@aglyn/plugins-ai 1.14.0 → 1.15.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 (128) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-build-page.component.js +5 -3
  3. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  4. package/src/lib/components/ai-site-import-finish.component.d.ts +3 -1
  5. package/src/lib/components/ai-site-import-finish.component.js +3 -3
  6. package/src/lib/components/ai-site-import-finish.component.js.map +1 -1
  7. package/src/lib/components/ai-site-import-job.component.d.ts +4 -3
  8. package/src/lib/components/ai-site-import-job.component.js +141 -43
  9. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  10. package/src/lib/components/ai-site-import-plan.component.d.ts +42 -0
  11. package/src/lib/components/ai-site-import-plan.component.js +246 -0
  12. package/src/lib/components/ai-site-import-plan.component.js.map +1 -0
  13. package/src/lib/components/ai-site-import-start.component.d.ts +3 -1
  14. package/src/lib/components/ai-site-import-start.component.js +3 -2
  15. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  16. package/src/lib/components/ai-site-start-card.component.js +6 -2
  17. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  18. package/src/lib/components/ai-site-start-steps.component.d.ts +3 -2
  19. package/src/lib/components/ai-site-start-steps.component.js +12 -5
  20. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  21. package/src/lib/jobs/ai-job-import-step.d.ts +47 -2
  22. package/src/lib/jobs/ai-job-import-step.js +356 -22
  23. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  24. package/src/lib/jobs/ai-job-layout-language.js +4 -1
  25. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  26. package/src/lib/jobs/ai-job-page-language.d.ts +21 -2
  27. package/src/lib/jobs/ai-job-page-language.js +217 -5
  28. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  29. package/src/lib/jobs/ai-job-page-step.d.ts +7 -0
  30. package/src/lib/jobs/ai-job-page-step.js +73 -12
  31. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  32. package/src/lib/jobs/ai-job-plan-step.js +4 -2
  33. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  34. package/src/lib/jobs/ai-job-site-look.js +14 -5
  35. package/src/lib/jobs/ai-job-site-look.js.map +1 -1
  36. package/src/lib/jobs/ai-job-text-step.d.ts +10 -2
  37. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  38. package/src/lib/jobs/ai-jobs.js +2 -1
  39. package/src/lib/jobs/ai-jobs.js.map +1 -1
  40. package/src/lib/jobs/ai-site-import-compile.d.ts +43 -2
  41. package/src/lib/jobs/ai-site-import-compile.js +105 -62
  42. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  43. package/src/lib/jobs/ai-site-import-document.d.ts +25 -1
  44. package/src/lib/jobs/ai-site-import-document.js +26 -7
  45. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  46. package/src/lib/jobs/ai-site-import-honesty.d.ts +65 -0
  47. package/src/lib/jobs/ai-site-import-honesty.js +271 -0
  48. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -0
  49. package/src/lib/jobs/ai-site-import-improve.d.ts +233 -0
  50. package/src/lib/jobs/ai-site-import-improve.js +1151 -0
  51. package/src/lib/jobs/ai-site-import-improve.js.map +1 -0
  52. package/src/lib/jobs/ai-site-import-look.d.ts +4 -0
  53. package/src/lib/jobs/ai-site-import-look.js +16 -6
  54. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  55. package/src/lib/jobs/ai-site-import-pictures.d.ts +83 -0
  56. package/src/lib/jobs/ai-site-import-pictures.js +261 -0
  57. package/src/lib/jobs/ai-site-import-pictures.js.map +1 -0
  58. package/src/lib/jobs/ai-site-import-plan.d.ts +78 -0
  59. package/src/lib/jobs/ai-site-import-plan.js +627 -0
  60. package/src/lib/jobs/ai-site-import-plan.js.map +1 -0
  61. package/src/lib/jobs/ai-site-import-wording.js +2 -5
  62. package/src/lib/jobs/ai-site-import-wording.js.map +1 -1
  63. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
  64. package/src/lib/layout-language/ai-layout-compiler.js +10 -6
  65. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  66. package/src/lib/layout-language/ai-layout-design.d.ts +9 -0
  67. package/src/lib/layout-language/ai-layout-design.js +29 -3
  68. package/src/lib/layout-language/ai-layout-design.js.map +1 -1
  69. package/src/lib/layout-language/ai-layout-frame-source.d.ts +5 -0
  70. package/src/lib/layout-language/ai-layout-frame-source.js +4 -2
  71. package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
  72. package/src/lib/layout-language/ai-layout-frame.d.ts +2 -0
  73. package/src/lib/layout-language/ai-layout-frame.js +20 -12
  74. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  75. package/src/lib/layout-language/ai-layout-language.d.ts +8 -0
  76. package/src/lib/layout-language/ai-layout-language.js +7 -3
  77. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  78. package/src/lib/model/ai-site-import-fidelity.d.ts +62 -0
  79. package/src/lib/model/ai-site-import-fidelity.js +374 -0
  80. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  81. package/src/lib/model/ai-site-import-ledger.d.ts +82 -0
  82. package/src/lib/model/ai-site-import-ledger.js +254 -0
  83. package/src/lib/model/ai-site-import-ledger.js.map +1 -0
  84. package/src/lib/model/ai-site-import-view.d.ts +110 -6
  85. package/src/lib/model/ai-site-import-view.js +166 -13
  86. package/src/lib/model/ai-site-import-view.js.map +1 -1
  87. package/src/lib/model/ai-site-import.d.ts +227 -2
  88. package/src/lib/model/ai-site-import.js +312 -15
  89. package/src/lib/model/ai-site-import.js.map +1 -1
  90. package/src/lib/model/ai-site-job.js +4 -0
  91. package/src/lib/model/ai-site-job.js.map +1 -1
  92. package/src/lib/model/ai-site-kinds.d.ts +2 -0
  93. package/src/lib/model/ai-site-kinds.js +7 -0
  94. package/src/lib/model/ai-site-kinds.js.map +1 -1
  95. package/src/lib/model/ai-site-look.d.ts +14 -5
  96. package/src/lib/model/ai-site-look.js +22 -16
  97. package/src/lib/model/ai-site-look.js.map +1 -1
  98. package/src/lib/model/ai-site-start.d.ts +37 -7
  99. package/src/lib/model/ai-site-start.js +54 -10
  100. package/src/lib/model/ai-site-start.js.map +1 -1
  101. package/src/lib/model/ai-site-starter-look.d.ts +69 -0
  102. package/src/lib/model/ai-site-starter-look.js +90 -0
  103. package/src/lib/model/ai-site-starter-look.js.map +1 -0
  104. package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -0
  105. package/src/lib/runtime/ai-doctrine-validators.js +3 -2
  106. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  107. package/src/lib/runtime/ai-doctrine.d.ts +10 -0
  108. package/src/lib/runtime/ai-doctrine.js +16 -2
  109. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  110. package/src/lib/server/ai-jobs-resume.js +12 -3
  111. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  112. package/src/lib/server/ai-jobs-route.js +5 -1
  113. package/src/lib/server/ai-jobs-route.js.map +1 -1
  114. package/src/lib/server/ai-site-import-route.d.ts +6 -0
  115. package/src/lib/server/ai-site-import-route.js +8 -1
  116. package/src/lib/server/ai-site-import-route.js.map +1 -1
  117. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +46 -7
  118. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +260 -14
  119. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  120. package/src/lib/site-import/fixtures/site-import-improve-answers.d.ts +33 -0
  121. package/src/lib/site-import/fixtures/site-import-improve-answers.js +457 -0
  122. package/src/lib/site-import/fixtures/site-import-improve-answers.js.map +1 -0
  123. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +29 -0
  124. package/src/lib/site-import/fixtures/site-layout-recordings.js +26 -0
  125. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  126. package/src/lib/site-import/site-import-flag.d.ts +17 -0
  127. package/src/lib/site-import/site-import-flag.js +15 -0
  128. package/src/lib/site-import/site-import-flag.js.map +1 -1
@@ -0,0 +1,1151 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ /**
4
+ * @license
5
+ * Copyright 2026 Aglyn LLC
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */ /*==========================================
19
+ * IMPROVE IT, GENERATIVE: A PAGE REDESIGNED FROM A LEDGER (AGL-4152).
20
+ *
21
+ * Today's Improve it draws the source's layout in a new design and rewords its
22
+ * lines in place. Behind `SITE_IMPORT_GENERATIVE_RELEASE_FLAG` a main page is
23
+ * instead designed the way Start with AI designs one, from what the import
24
+ * read: one `submit_improved_page` answer plans the sections and the grid and
25
+ * writes the words, and code places what the source holds.
26
+ *
27
+ * 1. The answer is told the page as a LEDGER (`aiSiteImportLedgerText`): each
28
+ * picture, form, plan, table, quote, video and contact line by a ref a
29
+ * `keep` block places, each link's destination, and the numbered lines it
30
+ * rewrites freely.
31
+ * 2. It is held by code: the honesty validator over its words and its refs
32
+ * (`ai-site-import-honesty.ts`), then the page compiled and scored on the
33
+ * kept ledger and the design lines (`siteImportFidelity`). A miss is named
34
+ * in the one re-ask.
35
+ * 3. Compiled by the site compiler with `keep` expanded to the source's own
36
+ * blocks, and a picture asked for in words left as a slot the page step's
37
+ * pictures fill or drop.
38
+ *
39
+ * Nothing here runs with the flag off, or for Keep my site.
40
+ *=========================================*/ import { fenceUntrustedText, UNTRUSTED_TEXT_RULE } from "@aglyn/shared-util-tools/untrusted-text";
41
+ import { aiLayoutDesignChoices, aiLayoutGroupVariant } from "../layout-language/ai-layout-design.js";
42
+ import { AI_LAYOUT_ALIGNS, AI_LAYOUT_BANDS, AI_LAYOUT_MAX_COLS, AI_LAYOUT_STYLES, aiReadLayoutBlock } from "../layout-language/ai-layout-language.js";
43
+ import { AI_ICON_WORDS } from "../runtime/ai-icon-library.js";
44
+ import { aiSiteHomeArc } from "../model/ai-site-home-arcs.js";
45
+ import { siteImportContentKept } from "../model/ai-site-import-fidelity.js";
46
+ import { siteImportLedger } from "../model/ai-site-import-ledger.js";
47
+ import { AI_SITE_IMPORT_PAGE_CEILING_CREDITS } from "../model/ai-site-import.js";
48
+ import { estimateAiBilledUsd } from "../providers/catalog.js";
49
+ import { assistCreditsFromUsd } from "../usage/assist-credits.js";
50
+ import { siteImportLabel } from "../site-import/site-import-page.js";
51
+ import { aiSiteImportHonesty, aiSiteImportImprovedPlaced } from "./ai-site-import-honesty.js";
52
+ import { aiSiteImportLayoutOf, aiSiteImportLinkTo, aiSiteImportMapScope, aiSiteImportNodeBlocks, aiSiteImportTakePicture } from "./ai-site-import-compile.js";
53
+ import { aiSiteImportTextParts } from "./ai-site-import-document.js";
54
+ const clean = (text)=>typeof text === 'string' ? text.replace(/\s+/g, ' ').trim() : '';
55
+ /*------------------------------------------
56
+ * The tool and its cached text
57
+ *-----------------------------------------*/ /** The answer's kind of generation: the name its re-ask and its doctrine scope go by. */ export const AI_SITE_IMPORT_IMPROVE_KIND = 'page-improve';
58
+ /**
59
+ * The most items a redesign's group keeps (AGL-4152): every item its owner's
60
+ * page has, where the layout language's own pages stop at seven. A page
61
+ * brought in is compiled as its source lays it out, with no such limit.
62
+ */ export const AI_SITE_IMPORT_IMPROVE_MAX_ITEMS = 24;
63
+ /** What a block may be: the layout language's words and groups, and `keep`. A customer's quote and a figure only ever arrive by `keep`. */ export const AI_SITE_IMPORT_IMPROVE_BLOCK_KINDS = [
64
+ 'eyebrow',
65
+ 'heading',
66
+ 'lede',
67
+ 'text',
68
+ 'note',
69
+ 'list',
70
+ 'button',
71
+ 'image',
72
+ 'cards',
73
+ 'steps',
74
+ 'faq',
75
+ 'keep'
76
+ ];
77
+ const ITEM_SCHEMA = {
78
+ type: 'object',
79
+ additionalProperties: false,
80
+ required: [
81
+ 'title',
82
+ 'text',
83
+ 'to',
84
+ 'icon',
85
+ 'ref'
86
+ ],
87
+ properties: {
88
+ title: {
89
+ type: 'string'
90
+ },
91
+ text: {
92
+ type: 'string'
93
+ },
94
+ to: {
95
+ type: 'string'
96
+ },
97
+ icon: {
98
+ type: 'string'
99
+ },
100
+ ref: {
101
+ type: 'string'
102
+ }
103
+ }
104
+ };
105
+ const BLOCK_SCHEMA = {
106
+ type: 'object',
107
+ additionalProperties: false,
108
+ required: [
109
+ 'kind',
110
+ 'col',
111
+ 'text',
112
+ 'to',
113
+ 'style',
114
+ 'icon',
115
+ 'items',
116
+ 'ref'
117
+ ],
118
+ properties: {
119
+ kind: {
120
+ type: 'string',
121
+ enum: [
122
+ ...AI_SITE_IMPORT_IMPROVE_BLOCK_KINDS
123
+ ]
124
+ },
125
+ col: {
126
+ type: 'integer'
127
+ },
128
+ text: {
129
+ type: 'string'
130
+ },
131
+ to: {
132
+ type: 'string'
133
+ },
134
+ style: {
135
+ type: 'string',
136
+ enum: [
137
+ ...AI_LAYOUT_STYLES,
138
+ 'none'
139
+ ]
140
+ },
141
+ icon: {
142
+ type: 'string'
143
+ },
144
+ items: {
145
+ type: 'array',
146
+ items: ITEM_SCHEMA
147
+ },
148
+ ref: {
149
+ type: 'string'
150
+ }
151
+ }
152
+ };
153
+ /** The redesign tool: the `submit_page` language, a `keep` block, and a picture on an item by its ref. */ export const AI_SITE_IMPORT_IMPROVE_TOOL = {
154
+ name: 'submit_improved_page',
155
+ description: 'Submit the redesigned page: its sections in order, in the layout language, each thing the page must keep placed with a keep block.',
156
+ strict: true,
157
+ inputSchema: {
158
+ type: 'object',
159
+ additionalProperties: false,
160
+ required: [
161
+ 'sections'
162
+ ],
163
+ properties: {
164
+ sections: {
165
+ type: 'array',
166
+ items: {
167
+ type: 'object',
168
+ additionalProperties: false,
169
+ required: [
170
+ 'band',
171
+ 'cols',
172
+ 'align',
173
+ 'blocks'
174
+ ],
175
+ properties: {
176
+ band: {
177
+ type: 'string',
178
+ enum: [
179
+ ...AI_LAYOUT_BANDS
180
+ ]
181
+ },
182
+ cols: {
183
+ type: 'array',
184
+ items: {
185
+ type: 'integer'
186
+ }
187
+ },
188
+ align: {
189
+ type: 'string',
190
+ enum: [
191
+ ...AI_LAYOUT_ALIGNS
192
+ ]
193
+ },
194
+ blocks: {
195
+ type: 'array',
196
+ items: BLOCK_SCHEMA
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ };
204
+ /** What a redesign is told, cached: every page of every site shares these bytes. */ export const AI_SITE_IMPORT_IMPROVE_TEXT = [
205
+ "You redesign one page of a small business's existing website the way a professional web designer and copywriter would, so the new page looks far better than the old one: polished, organized and inviting, never the old page restyled. The old page is usually plain: one column, flat grounds, a text link for a call to action, its sections in the order someone typed them. Plan the page again from what a visitor needs, in the order they need it, add the sections it lacks, and write every word. The platform turns your design into the page in the site's own theme, so never describe styling beyond the words below.",
206
+ '',
207
+ 'Answer with submit_improved_page. A page is a list of sections, top to bottom, and you decide how many and what each one is. A section has:',
208
+ '- band: plain (the page), soft (a set-apart ground), brand (the brand color) or dark.',
209
+ '- cols: relative column widths for a row: [1, 1] for halves, [7, 5] for a wide and a narrow column, [1, 1, 1]; at most 4. [] for one column.',
210
+ '- align: start or center. Center only a short section: an opening, a closing call to action, a heading over a group.',
211
+ '- blocks: what it shows, top to bottom. A block with col 0 or more goes in that column of the row; col -1 spans the section, above the row when it comes first and below it when it comes last.',
212
+ 'Every field is always written: a block that does not use one writes "" (text, to, icon, ref), "none" (style), -1 (col) or [] (items); an item that does not use one writes "".',
213
+ '',
214
+ 'Block kinds:',
215
+ '- eyebrow: a short label over a heading. heading: the first heading of the first section is the page title; the first heading of any other section is its heading. lede: the larger sentence under a heading. text: a paragraph. note: small print.',
216
+ '- button: text is its label, to where it goes, style primary (filled), secondary (outlined) or quiet. Two in a row read as a pair.',
217
+ '- cards, steps, faq: a group of items, each a title and a text. cards are services, features or reasons; steps are numbered and in order; faq items are a question and its answer. An item may carry an icon, a to, and ref naming a picture of the page, shown on the card.',
218
+ '- list: short lines, title only.',
219
+ '- image: text describes a picture the page should have where none of its own fits; the platform finds one, or leaves it out.',
220
+ '- keep: ref names one thing of the ledger, drawn exactly as the owner has it, so write nothing for it: a picture, form, plan, table, quote, video, contact line, figures, logos, a gallery of photos (drawn as a grid of them), tabs, or a group. Place every thing the ledger marks must, exactly once, wherever it serves the page best, in a column if that helps.',
221
+ '- A group:n of the ledger is a set of like items the old page shows (its cards, steps, questions or list). keep it to draw it whole as the owner has it, with the pictures and links it holds; or write its items again as a group of your own, every link and fact of it kept. A page too long to show whole has its groups folded: each is shown by its titles, marked must, and kept whole, and you write only what is around them.',
222
+ 'icon (on a block or an item) is one of: ' + AI_ICON_WORDS.join(', ') + '.',
223
+ '',
224
+ 'Where a link goes (to): page:<id> for a page the ledger names, #<n> for section n of this page, form for the form on this page, phone or email for the number or address the page gives, or an https: address the ledger lists. Every link the ledger lists must go somewhere on the page, as a button or an item.',
225
+ '',
226
+ "A designer's page is made of sections like these; choose and order the ones this page needs:",
227
+ '- Hero: the page title, a lede, a filled primary button and a quieter second one, beside a picture (cols [7, 5]: the words in col 0, the picture in col 1) or with the picture behind the words (one column, the picture first). Every opening places a picture: the page\'s own by keep, else an image block.',
228
+ '- Offer as a card grid: a heading, a lede, then cards, one item for each service or thing offered, each with an icon; three or four across.',
229
+ '- Figures or badges: figures the ledger holds, kept (keep stats:n); plain facts the page states, such as how long the business has run or that it is licensed, as cards of two to four items with icons, each saying the fact exactly as the page does.',
230
+ '- How it works: a heading and steps of three or four items, from first asking to done.',
231
+ '- Why choose it: cards of three with icons, each a reason the site supports.',
232
+ '- A quote drawn as a quote: its own section on a soft or dark ground, centered: a short heading and the kept quote alone.',
233
+ '- Pictures in a row: cols [1, 1, 1] or [1, 1], one picture kept in each column with a one-line caption under it; a gallery kept whole is its own grid, under a short heading. Pictures are never stacked one under another.',
234
+ '- Words beside a picture: cols [1, 1] or [5, 7]: a heading, a lede, a paragraph and a button in one column and a picture in the other, the side alternating down the page.',
235
+ '- Questions: a heading and a faq of three to six questions a visitor of this kind of business asks, each answered only with what the site says.',
236
+ '- Contact: the kept form on a framed ground (a soft band, cols [5, 7]): beside it a heading, a welcoming line, the kept contact line and a call or email button.',
237
+ '- Closing band: the last section, on a brand or dark ground, centered: a heading that says what the visitor gets, one line, and a filled primary button.',
238
+ '',
239
+ 'Plan it as a designer would:',
240
+ '- Give the page the sections its role asks for. The request names its role and how many new sections it needs: a new section is one the old page has nowhere, such as how it works, why choose it or the questions people ask, written from what the site says and what this kind of business generally does.',
241
+ '- Draw like things as a group: three or more services, reasons or steps are cards or steps, never headings and paragraphs one under another; a set of questions is a faq; two or three pictures are a row.',
242
+ '- Vary it: no two neighboring sections share a shape or a ground. Alternate plain and soft, and keep brand and dark to one or two sections a page, usually the closing band.',
243
+ '- Each heading says what the visitor gets, in a few specific words; never "Welcome", "Our services" or "Ready when you are" alone.',
244
+ '- Put the phone or email the page gives on a button (to phone, to email) where a visitor would call or write, beside the kept contact line.',
245
+ '',
246
+ "Writing: plain, specific and in the owner's voice, each heading a clear promise, each paragraph leading with the benefit, nothing that does not earn its place. Headings and card titles are in sentence case, so a capital reads as a name. Say what the page says, in stronger words, keeping every fact it gives; and you may say what this kind of business generally does.",
247
+ 'Never write a name, number, price, date, testimonial, client, award, credential, address or guarantee the page or the site does not give. A fact you do not have is left out, never a gap or a placeholder. Say a figure, a price, a phone or a name exactly as the page does.'
248
+ ].join('\n');
249
+ /** The site's own digest, which every page of one import reads ahead of its ledger: cached once per site. */ export function aiSiteImportImproveDigest(input) {
250
+ return [
251
+ fenceUntrustedText("What the owner's site says of itself", [
252
+ clean(input.siteName),
253
+ ...input.scope
254
+ ].filter(Boolean).join('\n'), {
255
+ maxChars: AI_SITE_IMPORT_IMPROVE_DIGEST_CHARS
256
+ }),
257
+ ...input.plan ? [
258
+ fenceUntrustedText('The plan every page of this site is drawn to', JSON.stringify(input.plan), {
259
+ maxChars: 4000
260
+ })
261
+ ] : []
262
+ ].join('\n');
263
+ }
264
+ /** The most of a site's own words the digest holds. */ export const AI_SITE_IMPORT_IMPROVE_DIGEST_CHARS = 16000;
265
+ /** A redesign's system blocks: the platform's text cached across sites, then this site's digest, cached once per site. The ledger rides the user turn. */ export function aiSiteImportImproveInstructions(digest) {
266
+ return [
267
+ {
268
+ text: AI_SITE_IMPORT_IMPROVE_TEXT,
269
+ cacheBreakpoint: true
270
+ },
271
+ {
272
+ text: UNTRUSTED_TEXT_RULE
273
+ },
274
+ {
275
+ text: digest,
276
+ cacheBreakpoint: true,
277
+ site: true
278
+ }
279
+ ];
280
+ }
281
+ /*------------------------------------------
282
+ * The ledger as the answer reads it
283
+ *-----------------------------------------*/ /** The most characters a page's ledger shows. */ export const AI_SITE_IMPORT_LEDGER_MAX_CHARS = 16000;
284
+ const textOf = (block)=>block && block.kind !== 'image' ? clean(block.text) : '';
285
+ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)}…` : text;
286
+ /** A ledger item, in a few words: what it is and what it shows. */ function shownItem(item, doc) {
287
+ const must = item.must ? ' must' : '';
288
+ const words = item.lines.map((ref)=>textOf(doc.blocks[ref])).filter(Boolean);
289
+ switch(item.kind){
290
+ case 'picture':
291
+ {
292
+ const block = doc.blocks[item.lines[0]];
293
+ const url = (block == null ? void 0 : block.kind) === 'image' ? block.url : '';
294
+ const photo = doc.photos.find((entry)=>entry.from === url);
295
+ const alt = (block == null ? void 0 : block.kind) === 'image' ? clean(block.alt) : '';
296
+ return `${item.ref}${must} (${(photo == null ? void 0 : photo.width) && photo.height ? `${photo.width}×${photo.height}, ` : ''}"${short(alt, 60)}")`;
297
+ }
298
+ case 'form':
299
+ return `${item.ref}${must} (a form)`;
300
+ case 'video':
301
+ return `${item.ref}${must} (a film)`;
302
+ case 'plan':
303
+ var _item_node;
304
+ return `${item.ref}${must} (${((_item_node = item.node) == null ? void 0 : _item_node.kind) === 'group' ? item.node.items.length : 0} plans: ${short(words.slice(0, 6).join(', '), 120)})`;
305
+ case 'table':
306
+ var _item_node1;
307
+ return `${item.ref}${must} (${((_item_node1 = item.node) == null ? void 0 : _item_node1.kind) === 'table' ? item.node.rows.length : 0} rows: ${short(words.slice(0, 6).join(', '), 120)})`;
308
+ case 'stats':
309
+ return `${item.ref}${must} (figures: ${short(words.join(', '), 120)})`;
310
+ case 'logos':
311
+ return `${item.ref}${must} (a strip of logos)`;
312
+ case 'gallery':
313
+ {
314
+ var _ref;
315
+ var _item_node2;
316
+ const node = ((_item_node2 = item.node) == null ? void 0 : _item_node2.kind) === 'group' ? item.node : null;
317
+ const alts = item.lines.flatMap((ref)=>{
318
+ const entry = doc.blocks[ref];
319
+ return (entry == null ? void 0 : entry.kind) === 'image' && clean(entry.alt) ? [
320
+ `"${short(clean(entry.alt), 40)}"`
321
+ ] : [];
322
+ });
323
+ return `${item.ref}${must} (a gallery of ${(_ref = node == null ? void 0 : node.items.length) != null ? _ref : 0} photos, drawn as a grid${(node == null ? void 0 : node.columns) ? ` ${node.columns} across` : ''}${alts.length ? `: ${alts.slice(0, 4).join(', ')}${alts.length > 4 ? ', …' : ''}` : ''})`;
324
+ }
325
+ case 'tabs':
326
+ return `${item.ref}${must} (tabs: ${short(words.slice(0, 4).join(', '), 120)})`;
327
+ case 'group':
328
+ {
329
+ var _ref1, _ref2, _ref3;
330
+ var _item_node3, _item_holds;
331
+ const node = ((_item_node3 = item.node) == null ? void 0 : _item_node3.kind) === 'group' ? item.node : null;
332
+ // Each item by its first line that says something in words: a step's number is no title.
333
+ const titles = ((_ref1 = node == null ? void 0 : node.items) != null ? _ref1 : []).map((entry)=>textOf(doc.blocks[entry.lines.find((ref)=>RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}]", "u").test(textOf(doc.blocks[ref])))])).filter(Boolean);
334
+ const linked = ((_ref2 = node == null ? void 0 : node.items) != null ? _ref2 : []).filter((entry)=>entry.to || entry.lines.some((ref)=>{
335
+ var _doc_blocks_ref;
336
+ return ((_doc_blocks_ref = doc.blocks[ref]) == null ? void 0 : _doc_blocks_ref.kind) === 'link';
337
+ })).length;
338
+ const kind = (node == null ? void 0 : node.group) === 'text' || !node ? 'like items' : node.group;
339
+ const shown = titles.slice(0, item.folded ? 16 : 6).map((title)=>`"${short(title, 40)}"`).join(', ');
340
+ return `${item.ref}${must} (${(_ref3 = node == null ? void 0 : node.items.length) != null ? _ref3 : 0} ${kind}${linked ? `, ${linked} linked` : ''}: ${shown}${titles.length > (item.folded ? 16 : 6) ? ', …' : ''}${((_item_holds = item.holds) == null ? void 0 : _item_holds.length) ? `; holds ${item.holds.join(', ')}` : ''})`;
341
+ }
342
+ default:
343
+ return `${item.ref}${must} (${short(words.join(' '), 160)})`;
344
+ }
345
+ }
346
+ /**
347
+ * A page's ledger as its answer reads it (AGL-4152): what it may place, where
348
+ * each link goes, and every line it rewrites, numbered. Uncached, per page, and
349
+ * fenced by the prompt: every word of it is the owner's.
350
+ */ export function aiSiteImportLedgerText(ledger, doc, destinations) {
351
+ // A link a folded group holds goes where it went by its keep: it is not listed again.
352
+ const folded = new Set(ledger.items.flatMap((item)=>item.folded ? item.lines : []));
353
+ const links = ledger.links.flatMap((link)=>{
354
+ const to = destinations.get(link.ref);
355
+ return to && !folded.has(link.line) ? [
356
+ `${link.ref} → ${to} ("${short(link.text, 60)}")`
357
+ ] : [];
358
+ });
359
+ // A long page shows each group by its titles alone, kept whole: what is around them is written (AGL-4152).
360
+ const lines = ledger.folded ? ledger.lines.filter((line)=>!line.group) : ledger.lines;
361
+ return [
362
+ ...ledger.folded ? [
363
+ 'This page is long: its groups are folded, each shown by its titles and kept whole with keep.'
364
+ ] : [],
365
+ 'Things to place with keep, each once; "must" may not be left out:',
366
+ ...ledger.items.length ? ledger.items.map((item)=>shownItem(item, doc)) : [
367
+ '(none)'
368
+ ],
369
+ '',
370
+ 'Links that must go somewhere on the page:',
371
+ ...links.length ? links : [
372
+ '(none)'
373
+ ],
374
+ '',
375
+ 'The lines of the old page, by section, which you rewrite as the page needs:',
376
+ ...lines.map((line)=>`[${line.line}] section ${line.section + 1}, ${line.kind}${line.group && !ledger.folded ? ` in ${line.group}` : ''}: ${line.text}`)
377
+ ].join('\n');
378
+ }
379
+ /** Everywhere a link may go on this page, as an answer writes it, each with the destination it means. */ export function aiSiteImportImproveDestinations(doc, ledger, input = {}) {
380
+ var _doc_siteLines, _input_sections;
381
+ var _exec, _exec1;
382
+ const scope = {
383
+ doc,
384
+ pathTo: new Map(doc.links.map((link)=>[
385
+ link.path.replace(/\/+$/, '') || '/',
386
+ link.id
387
+ ]))
388
+ };
389
+ const out = new Map();
390
+ for (const link of ledger.links){
391
+ const to = aiSiteImportLinkTo(scope, link.href);
392
+ if (to) {
393
+ out.set(link.ref, to);
394
+ out.set(to, to);
395
+ }
396
+ }
397
+ for (const page of doc.links)out.set(`page:${page.id}`, `page:${page.id}`);
398
+ // A new page has no contact line of its own: it may send a visitor to what the site gives (AGL-4152).
399
+ const text = [
400
+ ...doc.blocks.map((block)=>block.kind === 'image' ? '' : block.text),
401
+ ...doc.proposed ? (_doc_siteLines = doc.siteLines) != null ? _doc_siteLines : [] : []
402
+ ].join(' \n ');
403
+ const phone = (_exec = /(?:\+\d{1,3}[\s.-]?)?(?:\(\d{2,4}\)[\s.-]?)?\d{2,4}[\s.-]\d{3,4}(?:[\s.-]\d{2,4})?/.exec(text)) == null ? void 0 : _exec[0];
404
+ if (phone && phone.replace(/\D/g, '').length >= 7) out.set('phone', `tel:${phone.replace(/[^\d+]/g, '')}`);
405
+ const email = (_exec1 = RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}._%+-]+@[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}-]+(?:\\.[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}-]+)+", "u").exec(text)) == null ? void 0 : _exec1[0];
406
+ if (email) out.set('email', `mailto:${email}`);
407
+ for (const [key, to] of [
408
+ ...out
409
+ ])if (key === 'phone' || key === 'email') out.set(to, to);
410
+ if (input.formSection !== null && input.formSection !== undefined) out.set('form', `#${input.formSection + 1}`);
411
+ for(let n = 1; n <= ((_input_sections = input.sections) != null ? _input_sections : 0); n += 1)out.set(`#${n}`, `#${n}`);
412
+ return out;
413
+ }
414
+ /** A redesign's user turn: the page, its kind of site, how its opening is drawn, and its ledger, fenced as the owner's data. */ export function aiSiteImportImprovePrompt(input) {
415
+ var _input_roleLines;
416
+ return [
417
+ `Page: "${input.screen.title}" at ${input.screen.slug}`,
418
+ // A page the site's plan proposed: there is no old page to keep, so it is written whole from what the site says.
419
+ ...input.doc.proposed ? [
420
+ 'This page is new: the site has no such page yet. Its one line says what it tells a visitor. Write it from what the site says of itself and what this kind of business generally does, inventing no fact.'
421
+ ] : [],
422
+ ...(_input_roleLines = input.roleLines) != null ? _input_roleLines : [],
423
+ ...input.kindLines,
424
+ "The page's ledger, what it holds and where it links:",
425
+ fenceUntrustedText(`The owner's page ${input.doc.url}`, aiSiteImportLedgerText(input.ledger, input.doc, input.destinations), {
426
+ maxChars: AI_SITE_IMPORT_LEDGER_MAX_CHARS
427
+ }),
428
+ `Design seed: ${input.seed}.`
429
+ ].join('\n');
430
+ }
431
+ /*------------------------------------------
432
+ * What the page is for, and what it needs
433
+ *-----------------------------------------*/ /**
434
+ * How many new sections a page of each role is asked for (AGL-4152): a home
435
+ * or a main service page two, a contact page none, its form framed instead.
436
+ */ export const AI_SITE_IMPORT_NEW_SECTIONS = {
437
+ home: 2,
438
+ service: 2,
439
+ about: 1,
440
+ gallery: 1,
441
+ pricing: 1,
442
+ other: 1,
443
+ contact: 0,
444
+ faq: 0
445
+ };
446
+ /** The most sections a redesigned page runs to: a page the source already fills has no room for more. */ export const AI_SITE_IMPORT_IMPROVE_MOST_SECTIONS = 10;
447
+ /** What a page is for, as its plan says, else from its address and what it holds. */ export function aiSiteImportPageRoleOf(doc, slug) {
448
+ if (doc.role) return doc.role;
449
+ if (slug === '/' || slug === '') return 'home';
450
+ const words = `${slug} ${doc.title}`.toLowerCase();
451
+ if (/\b(?:faq|faqs|questions)\b/.test(words)) return 'faq';
452
+ if (/\b(?:contact|visit|find-us|location|book|booking|estimate|quote)\b/.test(words)) return 'contact';
453
+ if (/\b(?:about|story|team|people)\b/.test(words)) return 'about';
454
+ if (/\b(?:pricing|prices|rates|plans)\b/.test(words)) return 'pricing';
455
+ if (/\b(?:gallery|portfolio|projects|work)\b/.test(words)) return 'gallery';
456
+ if (doc.proposed) return 'other';
457
+ return 'service';
458
+ }
459
+ /** How many new sections a page is asked for: its role's, where the page has room, and none on a long page, whose groups fold. */ export function aiSiteImportNewSectionsWanted(role, ledger, proposed = false) {
460
+ if (proposed || ledger.folded) return 0;
461
+ const sections = new Set([
462
+ ...ledger.lines.map((line)=>line.section),
463
+ ...ledger.items.map((item)=>item.section)
464
+ ]).size;
465
+ return Math.max(0, Math.min(AI_SITE_IMPORT_NEW_SECTIONS[role], AI_SITE_IMPORT_IMPROVE_MOST_SECTIONS - 1 - sections));
466
+ }
467
+ /** What each role's page tells, in the order a designer would tell it. */ const ROLE_PLAN = {
468
+ home: 'the front door of the site: the hero, what the business offers, why choose it, how it works, the questions people ask, and the closing band',
469
+ service: 'what the service is: the hero, what is included as cards, how it works as steps, why choose it, the questions people ask about it, and the closing band',
470
+ about: 'the story and the people: the hero, the story beside a picture, what the business values or why choose it as cards, a kept quote where the ledger has one, and the closing band',
471
+ contact: 'how to reach the business: a short, welcoming opening, the form on a framed ground beside how to reach it, what happens after a visitor writes where the site says so, and no closing band',
472
+ gallery: 'the work in pictures: the hero, the pictures in rows with short captions, what the work is, and the closing band',
473
+ pricing: 'the prices, exactly as kept: the hero, the plans or table kept whole, what is included, the questions people ask about paying, and the closing band',
474
+ faq: 'the questions: a short opening, the questions as a faq, and the closing band',
475
+ other: 'what the page is for: the hero, its content drawn as groups and pictures, and the closing band'
476
+ };
477
+ /** The lines a redesign's request says of its page's role and what it needs (AGL-4152). */ export function aiSiteImportImproveRoleLines(input) {
478
+ var _input_kind;
479
+ const { role, wanted } = input;
480
+ // A home tells its story as a site start's does (`ai-site-home-arcs.ts`), one of its kind's arcs by the job's seed.
481
+ const arc = role === 'home' ? aiSiteHomeArc({
482
+ kind: (_input_kind = input.kind) != null ? _input_kind : null,
483
+ seed: input.seed
484
+ }) : null;
485
+ return [
486
+ `This page's role: ${role}, ${ROLE_PLAN[role]}.`,
487
+ ...arc ? [
488
+ `This home tells its story in this order, after the hero: ${arc.sections.map((section)=>section.words).join('; ')}. Where it says the brief, read what the site says. Fold the old page's sections into these, and keep the order.`
489
+ ] : [],
490
+ wanted ? `It needs at least ${wanted} new ${wanted === 1 ? 'section' : 'sections'}: ${wanted === 1 ? 'one' : 'sections'} the old page has nowhere, for this role.` : input.folded ? 'It is long: plan its order and its grounds, keep its groups whole, and add nothing it does not need.' : 'It needs no new section; organize and draw what it has.'
491
+ ];
492
+ }
493
+ /**
494
+ * The sections a redesign added (AGL-4152), by index: neither the opening nor
495
+ * a closing band, holding nothing kept but a picture, saying something of
496
+ * its own, and the rework of no section of the old page. Each section of the
497
+ * old page past its opening is reworked by the one section that says most
498
+ * of it; another section drawing on its words, such as a why-us of the
499
+ * opening's facts, is new.
500
+ */ export function aiSiteImportImproveNewSections(answer, ledger) {
501
+ var _sources_get;
502
+ const kinds = new Map(ledger.items.map((item)=>[
503
+ item.ref,
504
+ item.kind
505
+ ]));
506
+ const sources = new Map();
507
+ for (const line of ledger.lines)sources.set(line.section, [
508
+ ...(_sources_get = sources.get(line.section)) != null ? _sources_get : [],
509
+ line.text
510
+ ]);
511
+ const said = answer.map((section)=>section.blocks.flatMap((block)=>{
512
+ var _block_text, _block_items;
513
+ return block.kind === 'keep' ? [] : [
514
+ block.kind === 'image' ? '' : (_block_text = block.text) != null ? _block_text : '',
515
+ ...((_block_items = block.items) != null ? _block_items : []).flatMap((item)=>[
516
+ item.title,
517
+ item.text
518
+ ])
519
+ ];
520
+ }).join(' '));
521
+ const reworked = new Set();
522
+ // The old page's opening is the new page's: a section drawing on its facts, such as a why-us, is new.
523
+ for (const [at, lines] of sources){
524
+ if (at === 0) continue;
525
+ const text = lines.join(' ');
526
+ let best = -1;
527
+ let most = 0.5;
528
+ said.forEach((words, index)=>{
529
+ const kept = siteImportContentKept(text, words);
530
+ if (kept >= most) {
531
+ most = kept;
532
+ best = index;
533
+ }
534
+ });
535
+ if (best >= 0) reworked.add(best);
536
+ }
537
+ const last = answer.length - 1;
538
+ return answer.flatMap((section, index)=>{
539
+ if (index === 0 || reworked.has(index)) return [];
540
+ if (section.blocks.some((block)=>block.kind === 'keep' && kinds.get(block.ref) !== 'picture')) return [];
541
+ const groups = section.blocks.filter((block)=>{
542
+ var _ref;
543
+ var _block_items;
544
+ return block.kind !== 'keep' && ((_ref = (_block_items = block.items) == null ? void 0 : _block_items.length) != null ? _ref : 0) >= 2;
545
+ });
546
+ const words = section.blocks.filter((block)=>block.kind === 'text' || block.kind === 'lede');
547
+ // A closing band: a heading, a line at most and a button, last.
548
+ if (index === last && !groups.length && words.length <= 1 && section.blocks.some((block)=>block.kind === 'button')) return [];
549
+ return groups.length || words.length ? [
550
+ index
551
+ ] : [];
552
+ });
553
+ }
554
+ /** A section's shape, as a designer tells sections apart: what the variety of a page is counted in. */ function shapeOf(section, kinds) {
555
+ const kept = section.blocks.flatMap((block)=>{
556
+ var _kinds_get;
557
+ return block.kind === 'keep' ? [
558
+ (_kinds_get = kinds.get(block.ref)) != null ? _kinds_get : ''
559
+ ] : [];
560
+ });
561
+ const pictures = kept.filter((kind)=>kind === 'picture').length + section.blocks.filter((block)=>block.kind === 'image').length;
562
+ const group = section.blocks.find((block)=>{
563
+ var _ref;
564
+ var _block_items;
565
+ return block.kind !== 'keep' && ((_ref = (_block_items = block.items) == null ? void 0 : _block_items.length) != null ? _ref : 0) >= 2;
566
+ });
567
+ if (kept.includes('form')) return 'form';
568
+ if (kept.includes('quote')) return 'quote';
569
+ if (group) return group.kind;
570
+ const whole = kept.find((kind)=>kind !== 'picture' && kind !== 'contact');
571
+ if (whole) return whole;
572
+ if (pictures >= 2) return 'pictures';
573
+ if (pictures && section.cols) return 'split';
574
+ return section.blocks.some((block)=>block.kind === 'button') && !section.blocks.some((block)=>block.kind === 'text') ? 'band' : 'words';
575
+ }
576
+ /** The fewest shapes a page of four sections or more is drawn in. */ export const AI_SITE_IMPORT_IMPROVE_LEAST_SHAPES = 3;
577
+ /** Roles whose opening holds a picture. */ const PICTURED_OPENINGS = new Set([
578
+ 'home',
579
+ 'service',
580
+ 'about',
581
+ 'gallery',
582
+ 'other'
583
+ ]);
584
+ /**
585
+ * Whether a redesign is planned as a designer's page (AGL-4152), answer by
586
+ * answer: the new sections its role asks for, a picture in its opening, and
587
+ * sections drawn in more than one or two shapes. Each miss is named for the
588
+ * one re-ask.
589
+ */ export function aiSiteImportImprovePlanMisses(answer, input) {
590
+ var _ref;
591
+ var _answer_;
592
+ const out = [];
593
+ const added = aiSiteImportImproveNewSections(answer, input.ledger);
594
+ if (added.length < input.needs.wanted) {
595
+ out.push({
596
+ rule: null,
597
+ code: 'improve-new-sections',
598
+ message: `The page adds ${added.length} new ${added.length === 1 ? 'section' : 'sections'}; as a ${input.needs.role} page it needs at least ${input.needs.wanted}: sections the old page has nowhere, such as how it works as steps, why choose it as cards, or the questions people ask as a faq, written from what the site says.`
599
+ });
600
+ }
601
+ const opening = (_ref = (_answer_ = answer[0]) == null ? void 0 : _answer_.blocks) != null ? _ref : [];
602
+ if (PICTURED_OPENINGS.has(input.needs.role) && !opening.some((block)=>block.kind === 'image' || block.kind === 'keep' && block.ref.startsWith('picture:'))) {
603
+ out.push({
604
+ rule: null,
605
+ code: 'improve-opening',
606
+ message: "The opening has no picture. Place the page's own picture there with keep, or an image block, beside the words or behind them."
607
+ });
608
+ }
609
+ const kinds = new Map(input.ledger.items.map((item)=>[
610
+ item.ref,
611
+ item.kind
612
+ ]));
613
+ const shapes = new Set(answer.slice(1).map((section)=>shapeOf(section, kinds)));
614
+ if (answer.length >= 4 && shapes.size < AI_SITE_IMPORT_IMPROVE_LEAST_SHAPES) {
615
+ out.push({
616
+ rule: null,
617
+ code: 'improve-shapes',
618
+ message: `The sections after the opening are drawn in ${shapes.size === 1 ? 'one shape' : `${shapes.size} shapes`}. Vary them: a card grid, steps, words beside a picture, a row of pictures, a faq, a quote on its own ground, a closing band.`
619
+ });
620
+ }
621
+ return out;
622
+ }
623
+ /*------------------------------------------
624
+ * The answer read
625
+ *-----------------------------------------*/ /** A redesign's answer, read by position: `null` where it gave no section it can draw. */ export function aiReadImprovedPage(raw, settled = []) {
626
+ const given = raw && typeof raw === 'object' && Array.isArray(raw['sections']) ? raw['sections'] : null;
627
+ if (!given) return null;
628
+ const sections = [];
629
+ given.forEach((entry, index)=>{
630
+ const section = entry && typeof entry === 'object' ? entry : null;
631
+ if (!section) return;
632
+ const cols = Array.isArray(section['cols']) ? section['cols'].filter((value)=>typeof value === 'number' && Number.isFinite(value) && value > 0).slice(0, AI_LAYOUT_MAX_COLS).map((value)=>Math.min(12, Math.max(1, Math.round(value)))) : [];
633
+ const blocks = [];
634
+ (Array.isArray(section['blocks']) ? section['blocks'] : []).forEach((raw, position)=>{
635
+ const entry = raw && typeof raw === 'object' ? raw : null;
636
+ if (!entry) return;
637
+ const col = typeof entry['col'] === 'number' && Number.isInteger(entry['col']) && entry['col'] >= 0 && cols.length >= 2 ? Math.min(entry['col'], cols.length - 1) : undefined;
638
+ if (entry['kind'] === 'keep') {
639
+ const ref = clean(entry['ref']);
640
+ if (ref) blocks.push(_extends({
641
+ kind: 'keep',
642
+ ref
643
+ }, col !== undefined ? {
644
+ col
645
+ } : {}));
646
+ return;
647
+ }
648
+ const block = aiReadLayoutBlock(entry, `sections[${index}].blocks[${position}]`, settled, {
649
+ mostItems: AI_SITE_IMPORT_IMPROVE_MAX_ITEMS
650
+ });
651
+ if (!block) return;
652
+ const { col: _col } = block, rest = _object_without_properties_loose(block, [
653
+ "col"
654
+ ]);
655
+ blocks.push(_extends({}, rest, col !== undefined ? {
656
+ col
657
+ } : {}));
658
+ });
659
+ if (!blocks.length) return;
660
+ const band = AI_LAYOUT_BANDS.find((value)=>value === section['band']);
661
+ const align = AI_LAYOUT_ALIGNS.find((value)=>value === section['align']);
662
+ sections.push(_extends({}, band ? {
663
+ band
664
+ } : {}, cols.length >= 2 ? {
665
+ cols
666
+ } : {}, align ? {
667
+ align
668
+ } : {}, {
669
+ blocks
670
+ }));
671
+ });
672
+ return sections.length ? sections : null;
673
+ }
674
+ /*------------------------------------------
675
+ * The answer in the compiler's language
676
+ *-----------------------------------------*/ /** The site's hero as a page brought in draws it: a collage or a portrait holds what a page brought in does not. */ export function aiSiteImportImproveHero(design, plan) {
677
+ var _ref;
678
+ const chosen = (_ref = plan == null ? void 0 : plan.design.hero) != null ? _ref : aiLayoutDesignChoices(design).hero;
679
+ return chosen === 'collage' || chosen === 'portrait' ? 'split' : chosen;
680
+ }
681
+ /** How many of a group's items sit across: planned for how much each says. */ export function aiSiteImportImproveColumns(items) {
682
+ const count = items.length;
683
+ if (count <= 3) return count;
684
+ const longest = Math.max(...items.map((item)=>item.text.length));
685
+ if (count === 4) return longest > 110 ? 2 : 4;
686
+ return 3;
687
+ }
688
+ const WORD_KINDS = new Set([
689
+ 'eyebrow',
690
+ 'heading',
691
+ 'lede',
692
+ 'text',
693
+ 'note',
694
+ 'button'
695
+ ]);
696
+ /** The longest quote a kept set of quotes sets side by side. */ const QUOTE_ACROSS_CHARS = 220;
697
+ /** The frame a source's picture is cropped to where a redesign places it: wide across the page, closer in a column. */ const FRAME = {
698
+ wide: '16 / 9',
699
+ column: '4 / 3'
700
+ };
701
+ /** The sections' names: each heading's words, as a label, told apart. */ function sectionNames(sections, title) {
702
+ const taken = new Set();
703
+ return sections.map((section, index)=>{
704
+ var _section_blocks_find;
705
+ const heading = (_section_blocks_find = section.blocks.find((block)=>block.kind === 'heading' && block.text)) == null ? void 0 : _section_blocks_find.text;
706
+ const base = siteImportLabel(heading != null ? heading : '') || (index === 0 ? siteImportLabel(title) : '') || `Section ${index + 1}`;
707
+ let name = base;
708
+ for(let at = 2; taken.has(name.toLowerCase()); at += 1)name = `${base.slice(0, 50)} (${at})`;
709
+ taken.add(name.toLowerCase());
710
+ return name;
711
+ });
712
+ }
713
+ /** The sections a redesign holds, in the compiler's language: every `keep` expanded to the source's own blocks, every link resolved. */ export function aiSiteImportImprovedPage(answer, input) {
714
+ const { doc, ledger, design, destinations } = input;
715
+ const scope = aiSiteImportMapScope(doc, {
716
+ formId: input.formId,
717
+ finish: 'improve'
718
+ });
719
+ const items = new Map(ledger.items.map((item)=>[
720
+ item.ref,
721
+ item
722
+ ]));
723
+ const choices = aiLayoutDesignChoices(design);
724
+ const written = [];
725
+ // A brand band in a brand the theme had to deepen would read as neither: dark holds its place.
726
+ const deepened = !!input.theme && !!input.theme.button.fill && input.theme.button.fill !== input.theme.light.brand;
727
+ const resolve = (to)=>{
728
+ var _destinations_get;
729
+ if (!to) return undefined;
730
+ return (_destinations_get = destinations.get(to)) != null ? _destinations_get : undefined;
731
+ };
732
+ const say = (text)=>{
733
+ if (text == null ? void 0 : text.trim()) written.push(clean(text));
734
+ };
735
+ const pictureOf = (ref, frame)=>{
736
+ const item = items.get(ref);
737
+ if ((item == null ? void 0 : item.kind) !== 'picture') return null;
738
+ const picture = aiSiteImportTakePicture(scope, item.lines[0]);
739
+ return picture ? _extends({}, picture, {
740
+ fit: {
741
+ ratio: frame,
742
+ cropped: true,
743
+ objectFit: 'cover',
744
+ rounded: true
745
+ }
746
+ }) : null;
747
+ };
748
+ // A few short quotes kept whole sit side by side, as a designer sets them, wherever the old page stacked them; in a column, one under another.
749
+ const across = (block, inColumn)=>{
750
+ var _block_items;
751
+ const items = (_block_items = block.items) != null ? _block_items : [];
752
+ if (block.kind !== 'quotes' || inColumn || items.length < 2 || items.length > 4 || items.some((entry)=>entry.title.length > QUOTE_ACROSS_CHARS)) return {};
753
+ return {
754
+ columns: Math.min(3, items.length)
755
+ };
756
+ };
757
+ const keepOf = (ref, col)=>{
758
+ const item = items.get(ref);
759
+ if (!item) return [];
760
+ const placed = col !== undefined ? {
761
+ col
762
+ } : {};
763
+ if (item.kind === 'picture') {
764
+ const picture = pictureOf(ref, col !== undefined ? FRAME.column : FRAME.wide);
765
+ return picture ? [
766
+ _extends({
767
+ kind: 'image',
768
+ picture
769
+ }, placed)
770
+ ] : [];
771
+ }
772
+ if (!item.node) return [];
773
+ scope.answer = null;
774
+ scope.groupAt = 0;
775
+ return aiSiteImportNodeBlocks(scope, [
776
+ item.node
777
+ ], {
778
+ cols: null,
779
+ allowed: false
780
+ }).map((block)=>_extends({}, block, placed, across(block, col !== undefined)));
781
+ };
782
+ const sections = answer.map((section, index)=>{
783
+ scope.at = `sections[${index}]`;
784
+ const words = section.blocks.flatMap((block)=>{
785
+ var _block_text;
786
+ return block.kind === 'heading' || block.kind === 'eyebrow' ? [
787
+ (_block_text = block.text) != null ? _block_text : ''
788
+ ] : [];
789
+ }).join(' ');
790
+ const blocks = section.blocks.flatMap((raw)=>{
791
+ var _block_items;
792
+ if (raw.kind === 'keep') return keepOf(raw.ref, raw.col);
793
+ const block = raw;
794
+ const placed = block.col !== undefined ? {
795
+ col: block.col
796
+ } : {};
797
+ if (block.kind === 'image') {
798
+ const { col: _col } = block, rest = _object_without_properties_loose(block, [
799
+ "col"
800
+ ]);
801
+ return [
802
+ _extends({}, rest, placed)
803
+ ];
804
+ }
805
+ if (block.kind === 'text' || block.kind === 'lede' || block.kind === 'note') {
806
+ var _block_text;
807
+ say(block.text);
808
+ return aiSiteImportTextParts((_block_text = block.text) != null ? _block_text : '').map((part)=>_extends({}, block, {
809
+ text: part
810
+ }));
811
+ }
812
+ if (block.kind === 'heading' || block.kind === 'eyebrow') {
813
+ say(block.text);
814
+ return [
815
+ block
816
+ ];
817
+ }
818
+ if (block.kind === 'button') {
819
+ say(block.text);
820
+ const to = resolve(block.to);
821
+ const { to: _asked } = block, rest = _object_without_properties_loose(block, [
822
+ "to"
823
+ ]);
824
+ return [
825
+ _extends({}, rest, to ? {
826
+ to
827
+ } : {})
828
+ ];
829
+ }
830
+ const groupItems = ((_block_items = block.items) != null ? _block_items : []).map((item, at)=>{
831
+ say(item.title);
832
+ say(item.text);
833
+ const picture = item.ref ? pictureOf(item.ref, '4 / 3') : null;
834
+ const to = resolve(item.to);
835
+ const { ref: _ref, to: _to } = item, rest = _object_without_properties_loose(item, [
836
+ "ref",
837
+ "to"
838
+ ]);
839
+ return _extends({}, rest, block.kind === 'steps' ? {
840
+ figure: String(at + 1)
841
+ } : {}, picture ? {
842
+ picture
843
+ } : {}, to ? {
844
+ to
845
+ } : {});
846
+ });
847
+ if (block.kind === 'list') return [
848
+ _extends({}, block, {
849
+ items: groupItems,
850
+ columns: groupItems.length >= 6 ? 2 : 1
851
+ })
852
+ ];
853
+ if (block.kind === 'faq') return [
854
+ _extends({}, block, {
855
+ items: groupItems,
856
+ columns: 1
857
+ })
858
+ ];
859
+ const pictured = groupItems.every((item)=>item.picture);
860
+ const iconed = groupItems.every((item)=>item.icon);
861
+ const wanted = aiLayoutGroupVariant(design, choices, words);
862
+ const variant = pictured ? choices.group === 'cards' ? 'articles' : 'pictures' : wanted === 'icons' && !iconed ? 'cards' : wanted === 'menu' || wanted === 'pictures' || wanted === 'articles' ? 'cards' : wanted;
863
+ return [
864
+ _extends({}, block, {
865
+ items: groupItems,
866
+ columns: aiSiteImportImproveColumns(groupItems),
867
+ variant
868
+ })
869
+ ];
870
+ });
871
+ const pictures = blocks.filter((block)=>block.kind === 'image' || block.kind === 'video');
872
+ const opens = index === 0 && pictures.length === 1 && blocks.every((block)=>block.kind === 'image' || block.kind === 'video' || WORD_KINDS.has(block.kind));
873
+ const hero = opens ? aiSiteImportImproveHero(design, input.plan) : null;
874
+ const band = section.band === 'brand' && deepened ? 'dark' : section.band;
875
+ return _extends({}, band ? {
876
+ band
877
+ } : {}, section.align ? {
878
+ align: section.align
879
+ } : {}, section.cols && !hero ? {
880
+ cols: section.cols
881
+ } : {}, hero ? {
882
+ hero,
883
+ blocks: blocks.map((block)=>block.kind === 'image' && block.picture ? _extends({}, block, {
884
+ picture: _extends({}, block.picture, {
885
+ fit: undefined
886
+ })
887
+ }) : block)
888
+ } : {
889
+ blocks
890
+ });
891
+ });
892
+ const names = sectionNames(sections, doc.title);
893
+ const added = aiSiteImportImproveNewSections(answer, ledger).map((index)=>{
894
+ var _sections_index, _group_items;
895
+ const group = (_sections_index = sections[index]) == null ? void 0 : _sections_index.blocks.find((block)=>{
896
+ var _block_items;
897
+ return (_block_items = block.items) == null ? void 0 : _block_items.length;
898
+ });
899
+ return _extends({
900
+ heading: names[index]
901
+ }, (group == null ? void 0 : (_group_items = group.items) == null ? void 0 : _group_items.length) ? {
902
+ items: group.items.length
903
+ } : {});
904
+ });
905
+ const placed = new Set(aiSiteImportImprovedPlaced(answer, ledger));
906
+ const allPictures = ledger.items.filter((item)=>item.kind === 'picture');
907
+ const unplaced = allPictures.filter((item)=>!placed.has(item.ref)).flatMap((item)=>{
908
+ const block = doc.blocks[item.lines[0]];
909
+ return (block == null ? void 0 : block.kind) === 'image' ? [
910
+ block.url
911
+ ] : [];
912
+ });
913
+ return {
914
+ given: {
915
+ sections,
916
+ used: scope.used,
917
+ missing: scope.missing,
918
+ settled: scope.settled
919
+ },
920
+ names,
921
+ written,
922
+ added,
923
+ pictures: {
924
+ source: allPictures.length - unplaced.length,
925
+ stock: 0,
926
+ generated: 0,
927
+ slots: sections.reduce((total, section)=>total + section.blocks.filter((block)=>block.kind === 'image' && !block.picture).length, 0),
928
+ unplaced
929
+ }
930
+ };
931
+ }
932
+ /*------------------------------------------
933
+ * The check
934
+ *-----------------------------------------*/ /** The most an answer may ask for, whatever the page and the model: a whole page's design and words, with its thinking. */ export const AI_SITE_IMPORT_IMPROVE_MOST_TOKENS = 8000;
935
+ /**
936
+ * Room a page's ceiling keeps for its listing pass (AGL-4152): its p90 is 1,
937
+ * and it runs a model only where the source left the listing empty.
938
+ */ export const AI_SITE_IMPORT_LISTING_ROOM_CREDITS = 10;
939
+ /**
940
+ * What a page's redesign may spend, its answer and its re-ask together
941
+ * (AGL-4152): the page's ceiling, less its listing pass's room. Held in code
942
+ * (`aiSiteImportImproveTokensWithin`): an answer asks no more than the
943
+ * ceiling buys, and a re-ask it cannot pay for is not asked.
944
+ */ export const AI_SITE_IMPORT_IMPROVE_CEILING_CREDITS = AI_SITE_IMPORT_PAGE_CEILING_CREDITS - AI_SITE_IMPORT_LISTING_ROOM_CREDITS;
945
+ /** Characters a token is counted at, before a request is sent: fewer than the text runs, so a guess is never under. */ const CHARS_PER_TOKEN = 3;
946
+ const ZERO = {
947
+ inputTokens: 0,
948
+ outputTokens: 0,
949
+ cacheReadTokens: 0,
950
+ cacheWriteTokens: 0
951
+ };
952
+ const plus = (a, b)=>({
953
+ inputTokens: a.inputTokens + b.inputTokens,
954
+ outputTokens: a.outputTokens + b.outputTokens,
955
+ cacheReadTokens: a.cacheReadTokens + b.cacheReadTokens,
956
+ cacheWriteTokens: a.cacheWriteTokens + b.cacheWriteTokens
957
+ });
958
+ /** What a request reads before it is sent, at worst: its system blocks written to the cache, its turn as input. */ export function aiSiteImportImproveInputUsage(input) {
959
+ return _extends({}, ZERO, {
960
+ inputTokens: Math.ceil(input.promptChars / CHARS_PER_TOKEN),
961
+ cacheWriteTokens: Math.ceil(input.systemChars / CHARS_PER_TOKEN)
962
+ });
963
+ }
964
+ /** What a usage is billed in credits on a model. */ export function aiSiteImportImproveCredits(usage, model) {
965
+ return assistCreditsFromUsd(estimateAiBilledUsd(usage, model));
966
+ }
967
+ /**
968
+ * The most output tokens a request may write (AGL-4152) with `spent` already
969
+ * spent and `input` still to read, and stay inside `ceiling` credits; at
970
+ * most `most`, and 0 where its reading alone would pass the ceiling.
971
+ */ export function aiSiteImportImproveTokensWithin(input) {
972
+ var _input_ceiling;
973
+ const ceiling = (_input_ceiling = input.ceiling) != null ? _input_ceiling : AI_SITE_IMPORT_IMPROVE_CEILING_CREDITS;
974
+ const before = plus(input.spent, input.input);
975
+ const fits = (tokens)=>aiSiteImportImproveCredits(_extends({}, before, {
976
+ outputTokens: before.outputTokens + tokens
977
+ }), input.model) <= ceiling;
978
+ if (!fits(0)) return 0;
979
+ let low = 0;
980
+ let high = Math.max(0, Math.floor(input.most));
981
+ while(low < high){
982
+ const mid = Math.ceil((low + high) / 2);
983
+ if (fits(mid)) low = mid;
984
+ else high = mid - 1;
985
+ }
986
+ return low;
987
+ }
988
+ /** The least share of the last answer's length a re-ask must have room for: less, and it would be cut off. */ export const AI_SITE_IMPORT_REASK_ROOM = 0.9;
989
+ /** What a re-ask reads beyond its first request: the re-ask's own words naming what missed. */ const REASK_TOKENS = 600;
990
+ /**
991
+ * Whether a redesign's re-ask fits its page's ceiling (AGL-4152): the most
992
+ * tokens it may ask, given what the first answer spent, or 0 where the room
993
+ * left is under what the first answer wrote, and the page falls back with
994
+ * no re-ask rather than pass its ceiling.
995
+ */ export function aiSiteImportImproveReaskTokens(input) {
996
+ // The re-ask reads what the first request read, its system now from the cache at worst at the write's rate, and the re-ask's words.
997
+ const again = _extends({}, ZERO, {
998
+ inputTokens: input.spent.inputTokens + REASK_TOKENS,
999
+ cacheReadTokens: input.spent.cacheReadTokens,
1000
+ cacheWriteTokens: input.spent.cacheWriteTokens
1001
+ });
1002
+ const room = aiSiteImportImproveTokensWithin(_extends({
1003
+ model: input.model,
1004
+ spent: input.spent,
1005
+ input: again,
1006
+ most: input.most
1007
+ }, input.ceiling !== undefined ? {
1008
+ ceiling: input.ceiling
1009
+ } : {}));
1010
+ return room >= Math.ceil(input.lastOutput * AI_SITE_IMPORT_REASK_ROOM) ? room : 0;
1011
+ }
1012
+ /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its name. */ export function aiSiteImportImproveScope(doc, siteName) {
1013
+ var _doc_siteLines, _doc_scope;
1014
+ const own = doc.blocks.flatMap((block)=>block.kind === 'image' ? block.alt ? [
1015
+ block.alt
1016
+ ] : [] : block.text ? [
1017
+ block.text
1018
+ ] : []);
1019
+ return [
1020
+ ...own,
1021
+ ...(_doc_siteLines = doc.siteLines) != null ? _doc_siteLines : [],
1022
+ ...(_doc_scope = doc.scope) != null ? _doc_scope : [],
1023
+ doc.title,
1024
+ ...siteName ? [
1025
+ siteName
1026
+ ] : []
1027
+ ].map(clean).filter(Boolean);
1028
+ }
1029
+ /** What each line that missed says to the one re-ask. */ const MISS = {
1030
+ facts: 'The page leaves out a fact the owner gives. Say every name, number, price, date, phone and address the ledger shows.',
1031
+ invented: 'The page says something nothing on the site supports.',
1032
+ held: 'Something the ledger marks must is not on the page. Place it with a keep block.',
1033
+ links: 'A link the ledger lists goes nowhere on the page. Link to it from a button or an item.',
1034
+ meaning: "The page has drifted from what the owner says. Keep more of the old page's substance in the new words.",
1035
+ cta: 'The opening needs a filled primary button with a real destination, and the last section a button or the form: close on a call to action.',
1036
+ rhythm: 'Neighboring sections sit on one ground. Alternate plain and soft, or set one on a strong band.',
1037
+ columns: 'Sections stack like things in one column, or the page draws no group at all. Set a picture beside its words, and three or more like items as cards, steps or a faq.',
1038
+ framing: 'A picture is drawn taller than a screen holds. Set it in a column, or on a card.',
1039
+ contrast: 'A section is drawn on a ground its words do not read on. Choose another band.',
1040
+ phone: 'A section does not hold on a phone. Use the language’s rows and groups, which stack.'
1041
+ };
1042
+ /** A scored redesign's misses, each as the re-ask names it: what is red on its ledger and its design lines. */ export function aiSiteImportImprovedMisses(report) {
1043
+ const improved = report.improved;
1044
+ if (!improved) return [];
1045
+ return improved.red.flatMap((name)=>{
1046
+ var _ref, _ref1, _MISS_name;
1047
+ var _ledger_name, _ledger_name1;
1048
+ if (name === 'frame') return [];
1049
+ const ledger = improved.ledger;
1050
+ const shown = [
1051
+ ...(_ref = (_ledger_name = ledger[name]) == null ? void 0 : _ledger_name.missing) != null ? _ref : [],
1052
+ ...(_ref1 = (_ledger_name1 = ledger[name]) == null ? void 0 : _ledger_name1.found) != null ? _ref1 : []
1053
+ ].map((token)=>token.replace(/^[a-z]+:/, ''));
1054
+ const message = (_MISS_name = MISS[name]) != null ? _MISS_name : `The page falls short on ${name}.`;
1055
+ return [
1056
+ _extends({
1057
+ rule: null,
1058
+ code: `improve-${name}`,
1059
+ message
1060
+ }, shown.length ? {
1061
+ detail: `Named: ${shown.join(', ')}.`
1062
+ } : {})
1063
+ ];
1064
+ });
1065
+ }
1066
+ /** A redesign's read for a page: its ledger, and everywhere a link may go. */ export function aiSiteImportImproveLedger(doc) {
1067
+ return siteImportLedger({
1068
+ layout: aiSiteImportLayoutOf(doc),
1069
+ blocks: doc.blocks
1070
+ });
1071
+ }
1072
+ /**
1073
+ * A redesign's check (AGL-4152), answer by answer: its words and refs held to
1074
+ * what the import read, its page compiled and held to the doctrine as a page
1075
+ * written (`build`), and scored (`score`). Any miss is named for the one
1076
+ * re-ask; a second miss is the caller's fallback.
1077
+ */ export function aiSiteImportImproveCheck(input) {
1078
+ return (answer)=>{
1079
+ var _input_framing, _input_plan, _input_theme;
1080
+ const read = aiReadImprovedPage(answer);
1081
+ if (!read) return {
1082
+ value: null,
1083
+ violations: [
1084
+ {
1085
+ rule: null,
1086
+ code: 'improve-unreadable',
1087
+ message: `The answer gave no section that can be drawn. Answer with ${AI_SITE_IMPORT_IMPROVE_TOOL.name}.`
1088
+ }
1089
+ ]
1090
+ };
1091
+ const formAt = read.findIndex((section)=>section.blocks.some((block)=>block.kind === 'keep' && block.ref.startsWith('form:')));
1092
+ const destinations = aiSiteImportImproveDestinations(input.doc, input.ledger, {
1093
+ sections: read.length,
1094
+ formSection: formAt === -1 ? null : formAt
1095
+ });
1096
+ const honesty = aiSiteImportHonesty(read, {
1097
+ ledger: input.ledger,
1098
+ scope: input.scope,
1099
+ destinations,
1100
+ framing: (_input_framing = input.framing) != null ? _input_framing : null
1101
+ });
1102
+ // What it lost and how it is planned, named together, so the one re-ask mends both.
1103
+ const planned = input.needs ? aiSiteImportImprovePlanMisses(read, {
1104
+ ledger: input.ledger,
1105
+ needs: input.needs
1106
+ }) : [];
1107
+ if (honesty.length || planned.length) return {
1108
+ value: null,
1109
+ violations: [
1110
+ ...honesty,
1111
+ ...planned
1112
+ ]
1113
+ };
1114
+ const page = aiSiteImportImprovedPage(read, {
1115
+ doc: input.doc,
1116
+ ledger: input.ledger,
1117
+ design: input.design,
1118
+ destinations,
1119
+ formId: input.formId,
1120
+ plan: (_input_plan = input.plan) != null ? _input_plan : null,
1121
+ theme: (_input_theme = input.theme) != null ? _input_theme : null
1122
+ });
1123
+ const built = input.build(page);
1124
+ if (!built.value) return {
1125
+ value: null,
1126
+ violations: built.violations
1127
+ };
1128
+ const wanted = input.ledger.links.flatMap((link)=>{
1129
+ const to = destinations.get(link.ref);
1130
+ return to ? [
1131
+ to
1132
+ ] : [];
1133
+ });
1134
+ const missed = input.score(built.value, [
1135
+ ...new Set(wanted)
1136
+ ]);
1137
+ if (missed.length) return {
1138
+ value: null,
1139
+ violations: missed
1140
+ };
1141
+ return {
1142
+ value: {
1143
+ built: built.value,
1144
+ page
1145
+ },
1146
+ violations: []
1147
+ };
1148
+ };
1149
+ }
1150
+
1151
+ //# sourceMappingURL=ai-site-import-improve.js.map