@aglyn/plugins-ai 1.0.0 → 1.2.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.
- package/package.json +17 -17
- package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
- package/src/lib/components/ai-site-start-card.component.js +40 -13
- package/src/lib/components/ai-site-start-card.component.js.map +1 -1
- package/src/lib/components/ai-site-start-steps.component.d.ts +17 -1
- package/src/lib/components/ai-site-start-steps.component.js +30 -7
- package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
- package/src/lib/components/assist-panel.component.js +8 -12
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/jobs/ai-job-drafts.d.ts +3 -0
- package/src/lib/jobs/ai-job-drafts.js +5 -0
- package/src/lib/jobs/ai-job-drafts.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.d.ts +10 -0
- package/src/lib/jobs/ai-job-layout-language.js +38 -2
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-step.js +3 -3
- package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +15 -7
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.js +39 -1
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.d.ts +6 -0
- package/src/lib/layout-language/ai-layout-frame.js +85 -30
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +175 -0
- package/src/lib/model/ai-site-import-fidelity.js +941 -0
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -0
- package/src/lib/model/ai-site-start.d.ts +27 -0
- package/src/lib/model/ai-site-start.js +41 -0
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/assist-page-change.d.ts +26 -6
- package/src/lib/model/assist-page-change.js +32 -10
- package/src/lib/model/assist-page-change.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +18 -2
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/server/assist-chat.d.ts +5 -0
- package/src/lib/server/assist-chat.js +11 -2
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-page-change.d.ts +12 -0
- package/src/lib/server/assist-page-change.js +23 -1
- package/src/lib/server/assist-page-change.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +62 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +374 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-site-import-compile.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 * A PAGE BROUGHT IN, BUILT BY THE SITE COMPILER (AGL-4107).\n *\n * On 10/29 an import of aglyn.com came out one column of plain lines: the\n * import drew its own stacked text instead of the site's cards, columns,\n * pictures, icons and bands. This module is the page's build now:\n *\n * 1. The source's LAYOUT, as the reader read it (`AiSiteImportPageRead.\n * layout`, AGL-4106) — its sections and bands, rows of columns, groups of\n * cards, steps, figures, questions, quotes, logos and plans, its tables,\n * tabs, pictures and icons — becomes the layout language the guided\n * start's compiler takes (`aiSiteImportDesignedSections`): a group is a\n * `cards` block whose items carry every part (icon, picture, figure,\n * paragraphs, bullet points, links), a table a `table` block, tabs a\n * `tabs` block. Every line is placed exactly once, in its own section; a\n * line the layout placed nowhere is added at its section's end.\n * 2. The site compiler draws it (`aiCompileLayoutPage`, `verbatim`), with\n * the palette's own elements and the theme's tokens: the Card, the\n * Accordion, the Table, the Tabs, the hero around the source's picture.\n * Every word is the source's, as written.\n * 3. A main page's DESIGN is the one question a model answers\n * (`submit_design`, `aiSiteImportDesignText`): which hero the opening\n * becomes, how each group is drawn, a band where the source gave none,\n * the kind of a group the reader could not tell, an alignment. A page of\n * a collection, and any page whose answer is missing, is drawn from the\n * layout with no model.\n *\n * A read made before the reader kept no layout: its page is read into one\n * here, from its lines, one section at each second-level heading.\n *=========================================*/\n\nimport {\n aiCompileLayoutPage,\n type AiLayoutCompiledPage,\n type AiLayoutPagePlan,\n} from '../layout-language/ai-layout-compiler'\nimport type { AiLayoutDesign } from '../layout-language/ai-layout-design'\nimport {\n AI_LAYOUT_GROUP_STYLES,\n AI_LAYOUT_IMPORT_HEROES,\n AI_LAYOUT_MAX_COLS,\n type AiLayoutBlock,\n type AiLayoutDesignAnswer,\n type AiLayoutDesignSection,\n type AiLayoutGroupStyle,\n type AiLayoutImportHero,\n type AiLayoutItem,\n type AiLayoutLink,\n type AiLayoutPicture,\n type AiLayoutSection,\n type AiLayoutSettlement,\n type AiLayoutStyle,\n} from '../layout-language/ai-layout-language'\nimport type { AiLayoutTargets } from '../layout-language/ai-layout-links'\nimport {\n AI_SITE_IMPORT_LABEL_MAX_CHARS,\n type AiSiteImportPhoto,\n type SiteImportGroupKind,\n type SiteImportHeroPicture,\n type SiteImportIconShape,\n type SiteImportLayout,\n type SiteImportLayoutGroup,\n type SiteImportLayoutItem,\n type SiteImportLayoutLine,\n type SiteImportLayoutNode,\n type SiteImportLayoutSection,\n type SiteImportLineRef,\n} from '../model/ai-site-import'\nimport { aiModelAtLeastStepTier } from '../providers/routing'\nimport type { SiteImportBlock } from '../site-import/site-import-html'\nimport {\n AI_SITE_IMPORT_DOC_MAX_NODES,\n AI_SITE_IMPORT_LABEL_CHARS,\n aiSiteImportDocLines,\n aiSiteImportTextParts,\n aiSiteImportWordsIn,\n type AiSiteImportDocument,\n} from './ai-site-import-document'\n\nconst clean = (text: unknown): string => (typeof text === 'string' ? text.replace(/\\s+/g, ' ').trim() : '')\n\n/** Whether a block is a line of the page: a link inside a sentence is in its sentence. */\nfunction isLine(block: SiteImportBlock | undefined): boolean {\n if (!block) return false\n if (block.kind === 'image') return !!block.url\n if (block.kind === 'link') return !block.inline && !!clean(block.text)\n return !!clean(block.text)\n}\n\n/*------------------------------------------\n * The page's job: its model and its links\n *-----------------------------------------*/\n\n/**\n * The model a page brought in asks its design answer on (AGL-4107): the page\n * step's own tier, balanced, whatever the deployment's default model is — the\n * job's own pick where it is that tier or above.\n */\nexport function aiImportPageModel(modelFor?: (kind: 'job.page') => string | undefined): string {\n return aiModelAtLeastStepTier('job.page', modelFor?.('job.page'))\n}\n\n/**\n * Every page the import plans that a page brought in may link (AGL-4107), by\n * the id its draft is written under: a link to one in a wave still to come\n * shows its words until that page is live, then goes there.\n */\nexport function aiSiteImportLinkablePages(doc: Pick<AiSiteImportDocument, 'links'> | null): Array<{ id: string; label: string; slug: string }> {\n if (!doc) return []\n const seen = new Set<string>()\n return doc.links.flatMap((link) => {\n if (seen.has(link.id)) return []\n seen.add(link.id)\n const path = link.path.replace(/\\/+$/, '') || '/'\n return [{ id: link.id, label: path, slug: path }]\n })\n}\n\n/**\n * The listing a page brought in keeps (AGL-4107): its source's own title and\n * description, word for word, never clipped and never rewritten — the 10/29\n * import's Home was retitled \"Aglyn: Build a Website with AI, Free to Start\".\n * Only a part the source left empty takes what was `written` for it.\n */\nexport function aiImportedPageListing(\n screen: { seoTitle: string; seoDescription: string },\n written: { title?: string; description?: string } = {},\n): { title: string; description: string } {\n return {\n title: screen.seoTitle.trim() || (written.title ?? '').trim(),\n description: screen.seoDescription.trim() || (written.description ?? '').trim(),\n }\n}\n\n/** Whether a page brought in still owes a part of its listing: one its source left empty. */\nexport function aiImportedPageListingOwed(listing: { title: string; description: string }): boolean {\n return !listing.title || !listing.description\n}\n\n/*------------------------------------------\n * The layout a page is built from\n *-----------------------------------------*/\n\n/**\n * The layout of a page whose read kept none (AGL-4107): its lines in their\n * sections — the opening, then one at each second-level heading — each line\n * where the source put it, in order.\n */\nexport function aiSiteImportLayoutOfLines(doc: Pick<AiSiteImportDocument, 'blocks' | 'title'>): SiteImportLayout {\n const { lines, sections } = aiSiteImportDocLines(doc.blocks, doc.title)\n // The document's lines are numbered over the page's lines; the layout's are indexes of its blocks.\n const refOf: number[] = []\n doc.blocks.forEach((block, index) => {\n if (isLine(block)) refOf.push(index)\n })\n return {\n v: 1,\n sections: sections.map((section, index) => {\n const refs = section.lines.map((n) => refOf[n - 1]).filter((ref): ref is number => ref !== undefined)\n return {\n name: section.name,\n from: 'heading' as const,\n band: index % 2 === 1 ? ('soft' as const) : ('plain' as const),\n background: null,\n align: 'start' as const,\n nodes: refs.map((ref): SiteImportLayoutNode => (doc.blocks[ref]?.kind === 'image' ? { kind: 'picture', line: ref } : { kind: 'line', line: ref })),\n lines: refs,\n }\n }),\n icons: [],\n look: { fonts: { body: null, headings: null, google: [] }, background: null, text: null, buttonFill: null, buttonText: null, buttonRadius: null, link: null, header: null },\n }\n}\n\n/** The layout a page is built from: the reader's, else one read from its lines. */\nexport function aiSiteImportLayoutOf(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): SiteImportLayout {\n return doc.layout && doc.layout.sections.length ? doc.layout : aiSiteImportLayoutOfLines(doc)\n}\n\n/**\n * The page's sections by name, in order (AGL-4107): the source's own, as its\n * layout names them — its `aria-label`s, its headings — two of one name told\n * apart, so a link to either finds it. The page's plan has exactly these.\n */\nexport function aiSiteImportSectionNames(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): string[] {\n const named = new Set<string>()\n const names = aiSiteImportLayoutOf(doc).sections.map((section, index) => {\n const name = clean(section.name).slice(0, AI_SITE_IMPORT_LABEL_MAX_CHARS) || `Section ${index + 1}`\n let unique = name\n for (let attempt = 2; named.has(unique.toLowerCase()); attempt += 1) {\n unique = `${name.slice(0, AI_SITE_IMPORT_LABEL_MAX_CHARS - 5)} (${attempt})`\n }\n named.add(unique.toLowerCase())\n return unique\n })\n return names.length ? names : ['Introduction']\n}\n\n/*------------------------------------------\n * The source's icons, on the icon element's square\n *-----------------------------------------*/\n\n/** How many numbers each path command takes, by its lower-case letter. */\nconst PATH_PARAMS: Readonly<Record<string, number>> = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7, z: 0 }\n\nconst NUMBER = /[\\s,]*([-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?)/y\nconst FLAG = /[\\s,]*([01])/y\n\n/** A number of a path, at most three decimals, as short as it reads. */\nconst round = (value: number): string => {\n const fixed = Math.round(value * 1000) / 1000\n return Object.is(fixed, -0) ? '0' : String(fixed)\n}\n\n/**\n * A path's drawing moved onto the icon element's 24-unit square (AGL-4107):\n * every coordinate scaled from its viewBox and centered, every relative move\n * scaled alone, an arc's radii scaled and its flags and rotation kept.\n * `null` for anything that is not path data.\n */\nexport function aiSiteImportPathOn24(d: string, viewBox: string): string | null {\n const box = viewBox.trim().split(/[\\s,]+/).map(Number)\n if (box.length !== 4 || box.some((value) => !Number.isFinite(value)) || box[2] <= 0 || box[3] <= 0) return null\n const [minX, minY, width, height] = box\n const scale = 24 / Math.max(width, height)\n const dx = (24 - width * scale) / 2 - minX * scale\n const dy = (24 - height * scale) / 2 - minY * scale\n const identity = Math.abs(scale - 1) < 1e-9 && Math.abs(dx) < 1e-9 && Math.abs(dy) < 1e-9\n const out: string[] = []\n let at = 0\n let first = true\n const source = d.trim()\n while (at < source.length) {\n while (at < source.length && /[\\s,]/.test(source[at])) at += 1\n if (at >= source.length) break\n const command = source[at]\n const lower = command.toLowerCase()\n if (!(lower in PATH_PARAMS)) return null\n at += 1\n const count = PATH_PARAMS[lower]\n const relative = command === lower\n const groups: number[][] = []\n if (count === 0) {\n out.push(command)\n first = false\n continue\n }\n for (;;) {\n const group: number[] = []\n for (let index = 0; index < count; index += 1) {\n const pattern = lower === 'a' && (index === 3 || index === 4) ? FLAG : NUMBER\n pattern.lastIndex = at\n const match = pattern.exec(source)\n if (!match) break\n group.push(Number(match[1]))\n at = pattern.lastIndex\n }\n if (group.length === 0) break\n if (group.length !== count) return null\n groups.push(group)\n }\n if (!groups.length) return null\n const parts = groups.map((group, index) => {\n // A path that opens on a relative move opens at that point, as an absolute one would.\n const absolute = !relative || (first && lower === 'm' && index === 0)\n const x = (value: number) => (absolute ? value * scale + dx : value * scale)\n const y = (value: number) => (absolute ? value * scale + dy : value * scale)\n switch (lower) {\n case 'h':\n return [x(group[0])]\n case 'v':\n return [y(group[0])]\n case 'a':\n return [group[0] * scale, group[1] * scale, group[2], group[3], group[4], x(group[5]), y(group[6])]\n default:\n return group.map((value, position) => (position % 2 === 0 ? x(value) : y(value)))\n }\n })\n out.push(`${command}${parts.map((part) => part.map(round).join(' ')).join(' ')}`)\n first = false\n }\n if (!out.length || !/^[Mm]/.test(out[0])) return null\n return identity ? source : out.join('')\n}\n\n/** The attributes of a shape in a reader's cleaned drawing. */\nfunction shapeAttributes(source: string): Record<string, string> {\n const out: Record<string, string> = {}\n for (const match of source.matchAll(/([a-zA-Z-]+)=\"([^\"]*)\"/g)) out[match[1].toLowerCase()] = match[2]\n return out\n}\n\nconst num = (value: string | undefined): number => (value === undefined ? Number.NaN : Number.parseFloat(value))\n\n/** A shape of a drawing as path data, or `null` for one that is only a stroke or is moved by a transform. */\nfunction shapePath(tag: string, attributes: Record<string, string>): string | null {\n if (attributes['transform'] || attributes['fill'] === 'none') return null\n switch (tag) {\n case 'path':\n return attributes['d']?.trim() || null\n case 'circle':\n case 'ellipse': {\n const cx = num(attributes['cx'] ?? '0')\n const cy = num(attributes['cy'] ?? '0')\n const rx = tag === 'circle' ? num(attributes['r']) : num(attributes['rx'])\n const ry = tag === 'circle' ? rx : num(attributes['ry'])\n if (![cx, cy, rx, ry].every(Number.isFinite) || rx <= 0 || ry <= 0) return null\n return `M${cx - rx} ${cy}A${rx} ${ry} 0 1 0 ${cx + rx} ${cy}A${rx} ${ry} 0 1 0 ${cx - rx} ${cy}Z`\n }\n case 'rect': {\n const x = num(attributes['x'] ?? '0')\n const y = num(attributes['y'] ?? '0')\n const width = num(attributes['width'])\n const height = num(attributes['height'])\n if (![x, y, width, height].every(Number.isFinite) || width <= 0 || height <= 0) return null\n return `M${x} ${y}H${x + width}V${y + height}H${x}Z`\n }\n case 'polygon': {\n const points = (attributes['points'] ?? '').trim().split(/[\\s,]+/).map(Number)\n if (points.length < 4 || points.length % 2 || points.some((value) => !Number.isFinite(value))) return null\n return `M${points.slice(0, 2).join(' ')}L${points.slice(2).join(' ')}Z`\n }\n default:\n // A line or an open polyline is a stroke: filled, it draws nothing.\n return null\n }\n}\n\n/**\n * The source's icon as the icon element draws one (AGL-4107): one path on its\n * 24-unit square. A one-path icon is its path, moved onto the square; a small\n * drawing of several filled shapes is their paths together. A drawing made of\n * strokes, or of shapes a transform moves, has no one path, and is left out:\n * an icon is no word of the page.\n */\nexport function aiSiteImportIconPath(shape: SiteImportIconShape | undefined): string | null {\n if (!shape) return null\n if (shape.path) return aiSiteImportPathOn24(shape.path, shape.viewBox)\n if (!shape.svg) return null\n const paths: string[] = []\n for (const match of shape.svg.matchAll(/<(path|circle|ellipse|rect|polygon|polyline|line)\\b([^>]*)\\/?>/gi)) {\n const path = shapePath(match[1].toLowerCase(), shapeAttributes(match[2]))\n if (!path) return null\n paths.push(path)\n }\n return paths.length ? aiSiteImportPathOn24(paths.join(''), shape.viewBox) : null\n}\n\n/*------------------------------------------\n * The layout in the layout language\n *-----------------------------------------*/\n\n/** The groups a design answer may read as another kind: the ones whose kind the reader told by their shape alone. */\nconst OPEN_KINDS: ReadonlySet<SiteImportGroupKind> = new Set(['cards', 'steps', 'stats', 'list', 'text'])\n\n/** The hero each place of the source's picture opens as, where no answer chose one. */\nconst HERO_FOR: Readonly<Record<SiteImportHeroPicture, AiLayoutImportHero>> = {\n beside: 'split',\n behind: 'cover',\n below: 'column',\n above: 'column',\n}\n\ninterface MapScope {\n doc: AiSiteImportDocument\n layout: SiteImportLayout\n /** Lines taken into a block, by index of the page's blocks. */\n used: Set<number>\n /** Pictures the library could not hold, which a page leaves out. */\n missing: Set<number>\n photos: ReadonlyMap<string, AiSiteImportPhoto>\n pathTo: ReadonlyMap<string, string>\n /** The site's saved form a page brought in places where its source had one. */\n formId: string | null\n formPlaced: boolean\n /** The section being mapped: its design answer, and how many of its groups have been met. */\n answer: AiLayoutDesignSection | null\n groupAt: number\n settled: AiLayoutSettlement[]\n at: string\n}\n\n/** Where a link of the source goes on the new site, in the compiler's words; `undefined` where it can go nowhere a page may send a visitor. */\nfunction linkTo(scope: Pick<MapScope, 'doc' | 'pathTo'>, href: string | undefined): string | undefined {\n const value = (href ?? '').trim()\n if (/^mailto:[^\\s@]+@[^\\s@]+$/i.test(value) || /^tel:\\+?[\\d\\s().-]{3,}$/i.test(value)) return value\n let url: URL\n try {\n url = new URL(value)\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n if (scope.doc.origins.includes(url.origin)) {\n // The old site's own page: the page it becomes, any page the import plans\n // (AGL-4107), which a visitor reaches once it is live.\n const path = url.pathname.replace(/\\/+$/, '') || '/'\n const id = scope.pathTo.get(path)\n return id ? `page:${id}` : undefined\n }\n return url.protocol === 'https:' ? url.toString() : undefined\n}\n\n/** A line's words, as written; marks it taken. */\nfunction take(scope: MapScope, ref: SiteImportLineRef | undefined): string {\n if (ref === undefined || scope.used.has(ref)) return ''\n const block = scope.doc.blocks[ref]\n if (!isLine(block)) return ''\n scope.used.add(ref)\n return block.kind === 'image' ? '' : clean(block.text)\n}\n\n/** A picture line as the library holds it; marks it taken, and missing where the library holds none. */\nfunction takePicture(scope: MapScope, ref: SiteImportLineRef | undefined, href?: string): AiLayoutPicture | null {\n if (ref === undefined || scope.used.has(ref)) return null\n const block = scope.doc.blocks[ref]\n if (!block || block.kind !== 'image') return null\n scope.used.add(ref)\n const photo = scope.photos.get(block.url)\n if (!photo) {\n scope.missing.add(ref)\n return null\n }\n const alt = clean(block.alt || photo.alt || '').slice(0, 200)\n const ratio = photo.width && photo.height ? photo.width / photo.height : 0\n const to = linkTo(scope, href)\n return { src: photo.src, alt, ...(ratio > 0 ? { ratio } : {}), ...(to ? { to } : {}) }\n}\n\n/** Words as text blocks, a paragraph longer than a text element holds split between its sentences. */\nfunction textBlocks(kind: 'text' | 'lede' | 'note', text: string): AiLayoutBlock[] {\n return aiSiteImportTextParts(text).map((part) => ({ kind, text: part }))\n}\n\n/** A link of the source: a button where its words fit one, a link in a list where they run longer, its words where it goes nowhere. */\nfunction linkBlocks(scope: MapScope, text: string, href: string, style: AiLayoutStyle): AiLayoutBlock[] {\n const to = linkTo(scope, href)\n if (text.length <= AI_SITE_IMPORT_LABEL_CHARS) return [{ kind: 'button', text, ...(to ? { to } : {}), style }]\n if (to) return [{ kind: 'list', items: [{ title: text, text: '', to }] }]\n return textBlocks('text', text)\n}\n\n/** One line in place, as the kind of block its source and its role say. */\nfunction lineBlocks(scope: MapScope, node: SiteImportLayoutLine): AiLayoutBlock[] {\n const block = scope.doc.blocks[node.line]\n if (!block || scope.used.has(node.line)) return []\n if (block.kind === 'image') {\n const picture = takePicture(scope, node.line)\n return picture ? [{ kind: 'image', picture }] : []\n }\n const text = take(scope, node.line)\n if (!text) return []\n switch (block.kind) {\n case 'heading':\n return [{ kind: 'heading', text }]\n case 'link':\n return linkBlocks(scope, text, block.href, node.button ?? 'quiet')\n case 'list-item':\n return [{ kind: 'list', items: [{ title: text, text: '' }] }]\n case 'quote':\n return [{ kind: 'quotes', style: 'quiet', items: [{ title: '', text }] }]\n default:\n if (node.role === 'eyebrow') return [{ kind: 'eyebrow', text }]\n return textBlocks(node.role === 'lede' ? 'lede' : node.role === 'note' ? 'note' : 'text', text)\n }\n}\n\n/** The icon a group item or a bullet carries, by its index into the page's icons. */\nfunction iconAt(scope: MapScope, index: number | undefined): string | undefined {\n return index === undefined ? undefined : (aiSiteImportIconPath(scope.layout.icons[index]) ?? undefined)\n}\n\n/** The style of a link inside an item: a plan's own button is filled outlined, any other a quiet link. */\nfunction itemLinkStyle(kind: SiteImportGroupKind): AiLayoutStyle {\n return kind === 'pricing' ? 'secondary' : 'quiet'\n}\n\n/** One item of a group, every line of it in exactly one of its parts. */\nfunction itemOf(scope: MapScope, group: SiteImportLayoutGroup, item: SiteImportLayoutItem): AiLayoutItem {\n const out: AiLayoutItem = { title: '', text: '' }\n const named = new Set<number>([\n ...(item.title !== undefined ? [item.title] : []),\n ...(item.figure !== undefined ? [item.figure] : []),\n ...(item.image !== undefined ? [item.image] : []),\n ...(item.text ?? []),\n ...(item.list ?? []),\n ...(item.link ?? []),\n ])\n const paragraphs: string[] = []\n const links: AiLayoutLink[] = []\n const addLink = (ref: number) => {\n const block = scope.doc.blocks[ref]\n const text = take(scope, ref)\n if (!text) return\n const to = block?.kind === 'link' ? linkTo(scope, block.href) : undefined\n if (text.length <= AI_SITE_IMPORT_LABEL_CHARS) links.push({ text, ...(to ? { to } : {}), style: itemLinkStyle(group.group) })\n else paragraphs.push(text)\n }\n // The item's lines in the source's order: each where its part says.\n for (const ref of item.lines) {\n if (scope.used.has(ref)) continue\n const block = scope.doc.blocks[ref]\n if (!block) continue\n if (ref === item.title) out.title = take(scope, ref)\n else if (ref === item.figure) out.figure = take(scope, ref)\n else if (ref === item.image || (block.kind === 'image' && !named.has(ref))) {\n const picture = takePicture(scope, ref)\n if (picture && !out.picture) out.picture = picture\n } else if (item.list?.includes(ref)) {\n const line = take(scope, ref)\n if (line) out.list = [...(out.list ?? []), line]\n } else if (item.link?.includes(ref) || (!named.has(ref) && block.kind === 'link')) addLink(ref)\n else {\n const line = take(scope, ref)\n if (line) paragraphs.push(...aiSiteImportTextParts(line))\n }\n }\n if (paragraphs.length) out.text = paragraphs[0]\n if (paragraphs.length > 1) out.more = paragraphs.slice(1)\n if (links.length) out.links = links\n const icon = iconAt(scope, item.icon)\n if (icon) out.iconPath = icon\n const mark = iconAt(scope, item.listIcon)\n if (mark && out.list?.length) out.listIconPath = mark\n const to = linkTo(scope, item.to)\n if (to) out.to = to\n return out\n}\n\n/** The style a group of cards is drawn in where its design answer chose none: the source's own box, icons or pictures. */\nfunction defaultStyle(group: SiteImportLayoutGroup, items: readonly AiLayoutItem[]): AiLayoutGroupStyle {\n const pictured = items.length > 0 && items.every((item) => item.picture)\n if (pictured) return group.boxed ? 'articles' : 'pictures'\n if (group.boxed) return 'cards'\n return items.length > 0 && items.every((item) => item.iconPath) ? 'icons' : 'ruled'\n}\n\n/** The style an answer chose, where the group can be drawn so: pictures need a picture on every item, icons an icon. */\nfunction styleFor(asked: AiLayoutGroupStyle | undefined, group: SiteImportLayoutGroup, items: readonly AiLayoutItem[]): AiLayoutGroupStyle {\n const fallback = defaultStyle(group, items)\n if (!asked || !(AI_LAYOUT_GROUP_STYLES as readonly string[]).includes(asked)) return fallback\n if ((asked === 'pictures' || asked === 'articles') && !items.every((item) => item.picture)) return fallback\n if (asked === 'icons' && !items.every((item) => item.iconPath)) return fallback\n return asked\n}\n\n/** A group of the source, in the layout language: every item of it, in the kind and style its answer chose or its source shows. */\nfunction groupBlocks(scope: MapScope, group: SiteImportLayoutGroup): AiLayoutBlock[] {\n const answer = scope.answer?.groups[scope.groupAt] ?? null\n scope.groupAt += 1\n const kind: SiteImportGroupKind = answer?.kind && OPEN_KINDS.has(group.group) ? answer.kind : group.group\n if (kind !== group.group) scope.settled.push({ at: scope.at, what: `a ${group.group} group drawn as ${kind}, as its design answer read it` })\n const columns = Math.max(1, Math.min(AI_LAYOUT_MAX_COLS, group.columns || 1))\n if (kind === 'text') {\n // Lines that only share a shape: each where it stands.\n return group.items.flatMap((item) => item.lines.flatMap((ref) => lineBlocks(scope, { kind: 'line', line: ref })))\n }\n if (kind === 'list') {\n const items = group.items.flatMap((item): AiLayoutItem[] => {\n const linked = item.lines.map((ref) => scope.doc.blocks[ref]).find((block) => block?.kind === 'link')\n const words = item.lines.map((ref) => take(scope, ref)).filter(Boolean).join(' ')\n for (const ref of item.lines) {\n if (scope.doc.blocks[ref]?.kind === 'image') takePicture(scope, ref)\n }\n if (!words) return []\n const icon = iconAt(scope, item.icon)\n const to = linkTo(scope, item.to ?? (linked?.kind === 'link' ? linked.href : undefined))\n return [{ title: words, text: '', ...(icon ? { iconPath: icon } : {}), ...(to ? { to } : {}) }]\n })\n return items.length ? [{ kind: 'list', items, columns }] : []\n }\n if (kind === 'logos') {\n const items = group.items.flatMap((item): AiLayoutItem[] => {\n let picture: AiLayoutPicture | null = null\n const words: string[] = []\n for (const ref of item.lines) {\n if (scope.doc.blocks[ref]?.kind === 'image') picture = picture ?? takePicture(scope, ref)\n else {\n const line = take(scope, ref)\n if (line) words.push(line)\n }\n }\n if (picture && !words.length) return [{ title: '', text: '', picture }]\n return words.length ? [{ title: words.join(' '), text: '', ...(picture ? { picture } : {}) }] : picture ? [{ title: '', text: '', picture }] : []\n })\n return items.length ? [{ kind: 'logos', items }] : []\n }\n const items = group.items.map((item) => itemOf(scope, group, item))\n if (kind === 'quotes') {\n // The reader names a quote's words its title and who said it its text.\n const quotes = items.map((item) => ({ ...item, title: [item.text, ...(item.more ?? [])].filter(Boolean).join(' '), text: item.title, more: [] as string[] }))\n return [{ kind: 'quotes', items: quotes.map(({ more: _more, ...item }) => item), columns, ...(group.boxed ? { variant: 'cards' as const } : { style: 'quiet' as const }) }]\n }\n if (kind === 'faq') return [{ kind: 'faq', items, columns }]\n if (kind === 'stats') return [{ kind: 'stats', items, columns, ...(group.boxed ? { variant: 'cards' as const } : {}) }]\n const style = styleFor(answer?.style, group, items)\n return [{ kind: kind === 'steps' ? 'steps' : 'cards', items, columns, variant: style }]\n}\n\n/** A section's nodes in the layout language, a row of columns placed by `col` where the section may still take one. */\nfunction nodeBlocks(scope: MapScope, nodes: readonly SiteImportLayoutNode[], row: { cols: number[] | null; allowed: boolean }): AiLayoutBlock[] {\n const out: AiLayoutBlock[] = []\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n out.push(...lineBlocks(scope, node))\n break\n case 'picture': {\n const picture = takePicture(scope, node.line, node.button ? undefined : node.href)\n if (picture) out.push({ kind: 'image', picture })\n break\n }\n case 'icon':\n // A lone icon is no word and no picture of the page.\n break\n case 'form':\n if (scope.formId && !scope.formPlaced) {\n scope.formPlaced = true\n out.push({ kind: 'form', to: scope.formId })\n }\n break\n case 'row': {\n const cells = node.cells.filter((cell) => cell.nodes.length)\n const byline = bylineOf(scope, cells)\n if (byline) {\n // A portrait beside a name and a date: the portrait small, over its words.\n out.push(...byline)\n break\n }\n if (row.allowed && !row.cols && cells.length >= 2 && cells.length <= AI_LAYOUT_MAX_COLS) {\n // The section's row: each cell a column, by the source's widths.\n const weights = node.cells.map((cell, index) => ({ cell, weight: node.cols[index] ?? 1 })).filter((entry) => entry.cell.nodes.length)\n row.cols = weights.map((entry) => Math.min(12, Math.max(1, Math.round(entry.weight))))\n weights.forEach((entry, col) => {\n for (const block of nodeBlocks(scope, entry.cell.nodes, { cols: null, allowed: false })) out.push({ ...block, col })\n })\n } else {\n // A second row of a section, or one inside a column: its cells one under another.\n for (const cell of node.cells) out.push(...nodeBlocks(scope, cell.nodes, { cols: null, allowed: false }))\n }\n break\n }\n case 'group':\n out.push(...groupBlocks(scope, node))\n break\n case 'table': {\n const rows = node.rows.map((tableRow) => ({ cells: tableRow.cells.map((cell) => cell.lines.map((ref) => take(scope, ref)).filter(Boolean).join(' ')) }))\n if (rows.some((tableRow) => tableRow.cells.some(Boolean))) out.push({ kind: 'table', header: node.header, rows })\n break\n }\n case 'tabs': {\n const tabs = node.tabs.map((tab) => ({\n label: tab.label === null ? '' : take(scope, tab.label),\n ...(tab.selected ? { selected: true } : {}),\n blocks: mergeLists(nodeBlocks(scope, tab.panel, { cols: null, allowed: false })),\n }))\n if (tabs.some((tab) => tab.label || tab.blocks.length)) out.push({ kind: 'tabs', tabs })\n break\n }\n default:\n break\n }\n }\n return out\n}\n\n/** The most words beside a lone picture that make a row a byline: a name, a date, a role. */\nconst BYLINE_MAX_WORDS = 12\n\n/**\n * A row that is a byline (AGL-4107): one cell a lone picture, the other a few\n * words — a writer's portrait beside their name and date. Drawn as columns it\n * set a portrait across half the page; it is the portrait, small, and its words.\n */\nfunction bylineOf(scope: MapScope, cells: ReadonlyArray<{ nodes: SiteImportLayoutNode[] }>): AiLayoutBlock[] | null {\n if (cells.length !== 2) return null\n const at = cells.findIndex((cell) => cell.nodes.length === 1 && cell.nodes[0].kind === 'picture')\n if (at === -1) return null\n const words = cells[1 - at].nodes\n if (!words.every((node) => node.kind === 'line')) return null\n const count = words.reduce((total, node) => {\n const block = scope.doc.blocks[(node as SiteImportLayoutLine).line]\n return total + (block && block.kind !== 'image' ? aiSiteImportWordsIn(clean(block.text)) : 0)\n }, 0)\n if (count === 0 || count > BYLINE_MAX_WORDS) return null\n const node = cells[at].nodes[0] as Extract<SiteImportLayoutNode, { kind: 'picture' }>\n const picture = takePicture(scope, node.line, node.button ? undefined : node.href)\n return [...(picture ? [{ kind: 'image' as const, picture: { ...picture, small: true } }] : []), ...nodeBlocks(scope, words, { cols: null, allowed: false })]\n}\n\n/** Paragraphs past which a section is reading copy, set at the start whatever its source centers. */\nconst READING_PARAGRAPHS = 4\n\n/** Neighboring one-line lists of one column as one list, as the source's list items read. */\nfunction mergeLists(blocks: readonly AiLayoutBlock[]): AiLayoutBlock[] {\n const out: AiLayoutBlock[] = []\n for (const block of blocks) {\n const last = out[out.length - 1]\n const plain = (entry: AiLayoutBlock | undefined) => entry?.kind === 'list' && entry.columns === undefined && !entry.items?.some((item) => item.iconPath)\n if (plain(block) && plain(last) && last?.col === block.col) {\n out[out.length - 1] = { ...last, items: [...(last.items ?? []), ...(block.items ?? [])] }\n continue\n }\n out.push(block)\n }\n return out\n}\n\n/** The hero a section's opening takes: the first section's, around its picture beside, behind or under its words. */\nfunction heroOf(section: SiteImportLayoutSection, index: number, answer: AiLayoutDesignSection | null): AiLayoutImportHero | undefined {\n if (index !== 0 || !section.hero?.picture) return undefined\n // An answer of \"none\" keeps the opening as the source lays it out.\n if (answer?.hero === 'none') return undefined\n return answer?.hero ?? HERO_FOR[section.hero.picture]\n}\n\nexport interface AiSiteImportDesigned {\n sections: AiLayoutSection[]\n /** Lines taken into a block, by index of the page's blocks. */\n used: Set<number>\n /** Pictures the library could not hold. */\n missing: Set<number>\n settled: AiLayoutSettlement[]\n}\n\n/**\n * The page's sections in the layout language (AGL-4107): the source's layout,\n * each section in its own band (or the answer's, where the source gave none),\n * its row, its groups and their items, its tables, tabs and pictures, every\n * line taken exactly once and every line the layout placed nowhere added at\n * its section's end.\n */\nexport function aiSiteImportDesignedSections(\n doc: AiSiteImportDocument,\n answer?: AiLayoutDesignAnswer | null,\n options: { formId?: string | null } = {},\n): AiSiteImportDesigned {\n const layout = aiSiteImportLayoutOf(doc)\n const scope: MapScope = {\n doc,\n layout,\n used: new Set(),\n missing: new Set(),\n photos: new Map(doc.photos.flatMap((photo) => (photo.from ? [[photo.from, photo] as const] : []))),\n pathTo: new Map(doc.links.map((link) => [link.path.replace(/\\/+$/, '') || '/', link.id])),\n formId: options.formId ?? null,\n formPlaced: false,\n answer: null,\n groupAt: 0,\n settled: [],\n at: '',\n }\n const sections = layout.sections.map((section, index): AiLayoutSection => {\n const given = answer?.sections[index] ?? null\n scope.answer = given\n scope.groupAt = 0\n scope.at = `sections[${index}]`\n const row = { cols: null as number[] | null, allowed: true }\n const blocks = nodeBlocks(scope, section.nodes, row)\n // Every line the layout placed nowhere, at the section's end, as its kind says.\n for (const ref of section.lines) {\n if (scope.used.has(ref)) continue\n const block = doc.blocks[ref]\n if (!isLine(block)) continue\n blocks.push(...lineBlocks(scope, { kind: 'line', line: ref }))\n }\n const hero = heroOf(section, index, given)\n // A band only where the source gave the section none of its own.\n const band = section.background === null && !section.backdrop && given?.band ? given.band : section.band\n // A long read is set at the start, as text is read, whatever its source centers.\n const reading = blocks.filter((block) => block.kind === 'text').length > READING_PARAGRAPHS\n return {\n band,\n align: given?.align ?? (reading ? 'start' : section.align),\n ...(row.cols && blocks.some((block) => block.col !== undefined) ? { cols: row.cols } : {}),\n blocks: mergeLists(blocks),\n ...(hero ? { hero } : {}),\n }\n })\n return { sections, used: scope.used, missing: scope.missing, settled: scope.settled }\n}\n\n/*------------------------------------------\n * The page compiled\n *-----------------------------------------*/\n\nexport interface AiSiteImportCompileInput {\n doc: AiSiteImportDocument\n /** The ids the page stores its sections under, in plan order: one for each of the page's sections. */\n sectionIds: readonly string[]\n /** The page's plan: its title and its sections by name. */\n plan: AiLayoutPagePlan\n targets: AiLayoutTargets\n /** The site the page belongs to, which its hero is drawn for. */\n design?: AiLayoutDesign | null\n language?: string\n /** The page's design answer, for a main page; absent, the page is drawn as its source lays it out. */\n answer?: AiLayoutDesignAnswer | null\n}\n\nexport interface AiSiteImportCompiled extends Pick<AiLayoutCompiledPage, 'tree' | 'sectionRoots'> {\n sections: AiLayoutSection[]\n /** The lines on the page, by index of its blocks, in source order. */\n placed: number[]\n /** Every line the page has. */\n lines: number\n /** The words on the page, and the words its lines hold. */\n words: number\n sourceWords: number\n /** Set when the page ran past what one page may weigh, and its last sections keep only their names. */\n cut: boolean\n settled: AiLayoutSettlement[]\n}\n\n/**\n * The page brought in, built by the site compiler (AGL-4107): every line on\n * it exactly once, every word as its source wrote it, laid out as its source\n * lays it out and drawn in the site's own theme.\n */\nexport function aiCompileImportedPage(input: AiSiteImportCompileInput): AiSiteImportCompiled {\n const { doc } = input\n const formId = input.targets.forms.length === 1 ? input.targets.forms[0].id : null\n const designed = aiSiteImportDesignedSections(doc, input.answer ?? null, { formId })\n const compile = (sections: readonly AiLayoutSection[]) =>\n aiCompileLayoutPage(sections, input.plan, input.targets, {\n // A page brought in draws its repeats as its source does (AGL-4107).\n reusableComponents: false,\n sectionIds: input.sectionIds,\n verbatim: true,\n ...(input.design ? { design: input.design } : {}),\n ...(input.language ? { language: input.language } : {}),\n })\n let sections = designed.sections\n let compiled = compile(sections)\n let cut = false\n // A page past what one page may weigh keeps its last sections by name.\n for (let last = sections.length - 1; Object.keys(compiled.tree.nodes).length > AI_SITE_IMPORT_DOC_MAX_NODES && last > 0; last -= 1) {\n cut = true\n sections = sections.map((section, index) => (index >= last ? { ...section, blocks: [], cols: undefined } : section))\n compiled = compile(sections)\n }\n const dropped = new Set<number>()\n if (cut) {\n const layout = aiSiteImportLayoutOf(doc)\n layout.sections.forEach((section, index) => {\n if (!sections[index]?.blocks.length) for (const ref of section.lines) dropped.add(ref)\n })\n }\n const lineRefs = doc.blocks.flatMap((block, index) => (isLine(block) ? [index] : []))\n const placed = lineRefs.filter((ref) => designed.used.has(ref) && !designed.missing.has(ref) && !dropped.has(ref))\n const wordsOf = (ref: number) => {\n const block = doc.blocks[ref]\n return block && block.kind !== 'image' ? aiSiteImportWordsIn(clean(block.text)) : 0\n }\n return {\n tree: compiled.tree,\n sectionRoots: compiled.sectionRoots,\n sections,\n placed,\n lines: lineRefs.length,\n words: placed.reduce((total, ref) => total + wordsOf(ref), 0),\n sourceWords: lineRefs.reduce((total, ref) => total + wordsOf(ref), 0),\n cut,\n settled: [...designed.settled, ...compiled.settled],\n }\n}\n\n/*------------------------------------------\n * What the design answer is shown\n *-----------------------------------------*/\n\n/** The most characters of a page's structure a design prompt shows. */\nexport const AI_SITE_IMPORT_DESIGN_MAX_CHARS = 12_000\n\n/** What a line is, as the design answer reads its place. */\nfunction lineKind(block: SiteImportBlock | undefined, node: SiteImportLayoutLine): string {\n if (!block) return 'line'\n if (block.kind === 'heading') return 'heading'\n if (block.kind === 'link') return node.button ? `${node.button === 'primary' ? 'filled' : node.button === 'secondary' ? 'outlined' : 'quiet'} button` : 'link'\n if (block.kind === 'list-item') return 'list item'\n if (block.kind === 'quote') return 'quote'\n if (block.kind === 'image') return 'picture'\n return node.role ?? 'text'\n}\n\n/** What an item of a group shows, as one phrase: \"icon + title + text + link\". */\nfunction itemShape(item: SiteImportLayoutItem): string[] {\n return [\n item.image !== undefined ? 'picture' : '',\n item.icon !== undefined ? 'icon' : '',\n item.figure !== undefined ? 'figure' : '',\n item.title !== undefined ? 'title' : '',\n item.text?.length ? 'text' : '',\n item.list?.length ? `${item.listIcon !== undefined ? 'checked ' : ''}list` : '',\n item.link?.length ? 'link' : '',\n ].filter(Boolean)\n}\n\n/** A run of one kind of part counted: \"2 buttons\", not \"button, button\". */\nfunction counted(parts: readonly string[]): string {\n const out: string[] = []\n for (let at = 0; at < parts.length; ) {\n let run = 1\n while (parts[at + run] === parts[at]) run += 1\n out.push(run > 1 ? `${run} ${parts[at]}s` : parts[at])\n at += run\n }\n return out.join(', ')\n}\n\n/** A section's nodes as the design answer reads them, its groups numbered in order. */\nfunction describeNodes(doc: Pick<AiSiteImportDocument, 'blocks'>, nodes: readonly SiteImportLayoutNode[], groups: { count: number }): string[] {\n const parts: string[] = []\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n parts.push(lineKind(doc.blocks[node.line], node))\n break\n case 'picture':\n parts.push('picture')\n break\n case 'form':\n parts.push('form')\n break\n case 'row':\n parts.push(`a row of ${node.cells.length} columns (${node.cells.map((cell, index) => `column ${index + 1}: ${describeNodes(doc, cell.nodes, groups).join(', ') || 'empty'}`).join('; ')})`)\n break\n case 'group': {\n groups.count += 1\n const shape = [...new Set(node.items.map((item) => itemShape(item).join(' + ')).filter(Boolean))].slice(0, 2).join(' or ')\n parts.push(`group ${groups.count}: ${node.items.length} ${node.group} in ${node.columns} column${node.columns === 1 ? '' : 's'}${node.boxed ? ', boxed' : ''}${shape ? `, each ${shape}` : ''}`)\n break\n }\n case 'table':\n parts.push(`a table of ${node.rows.length} rows`)\n break\n case 'tabs':\n parts.push(`${node.tabs.length} tabs (${node.tabs.map((tab, index) => `tab ${index + 1}: ${describeNodes(doc, tab.panel, groups).join(', ') || 'not drawn'}`).join('; ')})`)\n break\n default:\n break\n }\n }\n return parts\n}\n\n/**\n * The page's structure as its design answer reads it (AGL-4107): each\n * section's name, band, alignment and what it shows, its groups numbered as\n * the answer names them. No word of the page is in it but its sections'\n * names, which are fenced where the prompt shows them.\n */\nexport function aiSiteImportDesignText(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): string {\n const layout = aiSiteImportLayoutOf(doc)\n const names = aiSiteImportSectionNames(doc)\n return layout.sections\n .map((section, index) => {\n const groups = { count: 0 }\n const shows = describeNodes(doc, section.nodes, groups)\n const band = section.background === null && !section.backdrop ? 'no band of its own' : `${section.band} band${section.backdrop?.kind === 'gradient' ? ' with a gradient' : ''}`\n const hero = index === 0 && section.hero?.picture ? `; opens the page, its picture ${section.hero.picture} its words` : index === 0 ? '; opens the page, with no picture' : ''\n return `Section ${index + 1} \"${names[index]}\": ${band}, ${section.align === 'center' ? 'centered' : 'aligned to the start'}${hero}. Groups: ${groups.count}. Shows: ${counted(shows)}.`\n })\n .join('\\n')\n}\n"],"names":["aiCompileLayoutPage","AI_LAYOUT_GROUP_STYLES","AI_LAYOUT_MAX_COLS","AI_SITE_IMPORT_LABEL_MAX_CHARS","aiModelAtLeastStepTier","AI_SITE_IMPORT_DOC_MAX_NODES","AI_SITE_IMPORT_LABEL_CHARS","aiSiteImportDocLines","aiSiteImportTextParts","aiSiteImportWordsIn","clean","text","replace","trim","isLine","block","kind","url","inline","aiImportPageModel","modelFor","aiSiteImportLinkablePages","doc","seen","Set","links","flatMap","link","has","id","add","path","label","slug","aiImportedPageListing","screen","written","title","seoTitle","description","seoDescription","aiImportedPageListingOwed","listing","aiSiteImportLayoutOfLines","lines","sections","blocks","refOf","forEach","index","push","v","map","section","refs","n","filter","ref","undefined","name","from","band","background","align","nodes","line","icons","look","fonts","body","headings","google","buttonFill","buttonText","buttonRadius","header","aiSiteImportLayoutOf","layout","length","aiSiteImportSectionNames","named","names","slice","unique","attempt","toLowerCase","PATH_PARAMS","m","l","h","c","s","q","t","a","z","NUMBER","FLAG","round","value","fixed","Math","Object","is","String","aiSiteImportPathOn24","d","viewBox","box","split","Number","some","isFinite","minX","minY","width","height","scale","max","dx","dy","identity","abs","out","at","first","source","test","command","lower","count","relative","groups","group","pattern","lastIndex","match","exec","parts","absolute","x","y","position","part","join","shapeAttributes","matchAll","num","NaN","parseFloat","shapePath","tag","attributes","cx","cy","rx","ry","every","points","aiSiteImportIconPath","shape","svg","paths","OPEN_KINDS","HERO_FOR","beside","behind","below","above","linkTo","scope","href","URL","protocol","origins","includes","origin","pathname","pathTo","get","toString","take","used","takePicture","photo","photos","missing","alt","ratio","to","src","textBlocks","linkBlocks","style","items","lineBlocks","node","picture","button","role","iconAt","itemLinkStyle","itemOf","item","figure","image","list","paragraphs","addLink","more","icon","iconPath","mark","listIcon","listIconPath","defaultStyle","pictured","boxed","styleFor","asked","fallback","groupBlocks","answer","groupAt","settled","what","columns","min","linked","find","words","Boolean","quotes","_more","variant","nodeBlocks","row","formId","formPlaced","cells","cell","byline","bylineOf","allowed","cols","weights","weight","entry","col","rows","tableRow","tabs","tab","selected","mergeLists","panel","BYLINE_MAX_WORDS","findIndex","reduce","total","small","READING_PARAGRAPHS","last","plain","heroOf","hero","aiSiteImportDesignedSections","options","Map","given","backdrop","reading","aiCompileImportedPage","input","targets","forms","designed","compile","plan","reusableComponents","sectionIds","verbatim","design","language","compiled","cut","keys","tree","dropped","lineRefs","placed","wordsOf","sectionRoots","sourceWords","AI_SITE_IMPORT_DESIGN_MAX_CHARS","lineKind","itemShape","counted","run","describeNodes","aiSiteImportDesignText","shows"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA6B2C,GAE3C,SACEA,mBAAmB,QAGd,2CAAuC;AAE9C,SACEC,sBAAsB,EAEtBC,kBAAkB,QAYb,2CAAuC;AAE9C,SACEC,8BAA8B,QAYzB,6BAAy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AAQ,CACnBO,GAAG,CAAC,CAACC,SAASJ;YAGiGI,mBAClFA;QAH5B,MAAM+E,SAAS;YAAEF,OAAO;QAAE;QAC1B,MAAM2K,QAAQF,cAAcrR,KAAK+B,QAAQW,KAAK,EAAEoE;QAChD,MAAMvE,OAAOR,QAAQS,UAAU,KAAK,QAAQ,CAACT,QAAQyN,QAAQ,GAAG,uBAAuB,GAAGzN,QAAQQ,IAAI,CAAC,KAAK,EAAER,EAAAA,oBAAAA,QAAQyN,QAAQ,qBAAhBzN,kBAAkBrC,IAAI,MAAK,aAAa,qBAAqB,IAAI;QAC/K,MAAMyP,OAAOxN,UAAU,OAAKI,gBAAAA,QAAQoN,IAAI,qBAAZpN,cAAcgJ,OAAO,IAAG,CAAC,8BAA8B,EAAEhJ,QAAQoN,IAAI,CAACpE,OAAO,CAAC,UAAU,CAAC,GAAGpJ,UAAU,IAAI,sCAAsC;QAC5K,OAAO,CAAC,QAAQ,EAAEA,QAAQ,EAAE,EAAE,EAAEgC,KAAK,CAAChC,MAAM,CAAC,GAAG,EAAEY,KAAK,EAAE,EAAER,QAAQU,KAAK,KAAK,WAAW,aAAa,yBAAyB0M,KAAK,UAAU,EAAErI,OAAOF,KAAK,CAAC,SAAS,EAAEuK,QAAQI,OAAO,CAAC,CAAC;IAC1L,GACC7J,IAAI,CAAC;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-site-import-compile.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 * A PAGE BROUGHT IN, BUILT BY THE SITE COMPILER (AGL-4107).\n *\n * On 10/29 an import of aglyn.com came out one column of plain lines: the\n * import drew its own stacked text instead of the site's cards, columns,\n * pictures, icons and bands. This module is the page's build now:\n *\n * 1. The source's LAYOUT, as the reader read it (`AiSiteImportPageRead.\n * layout`, AGL-4106) — its sections and bands, rows of columns, groups of\n * cards, steps, figures, questions, quotes, logos and plans, its tables,\n * tabs, pictures and icons — becomes the layout language the guided\n * start's compiler takes (`aiSiteImportDesignedSections`): a group is a\n * `cards` block whose items carry every part (icon, picture, figure,\n * paragraphs, bullet points, links), a table a `table` block, tabs a\n * `tabs` block. Every line is placed exactly once, in its own section; a\n * line the layout placed nowhere is added at its section's end.\n * 2. The site compiler draws it (`aiCompileLayoutPage`, `verbatim`), with\n * the palette's own elements and the theme's tokens: the Card, the\n * Accordion, the Table, the Tabs, the hero around the source's picture.\n * Every word is the source's, as written.\n * 3. A main page's DESIGN is the one question a model answers\n * (`submit_design`, `aiSiteImportDesignText`): which hero the opening\n * becomes, how each group is drawn, a band where the source gave none,\n * the kind of a group the reader could not tell, an alignment. A page of\n * a collection, and any page whose answer is missing, is drawn from the\n * layout with no model.\n *\n * A read made before the reader kept no layout: its page is read into one\n * here, from its lines, one section at each second-level heading.\n *=========================================*/\n\nimport {\n aiCompileLayoutPage,\n type AiLayoutCompiledPage,\n type AiLayoutPagePlan,\n} from '../layout-language/ai-layout-compiler'\nimport type { AiLayoutDesign } from '../layout-language/ai-layout-design'\nimport {\n AI_LAYOUT_GROUP_STYLES,\n AI_LAYOUT_IMPORT_HEROES,\n AI_LAYOUT_MAX_COLS,\n type AiLayoutBlock,\n type AiLayoutDesignAnswer,\n type AiLayoutDesignSection,\n type AiLayoutGroupStyle,\n type AiLayoutImportHero,\n type AiLayoutItem,\n type AiLayoutLink,\n type AiLayoutPicture,\n type AiLayoutSection,\n type AiLayoutSettlement,\n type AiLayoutStyle,\n} from '../layout-language/ai-layout-language'\nimport type { AiLayoutTargets } from '../layout-language/ai-layout-links'\nimport {\n AI_SITE_IMPORT_LABEL_MAX_CHARS,\n type AiSiteImportPhoto,\n type SiteImportGroupKind,\n type SiteImportHeroPicture,\n type SiteImportIconShape,\n type SiteImportLayout,\n type SiteImportLayoutGroup,\n type SiteImportLayoutItem,\n type SiteImportLayoutLine,\n type SiteImportLayoutNode,\n type SiteImportLayoutSection,\n type SiteImportLineRef,\n} from '../model/ai-site-import'\nimport { aiModelAtLeastStepTier } from '../providers/routing'\nimport type { SiteImportBlock } from '../site-import/site-import-html'\nimport {\n AI_SITE_IMPORT_DOC_MAX_NODES,\n AI_SITE_IMPORT_LABEL_CHARS,\n aiSiteImportDocLines,\n aiSiteImportTextParts,\n aiSiteImportWordsIn,\n type AiSiteImportDocument,\n} from './ai-site-import-document'\n\nconst clean = (text: unknown): string => (typeof text === 'string' ? text.replace(/\\s+/g, ' ').trim() : '')\n\n/** Whether a block is a line of the page: a link inside a sentence is in its sentence. */\nfunction isLine(block: SiteImportBlock | undefined): boolean {\n if (!block) return false\n if (block.kind === 'image') return !!block.url\n if (block.kind === 'link') return !block.inline && !!clean(block.text)\n return !!clean(block.text)\n}\n\n/*------------------------------------------\n * The page's job: its model and its links\n *-----------------------------------------*/\n\n/**\n * The model a page brought in asks its design answer on (AGL-4107): the page\n * step's own tier, balanced, whatever the deployment's default model is — the\n * job's own pick where it is that tier or above.\n */\nexport function aiImportPageModel(modelFor?: (kind: 'job.page') => string | undefined): string {\n return aiModelAtLeastStepTier('job.page', modelFor?.('job.page'))\n}\n\n/**\n * Every page the import plans that a page brought in may link (AGL-4107), by\n * the id its draft is written under: a link to one in a wave still to come\n * shows its words until that page is live, then goes there.\n */\nexport function aiSiteImportLinkablePages(doc: Pick<AiSiteImportDocument, 'links'> | null): Array<{ id: string; label: string; slug: string }> {\n if (!doc) return []\n const seen = new Set<string>()\n return doc.links.flatMap((link) => {\n if (seen.has(link.id)) return []\n seen.add(link.id)\n const path = link.path.replace(/\\/+$/, '') || '/'\n return [{ id: link.id, label: path, slug: path }]\n })\n}\n\n/**\n * The listing a page brought in keeps (AGL-4107): its source's own title and\n * description, word for word, never clipped and never rewritten — the 10/29\n * import's Home was retitled \"Aglyn: Build a Website with AI, Free to Start\".\n * Only a part the source left empty takes what was `written` for it.\n */\nexport function aiImportedPageListing(\n screen: { seoTitle: string; seoDescription: string },\n written: { title?: string; description?: string } = {},\n): { title: string; description: string } {\n return {\n title: screen.seoTitle.trim() || (written.title ?? '').trim(),\n description: screen.seoDescription.trim() || (written.description ?? '').trim(),\n }\n}\n\n/** Whether a page brought in still owes a part of its listing: one its source left empty. */\nexport function aiImportedPageListingOwed(listing: { title: string; description: string }): boolean {\n return !listing.title || !listing.description\n}\n\n/*------------------------------------------\n * The layout a page is built from\n *-----------------------------------------*/\n\n/**\n * The layout of a page whose read kept none (AGL-4107): its lines in their\n * sections — the opening, then one at each second-level heading — each line\n * where the source put it, in order.\n */\nexport function aiSiteImportLayoutOfLines(doc: Pick<AiSiteImportDocument, 'blocks' | 'title'>): SiteImportLayout {\n const { lines, sections } = aiSiteImportDocLines(doc.blocks, doc.title)\n // The document's lines are numbered over the page's lines; the layout's are indexes of its blocks.\n const refOf: number[] = []\n doc.blocks.forEach((block, index) => {\n if (isLine(block)) refOf.push(index)\n })\n return {\n v: 1,\n sections: sections.map((section, index) => {\n const refs = section.lines.map((n) => refOf[n - 1]).filter((ref): ref is number => ref !== undefined)\n return {\n name: section.name,\n from: 'heading' as const,\n band: index % 2 === 1 ? ('soft' as const) : ('plain' as const),\n background: null,\n align: 'start' as const,\n nodes: refs.map((ref): SiteImportLayoutNode => (doc.blocks[ref]?.kind === 'image' ? { kind: 'picture', line: ref } : { kind: 'line', line: ref })),\n lines: refs,\n }\n }),\n icons: [],\n look: { fonts: { body: null, headings: null, google: [] }, background: null, text: null, buttonFill: null, buttonText: null, buttonRadius: null, link: null, header: null },\n }\n}\n\n/** The layout a page is built from: the reader's, else one read from its lines. */\nexport function aiSiteImportLayoutOf(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): SiteImportLayout {\n return doc.layout && doc.layout.sections.length ? doc.layout : aiSiteImportLayoutOfLines(doc)\n}\n\n/**\n * The page's sections by name, in order (AGL-4107): the source's own, as its\n * layout names them — its `aria-label`s, its headings — two of one name told\n * apart, so a link to either finds it. The page's plan has exactly these.\n */\nexport function aiSiteImportSectionNames(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): string[] {\n const named = new Set<string>()\n const names = aiSiteImportLayoutOf(doc).sections.map((section, index) => {\n const name = clean(section.name).slice(0, AI_SITE_IMPORT_LABEL_MAX_CHARS) || `Section ${index + 1}`\n let unique = name\n for (let attempt = 2; named.has(unique.toLowerCase()); attempt += 1) {\n unique = `${name.slice(0, AI_SITE_IMPORT_LABEL_MAX_CHARS - 5)} (${attempt})`\n }\n named.add(unique.toLowerCase())\n return unique\n })\n return names.length ? names : ['Introduction']\n}\n\n/*------------------------------------------\n * The source's icons, on the icon element's square\n *-----------------------------------------*/\n\n/** How many numbers each path command takes, by its lower-case letter. */\nconst PATH_PARAMS: Readonly<Record<string, number>> = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7, z: 0 }\n\nconst NUMBER = /[\\s,]*([-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?)/y\nconst FLAG = /[\\s,]*([01])/y\n\n/** A number of a path, at most three decimals, as short as it reads. */\nconst round = (value: number): string => {\n const fixed = Math.round(value * 1000) / 1000\n return Object.is(fixed, -0) ? '0' : String(fixed)\n}\n\n/**\n * A path's drawing moved onto the icon element's 24-unit square (AGL-4107):\n * every coordinate scaled from its viewBox and centered, every relative move\n * scaled alone, an arc's radii scaled and its flags and rotation kept.\n * `null` for anything that is not path data.\n */\nexport function aiSiteImportPathOn24(d: string, viewBox: string): string | null {\n const box = viewBox.trim().split(/[\\s,]+/).map(Number)\n if (box.length !== 4 || box.some((value) => !Number.isFinite(value)) || box[2] <= 0 || box[3] <= 0) return null\n const [minX, minY, width, height] = box\n const scale = 24 / Math.max(width, height)\n const dx = (24 - width * scale) / 2 - minX * scale\n const dy = (24 - height * scale) / 2 - minY * scale\n const identity = Math.abs(scale - 1) < 1e-9 && Math.abs(dx) < 1e-9 && Math.abs(dy) < 1e-9\n const out: string[] = []\n let at = 0\n let first = true\n const source = d.trim()\n while (at < source.length) {\n while (at < source.length && /[\\s,]/.test(source[at])) at += 1\n if (at >= source.length) break\n const command = source[at]\n const lower = command.toLowerCase()\n if (!(lower in PATH_PARAMS)) return null\n at += 1\n const count = PATH_PARAMS[lower]\n const relative = command === lower\n const groups: number[][] = []\n if (count === 0) {\n out.push(command)\n first = false\n continue\n }\n for (;;) {\n const group: number[] = []\n for (let index = 0; index < count; index += 1) {\n const pattern = lower === 'a' && (index === 3 || index === 4) ? FLAG : NUMBER\n pattern.lastIndex = at\n const match = pattern.exec(source)\n if (!match) break\n group.push(Number(match[1]))\n at = pattern.lastIndex\n }\n if (group.length === 0) break\n if (group.length !== count) return null\n groups.push(group)\n }\n if (!groups.length) return null\n const parts = groups.map((group, index) => {\n // A path that opens on a relative move opens at that point, as an absolute one would.\n const absolute = !relative || (first && lower === 'm' && index === 0)\n const x = (value: number) => (absolute ? value * scale + dx : value * scale)\n const y = (value: number) => (absolute ? value * scale + dy : value * scale)\n switch (lower) {\n case 'h':\n return [x(group[0])]\n case 'v':\n return [y(group[0])]\n case 'a':\n return [group[0] * scale, group[1] * scale, group[2], group[3], group[4], x(group[5]), y(group[6])]\n default:\n return group.map((value, position) => (position % 2 === 0 ? x(value) : y(value)))\n }\n })\n out.push(`${command}${parts.map((part) => part.map(round).join(' ')).join(' ')}`)\n first = false\n }\n if (!out.length || !/^[Mm]/.test(out[0])) return null\n return identity ? source : out.join('')\n}\n\n/** The attributes of a shape in a reader's cleaned drawing. */\nfunction shapeAttributes(source: string): Record<string, string> {\n const out: Record<string, string> = {}\n for (const match of source.matchAll(/([a-zA-Z-]+)=\"([^\"]*)\"/g)) out[match[1].toLowerCase()] = match[2]\n return out\n}\n\nconst num = (value: string | undefined): number => (value === undefined ? Number.NaN : Number.parseFloat(value))\n\n/** A shape of a drawing as path data, or `null` for one that is only a stroke or is moved by a transform. */\nfunction shapePath(tag: string, attributes: Record<string, string>): string | null {\n if (attributes['transform'] || attributes['fill'] === 'none') return null\n switch (tag) {\n case 'path':\n return attributes['d']?.trim() || null\n case 'circle':\n case 'ellipse': {\n const cx = num(attributes['cx'] ?? '0')\n const cy = num(attributes['cy'] ?? '0')\n const rx = tag === 'circle' ? num(attributes['r']) : num(attributes['rx'])\n const ry = tag === 'circle' ? rx : num(attributes['ry'])\n if (![cx, cy, rx, ry].every(Number.isFinite) || rx <= 0 || ry <= 0) return null\n return `M${cx - rx} ${cy}A${rx} ${ry} 0 1 0 ${cx + rx} ${cy}A${rx} ${ry} 0 1 0 ${cx - rx} ${cy}Z`\n }\n case 'rect': {\n const x = num(attributes['x'] ?? '0')\n const y = num(attributes['y'] ?? '0')\n const width = num(attributes['width'])\n const height = num(attributes['height'])\n if (![x, y, width, height].every(Number.isFinite) || width <= 0 || height <= 0) return null\n return `M${x} ${y}H${x + width}V${y + height}H${x}Z`\n }\n case 'polygon': {\n const points = (attributes['points'] ?? '').trim().split(/[\\s,]+/).map(Number)\n if (points.length < 4 || points.length % 2 || points.some((value) => !Number.isFinite(value))) return null\n return `M${points.slice(0, 2).join(' ')}L${points.slice(2).join(' ')}Z`\n }\n default:\n // A line or an open polyline is a stroke: filled, it draws nothing.\n return null\n }\n}\n\n/**\n * The source's icon as the icon element draws one (AGL-4107): one path on its\n * 24-unit square. A one-path icon is its path, moved onto the square; a small\n * drawing of several filled shapes is their paths together. A drawing made of\n * strokes, or of shapes a transform moves, has no one path, and is left out:\n * an icon is no word of the page.\n */\nexport function aiSiteImportIconPath(shape: SiteImportIconShape | undefined): string | null {\n if (!shape) return null\n if (shape.path) return aiSiteImportPathOn24(shape.path, shape.viewBox)\n if (!shape.svg) return null\n const paths: string[] = []\n for (const match of shape.svg.matchAll(/<(path|circle|ellipse|rect|polygon|polyline|line)\\b([^>]*)\\/?>/gi)) {\n const path = shapePath(match[1].toLowerCase(), shapeAttributes(match[2]))\n if (!path) return null\n paths.push(path)\n }\n return paths.length ? aiSiteImportPathOn24(paths.join(''), shape.viewBox) : null\n}\n\n/*------------------------------------------\n * The layout in the layout language\n *-----------------------------------------*/\n\n/** The groups a design answer may read as another kind: the ones whose kind the reader told by their shape alone. */\nconst OPEN_KINDS: ReadonlySet<SiteImportGroupKind> = new Set(['cards', 'steps', 'stats', 'list', 'text'])\n\n/** The hero each place of the source's picture opens as, where no answer chose one. */\nconst HERO_FOR: Readonly<Record<SiteImportHeroPicture, AiLayoutImportHero>> = {\n beside: 'split',\n behind: 'cover',\n below: 'column',\n above: 'column',\n}\n\ninterface MapScope {\n doc: AiSiteImportDocument\n layout: SiteImportLayout\n /** Lines taken into a block, by index of the page's blocks. */\n used: Set<number>\n /** Pictures the library could not hold, which a page leaves out. */\n missing: Set<number>\n photos: ReadonlyMap<string, AiSiteImportPhoto>\n pathTo: ReadonlyMap<string, string>\n /** The site's saved form a page brought in places where its source had one. */\n formId: string | null\n formPlaced: boolean\n /** The section being mapped: its design answer, and how many of its groups have been met. */\n answer: AiLayoutDesignSection | null\n groupAt: number\n settled: AiLayoutSettlement[]\n at: string\n}\n\n/** Where a link of the source goes on the new site, in the compiler's words; `undefined` where it can go nowhere a page may send a visitor. */\nfunction linkTo(scope: Pick<MapScope, 'doc' | 'pathTo'>, href: string | undefined): string | undefined {\n const value = (href ?? '').trim()\n if (/^mailto:[^\\s@]+@[^\\s@]+$/i.test(value) || /^tel:\\+?[\\d\\s().-]{3,}$/i.test(value)) return value\n let url: URL\n try {\n url = new URL(value)\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n if (scope.doc.origins.includes(url.origin)) {\n // The old site's own page: the page it becomes, any page the import plans\n // (AGL-4107), which a visitor reaches once it is live.\n const path = url.pathname.replace(/\\/+$/, '') || '/'\n const id = scope.pathTo.get(path)\n return id ? `page:${id}` : undefined\n }\n return url.protocol === 'https:' ? url.toString() : undefined\n}\n\n/** A line's words, as written; marks it taken. */\nfunction take(scope: MapScope, ref: SiteImportLineRef | undefined): string {\n if (ref === undefined || scope.used.has(ref)) return ''\n const block = scope.doc.blocks[ref]\n if (!isLine(block)) return ''\n scope.used.add(ref)\n return block.kind === 'image' ? '' : clean(block.text)\n}\n\n/** A picture line as the library holds it; marks it taken, and missing where the library holds none. */\nfunction takePicture(scope: MapScope, ref: SiteImportLineRef | undefined, href?: string): AiLayoutPicture | null {\n if (ref === undefined || scope.used.has(ref)) return null\n const block = scope.doc.blocks[ref]\n if (!block || block.kind !== 'image') return null\n scope.used.add(ref)\n const photo = scope.photos.get(block.url)\n if (!photo) {\n scope.missing.add(ref)\n return null\n }\n const alt = clean(block.alt || photo.alt || '').slice(0, 200)\n const ratio = photo.width && photo.height ? photo.width / photo.height : 0\n const to = linkTo(scope, href)\n return { src: photo.src, alt, ...(ratio > 0 ? { ratio } : {}), ...(to ? { to } : {}) }\n}\n\n/** Words as text blocks, a paragraph longer than a text element holds split between its sentences. */\nfunction textBlocks(kind: 'text' | 'lede' | 'note', text: string): AiLayoutBlock[] {\n return aiSiteImportTextParts(text).map((part) => ({ kind, text: part }))\n}\n\n/** A link of the source: a button where its words fit one, a link in a list where they run longer, its words where it goes nowhere. */\nfunction linkBlocks(scope: MapScope, text: string, href: string, style: AiLayoutStyle): AiLayoutBlock[] {\n const to = linkTo(scope, href)\n if (text.length <= AI_SITE_IMPORT_LABEL_CHARS) return [{ kind: 'button', text, ...(to ? { to } : {}), style }]\n if (to) return [{ kind: 'list', items: [{ title: text, text: '', to }] }]\n return textBlocks('text', text)\n}\n\n/** One line in place, as the kind of block its source and its role say. */\nfunction lineBlocks(scope: MapScope, node: SiteImportLayoutLine): AiLayoutBlock[] {\n const block = scope.doc.blocks[node.line]\n if (!block || scope.used.has(node.line)) return []\n if (block.kind === 'image') {\n const picture = takePicture(scope, node.line)\n return picture ? [{ kind: 'image', picture }] : []\n }\n const text = take(scope, node.line)\n if (!text) return []\n switch (block.kind) {\n case 'heading':\n return [{ kind: 'heading', text }]\n case 'link':\n return linkBlocks(scope, text, block.href, node.button ?? 'quiet')\n case 'list-item':\n return [{ kind: 'list', items: [{ title: text, text: '' }] }]\n case 'quote':\n return [{ kind: 'quotes', style: 'quiet', items: [{ title: '', text }] }]\n default:\n if (node.role === 'eyebrow') return [{ kind: 'eyebrow', text }]\n return textBlocks(node.role === 'lede' ? 'lede' : node.role === 'note' ? 'note' : 'text', text)\n }\n}\n\n/** The icon a group item or a bullet carries, by its index into the page's icons. */\nfunction iconAt(scope: MapScope, index: number | undefined): string | undefined {\n return index === undefined ? undefined : (aiSiteImportIconPath(scope.layout.icons[index]) ?? undefined)\n}\n\n/** The style of a link inside an item: a plan's own button is filled outlined, any other a quiet link. */\nfunction itemLinkStyle(kind: SiteImportGroupKind): AiLayoutStyle {\n return kind === 'pricing' ? 'secondary' : 'quiet'\n}\n\n/** One item of a group, every line of it in exactly one of its parts. */\nfunction itemOf(scope: MapScope, group: SiteImportLayoutGroup, item: SiteImportLayoutItem): AiLayoutItem {\n const out: AiLayoutItem = { title: '', text: '' }\n const named = new Set<number>([\n ...(item.title !== undefined ? [item.title] : []),\n ...(item.figure !== undefined ? [item.figure] : []),\n ...(item.image !== undefined ? [item.image] : []),\n ...(item.text ?? []),\n ...(item.list ?? []),\n ...(item.link ?? []),\n ])\n const paragraphs: string[] = []\n const links: AiLayoutLink[] = []\n const addLink = (ref: number) => {\n const block = scope.doc.blocks[ref]\n const text = take(scope, ref)\n if (!text) return\n const to = block?.kind === 'link' ? linkTo(scope, block.href) : undefined\n if (text.length <= AI_SITE_IMPORT_LABEL_CHARS) links.push({ text, ...(to ? { to } : {}), style: itemLinkStyle(group.group) })\n else paragraphs.push(text)\n }\n // The item's lines in the source's order: each where its part says.\n for (const ref of item.lines) {\n if (scope.used.has(ref)) continue\n const block = scope.doc.blocks[ref]\n if (!block) continue\n if (ref === item.title) out.title = take(scope, ref)\n else if (ref === item.figure) out.figure = take(scope, ref)\n else if (ref === item.image || (block.kind === 'image' && !named.has(ref))) {\n const picture = takePicture(scope, ref)\n if (picture && !out.picture) out.picture = picture\n } else if (item.list?.includes(ref)) {\n const line = take(scope, ref)\n if (line) out.list = [...(out.list ?? []), line]\n } else if (item.link?.includes(ref) || (!named.has(ref) && block.kind === 'link')) addLink(ref)\n else {\n const line = take(scope, ref)\n if (line) paragraphs.push(...aiSiteImportTextParts(line))\n }\n }\n if (paragraphs.length) out.text = paragraphs[0]\n if (paragraphs.length > 1) out.more = paragraphs.slice(1)\n if (links.length) out.links = links\n const icon = iconAt(scope, item.icon)\n if (icon) out.iconPath = icon\n const mark = iconAt(scope, item.listIcon)\n if (mark && out.list?.length) out.listIconPath = mark\n const to = linkTo(scope, item.to)\n if (to) out.to = to\n return out\n}\n\n/** The style a group of cards is drawn in where its design answer chose none: the source's own box, icons or pictures. */\nfunction defaultStyle(group: SiteImportLayoutGroup, items: readonly AiLayoutItem[]): AiLayoutGroupStyle {\n const pictured = items.length > 0 && items.every((item) => item.picture)\n if (pictured) return group.boxed ? 'articles' : 'pictures'\n if (group.boxed) return 'cards'\n return items.length > 0 && items.every((item) => item.iconPath) ? 'icons' : 'ruled'\n}\n\n/** The style an answer chose, where the group can be drawn so: pictures need a picture on every item, icons an icon. */\nfunction styleFor(asked: AiLayoutGroupStyle | undefined, group: SiteImportLayoutGroup, items: readonly AiLayoutItem[]): AiLayoutGroupStyle {\n const fallback = defaultStyle(group, items)\n if (!asked || !(AI_LAYOUT_GROUP_STYLES as readonly string[]).includes(asked)) return fallback\n if ((asked === 'pictures' || asked === 'articles') && !items.every((item) => item.picture)) return fallback\n if (asked === 'icons' && !items.every((item) => item.iconPath)) return fallback\n return asked\n}\n\n/** A group of the source, in the layout language: every item of it, in the kind and style its answer chose or its source shows. */\nfunction groupBlocks(scope: MapScope, group: SiteImportLayoutGroup): AiLayoutBlock[] {\n const answer = scope.answer?.groups[scope.groupAt] ?? null\n scope.groupAt += 1\n const kind: SiteImportGroupKind = answer?.kind && OPEN_KINDS.has(group.group) ? answer.kind : group.group\n if (kind !== group.group) scope.settled.push({ at: scope.at, what: `a ${group.group} group drawn as ${kind}, as its design answer read it` })\n const columns = Math.max(1, Math.min(AI_LAYOUT_MAX_COLS, group.columns || 1))\n if (kind === 'text') {\n // Lines that only share a shape: each where it stands.\n return group.items.flatMap((item) => item.lines.flatMap((ref) => lineBlocks(scope, { kind: 'line', line: ref })))\n }\n if (kind === 'list') {\n const items = group.items.flatMap((item): AiLayoutItem[] => {\n const linked = item.lines.map((ref) => scope.doc.blocks[ref]).find((block) => block?.kind === 'link')\n const words = item.lines.map((ref) => take(scope, ref)).filter(Boolean).join(' ')\n for (const ref of item.lines) {\n if (scope.doc.blocks[ref]?.kind === 'image') takePicture(scope, ref)\n }\n if (!words) return []\n const icon = iconAt(scope, item.icon)\n const to = linkTo(scope, item.to ?? (linked?.kind === 'link' ? linked.href : undefined))\n return [{ title: words, text: '', ...(icon ? { iconPath: icon } : {}), ...(to ? { to } : {}) }]\n })\n return items.length ? [{ kind: 'list', items, columns }] : []\n }\n if (kind === 'logos') {\n const items = group.items.flatMap((item): AiLayoutItem[] => {\n let picture: AiLayoutPicture | null = null\n const words: string[] = []\n for (const ref of item.lines) {\n if (scope.doc.blocks[ref]?.kind === 'image') picture = picture ?? takePicture(scope, ref)\n else {\n const line = take(scope, ref)\n if (line) words.push(line)\n }\n }\n if (picture && !words.length) return [{ title: '', text: '', picture }]\n return words.length ? [{ title: words.join(' '), text: '', ...(picture ? { picture } : {}) }] : picture ? [{ title: '', text: '', picture }] : []\n })\n return items.length ? [{ kind: 'logos', items }] : []\n }\n const items = group.items.map((item) => itemOf(scope, group, item))\n if (kind === 'quotes') {\n // The reader names a quote's words its title and who said it its text.\n const quotes = items.map((item) => ({ ...item, title: [item.text, ...(item.more ?? [])].filter(Boolean).join(' '), text: item.title, more: [] as string[] }))\n return [{ kind: 'quotes', items: quotes.map(({ more: _more, ...item }) => item), columns, ...(group.boxed ? { variant: 'cards' as const } : { style: 'quiet' as const }) }]\n }\n if (kind === 'faq') return [{ kind: 'faq', items, columns }]\n if (kind === 'stats') return [{ kind: 'stats', items, columns, ...(group.boxed ? { variant: 'cards' as const } : {}) }]\n const style = styleFor(answer?.style, group, items)\n return [{ kind: kind === 'steps' ? 'steps' : 'cards', items, columns, variant: style }]\n}\n\n/** A section's nodes in the layout language, a row of columns placed by `col` where the section may still take one. */\nfunction nodeBlocks(scope: MapScope, nodes: readonly SiteImportLayoutNode[], row: { cols: number[] | null; allowed: boolean }): AiLayoutBlock[] {\n const out: AiLayoutBlock[] = []\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n out.push(...lineBlocks(scope, node))\n break\n case 'picture': {\n const picture = takePicture(scope, node.line, node.button ? undefined : node.href)\n if (picture) out.push({ kind: 'image', picture })\n break\n }\n case 'icon':\n // A lone icon is no word and no picture of the page.\n break\n case 'form':\n if (scope.formId && !scope.formPlaced) {\n scope.formPlaced = true\n out.push({ kind: 'form', to: scope.formId })\n }\n break\n case 'row': {\n const cells = node.cells.filter((cell) => cell.nodes.length)\n const byline = bylineOf(scope, cells)\n if (byline) {\n // A portrait beside a name and a date: the portrait small, over its words.\n out.push(...byline)\n break\n }\n if (row.allowed && !row.cols && cells.length >= 2 && cells.length <= AI_LAYOUT_MAX_COLS) {\n // The section's row: each cell a column, by the source's widths.\n const weights = node.cells.map((cell, index) => ({ cell, weight: node.cols[index] ?? 1 })).filter((entry) => entry.cell.nodes.length)\n row.cols = weights.map((entry) => Math.min(12, Math.max(1, Math.round(entry.weight))))\n weights.forEach((entry, col) => {\n for (const block of nodeBlocks(scope, entry.cell.nodes, { cols: null, allowed: false })) out.push({ ...block, col })\n })\n } else {\n // A second row of a section, or one inside a column: its cells one under another.\n for (const cell of node.cells) out.push(...nodeBlocks(scope, cell.nodes, { cols: null, allowed: false }))\n }\n break\n }\n case 'group':\n out.push(...groupBlocks(scope, node))\n break\n case 'table': {\n const rows = node.rows.map((tableRow) => ({ cells: tableRow.cells.map((cell) => cell.lines.map((ref) => take(scope, ref)).filter(Boolean).join(' ')) }))\n if (rows.some((tableRow) => tableRow.cells.some(Boolean))) out.push({ kind: 'table', header: node.header, rows })\n break\n }\n case 'tabs': {\n const tabs = node.tabs.map((tab) => {\n const label = tab.label === null ? '' : take(scope, tab.label)\n // A panel sets its first row side by side, as a section does (AGL-4114).\n const panelRow = { cols: null as number[] | null, allowed: true }\n const blocks = mergeLists(nodeBlocks(scope, tab.panel, panelRow))\n return {\n label,\n ...(tab.selected ? { selected: true } : {}),\n blocks,\n ...(panelRow.cols && blocks.some((block) => block.col !== undefined) ? { cols: panelRow.cols } : {}),\n }\n })\n if (tabs.some((tab) => tab.label || tab.blocks.length)) out.push({ kind: 'tabs', tabs })\n break\n }\n default:\n break\n }\n }\n return out\n}\n\n/** The most words beside a lone picture that make a row a byline: a name, a date, a role. */\nconst BYLINE_MAX_WORDS = 12\n\n/**\n * A row that is a byline (AGL-4107): one cell a lone picture, the other a few\n * words — a writer's portrait beside their name and date. Drawn as columns it\n * set a portrait across half the page; it is the portrait, small, and its words.\n */\nfunction bylineOf(scope: MapScope, cells: ReadonlyArray<{ nodes: SiteImportLayoutNode[] }>): AiLayoutBlock[] | null {\n if (cells.length !== 2) return null\n const at = cells.findIndex((cell) => cell.nodes.length === 1 && cell.nodes[0].kind === 'picture')\n if (at === -1) return null\n const words = cells[1 - at].nodes\n if (!words.every((node) => node.kind === 'line')) return null\n const count = words.reduce((total, node) => {\n const block = scope.doc.blocks[(node as SiteImportLayoutLine).line]\n return total + (block && block.kind !== 'image' ? aiSiteImportWordsIn(clean(block.text)) : 0)\n }, 0)\n if (count === 0 || count > BYLINE_MAX_WORDS) return null\n const node = cells[at].nodes[0] as Extract<SiteImportLayoutNode, { kind: 'picture' }>\n const picture = takePicture(scope, node.line, node.button ? undefined : node.href)\n return [...(picture ? [{ kind: 'image' as const, picture: { ...picture, small: true } }] : []), ...nodeBlocks(scope, words, { cols: null, allowed: false })]\n}\n\n/** Paragraphs past which a section is reading copy, set at the start whatever its source centers. */\nconst READING_PARAGRAPHS = 4\n\n/** Neighboring one-line lists of one column as one list, as the source's list items read. */\nfunction mergeLists(blocks: readonly AiLayoutBlock[]): AiLayoutBlock[] {\n const out: AiLayoutBlock[] = []\n for (const block of blocks) {\n const last = out[out.length - 1]\n const plain = (entry: AiLayoutBlock | undefined) => entry?.kind === 'list' && entry.columns === undefined && !entry.items?.some((item) => item.iconPath)\n if (plain(block) && plain(last) && last?.col === block.col) {\n out[out.length - 1] = { ...last, items: [...(last.items ?? []), ...(block.items ?? [])] }\n continue\n }\n out.push(block)\n }\n return out\n}\n\n/** The hero a section's opening takes: the first section's, around its picture beside, behind or under its words. */\nfunction heroOf(section: SiteImportLayoutSection, index: number, answer: AiLayoutDesignSection | null): AiLayoutImportHero | undefined {\n if (index !== 0 || !section.hero?.picture) return undefined\n // An answer of \"none\" keeps the opening as the source lays it out.\n if (answer?.hero === 'none') return undefined\n return answer?.hero ?? HERO_FOR[section.hero.picture]\n}\n\nexport interface AiSiteImportDesigned {\n sections: AiLayoutSection[]\n /** Lines taken into a block, by index of the page's blocks. */\n used: Set<number>\n /** Pictures the library could not hold. */\n missing: Set<number>\n settled: AiLayoutSettlement[]\n}\n\n/**\n * The page's sections in the layout language (AGL-4107): the source's layout,\n * each section in its own band (or the answer's, where the source gave none),\n * its row, its groups and their items, its tables, tabs and pictures, every\n * line taken exactly once and every line the layout placed nowhere added at\n * its section's end.\n */\nexport function aiSiteImportDesignedSections(\n doc: AiSiteImportDocument,\n answer?: AiLayoutDesignAnswer | null,\n options: { formId?: string | null } = {},\n): AiSiteImportDesigned {\n const layout = aiSiteImportLayoutOf(doc)\n const scope: MapScope = {\n doc,\n layout,\n used: new Set(),\n missing: new Set(),\n photos: new Map(doc.photos.flatMap((photo) => (photo.from ? [[photo.from, photo] as const] : []))),\n pathTo: new Map(doc.links.map((link) => [link.path.replace(/\\/+$/, '') || '/', link.id])),\n formId: options.formId ?? null,\n formPlaced: false,\n answer: null,\n groupAt: 0,\n settled: [],\n at: '',\n }\n const sections = layout.sections.map((section, index): AiLayoutSection => {\n const given = answer?.sections[index] ?? null\n scope.answer = given\n scope.groupAt = 0\n scope.at = `sections[${index}]`\n const row = { cols: null as number[] | null, allowed: true }\n const blocks = nodeBlocks(scope, section.nodes, row)\n // Every line the layout placed nowhere, at the section's end, as its kind says.\n for (const ref of section.lines) {\n if (scope.used.has(ref)) continue\n const block = doc.blocks[ref]\n if (!isLine(block)) continue\n blocks.push(...lineBlocks(scope, { kind: 'line', line: ref }))\n }\n const hero = heroOf(section, index, given)\n // A band only where the source gave the section none of its own.\n const band = section.background === null && !section.backdrop && given?.band ? given.band : section.band\n // A long read is set at the start, as text is read, whatever its source centers.\n const reading = blocks.filter((block) => block.kind === 'text').length > READING_PARAGRAPHS\n return {\n band,\n align: given?.align ?? (reading ? 'start' : section.align),\n ...(row.cols && blocks.some((block) => block.col !== undefined) ? { cols: row.cols } : {}),\n blocks: mergeLists(blocks),\n ...(hero ? { hero } : {}),\n }\n })\n return { sections, used: scope.used, missing: scope.missing, settled: scope.settled }\n}\n\n/*------------------------------------------\n * The page compiled\n *-----------------------------------------*/\n\nexport interface AiSiteImportCompileInput {\n doc: AiSiteImportDocument\n /** The ids the page stores its sections under, in plan order: one for each of the page's sections. */\n sectionIds: readonly string[]\n /** The page's plan: its title and its sections by name. */\n plan: AiLayoutPagePlan\n targets: AiLayoutTargets\n /** The site the page belongs to, which its hero is drawn for. */\n design?: AiLayoutDesign | null\n language?: string\n /** The page's design answer, for a main page; absent, the page is drawn as its source lays it out. */\n answer?: AiLayoutDesignAnswer | null\n}\n\nexport interface AiSiteImportCompiled extends Pick<AiLayoutCompiledPage, 'tree' | 'sectionRoots'> {\n sections: AiLayoutSection[]\n /** The lines on the page, by index of its blocks, in source order. */\n placed: number[]\n /** Every line the page has. */\n lines: number\n /** The words on the page, and the words its lines hold. */\n words: number\n sourceWords: number\n /** Set when the page ran past what one page may weigh, and its last sections keep only their names. */\n cut: boolean\n settled: AiLayoutSettlement[]\n}\n\n/**\n * The page brought in, built by the site compiler (AGL-4107): every line on\n * it exactly once, every word as its source wrote it, laid out as its source\n * lays it out and drawn in the site's own theme.\n */\nexport function aiCompileImportedPage(input: AiSiteImportCompileInput): AiSiteImportCompiled {\n const { doc } = input\n const formId = input.targets.forms.length === 1 ? input.targets.forms[0].id : null\n const designed = aiSiteImportDesignedSections(doc, input.answer ?? null, { formId })\n const compile = (sections: readonly AiLayoutSection[]) =>\n aiCompileLayoutPage(sections, input.plan, input.targets, {\n // A page brought in draws its repeats as its source does (AGL-4107).\n reusableComponents: false,\n sectionIds: input.sectionIds,\n verbatim: true,\n ...(input.design ? { design: input.design } : {}),\n ...(input.language ? { language: input.language } : {}),\n })\n let sections = designed.sections\n let compiled = compile(sections)\n let cut = false\n // A page past what one page may weigh keeps its last sections by name.\n for (let last = sections.length - 1; Object.keys(compiled.tree.nodes).length > AI_SITE_IMPORT_DOC_MAX_NODES && last > 0; last -= 1) {\n cut = true\n sections = sections.map((section, index) => (index >= last ? { ...section, blocks: [], cols: undefined } : section))\n compiled = compile(sections)\n }\n const dropped = new Set<number>()\n if (cut) {\n const layout = aiSiteImportLayoutOf(doc)\n layout.sections.forEach((section, index) => {\n if (!sections[index]?.blocks.length) for (const ref of section.lines) dropped.add(ref)\n })\n }\n const lineRefs = doc.blocks.flatMap((block, index) => (isLine(block) ? [index] : []))\n const placed = lineRefs.filter((ref) => designed.used.has(ref) && !designed.missing.has(ref) && !dropped.has(ref))\n const wordsOf = (ref: number) => {\n const block = doc.blocks[ref]\n return block && block.kind !== 'image' ? aiSiteImportWordsIn(clean(block.text)) : 0\n }\n return {\n tree: compiled.tree,\n sectionRoots: compiled.sectionRoots,\n sections,\n placed,\n lines: lineRefs.length,\n words: placed.reduce((total, ref) => total + wordsOf(ref), 0),\n sourceWords: lineRefs.reduce((total, ref) => total + wordsOf(ref), 0),\n cut,\n settled: [...designed.settled, ...compiled.settled],\n }\n}\n\n/*------------------------------------------\n * What the design answer is shown\n *-----------------------------------------*/\n\n/** The most characters of a page's structure a design prompt shows. */\nexport const AI_SITE_IMPORT_DESIGN_MAX_CHARS = 12_000\n\n/** What a line is, as the design answer reads its place. */\nfunction lineKind(block: SiteImportBlock | undefined, node: SiteImportLayoutLine): string {\n if (!block) return 'line'\n if (block.kind === 'heading') return 'heading'\n if (block.kind === 'link') return node.button ? `${node.button === 'primary' ? 'filled' : node.button === 'secondary' ? 'outlined' : 'quiet'} button` : 'link'\n if (block.kind === 'list-item') return 'list item'\n if (block.kind === 'quote') return 'quote'\n if (block.kind === 'image') return 'picture'\n return node.role ?? 'text'\n}\n\n/** What an item of a group shows, as one phrase: \"icon + title + text + link\". */\nfunction itemShape(item: SiteImportLayoutItem): string[] {\n return [\n item.image !== undefined ? 'picture' : '',\n item.icon !== undefined ? 'icon' : '',\n item.figure !== undefined ? 'figure' : '',\n item.title !== undefined ? 'title' : '',\n item.text?.length ? 'text' : '',\n item.list?.length ? `${item.listIcon !== undefined ? 'checked ' : ''}list` : '',\n item.link?.length ? 'link' : '',\n ].filter(Boolean)\n}\n\n/** A run of one kind of part counted: \"2 buttons\", not \"button, button\". */\nfunction counted(parts: readonly string[]): string {\n const out: string[] = []\n for (let at = 0; at < parts.length; ) {\n let run = 1\n while (parts[at + run] === parts[at]) run += 1\n out.push(run > 1 ? `${run} ${parts[at]}s` : parts[at])\n at += run\n }\n return out.join(', ')\n}\n\n/** A section's nodes as the design answer reads them, its groups numbered in order. */\nfunction describeNodes(doc: Pick<AiSiteImportDocument, 'blocks'>, nodes: readonly SiteImportLayoutNode[], groups: { count: number }): string[] {\n const parts: string[] = []\n for (const node of nodes) {\n switch (node.kind) {\n case 'line':\n parts.push(lineKind(doc.blocks[node.line], node))\n break\n case 'picture':\n parts.push('picture')\n break\n case 'form':\n parts.push('form')\n break\n case 'row':\n parts.push(`a row of ${node.cells.length} columns (${node.cells.map((cell, index) => `column ${index + 1}: ${describeNodes(doc, cell.nodes, groups).join(', ') || 'empty'}`).join('; ')})`)\n break\n case 'group': {\n groups.count += 1\n const shape = [...new Set(node.items.map((item) => itemShape(item).join(' + ')).filter(Boolean))].slice(0, 2).join(' or ')\n parts.push(`group ${groups.count}: ${node.items.length} ${node.group} in ${node.columns} column${node.columns === 1 ? '' : 's'}${node.boxed ? ', boxed' : ''}${shape ? `, each ${shape}` : ''}`)\n break\n }\n case 'table':\n parts.push(`a table of ${node.rows.length} rows`)\n break\n case 'tabs':\n parts.push(`${node.tabs.length} tabs (${node.tabs.map((tab, index) => `tab ${index + 1}: ${describeNodes(doc, tab.panel, groups).join(', ') || 'not drawn'}`).join('; ')})`)\n break\n default:\n break\n }\n }\n return parts\n}\n\n/**\n * The page's structure as its design answer reads it (AGL-4107): each\n * section's name, band, alignment and what it shows, its groups numbered as\n * the answer names them. No word of the page is in it but its sections'\n * names, which are fenced where the prompt shows them.\n */\nexport function aiSiteImportDesignText(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>): string {\n const layout = aiSiteImportLayoutOf(doc)\n const names = aiSiteImportSectionNames(doc)\n return layout.sections\n .map((section, index) => {\n const groups = { count: 0 }\n const shows = describeNodes(doc, section.nodes, groups)\n const band = section.background === null && !section.backdrop ? 'no band of its own' : `${section.band} band${section.backdrop?.kind === 'gradient' ? ' with a gradient' : ''}`\n const hero = index === 0 && section.hero?.picture ? `; opens the page, its picture ${section.hero.picture} its words` : index === 0 ? '; opens the page, with no picture' : ''\n return `Section ${index + 1} \"${names[index]}\": ${band}, ${section.align === 'center' ? 'centered' : 'aligned to the start'}${hero}. Groups: ${groups.count}. Shows: ${counted(shows)}.`\n })\n .join('\\n')\n}\n"],"names":["aiCompileLayoutPage","AI_LAYOUT_GROUP_STYLES","AI_LAYOUT_MAX_COLS","AI_SITE_IMPORT_LABEL_MAX_CHARS","aiModelAtLeastStepTier","AI_SITE_IMPORT_DOC_MAX_NODES","AI_SITE_IMPORT_LABEL_CHARS","aiSiteImportDocLines","aiSiteImportTextParts","aiSiteImportWordsIn","clean","text","replace","trim","isLine","block","kind","url","inline","aiImportPageModel","modelFor","aiSiteImportLinkablePages","doc","seen","Set","links","flatMap","link","has","id","add","path","label","slug","aiImportedPageListing","screen","written","title","seoTitle","description","seoDescription","aiImportedPageListingOwed","listing","aiSiteImportLayoutOfLines","lines","sections","blocks","refOf","forEach","index","push","v","map","section","refs","n","filter","ref","undefined","name","from","band","background","align","nodes","line","icons","look","fonts","body","headings","google","buttonFill","buttonText","buttonRadius","header","aiSiteImportLayoutOf","layout","length","aiSiteImportSectionNames","named","names","slice","unique","attempt","toLowerCase","PATH_PARAMS","m","l","h","c","s","q","t","a","z","NUMBER","FLAG","round","value","fixed","Math","Object","is","String","aiSiteImportPathOn24","d","viewBox","box","split","Number","some","isFinite","minX","minY","width","height","scale","max","dx","dy","identity","abs","out","at","first","source","test","command","lower","count","relative","groups","group","pattern","lastIndex","match","exec","parts","absolute","x","y","position","part","join","shapeAttributes","matchAll","num","NaN","parseFloat","shapePath","tag","attributes","cx","cy","rx","ry","every","points","aiSiteImportIconPath","shape","svg","paths","OPEN_KINDS","HERO_FOR","beside","behind","below","above","linkTo","scope","href","URL","protocol","origins","includes","origin","pathname","pathTo","get","toString","take","used","takePicture","photo","photos","missing","alt","ratio","to","src","textBlocks","linkBlocks","style","items","lineBlocks","node","picture","button","role","iconAt","itemLinkStyle","itemOf","item","figure","image","list","paragraphs","addLink","more","icon","iconPath","mark","listIcon","listIconPath","defaultStyle","pictured","boxed","styleFor","asked","fallback","groupBlocks","answer","groupAt","settled","what","columns","min","linked","find","words","Boolean","quotes","_more","variant","nodeBlocks","row","formId","formPlaced","cells","cell","byline","bylineOf","allowed","cols","weights","weight","entry","col","rows","tableRow","tabs","tab","panelRow","mergeLists","panel","selected","BYLINE_MAX_WORDS","findIndex","reduce","total","small","READING_PARAGRAPHS","last","plain","heroOf","hero","aiSiteImportDesignedSections","options","Map","given","backdrop","reading","aiCompileImportedPage","input","targets","forms","designed","compile","plan","reusableComponents","sectionIds","verbatim","design","language","compiled","cut","keys","tree","dropped","lineRefs","placed","wordsOf","sectionRoots","sourceWords","AI_SITE_IMPORT_DESIGN_MAX_CHARS","lineKind","itemShape","counted","run","describeNodes","aiSiteImportDesignText","shows"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA6B2C,GAE3C,SACEA,mBAAmB,QAGd,2CAAuC;AAE9C,SACEC,sBAAsB,EAEtBC,kBAAkB,QAYb,2CAAuC;AAE9C,SACEC,8BAA8B,QAYzB,6BAAyB;AAChC,SAASC,sBAAsB,QAAQ,0BAAsB;AAE7D,SACEC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,oBAAoB,EACpBC,qBAAqB,EACrBC,mBAAmB,QAEd,+BAA2B;AAElC,MAAMC,QAAQ,CAACC,OAA2B,OAAOA,SAAS,WAAWA,KAAKC,OAAO,CAAC,QAAQ,KAAKC,IAAI,KAAK;AAExG,wFAAwF,GACxF,SAASC,OAAOC,KAAkC;IAChD,IAAI,CAACA,OAAO,OAAO;IACnB,IAAIA,MAAMC,IAAI,KAAK,SAAS,OAAO,CAAC,CAACD,MAAME,GAAG;IAC9C,IAAIF,MAAMC,IAAI,KAAK,QAAQ,OAAO,CAACD,MAAMG,MAAM,IAAI,CAAC,CAACR,MAAMK,MAAMJ,IAAI;IACrE,OAAO,CAAC,CAACD,MAAMK,MAAMJ,IAAI;AAC3B;AAEA;;2CAE2C,GAE3C;;;;CAIC,GACD,OAAO,SAASQ,kBAAkBC,QAAmD;IACnF,OAAOhB,uBAAuB,YAAYgB,4BAAAA,SAAW;AACvD;AAEA;;;;CAIC,GACD,OAAO,SAASC,0BAA0BC,GAA+C;IACvF,IAAI,CAACA,KAAK,OAAO,EAAE;IACnB,MAAMC,OAAO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,sCAAsC;QAC5K,OAAO,CAAC,QAAQ,EAAEA,QAAQ,EAAE,EAAE,EAAEgC,KAAK,CAAChC,MAAM,CAAC,GAAG,EAAEY,KAAK,EAAE,EAAER,QAAQU,KAAK,KAAK,WAAW,aAAa,yBAAyB2M,KAAK,UAAU,EAAEtI,OAAOF,KAAK,CAAC,SAAS,EAAEwK,QAAQI,OAAO,CAAC,CAAC;IAC1L,GACC9J,IAAI,CAAC;AACV"}
|
|
@@ -3846,7 +3846,7 @@ function listingSection(scope, blocks, placed) {
|
|
|
3846
3846
|
const given = ((_block_tabs = block.tabs) != null ? _block_tabs : []).filter((tab)=>aiLayoutAsWritten(tab.label) || tab.blocks.length);
|
|
3847
3847
|
if (!given.length) return null;
|
|
3848
3848
|
const labels = given.map((tab)=>tabLabel(tab.label));
|
|
3849
|
-
const panels = given.map((tab)=>tab.blocks.length ?
|
|
3849
|
+
const panels = given.map((tab)=>tab.blocks.length ? tabPanel(scope, tab, room) : null);
|
|
3850
3850
|
const whole = given.length >= 2 && given.length <= 8 && labels.every((label)=>!!label) && new Set(labels.map((label)=>label.toLowerCase())).size === labels.length && panels.every(Boolean);
|
|
3851
3851
|
if (whole) {
|
|
3852
3852
|
const open = given.findIndex((tab)=>tab.selected);
|
|
@@ -3898,6 +3898,44 @@ function listingSection(scope, blocks, placed) {
|
|
|
3898
3898
|
spacing: '4'
|
|
3899
3899
|
}, null, parts, 'tabs');
|
|
3900
3900
|
}
|
|
3901
|
+
/**
|
|
3902
|
+
* A tab's panel of a page brought in: its blocks top to bottom, and the row
|
|
3903
|
+
* of columns the source sets in it side by side (AGL-4114), as a section
|
|
3904
|
+
* sets its row — the blocks above the row, its columns, the blocks below.
|
|
3905
|
+
*/ function tabPanel(scope, tab, room) {
|
|
3906
|
+
var _parts_;
|
|
3907
|
+
const cols = tab.cols && tab.cols.length >= 2 && room !== 'narrow' ? tab.cols : null;
|
|
3908
|
+
if (!cols || !tab.blocks.some((block)=>block.col !== undefined)) return compileFlow(scope, tab.blocks, room);
|
|
3909
|
+
const head = [];
|
|
3910
|
+
const tail = [];
|
|
3911
|
+
const columns = cols.map(()=>[]);
|
|
3912
|
+
for (const block of tab.blocks){
|
|
3913
|
+
if (block.col !== undefined) {
|
|
3914
|
+
var _columns_Math_min;
|
|
3915
|
+
const { col } = block, placed = _object_without_properties_loose(block, [
|
|
3916
|
+
"col"
|
|
3917
|
+
]);
|
|
3918
|
+
(_columns_Math_min = columns[Math.min(col, cols.length - 1)]) == null ? void 0 : _columns_Math_min.push(placed);
|
|
3919
|
+
} else if (columns.some((column)=>column.length)) tail.push(block);
|
|
3920
|
+
else head.push(block);
|
|
3921
|
+
}
|
|
3922
|
+
const filled = columns.map((column, position)=>{
|
|
3923
|
+
var _cols_position;
|
|
3924
|
+
return {
|
|
3925
|
+
column,
|
|
3926
|
+
weight: (_cols_position = cols[position]) != null ? _cols_position : 1
|
|
3927
|
+
};
|
|
3928
|
+
}).filter((entry)=>entry.column.length);
|
|
3929
|
+
const parts = [
|
|
3930
|
+
head.length ? compileFlow(scope, head, room) : null,
|
|
3931
|
+
filled.length >= 2 ? compileRow(scope, filled, 'flex-start') : compileFlow(scope, filled.flatMap((entry)=>entry.column), room),
|
|
3932
|
+
tail.length ? compileFlow(scope, tail, room) : null
|
|
3933
|
+
].filter((id)=>!!id);
|
|
3934
|
+
if (parts.length <= 1) return (_parts_ = parts[0]) != null ? _parts_ : null;
|
|
3935
|
+
return scope.page.tree.add('muiStack', {
|
|
3936
|
+
spacing: '3'
|
|
3937
|
+
}, null, parts, 'panel');
|
|
3938
|
+
}
|
|
3901
3939
|
/** A short line on an outlined surface of the theme's own shape: a label, a tag, a tab the source draws as one. */ function chip(scope, words, role) {
|
|
3902
3940
|
const tree = scope.page.tree;
|
|
3903
3941
|
return tree.add('muiPaper', {
|