@aglyn/plugins-ai 1.13.0 → 1.14.0

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.
Files changed (37) hide show
  1. package/package.json +17 -17
  2. package/src/lib/jobs/ai-site-import-compile.js +23 -3
  3. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  4. package/src/lib/layout-language/ai-layout-compiler.js +90 -8
  5. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  6. package/src/lib/layout-language/ai-layout-language.d.ts +8 -2
  7. package/src/lib/layout-language/ai-layout-language.js +4 -2
  8. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  9. package/src/lib/model/ai-site-import-fidelity.d.ts +9 -0
  10. package/src/lib/model/ai-site-import-fidelity.js +64 -6
  11. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  12. package/src/lib/model/ai-site-import.d.ts +7 -0
  13. package/src/lib/model/ai-site-import.js.map +1 -1
  14. package/src/lib/runtime/site-inventory.js +2 -3
  15. package/src/lib/runtime/site-inventory.js.map +1 -1
  16. package/src/lib/server/assist-view-context.js +3 -3
  17. package/src/lib/server/assist-view-context.js.map +1 -1
  18. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +12 -1
  19. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +19 -9
  20. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  21. package/src/lib/site-import/site-import-concealed.d.ts +30 -0
  22. package/src/lib/site-import/site-import-concealed.js +231 -0
  23. package/src/lib/site-import/site-import-concealed.js.map +1 -0
  24. package/src/lib/site-import/site-import-crawl.d.ts +3 -1
  25. package/src/lib/site-import/site-import-crawl.js +8 -1
  26. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  27. package/src/lib/site-import/site-import-css.js +13 -2
  28. package/src/lib/site-import/site-import-css.js.map +1 -1
  29. package/src/lib/site-import/site-import-html.d.ts +28 -0
  30. package/src/lib/site-import/site-import-html.js +246 -49
  31. package/src/lib/site-import/site-import-html.js.map +1 -1
  32. package/src/lib/site-import/site-import-layout.js +211 -12
  33. package/src/lib/site-import/site-import-layout.js.map +1 -1
  34. package/src/lib/site-import/site-import-page.js +2 -0
  35. package/src/lib/site-import/site-import-page.js.map +1 -1
  36. package/src/lib/testing/stand-in-dataset-index.js +6 -2
  37. package/src/lib/testing/stand-in-dataset-index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/site-import/site-import-layout.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE SOURCE'S LAYOUT, READ BY CODE (AGL-4106).\n *\n * An imported page used to be its lines and nothing else: every section\n * cut at an `h2`, every card a run of paragraphs, every icon gone, so the\n * page came out one column of text. This reads how the source lays the page\n * out, with no model, into a tree whose leaves are the page's own lines by\n * index (`SiteImportLayout`); the compile draws it with the site's own cards,\n * columns, pictures, icons and bands.\n *\n * - **Sections.** The source's own: the `<section>`s (or `<article>`s, or\n * labeled regions) its `<main>` is made of, else the containers of their\n * own that each hold a heading, else the stretches its `h1` and `h2` open.\n * The eyebrow that opens a section stays in it. Each gets its name (its\n * `aria-label`, else its heading) and its band, from its background: white\n * is `plain`, a light grey or tint `soft`, a strong color `brand`, a dark\n * color, a gradient or a photo `dark`.\n * - **Rows.** A container that lays its children side by side (a grid with\n * columns, a flex row, a grid framework's row and cells, a table row) is a\n * row; its columns' widths come from the grid template, the cells' sizes\n * or equal shares, in twelfths.\n * - **Placement (AGL-4152).** A grid whose children name where they go is read\n * in the rows and columns a visitor sees, whatever order its markup writes\n * them in: each child's box from its `grid-area`, `grid-row` or\n * `grid-column`, cells by row overlap and then column overlap, and rows\n * built to the same columns stacked into those columns, so a card's words\n * stay under its own heading. What comes out is rows, cells and groups like\n * any others. `order` on a flex or grid child is read the same way.\n * - **Groups.** Three or more siblings built alike (the same elements in the\n * same order) are a group, and what they hold says its kind: icon or\n * picture with a title and words are `cards`, a leading number `steps`, a\n * short figure over a label `stats`, questions with answers `faq`, quotes\n * `quotes`, pictures alone `logos`, a price with a period `pricing`.\n * Rows of cells built alike are a `table`; a `tablist` is `tabs`.\n * - **Pictures, icons, buttons.** Every picture where it sits (one inside a\n * button or a link too); every inline icon, once, by index; every link or\n * button the source draws as a button, filled (`primary`), outlined\n * (`secondary`) or plain (`quiet`).\n * - **Videos (AGL-4140).** Every video where it sits, its poster the picture\n * inside it; a film that plays on its own behind a section's words is that\n * section's backdrop.\n * - **The look.** The fonts (Google Fonts' named), the page's background and\n * text, the buttons' fill and corners, the links' color, the header's\n * background: what the look pass draws the site's theme from.\n *\n * Class names are hints a framework leaves (`MuiGrid-grid-md-4`, `col-md-6`),\n * never the rule: the reader reads what an element draws, through the page's\n * own stylesheets (`site-import-css.ts`). Nothing a page wrote runs.\n *=========================================*/\n\nimport {\n AI_SITE_IMPORT_MAX_SECTIONS,\n siteImportFilterNodes,\n siteImportLayoutLines,\n type SiteImportBand,\n type SiteImportButtonStyle,\n type SiteImportGroupKind,\n type SiteImportHeroPicture,\n type SiteImportIconTile,\n type SiteImportLayout,\n type SiteImportLayoutGroup,\n type SiteImportLayoutItem,\n type SiteImportLayoutLine,\n type SiteImportLayoutNode,\n type SiteImportLayoutSection,\n type SiteImportLayoutTable,\n type SiteImportLayoutTabs,\n type SiteImportLayoutVideo,\n type SiteImportLineRef,\n type SiteImportLookFacts,\n type SiteImportPictureFit,\n type SiteImportRule,\n} from '../model/ai-site-import'\nimport {\n SITE_IMPORT_CSS_WIDE_WIDTH,\n siteImportAspectRatio,\n siteImportBackgroundOf,\n siteImportBorderSides,\n siteImportColorDistance,\n siteImportColorOf,\n siteImportCssOf,\n siteImportPaletteOf,\n siteImportFontFamilies,\n siteImportFontSizePx,\n siteImportGridBoxes,\n siteImportGridColumns,\n siteImportHasBorder,\n siteImportHasShadow,\n siteImportHex,\n siteImportLengthPx,\n siteImportLuminance,\n siteImportOpaque,\n siteImportOrderOf,\n siteImportRadiusPx,\n siteImportSaturation,\n siteImportStylesOf,\n siteImportTwelfths,\n type SiteImportComputedStyle,\n type SiteImportGridBox,\n type SiteImportRgba,\n type SiteImportStyles,\n} from './site-import-css'\nimport { extractSiteImportPage, type SiteImportBlock, type SiteImportElement, type SiteImportExtract, type SiteImportStructure } from './site-import-html'\nimport { siteImportLabel } from './site-import-page'\n\n/** A page as the layout reader takes it: its blocks, its videos and how it is built. */\nexport type SiteImportLayoutSource = Pick<SiteImportExtract, 'blocks' | 'videos'> & { structure: SiteImportStructure }\n\n/** One thing in the page's order: a line (by its main-region index) or an icon. */\ninterface Leaf {\n /** Its place in the order a visitor reads the page: the markup's, but for what a grid or `order` moves (AGL-4152). */\n order: number\n /** Its place in the markup: the block's index, for a line. */\n written: number\n kind: 'line' | 'icon' | 'form' | 'video'\n /** The line's index among the main-region blocks; the icon's, the form's or the video's index. */\n ref: number\n element: number\n}\n\n/** A part of a container: one of its children with content, or a leaf directly in it. */\ntype Part = { element: number; first: number } | { leaf: Leaf; first: number }\n\nconst isElementPart = (part: Part): part is { element: number; first: number } => 'element' in part\n\n/** Whether a block is a line of its own: a link inside a sentence is in its sentence already. */\nfunction isLine(block: SiteImportBlock): boolean {\n if (block.kind === 'image') return !!block.url\n if (block.kind === 'link') return !block.inline && !!block.text.trim()\n return !!block.text.trim()\n}\n\nconst BUTTON_CLASS = /(?:^|[\\s_-])(?:btn|button)(?:$|[\\s_-])|Button-root|wp-block-button__link|sqs-block-button-element|elementor-button|w-button/i\nconst TEXT_BUTTON_CLASS = /MuiButton-text\\b|btn-link\\b|is-style-text/i\n/** An element's own `--primary` or `--secondary` (AGL-4152), whatever it is called, never a longer name that starts so (`--primary-inverse`). */\nconst OUTLINED_CLASS = /MuiButton-outlined\\b|btn-outline|is-style-outline|--outline|--secondary(?=\\s|$)|btn-secondary/i\nconst FILLED_CLASS = /MuiButton-contained\\b|btn-primary|--primary(?=\\s|$)|--solid|is-style-fill/i\nconst LANDMARK_TAGS = new Set(['section', 'article', 'aside'])\nconst SECTION_CLASS = /(?:^|[\\s_-])(?:section|page-section|wp-block-group|elementor-section|e-con|shopify-section|block-section)(?:$|[\\s_-])/i\nconst MUI_GRID_SIZE = /\\bMuiGrid-grid-(xs|sm|md|lg|xl)-(\\d+)\\b/g\nconst BOOTSTRAP_COL = /\\bcol-(?:(sm|md|lg|xl)-)?(\\d{1,2})\\b/g\nconst BREAKPOINT_RANK: Record<string, number> = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4 }\nconst PRICE = /(?:[$€£¥₹]\\s?\\d|\\d+(?:[.,]\\d+)?\\s?(?:USD|EUR|GBP|CAD|AUD)\\b)/\nconst PERIOD = /\\/\\s?(?:mo|month|yr|year|user|seat|site)\\b|\\bper (?:month|year|user|seat)\\b|\\bmonthly\\b|\\bannual(?:ly)?\\b|\\bbilled\\b|\\ba month\\b|\\ba year\\b/i\n/** A tag on an item: its longest words, and the corners a pill is drawn with. */\nconst BADGE_MAX_CHARS = 20\nconst BADGE_MAX_WORDS = 2\nconst BADGE_MIN_RADIUS = 12\n/** The longest line a price's period is: \"/mo\", \"per seat\". */\nconst PERIOD_MAX_CHARS = 12\n/** The columns a framework's own class caps itself at, where the page's sheets do not say. */\nconst WIDTH_CLASSES: ReadonlyArray<readonly [RegExp, number]> = [\n [/\\bMuiContainer-maxWidthXl\\b/, 1536],\n [/\\bMuiContainer-maxWidthLg\\b/, 1200],\n [/\\bMuiContainer-maxWidthMd\\b/, 900],\n [/\\bMuiContainer-maxWidthSm\\b/, 600],\n [/\\balignfull\\b/, 1536],\n [/\\balignwide\\b/, 1200],\n [/(?:^|\\s)container(?:\\s|$)/, 1320],\n]\nconst STEP_NUMBER = /^(?:step\\s*)?(?:0?\\d{1,2}|[ivx]{1,4})[.):]?$/i\nconst FIGURE = /^[^\\s]{0,3}[\\d][\\d.,:/x×+%kmb$€£-]*\\s?[^\\s]{0,12}$|^\\d+-[a-z]+$/i\n/** The width a page is read at for its tablet columns (AGL-4138): between a framework's `sm` and `md`. */\nconst TABLET_WIDTH = 768\n/** A paragraph set this much larger than the body, and bold, is a statement (AGL-4138), not a lede. */\nconst STATEMENT_SCALE = 1.75\nconst STATEMENT_MIN_PX = 28\nconst STATEMENT_MIN_WEIGHT = 600\n/** The widest square an icon's tile is (AGL-4138); wider, it is a card of its own. */\nconst TILE_MAX_PX = 64\n\n/**\n * The page's layout from its structure and its linked stylesheets' text,\n * over its main-region lines. `null` for a page with no structure or no main\n * content.\n */\nexport function siteImportLayout(page: SiteImportLayoutSource, stylesheets: readonly string[] = []): SiteImportLayout | null {\n const { structure, blocks } = page\n if (!structure) return null\n const { css, styles, darkStyles, sections } = readSections(page, stylesheets)\n if (!sections.length) return null\n return {\n v: 1,\n sections,\n icons: structure.icons.map((icon) => ({ ...icon })),\n look: siteImportLookFacts(structure, styles, css.fontFaces, blocks, sections, darkStyles, css.variableUses),\n }\n}\n\n/** A page's sections, as the layout reads them, with the stylesheets and styles they were read through. */\nfunction readSections(page: SiteImportLayoutSource, stylesheets: readonly string[]) {\n const { structure, blocks } = page\n const sheets = [...structure.styles, ...stylesheets]\n const css = siteImportCssOf(sheets)\n const styles = siteImportStylesOf(structure, css)\n const darkStyles = siteImportDarkStylesOf(structure, sheets)\n const reader = new LayoutReader(\n structure,\n blocks,\n styles,\n () => siteImportStylesOf(structure, siteImportCssOf(sheets, SITE_IMPORT_CSS_WIDE_WIDTH)),\n () => siteImportStylesOf(structure, siteImportCssOf(sheets, TABLET_WIDTH)),\n page.videos ?? [],\n darkStyles,\n )\n return { css, styles, darkStyles, sections: reader.sections() }\n}\n\n/** A page's styles in its dark scheme (AGL-4152), `null` where its stylesheets say nothing of one. */\nfunction siteImportDarkStylesOf(structure: SiteImportStructure, sheets: readonly string[]): SiteImportStyles | null {\n if (!sheets.some((sheet) => /dark/i.test(sheet))) return null\n const css = siteImportCssOf(sheets, undefined, { scheme: 'dark' })\n return css.darkRules ? siteImportStylesOf(structure, css) : null\n}\n\n/** A section's fill as the reader finds it: its band, what its color alone would call it, and the fill. */\ninterface ReadBand {\n band: SiteImportBand\n absolute?: SiteImportBand\n background: string | null\n backdrop?: SiteImportLayoutSection['backdrop']\n}\n\nclass LayoutReader {\n /** The page's elements; a grid placed by its children's rules holds the rows and cells a visitor sees (AGL-4152). */\n private readonly elements: SiteImportElement[]\n /** A grid read by its children's places: `stack` when its children now run down the page, `row` for a row of cells it draws. */\n private readonly placed = new Map<number, 'stack' | 'row'>()\n /** A cell's width on its grid, in tracks. */\n private readonly placedWidth = new Map<number, number>()\n /** A placed child that holds no words and has words laid over it. */\n private readonly placedBehind = new Set<number>()\n /** Block index → its index among the main-region blocks; -1 for every other block. */\n private readonly mainIndex: number[]\n /** Each element's leaves, its subtree's, in order (memoized). */\n private readonly leafMemo = new Map<number, Leaf[]>()\n /** Each element's own leaves. */\n private readonly own: Leaf[][]\n /** Tab panels a tab strip has read already. */\n private readonly usedPanels = new Set<number>()\n private bodySize = 16\n private wideStyles: SiteImportStyles | null = null\n private tabletStyles: SiteImportStyles | null = null\n /** The page's own ground, which a light band is read against (AGL-4152). */\n private readonly pageGround: SiteImportRgba | null\n\n constructor(\n private readonly structure: SiteImportStructure,\n private readonly blocks: readonly SiteImportBlock[],\n private readonly styles: SiteImportStyles,\n private readonly wideStylesOf: () => SiteImportStyles,\n private readonly tabletStylesOf: () => SiteImportStyles = () => styles,\n private readonly videos: NonNullable<SiteImportExtract['videos']> = [],\n private readonly darkStyles: SiteImportStyles | null = null,\n ) {\n this.elements = [...structure.elements]\n this.mainIndex = []\n let main = 0\n for (const block of blocks) this.mainIndex.push(block.region === 'main' ? main++ : -1)\n this.own = this.elements.map(() => [])\n structure.blockElement.forEach((element, index) => {\n const block = blocks[index]\n const ref = this.mainIndex[index] ?? -1\n if (!block || ref < 0 || !isLine(block)) return\n this.own[element]?.push({ order: index, written: index, kind: 'line', ref, element })\n })\n for (const element of this.elements) {\n if (element.region !== 'main' || element.nav) continue\n const order = element.order ?? 0\n if (element.icon !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'icon', ref: element.icon, element: element.id })\n if (element.form !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'form', ref: element.form, element: element.id })\n if (element.video !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'video', ref: element.video, element: element.id })\n }\n const body = structure.body >= 0 ? structure.body : -2\n this.bodySize = siteImportFontSizePx(styles.of(body)) ?? 16\n const ground = siteImportBackgroundOf(styles.of(body)).color ?? siteImportBackgroundOf(styles.of(-2)).color\n this.pageGround = ground && ground.a >= 0.5 ? ground : null\n this.readPlacement()\n }\n\n /*---------------- what a grid or `order` moves (AGL-4152) ----------------*/\n\n /**\n * The page as a visitor reads it: each flex or grid container whose children\n * say where they go, inner ones first, has its children set in that order.\n * Every container that says nothing is untouched, its order the markup's.\n */\n private readPlacement(): void {\n for (let id = this.elements.length - 1; id >= 0; id -= 1) {\n const node = this.elements[id] as SiteImportElement\n if (node.region !== 'main' || node.nav || node.children.length < 2) continue\n const style = this.style(id)\n const display = style.get('display') ?? ''\n if (!/\\b(?:grid|flex)\\b/.test(display)) continue\n if (/\\bgrid\\b/.test(display) && this.readGrid(id, style)) continue\n this.readOrder(id)\n }\n }\n\n /** A row's or a grid's children in their `order`, where any sets one. */\n private readOrder(element: number): void {\n const node = this.elements[element] as SiteImportElement\n const orderOf = (child: number) => siteImportOrderOf(this.style(child))\n const content = node.children.filter((child) => this.leaves(child).length)\n if (!content.some((child) => orderOf(child) !== 0)) return\n const sorted = content.map((child, at) => ({ child, at })).sort((a, b) => orderOf(a.child) - orderOf(b.child) || a.at - b.at).map((entry) => entry.child)\n this.setChildren(element, [...sorted, ...node.children.filter((child) => !content.includes(child))])\n this.moveLeaves(sorted)\n }\n\n /** A grid read by its children's boxes; `false`, and nothing changed, where they do not say where they go. */\n private readGrid(grid: number, style: SiteImportComputedStyle): boolean {\n const node = this.elements[grid] as SiteImportElement\n // What is not drawn takes no cell: it stays where it is read, after what is.\n const content = node.children.filter((child) => this.leaves(child).length && this.style(child).get('display') !== 'none')\n if (content.length < 2) return false\n const boxes = siteImportGridBoxes(style, content.map((child) => this.style(child)))\n if (!boxes) return false\n const items = content.map((element, at): PlacedItem => {\n const lines = this.leaves(element).filter((leaf) => leaf.kind === 'line').map((leaf) => this.block(leaf)?.kind)\n return {\n element,\n box: boxes[at] as SiteImportGridBox,\n words: lines.some((kind) => kind !== 'image'),\n heading: lines.includes('heading'),\n picture: lines.includes('image') || this.leaves(element).some((leaf) => leaf.kind === 'video'),\n }\n })\n for (const item of items) if (!item.words && items.some((other) => other.words && overLaid(other.box, item.box))) this.placedBehind.add(item.element)\n const bands = siteImportGridBands(items, (item) => this.placedBehind.has(item.element))\n const children = bands.flatMap((band) => (band.length === 1 ? (band[0] as DrawnCell).items.map((item) => item.element) : [this.drawnRow(grid, band)]))\n const rest = node.children.filter((child) => !content.includes(child))\n this.setChildren(grid, [...children, ...rest])\n this.placed.set(grid, 'stack')\n this.moveLeaves([...bands.flat().flatMap((cell) => cell.items.map((item) => item.element)), ...rest])\n return true\n }\n\n /** A row a placed grid draws: its cells side by side, each one child or the children stacked in it. */\n private drawnRow(grid: number, cells: readonly DrawnCell[]): number {\n const row = this.drawnElement(grid)\n this.placed.set(row, 'row')\n this.setChildren(\n row,\n cells.map((cell) => {\n const only = cell.items.length === 1 ? (cell.items[0] as PlacedItem).element : null\n const held = only ?? this.drawnElement(row)\n if (only === null) this.setChildren(held, cell.items.map((item) => item.element))\n this.placedWidth.set(held, cell.end - cell.start)\n return held\n }),\n )\n return row\n }\n\n /** A box the page does not write but draws, styled by nothing: its id is past every written element's. */\n private drawnElement(parent: number): number {\n const { region, nav } = this.elements[parent] as SiteImportElement\n const id = this.elements.length\n this.elements.push({ id, tag: 'div', parent, children: [], region, nav, attrs: {}, blocks: [] })\n this.own.push([])\n return id\n }\n\n private setChildren(element: number, children: number[]): void {\n this.elements[element] = { ...(this.elements[element] as SiteImportElement), children }\n for (const child of children) this.elements[child] = { ...(this.elements[child] as SiteImportElement), parent: element }\n this.leafMemo.clear()\n }\n\n /** These elements' leaves, in the order given, take the places they hold among themselves, so nothing around them moves. */\n private moveLeaves(elements: readonly number[]): void {\n const moved = elements.flatMap((element) => this.leaves(element))\n const places = moved.map((leaf) => leaf.order).sort((a, b) => a - b)\n moved.forEach((leaf, at) => {\n leaf.order = places[at] as number\n })\n this.leafMemo.clear()\n }\n\n /*---------------- leaves and parts ----------------*/\n\n leaves(element: number): Leaf[] {\n const held = this.leafMemo.get(element)\n if (held) return held\n const node = this.elements[element]\n if (!node) return []\n const list = [...(this.own[element] ?? [])]\n for (const child of node.children) list.push(...this.leaves(child))\n list.sort((a, b) => a.order - b.order)\n this.leafMemo.set(element, list)\n return list\n }\n\n private inRange(leaf: Leaf, range: readonly [number, number]): boolean {\n return leaf.order >= range[0] && leaf.order < range[1]\n }\n\n private parts(element: number, range: readonly [number, number]): Part[] {\n const node = this.elements[element]\n if (!node) return []\n const parts: Part[] = []\n for (const leaf of this.own[element] ?? []) if (this.inRange(leaf, range)) parts.push({ leaf, first: leaf.order })\n for (const child of node.children) {\n const first = this.leaves(child).find((leaf) => this.inRange(leaf, range))\n if (first) parts.push({ element: child, first: first.order })\n }\n return parts.sort((a, b) => a.first - b.first)\n }\n\n /** Down through wrappers that hold one part, to the element whose parts are the content. */\n private unwrap(element: number, range: readonly [number, number]): number {\n let at = element\n for (let guard = 0; guard < 64; guard += 1) {\n const parts = this.parts(at, range)\n if (parts.length !== 1 || !isElementPart(parts[0] as Part)) return at\n at = (parts[0] as { element: number }).element\n }\n return at\n }\n\n private style(element: number): SiteImportComputedStyle {\n return this.styles.of(element)\n }\n\n private block(leaf: Leaf): SiteImportBlock | undefined {\n return this.blocks[leaf.written]\n }\n\n /*---------------- sections ----------------*/\n\n sections(): SiteImportLayoutSection[] {\n const root = this.structure.main >= 0 ? this.structure.main : this.structure.body\n const all: readonly [number, number] = [-1, Number.POSITIVE_INFINITY]\n const rootLeaves = root >= 0 ? this.leaves(root) : this.elements.filter((element) => element.parent < 0).flatMap((element) => this.leaves(element.id))\n if (!rootLeaves.length) return []\n const container = root >= 0 ? this.unwrap(root, all) : -1\n const parts = container >= 0 ? this.parts(container, all) : []\n const elementParts = parts.filter(isElementPart)\n const landmarks = elementParts.filter((part) => this.isLandmark(part.element))\n let cuts: Cut[] = []\n if (elementParts.length >= 2 && landmarks.length >= Math.max(2, Math.ceil(elementParts.length / 2))) {\n // A container of its own among the landmarks (a post's article column) is a section too; a stray line joins the next.\n cuts = this.cutsAt(parts, (part) => this.isLandmark(part.element) || this.holdsHeading(part.element) || this.lineCount(part.element) >= 3, 'landmark')\n } else if (elementParts.length >= 2 && this.containersHoldSections(elementParts)) {\n cuts = this.cutsAt(parts, (part) => this.holdsHeading(part.element), 'container')\n }\n if (cuts.length < 2) cuts = this.headingCuts(rootLeaves)\n const sections: SiteImportLayoutSection[] = []\n for (const cut of cuts.slice(0, AI_SITE_IMPORT_MAX_SECTIONS * 2)) {\n const section = this.section(cut, container, sections.length)\n if (section) sections.push(section)\n }\n this.markHero(sections)\n return this.capSections(sections)\n }\n\n /** At most `AI_SITE_IMPORT_MAX_SECTIONS`: the last holds whatever follows. */\n private capSections(sections: SiteImportLayoutSection[]): SiteImportLayoutSection[] {\n if (sections.length <= AI_SITE_IMPORT_MAX_SECTIONS) return sections\n const kept = sections.slice(0, AI_SITE_IMPORT_MAX_SECTIONS)\n const last = kept[kept.length - 1] as SiteImportLayoutSection\n for (const extra of sections.slice(AI_SITE_IMPORT_MAX_SECTIONS)) {\n last.nodes.push(...extra.nodes)\n last.lines.push(...extra.lines)\n }\n return kept\n }\n\n private isLandmark(element: number): boolean {\n const node = this.elements[element]\n if (!node) return false\n if (LANDMARK_TAGS.has(node.tag)) return true\n if (node.attrs.role === 'region' || (node.attrs.label && /^(?:div|section)$/.test(node.tag))) return true\n return SECTION_CLASS.test(node.attrs.class ?? '')\n }\n\n private lineCount(element: number): number {\n return this.leaves(element).filter((leaf) => leaf.kind === 'line').length\n }\n\n private holdsHeading(element: number): boolean {\n return this.leaves(element).some((leaf) => {\n const block = this.block(leaf)\n return block?.kind === 'heading' && block.level <= 3\n })\n }\n\n /** Containers of their own, most of them holding a heading: a page builder's sections without the tag. */\n private containersHoldSections(parts: Array<{ element: number }>): boolean {\n const containers = parts.filter((part) => !/^(?:h[1-6]|p|ul|ol|li|a|img|span|strong|em|button|blockquote|figure|picture)$/.test(this.elements[part.element]?.tag ?? ''))\n if (containers.length < parts.length * 0.8) return false\n return containers.filter((part) => this.holdsHeading(part.element)).length >= Math.max(2, Math.ceil(containers.length * 0.6))\n }\n\n /** Sections at the parts `starts` picks; loose parts between them join the next one, or the last. */\n private cutsAt(parts: Part[], starts: (part: { element: number }) => boolean, from: SiteImportLayoutSection['from']): Cut[] {\n const cuts: Cut[] = []\n let pendingFrom: number | null = null\n for (const part of parts) {\n if (isElementPart(part) && starts(part)) {\n const leaves = this.leaves(part.element)\n const lo = Math.min(pendingFrom ?? Number.POSITIVE_INFINITY, (leaves[0] as Leaf).order)\n cuts.push({ element: pendingFrom === null ? part.element : null, anchor: part.element, range: [lo, (leaves[leaves.length - 1] as Leaf).order + 0.75], from })\n pendingFrom = null\n } else {\n pendingFrom = pendingFrom ?? part.first\n }\n }\n if (pendingFrom !== null) {\n const last = cuts[cuts.length - 1]\n if (last) {\n last.range[1] = Number.POSITIVE_INFINITY\n last.element = null\n } else cuts.push({ element: null, anchor: null, range: [pendingFrom, Number.POSITIVE_INFINITY], from })\n }\n // Ranges meet, so nothing between two sections is lost.\n for (let index = 1; index < cuts.length; index += 1) (cuts[index - 1] as Cut).range[1] = (cuts[index] as Cut).range[0]\n if (cuts[0]) {\n // Loose lines before the first section open it.\n if (cuts[0].range[0] > (parts[0]?.first ?? 0)) cuts[0].element = null\n cuts[0].range[0] = -1\n }\n if (cuts.length) (cuts[cuts.length - 1] as Cut).range[1] = Number.POSITIVE_INFINITY\n return cuts\n }\n\n /** Sections at the page's `h1` and `h2`, each opened by the eyebrow just above its heading. */\n private headingCuts(leaves: Leaf[]): Cut[] {\n const starts: number[] = []\n leaves.forEach((leaf, index) => {\n const block = this.block(leaf)\n if (block?.kind !== 'heading' || block.level > 2) return\n let at = index\n const before = leaves[index - 1]\n const previous = before ? this.block(before) : undefined\n if (before && previous?.kind === 'paragraph' && this.looksLikeEyebrow(before, previous.text)) at = index - 1\n const order = (leaves[at] as Leaf).order\n if (!starts.length || order > (starts[starts.length - 1] as number)) starts.push(order)\n })\n if (!starts.length || starts[0] !== (leaves[0] as Leaf).order) starts.unshift(-1)\n return starts.map((start, index) => ({\n element: null,\n anchor: null,\n range: [index === 0 ? -1 : start, starts[index + 1] ?? Number.POSITIVE_INFINITY] as [number, number],\n from: 'heading' as const,\n }))\n }\n\n private section(cut: Cut, container: number, index: number): SiteImportLayoutSection | null {\n const { element, range, from } = cut\n const scope = element ?? container\n let nodes = scope >= 0 ? this.read(scope, range) : this.readLeaves(range)\n const name = this.nameOf(cut.anchor, this.linesOf(nodes), index)\n let band = cut.anchor !== null ? this.bandOf(cut.anchor, false) : this.bandOf(container, true)\n // A film playing on its own behind the words is the section's backdrop (AGL-4140), its poster the first paint.\n const behind = band.backdrop ? undefined : this.videoBehind(nodes)\n if (behind) {\n nodes = withoutVideo(nodes, behind.video)\n band = { band: 'dark', background: band.background, backdrop: { kind: 'video', video: behind.video, ...(behind.poster !== undefined ? { poster: behind.poster } : {}) } }\n }\n // Its fill in the page's dark scheme, read as its fill is, where that scheme changes it.\n const dark = this.darkStyles ? (cut.anchor !== null ? this.bandOf(cut.anchor, false, this.darkStyles) : this.bandOf(container, true, this.darkStyles)) : null\n const lines = behind?.poster !== undefined ? [behind.poster, ...this.linesOf(nodes)] : this.linesOf(nodes)\n if (!lines.length && !behind && !nodes.some((node) => node.kind === 'icon' || node.kind === 'form' || node.kind === 'video')) return null\n const width = this.widthOf(cut.anchor ?? container)\n const align = this.alignOf(scope, lines)\n keepOwnAlign(nodes, align)\n return {\n name,\n from,\n band: band.band,\n ...(band.absolute && band.absolute !== band.band ? { absoluteBand: band.absolute } : {}),\n background: band.background,\n ...(dark?.background && dark.background !== band.background ? { darkBackground: dark.background } : {}),\n ...(band.backdrop ? { backdrop: band.backdrop } : {}),\n align,\n ...(width !== null ? { width } : {}),\n nodes,\n lines,\n }\n }\n\n /** Lines with no container to read them through: one after another. */\n private readLeaves(range: [number, number]): SiteImportLayoutNode[] {\n const leaves = this.elements.filter((element) => element.parent < 0).flatMap((element) => this.leaves(element.id))\n // A video's poster is its own, never a picture beside it.\n return leaves.filter((leaf) => this.inRange(leaf, range) && (leaf.kind === 'video' || this.videoHolding(leaf.element) === null)).map((leaf) => this.leafNode(leaf))\n }\n\n private nameOf(element: number | null, lines: SiteImportLineRef[], index: number): string {\n const label = element !== null ? this.elements[element]?.attrs.label : undefined\n if (label) return siteImportLabel(label)\n const mainBlocks = this.mainBlocks()\n const heading =\n lines.map((ref) => mainBlocks[ref]).find((block) => block?.kind === 'heading' && block.level <= 2) ??\n lines.map((ref) => mainBlocks[ref]).find((block) => block?.kind === 'heading')\n const text = heading && heading.kind === 'heading' ? siteImportLabel(heading.text) : ''\n if (text) return text\n const first = lines.map((ref) => mainBlocks[ref]).find((block) => block && block.kind !== 'image')\n const line = first && first.kind !== 'image' && first.text.length <= 60 ? siteImportLabel(first.text) : ''\n return line || `Section ${index + 1}`\n }\n\n private mainBlocksMemo: SiteImportBlock[] | null = null\n private mainBlocks(): SiteImportBlock[] {\n this.mainBlocksMemo ??= this.blocks.filter((block) => block.region === 'main')\n return this.mainBlocksMemo\n }\n\n /*---------------- bands ----------------*/\n\n /** An element and the wrappers inside it that hold all it holds, one in another. */\n private wrappersOf(element: number): number[] {\n const chain: number[] = []\n let at = element\n for (let depth = 0; depth < 4 && at >= 0; depth += 1) {\n chain.push(at)\n const children = (this.elements[at]?.children ?? []).filter((child) => this.leaves(child).length)\n if (children.length !== 1) break\n at = children[0] as number\n }\n return chain\n }\n\n private bandOf(element: number, inherited: boolean, styles: SiteImportStyles = this.styles): ReadBand {\n // The section's own background, else the one wrapper inside it that covers it.\n const chain = inherited ? [] : this.wrappersOf(element)\n for (const at of chain) {\n const found = this.backgroundBand(at, styles)\n if (found) return found\n }\n // None of its own: the page's, under it.\n for (let at = inherited ? element : (this.elements[element]?.parent ?? -1); at >= 0; at = this.elements[at]?.parent ?? -1) {\n const found = this.backgroundBand(at, styles)\n if (found) return found\n }\n return this.backgroundBand(-2, styles) ?? { band: 'plain', background: null }\n }\n\n private backgroundBand(element: number, styles: SiteImportStyles): ReadBand | null {\n const style = styles.of(element)\n const background = siteImportBackgroundOf(style)\n const hex = background.color && background.color.a >= 0.5 ? siteImportHex(background.color) : null\n if (background.image && !/\\.svg(?:$|\\?)/i.test(background.image)) {\n return { band: 'dark', background: hex, backdrop: { kind: 'picture', url: background.image } }\n }\n if (background.gradient) {\n const stops = background.gradient.filter((stop) => stop.a > 0.1)\n const light = stops.length ? stops.reduce((sum, stop) => sum + siteImportLuminance(stop), 0) / stops.length : 1\n return { band: light < 0.55 ? 'dark' : 'soft', background: hex, backdrop: { kind: 'gradient' } }\n }\n if (background.color && background.color.a >= 0.5) return { band: siteImportBandOn(background.color, this.pageGround), absolute: siteImportBandOfColor(background.color), background: hex }\n const theme = this.elements[element]?.attrs.theme\n if (theme) {\n if (/^(?:dark|black)/.test(theme)) return { band: 'dark', background: null }\n if (/^bright/.test(theme)) return { band: 'brand', background: null }\n if (/^light/.test(theme)) return { band: 'soft', background: null }\n if (/^white/.test(theme)) return { band: 'plain', background: null }\n }\n return null\n }\n\n /*---------------- widths ----------------*/\n\n /** The cap one element sets, in px: its own rule on a wide screen, else what its framework's class says. */\n private capOf(element: number): number | null {\n this.wideStyles ??= this.wideStylesOf()\n const style = this.wideStyles.of(element)\n for (const property of ['max-width', 'width']) {\n const value = style.get(property)\n const px = value ? siteImportLengthPx(value) : null\n if (px !== null && px > 0) return px\n }\n const classes = this.elements[element]?.attrs.class ?? ''\n return WIDTH_CLASSES.find(([pattern]) => pattern.test(classes))?.[1] ?? null\n }\n\n /** The narrowest cap a section's content sits under: on it, around it, or on the wrappers inside it. */\n private widthOf(element: number): number | null {\n if (element < 0) return null\n const around: number[] = []\n for (let at = this.elements[element]?.parent ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) around.push(at)\n const caps = [...around, ...this.wrappersOf(element)].flatMap((at) => this.capOf(at) ?? [])\n return caps.length ? Math.min(...caps) : null\n }\n\n private alignOf(scope: number, lines: SiteImportLineRef[]): 'start' | 'center' {\n const mainBlocks = this.mainBlocks()\n const heading = lines.find((ref) => mainBlocks[ref]?.kind === 'heading')\n if (heading === undefined || scope < 0) return 'start'\n const leaf = this.leaves(scope).find((entry) => entry.kind === 'line' && entry.ref === heading)\n if (!leaf) return 'start'\n return this.style(leaf.element).get('text-align') === 'center' ? 'center' : 'start'\n }\n\n /*---------------- reading a container ----------------*/\n\n private read(element: number, range: readonly [number, number]): SiteImportLayoutNode[] {\n const node = this.elements[element]\n if (!node) return []\n // A video is one node, whatever its marker holds: its poster (AGL-4140).\n if (node.video !== undefined) return [this.videoNode(element, range)]\n if (node.tag === 'table') {\n const table = this.table(element, range)\n if (table) return [table]\n }\n const parts = this.parts(element, range)\n if (!parts.length) return []\n if (parts.length === 1) {\n const only = parts[0] as Part\n return isElementPart(only) ? this.read(only.element, range) : [this.leafNode(only.leaf)]\n }\n const strips = this.tabStrips().get(element)\n if (strips) return this.readTabs(element, strips, range)\n const table = this.gridTable(element, parts, range)\n if (table) return [table]\n const runs = this.groupRuns(element, parts, range)\n const elementParts = parts.filter(isElementPart)\n // Items built alike are a group, a heading over them included; only a container of unlike parts is a row of columns.\n if (!runs.length && elementParts.length >= 2 && this.isRow(element)) {\n // A child laid out of the flow takes no cell of the row (AGL-4152): a section's picture laid behind its words.\n const inFlow = parts.filter((part) => !isElementPart(part) || !this.outOfFlow(part.element))\n if (this.rowWorthy(inFlow, range)) {\n const laid = elementParts.filter((part) => this.outOfFlow(part.element)).flatMap((part) => this.read(part.element, range))\n return [...laid, this.row(element, inFlow, range)]\n }\n }\n const out: SiteImportLayoutNode[] = []\n for (let index = 0; index < parts.length; ) {\n const run = runs.find((entry) => entry.start === index)\n if (run) {\n out.push(this.group(element, parts.slice(run.start, run.end) as Array<{ element: number; first: number }>, range))\n index = run.end\n continue\n }\n const part = parts[index] as Part\n if (isElementPart(part)) out.push(...this.read(part.element, range))\n else out.push(this.leafNode(part.leaf))\n index += 1\n }\n return out\n }\n\n private leafNode(leaf: Leaf): SiteImportLayoutNode {\n if (leaf.kind === 'icon') return { kind: 'icon', icon: leaf.ref }\n if (leaf.kind === 'form') return { kind: 'form', form: leaf.ref }\n if (leaf.kind === 'video') return this.videoNode(leaf.element, [-1, Number.POSITIVE_INFINITY])\n const block = this.block(leaf)\n if (block?.kind === 'image') {\n const wrap = this.wrapperOf(leaf.element, ['a', 'button'], 4)\n const href = wrap !== null && this.elements[wrap]?.tag === 'a' ? this.anchorHref(wrap) : null\n const fit = this.pictureFit(leaf)\n return {\n kind: 'picture',\n line: leaf.ref,\n ...(href ? { href } : {}),\n ...(wrap !== null && this.elements[wrap]?.tag === 'button' ? { button: true as const } : {}),\n ...(fit ? { fit } : {}),\n }\n }\n const button = this.buttonStyle(leaf)\n const role = button ? undefined : this.roleOf(leaf)\n const line: SiteImportLayoutLine = { kind: 'line', line: leaf.ref, ...(role ? { role } : {}), ...(button ? { button } : {}) }\n if (role === 'eyebrow') {\n // An eyebrow's own pill and color (AGL-4138): the hero's chip, a section's magenta label.\n if (this.inPill(leaf)) line.chip = true\n const ink = this.inkOf(leaf.element)\n if (ink) line.color = ink\n }\n return line\n }\n\n /*---------------- pictures, inks and tiles (AGL-4138) ----------------*/\n\n /**\n * How the source frames a picture: its own shape from its `width` and\n * `height`; the box around it that sets an `aspect-ratio`, or a height it\n * fills or is held to, which crops it; its fit; its corners and shadow, on\n * it or on a box within two levels that holds no other line.\n */\n private pictureFit(leaf: Leaf): SiteImportPictureFit | undefined {\n const element = leaf.element\n const node = this.elements[element]\n if (!node) return undefined\n const own = this.style(element)\n const fit: SiteImportPictureFit = {}\n if (node.attrs.width && node.attrs.height) fit.ratio = Math.round((node.attrs.width / node.attrs.height) * 10_000) / 10_000\n const objectFit = own.get('object-fit')\n if (objectFit === 'cover' || objectFit === 'contain') fit.objectFit = objectFit\n // The picture fills its box where it is set to the box's whole height.\n const fills = /^100%$/.test(own.get('height')?.trim() ?? '')\n for (let at = element, depth = 0; at >= 0 && depth <= 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (depth > 0 && this.leaves(at).some((other) => other.kind === 'line' && other.order !== leaf.order)) break\n const style = this.style(at)\n const box = siteImportAspectRatio(style.get('aspect-ratio'))\n if (box !== null && fit.box === undefined && fit.height === undefined) fit.box = Math.round(box * 10_000) / 10_000\n const height = siteImportLengthPx(style.get('height') ?? '')\n if (height !== null && height > 0 && fit.box === undefined && fit.height === undefined && (depth === 0 || fills)) fit.height = height\n const radius = siteImportRadiusPx(style)\n if (radius !== null && radius > 0 && fit.radius === undefined) fit.radius = Math.min(radius, 999)\n if (siteImportHasShadow(style)) fit.shadow = true\n const cap = siteImportLengthPx(style.get('max-width') ?? '')\n if (cap !== null && cap > 0 && fit.measure === undefined) fit.measure = cap\n }\n return Object.keys(fit).length ? fit : undefined\n }\n\n /** An element's words' color as it shows over the ground under it, `#rrggbb`; `null` where it sets none. */\n private inkOf(element: number): string | null {\n const color = siteImportColorOf(this.style(element).get('color'))\n if (!color || color.a < 0.05) return null\n return siteImportHex(siteImportOpaque(color, siteImportColorOf(this.backgroundUnder(element) ?? undefined)))\n }\n\n /** Whether a line sits in a pill of its own: its element, or the wrapper holding only it, filled or bordered and rounded to a pill. */\n private inPill(leaf: Leaf): boolean {\n for (let at = leaf.element, depth = 0; at >= 0 && depth < 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).length !== 1) return false\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n const filled = !!fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)\n if ((filled || siteImportHasBorder(style)) && (siteImportRadiusPx(style) ?? 0) >= BADGE_MIN_RADIUS) return true\n }\n return false\n }\n\n /**\n * The filled square an icon sits in: the nearest element above it, within\n * two levels and inside its item, holding nothing but the icon, no wider\n * than a tile, whose fill is not the ground under it.\n */\n private tileOf(icon: Leaf, item: number): SiteImportIconTile | undefined {\n for (let at = this.elements[icon.element]?.parent ?? -1, depth = 0; at >= 0 && depth < 2 && at !== item; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).some((leaf) => leaf.kind === 'line')) return undefined\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n if (!fill || fill.a < 0.5 || siteImportHex(fill) === this.backgroundUnder(at)) continue\n const width = siteImportLengthPx(style.get('width') ?? '')\n if (width === null || width > TILE_MAX_PX) continue\n const radius = siteImportRadiusPx(style)\n return { fill: siteImportHex(fill), radius: radius === null ? 0 : Math.min(radius, 999), color: this.inkOf(icon.element) }\n }\n return undefined\n }\n\n /** The nearest element of these tags at or above `element`, within `depth` levels. */\n private wrapperOf(element: number, tags: readonly string[], depth: number): number | null {\n let at = element\n for (let level = 0; level <= depth && at >= 0; level += 1) {\n const node = this.elements[at]\n if (!node) return null\n if (tags.includes(node.tag)) return at\n at = node.parent\n }\n return null\n }\n\n private anchorHref(element: number): string | null {\n const anchor = this.structure.anchors.find((entry) => entry.element === element)\n return anchor?.href ?? null\n }\n\n /*---------------- videos (AGL-4140) ----------------*/\n\n /** A video where it sits: its poster, the picture inside its marker, and whether the box it plays in casts a shadow. */\n private videoNode(element: number, range: readonly [number, number]): SiteImportLayoutVideo {\n const node = this.elements[element] as SiteImportElement\n const poster = this.leaves(element).find((leaf) => leaf.kind === 'line' && this.inRange(leaf, range) && this.block(leaf)?.kind === 'image')\n let shadow = false\n // The box around it, as far up as a wrapper holds nothing else.\n for (let at = element, depth = 0; at >= 0 && depth < 3 && !shadow; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).some((leaf) => leaf.kind === 'line' && leaf.element !== poster?.element)) break\n shadow = siteImportHasShadow(this.style(at))\n }\n const fit = poster ? this.pictureFit(poster) : undefined\n return { kind: 'video', video: node.video as number, ...(poster ? { poster: poster.ref } : {}), ...(fit ? { fit } : {}), ...(shadow ? { shadow: true as const } : {}) }\n }\n\n /** The video marker an element sits in, or is, within a few levels; `null` for none. */\n private videoHolding(element: number): number | null {\n for (let at = element, depth = 0; at >= 0 && depth < 4; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.elements[at]?.video !== undefined) return at\n }\n return null\n }\n\n /**\n * The film a section plays on its own behind its words (AGL-4140): one that\n * starts by itself, its place laid over the section (absolute or fixed, at\n * most three levels up), as a picture behind the words is.\n */\n private videoBehind(nodes: readonly SiteImportLayoutNode[]): SiteImportLayoutVideo | null {\n for (const node of siteImportVideoNodes(nodes)) {\n if (!this.videos[node.video]?.autoplay) continue\n const element = this.elements.find((entry) => entry.video === node.video)\n for (let at = element?.id ?? -1, depth = 0; at >= 0 && depth < 4; at = this.elements[at]?.parent ?? -1, depth += 1) {\n const position = this.style(at).get('position')\n if (position === 'absolute' || position === 'fixed') return node\n }\n }\n return null\n }\n\n /** How the source draws a line as a button, when it does. */\n private buttonStyle(leaf: Leaf): SiteImportButtonStyle | undefined {\n const block = this.block(leaf)\n if (!block || (block.kind !== 'link' && block.kind !== 'paragraph')) return undefined\n const host = this.wrapperOf(leaf.element, block.kind === 'link' ? ['a'] : ['button'], 3)\n if (host === null) return undefined\n const node = this.elements[host] as SiteImportElement\n if (node.attrs.role === 'tab') return undefined\n return siteImportButtonStyleOf(node, this.style(host), this.backgroundUnder(host)) ?? undefined\n }\n\n /** The background an element is drawn on: its nearest ancestor's. */\n private backgroundUnder(element: number): string | null {\n for (let at = this.elements[element]?.parent ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) {\n const color = siteImportBackgroundOf(this.style(at)).color\n if (color && color.a >= 0.5) return siteImportHex(color)\n }\n const page = siteImportBackgroundOf(this.style(-2)).color\n return page ? siteImportHex(page) : '#ffffff'\n }\n\n /** An eyebrow, a lede, a statement or a note, where the source's styling says so. */\n private roleOf(leaf: Leaf): SiteImportLayoutLine['role'] {\n const block = this.block(leaf)\n if (block?.kind !== 'paragraph') return undefined\n const style = this.style(leaf.element)\n if (this.looksLikeEyebrow(leaf, block.text)) return 'eyebrow'\n const size = siteImportFontSizePx(style)\n // A paragraph set as large as a heading, and bold, is a statement (AGL-4138): \"Most website builders hand you a blank page…\".\n if (size !== null && (size >= this.bodySize * STATEMENT_SCALE || size >= STATEMENT_MIN_PX) && siteImportFontWeight(style) >= STATEMENT_MIN_WEIGHT && block.text.length > 40) return 'statement'\n if (size !== null && size >= this.bodySize * 1.12 && block.text.length > 40) return 'lede'\n if (size !== null && size <= this.bodySize * 0.875 && block.text.length <= 160) return 'note'\n return undefined\n }\n\n private looksLikeEyebrow(leaf: Leaf, text: string): boolean {\n return siteImportIsEyebrowText(text, this.style(leaf.element))\n }\n\n /*---------------- rows ----------------*/\n\n private isRow(element: number): boolean {\n const node = this.elements[element]\n if (!node) return false\n const placed = this.placed.get(element)\n if (placed) return placed === 'row'\n if (node.tag === 'tr') return true\n const classes = node.attrs.class ?? ''\n if (/\\bMuiGrid-container\\b|(?:^|\\s)row(?:\\s|$)|\\bcolumns\\b|wp-block-columns|elementor-row|e-con-inner|sqs-row/.test(classes)) return true\n const style = this.style(element)\n const display = style.get('display') ?? ''\n if (/\\bgrid\\b/.test(display)) {\n const columns = siteImportGridColumns(style.get('grid-template-columns'))\n return !!columns && columns.length >= 2\n }\n if (/\\bflex\\b/.test(display)) return !/column/.test(style.get('flex-direction') ?? 'row')\n return false\n }\n\n private outOfFlow(element: number): boolean {\n return /^(?:absolute|fixed)$/.test(this.style(element).get('position') ?? '')\n }\n\n /** A row is columns of content, not a line of buttons or links. */\n private rowWorthy(parts: Part[], range: readonly [number, number]): boolean {\n const substantial = parts.filter((part) => {\n if (!isElementPart(part)) return false\n return this.leaves(part.element).some((leaf) => {\n if (!this.inRange(leaf, range)) return false\n if (leaf.kind === 'video') return true\n if (leaf.kind !== 'line') return false\n const block = this.block(leaf)\n return block?.kind === 'image' || block?.kind === 'heading' || ((block?.kind === 'paragraph' || block?.kind === 'list-item' || block?.kind === 'quote') && !this.buttonStyle(leaf))\n })\n })\n return substantial.length >= 2\n }\n\n private row(element: number, parts: Part[], range: readonly [number, number]): SiteImportLayoutNode {\n const cells: SiteImportLayoutNode[][] = parts.map((part) => (isElementPart(part) ? this.read(part.element, range) : [this.leafNode(part.leaf)]))\n const weights = this.weightsOf(element, parts)\n // Cells that are each one group of one kind are one group in columns.\n const groups = cells.map((cell) => (cell.length === 1 && cell[0]?.kind === 'group' ? (cell[0] as SiteImportLayoutGroup) : null))\n if (cells.length >= 2 && groups.every((group) => group && !group.inline && group.group === groups[0]?.group && group.columns === 1)) {\n const first = groups[0] as SiteImportLayoutGroup\n const boxed = groups.every((group) => group?.boxed)\n // Framed in every cell but not boxed in all of them: the rule they draw (AGL-4138).\n const rule = !boxed && groups.every((group) => group?.boxed || group?.rule) ? groups.find((group) => group?.rule)?.rule : undefined\n return { kind: 'group', group: first.group, columns: cells.length, boxed, ...(rule ? { rule } : {}), items: groups.flatMap((group) => group?.items ?? []) }\n }\n return { kind: 'row', cols: siteImportTwelfths(weights), cells: cells.map((nodes) => ({ nodes })) }\n }\n\n /** The columns' relative widths: the grid template, the cells' own sizes, else equal shares. */\n private weightsOf(element: number, parts: Part[]): number[] {\n const count = parts.length\n const template = siteImportGridColumns(this.style(element).get('grid-template-columns'))\n if (template && template.length >= count) return template.slice(0, count)\n const sized = parts.map((part) => (isElementPart(part) ? this.cellSize(part.element) : null))\n if (sized.every((size) => size !== null)) return sized as number[]\n return parts.map(() => 1)\n }\n\n /** A cell's size: a framework's column class, its width share or its flex grow. */\n private cellSize(element: number): number | null {\n const placed = this.placedWidth.get(element)\n if (placed !== undefined) return placed\n const classes = this.elements[element]?.attrs.class ?? ''\n let best: { rank: number; size: number } | null = null\n for (const match of classes.matchAll(MUI_GRID_SIZE)) {\n const rank = BREAKPOINT_RANK[match[1] as string] ?? 0\n if (rank <= 3 && (!best || rank >= best.rank)) best = { rank, size: Number(match[2]) }\n }\n for (const match of classes.matchAll(BOOTSTRAP_COL)) {\n const rank = match[1] ? (BREAKPOINT_RANK[match[1]] ?? 0) : 0\n if (rank <= 3 && (!best || rank >= best.rank)) best = { rank, size: Number(match[2]) }\n }\n if (best) return best.size\n const style = this.style(element)\n for (const property of ['flex-basis', 'width', 'max-width']) {\n const percent = /^(-?[\\d.]+)%$/.exec(style.get(property)?.trim() ?? '')\n if (percent) return Number(percent[1])\n }\n const grow = /^(\\d+(?:\\.\\d+)?)(?:\\s|$)/.exec(style.get('flex')?.trim() ?? style.get('flex-grow')?.trim() ?? '')\n if (grow && Number(grow[1]) > 0) return Number(grow[1])\n return null\n }\n\n /*---------------- groups ----------------*/\n\n private signature(element: number, range: readonly [number, number]): string {\n const at = this.unwrap(element, range)\n return this.parts(at, range)\n .map((part) => (isElementPart(part) ? (this.elements[part.element]?.tag ?? '') : part.leaf.kind !== 'line' ? part.leaf.kind : (this.block(part.leaf)?.kind ?? '')))\n .join(',')\n }\n\n /** The kinds of an item's leaves in order, repeats folded: a looser likeness. */\n private kinds(element: number, range: readonly [number, number]): string {\n const out: string[] = []\n for (const leaf of this.leaves(element)) {\n if (!this.inRange(leaf, range)) continue\n const kind = leaf.kind !== 'line' ? leaf.kind : (this.block(leaf)?.kind ?? '')\n if (out[out.length - 1] !== kind) out.push(kind)\n }\n return out.join(',')\n }\n\n /** Runs of three or more siblings built alike (two, when a row draws them as boxes). */\n private groupRuns(element: number, parts: Part[], range: readonly [number, number]): GroupRun[] {\n // A strip of short words side by side (a row of site kinds, a post's tags) is one group.\n if (parts.length >= 4 && this.isRow(element) && parts.every((part) => isElementPart(part) && this.isChip(part.element, range))) return [{ start: 0, end: parts.length }]\n const keys = parts.map((part) => (isElementPart(part) && this.couldBeItem(part.element, range) ? `${this.elements[part.element]?.tag}|${this.signature(part.element, range)}` : null))\n const loose = parts.map((part) => (isElementPart(part) ? this.kinds(part.element, range) : null))\n const runs: GroupRun[] = []\n const row = this.isRow(element)\n for (let index = 0; index < parts.length; ) {\n const key = keys[index]\n const kind = loose[index]\n if (key === null || key === undefined) {\n index += 1\n continue\n }\n let end = index + 1\n while (end < parts.length && keys[end] !== null && (keys[end] === key || (loose[end] === kind && !!kind && kind.includes(',')))) end += 1\n const count = end - index\n const boxed = count === 2 && row && parts.slice(index, end).every((part) => isElementPart(part) && this.framed(part.element))\n // One element alone (a single list item) is not a group; a heading leaf is never an item.\n const items = parts.slice(index, end) as Array<{ element: number }>\n const headings = items.every((part) => /^h[1-6]$/.test(this.elements[part.element]?.tag ?? ''))\n if ((count >= 3 || boxed) && !headings) {\n runs.push({ start: index, end })\n index = end\n } else index += 1\n }\n return runs\n }\n\n /**\n * Whether an element can be one item of a group: a list item, a disclosure,\n * a figure, a picture, or a container of more than one thing. A run of\n * plain paragraphs is prose, never a group.\n */\n private couldBeItem(element: number, range: readonly [number, number]): boolean {\n const node = this.elements[element]\n if (!node) return false\n // A row of a placed grid holds items; it is never one.\n if (this.placed.get(element) === 'row') return false\n if (/^(?:li|dt|dd|details|figure|article)$/.test(node.tag)) return true\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n if (leaves.length && leaves.every((leaf) => leaf.kind === 'line' && this.block(leaf)?.kind === 'image')) return true\n return this.parts(this.unwrap(element, range), range).length >= 2\n }\n\n /** One short line and nothing else: a chip, a tag, a strip's entry. */\n private isChip(element: number, range: readonly [number, number]): boolean {\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n const lines = leaves.filter((leaf) => leaf.kind === 'line')\n if (lines.length !== 1) return false\n // A short line with a mark of its own and no pill around it is a checklist's line, not a tag (AGL-4138).\n if (leaves.some((leaf) => leaf.kind === 'icon') && !this.framed(element)) return false\n const block = this.block(lines[0] as Leaf)\n return !!block && block.kind !== 'image' && block.kind !== 'heading' && block.text.length <= 40\n }\n\n /**\n * How an item is drawn apart from the page (AGL-4138), it and the wrappers\n * inside it that hold all it holds: a BOX is a shadow, a fill of its own or\n * a border on two sides or more; a RULE a border on one side only, a step's\n * line over its number. Either one makes it framed.\n */\n private frameOf(element: number): { box: boolean; rule: SiteImportRule | null } {\n let rule: SiteImportRule | null = null\n let at = element\n for (let depth = 0; depth < 3 && at >= 0; depth += 1) {\n const style = this.style(at)\n if (siteImportHasShadow(style)) return { box: true, rule: null }\n const fill = siteImportBackgroundOf(style).color\n if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)) return { box: true, rule: null }\n const sides = siteImportBorderSides(style)\n const drawn = (Object.keys(sides) as Array<keyof typeof sides>).filter((side) => sides[side])\n if (drawn.length >= 2) return { box: true, rule: null }\n const side = drawn[0]\n if (side && !rule) {\n const border = sides[side] as { width: number; color: SiteImportRgba | null }\n const under = siteImportColorOf(this.backgroundUnder(at) ?? undefined)\n rule = { side, width: Math.max(1, Math.round(border.width)), color: border.color && border.color.a >= 0.05 ? siteImportHex(siteImportOpaque(border.color, under)) : null }\n }\n const children = (this.elements[at]?.children ?? []).filter((child) => this.leaves(child).length)\n if (children.length !== 1) break\n at = children[0] as number\n }\n return { box: false, rule }\n }\n\n /** Whether an item is drawn apart from the page at all: a box or a rule (a border on any side, a shadow, a fill of its own). */\n private framed(element: number): boolean {\n const frame = this.frameOf(element)\n return frame.box || !!frame.rule\n }\n\n private group(container: number, parts: Array<{ element: number; first: number }>, range: readonly [number, number]): SiteImportLayoutGroup {\n const items = parts.map((part) => this.item(part.element, range))\n const chips = parts.length >= 4 && this.isRow(container) && parts.every((part) => this.isChip(part.element, range))\n const kind = chips ? 'logos' : this.groupKind(parts.map((part) => part.element), items, range)\n const columns = this.columnsOf(container, parts)\n const frames = parts.map((part) => this.frameOf(part.element))\n const half = Math.ceil(parts.length / 2)\n const boxed = parts.length > 0 && frames.filter((frame) => frame.box).length >= half\n // Framed, most of them, but not boxed: the rule the first of them draws (AGL-4138).\n const ruled = !boxed && frames.filter((frame) => frame.box || frame.rule).length >= half ? (frames.find((frame) => frame.rule)?.rule ?? null) : null\n // A step's number and a stat's figure lead their item.\n if (kind === 'steps' || kind === 'stats') {\n for (const item of items) {\n const lead = item.title ?? item.text?.[0]\n const text = lead !== undefined ? this.lineText(lead) : ''\n if (lead !== undefined && (kind === 'steps' ? STEP_NUMBER.test(text.trim()) : FIGURE.test(text.trim()) || text.length <= 14)) {\n item.figure = lead\n if (item.title === lead) {\n delete item.title\n const next = item.text?.find((ref) => this.lineText(ref).length <= 80)\n if (next !== undefined && (item.text?.length ?? 0) > 1) {\n item.title = next\n dropLine(item, 'text', next)\n }\n } else dropLine(item, 'text', lead)\n if (item.text && !item.text.length) delete item.text\n }\n }\n // A step's number the source sets in its muted words' grey, not its brand (AGL-4138).\n items.forEach((item, at) => {\n const leaf = item.figure === undefined ? undefined : this.leaves(parts[at]?.element ?? -1).find((entry) => entry.kind === 'line' && entry.ref === item.figure)\n const ink = leaf ? this.inkOf(leaf.element) : null\n if (ink && siteImportIsMutedInk(ink)) item.figureMuted = true\n })\n }\n if (kind === 'faq') {\n for (const item of items) {\n const question = item.lines[0]\n if (question === undefined || item.title === question) continue\n // The question names it; whatever named it before is its words.\n if (item.title !== undefined) item.text = [item.title, ...(item.text ?? [])].sort((a, b) => item.lines.indexOf(a) - item.lines.indexOf(b))\n item.title = question\n dropLine(item, 'text', question)\n dropLine(item, 'link', question)\n if (item.text && !item.text.length) delete item.text\n if (item.link && !item.link.length) delete item.link\n }\n }\n if (kind === 'pricing') {\n for (const item of items) {\n const price = item.lines.find((ref) => PRICE.test(this.lineText(ref)) && this.lineText(ref).length <= 24)\n if (price === undefined || item.title === price) continue\n item.figure = price\n dropLine(item, 'text', price)\n dropLine(item, 'list', price)\n if (item.text && !item.text.length) delete item.text\n if (item.list && !item.list.length) delete item.list\n }\n items.forEach((item, at) => this.takePeriod(item, parts[at]?.element as number, range))\n }\n if (kind === 'cards' || kind === 'pricing') items.forEach((item, at) => this.takeBadge(item, parts[at]?.element as number, range))\n const inline = columns === 1 && (kind === 'cards' || kind === 'pricing') && parts.every((part) => this.isWordRow(part.element, range))\n const columnsSm = this.columnsSmOf(container, parts, columns)\n const align = this.itemsAlignOf(parts[0]?.element ?? -1, items[0], range)\n return {\n kind: 'group',\n group: kind,\n columns,\n ...(columnsSm !== null ? { columnsSm } : {}),\n boxed,\n ...(ruled ? { rule: ruled } : {}),\n ...(align ? { align } : {}),\n ...(inline ? { inline: true as const } : {}),\n items,\n }\n }\n\n /**\n * How an item's words are set (AGL-4138): centered where its name's\n * element centers its text or its own column centers what it holds, else\n * at the start. `keepOwnAlign` drops it where the section reads the same.\n */\n private itemsAlignOf(element: number, item: SiteImportLayoutItem | undefined, range: readonly [number, number]): 'start' | 'center' | null {\n const ref = item?.title ?? item?.text?.[0]\n if (element < 0 || ref === undefined) return null\n const leaf = this.leaves(element).find((entry) => entry.kind === 'line' && entry.ref === ref)\n if (!leaf) return null\n if (this.style(leaf.element).get('text-align') === 'center') return 'center'\n const column = this.style(this.unwrap(element, range))\n if (/\\bflex\\b/.test(column.get('display') ?? '') && /column/.test(column.get('flex-direction') ?? '') && column.get('align-items') === 'center') return 'center'\n return 'start'\n }\n\n /**\n * The columns a group's items sit in on a tablet (AGL-4138), where it is\n * fewer than on a wide screen and more than one: a framework's `sm` size on\n * its cells, else the grid the container lays out at a tablet's width.\n */\n private columnsSmOf(container: number, parts: Array<{ element: number }>, columns: number): number | null {\n if (columns <= 2) return null\n const classes = this.elements[parts[0]?.element ?? -1]?.attrs.class ?? ''\n const sized = /\\bMuiGrid-grid-sm-(\\d+)\\b/.exec(classes) ?? /\\bcol-sm-(\\d{1,2})\\b/.exec(classes)\n let count: number | null = null\n if (sized) count = Math.round(12 / Math.max(1, Number(sized[1])))\n else {\n this.tabletStyles ??= this.tabletStylesOf()\n const style = this.tabletStyles.of(container)\n const template = /\\bgrid\\b/.test(style.get('display') ?? '') ? siteImportGridColumns(style.get('grid-template-columns')) : null\n if (template) count = template.length\n }\n return count !== null && count >= 2 && count < columns ? count : null\n }\n\n /** The line of an item that says what its price is for, beside the price: taken out of its words. */\n private takePeriod(item: SiteImportLayoutItem, element: number, range: readonly [number, number]): void {\n if (item.figure === undefined) return\n const leaves = this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range))\n const price = leaves.find((leaf) => leaf.ref === item.figure)\n const next = item.lines[item.lines.indexOf(item.figure) + 1]\n const period = (item.text ?? []).find((ref) => {\n const text = this.lineText(ref).trim()\n if (text.length > PERIOD_MAX_CHARS || !PERIOD.test(text)) return false\n const leaf = leaves.find((entry) => entry.ref === ref)\n return ref === next || (!!leaf && !!price && this.elements[leaf.element]?.parent === this.elements[price.element]?.parent)\n })\n if (period === undefined) return\n item.period = period\n dropLine(item, 'text', period)\n }\n\n /** The line of an item drawn as a tag on it, a short line in a filled pill: taken out of its words. */\n private takeBadge(item: SiteImportLayoutItem, element: number, range: readonly [number, number]): void {\n const leaves = this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range))\n const badge = (item.text ?? []).find((ref) => {\n const leaf = leaves.find((entry) => entry.ref === ref)\n return !!leaf && this.isBadge(leaf)\n })\n if (badge === undefined) return\n item.badge = badge\n dropLine(item, 'text', badge)\n }\n\n /** Whether a line is a tag: a word or two on a fill of its own, its corners rounded to a pill. */\n private isBadge(leaf: Leaf): boolean {\n const block = this.block(leaf)\n if (block?.kind !== 'paragraph') return false\n const words = block.text.trim().split(/\\s+/)\n if (block.text.trim().length > BADGE_MAX_CHARS || words.length > BADGE_MAX_WORDS) return false\n // The pill may be the line's own element, or the wrapper that holds only it.\n for (let at = leaf.element, depth = 0; at >= 0 && depth < 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).length !== 1) return false\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at) && (siteImportRadiusPx(style) ?? 0) >= BADGE_MIN_RADIUS) return true\n }\n return false\n }\n\n /** Whether an item is a row of its own, its parts side by side and two of them words: a plan's row, a label and its value. */\n private isWordRow(element: number, range: readonly [number, number]): boolean {\n const row = this.unwrap(element, range)\n if (!this.isRow(row)) return false\n const cells = this.parts(row, range).filter((part) => {\n if (!isElementPart(part)) return part.leaf.kind === 'line' && this.block(part.leaf)?.kind !== 'image'\n return this.leaves(part.element).some((leaf) => leaf.kind === 'line' && this.inRange(leaf, range) && this.block(leaf)?.kind !== 'image')\n })\n return cells.length >= 2\n }\n\n private lineText(ref: SiteImportLineRef): string {\n const block = this.mainBlocks()[ref]\n if (!block) return ''\n return block.kind === 'image' ? block.alt : block.text\n }\n\n /** One item's lines, each in exactly one of its parts. */\n private item(element: number, range: readonly [number, number]): SiteImportLayoutItem {\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n const item: SiteImportLayoutItem = { lines: [] }\n const lines = leaves.filter((leaf) => leaf.kind === 'line')\n item.lines = lines.map((leaf) => leaf.ref)\n const firstLine = lines[0]\n const leadIcon = leaves.find((leaf) => leaf.kind === 'icon' && (!firstLine || leaf.order < firstLine.order + 1))\n if (leadIcon) item.icon = leadIcon.ref\n // Bullet points: list items, and lines that sit in a repeated run inside the item (a plan's features).\n const listed = new Set<number>()\n const own = this.elements[element]?.tag === 'li'\n if (!own) for (const leaf of lines) if (this.block(leaf)?.kind === 'list-item') listed.add(leaf.ref)\n const inner = this.unwrap(element, range)\n for (const members of this.listRuns(inner, range, 4)) {\n for (const member of members) for (const leaf of this.leaves(member)) if (leaf.kind === 'line' && this.inRange(leaf, range)) listed.add(leaf.ref)\n const marks = members.map((member) => this.leaves(member).find((leaf) => leaf.kind === 'icon')?.ref)\n if (marks.length && marks.every((mark) => mark !== undefined && mark === marks[0])) item.listIcon = marks[0] as number\n }\n if (item.icon !== undefined && item.icon === item.listIcon && !lines.length) delete item.icon\n const rest = lines.filter((leaf) => !listed.has(leaf.ref))\n // A film the item holds (AGL-4140): its poster is the item's picture.\n const film = leaves.find((leaf) => leaf.kind === 'video')\n if (film) item.video = film.ref\n const image = (film ? rest.find((leaf) => this.block(leaf)?.kind === 'image' && this.videoHolding(leaf.element) === film.element) : undefined) ?? rest.find((leaf) => this.block(leaf)?.kind === 'image')\n if (image) {\n item.image = image.ref\n const fit = this.pictureFit(image)\n if (fit) item.imageFit = fit\n }\n const words = rest.filter((leaf) => leaf !== image)\n // Its own calls to action: every link it draws as a button, wherever it\n // sits (a plan's button sits above its features), and the links and\n // buttons that close it.\n let drawn = words.filter((leaf) => this.block(leaf)?.kind === 'link' && !!this.buttonStyle(leaf))\n const loose = words.filter((leaf) => !drawn.includes(leaf))\n const trailing: Leaf[] = []\n for (let index = loose.length - 1; index >= 0; index -= 1) {\n const leaf = loose[index] as Leaf\n const block = this.block(leaf)\n if (block?.kind === 'link' || this.buttonStyle(leaf)) trailing.unshift(leaf)\n else break\n }\n const body = loose.slice(0, loose.length - trailing.length)\n let title: Leaf | undefined = body.find((leaf) => this.block(leaf)?.kind === 'heading')\n if (!title) {\n const first = body[0]\n const block = first ? this.block(first) : undefined\n if (first && block?.kind === 'link' && body.length >= 2) title = first\n else if (first && block && block.kind !== 'image' && block.text.length <= 80 && block.text.split(/\\s+/).length <= 12 && body.length >= 2) title = first\n }\n let closing = [...drawn, ...trailing].sort((a, b) => a.order - b.order)\n if (!title && closing.length === words.length && closing.length >= 1 && words.length >= 2) {\n // Only links: the first names the item.\n title = closing[0]\n closing = closing.slice(1)\n drawn = drawn.filter((leaf) => leaf !== title)\n }\n if (title) item.title = title.ref\n const text = body.filter((leaf) => leaf !== title).map((leaf) => leaf.ref)\n if (text.length) item.text = text\n if (listed.size) item.list = lines.filter((leaf) => listed.has(leaf.ref)).map((leaf) => leaf.ref)\n if (closing.length) item.link = closing.map((leaf) => leaf.ref)\n if (drawn.length) item.ctas = drawn.map((leaf) => ({ line: leaf.ref, style: this.buttonStyle(leaf) as SiteImportButtonStyle }))\n const titleBlock = title ? this.block(title) : undefined\n if (titleBlock?.kind === 'link') item.to = titleBlock.href\n else if (closing.length === 1) {\n const only = this.block(closing[0] as Leaf)\n if (only?.kind === 'link') item.to = only.href\n } else {\n const wrap = this.wrapperOf(element, ['a'], 0)\n const href = wrap !== null ? this.anchorHref(wrap) : null\n if (href) item.to = href\n }\n // The square its lead icon sits in, and the arrow at the end of its first row (AGL-4138).\n if (leadIcon) {\n const tile = this.tileOf(leadIcon, element)\n if (tile) item.tile = tile\n }\n const mark = this.markOf(leaves, leadIcon, listed, element, item.to)\n if (mark !== undefined) item.mark = mark\n return item\n }\n\n /**\n * A second icon of an item that says where it goes (AGL-4138): an icon\n * alone in a link to the item's own address (a card's \"↗\"), or one in the\n * row its lead icon sits in. Never a bullet's mark.\n */\n private markOf(leaves: readonly Leaf[], lead: Leaf | undefined, listed: ReadonlySet<number>, item: number, to: string | undefined): number | undefined {\n const bullets = new Set<number>()\n for (const leaf of leaves) if (leaf.kind === 'line' && listed.has(leaf.ref)) bullets.add(this.elements[leaf.element]?.parent ?? -1)\n const same = (a: string | null | undefined, b: string | null | undefined) => !!a && !!b && a.replace(/\\/+$/, '') === b.replace(/\\/+$/, '')\n for (const leaf of leaves) {\n if (leaf.kind !== 'icon' || leaf === lead) continue\n const parent = this.elements[leaf.element]?.parent ?? -1\n if (bullets.has(parent) || bullets.has(this.elements[parent]?.parent ?? -1)) continue\n const link = this.wrapperOf(leaf.element, ['a'], 3)\n if (link !== null && link !== item && this.refsIn(link, [-1, Number.POSITIVE_INFINITY]).length === 0 && same(this.anchorHref(link), to)) return leaf.ref\n const row = lead ? this.commonAncestor([lead.element, leaf.element]) : null\n if (row !== null && row !== item && this.contains(item, row) && this.isRow(row) && !this.leaves(row).some((entry) => entry.kind === 'line')) return leaf.ref\n }\n return undefined\n }\n\n /**\n * Runs of three or more one-line entries built alike anywhere inside an\n * item (a plan's features, each a check mark and a line), each run its\n * entries' elements. The item itself is never one of them.\n */\n private listRuns(element: number, range: readonly [number, number], depth: number, root = true): number[][] {\n const out: number[][] = []\n const parts = this.parts(element, range)\n const taken = new Set<number>()\n for (const run of this.groupRuns(element, parts, range)) {\n const members = (parts.slice(run.start, run.end) as Array<{ element: number }>).map((part) => part.element)\n const oneLine = members.every((member) => this.leaves(member).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range)).length === 1)\n if (!oneLine || (root && members.length === parts.length)) continue\n out.push(members)\n members.forEach((member) => taken.add(member))\n }\n if (depth <= 0) return out\n for (const part of parts) if (isElementPart(part) && !taken.has(part.element)) out.push(...this.listRuns(part.element, range, depth - 1, false))\n return out\n }\n\n private groupKind(elements: number[], items: SiteImportLayoutItem[], range: readonly [number, number]): SiteImportGroupKind {\n const count = items.length\n const share = (test: (item: SiteImportLayoutItem, index: number) => boolean) => items.filter(test).length / Math.max(1, count)\n const first = (item: SiteImportLayoutItem) => this.lineText(item.lines[0] ?? -1).trim()\n const blockKinds = (item: SiteImportLayoutItem) => item.lines.map((ref) => this.mainBlocks()[ref]?.kind)\n if (elements.some((element) => this.elements[element]?.tag === 'details')) return 'faq'\n if (share((item) => item.lines.length === 0 || blockKinds(item).every((kind) => kind === 'image')) === 1 && items.some((item) => item.lines.length) && count >= 4) return 'logos'\n if (share((item) => blockKinds(item).includes('quote') || /^[“\"«]/.test(first(item))) >= 0.6) return 'quotes'\n if (share((item) => item.lines.some((ref) => PRICE.test(this.lineText(ref)) && this.lineText(ref).length <= 24) && (item.lines.some((ref) => PERIOD.test(this.lineText(ref))) || !!item.link)) >= 0.6 && count >= 2) {\n return 'pricing'\n }\n if (share((item) => /\\?\\s*$/.test(first(item)) && item.lines.length >= 2) >= 0.6) return 'faq'\n if (share((item) => STEP_NUMBER.test(first(item)) && item.lines.length >= 2) >= 0.6) return 'steps'\n if (share((item) => item.lines.length >= 2 && item.lines.length <= 3 && first(item).length <= 14 && FIGURE.test(first(item))) >= 0.6) return 'stats'\n const visual = share((item) => item.icon !== undefined || item.image !== undefined)\n const titled = share((item) => item.title !== undefined && (item.text?.length ?? 0) > 0)\n const boxed = elements.filter((element) => this.framed(element)).length >= Math.ceil(elements.length / 2)\n if ((visual >= 0.6 && titled >= 0.6) || (boxed && share((item) => item.lines.length >= 2) >= 0.6)) return 'cards'\n if (share((item) => item.lines.length === 1) >= 0.8) return 'list'\n if (titled >= 0.6) return 'cards'\n void range\n return 'text'\n }\n\n /** How many columns a group's items sit in on a wide screen. */\n private columnsOf(container: number, parts: Array<{ element: number }>): number {\n const count = parts.length\n const placed = this.placed.get(container)\n if (placed) return placed === 'row' ? count : 1\n const style = this.style(container)\n const display = style.get('display') ?? ''\n if (/\\bgrid\\b/.test(display)) {\n const template = siteImportGridColumns(style.get('grid-template-columns'))\n if (template) return Math.max(1, Math.min(count, template.length))\n return 1\n }\n const sizes = parts.map((part) => this.cellSize(part.element))\n const classes = this.elements[container]?.attrs.class ?? ''\n if (/\\bMuiGrid-container\\b|(?:^|\\s)row(?:\\s|$)/.test(classes) && sizes[0]) {\n return Math.max(1, Math.min(count, Math.round(12 / (sizes[0] as number))))\n }\n if (/\\bflex\\b/.test(display) && !/column/.test(style.get('flex-direction') ?? 'row')) {\n const width = sizes[0]\n if (width && width <= 100 && /^(-?[\\d.]+)%$/.test(this.style(parts[0]?.element ?? -1).get('width') ?? '')) return Math.max(1, Math.round(100 / width))\n return Math.min(count, 4)\n }\n return 1\n }\n\n /*---------------- tables and tabs ----------------*/\n\n private table(element: number, range: readonly [number, number]): SiteImportLayoutTable | null {\n const rows: number[] = []\n const visit = (at: number) => {\n for (const child of this.elements[at]?.children ?? []) {\n const tag = this.elements[child]?.tag\n if (tag === 'tr') rows.push(child)\n else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') visit(child)\n }\n }\n visit(element)\n if (!rows.length) return null\n const out: SiteImportLineRef[][][] = rows.map((row) =>\n (this.elements[row]?.children ?? [])\n .filter((cell) => /^t[dh]$/.test(this.elements[cell]?.tag ?? ''))\n .map((cell) => this.refsIn(cell, range)),\n )\n const header =\n (this.elements[rows[0] as number]?.parent !== undefined && this.elements[this.elements[rows[0] as number]?.parent as number]?.tag === 'thead') ||\n (this.elements[rows[0] as number]?.children ?? []).every((cell) => this.elements[cell]?.tag === 'th')\n // A caption, or lines outside the rows, are not lost.\n return { kind: 'table', header, rows: tableRows(out.filter((row) => row.some((cell) => cell.length))) }\n }\n\n private refsIn(element: number, range: readonly [number, number]): SiteImportLineRef[] {\n return this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range)).map((leaf) => leaf.ref)\n }\n\n /** Rows of short cells built alike, laid out as rows: a table drawn with a grid. */\n private gridTable(element: number, parts: Part[], range: readonly [number, number]): SiteImportLayoutTable | null {\n const rows = parts.filter(isElementPart).map((part) => part.element)\n if (rows.length < 3 || rows.length !== parts.length) return null\n const widths = rows.map((row) => (this.elements[row]?.children ?? []).length)\n const common = mode(widths)\n if (common < 2 || widths.filter((width) => width === common).length < rows.length * 0.8) return null\n if (common === 2 && rows.length < 4) return null\n if (!rows.every((row) => this.isRow(row))) return null\n const cells = rows.map((row) => (this.elements[row]?.children ?? []).map((cell) => this.refsIn(cell, range)))\n // Cells are short and flat: a value, not a card. Two-cell rows are a label and its value.\n const longest = common === 2 ? 60 : 120\n const flat = cells.every((row) => row.every((cell) => cell.length <= 2 && cell.every((ref) => this.lineText(ref).length <= longest && this.mainBlocks()[ref]?.kind !== 'image')))\n if (!flat) return null\n // A label and its value: both cells hold words (an icon beside a line is a list, not a table).\n if (common === 2 && cells.filter((row) => row.length === 2 && row.every((cell) => cell.length > 0)).length < rows.length * 0.8) return null\n // A comparison's first row names the columns over an empty corner.\n const first = cells[0] ?? []\n const header = common >= 3 && !(first[0]?.length) && first.slice(1).every((cell) => cell.length > 0)\n return { kind: 'table', header, rows: tableRows(cells) }\n }\n\n /** Tab strips, each read at the lowest element holding it and its panels. */\n private tabStrips(): Map<number, TabStrip[]> {\n if (this.tabsMemo) return this.tabsMemo\n const at = new Map<number, TabStrip[]>()\n const panels = this.elements.filter((node) => node.attrs.role === 'tabpanel' && node.region === 'main').map((node) => node.id)\n const taken = new Set<number>()\n for (const strip of this.elements) {\n if (strip.attrs.role !== 'tablist' || strip.region !== 'main') continue\n const tabs = this.findAll(strip.id, (node) => node.attrs.role === 'tab')\n if (tabs.length < 2) continue\n const found = tabs.map((tab) => {\n const attrs = this.elements[tab]?.attrs ?? {}\n const own = (id: string | undefined) => (id ? id.replace(/^tab-?/, '') : '')\n const panel = panels.find((candidate) => {\n if (taken.has(candidate)) return false\n const panelAttrs = this.elements[candidate]?.attrs ?? {}\n return (\n (!!attrs.controls && panelAttrs.id === attrs.controls) ||\n (!!attrs.id && panelAttrs.labelledby === attrs.id) ||\n (!!attrs.id && !!panelAttrs.id && own(attrs.id) === panelAttrs.id.replace(/^tabpanel-?/, ''))\n )\n })\n if (panel !== undefined) taken.add(panel)\n return panel ?? null\n })\n // Panels the tabs do not name: the ones after the strip, in order.\n const loose = panels.filter((panel) => !taken.has(panel) && panel > strip.id)\n const resolved = found.map((panel) => {\n if (panel !== null) return panel\n const next = loose.shift()\n if (next !== undefined) taken.add(next)\n return next ?? null\n })\n const members = [strip.id, ...resolved.filter((panel): panel is number => panel !== null)]\n const home = this.commonAncestor(members)\n if (home === null) continue\n const list = at.get(home) ?? []\n list.push({ strip: strip.id, tabs, panels: resolved })\n at.set(home, list)\n }\n this.tabsMemo = at\n return at\n }\n\n private tabsMemo: Map<number, TabStrip[]> | null = null\n\n private commonAncestor(elements: number[]): number | null {\n const chains = elements.map((element) => {\n const chain: number[] = []\n for (let at = element; at >= 0; at = this.elements[at]?.parent ?? -1) chain.unshift(at)\n return chain\n })\n let common: number | null = null\n for (let depth = 0; ; depth += 1) {\n const step = chains[0]?.[depth]\n if (step === undefined || !chains.every((chain) => chain[depth] === step)) break\n common = step\n }\n // A strip with no panels is read where it sits: its parent holds it.\n if (common !== null && elements.length === 1) common = this.elements[common]?.parent ?? null\n return common !== null && common >= 0 ? common : null\n }\n\n private readTabs(element: number, strips: TabStrip[], range: readonly [number, number]): SiteImportLayoutNode[] {\n const inside = new Set<number>()\n for (const strip of strips) for (const member of [strip.strip, ...strip.panels]) if (member !== null) for (const leaf of this.leaves(member)) inside.add(leaf.order)\n const outside = (nodes: SiteImportLayoutNode[]) =>\n siteImportFilterNodes(nodes, (ref) => {\n const leaf = this.leaves(element).find((entry) => entry.kind === 'line' && entry.ref === ref)\n return !leaf || !inside.has(leaf.order)\n })\n const out: SiteImportLayoutNode[] = []\n const drawn = new Set<TabStrip>()\n for (const part of this.parts(element, range)) {\n if (!isElementPart(part)) {\n if (!inside.has(part.leaf.order)) out.push(this.leafNode(part.leaf))\n continue\n }\n const strip = strips.find((entry) => this.contains(part.element, entry.strip))\n const panel = strips.some((entry) => entry.panels.some((member) => member !== null && this.contains(part.element, member)))\n if (strip || panel) {\n if (part.element !== strip?.strip && !strips.some((entry) => entry.panels.includes(part.element))) out.push(...outside(this.read(part.element, range)))\n if (strip && !drawn.has(strip)) {\n drawn.add(strip)\n out.push(this.tabsNode(strip, range))\n }\n continue\n }\n out.push(...this.read(part.element, range))\n }\n return out\n }\n\n private tabsNode(strip: TabStrip, range: readonly [number, number]): SiteImportLayoutTabs {\n return {\n kind: 'tabs',\n tabs: strip.tabs.map((tab, index) => {\n const node = this.elements[tab] as SiteImportElement\n const panel = strip.panels[index] ?? null\n const selected = /\\b(?:Mui-selected|active|is-active|selected)\\b/.test(node.attrs.class ?? '')\n return {\n label: this.refsIn(tab, range)[0] ?? null,\n ...(selected ? { selected: true as const } : {}),\n panel: panel !== null ? this.read(panel, range) : [],\n }\n }),\n }\n }\n\n private findRole(element: number, role: string, depth: number): number | null {\n const node = this.elements[element]\n if (!node) return null\n if (node.attrs.role === role) return element\n if (depth <= 0) return null\n for (const child of node.children) {\n const found = this.findRole(child, role, depth - 1)\n if (found !== null) return found\n }\n return null\n }\n\n private findAll(element: number, test: (node: SiteImportElement) => boolean): number[] {\n const out: number[] = []\n const visit = (at: number) => {\n const node = this.elements[at]\n if (!node) return\n if (test(node)) {\n out.push(at)\n return\n }\n for (const child of node.children) visit(child)\n }\n for (const child of this.elements[element]?.children ?? []) visit(child)\n return out\n }\n\n private contains(ancestor: number, element: number): boolean {\n for (let at = element; at >= 0; at = this.elements[at]?.parent ?? -1) if (at === ancestor) return true\n return false\n }\n\n /*---------------- the hero ----------------*/\n\n private markHero(sections: SiteImportLayoutSection[]): void {\n const mainBlocks = this.mainBlocks()\n const hero = sections.find((section) => section.lines.some((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1))\n if (!hero) return\n let picture: SiteImportHeroPicture | null = null\n if (hero.backdrop?.kind === 'picture' || hero.backdrop?.kind === 'video') picture = 'behind'\n else {\n const h1 = hero.lines.find((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1) as number\n const image = hero.lines.find((ref) => mainBlocks[ref]?.kind === 'image')\n if (image !== undefined) {\n const beside = (nodes: SiteImportLayoutNode[]): boolean =>\n nodes.some((node) => {\n if (node.kind !== 'row') return false\n const cellOf = (ref: number) => node.cells.findIndex((cell) => this.linesOf(cell.nodes).includes(ref))\n const a = cellOf(h1)\n const b = cellOf(image)\n if (a >= 0 && b >= 0 && a !== b) return true\n return node.cells.some((cell) => beside(cell.nodes))\n })\n if (beside(hero.nodes)) picture = 'beside'\n else if (this.pictureBehind(image)) {\n picture = 'behind'\n // A picture its grid lays behind the words is the section's ground, as a background picture is: a photo is `dark`.\n if (this.placedUnderWords(image) && hero === sections[0]) {\n hero.band = 'dark'\n delete hero.absoluteBand\n }\n }\n else picture = hero.lines.indexOf(image) > hero.lines.indexOf(h1) ? 'below' : 'above'\n }\n }\n const measure = this.measureOf(hero, hero.lines.find((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1) as number)\n hero.hero = { picture, ...(measure !== null ? { measure } : {}) }\n }\n\n /**\n * The narrowest width the source holds its hero's heading to (AGL-4152), in\n * px: the least `max-width` on the `<h1>` or on the wrappers around it inside\n * its section, as a wide screen reads them. `null` where none is narrower\n * than the section's own cap, and the heading runs the section's width.\n */\n private measureOf(section: SiteImportLayoutSection, h1: number): number | null {\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === h1))\n if (!element) return null\n this.wideStyles ??= this.wideStylesOf()\n const inside = new Set(section.lines)\n const caps: number[] = []\n for (let at = element.id; at >= 0; at = this.elements[at]?.parent ?? -1) {\n // A wrapper that holds a line of another section is around the section, not in it.\n if (at !== element.id && this.leaves(at).some((leaf) => leaf.kind === 'line' && !inside.has(leaf.ref))) break\n const style = this.wideStyles.of(at)\n const px = siteImportMeasurePx(style.get('max-width'), siteImportFontSizePx(style) ?? this.bodySize)\n if (px !== null) caps.push(px)\n }\n const measure = caps.length ? Math.round(Math.min(...caps)) : null\n return measure !== null && (section.width === undefined || measure < section.width) ? measure : null\n }\n\n /** A picture laid over its section's whole area, behind the words. */\n private pictureBehind(ref: number): boolean {\n if (this.placedUnderWords(ref)) return true\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === ref))\n for (let at = element?.id ?? -1, depth = 0; at >= 0 && depth < 3; at = this.elements[at]?.parent ?? -1, depth += 1) {\n const position = this.style(at).get('position')\n if (position === 'absolute' || position === 'fixed') return true\n }\n return false\n }\n\n /** A picture its grid places in the same cells as words (AGL-4152). */\n private placedUnderWords(ref: number): boolean {\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === ref))\n for (let at = element?.id ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) if (this.placedBehind.has(at)) return true\n return false\n }\n\n linesOf(nodes: readonly SiteImportLayoutNode[]): SiteImportLineRef[] {\n return siteImportLayoutLines(nodes)\n }\n}\n\n/** One child of a placed grid (AGL-4152): its box, and what it holds that says whether a row below it is more of the same card. */\ninterface PlacedItem {\n element: number\n box: SiteImportGridBox\n words: boolean\n heading: boolean\n picture: boolean\n}\n\n/** A cell a placed grid draws: the columns it covers and what sits in it, top to bottom. */\ninterface DrawnCell {\n start: number\n end: number\n items: PlacedItem[]\n}\n\n/** How much of two stretches of a grid's lines coincide. */\nconst overlapOf = (aStart: number, aEnd: number, bStart: number, bEnd: number) => Math.max(0, Math.min(aEnd, bEnd) - Math.max(aStart, bStart))\n\n/** Whether words are laid over a box: at least half their cells are its cells. */\nfunction overLaid(words: SiteImportGridBox, under: SiteImportGridBox): boolean {\n const cells = overlapOf(words.rowStart, words.rowEnd, under.rowStart, under.rowEnd) * overlapOf(words.columnStart, words.columnEnd, under.columnStart, under.columnEnd)\n return cells * 2 >= (words.rowEnd - words.rowStart) * (words.columnEnd - words.columnStart) && cells > 0\n}\n\n/**\n * A placed grid's children as a visitor reads them (AGL-4152): sorted by row\n * then column, clustered into visual rows where their rows overlap, split into\n * cells where their columns do, each cell top to bottom with what is laid\n * under words first. A row then joins the columns above it where it is built\n * to them and those columns have something it belongs to: words under a\n * heading or a picture. A row with a heading or a picture where its column\n * already holds one starts anew, so rows of whole cards stay rows, and words\n * with nothing above them to belong to stay rows too. One band is one row of\n * the page; a band of one cell is simply stacked.\n */\nfunction siteImportGridBands(items: readonly PlacedItem[], behind: (item: PlacedItem) => boolean): DrawnCell[][] {\n const sorted = [...items].sort((a, b) => a.box.rowStart - b.box.rowStart || a.box.columnStart - b.box.columnStart)\n const rows: PlacedItem[][] = []\n let rowEnd = Number.NEGATIVE_INFINITY\n for (const item of sorted) {\n const joins = item.box.rowStart < rowEnd\n if (joins) (rows[rows.length - 1] as PlacedItem[]).push(item)\n else rows.push([item])\n rowEnd = joins ? Math.max(rowEnd, item.box.rowEnd) : item.box.rowEnd\n }\n const bands: DrawnCell[][] = []\n for (const row of rows) {\n const cells: DrawnCell[] = []\n for (const item of [...row].sort((a, b) => a.box.columnStart - b.box.columnStart)) {\n const { columnStart: start, columnEnd: end } = item.box\n const last = cells[cells.length - 1]\n // The same cell where half the narrower of the two is shared; a block nudged over its neighbor's edge is still beside it.\n if (last && overlapOf(last.start, last.end, start, end) * 2 >= Math.min(last.end - last.start, end - start)) {\n last.items.push(item)\n last.end = Math.max(last.end, end)\n } else cells.push({ start, end, items: [item] })\n }\n const band = bands[bands.length - 1]\n const columns = band ? columnsFor(band, cells) : null\n if (band && columns) {\n cells.forEach((cell, at) => {\n const column = band[columns[at] as number] as DrawnCell\n column.items.push(...cell.items)\n column.start = Math.min(column.start, cell.start)\n column.end = Math.max(column.end, cell.end)\n })\n } else bands.push(cells)\n }\n for (const band of bands) {\n for (const cell of band) cell.items.sort((a, b) => Number(behind(b)) - Number(behind(a)) || a.box.rowStart - b.box.rowStart || a.box.columnStart - b.box.columnStart)\n }\n return bands\n}\n\n/** The column of a band each cell of the row under it belongs in, or `null` where that row is a row of its own. */\nfunction columnsFor(band: readonly DrawnCell[], cells: readonly DrawnCell[]): number[] | null {\n if (band.length < 2 || !band.some((column) => column.items.some((item) => item.heading || item.picture))) return null\n const taken: number[] = []\n for (const cell of cells) {\n const overlaps = band.map((column) => overlapOf(column.start, column.end, cell.start, cell.end))\n const best = overlaps.indexOf(Math.max(...overlaps))\n const column = band[best] as DrawnCell\n if ((overlaps[best] as number) * 2 < cell.end - cell.start || taken.includes(best)) return null\n const has = (test: (item: PlacedItem) => boolean) => cell.items.some(test) && column.items.some(test)\n if (has((item) => item.heading) || has((item) => item.picture)) return null\n taken.push(best)\n }\n return taken\n}\n\n/** Drops a group's own alignment where its section reads the same (AGL-4138): only an item set apart from its section says how. */\nfunction keepOwnAlign(nodes: readonly SiteImportLayoutNode[], align: 'start' | 'center'): void {\n for (const node of nodes) {\n if (node.kind === 'group' && node.align === align) delete node.align\n else if (node.kind === 'row') for (const cell of node.cells) keepOwnAlign(cell.nodes, align)\n else if (node.kind === 'tabs') for (const tab of node.tabs) keepOwnAlign(tab.panel, align)\n }\n}\n\n/** How wide a `ch` is, in ems: the width of a zero in the faces a page is set in. */\nconst CH_EM = 0.55\n\n/**\n * A `max-width` as px (AGL-4152), at the font size of the element it is set\n * on: a length in px, rem, em or ch, or the least of those a `min()` names. A\n * share of the parent (`%`, `vw`), `none` or anything else is `null`, because\n * it holds a heading to no width of its own.\n */\nexport function siteImportMeasurePx(value: string | undefined, fontPx: number): number | null {\n const text = value?.trim().toLowerCase() ?? ''\n if (!text) return null\n const one = (term: string): number | null => {\n const match = /^(\\d*\\.?\\d+)(px|rem|em|ch)$/.exec(term.trim())\n if (!match) return null\n const amount = Number(match[1])\n const px = match[2] === 'px' ? amount : match[2] === 'rem' ? amount * 16 : match[2] === 'em' ? amount * fontPx : amount * fontPx * CH_EM\n return px > 0 ? px : null\n }\n const min = /^min\\((.+)\\)$/.exec(text)\n if (!min) return one(text)\n const terms = (min[1] as string).split(',').map(one).filter((px): px is number => px !== null)\n return terms.length ? Math.min(...terms) : null\n}\n\n/** Whether a short line reads as an eyebrow: ten words at most, in capitals or set in them. */\nexport function siteImportIsEyebrowText(text: string, style: SiteImportComputedStyle): boolean {\n const words = text.match(/[\\p{L}\\p{N}]+/gu) ?? []\n if (text.length > 60 || words.length > 10) return false\n const letters = text.replace(/[^\\p{L}]/gu, '')\n const caps = letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase()\n return caps || style.get('text-transform') === 'uppercase'\n}\n\n/** A font weight as a number: `700`, `bold` 700, `normal` 400. */\nexport function siteImportFontWeight(style: SiteImportComputedStyle): number {\n const value = style.get('font-weight')?.trim() ?? ''\n if (/^\\d{3}$/.test(value)) return Number(value)\n if (/^(?:bold|bolder)$/.test(value)) return 700\n if (value === 'lighter') return 300\n return 400\n}\n\n/** Whether a color is a muted words' grey (AGL-4138): no hue to speak of, lighter than the words' ink and darker than a rule. */\nexport function siteImportIsMutedInk(hex: string): boolean {\n const color = siteImportColorOf(hex)\n if (!color) return false\n const light = siteImportLuminance(color)\n return siteImportSaturation(color) < 0.15 && light >= 0.06 && light <= 0.6\n}\n\n/** Takes a line out of one of an item's lists; a list left empty goes, never left undefined (Firestore holds no undefined). */\nfunction dropLine(item: SiteImportLayoutItem, key: 'text' | 'list' | 'link', ref: SiteImportLineRef): void {\n const list = item[key]?.filter((entry) => entry !== ref)\n if (list?.length) item[key] = list\n else delete item[key]\n}\n\n/** Every video node of a section, rows and tab panels opened (AGL-4140). */\nfunction siteImportVideoNodes(nodes: readonly SiteImportLayoutNode[]): SiteImportLayoutVideo[] {\n return nodes.flatMap((node): SiteImportLayoutVideo[] => {\n if (node.kind === 'video') return [node]\n if (node.kind === 'row') return node.cells.flatMap((cell) => siteImportVideoNodes(cell.nodes))\n if (node.kind === 'tabs') return node.tabs.flatMap((tab) => siteImportVideoNodes(tab.panel))\n return []\n })\n}\n\n/** A section's nodes with one video taken out, as its backdrop takes it; a cell or a row left empty goes. */\nfunction withoutVideo(nodes: readonly SiteImportLayoutNode[], video: number): SiteImportLayoutNode[] {\n return nodes.flatMap((node): SiteImportLayoutNode[] => {\n if (node.kind === 'video') return node.video === video ? [] : [node]\n if (node.kind === 'row') {\n const cells = node.cells.map((cell) => ({ nodes: withoutVideo(cell.nodes, video) }))\n const kept = cells.filter((cell) => cell.nodes.length)\n if (!kept.length) return []\n return kept.length === 1 ? (kept[0] as { nodes: SiteImportLayoutNode[] }).nodes : [{ ...node, cells }]\n }\n if (node.kind === 'tabs') return [{ ...node, tabs: node.tabs.map((tab) => ({ ...tab, panel: withoutVideo(tab.panel, video) })) }]\n return [node]\n })\n}\n\n/** Rows of cells of lines, as objects: a Firestore document holds no array inside an array. */\nfunction tableRows(rows: SiteImportLineRef[][][]): SiteImportLayoutTable['rows'] {\n return rows.map((row) => ({ cells: row.map((lines) => ({ lines })) }))\n}\n\ninterface TabStrip {\n strip: number\n tabs: number[]\n /** Each tab's panel, `null` for one the source did not draw. */\n panels: Array<number | null>\n}\n\ninterface GroupRun {\n start: number\n end: number\n}\n\n/** A section's stretch of the page: the element it is (`null` when it is read through its container), the element its name and band come from, and its leaves' range. */\ninterface Cut {\n element: number | null\n anchor: number | null\n range: [number, number]\n from: SiteImportLayoutSection['from']\n}\n\nfunction mode(values: readonly number[]): number {\n const counts = new Map<number, number>()\n for (const value of values) counts.set(value, (counts.get(value) ?? 0) + 1)\n return [...counts.entries()].sort((a, b) => b[1] - a[1] || b[0] - a[0])[0]?.[0] ?? 0\n}\n\n/** How far a light fill may sit from the page's ground and still be that ground (AGL-4152), in OKLab. */\nconst SAME_GROUND = 0.02\n\n/**\n * A section's fill as a band of its page (AGL-4152): a light fill is `plain`\n * on the page's own ground (white, where the page sets none) and `soft`\n * anywhere else, so a page on light grey with white bands draws those bands\n * apart from it in both color schemes. A strong color or a dark one is what it is.\n */\nexport function siteImportBandOn(color: SiteImportRgba, page: SiteImportRgba | null): SiteImportBand {\n const band = siteImportBandOfColor(color)\n if (band !== 'plain' && band !== 'soft') return band\n return siteImportColorDistance(color, page ?? { r: 255, g: 255, b: 255, a: 1 }) <= SAME_GROUND ? 'plain' : 'soft'\n}\n\n/** A solid background's band: near white is the page, light or tinted is soft, a strong color is the brand's, dark is dark. */\nexport function siteImportBandOfColor(color: { r: number; g: number; b: number; a: number }): SiteImportBand {\n const light = siteImportLuminance(color)\n const saturation = siteImportSaturation(color)\n if (saturation > 0.45 && light >= 0.06 && light < 0.75) return 'brand'\n if (light < 0.3) return 'dark'\n if (light >= 0.95) return 'plain'\n return 'soft'\n}\n\n/**\n * How the source draws an `<a>` or `<button>` as a button, or `null` when it\n * draws it as a link: a framework's button class, a role, or a fill or a\n * border with room around the words.\n */\nexport function siteImportButtonStyleOf(element: SiteImportElement, style: SiteImportComputedStyle, under: string | null): SiteImportButtonStyle | null {\n const classes = element.attrs.class ?? ''\n const fill = siteImportBackgroundOf(style)\n const filled = (!!fill.color && fill.color.a >= 0.5 && siteImportHex(fill.color) !== under) || !!fill.gradient\n const bordered = siteImportHasBorder(style)\n const padded = ['padding', 'padding-left', 'padding-top'].some((property) => {\n const value = style.get(property)\n return !!value && /[1-9]/.test(value)\n })\n const classed = BUTTON_CLASS.test(classes) || element.attrs.role === 'button'\n if (!classed && !((filled || bordered) && padded)) return null\n if (TEXT_BUTTON_CLASS.test(classes)) return 'quiet'\n if (filled || FILLED_CLASS.test(classes)) return 'primary'\n if (bordered || OUTLINED_CLASS.test(classes)) return 'secondary'\n return 'quiet'\n}\n\n/*------------------------------------------\n * The look\n *-----------------------------------------*/\n\n/** Families a Google Fonts stylesheet address loads: `family=Roboto+Flex:wght@400` is \"Roboto Flex\". */\nexport function siteImportGoogleFamilies(urls: readonly string[]): string[] {\n const families: string[] = []\n for (const raw of urls) {\n let url: URL\n try {\n url = new URL(raw)\n } catch {\n continue\n }\n if (url.hostname !== 'fonts.googleapis.com') continue\n for (const value of url.searchParams.getAll('family')) {\n for (const entry of value.split('|')) {\n const name = entry.split(':')[0]?.replace(/\\+/g, ' ').trim()\n if (name && !families.includes(name)) families.push(name)\n }\n }\n }\n return families\n}\n\n/**\n * The look facts of a page read with its structure, through its linked\n * stylesheets' text; its blocks, where given, for its eyebrows' color and its\n * sections' dark ground, read as its layout reads them.\n */\nexport function siteImportLookOf(\n page: Pick<SiteImportLayoutSource, 'structure'> & { blocks?: readonly SiteImportBlock[]; videos?: SiteImportExtract['videos'] },\n stylesheets: readonly string[] = [],\n): SiteImportLookFacts | null {\n if (!page.structure) return null\n if (page.blocks?.length) {\n const { css, styles, darkStyles, sections } = readSections({ structure: page.structure, blocks: [...page.blocks], ...(page.videos ? { videos: page.videos } : {}) }, stylesheets)\n return siteImportLookFacts(page.structure, styles, css.fontFaces, page.blocks, sections, darkStyles, css.variableUses)\n }\n const css = siteImportCssOf([...page.structure.styles, ...stylesheets])\n return siteImportLookFacts(page.structure, siteImportStylesOf(page.structure, css), css.fontFaces, [], [], null, css.variableUses)\n}\n\n/**\n * The look facts of a page's markup and the stylesheets it links (AGL-4106),\n * for the look pass, which reads the home page and its stylesheets itself.\n */\nexport function siteImportLookOfHtml(html: string, pageUrl: string, stylesheets: readonly string[] = []): SiteImportLookFacts | null {\n let origin = ''\n try {\n origin = new URL(pageUrl).origin\n } catch {\n return null\n }\n const extract = extractSiteImportPage(html, pageUrl, (url) => url.origin === origin, { structure: true })\n return extract.structure ? siteImportLookOf({ structure: extract.structure, blocks: extract.blocks, ...(extract.videos ? { videos: extract.videos } : {}) }, stylesheets) : null\n}\n\n/** How far two colors may sit apart and still be one (AGL-4138), in OKLab. */\nconst SAME_COLOR = 0.1\n\n/**\n * The color most of a page's eyebrows are drawn in (AGL-4138), where it is a\n * color of its own: not the words' ink, the buttons' fill, the links' color\n * or white, and no grey. `null` where its eyebrows are none, or drawn in one\n * of those.\n */\nfunction eyebrowColorOf(structure: SiteImportStructure, styles: SiteImportStyles, blocks: readonly SiteImportBlock[], not: ReadonlyArray<string | null>): string | null {\n const counts = new Map<string, number>()\n const inControl = (element: number) => {\n for (let at = element, depth = 0; at >= 0 && depth <= 3; at = structure.elements[at]?.parent ?? -1, depth += 1) {\n if (/^(?:a|button)$/.test(structure.elements[at]?.tag ?? '')) return true\n }\n return false\n }\n structure.blockElement.forEach((element, index) => {\n const block = blocks[index]\n // A button's or a link's words set in capitals are no eyebrow.\n if (block?.kind !== 'paragraph' || block.region !== 'main' || inControl(element)) return\n const style = styles.of(element)\n if (!siteImportIsEyebrowText(block.text, style)) return\n const color = siteImportColorOf(style.get('color'))\n if (!color || color.a < 0.5) return\n const hex = siteImportHex(siteImportOpaque(color))\n counts.set(hex, (counts.get(hex) ?? 0) + 1)\n })\n const top = [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0]\n const own = top ? siteImportColorOf(top) : null\n // A grey is the words' own muted color, never a color of the site's.\n if (!top || !own || siteImportSaturation(own) < 0.25) return null\n const others = [...not, '#ffffff'].flatMap((hex) => {\n const color = siteImportColorOf(hex ?? undefined)\n return color ? [siteImportOpaque(color)] : []\n })\n return others.some((other) => siteImportColorDistance(own, other) < SAME_COLOR) ? null : top\n}\n\n/** The fill most of a page's dark sections sit on (AGL-4152), the first of them on a tie; `null` where none has one. */\nfunction darkBackgroundOf(sections: readonly SiteImportLayoutSection[]): string | null {\n return mostUsedFill(sections.filter((section) => section.band === 'dark').map((section) => section.background))\n}\n\n/** The fill most of these are, the first of them on a tie; `null` where none is a solid color. */\nfunction mostUsedFill(fills: ReadonlyArray<string | null | undefined>): string | null {\n const counts = new Map<string, number>()\n for (const fill of fills) {\n if (fill && /^#[0-9a-f]{6}$/i.test(fill)) {\n const hex = fill.toLowerCase()\n counts.set(hex, (counts.get(hex) ?? 0) + 1)\n }\n }\n // A map keeps the order its keys came in, and a stable sort keeps the first of a tie first.\n return [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? null\n}\n\n/** The case most of a page's buttons of one style are set in; `null` for a page with none. */\nconst caseOf = ({ upper, lower }: { upper: number; lower: number }): 'upper' | 'none' | null => (upper + lower ? (upper > lower ? 'upper' : 'none') : null)\n\n/** Whether a button's words are written in capitals: three letters or more, none of them lower case. */\nfunction writtenInCapitals(text: string): boolean {\n const letters = text.replace(/[^\\p{L}]/gu, '')\n return letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase()\n}\n\n/**\n * What the source's look is made of (AGL-4106): its fonts, its page's\n * background and text, its filled buttons' fill, text, corners and case\n * (AGL-4152), its links' color, its header's background, its eyebrows' own\n * color (AGL-4138), and, given its sections, the fill its dark bands sit on\n * (AGL-4152).\n */\nexport function siteImportLookFacts(\n structure: SiteImportStructure,\n styles: SiteImportStyles,\n fontFaces: readonly string[] = [],\n blocks: readonly SiteImportBlock[] = [],\n sections: readonly SiteImportLayoutSection[] = [],\n darkStyles: SiteImportStyles | null = null,\n variableUses: ReadonlyMap<string, number> | null = null,\n): SiteImportLookFacts {\n const { elements } = structure\n const body = structure.body >= 0 ? structure.body : -2\n const bodyStyle = styles.of(body)\n const hexOf = (value: string | undefined) => {\n const color = siteImportColorOf(value)\n return color && color.a >= 0.5 ? siteImportHex(color) : null\n }\n const imports = structure.styles.flatMap((css) => [...css.matchAll(/@import\\s+(?:url\\()?\\s*[\"']?(https:\\/\\/fonts\\.googleapis\\.com\\/[^\"')\\s;]+)/gi)].map((match) => match[1] as string))\n const google = siteImportGoogleFamilies([...structure.stylesheets, ...imports])\n // Its body's family; where neither the body nor the root names one, the family its words are set in (AGL-4152).\n const paragraph = elements.find((element) => element.tag === 'p' && element.region === 'main') ?? elements.find((element) => element.tag === 'p')\n const bodyFamily = siteImportFontFamilies(bodyStyle.get('font-family'))[0] ?? siteImportFontFamilies(styles.of(-2).get('font-family'))[0] ?? (paragraph ? siteImportFontFamilies(styles.of(paragraph.id).get('font-family'))[0] : undefined) ?? null\n const heading = elements.find((element) => /^h[12]$/.test(element.tag) && element.region === 'main') ?? elements.find((element) => /^h[1-3]$/.test(element.tag))\n const headingFamily = heading ? (siteImportFontFamilies(styles.of(heading.id).get('font-family'))[0] ?? bodyFamily) : bodyFamily\n const known = (family: string | null) => (family && (google.includes(family) || fontFaces.includes(family) || !/^(?:arial|helvetica|helvetica neue|segoe ui|roboto fallback|times new roman|georgia|verdana)$/i.test(family)) ? family : null)\n const background = siteImportBackgroundOf(bodyStyle).color ?? siteImportBackgroundOf(styles.of(-2)).color\n // Buttons, the page's own and its header's: the most used fill.\n const fills = new Map<string, { count: number; text: string | null; radius: number[] }>()\n // Each style's case (AGL-4152): set in capitals, or written in them.\n const filledCase = { upper: 0, lower: 0 }\n const outlinedCase = { upper: 0, lower: 0 }\n const textCase = { upper: 0, lower: 0 }\n const outlines: string[] = []\n const outlinedFills: string[] = []\n const wordsOf = (element: SiteImportElement): string => {\n const own: number[] = []\n const visit = (at: number, depth: number) => {\n const node = elements[at]\n if (!node || depth > 3) return\n own.push(...node.blocks)\n for (const child of node.children) visit(child, depth + 1)\n }\n visit(element.id, 0)\n return own.map((index) => {\n const block = blocks[index]\n return block && block.kind !== 'image' ? block.text : ''\n }).join(' ')\n }\n const count = (tally: { upper: number; lower: number }, element: SiteImportElement, style: SiteImportComputedStyle) => {\n if (style.get('text-transform') === 'uppercase' || writtenInCapitals(wordsOf(element))) tally.upper += 1\n else tally.lower += 1\n }\n const linkColors = new Map<string, number>()\n for (const element of elements) {\n if (element.tag !== 'a' && element.tag !== 'button') continue\n if (element.region === 'footer') continue\n const style = styles.of(element.id)\n let under: string | null = null\n for (let at = element.parent; at >= 0; at = elements[at]?.parent ?? -1) {\n const color = siteImportBackgroundOf(styles.of(at)).color\n if (color && color.a >= 0.5) {\n under = siteImportHex(color)\n break\n }\n }\n const kind = siteImportButtonStyleOf(element, style, under ?? (background ? siteImportHex(background) : '#ffffff'))\n if (kind === 'primary') {\n const fill = siteImportBackgroundOf(style).color\n if (!fill) continue\n const hex = siteImportHex(fill)\n const entry = fills.get(hex) ?? { count: 0, text: hexOf(style.get('color')), radius: [] }\n entry.count += 1\n const radius = siteImportRadiusPx(style)\n if (radius !== null) entry.radius.push(radius)\n fills.set(hex, entry)\n count(filledCase, element, style)\n // An outlined button that fills itself is read as a filled one, and its fill said apart.\n if (OUTLINED_CLASS.test(element.attrs.class ?? '')) outlinedFills.push(hex)\n } else if (kind === 'secondary') {\n count(outlinedCase, element, style)\n const color = hexOf(style.get('color'))\n if (color) outlines.push(color)\n } else if (kind === 'quiet') {\n count(textCase, element, style)\n } else if (!kind && element.tag === 'a' && element.region === 'main') {\n // A page draws a link standing on its own as a text button (the compile's `quiet`).\n count(textCase, element, style)\n const color = hexOf(style.get('color'))\n if (color) linkColors.set(color, (linkColors.get(color) ?? 0) + 1)\n }\n }\n const topFill = [...fills.entries()].sort((a, b) => b[1].count - a[1].count)[0]\n const radii = topFill?.[1].radius ?? []\n const text = hexOf(bodyStyle.get('color'))\n // The links' color: the most used one that is not the body text's.\n const link = [...linkColors.entries()].filter(([hex]) => hex !== text).sort((a, b) => b[1] - a[1])[0]?.[0] ?? null\n const header = elements.find((element) => element.tag === 'header' && element.region === 'header') ?? elements.find((element) => element.attrs.role === 'banner')\n let headerFill: string | null = null\n for (let at = header?.id ?? -1, depth = 0; at >= 0 && depth < 3; depth += 1) {\n const color = siteImportBackgroundOf(styles.of(at)).color\n if (color && color.a >= 0.5) {\n headerFill = siteImportHex(color)\n break\n }\n const children: number[] = elements[at]?.children ?? []\n at = children.length === 1 ? (children[0] as number) : -1\n }\n // The page's own fill in its dark scheme, where its stylesheets change it.\n const darkFill = darkStyles ? (siteImportBackgroundOf(darkStyles.of(body)).color ?? siteImportBackgroundOf(darkStyles.of(-2)).color) : null\n const darkGround = darkFill && darkFill.a >= 0.5 && (!background || siteImportHex(darkFill) !== siteImportHex(background)) ? siteImportHex(darkFill) : null\n const palette = variableUses ? siteImportPaletteOf(styles, variableUses) : []\n return {\n fonts: { body: known(bodyFamily), headings: known(headingFamily), google },\n background: background ? siteImportHex(background) : null,\n text,\n buttonFill: topFill?.[0] ?? null,\n buttonText: topFill?.[1].text ?? null,\n buttonRadius: radii.length ? (radii.sort((a, b) => a - b)[Math.floor(radii.length / 2)] as number) : null,\n link,\n header: headerFill,\n darkBackground: darkGround ?? darkBackgroundOf(sections),\n paperBackground: mostUsedFill(sections.filter((section) => section.band === 'soft').map((section) => section.background)),\n darkPaper: mostUsedFill(sections.filter((section) => section.band === 'soft').map((section) => section.darkBackground)),\n // Most of each style's buttons decide; none, and its case is no fact of the source's.\n buttonCase: caseOf(filledCase),\n outlinedCase: caseOf(outlinedCase),\n textCase: caseOf(textCase),\n buttonOutline: mostUsedFill(outlines),\n outlinedFill: mostUsedFill(outlinedFills),\n // Its eyebrows' own color: none of its words', its buttons' or its links', which the theme draws already.\n eyebrow: blocks.length ? eyebrowColorOf(structure, styles, blocks, [text, topFill?.[0] ?? null, link]) : null,\n ...(palette.length ? { palette } : {}),\n }\n}\n\n/** What a layout holds, counted (AGL-4106): the reader's side of a fidelity score. */\nexport interface SiteImportLayoutCounts {\n sections: number\n bands: SiteImportBand[]\n /** Rows of two or more columns. */\n rows: number\n /** Groups by kind, and the items in them. */\n groups: Partial<Record<SiteImportGroupKind, number>>\n items: Partial<Record<SiteImportGroupKind, number>>\n tables: number\n tabs: number\n pictures: number\n /** Icons drawn: a group item's lead icon, each bullet's mark, and icons standing alone. */\n icons: number\n /** Lines the source draws as buttons. */\n buttons: number\n forms: number\n /** Videos placed (AGL-4140): where they sit, in an item, or behind a section. */\n videos: number\n /** Lines placed, each once. */\n lines: number\n}\n\n/** Counts a layout's sections, bands, rows, groups, pictures, icons and buttons. */\nexport function siteImportLayoutCounts(layout: SiteImportLayout, blocks: readonly SiteImportBlock[] = []): SiteImportLayoutCounts {\n const counts: SiteImportLayoutCounts = {\n sections: layout.sections.length,\n bands: layout.sections.map((section) => section.band),\n rows: 0,\n groups: {},\n items: {},\n tables: 0,\n tabs: 0,\n pictures: 0,\n icons: 0,\n buttons: 0,\n forms: 0,\n videos: 0,\n lines: 0,\n }\n const main = blocks.filter((block) => block.region === 'main')\n const isPicture = (ref: number) => main[ref]?.kind === 'image'\n const visit = (nodes: readonly SiteImportLayoutNode[]) => {\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n if (node.button) counts.buttons += 1\n break\n case 'picture':\n counts.pictures += 1\n break\n case 'icon':\n counts.icons += 1\n break\n case 'form':\n counts.forms += 1\n break\n case 'video':\n // Its poster is a picture of the page, as it was before the film was read.\n counts.videos += 1\n if (node.poster !== undefined) counts.pictures += 1\n break\n case 'row':\n if (node.cells.length >= 2) counts.rows += 1\n for (const cell of node.cells) visit(cell.nodes)\n break\n case 'group':\n counts.groups[node.group] = (counts.groups[node.group] ?? 0) + 1\n counts.items[node.group] = (counts.items[node.group] ?? 0) + node.items.length\n for (const item of node.items) {\n if (item.icon !== undefined) counts.icons += 1\n if (item.mark !== undefined) counts.icons += 1\n if (item.listIcon !== undefined) counts.icons += item.list?.length ?? 0\n if (item.image !== undefined || (main.length && item.lines.some(isPicture))) counts.pictures += 1\n if (item.video !== undefined) counts.videos += 1\n }\n break\n case 'table':\n counts.tables += 1\n break\n case 'tabs':\n counts.tabs += 1\n for (const tab of node.tabs) visit(tab.panel)\n break\n default:\n break\n }\n }\n }\n for (const section of layout.sections) {\n visit(section.nodes)\n if (section.backdrop?.kind === 'video') {\n counts.videos += 1\n if (section.backdrop.poster !== undefined) counts.pictures += 1\n }\n counts.lines += section.lines.length\n }\n return counts\n}\n"],"names":["AI_SITE_IMPORT_MAX_SECTIONS","siteImportFilterNodes","siteImportLayoutLines","SITE_IMPORT_CSS_WIDE_WIDTH","siteImportAspectRatio","siteImportBackgroundOf","siteImportBorderSides","siteImportColorDistance","siteImportColorOf","siteImportCssOf","siteImportPaletteOf","siteImportFontFamilies","siteImportFontSizePx","siteImportGridBoxes","siteImportGridColumns","siteImportHasBorder","siteImportHasShadow","siteImportHex","siteImportLengthPx","siteImportLuminance","siteImportOpaque","siteImportOrderOf","siteImportRadiusPx","siteImportSaturation","siteImportStylesOf","siteImportTwelfths","extractSiteImportPage","siteImportLabel","isElementPart","part","isLine","block","kind","url","inline","text","trim","BUTTON_CLASS","TEXT_BUTTON_CLASS","OUTLINED_CLASS","FILLED_CLASS","LANDMARK_TAGS","Set","SECTION_CLASS","MUI_GRID_SIZE","BOOTSTRAP_COL","BREAKPOINT_RANK","xs","sm","md","lg","xl","PRICE","PERIOD","BADGE_MAX_CHARS","BADGE_MAX_WORDS","BADGE_MIN_RADIUS","PERIOD_MAX_CHARS","WIDTH_CLASSES","STEP_NUMBER","FIGURE","TABLET_WIDTH","STATEMENT_SCALE","STATEMENT_MIN_PX","STATEMENT_MIN_WEIGHT","TILE_MAX_PX","siteImportLayout","page","stylesheets","structure","blocks","css","styles","darkStyles","sections","readSections","length","v","icons","map","icon","look","siteImportLookFacts","fontFaces","variableUses","sheets","siteImportDarkStylesOf","reader","LayoutReader","videos","some","sheet","test","undefined","scheme","darkRules","readPlacement","id","elements","style","node","region","nav","children","display","get","readGrid","readOrder","element","orderOf","child","content","filter","leaves","sorted","at","sort","a","b","entry","setChildren","includes","moveLeaves","grid","boxes","items","lines","leaf","box","words","heading","picture","item","other","overLaid","placedBehind","add","bands","siteImportGridBands","has","flatMap","band","drawnRow","rest","placed","set","flat","cell","cells","row","drawnElement","only","held","placedWidth","end","start","parent","push","tag","attrs","own","leafMemo","clear","moved","places","order","forEach","list","inRange","range","parts","first","find","unwrap","guard","of","written","root","main","body","all","Number","POSITIVE_INFINITY","rootLeaves","container","elementParts","landmarks","isLandmark","cuts","Math","max","ceil","cutsAt","holdsHeading","lineCount","containersHoldSections","headingCuts","cut","slice","section","markHero","capSections","kept","last","extra","nodes","role","label","class","level","containers","starts","from","pendingFrom","lo","min","anchor","index","before","previous","looksLikeEyebrow","unshift","scope","read","readLeaves","name","nameOf","linesOf","bandOf","behind","backdrop","videoBehind","withoutVideo","video","background","poster","dark","width","widthOf","align","alignOf","keepOwnAlign","absolute","absoluteBand","darkBackground","videoHolding","leafNode","mainBlocks","ref","line","mainBlocksMemo","wrappersOf","chain","depth","inherited","found","backgroundBand","hex","color","image","gradient","stops","stop","light","reduce","sum","siteImportBandOn","pageGround","siteImportBandOfColor","theme","capOf","wideStyles","wideStylesOf","property","value","px","classes","pattern","around","caps","videoNode","table","strips","tabStrips","readTabs","gridTable","runs","groupRuns","isRow","inFlow","outOfFlow","rowWorthy","laid","out","run","group","form","wrap","wrapperOf","href","anchorHref","fit","pictureFit","button","buttonStyle","roleOf","inPill","chip","ink","inkOf","height","ratio","round","objectFit","fills","radius","shadow","cap","measure","Object","keys","backgroundUnder","fill","filled","tileOf","tags","anchors","siteImportVideoNodes","autoplay","position","siteImportButtonStyleOf","host","size","bodySize","siteImportFontWeight","siteImportIsEyebrowText","columns","substantial","weights","weightsOf","groups","every","boxed","rule","cols","count","template","sized","cellSize","best","match","matchAll","rank","percent","exec","grow","signature","join","kinds","isChip","couldBeItem","loose","key","framed","headings","frameOf","sides","drawn","side","border","under","frame","frames","chips","groupKind","columnsOf","half","ruled","lead","title","lineText","figure","next","dropLine","siteImportIsMutedInk","figureMuted","question","indexOf","link","price","takePeriod","takeBadge","isWordRow","columnsSm","columnsSmOf","itemsAlignOf","column","tabletStyles","tabletStylesOf","period","badge","isBadge","split","alt","film","firstLine","leadIcon","listed","inner","members","listRuns","member","marks","mark","listIcon","imageFit","trailing","closing","ctas","titleBlock","to","tile","markOf","bullets","same","replace","refsIn","commonAncestor","contains","taken","oneLine","share","blockKinds","visual","titled","sizes","rows","visit","header","tableRows","widths","common","mode","longest","tabsMemo","Map","panels","strip","tabs","findAll","tab","panel","candidate","panelAttrs","controls","labelledby","resolved","shift","home","chains","step","inside","outside","tabsNode","selected","findRole","ancestor","hero","h1","beside","cellOf","findIndex","pictureBehind","placedUnderWords","measureOf","mainIndex","siteImportMeasurePx","usedPanels","blockElement","ground","overlapOf","aStart","aEnd","bStart","bEnd","rowStart","rowEnd","columnStart","columnEnd","NEGATIVE_INFINITY","joins","columnsFor","overlaps","CH_EM","fontPx","toLowerCase","one","term","amount","terms","letters","toUpperCase","values","counts","entries","SAME_GROUND","r","g","saturation","bordered","padded","classed","siteImportGoogleFamilies","urls","families","raw","URL","hostname","searchParams","getAll","siteImportLookOf","siteImportLookOfHtml","html","pageUrl","origin","extract","SAME_COLOR","eyebrowColorOf","not","inControl","top","others","darkBackgroundOf","mostUsedFill","caseOf","upper","lower","writtenInCapitals","bodyStyle","hexOf","imports","google","paragraph","bodyFamily","headingFamily","known","family","filledCase","outlinedCase","textCase","outlines","outlinedFills","wordsOf","tally","linkColors","topFill","radii","headerFill","darkFill","darkGround","palette","fonts","buttonFill","buttonText","buttonRadius","floor","paperBackground","darkPaper","buttonCase","buttonOutline","outlinedFill","eyebrow","siteImportLayoutCounts","layout","tables","pictures","buttons","forms","isPicture"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK0R,QAAQ,KAAKjU,WAAW0Z,OAAOza,KAAK,aAAIsD,aAAAA,KAAKmC,IAAI,qBAATnC,WAAWxD,MAAM,mBAAI;wBACtE,IAAIwD,KAAK+H,KAAK,KAAKtK,aAAcqF,KAAKtG,MAAM,IAAIwD,KAAKN,KAAK,CAACpC,IAAI,CAACwe,YAAa3E,OAAOwE,QAAQ,IAAI;wBAChG,IAAI3b,KAAKqG,KAAK,KAAK5I,WAAW0Z,OAAO9Z,MAAM,IAAI;oBACjD;oBACA;gBACF,KAAK;oBACH8Z,OAAOuE,MAAM,IAAI;oBACjB;gBACF,KAAK;oBACHvE,OAAOvD,IAAI,IAAI;oBACf,KAAK,MAAME,OAAO9V,KAAK4V,IAAI,CAAEX,MAAMa,IAAIC,KAAK;oBAC5C;gBACF;oBACE;YACJ;QACF;IACF;IACA,KAAK,MAAM5P,WAAWsX,OAAOnf,QAAQ,CAAE;YAEjC6H;QADJ8O,MAAM9O,QAAQM,KAAK;QACnB,IAAIN,EAAAA,oBAAAA,QAAQ+B,QAAQ,qBAAhB/B,kBAAkBvK,IAAI,MAAK,SAAS;YACtCud,OAAO9Z,MAAM,IAAI;YACjB,IAAI8G,QAAQ+B,QAAQ,CAACK,MAAM,KAAK9I,WAAW0Z,OAAOwE,QAAQ,IAAI;QAChE;QACAxE,OAAOzX,KAAK,IAAIyE,QAAQzE,KAAK,CAAClD,MAAM;IACtC;IACA,OAAO2a;AACT"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/site-import/site-import-layout.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE SOURCE'S LAYOUT, READ BY CODE (AGL-4106).\n *\n * An imported page used to be its lines and nothing else: every section\n * cut at an `h2`, every card a run of paragraphs, every icon gone, so the\n * page came out one column of text. This reads how the source lays the page\n * out, with no model, into a tree whose leaves are the page's own lines by\n * index (`SiteImportLayout`); the compile draws it with the site's own cards,\n * columns, pictures, icons and bands.\n *\n * - **Sections.** The source's own: the `<section>`s (or `<article>`s, or\n * labeled regions) its `<main>` is made of, else the containers of their\n * own that each hold a heading, else the stretches its `h1` and `h2` open.\n * The eyebrow that opens a section stays in it. Each gets its name (its\n * `aria-label`, else its heading) and its band, from its background: white\n * is `plain`, a light grey or tint `soft`, a strong color `brand`, a dark\n * color, a gradient or a photo `dark`.\n * - **Rows.** A container that lays its children side by side (a grid with\n * columns, a flex row, a grid framework's row and cells, a table row) is a\n * row; its columns' widths come from the grid template, the cells' sizes\n * or equal shares, in twelfths.\n * - **Placement (AGL-4152).** A grid whose children name where they go is read\n * in the rows and columns a visitor sees, whatever order its markup writes\n * them in: each child's box from its `grid-area`, `grid-row` or\n * `grid-column`, cells by row overlap and then column overlap, and rows\n * built to the same columns stacked into those columns, so a card's words\n * stay under its own heading. What comes out is rows, cells and groups like\n * any others. `order` on a flex or grid child is read the same way. A page\n * laid whole on one grid is cut into the parts it draws: a box painted across\n * it behind its rows is a band of its own, and past that a row with an `h1`\n * or an `h2` opens a part.\n * - **Groups.** Three or more siblings built alike (the same elements in the\n * same order) are a group, and what they hold says its kind: icon or\n * picture with a title and words are `cards`, a leading number `steps`, a\n * short figure over a label `stats`, questions with answers `faq`, quotes\n * `quotes`, pictures alone `logos`, a price with a period `pricing`.\n * Rows of cells built alike are a `table`; a `tablist` is `tabs`.\n * - **Pictures, icons, buttons.** Every picture where it sits (one inside a\n * button or a link too); every inline icon, once, by index; every link or\n * button the source draws as a button, filled (`primary`), outlined\n * (`secondary`) or plain (`quiet`).\n * - **Videos (AGL-4140).** Every video where it sits, its poster the picture\n * inside it; a film that plays on its own behind a section's words is that\n * section's backdrop.\n * - **The look.** The fonts (Google Fonts' named), the page's background and\n * text, the buttons' fill and corners, the links' color, the header's\n * background: what the look pass draws the site's theme from.\n *\n * Class names are hints a framework leaves (`MuiGrid-grid-md-4`, `col-md-6`),\n * never the rule: the reader reads what an element draws, through the page's\n * own stylesheets (`site-import-css.ts`). Nothing a page wrote runs.\n *=========================================*/\n\nimport {\n AI_SITE_IMPORT_MAX_SECTIONS,\n siteImportFilterNodes,\n siteImportLayoutLines,\n type SiteImportBand,\n type SiteImportButtonStyle,\n type SiteImportGroupKind,\n type SiteImportHeroPicture,\n type SiteImportIconTile,\n type SiteImportLayout,\n type SiteImportLayoutGroup,\n type SiteImportLayoutItem,\n type SiteImportLayoutLine,\n type SiteImportLayoutNode,\n type SiteImportLayoutSection,\n type SiteImportLayoutTable,\n type SiteImportLayoutTabs,\n type SiteImportLayoutVideo,\n type SiteImportLineRef,\n type SiteImportLookFacts,\n type SiteImportPictureFit,\n type SiteImportRule,\n} from '../model/ai-site-import'\nimport {\n SITE_IMPORT_CSS_WIDE_WIDTH,\n siteImportAspectRatio,\n siteImportBackgroundOf,\n siteImportBorderSides,\n siteImportColorDistance,\n siteImportColorOf,\n siteImportCssOf,\n siteImportPaletteOf,\n siteImportFontFamilies,\n siteImportFontSizePx,\n siteImportGridBoxes,\n siteImportGridColumns,\n siteImportGridTrackCount,\n siteImportHasBorder,\n siteImportHasShadow,\n siteImportHex,\n siteImportLengthPx,\n siteImportLuminance,\n siteImportOpaque,\n siteImportOrderOf,\n siteImportRadiusPx,\n siteImportSaturation,\n siteImportStylesOf,\n siteImportTwelfths,\n type SiteImportComputedStyle,\n type SiteImportGridBox,\n type SiteImportRgba,\n type SiteImportStyles,\n} from './site-import-css'\nimport { extractSiteImportPage, type SiteImportBlock, type SiteImportElement, type SiteImportExtract, type SiteImportStructure } from './site-import-html'\nimport { siteImportLabel } from './site-import-page'\n\n/** A page as the layout reader takes it: its blocks, its videos and how it is built. */\nexport type SiteImportLayoutSource = Pick<SiteImportExtract, 'blocks' | 'videos'> & { structure: SiteImportStructure }\n\n/** One thing in the page's order: a line (by its main-region index) or an icon. */\ninterface Leaf {\n /** Its place in the order a visitor reads the page: the markup's, but for what a grid or `order` moves (AGL-4152). */\n order: number\n /** Its place in the markup: the block's index, for a line. */\n written: number\n kind: 'line' | 'icon' | 'form' | 'video'\n /** The line's index among the main-region blocks; the icon's, the form's or the video's index. */\n ref: number\n element: number\n}\n\n/** A part of a container: one of its children with content, or a leaf directly in it. */\ntype Part = { element: number; first: number } | { leaf: Leaf; first: number }\n\nconst isElementPart = (part: Part): part is { element: number; first: number } => 'element' in part\n\n/** Whether a block is a line of its own: a link inside a sentence is in its sentence already. */\nfunction isLine(block: SiteImportBlock): boolean {\n if (block.kind === 'image') return !!block.url\n if (block.kind === 'link') return !block.inline && !!block.text.trim()\n return !!block.text.trim()\n}\n\nconst BUTTON_CLASS = /(?:^|[\\s_-])(?:btn|button)(?:$|[\\s_-])|Button-root|wp-block-button__link|sqs-block-button-element|elementor-button|w-button/i\nconst TEXT_BUTTON_CLASS = /MuiButton-text\\b|btn-link\\b|is-style-text/i\n/** An element's own `--primary` or `--secondary` (AGL-4152), whatever it is called, never a longer name that starts so (`--primary-inverse`). */\nconst OUTLINED_CLASS = /MuiButton-outlined\\b|btn-outline|is-style-outline|--outline|--secondary(?=\\s|$)|btn-secondary/i\nconst FILLED_CLASS = /MuiButton-contained\\b|btn-primary|--primary(?=\\s|$)|--solid|is-style-fill/i\nconst LANDMARK_TAGS = new Set(['section', 'article', 'aside'])\nconst SECTION_CLASS = /(?:^|[\\s_-])(?:section|page-section|wp-block-group|elementor-section|e-con|shopify-section|block-section)(?:$|[\\s_-])/i\nconst MUI_GRID_SIZE = /\\bMuiGrid-grid-(xs|sm|md|lg|xl)-(\\d+)\\b/g\nconst BOOTSTRAP_COL = /\\bcol-(?:(sm|md|lg|xl)-)?(\\d{1,2})\\b/g\nconst BREAKPOINT_RANK: Record<string, number> = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4 }\nconst PRICE = /(?:[$€£¥₹]\\s?\\d|\\d+(?:[.,]\\d+)?\\s?(?:USD|EUR|GBP|CAD|AUD)\\b)/\nconst PERIOD = /\\/\\s?(?:mo|month|yr|year|user|seat|site)\\b|\\bper (?:month|year|user|seat)\\b|\\bmonthly\\b|\\bannual(?:ly)?\\b|\\bbilled\\b|\\ba month\\b|\\ba year\\b/i\n/** A tag on an item: its longest words, and the corners a pill is drawn with. */\nconst BADGE_MAX_CHARS = 20\nconst BADGE_MAX_WORDS = 2\nconst BADGE_MIN_RADIUS = 12\n/** The longest line a price's period is: \"/mo\", \"per seat\". */\nconst PERIOD_MAX_CHARS = 12\n/** The columns a framework's own class caps itself at, where the page's sheets do not say. */\nconst WIDTH_CLASSES: ReadonlyArray<readonly [RegExp, number]> = [\n [/\\bMuiContainer-maxWidthXl\\b/, 1536],\n [/\\bMuiContainer-maxWidthLg\\b/, 1200],\n [/\\bMuiContainer-maxWidthMd\\b/, 900],\n [/\\bMuiContainer-maxWidthSm\\b/, 600],\n [/\\balignfull\\b/, 1536],\n [/\\balignwide\\b/, 1200],\n [/(?:^|\\s)container(?:\\s|$)/, 1320],\n]\nconst STEP_NUMBER = /^(?:step\\s*)?(?:0?\\d{1,2}|[ivx]{1,4})[.):]?$/i\nconst FIGURE = /^[^\\s]{0,3}[\\d][\\d.,:/x×+%kmb$€£-]*\\s?[^\\s]{0,12}$|^\\d+-[a-z]+$/i\n/** A picture drawn at this share of the screen or more is a photo (AGL-4152), in percent. */\nconst GALLERY_MIN_SHARE = 15\n/** A picture this wide or wider, by its own size, is a photo where no sheet holds it to a mark's height. */\nconst GALLERY_MIN_PX = 400\nconst GALLERY_MAX_RATIO = 2.4\n/** The tallest a sheet draws a mark. */\nconst MARK_MAX_PX = 100\n/** A gallery's columns where nothing says them, and the most it is drawn in. */\nconst GALLERY_COLUMNS = 3\nconst GALLERY_COLUMNS_MAX = 4\n/** The width a page is read at for its tablet columns (AGL-4138): between a framework's `sm` and `md`. */\nconst TABLET_WIDTH = 768\n/** A paragraph set this much larger than the body, and bold, is a statement (AGL-4138), not a lede. */\nconst STATEMENT_SCALE = 1.75\nconst STATEMENT_MIN_PX = 28\nconst STATEMENT_MIN_WEIGHT = 600\n/** The widest square an icon's tile is (AGL-4138); wider, it is a card of its own. */\nconst TILE_MAX_PX = 64\n\n/**\n * The page's layout from its structure and its linked stylesheets' text,\n * over its main-region lines. `null` for a page with no structure or no main\n * content.\n */\nexport function siteImportLayout(page: SiteImportLayoutSource, stylesheets: readonly string[] = []): SiteImportLayout | null {\n const { structure, blocks } = page\n if (!structure) return null\n const { css, styles, darkStyles, sections } = readSections(page, stylesheets)\n if (!sections.length) return null\n return {\n v: 1,\n sections,\n icons: structure.icons.map((icon) => ({ ...icon })),\n look: siteImportLookFacts(structure, styles, css.fontFaces, blocks, sections, darkStyles, css.variableUses),\n }\n}\n\n/** A page's sections, as the layout reads them, with the stylesheets and styles they were read through. */\nfunction readSections(page: SiteImportLayoutSource, stylesheets: readonly string[]) {\n const { structure, blocks } = page\n const sheets = [...structure.styles, ...stylesheets]\n const css = siteImportCssOf(sheets)\n const styles = siteImportStylesOf(structure, css)\n const darkStyles = siteImportDarkStylesOf(structure, sheets)\n const reader = new LayoutReader(\n structure,\n blocks,\n styles,\n () => siteImportStylesOf(structure, siteImportCssOf(sheets, SITE_IMPORT_CSS_WIDE_WIDTH)),\n () => siteImportStylesOf(structure, siteImportCssOf(sheets, TABLET_WIDTH)),\n page.videos ?? [],\n darkStyles,\n )\n return { css, styles, darkStyles, sections: reader.sections() }\n}\n\n/** A page's styles in its dark scheme (AGL-4152), `null` where its stylesheets say nothing of one. */\nfunction siteImportDarkStylesOf(structure: SiteImportStructure, sheets: readonly string[]): SiteImportStyles | null {\n if (!sheets.some((sheet) => /dark/i.test(sheet))) return null\n const css = siteImportCssOf(sheets, undefined, { scheme: 'dark' })\n return css.darkRules ? siteImportStylesOf(structure, css) : null\n}\n\n/** A section's fill as the reader finds it: its band, what its color alone would call it, and the fill. */\ninterface ReadBand {\n band: SiteImportBand\n absolute?: SiteImportBand\n background: string | null\n backdrop?: SiteImportLayoutSection['backdrop']\n}\n\nclass LayoutReader {\n /** The page's elements; a grid placed by its children's rules holds the rows and cells a visitor sees (AGL-4152). */\n private readonly elements: SiteImportElement[]\n /** A grid read by its children's places: `stack` when its children now run down the page, `row` for a row of cells it draws. */\n private readonly placed = new Map<number, 'stack' | 'row'>()\n /** A cell's width on its grid, in tracks. */\n private readonly placedWidth = new Map<number, number>()\n /** A placed child that holds no words and has words laid over it. */\n private readonly placedBehind = new Set<number>()\n /** Where a placed grid draws the parts of a page, a band of its own or a heading opening each (AGL-4152). */\n private readonly drawnParts = new Map<number, DrawnPart[]>()\n /** Block index → its index among the main-region blocks; -1 for every other block. */\n private readonly mainIndex: number[]\n /** Each element's leaves, its subtree's, in order (memoized). */\n private readonly leafMemo = new Map<number, Leaf[]>()\n /** Each element's own leaves. */\n private readonly own: Leaf[][]\n /** Tab panels a tab strip has read already. */\n private readonly usedPanels = new Set<number>()\n private bodySize = 16\n private wideStyles: SiteImportStyles | null = null\n private tabletStyles: SiteImportStyles | null = null\n /** The page's own ground, which a light band is read against (AGL-4152). */\n private readonly pageGround: SiteImportRgba | null\n\n constructor(\n private readonly structure: SiteImportStructure,\n private readonly blocks: readonly SiteImportBlock[],\n private readonly styles: SiteImportStyles,\n private readonly wideStylesOf: () => SiteImportStyles,\n private readonly tabletStylesOf: () => SiteImportStyles = () => styles,\n private readonly videos: NonNullable<SiteImportExtract['videos']> = [],\n private readonly darkStyles: SiteImportStyles | null = null,\n ) {\n this.elements = [...structure.elements]\n this.mainIndex = []\n let main = 0\n for (const block of blocks) this.mainIndex.push(block.region === 'main' ? main++ : -1)\n this.own = this.elements.map(() => [])\n structure.blockElement.forEach((element, index) => {\n const block = blocks[index]\n const ref = this.mainIndex[index] ?? -1\n if (!block || ref < 0 || !isLine(block)) return\n this.own[element]?.push({ order: index, written: index, kind: 'line', ref, element })\n })\n for (const element of this.elements) {\n if (element.region !== 'main' || element.nav) continue\n const order = element.order ?? 0\n if (element.icon !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'icon', ref: element.icon, element: element.id })\n if (element.form !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'form', ref: element.form, element: element.id })\n if (element.video !== undefined) this.own[element.id]?.push({ order, written: order, kind: 'video', ref: element.video, element: element.id })\n }\n const body = structure.body >= 0 ? structure.body : -2\n this.bodySize = siteImportFontSizePx(styles.of(body)) ?? 16\n const ground = siteImportBackgroundOf(styles.of(body)).color ?? siteImportBackgroundOf(styles.of(-2)).color\n this.pageGround = ground && ground.a >= 0.5 ? ground : null\n this.readPlacement()\n }\n\n /*---------------- what a grid or `order` moves (AGL-4152) ----------------*/\n\n /**\n * The page as a visitor reads it: each flex or grid container whose children\n * say where they go, inner ones first, has its children set in that order.\n * Every container that says nothing is untouched, its order the markup's.\n */\n private readPlacement(): void {\n for (let id = this.elements.length - 1; id >= 0; id -= 1) {\n const node = this.elements[id] as SiteImportElement\n if (node.region !== 'main' || node.nav || node.children.length < 2) continue\n const style = this.style(id)\n const display = style.get('display') ?? ''\n if (!/\\b(?:grid|flex)\\b/.test(display)) continue\n if (/\\bgrid\\b/.test(display) && this.readGrid(id, style)) continue\n this.readOrder(id)\n }\n }\n\n /** A row's or a grid's children in their `order`, where any sets one. */\n private readOrder(element: number): void {\n const node = this.elements[element] as SiteImportElement\n const orderOf = (child: number) => siteImportOrderOf(this.style(child))\n const content = node.children.filter((child) => this.leaves(child).length)\n if (!content.some((child) => orderOf(child) !== 0)) return\n const sorted = content.map((child, at) => ({ child, at })).sort((a, b) => orderOf(a.child) - orderOf(b.child) || a.at - b.at).map((entry) => entry.child)\n this.setChildren(element, [...sorted, ...node.children.filter((child) => !content.includes(child))])\n this.moveLeaves(sorted)\n }\n\n /** A grid read by its children's boxes; `false`, and nothing changed, where they do not say where they go. */\n private readGrid(grid: number, style: SiteImportComputedStyle): boolean {\n const node = this.elements[grid] as SiteImportElement\n // What is not drawn takes no cell: it stays where it is read, after what is.\n const content = node.children.filter((child) => this.leaves(child).length && this.style(child).get('display') !== 'none')\n if (content.length < 2) return false\n // A box it draws and writes nothing in (a filled rectangle behind the words) takes its cells too, and says where a band runs.\n const painted = node.children.filter((child) => !this.leaves(child).length && this.style(child).get('display') !== 'none' && this.paints(child))\n const boxes = siteImportGridBoxes(style, [...content, ...painted].map((child) => this.style(child)))\n if (!boxes) return false\n const items = content.map((element, at): PlacedItem => {\n const lines = this.leaves(element).filter((leaf) => leaf.kind === 'line').map((leaf) => this.block(leaf)?.kind)\n return {\n element,\n box: boxes[at] as SiteImportGridBox,\n words: lines.some((kind) => kind !== 'image'),\n heading: lines.includes('heading'),\n picture: lines.includes('image') || this.leaves(element).some((leaf) => leaf.kind === 'video'),\n }\n })\n for (const item of items) if (!item.words && items.some((other) => other.words && overLaid(other.box, item.box))) this.placedBehind.add(item.element)\n const bands = siteImportGridBands(items, (item) => this.placedBehind.has(item.element))\n const children = bands.flatMap((band) => (band.length === 1 ? (band[0] as DrawnCell).items.map((item) => item.element) : [this.drawnRow(grid, band)]))\n const rest = node.children.filter((child) => !content.includes(child))\n this.setChildren(grid, [...children, ...rest])\n this.placed.set(grid, 'stack')\n this.moveLeaves([...bands.flat().flatMap((cell) => cell.items.map((item) => item.element)), ...rest])\n this.readDrawnParts(grid, bands, painted.map((element, at) => ({ element, box: boxes[content.length + at] as SiteImportGridBox })), siteImportGridTrackCount(style.get('grid-template-columns')))\n return true\n }\n\n /** Whether an element that holds no line paints a box: a fill of its own, or a drawing of a plain box, as far in as it holds only one thing. */\n private paints(element: number): boolean {\n return this.paintedFill(element) !== null || this.holdsPlainBox(element)\n }\n\n private holdsPlainBox(element: number): boolean {\n const node = this.elements[element]\n if (!node) return false\n return (node.tag === 'aglyn-svg' && node.attrs.type === 'box') || node.children.some((child) => this.holdsPlainBox(child))\n }\n\n /** The fill an element with no line paints, on it or on the one wrapper at a time inside it. */\n private paintedFill(element: number): SiteImportRgba | null {\n let at = element\n for (let depth = 0; depth < 4 && at >= 0; depth += 1) {\n const fill = siteImportBackgroundOf(this.style(at)).color\n if (fill && fill.a >= 0.5) return fill\n const children: number[] = this.elements[at]?.children ?? []\n if (children.length !== 1) return null\n at = children[0] as number\n }\n return null\n }\n\n /**\n * The parts of a page one placed grid holds (AGL-4152): some builders lay a\n * whole page on one grid in one section. A box painted across the grid behind\n * its rows is a band of its own; past that, a row that holds an `h1` or an\n * `h2` opens a part, as it would anywhere. A row of only buttons standing over\n * a part goes with it. Read at the end, for an outer grid may yet move these.\n */\n private readDrawnParts(grid: number, bands: readonly DrawnCell[][], painted: ReadonlyArray<{ element: number; box: SiteImportGridBox }>, tracks: number | null): void {\n const allColumns = tracks ?? Math.max(...bands.flat().map((cell) => cell.end - 1), ...painted.map((entry) => entry.box.columnEnd - 1))\n const wide = painted.filter((entry) => (entry.box.columnEnd - entry.box.columnStart) * 5 >= allColumns * 3)\n const itemsOf = (band: readonly DrawnCell[]) => band.flatMap((cell) => cell.items)\n const boxOf = (band: readonly DrawnCell[]) => {\n const items = itemsOf(band)\n const from = Math.min(...items.map((item) => item.box.rowStart))\n const to = Math.max(...items.map((item) => item.box.rowEnd))\n return wide.find((entry) => overlapOf(from, to, entry.box.rowStart, entry.box.rowEnd) * 2 >= to - from) ?? null\n }\n const opensPart = (band: readonly DrawnCell[]) => itemsOf(band).some((item) => this.leaves(item.element).some((leaf) => {\n const block = this.block(leaf)\n return block?.kind === 'heading' && block.level <= 2\n }))\n const onlyLinks = (band: readonly DrawnCell[]) => itemsOf(band).every((item) => this.leaves(item.element).every((leaf) => this.block(leaf)?.kind === 'link'))\n const starts: Array<{ at: number; box: { element: number; box: SiteImportGridBox } | null }> = []\n let held: { element: number; box: SiteImportGridBox } | null = null\n bands.forEach((band, at) => {\n const box = boxOf(band)\n if (!starts.length || box !== held || (!box && opensPart(band))) starts.push({ at, box })\n held = box\n })\n for (const start of starts.slice(1)) {\n const before = bands[start.at - 1]\n if (!start.box && before && !boxOf(before) && onlyLinks(before) && !starts.some((other) => other.at === start.at - 1)) start.at -= 1\n }\n if (starts.length < 2) return\n this.drawnParts.set(grid, starts.map((start) => ({\n elements: itemsOf(bands[start.at] as DrawnCell[]).map((item) => item.element),\n ...(start.box ? { box: start.box.element } : {}),\n })))\n }\n\n /** The sections a whole section's placed grid draws, each read from it by the range it holds. */\n private partsOf(cut: Cut): Cut[] {\n if (cut.anchor === null) return [cut]\n const parts = this.drawnParts.get(this.unwrap(cut.anchor, cut.range))\n if (!parts) return [cut]\n const starts = parts.map((part) => Math.min(...part.elements.flatMap((element) => this.leaves(element).map((leaf) => leaf.order))))\n return parts.map((part, at) => {\n const drawn = part.box === undefined ? null : this.partBand(part.box, starts[at] as number, starts[at + 1] ?? Number.POSITIVE_INFINITY, cut.anchor as number)\n return {\n element: cut.element,\n anchor: cut.anchor,\n from: cut.from,\n range: [at === 0 ? cut.range[0] : (starts[at] as number), at === parts.length - 1 ? cut.range[1] : (starts[at + 1] as number)] as [number, number],\n ...(drawn ? { drawn } : {}),\n }\n })\n }\n\n /** The band a painted box draws: its fill, or where a sheet paints it some way no sheet says, what the words set on it say of it. */\n private partBand(box: number, from: number, to: number, within: number): ReadBand | null {\n const fill = this.paintedFill(box)\n if (fill) return { band: siteImportBandOn(fill, this.pageGround), absolute: siteImportBandOfColor(fill), background: siteImportHex(fill) }\n const lines = this.leaves(within).filter((entry) => entry.order >= from && entry.order < to && entry.kind === 'line' && !/^(?:image|link)$/.test(this.block(entry)?.kind ?? ''))\n const light = lines.filter((entry) => {\n const ink = this.wordsInk(entry.element)\n return !!ink && ink.a >= 0.5 && siteImportLuminance(ink) >= LIGHT_INK\n })\n return lines.length && light.length * 2 >= lines.length ? { band: 'dark', background: null } : null\n }\n\n /** The color a line's words are set in, by the element that holds them: the inline one a text editor wraps them in, where there is one. */\n private wordsInk(element: number): SiteImportRgba | null {\n let at = element\n for (let depth = 0; depth < 3; depth += 1) {\n const children: number[] = this.elements[at]?.children ?? []\n if (children.length !== 1) break\n at = children[0] as number\n }\n return siteImportColorOf(this.style(at).get('color'))\n }\n\n /** A row a placed grid draws: its cells side by side, each one child or the children stacked in it. */\n private drawnRow(grid: number, cells: readonly DrawnCell[]): number {\n const row = this.drawnElement(grid)\n this.placed.set(row, 'row')\n this.setChildren(\n row,\n cells.map((cell) => {\n const only = cell.items.length === 1 ? (cell.items[0] as PlacedItem).element : null\n const held = only ?? this.drawnElement(row)\n if (only === null) this.setChildren(held, cell.items.map((item) => item.element))\n this.placedWidth.set(held, cell.end - cell.start)\n return held\n }),\n )\n return row\n }\n\n /** A box the page does not write but draws, styled by nothing: its id is past every written element's. */\n private drawnElement(parent: number): number {\n const { region, nav } = this.elements[parent] as SiteImportElement\n const id = this.elements.length\n this.elements.push({ id, tag: 'div', parent, children: [], region, nav, attrs: {}, blocks: [] })\n this.own.push([])\n return id\n }\n\n private setChildren(element: number, children: number[]): void {\n this.elements[element] = { ...(this.elements[element] as SiteImportElement), children }\n for (const child of children) this.elements[child] = { ...(this.elements[child] as SiteImportElement), parent: element }\n this.leafMemo.clear()\n }\n\n /** These elements' leaves, in the order given, take the places they hold among themselves, so nothing around them moves. */\n private moveLeaves(elements: readonly number[]): void {\n const moved = elements.flatMap((element) => this.leaves(element))\n const places = moved.map((leaf) => leaf.order).sort((a, b) => a - b)\n moved.forEach((leaf, at) => {\n leaf.order = places[at] as number\n })\n this.leafMemo.clear()\n }\n\n /*---------------- leaves and parts ----------------*/\n\n leaves(element: number): Leaf[] {\n const held = this.leafMemo.get(element)\n if (held) return held\n const node = this.elements[element]\n if (!node) return []\n const list = [...(this.own[element] ?? [])]\n for (const child of node.children) list.push(...this.leaves(child))\n list.sort((a, b) => a.order - b.order)\n this.leafMemo.set(element, list)\n return list\n }\n\n private inRange(leaf: Leaf, range: readonly [number, number]): boolean {\n return leaf.order >= range[0] && leaf.order < range[1]\n }\n\n private parts(element: number, range: readonly [number, number]): Part[] {\n const node = this.elements[element]\n if (!node) return []\n const parts: Part[] = []\n for (const leaf of this.own[element] ?? []) if (this.inRange(leaf, range)) parts.push({ leaf, first: leaf.order })\n for (const child of node.children) {\n const first = this.leaves(child).find((leaf) => this.inRange(leaf, range))\n if (first) parts.push({ element: child, first: first.order })\n }\n return parts.sort((a, b) => a.first - b.first)\n }\n\n /** Down through wrappers that hold one part, to the element whose parts are the content. */\n private unwrap(element: number, range: readonly [number, number]): number {\n let at = element\n for (let guard = 0; guard < 64; guard += 1) {\n const parts = this.parts(at, range)\n if (parts.length !== 1 || !isElementPart(parts[0] as Part)) return at\n at = (parts[0] as { element: number }).element\n }\n return at\n }\n\n private style(element: number): SiteImportComputedStyle {\n return this.styles.of(element)\n }\n\n private block(leaf: Leaf): SiteImportBlock | undefined {\n return this.blocks[leaf.written]\n }\n\n /*---------------- sections ----------------*/\n\n sections(): SiteImportLayoutSection[] {\n const root = this.structure.main >= 0 ? this.structure.main : this.structure.body\n const all: readonly [number, number] = [-1, Number.POSITIVE_INFINITY]\n const rootLeaves = root >= 0 ? this.leaves(root) : this.elements.filter((element) => element.parent < 0).flatMap((element) => this.leaves(element.id))\n if (!rootLeaves.length) return []\n const container = root >= 0 ? this.unwrap(root, all) : -1\n const parts = container >= 0 ? this.parts(container, all) : []\n const elementParts = parts.filter(isElementPart)\n const landmarks = elementParts.filter((part) => this.isLandmark(part.element))\n let cuts: Cut[] = []\n // A page laid whole on one placed grid is the parts it draws (AGL-4152).\n if (container >= 0 && this.drawnParts.has(container)) cuts = this.partsOf({ element: container, anchor: container, range: [all[0], all[1]], from: 'container' })\n else if (elementParts.length >= 2 && landmarks.length >= Math.max(2, Math.ceil(elementParts.length / 2))) {\n // A container of its own among the landmarks (a post's article column) is a section too; a stray line joins the next.\n cuts = this.cutsAt(parts, (part) => this.isLandmark(part.element) || this.holdsHeading(part.element) || this.lineCount(part.element) >= 3, 'landmark')\n } else if (elementParts.length >= 2 && this.containersHoldSections(elementParts)) {\n cuts = this.cutsAt(parts, (part) => this.holdsHeading(part.element), 'container')\n }\n if (!this.drawnParts.has(container)) cuts = cuts.flatMap((cut) => this.partsOf(cut))\n if (cuts.length < 2) cuts = this.headingCuts(rootLeaves)\n const sections: SiteImportLayoutSection[] = []\n for (const cut of cuts.slice(0, AI_SITE_IMPORT_MAX_SECTIONS * 2)) {\n const section = this.section(cut, container, sections.length)\n if (section) sections.push(section)\n }\n this.markHero(sections)\n return this.capSections(sections)\n }\n\n /** At most `AI_SITE_IMPORT_MAX_SECTIONS`: the last holds whatever follows. */\n private capSections(sections: SiteImportLayoutSection[]): SiteImportLayoutSection[] {\n if (sections.length <= AI_SITE_IMPORT_MAX_SECTIONS) return sections\n const kept = sections.slice(0, AI_SITE_IMPORT_MAX_SECTIONS)\n const last = kept[kept.length - 1] as SiteImportLayoutSection\n for (const extra of sections.slice(AI_SITE_IMPORT_MAX_SECTIONS)) {\n last.nodes.push(...extra.nodes)\n last.lines.push(...extra.lines)\n }\n return kept\n }\n\n private isLandmark(element: number): boolean {\n const node = this.elements[element]\n if (!node) return false\n if (LANDMARK_TAGS.has(node.tag)) return true\n if (node.attrs.role === 'region' || (node.attrs.label && /^(?:div|section)$/.test(node.tag))) return true\n return SECTION_CLASS.test(node.attrs.class ?? '')\n }\n\n private lineCount(element: number): number {\n return this.leaves(element).filter((leaf) => leaf.kind === 'line').length\n }\n\n private holdsHeading(element: number): boolean {\n return this.leaves(element).some((leaf) => {\n const block = this.block(leaf)\n return block?.kind === 'heading' && block.level <= 3\n })\n }\n\n /** Containers of their own, most of them holding a heading: a page builder's sections without the tag. */\n private containersHoldSections(parts: Array<{ element: number }>): boolean {\n const containers = parts.filter((part) => !/^(?:h[1-6]|p|ul|ol|li|a|img|span|strong|em|button|blockquote|figure|picture)$/.test(this.elements[part.element]?.tag ?? ''))\n if (containers.length < parts.length * 0.8) return false\n return containers.filter((part) => this.holdsHeading(part.element)).length >= Math.max(2, Math.ceil(containers.length * 0.6))\n }\n\n /** Sections at the parts `starts` picks; loose parts between them join the next one, or the last. */\n private cutsAt(parts: Part[], starts: (part: { element: number }) => boolean, from: SiteImportLayoutSection['from']): Cut[] {\n const cuts: Cut[] = []\n let pendingFrom: number | null = null\n for (const part of parts) {\n if (isElementPart(part) && starts(part)) {\n const leaves = this.leaves(part.element)\n const lo = Math.min(pendingFrom ?? Number.POSITIVE_INFINITY, (leaves[0] as Leaf).order)\n cuts.push({ element: pendingFrom === null ? part.element : null, anchor: part.element, range: [lo, (leaves[leaves.length - 1] as Leaf).order + 0.75], from })\n pendingFrom = null\n } else {\n pendingFrom = pendingFrom ?? part.first\n }\n }\n if (pendingFrom !== null) {\n const last = cuts[cuts.length - 1]\n if (last) {\n last.range[1] = Number.POSITIVE_INFINITY\n last.element = null\n } else cuts.push({ element: null, anchor: null, range: [pendingFrom, Number.POSITIVE_INFINITY], from })\n }\n // Ranges meet, so nothing between two sections is lost.\n for (let index = 1; index < cuts.length; index += 1) (cuts[index - 1] as Cut).range[1] = (cuts[index] as Cut).range[0]\n if (cuts[0]) {\n // Loose lines before the first section open it.\n if (cuts[0].range[0] > (parts[0]?.first ?? 0)) cuts[0].element = null\n cuts[0].range[0] = -1\n }\n if (cuts.length) (cuts[cuts.length - 1] as Cut).range[1] = Number.POSITIVE_INFINITY\n return cuts\n }\n\n /** Sections at the page's `h1` and `h2`, each opened by the eyebrow just above its heading. */\n private headingCuts(leaves: Leaf[]): Cut[] {\n const starts: number[] = []\n leaves.forEach((leaf, index) => {\n const block = this.block(leaf)\n if (block?.kind !== 'heading' || block.level > 2) return\n let at = index\n const before = leaves[index - 1]\n const previous = before ? this.block(before) : undefined\n if (before && previous?.kind === 'paragraph' && this.looksLikeEyebrow(before, previous.text)) at = index - 1\n const order = (leaves[at] as Leaf).order\n if (!starts.length || order > (starts[starts.length - 1] as number)) starts.push(order)\n })\n if (!starts.length || starts[0] !== (leaves[0] as Leaf).order) starts.unshift(-1)\n return starts.map((start, index) => ({\n element: null,\n anchor: null,\n range: [index === 0 ? -1 : start, starts[index + 1] ?? Number.POSITIVE_INFINITY] as [number, number],\n from: 'heading' as const,\n }))\n }\n\n private section(cut: Cut, container: number, index: number): SiteImportLayoutSection | null {\n const { element, range, from } = cut\n const scope = element ?? container\n let nodes = scope >= 0 ? this.read(scope, range) : this.readLeaves(range)\n const name = this.nameOf(cut.anchor, this.linesOf(nodes), index)\n let band = cut.drawn ?? (cut.anchor !== null ? this.bandOf(cut.anchor, false) : this.bandOf(container, true))\n // A film playing on its own behind the words is the section's backdrop (AGL-4140), its poster the first paint.\n const behind = band.backdrop ? undefined : this.videoBehind(nodes)\n if (behind) {\n nodes = withoutVideo(nodes, behind.video)\n band = { band: 'dark', background: band.background, backdrop: { kind: 'video', video: behind.video, ...(behind.poster !== undefined ? { poster: behind.poster } : {}) } }\n }\n // Its fill in the page's dark scheme, read as its fill is, where that scheme changes it.\n const dark = this.darkStyles && !cut.drawn ? (cut.anchor !== null ? this.bandOf(cut.anchor, false, this.darkStyles) : this.bandOf(container, true, this.darkStyles)) : null\n const lines = behind?.poster !== undefined ? [behind.poster, ...this.linesOf(nodes)] : this.linesOf(nodes)\n if (!lines.length && !behind && !nodes.some((node) => node.kind === 'icon' || node.kind === 'form' || node.kind === 'video')) return null\n const width = this.widthOf(cut.anchor ?? container)\n const align = this.alignOf(scope, lines)\n keepOwnAlign(nodes, align)\n return {\n name,\n from,\n band: band.band,\n ...(band.absolute && band.absolute !== band.band ? { absoluteBand: band.absolute } : {}),\n background: band.background,\n ...(dark?.background && dark.background !== band.background ? { darkBackground: dark.background } : {}),\n ...(band.backdrop ? { backdrop: band.backdrop } : {}),\n align,\n ...(width !== null ? { width } : {}),\n nodes,\n lines,\n }\n }\n\n /** Lines with no container to read them through: one after another. */\n private readLeaves(range: [number, number]): SiteImportLayoutNode[] {\n const leaves = this.elements.filter((element) => element.parent < 0).flatMap((element) => this.leaves(element.id))\n // A video's poster is its own, never a picture beside it.\n return leaves.filter((leaf) => this.inRange(leaf, range) && (leaf.kind === 'video' || this.videoHolding(leaf.element) === null)).map((leaf) => this.leafNode(leaf))\n }\n\n private nameOf(element: number | null, lines: SiteImportLineRef[], index: number): string {\n const label = element !== null ? this.elements[element]?.attrs.label : undefined\n if (label) return siteImportLabel(label)\n const mainBlocks = this.mainBlocks()\n const heading =\n lines.map((ref) => mainBlocks[ref]).find((block) => block?.kind === 'heading' && block.level <= 2) ??\n lines.map((ref) => mainBlocks[ref]).find((block) => block?.kind === 'heading')\n const text = heading && heading.kind === 'heading' ? siteImportLabel(heading.text) : ''\n if (text) return text\n const first = lines.map((ref) => mainBlocks[ref]).find((block) => block && block.kind !== 'image')\n const line = first && first.kind !== 'image' && first.text.length <= 60 ? siteImportLabel(first.text) : ''\n return line || `Section ${index + 1}`\n }\n\n private mainBlocksMemo: SiteImportBlock[] | null = null\n private mainBlocks(): SiteImportBlock[] {\n this.mainBlocksMemo ??= this.blocks.filter((block) => block.region === 'main')\n return this.mainBlocksMemo\n }\n\n /*---------------- bands ----------------*/\n\n /** An element and the wrappers inside it that hold all it holds, one in another. */\n private wrappersOf(element: number): number[] {\n const chain: number[] = []\n let at = element\n for (let depth = 0; depth < 4 && at >= 0; depth += 1) {\n chain.push(at)\n const children = (this.elements[at]?.children ?? []).filter((child) => this.leaves(child).length)\n if (children.length !== 1) break\n at = children[0] as number\n }\n return chain\n }\n\n private bandOf(element: number, inherited: boolean, styles: SiteImportStyles = this.styles): ReadBand {\n // The section's own background, else the one wrapper inside it that covers it.\n const chain = inherited ? [] : this.wrappersOf(element)\n for (const at of chain) {\n const found = this.backgroundBand(at, styles)\n if (found) return found\n }\n // None of its own: the page's, under it.\n for (let at = inherited ? element : (this.elements[element]?.parent ?? -1); at >= 0; at = this.elements[at]?.parent ?? -1) {\n const found = this.backgroundBand(at, styles)\n if (found) return found\n }\n return this.backgroundBand(-2, styles) ?? { band: 'plain', background: null }\n }\n\n private backgroundBand(element: number, styles: SiteImportStyles): ReadBand | null {\n const style = styles.of(element)\n const background = siteImportBackgroundOf(style)\n const hex = background.color && background.color.a >= 0.5 ? siteImportHex(background.color) : null\n if (background.image && !/\\.svg(?:$|\\?)/i.test(background.image)) {\n return { band: 'dark', background: hex, backdrop: { kind: 'picture', url: background.image } }\n }\n if (background.gradient) {\n const stops = background.gradient.filter((stop) => stop.a > 0.1)\n const light = stops.length ? stops.reduce((sum, stop) => sum + siteImportLuminance(stop), 0) / stops.length : 1\n return { band: light < 0.55 ? 'dark' : 'soft', background: hex, backdrop: { kind: 'gradient' } }\n }\n if (background.color && background.color.a >= 0.5) return { band: siteImportBandOn(background.color, this.pageGround), absolute: siteImportBandOfColor(background.color), background: hex }\n const theme = this.elements[element]?.attrs.theme\n if (theme) {\n if (/^(?:dark|black)/.test(theme)) return { band: 'dark', background: null }\n if (/^bright/.test(theme)) return { band: 'brand', background: null }\n if (/^light/.test(theme)) return { band: 'soft', background: null }\n if (/^white/.test(theme)) return { band: 'plain', background: null }\n }\n return null\n }\n\n /*---------------- widths ----------------*/\n\n /** The cap one element sets, in px: its own rule on a wide screen, else what its framework's class says. */\n private capOf(element: number): number | null {\n this.wideStyles ??= this.wideStylesOf()\n const style = this.wideStyles.of(element)\n for (const property of ['max-width', 'width']) {\n const value = style.get(property)\n const px = value ? siteImportLengthPx(value) : null\n if (px !== null && px > 0) return px\n }\n const classes = this.elements[element]?.attrs.class ?? ''\n return WIDTH_CLASSES.find(([pattern]) => pattern.test(classes))?.[1] ?? null\n }\n\n /** The narrowest cap a section's content sits under: on it, around it, or on the wrappers inside it. */\n private widthOf(element: number): number | null {\n if (element < 0) return null\n const around: number[] = []\n for (let at = this.elements[element]?.parent ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) around.push(at)\n const caps = [...around, ...this.wrappersOf(element)].flatMap((at) => this.capOf(at) ?? [])\n return caps.length ? Math.min(...caps) : null\n }\n\n private alignOf(scope: number, lines: SiteImportLineRef[]): 'start' | 'center' {\n const mainBlocks = this.mainBlocks()\n const heading = lines.find((ref) => mainBlocks[ref]?.kind === 'heading')\n if (heading === undefined || scope < 0) return 'start'\n const leaf = this.leaves(scope).find((entry) => entry.kind === 'line' && entry.ref === heading)\n if (!leaf) return 'start'\n return this.style(leaf.element).get('text-align') === 'center' ? 'center' : 'start'\n }\n\n /*---------------- reading a container ----------------*/\n\n private read(element: number, range: readonly [number, number]): SiteImportLayoutNode[] {\n const node = this.elements[element]\n if (!node) return []\n // A video is one node, whatever its marker holds: its poster (AGL-4140).\n if (node.video !== undefined) return [this.videoNode(element, range)]\n if (node.tag === 'table') {\n const table = this.table(element, range)\n if (table) return [table]\n }\n const parts = this.parts(element, range)\n if (!parts.length) return []\n if (parts.length === 1) {\n const only = parts[0] as Part\n return isElementPart(only) ? this.read(only.element, range) : [this.leafNode(only.leaf)]\n }\n const strips = this.tabStrips().get(element)\n if (strips) return this.readTabs(element, strips, range)\n const table = this.gridTable(element, parts, range)\n if (table) return [table]\n const runs = this.groupRuns(element, parts, range)\n const elementParts = parts.filter(isElementPart)\n // Items built alike are a group, a heading over them included; only a container of unlike parts is a row of columns.\n if (!runs.length && elementParts.length >= 2 && this.isRow(element)) {\n // A child laid out of the flow takes no cell of the row (AGL-4152): a section's picture laid behind its words.\n const inFlow = parts.filter((part) => !isElementPart(part) || !this.outOfFlow(part.element))\n if (this.rowWorthy(inFlow, range)) {\n const laid = elementParts.filter((part) => this.outOfFlow(part.element)).flatMap((part) => this.read(part.element, range))\n return [...laid, this.row(element, inFlow, range)]\n }\n }\n const out: SiteImportLayoutNode[] = []\n for (let index = 0; index < parts.length; ) {\n const run = runs.find((entry) => entry.start === index)\n if (run) {\n out.push(this.group(element, parts.slice(run.start, run.end) as Array<{ element: number; first: number }>, range))\n index = run.end\n continue\n }\n const part = parts[index] as Part\n if (isElementPart(part)) out.push(...this.read(part.element, range))\n else out.push(this.leafNode(part.leaf))\n index += 1\n }\n return out\n }\n\n private leafNode(leaf: Leaf): SiteImportLayoutNode {\n if (leaf.kind === 'icon') return { kind: 'icon', icon: leaf.ref }\n if (leaf.kind === 'form') return { kind: 'form', form: leaf.ref }\n if (leaf.kind === 'video') return this.videoNode(leaf.element, [-1, Number.POSITIVE_INFINITY])\n const block = this.block(leaf)\n if (block?.kind === 'image') {\n const wrap = this.wrapperOf(leaf.element, ['a', 'button'], 4)\n const href = wrap !== null && this.elements[wrap]?.tag === 'a' ? this.anchorHref(wrap) : null\n const fit = this.pictureFit(leaf)\n return {\n kind: 'picture',\n line: leaf.ref,\n ...(href ? { href } : {}),\n ...(wrap !== null && this.elements[wrap]?.tag === 'button' ? { button: true as const } : {}),\n ...(fit ? { fit } : {}),\n }\n }\n const button = this.buttonStyle(leaf)\n const role = button ? undefined : this.roleOf(leaf)\n const line: SiteImportLayoutLine = { kind: 'line', line: leaf.ref, ...(role ? { role } : {}), ...(button ? { button } : {}) }\n if (role === 'eyebrow') {\n // An eyebrow's own pill and color (AGL-4138): the hero's chip, a section's magenta label.\n if (this.inPill(leaf)) line.chip = true\n const ink = this.inkOf(leaf.element)\n if (ink) line.color = ink\n }\n return line\n }\n\n /*---------------- pictures, inks and tiles (AGL-4138) ----------------*/\n\n /**\n * How the source frames a picture: its own shape from its `width` and\n * `height`; the box around it that sets an `aspect-ratio`, or a height it\n * fills or is held to, which crops it; its fit; its corners and shadow, on\n * it or on a box within two levels that holds no other line.\n */\n private pictureFit(leaf: Leaf): SiteImportPictureFit | undefined {\n const element = leaf.element\n const node = this.elements[element]\n if (!node) return undefined\n const own = this.style(element)\n const fit: SiteImportPictureFit = {}\n if (node.attrs.width && node.attrs.height) fit.ratio = Math.round((node.attrs.width / node.attrs.height) * 10_000) / 10_000\n const objectFit = own.get('object-fit')\n if (objectFit === 'cover' || objectFit === 'contain') fit.objectFit = objectFit\n // The picture fills its box where it is set to the box's whole height.\n const fills = /^100%$/.test(own.get('height')?.trim() ?? '')\n for (let at = element, depth = 0; at >= 0 && depth <= 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (depth > 0 && this.leaves(at).some((other) => other.kind === 'line' && other.order !== leaf.order)) break\n const style = this.style(at)\n const box = siteImportAspectRatio(style.get('aspect-ratio'))\n if (box !== null && fit.box === undefined && fit.height === undefined) fit.box = Math.round(box * 10_000) / 10_000\n const height = siteImportLengthPx(style.get('height') ?? '')\n if (height !== null && height > 0 && fit.box === undefined && fit.height === undefined && (depth === 0 || fills)) fit.height = height\n const radius = siteImportRadiusPx(style)\n if (radius !== null && radius > 0 && fit.radius === undefined) fit.radius = Math.min(radius, 999)\n if (siteImportHasShadow(style)) fit.shadow = true\n const cap = siteImportLengthPx(style.get('max-width') ?? '')\n if (cap !== null && cap > 0 && fit.measure === undefined) fit.measure = cap\n }\n return Object.keys(fit).length ? fit : undefined\n }\n\n /** An element's words' color as it shows over the ground under it, `#rrggbb`; `null` where it sets none. */\n private inkOf(element: number): string | null {\n const color = siteImportColorOf(this.style(element).get('color'))\n if (!color || color.a < 0.05) return null\n return siteImportHex(siteImportOpaque(color, siteImportColorOf(this.backgroundUnder(element) ?? undefined)))\n }\n\n /** Whether a line sits in a pill of its own: its element, or the wrapper holding only it, filled or bordered and rounded to a pill. */\n private inPill(leaf: Leaf): boolean {\n for (let at = leaf.element, depth = 0; at >= 0 && depth < 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).length !== 1) return false\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n const filled = !!fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)\n if ((filled || siteImportHasBorder(style)) && (siteImportRadiusPx(style) ?? 0) >= BADGE_MIN_RADIUS) return true\n }\n return false\n }\n\n /**\n * The filled square an icon sits in: the nearest element above it, within\n * two levels and inside its item, holding nothing but the icon, no wider\n * than a tile, whose fill is not the ground under it.\n */\n private tileOf(icon: Leaf, item: number): SiteImportIconTile | undefined {\n for (let at = this.elements[icon.element]?.parent ?? -1, depth = 0; at >= 0 && depth < 2 && at !== item; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).some((leaf) => leaf.kind === 'line')) return undefined\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n if (!fill || fill.a < 0.5 || siteImportHex(fill) === this.backgroundUnder(at)) continue\n const width = siteImportLengthPx(style.get('width') ?? '')\n if (width === null || width > TILE_MAX_PX) continue\n const radius = siteImportRadiusPx(style)\n return { fill: siteImportHex(fill), radius: radius === null ? 0 : Math.min(radius, 999), color: this.inkOf(icon.element) }\n }\n return undefined\n }\n\n /** The nearest element of these tags at or above `element`, within `depth` levels. */\n private wrapperOf(element: number, tags: readonly string[], depth: number): number | null {\n let at = element\n for (let level = 0; level <= depth && at >= 0; level += 1) {\n const node = this.elements[at]\n if (!node) return null\n if (tags.includes(node.tag)) return at\n at = node.parent\n }\n return null\n }\n\n private anchorHref(element: number): string | null {\n const anchor = this.structure.anchors.find((entry) => entry.element === element)\n return anchor?.href ?? null\n }\n\n /*---------------- videos (AGL-4140) ----------------*/\n\n /** A video where it sits: its poster, the picture inside its marker, and whether the box it plays in casts a shadow. */\n private videoNode(element: number, range: readonly [number, number]): SiteImportLayoutVideo {\n const node = this.elements[element] as SiteImportElement\n const poster = this.leaves(element).find((leaf) => leaf.kind === 'line' && this.inRange(leaf, range) && this.block(leaf)?.kind === 'image')\n let shadow = false\n // The box around it, as far up as a wrapper holds nothing else.\n for (let at = element, depth = 0; at >= 0 && depth < 3 && !shadow; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).some((leaf) => leaf.kind === 'line' && leaf.element !== poster?.element)) break\n shadow = siteImportHasShadow(this.style(at))\n }\n const fit = poster ? this.pictureFit(poster) : undefined\n return { kind: 'video', video: node.video as number, ...(poster ? { poster: poster.ref } : {}), ...(fit ? { fit } : {}), ...(shadow ? { shadow: true as const } : {}) }\n }\n\n /** The video marker an element sits in, or is, within a few levels; `null` for none. */\n private videoHolding(element: number): number | null {\n for (let at = element, depth = 0; at >= 0 && depth < 4; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.elements[at]?.video !== undefined) return at\n }\n return null\n }\n\n /**\n * The film a section plays on its own behind its words (AGL-4140): one that\n * starts by itself, its place laid over the section (absolute or fixed, at\n * most three levels up), as a picture behind the words is.\n */\n private videoBehind(nodes: readonly SiteImportLayoutNode[]): SiteImportLayoutVideo | null {\n for (const node of siteImportVideoNodes(nodes)) {\n if (!this.videos[node.video]?.autoplay) continue\n const element = this.elements.find((entry) => entry.video === node.video)\n for (let at = element?.id ?? -1, depth = 0; at >= 0 && depth < 4; at = this.elements[at]?.parent ?? -1, depth += 1) {\n const position = this.style(at).get('position')\n if (position === 'absolute' || position === 'fixed') return node\n }\n }\n return null\n }\n\n /** How the source draws a line as a button, when it does. */\n private buttonStyle(leaf: Leaf): SiteImportButtonStyle | undefined {\n const block = this.block(leaf)\n if (!block || (block.kind !== 'link' && block.kind !== 'paragraph')) return undefined\n const host = this.wrapperOf(leaf.element, block.kind === 'link' ? ['a'] : ['button'], 3)\n if (host === null) return undefined\n const node = this.elements[host] as SiteImportElement\n if (node.attrs.role === 'tab') return undefined\n return siteImportButtonStyleOf(node, this.style(host), this.backgroundUnder(host)) ?? undefined\n }\n\n /** The background an element is drawn on: its nearest ancestor's. */\n private backgroundUnder(element: number): string | null {\n for (let at = this.elements[element]?.parent ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) {\n const color = siteImportBackgroundOf(this.style(at)).color\n if (color && color.a >= 0.5) return siteImportHex(color)\n }\n const page = siteImportBackgroundOf(this.style(-2)).color\n return page ? siteImportHex(page) : '#ffffff'\n }\n\n /** An eyebrow, a lede, a statement or a note, where the source's styling says so. */\n private roleOf(leaf: Leaf): SiteImportLayoutLine['role'] {\n const block = this.block(leaf)\n if (block?.kind !== 'paragraph') return undefined\n const style = this.style(leaf.element)\n if (this.looksLikeEyebrow(leaf, block.text)) return 'eyebrow'\n const size = siteImportFontSizePx(style)\n // A paragraph set as large as a heading, and bold, is a statement (AGL-4138): \"Most website builders hand you a blank page…\".\n if (size !== null && (size >= this.bodySize * STATEMENT_SCALE || size >= STATEMENT_MIN_PX) && siteImportFontWeight(style) >= STATEMENT_MIN_WEIGHT && block.text.length > 40) return 'statement'\n if (size !== null && size >= this.bodySize * 1.12 && block.text.length > 40) return 'lede'\n if (size !== null && size <= this.bodySize * 0.875 && block.text.length <= 160) return 'note'\n return undefined\n }\n\n private looksLikeEyebrow(leaf: Leaf, text: string): boolean {\n return siteImportIsEyebrowText(text, this.style(leaf.element))\n }\n\n /*---------------- rows ----------------*/\n\n private isRow(element: number): boolean {\n const node = this.elements[element]\n if (!node) return false\n const placed = this.placed.get(element)\n if (placed) return placed === 'row'\n if (node.tag === 'tr') return true\n const classes = node.attrs.class ?? ''\n if (/\\bMuiGrid-container\\b|(?:^|\\s)row(?:\\s|$)|\\bcolumns\\b|wp-block-columns|elementor-row|e-con-inner|sqs-row/.test(classes)) return true\n const style = this.style(element)\n const display = style.get('display') ?? ''\n if (/\\bgrid\\b/.test(display)) {\n const columns = siteImportGridColumns(style.get('grid-template-columns'))\n return !!columns && columns.length >= 2\n }\n if (/\\bflex\\b/.test(display)) return !/column/.test(style.get('flex-direction') ?? 'row')\n return false\n }\n\n private outOfFlow(element: number): boolean {\n return /^(?:absolute|fixed)$/.test(this.style(element).get('position') ?? '')\n }\n\n /** A row is columns of content, not a line of buttons or links. */\n private rowWorthy(parts: Part[], range: readonly [number, number]): boolean {\n const substantial = parts.filter((part) => {\n if (!isElementPart(part)) return false\n return this.leaves(part.element).some((leaf) => {\n if (!this.inRange(leaf, range)) return false\n if (leaf.kind === 'video') return true\n if (leaf.kind !== 'line') return false\n const block = this.block(leaf)\n return block?.kind === 'image' || block?.kind === 'heading' || ((block?.kind === 'paragraph' || block?.kind === 'list-item' || block?.kind === 'quote') && !this.buttonStyle(leaf))\n })\n })\n return substantial.length >= 2\n }\n\n private row(element: number, parts: Part[], range: readonly [number, number]): SiteImportLayoutNode {\n const cells: SiteImportLayoutNode[][] = parts.map((part) => (isElementPart(part) ? this.read(part.element, range) : [this.leafNode(part.leaf)]))\n const weights = this.weightsOf(element, parts)\n // Cells that are each one group of one kind are one group in columns.\n const groups = cells.map((cell) => (cell.length === 1 && cell[0]?.kind === 'group' ? (cell[0] as SiteImportLayoutGroup) : null))\n if (cells.length >= 2 && groups.every((group) => group && !group.inline && group.group === groups[0]?.group && group.columns === 1)) {\n const first = groups[0] as SiteImportLayoutGroup\n const boxed = groups.every((group) => group?.boxed)\n // Framed in every cell but not boxed in all of them: the rule they draw (AGL-4138).\n const rule = !boxed && groups.every((group) => group?.boxed || group?.rule) ? groups.find((group) => group?.rule)?.rule : undefined\n return { kind: 'group', group: first.group, columns: cells.length, boxed, ...(rule ? { rule } : {}), items: groups.flatMap((group) => group?.items ?? []) }\n }\n return { kind: 'row', cols: siteImportTwelfths(weights), cells: cells.map((nodes) => ({ nodes })) }\n }\n\n /** The columns' relative widths: the grid template, the cells' own sizes, else equal shares. */\n private weightsOf(element: number, parts: Part[]): number[] {\n const count = parts.length\n const template = siteImportGridColumns(this.style(element).get('grid-template-columns'))\n if (template && template.length >= count) return template.slice(0, count)\n const sized = parts.map((part) => (isElementPart(part) ? this.cellSize(part.element) : null))\n if (sized.every((size) => size !== null)) return sized as number[]\n return parts.map(() => 1)\n }\n\n /** A cell's size: a framework's column class, its width share or its flex grow. */\n private cellSize(element: number): number | null {\n const placed = this.placedWidth.get(element)\n if (placed !== undefined) return placed\n const classes = this.elements[element]?.attrs.class ?? ''\n let best: { rank: number; size: number } | null = null\n for (const match of classes.matchAll(MUI_GRID_SIZE)) {\n const rank = BREAKPOINT_RANK[match[1] as string] ?? 0\n if (rank <= 3 && (!best || rank >= best.rank)) best = { rank, size: Number(match[2]) }\n }\n for (const match of classes.matchAll(BOOTSTRAP_COL)) {\n const rank = match[1] ? (BREAKPOINT_RANK[match[1]] ?? 0) : 0\n if (rank <= 3 && (!best || rank >= best.rank)) best = { rank, size: Number(match[2]) }\n }\n if (best) return best.size\n const style = this.style(element)\n for (const property of ['flex-basis', 'width', 'max-width']) {\n const percent = /^(-?[\\d.]+)%$/.exec(style.get(property)?.trim() ?? '')\n if (percent) return Number(percent[1])\n }\n const grow = /^(\\d+(?:\\.\\d+)?)(?:\\s|$)/.exec(style.get('flex')?.trim() ?? style.get('flex-grow')?.trim() ?? '')\n if (grow && Number(grow[1]) > 0) return Number(grow[1])\n return null\n }\n\n /*---------------- groups ----------------*/\n\n private signature(element: number, range: readonly [number, number]): string {\n const at = this.unwrap(element, range)\n return this.parts(at, range)\n .map((part) => (isElementPart(part) ? (this.elements[part.element]?.tag ?? '') : part.leaf.kind !== 'line' ? part.leaf.kind : (this.block(part.leaf)?.kind ?? '')))\n .join(',')\n }\n\n /** The kinds of an item's leaves in order, repeats folded: a looser likeness. */\n private kinds(element: number, range: readonly [number, number]): string {\n const out: string[] = []\n for (const leaf of this.leaves(element)) {\n if (!this.inRange(leaf, range)) continue\n const kind = leaf.kind !== 'line' ? leaf.kind : (this.block(leaf)?.kind ?? '')\n if (out[out.length - 1] !== kind) out.push(kind)\n }\n return out.join(',')\n }\n\n /** Runs of three or more siblings built alike (two, when a row draws them as boxes). */\n private groupRuns(element: number, parts: Part[], range: readonly [number, number]): GroupRun[] {\n // A strip of short words side by side (a row of site kinds, a post's tags) is one group.\n if (parts.length >= 4 && this.isRow(element) && parts.every((part) => isElementPart(part) && this.isChip(part.element, range))) return [{ start: 0, end: parts.length }]\n const keys = parts.map((part) => (isElementPart(part) && this.couldBeItem(part.element, range) ? `${this.elements[part.element]?.tag}|${this.signature(part.element, range)}` : null))\n const loose = parts.map((part) => (isElementPart(part) ? this.kinds(part.element, range) : null))\n const runs: GroupRun[] = []\n const row = this.isRow(element)\n for (let index = 0; index < parts.length; ) {\n const key = keys[index]\n const kind = loose[index]\n if (key === null || key === undefined) {\n index += 1\n continue\n }\n let end = index + 1\n while (end < parts.length && keys[end] !== null && (keys[end] === key || (loose[end] === kind && !!kind && kind.includes(',')))) end += 1\n const count = end - index\n const boxed = count === 2 && row && parts.slice(index, end).every((part) => isElementPart(part) && this.framed(part.element))\n // One element alone (a single list item) is not a group; a heading leaf is never an item.\n const items = parts.slice(index, end) as Array<{ element: number }>\n const headings = items.every((part) => /^h[1-6]$/.test(this.elements[part.element]?.tag ?? ''))\n if ((count >= 3 || boxed) && !headings) {\n runs.push({ start: index, end })\n index = end\n } else index += 1\n }\n return runs\n }\n\n /**\n * Whether an element can be one item of a group: a list item, a disclosure,\n * a figure, a picture, or a container of more than one thing. A run of\n * plain paragraphs is prose, never a group.\n */\n private couldBeItem(element: number, range: readonly [number, number]): boolean {\n const node = this.elements[element]\n if (!node) return false\n // A row of a placed grid holds items; it is never one.\n if (this.placed.get(element) === 'row') return false\n if (/^(?:li|dt|dd|details|figure|article)$/.test(node.tag)) return true\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n if (leaves.length && leaves.every((leaf) => leaf.kind === 'line' && this.block(leaf)?.kind === 'image')) return true\n return this.parts(this.unwrap(element, range), range).length >= 2\n }\n\n /** One short line and nothing else: a chip, a tag, a strip's entry. */\n private isChip(element: number, range: readonly [number, number]): boolean {\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n const lines = leaves.filter((leaf) => leaf.kind === 'line')\n if (lines.length !== 1) return false\n // A short line with a mark of its own and no pill around it is a checklist's line, not a tag (AGL-4138).\n if (leaves.some((leaf) => leaf.kind === 'icon') && !this.framed(element)) return false\n const block = this.block(lines[0] as Leaf)\n return !!block && block.kind !== 'image' && block.kind !== 'heading' && block.text.length <= 40\n }\n\n /**\n * How an item is drawn apart from the page (AGL-4138), it and the wrappers\n * inside it that hold all it holds: a BOX is a shadow, a fill of its own or\n * a border on two sides or more; a RULE a border on one side only, a step's\n * line over its number. Either one makes it framed.\n */\n private frameOf(element: number): { box: boolean; rule: SiteImportRule | null } {\n let rule: SiteImportRule | null = null\n let at = element\n for (let depth = 0; depth < 3 && at >= 0; depth += 1) {\n const style = this.style(at)\n if (siteImportHasShadow(style)) return { box: true, rule: null }\n const fill = siteImportBackgroundOf(style).color\n if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)) return { box: true, rule: null }\n const sides = siteImportBorderSides(style)\n const drawn = (Object.keys(sides) as Array<keyof typeof sides>).filter((side) => sides[side])\n if (drawn.length >= 2) return { box: true, rule: null }\n const side = drawn[0]\n if (side && !rule) {\n const border = sides[side] as { width: number; color: SiteImportRgba | null }\n const under = siteImportColorOf(this.backgroundUnder(at) ?? undefined)\n rule = { side, width: Math.max(1, Math.round(border.width)), color: border.color && border.color.a >= 0.05 ? siteImportHex(siteImportOpaque(border.color, under)) : null }\n }\n const children = (this.elements[at]?.children ?? []).filter((child) => this.leaves(child).length)\n if (children.length !== 1) break\n at = children[0] as number\n }\n return { box: false, rule }\n }\n\n /** Whether an item is drawn apart from the page at all: a box or a rule (a border on any side, a shadow, a fill of its own). */\n private framed(element: number): boolean {\n const frame = this.frameOf(element)\n return frame.box || !!frame.rule\n }\n\n private group(container: number, parts: Array<{ element: number; first: number }>, range: readonly [number, number]): SiteImportLayoutGroup {\n const items = parts.map((part) => this.item(part.element, range))\n const chips = parts.length >= 4 && this.isRow(container) && parts.every((part) => this.isChip(part.element, range))\n const kind = chips ? 'logos' : this.groupKind(parts.map((part) => part.element), items, range)\n const gallery = !chips && kind === 'logos' && this.isGallery(items)\n const columns = gallery ? this.galleryColumns(container, parts, items) : this.columnsOf(container, parts)\n const frames = parts.map((part) => this.frameOf(part.element))\n const half = Math.ceil(parts.length / 2)\n const boxed = parts.length > 0 && frames.filter((frame) => frame.box).length >= half\n // Framed, most of them, but not boxed: the rule the first of them draws (AGL-4138).\n const ruled = !boxed && frames.filter((frame) => frame.box || frame.rule).length >= half ? (frames.find((frame) => frame.rule)?.rule ?? null) : null\n // A step's number and a stat's figure lead their item.\n if (kind === 'steps' || kind === 'stats') {\n for (const item of items) {\n const lead = item.title ?? item.text?.[0]\n const text = lead !== undefined ? this.lineText(lead) : ''\n if (lead !== undefined && (kind === 'steps' ? STEP_NUMBER.test(text.trim()) : FIGURE.test(text.trim()) || text.length <= 14)) {\n item.figure = lead\n if (item.title === lead) {\n delete item.title\n const next = item.text?.find((ref) => this.lineText(ref).length <= 80)\n if (next !== undefined && (item.text?.length ?? 0) > 1) {\n item.title = next\n dropLine(item, 'text', next)\n }\n } else dropLine(item, 'text', lead)\n if (item.text && !item.text.length) delete item.text\n }\n }\n // A step's number the source sets in its muted words' grey, not its brand (AGL-4138).\n items.forEach((item, at) => {\n const leaf = item.figure === undefined ? undefined : this.leaves(parts[at]?.element ?? -1).find((entry) => entry.kind === 'line' && entry.ref === item.figure)\n const ink = leaf ? this.inkOf(leaf.element) : null\n if (ink && siteImportIsMutedInk(ink)) item.figureMuted = true\n })\n }\n if (kind === 'faq') {\n for (const item of items) {\n const question = item.lines[0]\n if (question === undefined || item.title === question) continue\n // The question names it; whatever named it before is its words.\n if (item.title !== undefined) item.text = [item.title, ...(item.text ?? [])].sort((a, b) => item.lines.indexOf(a) - item.lines.indexOf(b))\n item.title = question\n dropLine(item, 'text', question)\n dropLine(item, 'link', question)\n if (item.text && !item.text.length) delete item.text\n if (item.link && !item.link.length) delete item.link\n }\n }\n if (kind === 'pricing') {\n for (const item of items) {\n const price = item.lines.find((ref) => PRICE.test(this.lineText(ref)) && this.lineText(ref).length <= 24)\n if (price === undefined || item.title === price) continue\n item.figure = price\n dropLine(item, 'text', price)\n dropLine(item, 'list', price)\n if (item.text && !item.text.length) delete item.text\n if (item.list && !item.list.length) delete item.list\n }\n items.forEach((item, at) => this.takePeriod(item, parts[at]?.element as number, range))\n }\n if (kind === 'cards' || kind === 'pricing') items.forEach((item, at) => this.takeBadge(item, parts[at]?.element as number, range))\n const inline = columns === 1 && (kind === 'cards' || kind === 'pricing') && parts.every((part) => this.isWordRow(part.element, range))\n const columnsSm = this.columnsSmOf(container, parts, columns)\n const align = this.itemsAlignOf(parts[0]?.element ?? -1, items[0], range)\n return {\n kind: 'group',\n group: kind,\n columns,\n ...(columnsSm !== null ? { columnsSm } : {}),\n boxed,\n ...(gallery ? { gallery: true as const } : {}),\n ...(ruled ? { rule: ruled } : {}),\n ...(align ? { align } : {}),\n ...(inline ? { inline: true as const } : {}),\n items,\n }\n }\n\n /**\n * How an item's words are set (AGL-4138): centered where its name's\n * element centers its text or its own column centers what it holds, else\n * at the start. `keepOwnAlign` drops it where the section reads the same.\n */\n private itemsAlignOf(element: number, item: SiteImportLayoutItem | undefined, range: readonly [number, number]): 'start' | 'center' | null {\n const ref = item?.title ?? item?.text?.[0]\n if (element < 0 || ref === undefined) return null\n const leaf = this.leaves(element).find((entry) => entry.kind === 'line' && entry.ref === ref)\n if (!leaf) return null\n if (this.style(leaf.element).get('text-align') === 'center') return 'center'\n const column = this.style(this.unwrap(element, range))\n if (/\\bflex\\b/.test(column.get('display') ?? '') && /column/.test(column.get('flex-direction') ?? '') && column.get('align-items') === 'center') return 'center'\n return 'start'\n }\n\n /**\n * The columns a group's items sit in on a tablet (AGL-4138), where it is\n * fewer than on a wide screen and more than one: a framework's `sm` size on\n * its cells, else the grid the container lays out at a tablet's width.\n */\n private columnsSmOf(container: number, parts: Array<{ element: number }>, columns: number): number | null {\n if (columns <= 2) return null\n const classes = this.elements[parts[0]?.element ?? -1]?.attrs.class ?? ''\n const sized = /\\bMuiGrid-grid-sm-(\\d+)\\b/.exec(classes) ?? /\\bcol-sm-(\\d{1,2})\\b/.exec(classes)\n let count: number | null = null\n if (sized) count = Math.round(12 / Math.max(1, Number(sized[1])))\n else {\n this.tabletStyles ??= this.tabletStylesOf()\n const style = this.tabletStyles.of(container)\n const template = /\\bgrid\\b/.test(style.get('display') ?? '') ? siteImportGridColumns(style.get('grid-template-columns')) : null\n if (template) count = template.length\n }\n return count !== null && count >= 2 && count < columns ? count : null\n }\n\n /** The line of an item that says what its price is for, beside the price: taken out of its words. */\n private takePeriod(item: SiteImportLayoutItem, element: number, range: readonly [number, number]): void {\n if (item.figure === undefined) return\n const leaves = this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range))\n const price = leaves.find((leaf) => leaf.ref === item.figure)\n const next = item.lines[item.lines.indexOf(item.figure) + 1]\n const period = (item.text ?? []).find((ref) => {\n const text = this.lineText(ref).trim()\n if (text.length > PERIOD_MAX_CHARS || !PERIOD.test(text)) return false\n const leaf = leaves.find((entry) => entry.ref === ref)\n return ref === next || (!!leaf && !!price && this.elements[leaf.element]?.parent === this.elements[price.element]?.parent)\n })\n if (period === undefined) return\n item.period = period\n dropLine(item, 'text', period)\n }\n\n /** The line of an item drawn as a tag on it, a short line in a filled pill: taken out of its words. */\n private takeBadge(item: SiteImportLayoutItem, element: number, range: readonly [number, number]): void {\n const leaves = this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range))\n const badge = (item.text ?? []).find((ref) => {\n const leaf = leaves.find((entry) => entry.ref === ref)\n return !!leaf && this.isBadge(leaf)\n })\n if (badge === undefined) return\n item.badge = badge\n dropLine(item, 'text', badge)\n }\n\n /** Whether a line is a tag: a word or two on a fill of its own, its corners rounded to a pill. */\n private isBadge(leaf: Leaf): boolean {\n const block = this.block(leaf)\n if (block?.kind !== 'paragraph') return false\n const words = block.text.trim().split(/\\s+/)\n if (block.text.trim().length > BADGE_MAX_CHARS || words.length > BADGE_MAX_WORDS) return false\n // The pill may be the line's own element, or the wrapper that holds only it.\n for (let at = leaf.element, depth = 0; at >= 0 && depth < 2; at = this.elements[at]?.parent ?? -1, depth += 1) {\n if (this.leaves(at).length !== 1) return false\n const style = this.style(at)\n const fill = siteImportBackgroundOf(style).color\n if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at) && (siteImportRadiusPx(style) ?? 0) >= BADGE_MIN_RADIUS) return true\n }\n return false\n }\n\n /** Whether an item is a row of its own, its parts side by side and two of them words: a plan's row, a label and its value. */\n private isWordRow(element: number, range: readonly [number, number]): boolean {\n const row = this.unwrap(element, range)\n if (!this.isRow(row)) return false\n const cells = this.parts(row, range).filter((part) => {\n if (!isElementPart(part)) return part.leaf.kind === 'line' && this.block(part.leaf)?.kind !== 'image'\n return this.leaves(part.element).some((leaf) => leaf.kind === 'line' && this.inRange(leaf, range) && this.block(leaf)?.kind !== 'image')\n })\n return cells.length >= 2\n }\n\n private lineText(ref: SiteImportLineRef): string {\n const block = this.mainBlocks()[ref]\n if (!block) return ''\n return block.kind === 'image' ? block.alt : block.text\n }\n\n /** One item's lines, each in exactly one of its parts. */\n private item(element: number, range: readonly [number, number]): SiteImportLayoutItem {\n const leaves = this.leaves(element).filter((leaf) => this.inRange(leaf, range))\n const item: SiteImportLayoutItem = { lines: [] }\n const lines = leaves.filter((leaf) => leaf.kind === 'line')\n item.lines = lines.map((leaf) => leaf.ref)\n const firstLine = lines[0]\n const leadIcon = leaves.find((leaf) => leaf.kind === 'icon' && (!firstLine || leaf.order < firstLine.order + 1))\n if (leadIcon) item.icon = leadIcon.ref\n // Bullet points: list items, and lines that sit in a repeated run inside the item (a plan's features).\n const listed = new Set<number>()\n const own = this.elements[element]?.tag === 'li'\n if (!own) for (const leaf of lines) if (this.block(leaf)?.kind === 'list-item') listed.add(leaf.ref)\n const inner = this.unwrap(element, range)\n for (const members of this.listRuns(inner, range, 4)) {\n for (const member of members) for (const leaf of this.leaves(member)) if (leaf.kind === 'line' && this.inRange(leaf, range)) listed.add(leaf.ref)\n const marks = members.map((member) => this.leaves(member).find((leaf) => leaf.kind === 'icon')?.ref)\n if (marks.length && marks.every((mark) => mark !== undefined && mark === marks[0])) item.listIcon = marks[0] as number\n }\n if (item.icon !== undefined && item.icon === item.listIcon && !lines.length) delete item.icon\n const rest = lines.filter((leaf) => !listed.has(leaf.ref))\n // A film the item holds (AGL-4140): its poster is the item's picture.\n const film = leaves.find((leaf) => leaf.kind === 'video')\n if (film) item.video = film.ref\n const image = (film ? rest.find((leaf) => this.block(leaf)?.kind === 'image' && this.videoHolding(leaf.element) === film.element) : undefined) ?? rest.find((leaf) => this.block(leaf)?.kind === 'image')\n if (image) {\n item.image = image.ref\n const fit = this.pictureFit(image)\n if (fit) item.imageFit = fit\n }\n const words = rest.filter((leaf) => leaf !== image)\n // Its own calls to action: every link it draws as a button, wherever it\n // sits (a plan's button sits above its features), and the links and\n // buttons that close it.\n let drawn = words.filter((leaf) => this.block(leaf)?.kind === 'link' && !!this.buttonStyle(leaf))\n const loose = words.filter((leaf) => !drawn.includes(leaf))\n const trailing: Leaf[] = []\n for (let index = loose.length - 1; index >= 0; index -= 1) {\n const leaf = loose[index] as Leaf\n const block = this.block(leaf)\n if (block?.kind === 'link' || this.buttonStyle(leaf)) trailing.unshift(leaf)\n else break\n }\n const body = loose.slice(0, loose.length - trailing.length)\n let title: Leaf | undefined = body.find((leaf) => this.block(leaf)?.kind === 'heading')\n if (!title) {\n const first = body[0]\n const block = first ? this.block(first) : undefined\n if (first && block?.kind === 'link' && body.length >= 2) title = first\n else if (first && block && block.kind !== 'image' && block.text.length <= 80 && block.text.split(/\\s+/).length <= 12 && body.length >= 2) title = first\n }\n let closing = [...drawn, ...trailing].sort((a, b) => a.order - b.order)\n if (!title && closing.length === words.length && closing.length >= 1 && words.length >= 2) {\n // Only links: the first names the item.\n title = closing[0]\n closing = closing.slice(1)\n drawn = drawn.filter((leaf) => leaf !== title)\n }\n if (title) item.title = title.ref\n const text = body.filter((leaf) => leaf !== title).map((leaf) => leaf.ref)\n if (text.length) item.text = text\n if (listed.size) item.list = lines.filter((leaf) => listed.has(leaf.ref)).map((leaf) => leaf.ref)\n if (closing.length) item.link = closing.map((leaf) => leaf.ref)\n if (drawn.length) item.ctas = drawn.map((leaf) => ({ line: leaf.ref, style: this.buttonStyle(leaf) as SiteImportButtonStyle }))\n const titleBlock = title ? this.block(title) : undefined\n if (titleBlock?.kind === 'link') item.to = titleBlock.href\n else if (closing.length === 1) {\n const only = this.block(closing[0] as Leaf)\n if (only?.kind === 'link') item.to = only.href\n } else {\n const wrap = this.wrapperOf(element, ['a'], 0)\n const href = wrap !== null ? this.anchorHref(wrap) : null\n if (href) item.to = href\n }\n // The square its lead icon sits in, and the arrow at the end of its first row (AGL-4138).\n if (leadIcon) {\n const tile = this.tileOf(leadIcon, element)\n if (tile) item.tile = tile\n }\n const mark = this.markOf(leaves, leadIcon, listed, element, item.to)\n if (mark !== undefined) item.mark = mark\n return item\n }\n\n /**\n * A second icon of an item that says where it goes (AGL-4138): an icon\n * alone in a link to the item's own address (a card's \"↗\"), or one in the\n * row its lead icon sits in. Never a bullet's mark.\n */\n private markOf(leaves: readonly Leaf[], lead: Leaf | undefined, listed: ReadonlySet<number>, item: number, to: string | undefined): number | undefined {\n const bullets = new Set<number>()\n for (const leaf of leaves) if (leaf.kind === 'line' && listed.has(leaf.ref)) bullets.add(this.elements[leaf.element]?.parent ?? -1)\n const same = (a: string | null | undefined, b: string | null | undefined) => !!a && !!b && a.replace(/\\/+$/, '') === b.replace(/\\/+$/, '')\n for (const leaf of leaves) {\n if (leaf.kind !== 'icon' || leaf === lead) continue\n const parent = this.elements[leaf.element]?.parent ?? -1\n if (bullets.has(parent) || bullets.has(this.elements[parent]?.parent ?? -1)) continue\n const link = this.wrapperOf(leaf.element, ['a'], 3)\n if (link !== null && link !== item && this.refsIn(link, [-1, Number.POSITIVE_INFINITY]).length === 0 && same(this.anchorHref(link), to)) return leaf.ref\n const row = lead ? this.commonAncestor([lead.element, leaf.element]) : null\n if (row !== null && row !== item && this.contains(item, row) && this.isRow(row) && !this.leaves(row).some((entry) => entry.kind === 'line')) return leaf.ref\n }\n return undefined\n }\n\n /**\n * Runs of three or more one-line entries built alike anywhere inside an\n * item (a plan's features, each a check mark and a line), each run its\n * entries' elements. The item itself is never one of them.\n */\n private listRuns(element: number, range: readonly [number, number], depth: number, root = true): number[][] {\n const out: number[][] = []\n const parts = this.parts(element, range)\n const taken = new Set<number>()\n for (const run of this.groupRuns(element, parts, range)) {\n const members = (parts.slice(run.start, run.end) as Array<{ element: number }>).map((part) => part.element)\n const oneLine = members.every((member) => this.leaves(member).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range)).length === 1)\n if (!oneLine || (root && members.length === parts.length)) continue\n out.push(members)\n members.forEach((member) => taken.add(member))\n }\n if (depth <= 0) return out\n for (const part of parts) if (isElementPart(part) && !taken.has(part.element)) out.push(...this.listRuns(part.element, range, depth - 1, false))\n return out\n }\n\n private groupKind(elements: number[], items: SiteImportLayoutItem[], range: readonly [number, number]): SiteImportGroupKind {\n const count = items.length\n const share = (test: (item: SiteImportLayoutItem, index: number) => boolean) => items.filter(test).length / Math.max(1, count)\n const first = (item: SiteImportLayoutItem) => this.lineText(item.lines[0] ?? -1).trim()\n const blockKinds = (item: SiteImportLayoutItem) => item.lines.map((ref) => this.mainBlocks()[ref]?.kind)\n if (elements.some((element) => this.elements[element]?.tag === 'details')) return 'faq'\n // Pictures alone, two or more, are marks or a gallery (AGL-4152): `group` says which.\n if (share((item) => item.lines.length === 0 || blockKinds(item).every((kind) => kind === 'image')) === 1 && items.some((item) => item.lines.length) && count >= 2) return 'logos'\n if (share((item) => blockKinds(item).includes('quote') || /^[“\"«]/.test(first(item))) >= 0.6) return 'quotes'\n if (share((item) => item.lines.some((ref) => PRICE.test(this.lineText(ref)) && this.lineText(ref).length <= 24) && (item.lines.some((ref) => PERIOD.test(this.lineText(ref))) || !!item.link)) >= 0.6 && count >= 2) {\n return 'pricing'\n }\n if (share((item) => /\\?\\s*$/.test(first(item)) && item.lines.length >= 2) >= 0.6) return 'faq'\n if (share((item) => STEP_NUMBER.test(first(item)) && item.lines.length >= 2) >= 0.6) return 'steps'\n if (share((item) => item.lines.length >= 2 && item.lines.length <= 3 && first(item).length <= 14 && FIGURE.test(first(item))) >= 0.6) return 'stats'\n const visual = share((item) => item.icon !== undefined || item.image !== undefined)\n const titled = share((item) => item.title !== undefined && (item.text?.length ?? 0) > 0)\n const boxed = elements.filter((element) => this.framed(element)).length >= Math.ceil(elements.length / 2)\n if ((visual >= 0.6 && titled >= 0.6) || (boxed && share((item) => item.lines.length >= 2) >= 0.6)) return 'cards'\n if (share((item) => item.lines.length === 1) >= 0.8) return 'list'\n if (titled >= 0.6) return 'cards'\n void range\n return 'text'\n }\n\n /**\n * Whether a group of pictures alone is photos (AGL-4152), not marks: each\n * picture drawn at a good share of the screen by its `sizes`, or its own size\n * a photo's (400 px wide or more, no banner's shape) and no sheet holding it\n * to a mark's height.\n */\n private isGallery(items: readonly SiteImportLayoutItem[]): boolean {\n return items.every((item) => {\n const pictures = this.pictureElements(item)\n return pictures.length > 0 && pictures.every((node) => {\n if ((node.attrs.share ?? 0) >= GALLERY_MIN_SHARE) return true\n const { width, height } = node.attrs\n if (!width || !height || width < GALLERY_MIN_PX || width / height > GALLERY_MAX_RATIO || height / width > GALLERY_MAX_RATIO) return false\n const held = siteImportLengthPx(this.style(node.id).get('height') ?? '')\n return held === null || held > MARK_MAX_PX\n })\n })\n }\n\n private pictureElements(item: SiteImportLayoutItem): SiteImportElement[] {\n const mainBlocks = this.mainBlocks()\n return item.lines.filter((ref) => mainBlocks[ref]?.kind === 'image').flatMap((ref) => {\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === ref))\n return element ? [element] : []\n })\n }\n\n /** A gallery's columns: its container's, else as many as its pictures' share of the screen fits, else three at most. */\n private galleryColumns(container: number, parts: Array<{ element: number }>, items: readonly SiteImportLayoutItem[]): number {\n const read = this.columnsOf(container, parts)\n if (read > 1) return read\n const share = this.pictureElements(items[0] as SiteImportLayoutItem)[0]?.attrs.share\n const fits = share ? Math.floor(100 / share) : GALLERY_COLUMNS\n return Math.max(1, Math.min(parts.length, GALLERY_COLUMNS_MAX, fits))\n }\n\n /** How many columns a group's items sit in on a wide screen. */\n private columnsOf(container: number, parts: Array<{ element: number }>): number {\n const count = parts.length\n const placed = this.placed.get(container)\n if (placed) return placed === 'row' ? count : 1\n const style = this.style(container)\n const display = style.get('display') ?? ''\n if (/\\bgrid\\b/.test(display)) {\n const template = siteImportGridColumns(style.get('grid-template-columns'))\n if (template) return Math.max(1, Math.min(count, template.length))\n return 1\n }\n const sizes = parts.map((part) => this.cellSize(part.element))\n const classes = this.elements[container]?.attrs.class ?? ''\n if (/\\bMuiGrid-container\\b|(?:^|\\s)row(?:\\s|$)/.test(classes) && sizes[0]) {\n return Math.max(1, Math.min(count, Math.round(12 / (sizes[0] as number))))\n }\n if (/\\bflex\\b/.test(display) && !/column/.test(style.get('flex-direction') ?? 'row')) {\n const width = sizes[0]\n if (width && width <= 100 && /^(-?[\\d.]+)%$/.test(this.style(parts[0]?.element ?? -1).get('width') ?? '')) return Math.max(1, Math.round(100 / width))\n return Math.min(count, 4)\n }\n return 1\n }\n\n /*---------------- tables and tabs ----------------*/\n\n private table(element: number, range: readonly [number, number]): SiteImportLayoutTable | null {\n const rows: number[] = []\n const visit = (at: number) => {\n for (const child of this.elements[at]?.children ?? []) {\n const tag = this.elements[child]?.tag\n if (tag === 'tr') rows.push(child)\n else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') visit(child)\n }\n }\n visit(element)\n if (!rows.length) return null\n const out: SiteImportLineRef[][][] = rows.map((row) =>\n (this.elements[row]?.children ?? [])\n .filter((cell) => /^t[dh]$/.test(this.elements[cell]?.tag ?? ''))\n .map((cell) => this.refsIn(cell, range)),\n )\n const header =\n (this.elements[rows[0] as number]?.parent !== undefined && this.elements[this.elements[rows[0] as number]?.parent as number]?.tag === 'thead') ||\n (this.elements[rows[0] as number]?.children ?? []).every((cell) => this.elements[cell]?.tag === 'th')\n // A caption, or lines outside the rows, are not lost.\n return { kind: 'table', header, rows: tableRows(out.filter((row) => row.some((cell) => cell.length))) }\n }\n\n private refsIn(element: number, range: readonly [number, number]): SiteImportLineRef[] {\n return this.leaves(element).filter((leaf) => leaf.kind === 'line' && this.inRange(leaf, range)).map((leaf) => leaf.ref)\n }\n\n /** Rows of short cells built alike, laid out as rows: a table drawn with a grid. */\n private gridTable(element: number, parts: Part[], range: readonly [number, number]): SiteImportLayoutTable | null {\n const rows = parts.filter(isElementPart).map((part) => part.element)\n if (rows.length < 3 || rows.length !== parts.length) return null\n const widths = rows.map((row) => (this.elements[row]?.children ?? []).length)\n const common = mode(widths)\n if (common < 2 || widths.filter((width) => width === common).length < rows.length * 0.8) return null\n if (common === 2 && rows.length < 4) return null\n if (!rows.every((row) => this.isRow(row))) return null\n const cells = rows.map((row) => (this.elements[row]?.children ?? []).map((cell) => this.refsIn(cell, range)))\n // Cells are short and flat: a value, not a card. Two-cell rows are a label and its value.\n const longest = common === 2 ? 60 : 120\n const flat = cells.every((row) => row.every((cell) => cell.length <= 2 && cell.every((ref) => this.lineText(ref).length <= longest && this.mainBlocks()[ref]?.kind !== 'image')))\n if (!flat) return null\n // A label and its value: both cells hold words (an icon beside a line is a list, not a table).\n if (common === 2 && cells.filter((row) => row.length === 2 && row.every((cell) => cell.length > 0)).length < rows.length * 0.8) return null\n // A comparison's first row names the columns over an empty corner.\n const first = cells[0] ?? []\n const header = common >= 3 && !(first[0]?.length) && first.slice(1).every((cell) => cell.length > 0)\n return { kind: 'table', header, rows: tableRows(cells) }\n }\n\n /** Tab strips, each read at the lowest element holding it and its panels. */\n private tabStrips(): Map<number, TabStrip[]> {\n if (this.tabsMemo) return this.tabsMemo\n const at = new Map<number, TabStrip[]>()\n const panels = this.elements.filter((node) => node.attrs.role === 'tabpanel' && node.region === 'main').map((node) => node.id)\n const taken = new Set<number>()\n for (const strip of this.elements) {\n if (strip.attrs.role !== 'tablist' || strip.region !== 'main') continue\n const tabs = this.findAll(strip.id, (node) => node.attrs.role === 'tab')\n if (tabs.length < 2) continue\n const found = tabs.map((tab) => {\n const attrs = this.elements[tab]?.attrs ?? {}\n const own = (id: string | undefined) => (id ? id.replace(/^tab-?/, '') : '')\n const panel = panels.find((candidate) => {\n if (taken.has(candidate)) return false\n const panelAttrs = this.elements[candidate]?.attrs ?? {}\n return (\n (!!attrs.controls && panelAttrs.id === attrs.controls) ||\n (!!attrs.id && panelAttrs.labelledby === attrs.id) ||\n (!!attrs.id && !!panelAttrs.id && own(attrs.id) === panelAttrs.id.replace(/^tabpanel-?/, ''))\n )\n })\n if (panel !== undefined) taken.add(panel)\n return panel ?? null\n })\n // Panels the tabs do not name: the ones after the strip, in order.\n const loose = panels.filter((panel) => !taken.has(panel) && panel > strip.id)\n const resolved = found.map((panel) => {\n if (panel !== null) return panel\n const next = loose.shift()\n if (next !== undefined) taken.add(next)\n return next ?? null\n })\n const members = [strip.id, ...resolved.filter((panel): panel is number => panel !== null)]\n const home = this.commonAncestor(members)\n if (home === null) continue\n const list = at.get(home) ?? []\n list.push({ strip: strip.id, tabs, panels: resolved })\n at.set(home, list)\n }\n this.tabsMemo = at\n return at\n }\n\n private tabsMemo: Map<number, TabStrip[]> | null = null\n\n private commonAncestor(elements: number[]): number | null {\n const chains = elements.map((element) => {\n const chain: number[] = []\n for (let at = element; at >= 0; at = this.elements[at]?.parent ?? -1) chain.unshift(at)\n return chain\n })\n let common: number | null = null\n for (let depth = 0; ; depth += 1) {\n const step = chains[0]?.[depth]\n if (step === undefined || !chains.every((chain) => chain[depth] === step)) break\n common = step\n }\n // A strip with no panels is read where it sits: its parent holds it.\n if (common !== null && elements.length === 1) common = this.elements[common]?.parent ?? null\n return common !== null && common >= 0 ? common : null\n }\n\n private readTabs(element: number, strips: TabStrip[], range: readonly [number, number]): SiteImportLayoutNode[] {\n const inside = new Set<number>()\n for (const strip of strips) for (const member of [strip.strip, ...strip.panels]) if (member !== null) for (const leaf of this.leaves(member)) inside.add(leaf.order)\n const outside = (nodes: SiteImportLayoutNode[]) =>\n siteImportFilterNodes(nodes, (ref) => {\n const leaf = this.leaves(element).find((entry) => entry.kind === 'line' && entry.ref === ref)\n return !leaf || !inside.has(leaf.order)\n })\n const out: SiteImportLayoutNode[] = []\n const drawn = new Set<TabStrip>()\n for (const part of this.parts(element, range)) {\n if (!isElementPart(part)) {\n if (!inside.has(part.leaf.order)) out.push(this.leafNode(part.leaf))\n continue\n }\n const strip = strips.find((entry) => this.contains(part.element, entry.strip))\n const panel = strips.some((entry) => entry.panels.some((member) => member !== null && this.contains(part.element, member)))\n if (strip || panel) {\n if (part.element !== strip?.strip && !strips.some((entry) => entry.panels.includes(part.element))) out.push(...outside(this.read(part.element, range)))\n if (strip && !drawn.has(strip)) {\n drawn.add(strip)\n out.push(this.tabsNode(strip, range))\n }\n continue\n }\n out.push(...this.read(part.element, range))\n }\n return out\n }\n\n private tabsNode(strip: TabStrip, range: readonly [number, number]): SiteImportLayoutTabs {\n return {\n kind: 'tabs',\n tabs: strip.tabs.map((tab, index) => {\n const node = this.elements[tab] as SiteImportElement\n const panel = strip.panels[index] ?? null\n const selected = /\\b(?:Mui-selected|active|is-active|selected)\\b/.test(node.attrs.class ?? '')\n return {\n label: this.refsIn(tab, range)[0] ?? null,\n ...(selected ? { selected: true as const } : {}),\n panel: panel !== null ? this.read(panel, range) : [],\n }\n }),\n }\n }\n\n private findRole(element: number, role: string, depth: number): number | null {\n const node = this.elements[element]\n if (!node) return null\n if (node.attrs.role === role) return element\n if (depth <= 0) return null\n for (const child of node.children) {\n const found = this.findRole(child, role, depth - 1)\n if (found !== null) return found\n }\n return null\n }\n\n private findAll(element: number, test: (node: SiteImportElement) => boolean): number[] {\n const out: number[] = []\n const visit = (at: number) => {\n const node = this.elements[at]\n if (!node) return\n if (test(node)) {\n out.push(at)\n return\n }\n for (const child of node.children) visit(child)\n }\n for (const child of this.elements[element]?.children ?? []) visit(child)\n return out\n }\n\n private contains(ancestor: number, element: number): boolean {\n for (let at = element; at >= 0; at = this.elements[at]?.parent ?? -1) if (at === ancestor) return true\n return false\n }\n\n /*---------------- the hero ----------------*/\n\n private markHero(sections: SiteImportLayoutSection[]): void {\n const mainBlocks = this.mainBlocks()\n const hero = sections.find((section) => section.lines.some((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1))\n if (!hero) return\n let picture: SiteImportHeroPicture | null = null\n if (hero.backdrop?.kind === 'picture' || hero.backdrop?.kind === 'video') picture = 'behind'\n else {\n const h1 = hero.lines.find((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1) as number\n const image = hero.lines.find((ref) => mainBlocks[ref]?.kind === 'image')\n if (image !== undefined) {\n const beside = (nodes: SiteImportLayoutNode[]): boolean =>\n nodes.some((node) => {\n if (node.kind !== 'row') return false\n const cellOf = (ref: number) => node.cells.findIndex((cell) => this.linesOf(cell.nodes).includes(ref))\n const a = cellOf(h1)\n const b = cellOf(image)\n if (a >= 0 && b >= 0 && a !== b) return true\n return node.cells.some((cell) => beside(cell.nodes))\n })\n if (beside(hero.nodes)) picture = 'beside'\n else if (this.pictureBehind(image)) {\n picture = 'behind'\n // A picture its grid lays behind the words is the section's ground, as a background picture is: a photo is `dark`.\n if (this.placedUnderWords(image) && hero === sections[0]) {\n hero.band = 'dark'\n delete hero.absoluteBand\n }\n }\n else picture = hero.lines.indexOf(image) > hero.lines.indexOf(h1) ? 'below' : 'above'\n }\n }\n const measure = this.measureOf(hero, hero.lines.find((ref) => mainBlocks[ref]?.kind === 'heading' && (mainBlocks[ref] as { level: number }).level === 1) as number)\n hero.hero = { picture, ...(measure !== null ? { measure } : {}) }\n }\n\n /**\n * The narrowest width the source holds its hero's heading to (AGL-4152), in\n * px: the least `max-width` on the `<h1>` or on the wrappers around it inside\n * its section, as a wide screen reads them. `null` where none is narrower\n * than the section's own cap, and the heading runs the section's width.\n */\n private measureOf(section: SiteImportLayoutSection, h1: number): number | null {\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === h1))\n if (!element) return null\n this.wideStyles ??= this.wideStylesOf()\n const inside = new Set(section.lines)\n const caps: number[] = []\n for (let at = element.id; at >= 0; at = this.elements[at]?.parent ?? -1) {\n // A wrapper that holds a line of another section is around the section, not in it.\n if (at !== element.id && this.leaves(at).some((leaf) => leaf.kind === 'line' && !inside.has(leaf.ref))) break\n const style = this.wideStyles.of(at)\n const px = siteImportMeasurePx(style.get('max-width'), siteImportFontSizePx(style) ?? this.bodySize)\n if (px !== null) caps.push(px)\n }\n const measure = caps.length ? Math.round(Math.min(...caps)) : null\n return measure !== null && (section.width === undefined || measure < section.width) ? measure : null\n }\n\n /** A picture laid over its section's whole area, behind the words. */\n private pictureBehind(ref: number): boolean {\n if (this.placedUnderWords(ref)) return true\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === ref))\n for (let at = element?.id ?? -1, depth = 0; at >= 0 && depth < 3; at = this.elements[at]?.parent ?? -1, depth += 1) {\n const position = this.style(at).get('position')\n if (position === 'absolute' || position === 'fixed') return true\n }\n return false\n }\n\n /** A picture its grid places in the same cells as words (AGL-4152). */\n private placedUnderWords(ref: number): boolean {\n const element = this.elements.find((node) => node.blocks.some((index) => this.mainIndex[index] === ref))\n for (let at = element?.id ?? -1; at >= 0; at = this.elements[at]?.parent ?? -1) if (this.placedBehind.has(at)) return true\n return false\n }\n\n linesOf(nodes: readonly SiteImportLayoutNode[]): SiteImportLineRef[] {\n return siteImportLayoutLines(nodes)\n }\n}\n\n/** A part of a page one placed grid draws (AGL-4152): what opens it, and the box painted behind it. */\ninterface DrawnPart {\n elements: number[]\n box?: number\n}\n\n/** Words at least this light are set on something dark. */\nconst LIGHT_INK = 0.6\n\n/** One child of a placed grid (AGL-4152): its box, and what it holds that says whether a row below it is more of the same card. */\ninterface PlacedItem {\n element: number\n box: SiteImportGridBox\n words: boolean\n heading: boolean\n picture: boolean\n}\n\n/** A cell a placed grid draws: the columns it covers and what sits in it, top to bottom. */\ninterface DrawnCell {\n start: number\n end: number\n items: PlacedItem[]\n}\n\n/** How much of two stretches of a grid's lines coincide. */\nconst overlapOf = (aStart: number, aEnd: number, bStart: number, bEnd: number) => Math.max(0, Math.min(aEnd, bEnd) - Math.max(aStart, bStart))\n\n/** Whether words are laid over a box: at least half their cells are its cells. */\nfunction overLaid(words: SiteImportGridBox, under: SiteImportGridBox): boolean {\n const cells = overlapOf(words.rowStart, words.rowEnd, under.rowStart, under.rowEnd) * overlapOf(words.columnStart, words.columnEnd, under.columnStart, under.columnEnd)\n return cells * 2 >= (words.rowEnd - words.rowStart) * (words.columnEnd - words.columnStart) && cells > 0\n}\n\n/**\n * A placed grid's children as a visitor reads them (AGL-4152): sorted by row\n * then column, clustered into visual rows where their rows overlap, split into\n * cells where their columns do, each cell top to bottom with what is laid\n * under words first. A row then joins the columns above it where it is built\n * to them and those columns have something it belongs to: words under a\n * heading or a picture. A row with a heading or a picture where its column\n * already holds one starts anew, so rows of whole cards stay rows, and words\n * with nothing above them to belong to stay rows too. One band is one row of\n * the page; a band of one cell is simply stacked.\n */\nfunction siteImportGridBands(items: readonly PlacedItem[], behind: (item: PlacedItem) => boolean): DrawnCell[][] {\n const sorted = [...items].sort((a, b) => a.box.rowStart - b.box.rowStart || a.box.columnStart - b.box.columnStart)\n const rows: PlacedItem[][] = []\n let rowEnd = Number.NEGATIVE_INFINITY\n for (const item of sorted) {\n const joins = item.box.rowStart < rowEnd\n if (joins) (rows[rows.length - 1] as PlacedItem[]).push(item)\n else rows.push([item])\n rowEnd = joins ? Math.max(rowEnd, item.box.rowEnd) : item.box.rowEnd\n }\n const bands: DrawnCell[][] = []\n for (const row of rows) {\n const cells: DrawnCell[] = []\n for (const item of [...row].sort((a, b) => a.box.columnStart - b.box.columnStart)) {\n const { columnStart: start, columnEnd: end } = item.box\n const last = cells[cells.length - 1]\n // The same cell where half the narrower of the two is shared; a block nudged over its neighbor's edge is still beside it.\n if (last && overlapOf(last.start, last.end, start, end) * 2 >= Math.min(last.end - last.start, end - start)) {\n last.items.push(item)\n last.end = Math.max(last.end, end)\n } else cells.push({ start, end, items: [item] })\n }\n const band = bands[bands.length - 1]\n const columns = band ? columnsFor(band, cells) : null\n if (band && columns) {\n cells.forEach((cell, at) => {\n const column = band[columns[at] as number] as DrawnCell\n column.items.push(...cell.items)\n column.start = Math.min(column.start, cell.start)\n column.end = Math.max(column.end, cell.end)\n })\n } else bands.push(cells)\n }\n for (const band of bands) {\n for (const cell of band) cell.items.sort((a, b) => Number(behind(b)) - Number(behind(a)) || a.box.rowStart - b.box.rowStart || a.box.columnStart - b.box.columnStart)\n }\n return bands\n}\n\n/** The column of a band each cell of the row under it belongs in, or `null` where that row is a row of its own. */\nfunction columnsFor(band: readonly DrawnCell[], cells: readonly DrawnCell[]): number[] | null {\n if (band.length < 2 || !band.some((column) => column.items.some((item) => item.heading || item.picture))) return null\n const taken: number[] = []\n for (const cell of cells) {\n const overlaps = band.map((column) => overlapOf(column.start, column.end, cell.start, cell.end))\n const best = overlaps.indexOf(Math.max(...overlaps))\n const column = band[best] as DrawnCell\n // Mostly under it: a block centered across two columns joins neither.\n if ((overlaps[best] as number) * 3 < (cell.end - cell.start) * 2 || taken.includes(best)) return null\n const has = (test: (item: PlacedItem) => boolean) => cell.items.some(test) && column.items.some(test)\n if (has((item) => item.heading) || has((item) => item.picture)) return null\n taken.push(best)\n }\n return taken\n}\n\n/** Drops a group's own alignment where its section reads the same (AGL-4138): only an item set apart from its section says how. */\nfunction keepOwnAlign(nodes: readonly SiteImportLayoutNode[], align: 'start' | 'center'): void {\n for (const node of nodes) {\n if (node.kind === 'group' && node.align === align) delete node.align\n else if (node.kind === 'row') for (const cell of node.cells) keepOwnAlign(cell.nodes, align)\n else if (node.kind === 'tabs') for (const tab of node.tabs) keepOwnAlign(tab.panel, align)\n }\n}\n\n/** How wide a `ch` is, in ems: the width of a zero in the faces a page is set in. */\nconst CH_EM = 0.55\n\n/**\n * A `max-width` as px (AGL-4152), at the font size of the element it is set\n * on: a length in px, rem, em or ch, or the least of those a `min()` names. A\n * share of the parent (`%`, `vw`), `none` or anything else is `null`, because\n * it holds a heading to no width of its own.\n */\nexport function siteImportMeasurePx(value: string | undefined, fontPx: number): number | null {\n const text = value?.trim().toLowerCase() ?? ''\n if (!text) return null\n const one = (term: string): number | null => {\n const match = /^(\\d*\\.?\\d+)(px|rem|em|ch)$/.exec(term.trim())\n if (!match) return null\n const amount = Number(match[1])\n const px = match[2] === 'px' ? amount : match[2] === 'rem' ? amount * 16 : match[2] === 'em' ? amount * fontPx : amount * fontPx * CH_EM\n return px > 0 ? px : null\n }\n const min = /^min\\((.+)\\)$/.exec(text)\n if (!min) return one(text)\n const terms = (min[1] as string).split(',').map(one).filter((px): px is number => px !== null)\n return terms.length ? Math.min(...terms) : null\n}\n\n/** Whether a short line reads as an eyebrow: ten words at most, in capitals or set in them. */\nexport function siteImportIsEyebrowText(text: string, style: SiteImportComputedStyle): boolean {\n const words = text.match(/[\\p{L}\\p{N}]+/gu) ?? []\n if (text.length > 60 || words.length > 10) return false\n const letters = text.replace(/[^\\p{L}]/gu, '')\n const caps = letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase()\n return caps || style.get('text-transform') === 'uppercase'\n}\n\n/** A font weight as a number: `700`, `bold` 700, `normal` 400. */\nexport function siteImportFontWeight(style: SiteImportComputedStyle): number {\n const value = style.get('font-weight')?.trim() ?? ''\n if (/^\\d{3}$/.test(value)) return Number(value)\n if (/^(?:bold|bolder)$/.test(value)) return 700\n if (value === 'lighter') return 300\n return 400\n}\n\n/** Whether a color is a muted words' grey (AGL-4138): no hue to speak of, lighter than the words' ink and darker than a rule. */\nexport function siteImportIsMutedInk(hex: string): boolean {\n const color = siteImportColorOf(hex)\n if (!color) return false\n const light = siteImportLuminance(color)\n return siteImportSaturation(color) < 0.15 && light >= 0.06 && light <= 0.6\n}\n\n/** Takes a line out of one of an item's lists; a list left empty goes, never left undefined (Firestore holds no undefined). */\nfunction dropLine(item: SiteImportLayoutItem, key: 'text' | 'list' | 'link', ref: SiteImportLineRef): void {\n const list = item[key]?.filter((entry) => entry !== ref)\n if (list?.length) item[key] = list\n else delete item[key]\n}\n\n/** Every video node of a section, rows and tab panels opened (AGL-4140). */\nfunction siteImportVideoNodes(nodes: readonly SiteImportLayoutNode[]): SiteImportLayoutVideo[] {\n return nodes.flatMap((node): SiteImportLayoutVideo[] => {\n if (node.kind === 'video') return [node]\n if (node.kind === 'row') return node.cells.flatMap((cell) => siteImportVideoNodes(cell.nodes))\n if (node.kind === 'tabs') return node.tabs.flatMap((tab) => siteImportVideoNodes(tab.panel))\n return []\n })\n}\n\n/** A section's nodes with one video taken out, as its backdrop takes it; a cell or a row left empty goes. */\nfunction withoutVideo(nodes: readonly SiteImportLayoutNode[], video: number): SiteImportLayoutNode[] {\n return nodes.flatMap((node): SiteImportLayoutNode[] => {\n if (node.kind === 'video') return node.video === video ? [] : [node]\n if (node.kind === 'row') {\n const cells = node.cells.map((cell) => ({ nodes: withoutVideo(cell.nodes, video) }))\n const kept = cells.filter((cell) => cell.nodes.length)\n if (!kept.length) return []\n return kept.length === 1 ? (kept[0] as { nodes: SiteImportLayoutNode[] }).nodes : [{ ...node, cells }]\n }\n if (node.kind === 'tabs') return [{ ...node, tabs: node.tabs.map((tab) => ({ ...tab, panel: withoutVideo(tab.panel, video) })) }]\n return [node]\n })\n}\n\n/** Rows of cells of lines, as objects: a Firestore document holds no array inside an array. */\nfunction tableRows(rows: SiteImportLineRef[][][]): SiteImportLayoutTable['rows'] {\n return rows.map((row) => ({ cells: row.map((lines) => ({ lines })) }))\n}\n\ninterface TabStrip {\n strip: number\n tabs: number[]\n /** Each tab's panel, `null` for one the source did not draw. */\n panels: Array<number | null>\n}\n\ninterface GroupRun {\n start: number\n end: number\n}\n\n/** A section's stretch of the page: the element it is (`null` when it is read through its container), the element its name and band come from, and its leaves' range. */\ninterface Cut {\n element: number | null\n anchor: number | null\n range: [number, number]\n from: SiteImportLayoutSection['from']\n /** The band a box painted behind this stretch of a grid draws (AGL-4152). */\n drawn?: ReadBand\n}\n\nfunction mode(values: readonly number[]): number {\n const counts = new Map<number, number>()\n for (const value of values) counts.set(value, (counts.get(value) ?? 0) + 1)\n return [...counts.entries()].sort((a, b) => b[1] - a[1] || b[0] - a[0])[0]?.[0] ?? 0\n}\n\n/** How far a light fill may sit from the page's ground and still be that ground (AGL-4152), in OKLab. */\nconst SAME_GROUND = 0.02\n\n/**\n * A section's fill as a band of its page (AGL-4152): a light fill is `plain`\n * on the page's own ground (white, where the page sets none) and `soft`\n * anywhere else, so a page on light grey with white bands draws those bands\n * apart from it in both color schemes. A strong color or a dark one is what it is.\n */\nexport function siteImportBandOn(color: SiteImportRgba, page: SiteImportRgba | null): SiteImportBand {\n const band = siteImportBandOfColor(color)\n if (band !== 'plain' && band !== 'soft') return band\n return siteImportColorDistance(color, page ?? { r: 255, g: 255, b: 255, a: 1 }) <= SAME_GROUND ? 'plain' : 'soft'\n}\n\n/** A solid background's band: near white is the page, light or tinted is soft, a strong color is the brand's, dark is dark. */\nexport function siteImportBandOfColor(color: { r: number; g: number; b: number; a: number }): SiteImportBand {\n const light = siteImportLuminance(color)\n const saturation = siteImportSaturation(color)\n if (saturation > 0.45 && light >= 0.06 && light < 0.75) return 'brand'\n if (light < 0.3) return 'dark'\n if (light >= 0.95) return 'plain'\n return 'soft'\n}\n\n/**\n * How the source draws an `<a>` or `<button>` as a button, or `null` when it\n * draws it as a link: a framework's button class, a role, or a fill or a\n * border with room around the words.\n */\nexport function siteImportButtonStyleOf(element: SiteImportElement, style: SiteImportComputedStyle, under: string | null): SiteImportButtonStyle | null {\n const classes = element.attrs.class ?? ''\n const fill = siteImportBackgroundOf(style)\n const filled = (!!fill.color && fill.color.a >= 0.5 && siteImportHex(fill.color) !== under) || !!fill.gradient\n const bordered = siteImportHasBorder(style)\n const padded = ['padding', 'padding-left', 'padding-top'].some((property) => {\n const value = style.get(property)\n return !!value && /[1-9]/.test(value)\n })\n const classed = BUTTON_CLASS.test(classes) || element.attrs.role === 'button'\n if (!classed && !((filled || bordered) && padded)) return null\n if (TEXT_BUTTON_CLASS.test(classes)) return 'quiet'\n if (filled || FILLED_CLASS.test(classes)) return 'primary'\n if (bordered || OUTLINED_CLASS.test(classes)) return 'secondary'\n return 'quiet'\n}\n\n/*------------------------------------------\n * The look\n *-----------------------------------------*/\n\n/** Families a Google Fonts stylesheet address loads: `family=Roboto+Flex:wght@400` is \"Roboto Flex\". */\nexport function siteImportGoogleFamilies(urls: readonly string[]): string[] {\n const families: string[] = []\n for (const raw of urls) {\n let url: URL\n try {\n url = new URL(raw)\n } catch {\n continue\n }\n if (url.hostname !== 'fonts.googleapis.com') continue\n for (const value of url.searchParams.getAll('family')) {\n for (const entry of value.split('|')) {\n const name = entry.split(':')[0]?.replace(/\\+/g, ' ').trim()\n if (name && !families.includes(name)) families.push(name)\n }\n }\n }\n return families\n}\n\n/**\n * The look facts of a page read with its structure, through its linked\n * stylesheets' text; its blocks, where given, for its eyebrows' color and its\n * sections' dark ground, read as its layout reads them.\n */\nexport function siteImportLookOf(\n page: Pick<SiteImportLayoutSource, 'structure'> & { blocks?: readonly SiteImportBlock[]; videos?: SiteImportExtract['videos'] },\n stylesheets: readonly string[] = [],\n): SiteImportLookFacts | null {\n if (!page.structure) return null\n if (page.blocks?.length) {\n const { css, styles, darkStyles, sections } = readSections({ structure: page.structure, blocks: [...page.blocks], ...(page.videos ? { videos: page.videos } : {}) }, stylesheets)\n return siteImportLookFacts(page.structure, styles, css.fontFaces, page.blocks, sections, darkStyles, css.variableUses)\n }\n const css = siteImportCssOf([...page.structure.styles, ...stylesheets])\n return siteImportLookFacts(page.structure, siteImportStylesOf(page.structure, css), css.fontFaces, [], [], null, css.variableUses)\n}\n\n/**\n * The look facts of a page's markup and the stylesheets it links (AGL-4106),\n * for the look pass, which reads the home page and its stylesheets itself.\n */\nexport function siteImportLookOfHtml(html: string, pageUrl: string, stylesheets: readonly string[] = []): SiteImportLookFacts | null {\n let origin = ''\n try {\n origin = new URL(pageUrl).origin\n } catch {\n return null\n }\n const extract = extractSiteImportPage(html, pageUrl, (url) => url.origin === origin, { structure: true, stylesheets })\n return extract.structure ? siteImportLookOf({ structure: extract.structure, blocks: extract.blocks, ...(extract.videos ? { videos: extract.videos } : {}) }, stylesheets) : null\n}\n\n/** How far two colors may sit apart and still be one (AGL-4138), in OKLab. */\nconst SAME_COLOR = 0.1\n\n/**\n * The color most of a page's eyebrows are drawn in (AGL-4138), where it is a\n * color of its own: not the words' ink, the buttons' fill, the links' color\n * or white, and no grey. `null` where its eyebrows are none, or drawn in one\n * of those.\n */\nfunction eyebrowColorOf(structure: SiteImportStructure, styles: SiteImportStyles, blocks: readonly SiteImportBlock[], not: ReadonlyArray<string | null>): string | null {\n const counts = new Map<string, number>()\n const inControl = (element: number) => {\n for (let at = element, depth = 0; at >= 0 && depth <= 3; at = structure.elements[at]?.parent ?? -1, depth += 1) {\n if (/^(?:a|button)$/.test(structure.elements[at]?.tag ?? '')) return true\n }\n return false\n }\n structure.blockElement.forEach((element, index) => {\n const block = blocks[index]\n // A button's or a link's words set in capitals are no eyebrow.\n if (block?.kind !== 'paragraph' || block.region !== 'main' || inControl(element)) return\n const style = styles.of(element)\n if (!siteImportIsEyebrowText(block.text, style)) return\n const color = siteImportColorOf(style.get('color'))\n if (!color || color.a < 0.5) return\n const hex = siteImportHex(siteImportOpaque(color))\n counts.set(hex, (counts.get(hex) ?? 0) + 1)\n })\n const top = [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0]\n const own = top ? siteImportColorOf(top) : null\n // A grey is the words' own muted color, never a color of the site's.\n if (!top || !own || siteImportSaturation(own) < 0.25) return null\n const others = [...not, '#ffffff'].flatMap((hex) => {\n const color = siteImportColorOf(hex ?? undefined)\n return color ? [siteImportOpaque(color)] : []\n })\n return others.some((other) => siteImportColorDistance(own, other) < SAME_COLOR) ? null : top\n}\n\n/** The fill most of a page's dark sections sit on (AGL-4152), the first of them on a tie; `null` where none has one. */\nfunction darkBackgroundOf(sections: readonly SiteImportLayoutSection[]): string | null {\n return mostUsedFill(sections.filter((section) => section.band === 'dark').map((section) => section.background))\n}\n\n/** The fill most of these are, the first of them on a tie; `null` where none is a solid color. */\nfunction mostUsedFill(fills: ReadonlyArray<string | null | undefined>): string | null {\n const counts = new Map<string, number>()\n for (const fill of fills) {\n if (fill && /^#[0-9a-f]{6}$/i.test(fill)) {\n const hex = fill.toLowerCase()\n counts.set(hex, (counts.get(hex) ?? 0) + 1)\n }\n }\n // A map keeps the order its keys came in, and a stable sort keeps the first of a tie first.\n return [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? null\n}\n\n/** The case most of a page's buttons of one style are set in; `null` for a page with none. */\nconst caseOf = ({ upper, lower }: { upper: number; lower: number }): 'upper' | 'none' | null => (upper + lower ? (upper > lower ? 'upper' : 'none') : null)\n\n/** Whether a button's words are written in capitals: three letters or more, none of them lower case. */\nfunction writtenInCapitals(text: string): boolean {\n const letters = text.replace(/[^\\p{L}]/gu, '')\n return letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase()\n}\n\n/**\n * What the source's look is made of (AGL-4106): its fonts, its page's\n * background and text, its filled buttons' fill, text, corners and case\n * (AGL-4152), its links' color, its header's background, its eyebrows' own\n * color (AGL-4138), and, given its sections, the fill its dark bands sit on\n * (AGL-4152).\n */\nexport function siteImportLookFacts(\n structure: SiteImportStructure,\n styles: SiteImportStyles,\n fontFaces: readonly string[] = [],\n blocks: readonly SiteImportBlock[] = [],\n sections: readonly SiteImportLayoutSection[] = [],\n darkStyles: SiteImportStyles | null = null,\n variableUses: ReadonlyMap<string, number> | null = null,\n): SiteImportLookFacts {\n const { elements } = structure\n const body = structure.body >= 0 ? structure.body : -2\n const bodyStyle = styles.of(body)\n const hexOf = (value: string | undefined) => {\n const color = siteImportColorOf(value)\n return color && color.a >= 0.5 ? siteImportHex(color) : null\n }\n const imports = structure.styles.flatMap((css) => [...css.matchAll(/@import\\s+(?:url\\()?\\s*[\"']?(https:\\/\\/fonts\\.googleapis\\.com\\/[^\"')\\s;]+)/gi)].map((match) => match[1] as string))\n const google = siteImportGoogleFamilies([...structure.stylesheets, ...imports])\n // Its body's family; where neither the body nor the root names one, the family its words are set in (AGL-4152).\n const paragraph = elements.find((element) => element.tag === 'p' && element.region === 'main') ?? elements.find((element) => element.tag === 'p')\n const bodyFamily = siteImportFontFamilies(bodyStyle.get('font-family'))[0] ?? siteImportFontFamilies(styles.of(-2).get('font-family'))[0] ?? (paragraph ? siteImportFontFamilies(styles.of(paragraph.id).get('font-family'))[0] : undefined) ?? null\n const heading = elements.find((element) => /^h[12]$/.test(element.tag) && element.region === 'main') ?? elements.find((element) => /^h[1-3]$/.test(element.tag))\n const headingFamily = heading ? (siteImportFontFamilies(styles.of(heading.id).get('font-family'))[0] ?? bodyFamily) : bodyFamily\n const known = (family: string | null) => (family && (google.includes(family) || fontFaces.includes(family) || !/^(?:arial|helvetica|helvetica neue|segoe ui|roboto fallback|times new roman|georgia|verdana)$/i.test(family)) ? family : null)\n const background = siteImportBackgroundOf(bodyStyle).color ?? siteImportBackgroundOf(styles.of(-2)).color\n // Buttons, the page's own and its header's: the most used fill.\n const fills = new Map<string, { count: number; text: string | null; radius: number[] }>()\n // Each style's case (AGL-4152): set in capitals, or written in them.\n const filledCase = { upper: 0, lower: 0 }\n const outlinedCase = { upper: 0, lower: 0 }\n const textCase = { upper: 0, lower: 0 }\n const outlines: string[] = []\n const outlinedFills: string[] = []\n const wordsOf = (element: SiteImportElement): string => {\n const own: number[] = []\n const visit = (at: number, depth: number) => {\n const node = elements[at]\n if (!node || depth > 3) return\n own.push(...node.blocks)\n for (const child of node.children) visit(child, depth + 1)\n }\n visit(element.id, 0)\n return own.map((index) => {\n const block = blocks[index]\n return block && block.kind !== 'image' ? block.text : ''\n }).join(' ')\n }\n const count = (tally: { upper: number; lower: number }, element: SiteImportElement, style: SiteImportComputedStyle) => {\n if (style.get('text-transform') === 'uppercase' || writtenInCapitals(wordsOf(element))) tally.upper += 1\n else tally.lower += 1\n }\n const linkColors = new Map<string, number>()\n for (const element of elements) {\n if (element.tag !== 'a' && element.tag !== 'button') continue\n if (element.region === 'footer') continue\n const style = styles.of(element.id)\n let under: string | null = null\n for (let at = element.parent; at >= 0; at = elements[at]?.parent ?? -1) {\n const color = siteImportBackgroundOf(styles.of(at)).color\n if (color && color.a >= 0.5) {\n under = siteImportHex(color)\n break\n }\n }\n const kind = siteImportButtonStyleOf(element, style, under ?? (background ? siteImportHex(background) : '#ffffff'))\n if (kind === 'primary') {\n const fill = siteImportBackgroundOf(style).color\n if (!fill) continue\n const hex = siteImportHex(fill)\n const entry = fills.get(hex) ?? { count: 0, text: hexOf(style.get('color')), radius: [] }\n entry.count += 1\n const radius = siteImportRadiusPx(style)\n if (radius !== null) entry.radius.push(radius)\n fills.set(hex, entry)\n count(filledCase, element, style)\n // An outlined button that fills itself is read as a filled one, and its fill said apart.\n if (OUTLINED_CLASS.test(element.attrs.class ?? '')) outlinedFills.push(hex)\n } else if (kind === 'secondary') {\n count(outlinedCase, element, style)\n const color = hexOf(style.get('color'))\n if (color) outlines.push(color)\n } else if (kind === 'quiet') {\n count(textCase, element, style)\n } else if (!kind && element.tag === 'a' && element.region === 'main') {\n // A page draws a link standing on its own as a text button (the compile's `quiet`).\n count(textCase, element, style)\n const color = hexOf(style.get('color'))\n if (color) linkColors.set(color, (linkColors.get(color) ?? 0) + 1)\n }\n }\n const topFill = [...fills.entries()].sort((a, b) => b[1].count - a[1].count)[0]\n const radii = topFill?.[1].radius ?? []\n const text = hexOf(bodyStyle.get('color'))\n // The links' color: the most used one that is not the body text's.\n const link = [...linkColors.entries()].filter(([hex]) => hex !== text).sort((a, b) => b[1] - a[1])[0]?.[0] ?? null\n const header = elements.find((element) => element.tag === 'header' && element.region === 'header') ?? elements.find((element) => element.attrs.role === 'banner')\n let headerFill: string | null = null\n for (let at = header?.id ?? -1, depth = 0; at >= 0 && depth < 3; depth += 1) {\n const color = siteImportBackgroundOf(styles.of(at)).color\n if (color && color.a >= 0.5) {\n headerFill = siteImportHex(color)\n break\n }\n const children: number[] = elements[at]?.children ?? []\n at = children.length === 1 ? (children[0] as number) : -1\n }\n // The page's own fill in its dark scheme, where its stylesheets change it.\n const darkFill = darkStyles ? (siteImportBackgroundOf(darkStyles.of(body)).color ?? siteImportBackgroundOf(darkStyles.of(-2)).color) : null\n const darkGround = darkFill && darkFill.a >= 0.5 && (!background || siteImportHex(darkFill) !== siteImportHex(background)) ? siteImportHex(darkFill) : null\n const palette = variableUses ? siteImportPaletteOf(styles, variableUses) : []\n return {\n fonts: { body: known(bodyFamily), headings: known(headingFamily), google },\n background: background ? siteImportHex(background) : null,\n text,\n buttonFill: topFill?.[0] ?? null,\n buttonText: topFill?.[1].text ?? null,\n buttonRadius: radii.length ? (radii.sort((a, b) => a - b)[Math.floor(radii.length / 2)] as number) : null,\n link,\n header: headerFill,\n darkBackground: darkGround ?? darkBackgroundOf(sections),\n paperBackground: mostUsedFill(sections.filter((section) => section.band === 'soft').map((section) => section.background)),\n darkPaper: mostUsedFill(sections.filter((section) => section.band === 'soft').map((section) => section.darkBackground)),\n // Most of each style's buttons decide; none, and its case is no fact of the source's.\n buttonCase: caseOf(filledCase),\n outlinedCase: caseOf(outlinedCase),\n textCase: caseOf(textCase),\n buttonOutline: mostUsedFill(outlines),\n outlinedFill: mostUsedFill(outlinedFills),\n // Its eyebrows' own color: none of its words', its buttons' or its links', which the theme draws already.\n eyebrow: blocks.length ? eyebrowColorOf(structure, styles, blocks, [text, topFill?.[0] ?? null, link]) : null,\n ...(palette.length ? { palette } : {}),\n }\n}\n\n/** What a layout holds, counted (AGL-4106): the reader's side of a fidelity score. */\nexport interface SiteImportLayoutCounts {\n sections: number\n bands: SiteImportBand[]\n /** Rows of two or more columns. */\n rows: number\n /** Groups by kind, and the items in them. */\n groups: Partial<Record<SiteImportGroupKind, number>>\n items: Partial<Record<SiteImportGroupKind, number>>\n tables: number\n tabs: number\n pictures: number\n /** Icons drawn: a group item's lead icon, each bullet's mark, and icons standing alone. */\n icons: number\n /** Lines the source draws as buttons. */\n buttons: number\n forms: number\n /** Videos placed (AGL-4140): where they sit, in an item, or behind a section. */\n videos: number\n /** Lines placed, each once. */\n lines: number\n}\n\n/** Counts a layout's sections, bands, rows, groups, pictures, icons and buttons. */\nexport function siteImportLayoutCounts(layout: SiteImportLayout, blocks: readonly SiteImportBlock[] = []): SiteImportLayoutCounts {\n const counts: SiteImportLayoutCounts = {\n sections: layout.sections.length,\n bands: layout.sections.map((section) => section.band),\n rows: 0,\n groups: {},\n items: {},\n tables: 0,\n tabs: 0,\n pictures: 0,\n icons: 0,\n buttons: 0,\n forms: 0,\n videos: 0,\n lines: 0,\n }\n const main = blocks.filter((block) => block.region === 'main')\n const isPicture = (ref: number) => main[ref]?.kind === 'image'\n const visit = (nodes: readonly SiteImportLayoutNode[]) => {\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n if (node.button) counts.buttons += 1\n break\n case 'picture':\n counts.pictures += 1\n break\n case 'icon':\n counts.icons += 1\n break\n case 'form':\n counts.forms += 1\n break\n case 'video':\n // Its poster is a picture of the page, as it was before the film was read.\n counts.videos += 1\n if (node.poster !== undefined) counts.pictures += 1\n break\n case 'row':\n if (node.cells.length >= 2) counts.rows += 1\n for (const cell of node.cells) visit(cell.nodes)\n break\n case 'group':\n counts.groups[node.group] = (counts.groups[node.group] ?? 0) + 1\n counts.items[node.group] = (counts.items[node.group] ?? 0) + node.items.length\n for (const item of node.items) {\n if (item.icon !== undefined) counts.icons += 1\n if (item.mark !== undefined) counts.icons += 1\n if (item.listIcon !== undefined) counts.icons += item.list?.length ?? 0\n if (item.image !== undefined || (main.length && item.lines.some(isPicture))) counts.pictures += 1\n if (item.video !== undefined) counts.videos += 1\n }\n break\n case 'table':\n counts.tables += 1\n break\n case 'tabs':\n counts.tabs += 1\n for (const tab of node.tabs) visit(tab.panel)\n break\n default:\n break\n }\n }\n }\n for (const section of layout.sections) {\n visit(section.nodes)\n if (section.backdrop?.kind === 'video') {\n counts.videos += 1\n if (section.backdrop.poster !== undefined) counts.pictures += 1\n }\n counts.lines += section.lines.length\n }\n return counts\n}\n"],"names":["AI_SITE_IMPORT_MAX_SECTIONS","siteImportFilterNodes","siteImportLayoutLines","SITE_IMPORT_CSS_WIDE_WIDTH","siteImportAspectRatio","siteImportBackgroundOf","siteImportBorderSides","siteImportColorDistance","siteImportColorOf","siteImportCssOf","siteImportPaletteOf","siteImportFontFamilies","siteImportFontSizePx","siteImportGridBoxes","siteImportGridColumns","siteImportGridTrackCount","siteImportHasBorder","siteImportHasShadow","siteImportHex","siteImportLengthPx","siteImportLuminance","siteImportOpaque","siteImportOrderOf","siteImportRadiusPx","siteImportSaturation","siteImportStylesOf","siteImportTwelfths","extractSiteImportPage","siteImportLabel","isElementPart","part","isLine","block","kind","url","inline","text","trim","BUTTON_CLASS","TEXT_BUTTON_CLASS","OUTLINED_CLASS","FILLED_CLASS","LANDMARK_TAGS","Set","SECTION_CLASS","MUI_GRID_SIZE","BOOTSTRAP_COL","BREAKPOINT_RANK","xs","sm","md","lg","xl","PRICE","PERIOD","BADGE_MAX_CHARS","BADGE_MAX_WORDS","BADGE_MIN_RADIUS","PERIOD_MAX_CHARS","WIDTH_CLASSES","STEP_NUMBER","FIGURE","GALLERY_MIN_SHARE","GALLERY_MIN_PX","GALLERY_MAX_RATIO","MARK_MAX_PX","GALLERY_COLUMNS","GALLERY_COLUMNS_MAX","TABLET_WIDTH","STATEMENT_SCALE","STATEMENT_MIN_PX","STATEMENT_MIN_WEIGHT","TILE_MAX_PX","siteImportLayout","page","stylesheets","structure","blocks","css","styles","darkStyles","sections","readSections","length","v","icons","map","icon","look","siteImportLookFacts","fontFaces","variableUses","sheets","siteImportDarkStylesOf","reader","LayoutReader","videos","some","sheet","test","undefined","scheme","darkRules","readPlacement","id","elements","style","node","region","nav","children","display","get","readGrid","readOrder","element","orderOf","child","content","filter","leaves","sorted","at","sort","a","b","entry","setChildren","includes","moveLeaves","grid","painted","paints","boxes","items","lines","leaf","box","words","heading","picture","item","other","overLaid","placedBehind","add","bands","siteImportGridBands","has","flatMap","band","drawnRow","rest","placed","set","flat","cell","readDrawnParts","paintedFill","holdsPlainBox","tag","attrs","type","depth","fill","color","tracks","allColumns","Math","max","end","columnEnd","wide","columnStart","itemsOf","boxOf","from","min","rowStart","to","rowEnd","find","overlapOf","opensPart","level","onlyLinks","every","starts","held","forEach","push","start","slice","before","drawnParts","partsOf","cut","anchor","parts","unwrap","range","order","drawn","partBand","Number","POSITIVE_INFINITY","within","siteImportBandOn","pageGround","absolute","siteImportBandOfColor","background","light","ink","wordsInk","LIGHT_INK","cells","row","drawnElement","only","placedWidth","parent","own","leafMemo","clear","moved","places","list","inRange","first","guard","of","written","root","main","body","all","rootLeaves","container","elementParts","landmarks","isLandmark","cuts","ceil","cutsAt","holdsHeading","lineCount","containersHoldSections","headingCuts","section","markHero","capSections","kept","last","extra","nodes","role","label","class","containers","pendingFrom","lo","index","previous","looksLikeEyebrow","unshift","scope","read","readLeaves","name","nameOf","linesOf","bandOf","behind","backdrop","videoBehind","withoutVideo","video","poster","dark","width","widthOf","align","alignOf","keepOwnAlign","absoluteBand","darkBackground","videoHolding","leafNode","mainBlocks","ref","line","mainBlocksMemo","wrappersOf","chain","inherited","found","backgroundBand","hex","image","gradient","stops","stop","reduce","sum","theme","capOf","wideStyles","wideStylesOf","property","value","px","classes","pattern","around","caps","videoNode","table","strips","tabStrips","readTabs","gridTable","runs","groupRuns","isRow","inFlow","outOfFlow","rowWorthy","laid","out","run","group","form","wrap","wrapperOf","href","anchorHref","fit","pictureFit","button","buttonStyle","roleOf","inPill","chip","inkOf","height","ratio","round","objectFit","fills","radius","shadow","cap","measure","Object","keys","backgroundUnder","filled","tileOf","tags","anchors","siteImportVideoNodes","autoplay","position","siteImportButtonStyleOf","host","size","bodySize","siteImportFontWeight","siteImportIsEyebrowText","columns","substantial","weights","weightsOf","groups","boxed","rule","cols","count","template","sized","cellSize","best","match","matchAll","rank","percent","exec","grow","signature","join","kinds","isChip","couldBeItem","loose","key","framed","headings","frameOf","sides","side","border","under","frame","frames","chips","groupKind","gallery","isGallery","galleryColumns","columnsOf","half","ruled","lead","title","lineText","figure","next","dropLine","siteImportIsMutedInk","figureMuted","question","indexOf","link","price","takePeriod","takeBadge","isWordRow","columnsSm","columnsSmOf","itemsAlignOf","column","tabletStyles","tabletStylesOf","period","badge","isBadge","split","alt","film","firstLine","leadIcon","listed","inner","members","listRuns","member","marks","mark","listIcon","imageFit","trailing","closing","ctas","titleBlock","tile","markOf","bullets","same","replace","refsIn","commonAncestor","contains","taken","oneLine","share","blockKinds","visual","titled","pictures","pictureElements","mainIndex","fits","floor","sizes","rows","visit","header","tableRows","widths","common","mode","longest","tabsMemo","Map","panels","strip","tabs","findAll","tab","panel","candidate","panelAttrs","controls","labelledby","resolved","shift","home","chains","step","inside","outside","tabsNode","selected","findRole","ancestor","hero","h1","beside","cellOf","findIndex","pictureBehind","placedUnderWords","measureOf","siteImportMeasurePx","usedPanels","blockElement","ground","aStart","aEnd","bStart","bEnd","NEGATIVE_INFINITY","joins","columnsFor","overlaps","CH_EM","fontPx","toLowerCase","one","term","amount","terms","letters","toUpperCase","values","counts","entries","SAME_GROUND","r","g","saturation","bordered","padded","classed","siteImportGoogleFamilies","urls","families","raw","URL","hostname","searchParams","getAll","siteImportLookOf","siteImportLookOfHtml","html","pageUrl","origin","extract","SAME_COLOR","eyebrowColorOf","not","inControl","top","others","darkBackgroundOf","mostUsedFill","caseOf","upper","lower","writtenInCapitals","bodyStyle","hexOf","imports","google","paragraph","bodyFamily","headingFamily","known","family","filledCase","outlinedCase","textCase","outlines","outlinedFills","wordsOf","tally","linkColors","topFill","radii","headerFill","darkFill","darkGround","palette","fonts","buttonFill","buttonText","buttonRadius","paperBackground","darkPaper","buttonCase","buttonOutline","outlinedFill","eyebrow","siteImportLayoutCounts","layout","tables","buttons","forms","isPicture"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAmD2C,GAE3C,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAmBhB,6BAAyB;AAChC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,qBAAqB,EACrBC,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,oBAAoB,EACpBC,mBAAmB,EACnB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