@aglyn/plugins-ai 1.15.2 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-plan.component.js +1 -1
  3. package/src/lib/components/ai-site-import-plan.component.js.map +1 -1
  4. package/src/lib/jobs/ai-job-import-step.js +6 -4
  5. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  6. package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
  7. package/src/lib/jobs/ai-job-page-language.js +29 -14
  8. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  9. package/src/lib/jobs/ai-job-page-step.js +3 -1
  10. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  11. package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
  12. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  13. package/src/lib/jobs/ai-site-import-compile.d.ts +9 -1
  14. package/src/lib/jobs/ai-site-import-compile.js +67 -1
  15. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  16. package/src/lib/jobs/ai-site-import-honesty.d.ts +6 -2
  17. package/src/lib/jobs/ai-site-import-honesty.js +5 -5
  18. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
  19. package/src/lib/jobs/ai-site-import-improve.d.ts +61 -2
  20. package/src/lib/jobs/ai-site-import-improve.js +184 -19
  21. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  22. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -1
  23. package/src/lib/layout-language/ai-layout-compiler.js +27 -9
  24. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  25. package/src/lib/model/ai-site-import-fidelity.d.ts +18 -2
  26. package/src/lib/model/ai-site-import-fidelity.js +35 -11
  27. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  28. package/src/lib/model/ai-site-import-view.js +6 -1
  29. package/src/lib/model/ai-site-import-view.js.map +1 -1
  30. package/src/lib/model/ai-site-import.d.ts +8 -1
  31. package/src/lib/model/ai-site-import.js +12 -4
  32. package/src/lib/model/ai-site-import.js.map +1 -1
  33. package/src/lib/runtime/ai-palette.generated.js +36 -5
  34. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
@@ -456,12 +456,17 @@ const BUILD_COPY = {
456
456
  label: group.label,
457
457
  pages: group.pages.map(name).filter(Boolean)
458
458
  })).filter((group)=>group.pages.length);
459
+ // A menu entry of one page is a link to it under the entry's label, as the header draws it, never a menu of one (AGL-4152).
460
+ const menu = named(plan.nav.groups).map((group)=>group.pages.length === 1 ? {
461
+ label: group.label,
462
+ pages: []
463
+ } : group);
459
464
  const cta = plan.nav.primaryCta;
460
465
  const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (_cta_page = cta.page) != null ? _cta_page : '' : cta.target);
461
466
  return {
462
467
  what: plan.site.what,
463
468
  audience: plan.site.audience,
464
- menu: named(plan.nav.groups),
469
+ menu,
465
470
  cta: cta && where ? `${cta.label} → ${where}` : null,
466
471
  footer: named(plan.nav.footer),
467
472
  proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport { aiMediaCreditsPerPicture } from './ai-media-credits'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE,\n AI_SITE_IMPORT_LAYOUT_KEPT,\n AI_SITE_IMPORT_PLAN_FELL_BACK,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportGeneratedPicturesOn,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportPlanAccepted,\n aiSiteImportPlanAwaits,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveIsGenerative,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n * Under a generative Improve it: \"Redesigned by Aglyn AI · 2 new sections\",\n * or \"Layout kept: the redesign did not pass\".\n */\n build: string | null\n /** \"New: Why us, FAQ (4)\": the sections a redesign added (AGL-4152). */\n added?: string | null\n /** \"1 stock photo, 1 generated picture\": the pictures a redesign took beside its own (AGL-4152). */\n pictures?: string | null\n /** A page the site's plan proposed (AGL-4152): it has no old page to open. */\n isNew?: boolean\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page redesigned from its ledger (AGL-4152). */\n redesigned: `Redesigned by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice, generative = false): string | null {\n if (!page.build) return null\n // A redesign that did not pass (AGL-4152): today's compile drew the page.\n if (page.redesign === 'layout-kept') return AI_SITE_IMPORT_LAYOUT_KEPT\n if (page.redesign === 'redesigned') {\n const added = page.added?.length ?? 0\n return added ? `${BUILD_COPY.redesigned} · ${added} new ${added === 1 ? 'section' : 'sections'}` : BUILD_COPY.redesigned\n }\n if (generative && page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.redesigned\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** \"New: Why us, FAQ (4)\": the sections a redesign added, as its row says (AGL-4152). */\nexport function aiSiteImportAddedText(page: Pick<AiSiteImportPage, 'added'>): string | null {\n const added = page.added ?? []\n return added.length ? `New: ${added.map((section) => (section.items ? `${section.heading} (${section.items})` : section.heading)).join(', ')}` : null\n}\n\n/** \"1 stock photo, 1 generated picture\": what a redesign's pictures came from beside the page's own (AGL-4152). */\nexport function aiSiteImportPicturesText(page: Pick<AiSiteImportPage, 'pictures'>): string | null {\n const pictures = page.pictures\n if (!pictures) return null\n const parts = [\n pictures.stock ? `${pictures.stock} stock ${pictures.stock === 1 ? 'photo' : 'photos'}` : '',\n pictures.generated ? `${pictures.generated} generated ${pictures.generated === 1 ? 'picture' : 'pictures'}` : '',\n pictures.unplaced.length ? `${pictures.unplaced.length} of your photos not placed` : '',\n ].filter(Boolean)\n return parts.length ? parts.join(', ') : null\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n const generative = aiSiteImportWaveIsGenerative(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n // What a generative Improve it says of a page beside its build (AGL-4152).\n ...(aiSiteImportAddedText(page) ? { added: aiSiteImportAddedText(page) } : {}),\n ...(aiSiteImportPicturesText(page) ? { pictures: aiSiteImportPicturesText(page) } : {}),\n ...(page.origin === 'proposed' ? { isNew: true } : {}),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought && page.origin !== 'proposed'\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice, generative),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null), aiSiteImportWaveIsGenerative(state, wave) ? { generative: true } : {})\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/**\n * The same choice under a generative Improve it (AGL-4152): the improve option's\n * and the switch's words; everything else stands. Only drawn under the flag.\n */\nexport const AI_SITE_IMPORT_FINISH_COPY_GENERATIVE = {\n ...AI_SITE_IMPORT_FINISH_COPY,\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI plans your menu and footer, and redesigns each page with your pictures and forms, in a theme built around your brand. It shows you the plan before anything is built.`,\n },\n wording: {\n label: 'Also write new copy',\n description: `${PLATFORM_BRAND_NAME} AI writes new headings, paragraphs and sections for your main pages from what your site says. It never makes up a name, number, price, date, testimonial, client, award, credential, address or guarantee. Off, every word stays as you wrote it, and your layout and menu are still redesigned.`,\n },\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\"; under a generative Improve it, \"Improve it, with new copy\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (!choice.wording) return AI_SITE_IMPORT_FINISH_COPY.improve.label\n return options.generative ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, with new copy` : `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording`\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\"; under a generative Improve it, \"Redesigned\" or \"Redesigned, new copy\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (options.generative) return choice.wording ? 'Redesigned, new copy' : 'Redesigned'\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave), wave.generative ? { generative: true } : {})}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n if (options.generative && choice.wording) return `${PLATFORM_BRAND_NAME} AI redesigns each page and writes new copy from what your site says, making up no name, number, price or date. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n options: { generative?: boolean } = {},\n): string {\n // Under a generative Improve it (AGL-4152) new copy is quoted as the redesign it is, before the read and on the job's page alike.\n const generative = scope?.job.siteImport ? aiSiteImportWaveIsGenerative(scope.job.siteImport, scope.wave) : options.generative === true\n const how = generative ? { generative: true } : {}\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1, how).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages, how).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n\n/*------------------------------------------\n * Your new site (AGL-4152)\n *-----------------------------------------*/\n\n/** The \"Your new site\" panel's words: what the site is, its menu, its main button, its footer, and what its owner may switch. */\nexport interface AiSiteImportPlanView {\n what: string\n audience: string\n /** Each menu entry: its label and the pages under it; one page is a plain link. */\n menu: Array<{ label: string; pages: string[] }>\n /** \"Book a visit → Contact\". */\n cta: string | null\n footer: Array<{ label: string; pages: string[] }>\n /** The page it proposes, whether it was kept or switched off. */\n proposed: { title: string; purpose: string; address: string } | null\n /** Whether the owner still decides: the plan waits on them. */\n editable: boolean\n}\n\n/** The panel's fixed words, one place for its specs and its screen. */\nexport const AI_SITE_IMPORT_PLAN_COPY_TEXT = {\n heading: 'Your new site',\n menu: 'Menu',\n cta: 'Main button',\n footer: 'Footer',\n addPage: 'Add this new page',\n addPageHelp: 'One new page, written from what your site says. It counts toward your plan’s page limit.',\n pictures: 'Create pictures with AI where needed',\n build: 'Build my new site',\n whatsNew: 'What’s new',\n} as const\n\n/** The panel as a plan reads, or `null` with none: every import the flag is off for, and every plan that did not pass. */\nexport function aiSiteImportPlanViewOf(state: AiSiteImportState | null | undefined): AiSiteImportPlanView | null {\n const plan = state?.plan\n if (!state || !plan) return null\n const name = (id: string) => (plan.proposed?.draftId === id ? plan.proposed.title : (state.pages.find((page) => page.draftId === id)?.title ?? ''))\n const named = (groups: ReadonlyArray<{ label: string; pages: string[] }>) => groups.map((group) => ({ label: group.label, pages: group.pages.map(name).filter(Boolean) })).filter((group) => group.pages.length)\n const cta = plan.nav.primaryCta\n const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (cta.page ?? '') : cta.target)\n return {\n what: plan.site.what,\n audience: plan.site.audience,\n menu: named(plan.nav.groups),\n cta: cta && where ? `${cta.label} → ${where}` : null,\n footer: named(plan.nav.footer),\n proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? { title: plan.proposed.title, purpose: plan.proposed.purpose, address: `/${plan.proposed.slug}` } : null,\n editable: aiSiteImportPlanAwaits(state),\n }\n}\n\n/** What the plan that did not pass says, or `null`: a plan that passed, and every import with none asked. */\nexport function aiSiteImportPlanFellBackText(state: Pick<AiSiteImportState, 'plan'> | null | undefined): string | null {\n return state?.plan === null ? AI_SITE_IMPORT_PLAN_FELL_BACK : null\n}\n\n/** The credits a generated picture is quoted at, on a paid plan: an import is one. */\nexport const aiSiteImportPictureCredits = (): number => aiMediaCreditsPerPicture('photo', undefined, '1K')\n\n/** What the generated pictures switch says it adds: how many at most, and what each costs, before it is on. */\nexport function aiSiteImportPicturesSwitchText(state: AiSiteImportState): string {\n const pages = state.pages.filter((page) => page.wording === 'improved' && !page.refused).length\n const each = aiSiteImportPictureCredits()\n const most = pages * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE\n return `Only where your own photos and the stock library have nothing that fits: a page’s opening picture or a section’s lead, up to ${AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE} a page. About ${each.toLocaleString('en-US')} AI credits each${most ? `, so at most ${(most * each).toLocaleString('en-US')} for this wave` : ''}. A picture that is not made costs nothing.`\n}\n\n/** Whether generated pictures are switched on now, for the panel's first draw. */\nexport function aiSiteImportPlanFieldOf(state: AiSiteImportState | null | undefined): { addPage: boolean; pictures: boolean } {\n return { addPage: state?.plan?.proposed?.on !== false, pictures: aiSiteImportGeneratedPicturesOn(state) }\n}\n\n/** Whether a plan's generated pictures switch means anything: only pages with new copy ask for a picture. */\nexport function aiSiteImportPlanTakesPictures(state: Pick<AiSiteImportState, 'pages'>): boolean {\n return state.pages.some((page) => page.wording === 'improved' && !page.refused)\n}\n\n/** The wave's quote as the plan's switches stand now (AGL-4152), before they are saved: with or without its new page, and its pictures. */\nexport function aiSiteImportPlanQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, field: { addPage: boolean; pictures: boolean }): string | null {\n const state = job.siteImport ?? null\n const plan = state?.plan\n if (!state || !plan) return null\n const asked: AiSiteImportState = { ...state, generatedPictures: field.pictures, plan: { ...plan, proposed: plan.proposed ? { ...plan.proposed, on: field.addPage } : null } }\n const next = aiSiteImportPlanAccepted(asked, job.items ?? [])\n const wave = aiSiteImportRunningWave(next.state)\n return wave ? aiSiteImportWaveQuote({ items: next.items, siteImport: next.state }, wave) : null\n}\n\n/** One page's lines of a wave's \"What's new\" (AGL-4152): its new sections, and its pictures. */\nexport interface AiSiteImportWhatsNewLine {\n page: string\n lines: string[]\n}\n\n/** A wave's \"What's new\" (AGL-4152): what its redesigns added, page by page. Empty on every other wave. */\nexport function aiSiteImportWhatsNew(state: AiSiteImportState, wave: AiSiteImportWave): AiSiteImportWhatsNewLine[] {\n return wave.slots.flatMap((slot) => {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page || page.redesign !== 'redesigned') return []\n const lines = [page.origin === 'proposed' ? 'A new page, written from what your site says' : '', aiSiteImportAddedText(page) ?? '', aiSiteImportPicturesText(page) ?? ''].filter(Boolean)\n return lines.length ? [{ page: page.title, lines }] : []\n })\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","aiMediaCreditsPerPicture","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE","AI_SITE_IMPORT_LAYOUT_KEPT","AI_SITE_IMPORT_PLAN_FELL_BACK","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportGeneratedPicturesOn","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportPlanAccepted","aiSiteImportPlanAwaits","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveIsGenerative","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","redesigned","reworded","wordsKept","buildCopy","page","choice","generative","build","redesign","length","wording","aiSiteImportAddedText","map","section","items","aiSiteImportPicturesText","pictures","stock","generated","unplaced","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","Map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","origin","isNew","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","AI_SITE_IMPORT_FINISH_COPY_GENERATIVE","aiSiteImportChoiceText","options","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","how","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field","AI_SITE_IMPORT_PLAN_COPY_TEXT","menu","cta","footer","addPage","addPageHelp","whatsNew","aiSiteImportPlanViewOf","name","id","proposed","draftId","named","nav","primaryCta","where","target","what","site","audience","on","purpose","address","editable","aiSiteImportPlanFellBackText","aiSiteImportPictureCredits","undefined","aiSiteImportPicturesSwitchText","each","most","aiSiteImportPlanFieldOf","aiSiteImportPlanTakesPictures","aiSiteImportPlanQuote","asked","generatedPictures","next","aiSiteImportWhatsNew","flatMap","lines"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,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Q,KAAK,cAAc,OAAO,EAAE;QACtD,MAAMmJ,QAAQ;YAACvJ,KAAK0C,MAAM,KAAK,aAAa,iDAAiD;aAAInC,yBAAAA,sBAAsBP,iBAAtBO,yBAA+B;aAAII,4BAAAA,yBAAyBX,iBAAzBW,4BAAkC;SAAG,CAACvB,MAAM,CAACC;QACjL,OAAOkK,MAAMlJ,MAAM,GAAG;YAAC;gBAAEL,MAAMA,KAAK0B,KAAK;gBAAE6H;YAAM;SAAE,GAAG,EAAE;IAC1D;AACF"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport { aiMediaCreditsPerPicture } from './ai-media-credits'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE,\n AI_SITE_IMPORT_LAYOUT_KEPT,\n AI_SITE_IMPORT_PLAN_FELL_BACK,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportGeneratedPicturesOn,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportPlanAccepted,\n aiSiteImportPlanAwaits,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveIsGenerative,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n * Under a generative Improve it: \"Redesigned by Aglyn AI · 2 new sections\",\n * or \"Layout kept: the redesign did not pass\".\n */\n build: string | null\n /** \"New: Why us, FAQ (4)\": the sections a redesign added (AGL-4152). */\n added?: string | null\n /** \"1 stock photo, 1 generated picture\": the pictures a redesign took beside its own (AGL-4152). */\n pictures?: string | null\n /** A page the site's plan proposed (AGL-4152): it has no old page to open. */\n isNew?: boolean\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page redesigned from its ledger (AGL-4152). */\n redesigned: `Redesigned by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice, generative = false): string | null {\n if (!page.build) return null\n // A redesign that did not pass (AGL-4152): today's compile drew the page.\n if (page.redesign === 'layout-kept') return AI_SITE_IMPORT_LAYOUT_KEPT\n if (page.redesign === 'redesigned') {\n const added = page.added?.length ?? 0\n return added ? `${BUILD_COPY.redesigned} · ${added} new ${added === 1 ? 'section' : 'sections'}` : BUILD_COPY.redesigned\n }\n if (generative && page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.redesigned\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** \"New: Why us, FAQ (4)\": the sections a redesign added, as its row says (AGL-4152). */\nexport function aiSiteImportAddedText(page: Pick<AiSiteImportPage, 'added'>): string | null {\n const added = page.added ?? []\n return added.length ? `New: ${added.map((section) => (section.items ? `${section.heading} (${section.items})` : section.heading)).join(', ')}` : null\n}\n\n/** \"1 stock photo, 1 generated picture\": what a redesign's pictures came from beside the page's own (AGL-4152). */\nexport function aiSiteImportPicturesText(page: Pick<AiSiteImportPage, 'pictures'>): string | null {\n const pictures = page.pictures\n if (!pictures) return null\n const parts = [\n pictures.stock ? `${pictures.stock} stock ${pictures.stock === 1 ? 'photo' : 'photos'}` : '',\n pictures.generated ? `${pictures.generated} generated ${pictures.generated === 1 ? 'picture' : 'pictures'}` : '',\n pictures.unplaced.length ? `${pictures.unplaced.length} of your photos not placed` : '',\n ].filter(Boolean)\n return parts.length ? parts.join(', ') : null\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n const generative = aiSiteImportWaveIsGenerative(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n // What a generative Improve it says of a page beside its build (AGL-4152).\n ...(aiSiteImportAddedText(page) ? { added: aiSiteImportAddedText(page) } : {}),\n ...(aiSiteImportPicturesText(page) ? { pictures: aiSiteImportPicturesText(page) } : {}),\n ...(page.origin === 'proposed' ? { isNew: true } : {}),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought && page.origin !== 'proposed'\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice, generative),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null), aiSiteImportWaveIsGenerative(state, wave) ? { generative: true } : {})\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/**\n * The same choice under a generative Improve it (AGL-4152): the improve option's\n * and the switch's words; everything else stands. Only drawn under the flag.\n */\nexport const AI_SITE_IMPORT_FINISH_COPY_GENERATIVE = {\n ...AI_SITE_IMPORT_FINISH_COPY,\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI plans your menu and footer, and redesigns each page with your pictures and forms, in a theme built around your brand. It shows you the plan before anything is built.`,\n },\n wording: {\n label: 'Also write new copy',\n description: `${PLATFORM_BRAND_NAME} AI writes new headings, paragraphs and sections for your main pages from what your site says. It never makes up a name, number, price, date, testimonial, client, award, credential, address or guarantee. Off, every word stays as you wrote it, and your layout and menu are still redesigned.`,\n },\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\"; under a generative Improve it, \"Improve it, with new copy\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (!choice.wording) return AI_SITE_IMPORT_FINISH_COPY.improve.label\n return options.generative ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, with new copy` : `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording`\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\"; under a generative Improve it, \"Redesigned\" or \"Redesigned, new copy\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (options.generative) return choice.wording ? 'Redesigned, new copy' : 'Redesigned'\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave), wave.generative ? { generative: true } : {})}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n if (options.generative && choice.wording) return `${PLATFORM_BRAND_NAME} AI redesigns each page and writes new copy from what your site says, making up no name, number, price or date. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n options: { generative?: boolean } = {},\n): string {\n // Under a generative Improve it (AGL-4152) new copy is quoted as the redesign it is, before the read and on the job's page alike.\n const generative = scope?.job.siteImport ? aiSiteImportWaveIsGenerative(scope.job.siteImport, scope.wave) : options.generative === true\n const how = generative ? { generative: true } : {}\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1, how).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages, how).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n\n/*------------------------------------------\n * Your new site (AGL-4152)\n *-----------------------------------------*/\n\n/** The \"Your new site\" panel's words: what the site is, its menu, its main button, its footer, and what its owner may switch. */\nexport interface AiSiteImportPlanView {\n what: string\n audience: string\n /** Each menu entry: its label and the pages under it; one page is a plain link. */\n menu: Array<{ label: string; pages: string[] }>\n /** \"Book a visit → Contact\". */\n cta: string | null\n footer: Array<{ label: string; pages: string[] }>\n /** The page it proposes, whether it was kept or switched off. */\n proposed: { title: string; purpose: string; address: string } | null\n /** Whether the owner still decides: the plan waits on them. */\n editable: boolean\n}\n\n/** The panel's fixed words, one place for its specs and its screen. */\nexport const AI_SITE_IMPORT_PLAN_COPY_TEXT = {\n heading: 'Your new site',\n menu: 'Menu',\n cta: 'Main button',\n footer: 'Footer',\n addPage: 'Add this new page',\n addPageHelp: 'One new page, written from what your site says. It counts toward your plan’s page limit.',\n pictures: 'Create pictures with AI where needed',\n build: 'Build my new site',\n whatsNew: 'What’s new',\n} as const\n\n/** The panel as a plan reads, or `null` with none: every import the flag is off for, and every plan that did not pass. */\nexport function aiSiteImportPlanViewOf(state: AiSiteImportState | null | undefined): AiSiteImportPlanView | null {\n const plan = state?.plan\n if (!state || !plan) return null\n const name = (id: string) => (plan.proposed?.draftId === id ? plan.proposed.title : (state.pages.find((page) => page.draftId === id)?.title ?? ''))\n const named = (groups: ReadonlyArray<{ label: string; pages: string[] }>) => groups.map((group) => ({ label: group.label, pages: group.pages.map(name).filter(Boolean) })).filter((group) => group.pages.length)\n // A menu entry of one page is a link to it under the entry's label, as the header draws it, never a menu of one (AGL-4152).\n const menu = named(plan.nav.groups).map((group) => (group.pages.length === 1 ? { label: group.label, pages: [] } : group))\n const cta = plan.nav.primaryCta\n const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (cta.page ?? '') : cta.target)\n return {\n what: plan.site.what,\n audience: plan.site.audience,\n menu,\n cta: cta && where ? `${cta.label} → ${where}` : null,\n footer: named(plan.nav.footer),\n proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? { title: plan.proposed.title, purpose: plan.proposed.purpose, address: `/${plan.proposed.slug}` } : null,\n editable: aiSiteImportPlanAwaits(state),\n }\n}\n\n/** What the plan that did not pass says, or `null`: a plan that passed, and every import with none asked. */\nexport function aiSiteImportPlanFellBackText(state: Pick<AiSiteImportState, 'plan'> | null | undefined): string | null {\n return state?.plan === null ? AI_SITE_IMPORT_PLAN_FELL_BACK : null\n}\n\n/** The credits a generated picture is quoted at, on a paid plan: an import is one. */\nexport const aiSiteImportPictureCredits = (): number => aiMediaCreditsPerPicture('photo', undefined, '1K')\n\n/** What the generated pictures switch says it adds: how many at most, and what each costs, before it is on. */\nexport function aiSiteImportPicturesSwitchText(state: AiSiteImportState): string {\n const pages = state.pages.filter((page) => page.wording === 'improved' && !page.refused).length\n const each = aiSiteImportPictureCredits()\n const most = pages * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE\n return `Only where your own photos and the stock library have nothing that fits: a page’s opening picture or a section’s lead, up to ${AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE} a page. About ${each.toLocaleString('en-US')} AI credits each${most ? `, so at most ${(most * each).toLocaleString('en-US')} for this wave` : ''}. A picture that is not made costs nothing.`\n}\n\n/** Whether generated pictures are switched on now, for the panel's first draw. */\nexport function aiSiteImportPlanFieldOf(state: AiSiteImportState | null | undefined): { addPage: boolean; pictures: boolean } {\n return { addPage: state?.plan?.proposed?.on !== false, pictures: aiSiteImportGeneratedPicturesOn(state) }\n}\n\n/** Whether a plan's generated pictures switch means anything: only pages with new copy ask for a picture. */\nexport function aiSiteImportPlanTakesPictures(state: Pick<AiSiteImportState, 'pages'>): boolean {\n return state.pages.some((page) => page.wording === 'improved' && !page.refused)\n}\n\n/** The wave's quote as the plan's switches stand now (AGL-4152), before they are saved: with or without its new page, and its pictures. */\nexport function aiSiteImportPlanQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, field: { addPage: boolean; pictures: boolean }): string | null {\n const state = job.siteImport ?? null\n const plan = state?.plan\n if (!state || !plan) return null\n const asked: AiSiteImportState = { ...state, generatedPictures: field.pictures, plan: { ...plan, proposed: plan.proposed ? { ...plan.proposed, on: field.addPage } : null } }\n const next = aiSiteImportPlanAccepted(asked, job.items ?? [])\n const wave = aiSiteImportRunningWave(next.state)\n return wave ? aiSiteImportWaveQuote({ items: next.items, siteImport: next.state }, wave) : null\n}\n\n/** One page's lines of a wave's \"What's new\" (AGL-4152): its new sections, and its pictures. */\nexport interface AiSiteImportWhatsNewLine {\n page: string\n lines: string[]\n}\n\n/** A wave's \"What's new\" (AGL-4152): what its redesigns added, page by page. Empty on every other wave. */\nexport function aiSiteImportWhatsNew(state: AiSiteImportState, wave: AiSiteImportWave): AiSiteImportWhatsNewLine[] {\n return wave.slots.flatMap((slot) => {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page || page.redesign !== 'redesigned') return []\n const lines = [page.origin === 'proposed' ? 'A new page, written from what your site says' : '', aiSiteImportAddedText(page) ?? '', aiSiteImportPicturesText(page) ?? ''].filter(Boolean)\n return lines.length ? [{ page: page.title, lines }] : []\n })\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","aiMediaCreditsPerPicture","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE","AI_SITE_IMPORT_LAYOUT_KEPT","AI_SITE_IMPORT_PLAN_FELL_BACK","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportGeneratedPicturesOn","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportPlanAccepted","aiSiteImportPlanAwaits","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveIsGenerative","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","redesigned","reworded","wordsKept","buildCopy","page","choice","generative","build","redesign","length","wording","aiSiteImportAddedText","map","section","items","aiSiteImportPicturesText","pictures","stock","generated","unplaced","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","Map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","origin","isNew","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","AI_SITE_IMPORT_FINISH_COPY_GENERATIVE","aiSiteImportChoiceText","options","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","how","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field","AI_SITE_IMPORT_PLAN_COPY_TEXT","menu","cta","footer","addPage","addPageHelp","whatsNew","aiSiteImportPlanViewOf","name","id","proposed","draftId","named","nav","primaryCta","where","target","what","site","audience","on","purpose","address","editable","aiSiteImportPlanFellBackText","aiSiteImportPictureCredits","undefined","aiSiteImportPicturesSwitchText","each","most","aiSiteImportPlanFieldOf","aiSiteImportPlanTakesPictures","aiSiteImportPlanQuote","asked","generatedPictures","next","aiSiteImportWhatsNew","flatMap","lines"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,wBAAwB,QAAQ,wBAAoB;AAE7D,SACEC,yBAAyB,EACzBC,0CAA0C,EAC1CC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,6BAA6B,EAC7BC,oBAAoB,EACpBC,+BAA+B,EAC/BC,oBAAoB,EACpBC,qBAAqB,EACrBC,wBAAwB,EACxBC,sBAAsB,EACtBC,qBAAqB,EACrBC,qBAAqB,EACrBC,8BAA8B,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X,iBAAzBW,4BAAkC;SAAG,CAACvB,MAAM,CAACC;QACjL,OAAOkK,MAAMlJ,MAAM,GAAG;YAAC;gBAAEL,MAAMA,KAAK0B,KAAK;gBAAE6H;YAAM;SAAE,GAAG,EAAE;IAC1D;AACF"}
@@ -799,6 +799,13 @@ export interface AiSiteImportPage {
799
799
  * report; its row reads in words, never these.
800
800
  */
801
801
  redesignMissed?: string[] | null;
802
+ /**
803
+ * Why its layout was kept, line by line (AGL-4152): each miss's code and
804
+ * what it says of the line it found, cut to 300 characters, at most 8. The
805
+ * answer is never stored, so this is what a later read of the job has to
806
+ * diagnose a miss by. For the job's record; its row never shows it.
807
+ */
808
+ redesignMissedWhy?: string[] | null;
802
809
  }
803
810
  /** How a page's generative Improve it came out (AGL-4152). */
804
811
  export type AiSiteImportRedesign = 'redesigned' | 'layout-kept';
@@ -1388,7 +1395,7 @@ export declare function aiSiteImportFinishUpdate(job: Pick<AiJob, 'kind' | 'stat
1388
1395
  * it shows, for its row; and the source's photos it left off, which a later
1389
1396
  * page's slot takes before a stock photo.
1390
1397
  */
1391
- export declare function aiSiteImportRedesignOf(state: AiSiteImportState, slot: string, redesign: AiSiteImportRedesign, added?: readonly AiSiteImportAddedSection[], pictures?: AiSiteImportPagePictures | null, missed?: readonly string[] | null): AiSiteImportState;
1398
+ export declare function aiSiteImportRedesignOf(state: AiSiteImportState, slot: string, redesign: AiSiteImportRedesign, added?: readonly AiSiteImportAddedSection[], pictures?: AiSiteImportPagePictures | null, missed?: readonly string[] | null, why?: readonly string[] | null): AiSiteImportState;
1392
1399
  /** Whether generated pictures are on for an import: as its owner said, else the default. */
1393
1400
  export declare function aiSiteImportGeneratedPicturesOn(state: Pick<AiSiteImportState, 'generatedPictures'> | null | undefined): boolean;
1394
1401
  /** Whether the job waits on its owner's say-so over a plan (AGL-4152): shown, and nothing of the site built. */
@@ -484,8 +484,8 @@ function trimItem(item, keep) {
484
484
  var _read_blocks;
485
485
  if (typeof read === 'string') continue;
486
486
  for (const block of (_read_blocks = read.blocks) != null ? _read_blocks : []){
487
- if (block.kind === 'image') continue;
488
- const line = block.text.replace(/\s+/g, ' ').trim();
487
+ // A picture's words are what it says (AGL-4152): a crew, a town, a kind of work a later page may name.
488
+ const line = ((block.kind === 'image' ? block.alt : block.text) || '').replace(/\s+/g, ' ').trim();
489
489
  if (!line || seen.has(line) || chars + line.length > AI_SITE_IMPORT_SAID_MAX_CHARS) continue;
490
490
  seen.add(line);
491
491
  out.push(line);
@@ -1388,12 +1388,18 @@ const readChars = (read)=>{
1388
1388
  * How a page's generative Improve it came out (AGL-4152), what it added and what
1389
1389
  * it shows, for its row; and the source's photos it left off, which a later
1390
1390
  * page's slot takes before a stock photo.
1391
- */ export function aiSiteImportRedesignOf(state, slot, redesign, added, pictures, missed) {
1391
+ */ export function aiSiteImportRedesignOf(state, slot, redesign, added, pictures, missed, why) {
1392
1392
  var _ref, _ref1, _next_sitePhotos;
1393
1393
  var _state_pages_find_photos, _state_pages_find;
1394
+ // A page run again clears what an earlier run said of it.
1395
+ const was = state.pages.find((page)=>page.slot === slot);
1394
1396
  const next = withPage(state, slot, _extends({
1395
1397
  redesign
1396
- }, (added == null ? void 0 : added.length) ? {
1398
+ }, (was == null ? void 0 : was.redesignMissed) ? {
1399
+ redesignMissed: null
1400
+ } : {}, (was == null ? void 0 : was.redesignMissedWhy) ? {
1401
+ redesignMissedWhy: null
1402
+ } : {}, (added == null ? void 0 : added.length) ? {
1397
1403
  added: [
1398
1404
  ...added
1399
1405
  ]
@@ -1401,6 +1407,8 @@ const readChars = (read)=>{
1401
1407
  pictures
1402
1408
  } : {}, (missed == null ? void 0 : missed.length) ? {
1403
1409
  redesignMissed: missed.slice(0, 8).map((code)=>code.slice(0, 40))
1410
+ } : {}, (why == null ? void 0 : why.length) ? {
1411
+ redesignMissedWhy: why.slice(0, 8).map((line)=>line.slice(0, 300))
1404
1412
  } : {}));
1405
1413
  const left = new Set((_ref = pictures == null ? void 0 : pictures.unplaced) != null ? _ref : []);
1406
1414
  if (!left.size) return next;