@aglyn/plugins-ai 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/activity/ai-activity.js +4 -2
- package/src/lib/activity/ai-activity.js.map +1 -1
- package/src/lib/components/ai-credits-card.component.d.ts +4 -3
- package/src/lib/components/ai-credits-card.component.js +13 -12
- package/src/lib/components/ai-credits-card.component.js.map +1 -1
- package/src/lib/components/ai-site-import-job.component.js +14 -5
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/components/ai-upsell-dialog.component.d.ts +2 -2
- package/src/lib/components/ai-upsell-dialog.component.js +3 -3
- package/src/lib/components/ai-upsell-dialog.component.js.map +1 -1
- package/src/lib/components/staff-org-ai-card.component.js +2 -2
- package/src/lib/components/staff-org-ai-card.component.js.map +1 -1
- package/src/lib/declarations.d.ts +2 -2
- package/src/lib/declarations.js +10 -9
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +28 -2
- package/src/lib/jobs/ai-job-import-step.js +170 -14
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +2 -0
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.js +6 -2
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +13 -3
- package/src/lib/jobs/ai-site-import-compile.js +339 -27
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +3 -1
- package/src/lib/jobs/ai-site-import-document.js +42 -1
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-look.d.ts +9 -0
- package/src/lib/jobs/ai-site-import-look.js +89 -6
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +16 -0
- package/src/lib/layout-language/ai-layout-compiler.js +378 -56
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +88 -2
- package/src/lib/layout-language/ai-layout-frame-source.js +591 -30
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.js +30 -18
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +74 -3
- package/src/lib/layout-language/ai-layout-language.js +5 -3
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/layout-language/ai-layout-store.d.ts +8 -0
- package/src/lib/layout-language/ai-layout-store.js +32 -6
- package/src/lib/layout-language/ai-layout-store.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +31 -1
- package/src/lib/model/ai-site-import-fidelity.js +347 -25
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-view.js +4 -3
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +205 -6
- package/src/lib/model/ai-site-import.js +161 -5
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +8 -1
- package/src/lib/model/ai-site-look.js +8 -5
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/model/ai-upsell-copy.js +4 -3
- package/src/lib/model/ai-upsell-copy.js.map +1 -1
- package/src/lib/plan-entitlements.d.ts +3 -3
- package/src/lib/plan-entitlements.js +1 -1
- package/src/lib/plan-entitlements.js.map +1 -1
- package/src/lib/providers/model-choice.d.ts +6 -3
- package/src/lib/providers/model-choice.js +8 -4
- package/src/lib/providers/model-choice.js.map +1 -1
- package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -1
- package/src/lib/runtime/ai-doctrine-validators.js +25 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +19 -2
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-page-links.d.ts +15 -0
- package/src/lib/runtime/ai-page-links.js +48 -0
- package/src/lib/runtime/ai-page-links.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +35 -6
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +9 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +24 -5
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-crawl.d.ts +3 -1
- package/src/lib/site-import/site-import-crawl.js +8 -3
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +20 -0
- package/src/lib/site-import/site-import-css.js +106 -0
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +39 -0
- package/src/lib/site-import/site-import-html.js +515 -5
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.d.ts +16 -6
- package/src/lib/site-import/site-import-layout.js +528 -52
- package/src/lib/site-import/site-import-layout.js.map +1 -1
- package/src/lib/site-import/site-import-nav.js +286 -24
- package/src/lib/site-import/site-import-nav.js.map +1 -1
- package/src/lib/site-import/site-import-page.js +3 -0
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/usage/assist-credits.d.ts +5 -4
- package/src/lib/usage/assist-credits.js +5 -4
- package/src/lib/usage/assist-credits.js.map +1 -1
- package/src/lib/usage/staff-org-ai-view.js +6 -6
- package/src/lib/usage/staff-org-ai-view.js.map +1 -1
- package/src/lib/usage/staff-org-ai.d.ts +4 -4
- package/src/lib/usage/staff-org-ai.js +8 -7
- package/src/lib/usage/staff-org-ai.js.map +1 -1
- package/src/lib/usage/staff-org-usage-ai.js +2 -2
- package/src/lib/usage/staff-org-usage-ai.js.map +1 -1
|
@@ -45,6 +45,9 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
45
45
|
* button or a link too); every inline icon, once, by index; every link or
|
|
46
46
|
* button the source draws as a button, filled (`primary`), outlined
|
|
47
47
|
* (`secondary`) or plain (`quiet`).
|
|
48
|
+
* - **Videos (AGL-4140).** Every video where it sits, its poster the picture
|
|
49
|
+
* inside it; a film that plays on its own behind a section's words is that
|
|
50
|
+
* section's backdrop.
|
|
48
51
|
* - **The look.** The fonts (Google Fonts' named), the page's background and
|
|
49
52
|
* text, the buttons' fill and corners, the links' color, the header's
|
|
50
53
|
* background: what the look pass draws the site's theme from.
|
|
@@ -53,7 +56,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
53
56
|
* never the rule: the reader reads what an element draws, through the page's
|
|
54
57
|
* own stylesheets (`site-import-css.ts`). Nothing a page wrote runs.
|
|
55
58
|
*=========================================*/ import { AI_SITE_IMPORT_MAX_SECTIONS, siteImportFilterNodes, siteImportLayoutLines } from "../model/ai-site-import.js";
|
|
56
|
-
import { SITE_IMPORT_CSS_WIDE_WIDTH, siteImportBackgroundOf, siteImportColorOf, siteImportCssOf, siteImportFontFamilies, siteImportFontSizePx, siteImportGridColumns, siteImportHasBorder, siteImportHasShadow, siteImportHex, siteImportLengthPx, siteImportLuminance, siteImportRadiusPx, siteImportSaturation, siteImportStylesOf, siteImportTwelfths } from "./site-import-css.js";
|
|
59
|
+
import { SITE_IMPORT_CSS_WIDE_WIDTH, siteImportAspectRatio, siteImportBackgroundOf, siteImportBorderSides, siteImportColorDistance, siteImportColorOf, siteImportCssOf, siteImportFontFamilies, siteImportFontSizePx, siteImportGridColumns, siteImportHasBorder, siteImportHasShadow, siteImportHex, siteImportLengthPx, siteImportLuminance, siteImportOpaque, siteImportRadiusPx, siteImportSaturation, siteImportStylesOf, siteImportTwelfths } from "./site-import-css.js";
|
|
57
60
|
import { extractSiteImportPage } from "./site-import-html.js";
|
|
58
61
|
import { siteImportLabel } from "./site-import-page.js";
|
|
59
62
|
const isElementPart = (part)=>'element' in part;
|
|
@@ -119,11 +122,17 @@ const BADGE_MIN_RADIUS = 12;
|
|
|
119
122
|
];
|
|
120
123
|
const STEP_NUMBER = /^(?:step\s*)?(?:0?\d{1,2}|[ivx]{1,4})[.):]?$/i;
|
|
121
124
|
const FIGURE = /^[^\s]{0,3}[\d][\d.,:/x×+%kmb$€£-]*\s?[^\s]{0,12}$|^\d+-[a-z]+$/i;
|
|
125
|
+
/** The width a page is read at for its tablet columns (AGL-4138): between a framework's `sm` and `md`. */ const TABLET_WIDTH = 768;
|
|
126
|
+
/** A paragraph set this much larger than the body, and bold, is a statement (AGL-4138), not a lede. */ const STATEMENT_SCALE = 1.75;
|
|
127
|
+
const STATEMENT_MIN_PX = 28;
|
|
128
|
+
const STATEMENT_MIN_WEIGHT = 600;
|
|
129
|
+
/** The widest square an icon's tile is (AGL-4138); wider, it is a card of its own. */ const TILE_MAX_PX = 64;
|
|
122
130
|
/**
|
|
123
131
|
* The page's layout from its structure and its linked stylesheets' text,
|
|
124
132
|
* over its main-region lines. `null` for a page with no structure or no main
|
|
125
133
|
* content.
|
|
126
134
|
*/ export function siteImportLayout(page, stylesheets = []) {
|
|
135
|
+
var _page_videos;
|
|
127
136
|
const { structure, blocks } = page;
|
|
128
137
|
if (!structure) return null;
|
|
129
138
|
const sheets = [
|
|
@@ -132,14 +141,14 @@ const FIGURE = /^[^\s]{0,3}[\d][\d.,:/x×+%kmb$€£-]*\s?[^\s]{0,12}$|^\d+-[a-z
|
|
|
132
141
|
];
|
|
133
142
|
const css = siteImportCssOf(sheets);
|
|
134
143
|
const styles = siteImportStylesOf(structure, css);
|
|
135
|
-
const reader = new LayoutReader(structure, blocks, styles, ()=>siteImportStylesOf(structure, siteImportCssOf(sheets, SITE_IMPORT_CSS_WIDE_WIDTH)));
|
|
144
|
+
const reader = new LayoutReader(structure, blocks, styles, ()=>siteImportStylesOf(structure, siteImportCssOf(sheets, SITE_IMPORT_CSS_WIDE_WIDTH)), ()=>siteImportStylesOf(structure, siteImportCssOf(sheets, TABLET_WIDTH)), (_page_videos = page.videos) != null ? _page_videos : []);
|
|
136
145
|
const sections = reader.sections();
|
|
137
146
|
if (!sections.length) return null;
|
|
138
147
|
return {
|
|
139
148
|
v: 1,
|
|
140
149
|
sections,
|
|
141
150
|
icons: structure.icons.map((icon)=>_extends({}, icon)),
|
|
142
|
-
look: siteImportLookFacts(structure, styles, css.fontFaces)
|
|
151
|
+
look: siteImportLookFacts(structure, styles, css.fontFaces, blocks)
|
|
143
152
|
};
|
|
144
153
|
}
|
|
145
154
|
let LayoutReader = class LayoutReader {
|
|
@@ -335,12 +344,32 @@ let LayoutReader = class LayoutReader {
|
|
|
335
344
|
var _cut_anchor;
|
|
336
345
|
const { element, range, from } = cut;
|
|
337
346
|
const scope = element != null ? element : container;
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const
|
|
347
|
+
let nodes = scope >= 0 ? this.read(scope, range) : this.readLeaves(range);
|
|
348
|
+
const name = this.nameOf(cut.anchor, this.linesOf(nodes), index);
|
|
349
|
+
let band = cut.anchor !== null ? this.bandOf(cut.anchor, false) : this.bandOf(container, true);
|
|
350
|
+
// A film playing on its own behind the words is the section's backdrop (AGL-4140), its poster the first paint.
|
|
351
|
+
const behind = band.backdrop ? undefined : this.videoBehind(nodes);
|
|
352
|
+
if (behind) {
|
|
353
|
+
nodes = withoutVideo(nodes, behind.video);
|
|
354
|
+
band = {
|
|
355
|
+
band: 'dark',
|
|
356
|
+
background: band.background,
|
|
357
|
+
backdrop: _extends({
|
|
358
|
+
kind: 'video',
|
|
359
|
+
video: behind.video
|
|
360
|
+
}, behind.poster !== undefined ? {
|
|
361
|
+
poster: behind.poster
|
|
362
|
+
} : {})
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const lines = (behind == null ? void 0 : behind.poster) !== undefined ? [
|
|
366
|
+
behind.poster,
|
|
367
|
+
...this.linesOf(nodes)
|
|
368
|
+
] : this.linesOf(nodes);
|
|
369
|
+
if (!lines.length && !behind && !nodes.some((node)=>node.kind === 'icon' || node.kind === 'form' || node.kind === 'video')) return null;
|
|
343
370
|
const width = this.widthOf((_cut_anchor = cut.anchor) != null ? _cut_anchor : container);
|
|
371
|
+
const align = this.alignOf(scope, lines);
|
|
372
|
+
keepOwnAlign(nodes, align);
|
|
344
373
|
return _extends({
|
|
345
374
|
name,
|
|
346
375
|
from,
|
|
@@ -349,7 +378,7 @@ let LayoutReader = class LayoutReader {
|
|
|
349
378
|
}, band.backdrop ? {
|
|
350
379
|
backdrop: band.backdrop
|
|
351
380
|
} : {}, {
|
|
352
|
-
align
|
|
381
|
+
align
|
|
353
382
|
}, width !== null ? {
|
|
354
383
|
width
|
|
355
384
|
} : {}, {
|
|
@@ -359,7 +388,8 @@ let LayoutReader = class LayoutReader {
|
|
|
359
388
|
}
|
|
360
389
|
/** Lines with no container to read them through: one after another. */ readLeaves(range) {
|
|
361
390
|
const leaves = this.elements.filter((element)=>element.parent < 0).flatMap((element)=>this.leaves(element.id));
|
|
362
|
-
|
|
391
|
+
// A video's poster is its own, never a picture beside it.
|
|
392
|
+
return leaves.filter((leaf)=>this.inRange(leaf, range) && (leaf.kind === 'video' || this.videoHolding(leaf.element) === null)).map((leaf)=>this.leafNode(leaf));
|
|
363
393
|
}
|
|
364
394
|
nameOf(element, lines, index) {
|
|
365
395
|
var _lines_map_find;
|
|
@@ -507,6 +537,10 @@ let LayoutReader = class LayoutReader {
|
|
|
507
537
|
/*---------------- reading a container ----------------*/ read(element, range) {
|
|
508
538
|
const node = this.elements[element];
|
|
509
539
|
if (!node) return [];
|
|
540
|
+
// A video is one node, whatever its marker holds: its poster (AGL-4140).
|
|
541
|
+
if (node.video !== undefined) return [
|
|
542
|
+
this.videoNode(element, range)
|
|
543
|
+
];
|
|
510
544
|
if (node.tag === 'table') {
|
|
511
545
|
const table = this.table(element, range);
|
|
512
546
|
if (table) return [
|
|
@@ -559,6 +593,10 @@ let LayoutReader = class LayoutReader {
|
|
|
559
593
|
kind: 'form',
|
|
560
594
|
form: leaf.ref
|
|
561
595
|
};
|
|
596
|
+
if (leaf.kind === 'video') return this.videoNode(leaf.element, [
|
|
597
|
+
-1,
|
|
598
|
+
Number.POSITIVE_INFINITY
|
|
599
|
+
]);
|
|
562
600
|
const block = this.block(leaf);
|
|
563
601
|
if ((block == null ? void 0 : block.kind) === 'image') {
|
|
564
602
|
var _this_elements_wrap, _this_elements_wrap1;
|
|
@@ -567,6 +605,7 @@ let LayoutReader = class LayoutReader {
|
|
|
567
605
|
'button'
|
|
568
606
|
], 4);
|
|
569
607
|
const href = wrap !== null && ((_this_elements_wrap = this.elements[wrap]) == null ? void 0 : _this_elements_wrap.tag) === 'a' ? this.anchorHref(wrap) : null;
|
|
608
|
+
const fit = this.pictureFit(leaf);
|
|
570
609
|
return _extends({
|
|
571
610
|
kind: 'picture',
|
|
572
611
|
line: leaf.ref
|
|
@@ -574,11 +613,13 @@ let LayoutReader = class LayoutReader {
|
|
|
574
613
|
href
|
|
575
614
|
} : {}, wrap !== null && ((_this_elements_wrap1 = this.elements[wrap]) == null ? void 0 : _this_elements_wrap1.tag) === 'button' ? {
|
|
576
615
|
button: true
|
|
616
|
+
} : {}, fit ? {
|
|
617
|
+
fit
|
|
577
618
|
} : {});
|
|
578
619
|
}
|
|
579
620
|
const button = this.buttonStyle(leaf);
|
|
580
621
|
const role = button ? undefined : this.roleOf(leaf);
|
|
581
|
-
|
|
622
|
+
const line = _extends({
|
|
582
623
|
kind: 'line',
|
|
583
624
|
line: leaf.ref
|
|
584
625
|
}, role ? {
|
|
@@ -586,6 +627,90 @@ let LayoutReader = class LayoutReader {
|
|
|
586
627
|
} : {}, button ? {
|
|
587
628
|
button
|
|
588
629
|
} : {});
|
|
630
|
+
if (role === 'eyebrow') {
|
|
631
|
+
// An eyebrow's own pill and color (AGL-4138): the hero's chip, a section's magenta label.
|
|
632
|
+
if (this.inPill(leaf)) line.chip = true;
|
|
633
|
+
const ink = this.inkOf(leaf.element);
|
|
634
|
+
if (ink) line.color = ink;
|
|
635
|
+
}
|
|
636
|
+
return line;
|
|
637
|
+
}
|
|
638
|
+
/*---------------- pictures, inks and tiles (AGL-4138) ----------------*/ /**
|
|
639
|
+
* How the source frames a picture: its own shape from its `width` and
|
|
640
|
+
* `height`; the box around it that sets an `aspect-ratio`, or a height it
|
|
641
|
+
* fills or is held to, which crops it; its fit; its corners and shadow, on
|
|
642
|
+
* it or on a box within two levels that holds no other line.
|
|
643
|
+
*/ pictureFit(leaf) {
|
|
644
|
+
var _ref, _ref1;
|
|
645
|
+
var _own_get, _this_elements_at;
|
|
646
|
+
const element = leaf.element;
|
|
647
|
+
const node = this.elements[element];
|
|
648
|
+
if (!node) return undefined;
|
|
649
|
+
const own = this.style(element);
|
|
650
|
+
const fit = {};
|
|
651
|
+
if (node.attrs.width && node.attrs.height) fit.ratio = Math.round(node.attrs.width / node.attrs.height * 10000) / 10000;
|
|
652
|
+
const objectFit = own.get('object-fit');
|
|
653
|
+
if (objectFit === 'cover' || objectFit === 'contain') fit.objectFit = objectFit;
|
|
654
|
+
// The picture fills its box where it is set to the box's whole height.
|
|
655
|
+
const fills = /^100%$/.test((_ref = (_own_get = own.get('height')) == null ? void 0 : _own_get.trim()) != null ? _ref : '');
|
|
656
|
+
for(let at = element, depth = 0; at >= 0 && depth <= 2; at = (_ref1 = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref1 : -1, depth += 1){
|
|
657
|
+
var _style_get, _style_get1;
|
|
658
|
+
if (depth > 0 && this.leaves(at).some((other)=>other.kind === 'line' && other.order !== leaf.order)) break;
|
|
659
|
+
const style = this.style(at);
|
|
660
|
+
const box = siteImportAspectRatio(style.get('aspect-ratio'));
|
|
661
|
+
if (box !== null && fit.box === undefined && fit.height === undefined) fit.box = Math.round(box * 10000) / 10000;
|
|
662
|
+
const height = siteImportLengthPx((_style_get = style.get('height')) != null ? _style_get : '');
|
|
663
|
+
if (height !== null && height > 0 && fit.box === undefined && fit.height === undefined && (depth === 0 || fills)) fit.height = height;
|
|
664
|
+
const radius = siteImportRadiusPx(style);
|
|
665
|
+
if (radius !== null && radius > 0 && fit.radius === undefined) fit.radius = Math.min(radius, 999);
|
|
666
|
+
if (siteImportHasShadow(style)) fit.shadow = true;
|
|
667
|
+
const cap = siteImportLengthPx((_style_get1 = style.get('max-width')) != null ? _style_get1 : '');
|
|
668
|
+
if (cap !== null && cap > 0 && fit.measure === undefined) fit.measure = cap;
|
|
669
|
+
}
|
|
670
|
+
return Object.keys(fit).length ? fit : undefined;
|
|
671
|
+
}
|
|
672
|
+
/** An element's words' color as it shows over the ground under it, `#rrggbb`; `null` where it sets none. */ inkOf(element) {
|
|
673
|
+
var _this_backgroundUnder;
|
|
674
|
+
const color = siteImportColorOf(this.style(element).get('color'));
|
|
675
|
+
if (!color || color.a < 0.05) return null;
|
|
676
|
+
return siteImportHex(siteImportOpaque(color, siteImportColorOf((_this_backgroundUnder = this.backgroundUnder(element)) != null ? _this_backgroundUnder : undefined)));
|
|
677
|
+
}
|
|
678
|
+
/** Whether a line sits in a pill of its own: its element, or the wrapper holding only it, filled or bordered and rounded to a pill. */ inPill(leaf) {
|
|
679
|
+
var _ref;
|
|
680
|
+
var _this_elements_at;
|
|
681
|
+
for(let at = leaf.element, depth = 0; at >= 0 && depth < 2; at = (_ref = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref : -1, depth += 1){
|
|
682
|
+
var _siteImportRadiusPx;
|
|
683
|
+
if (this.leaves(at).length !== 1) return false;
|
|
684
|
+
const style = this.style(at);
|
|
685
|
+
const fill = siteImportBackgroundOf(style).color;
|
|
686
|
+
const filled = !!fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at);
|
|
687
|
+
if ((filled || siteImportHasBorder(style)) && ((_siteImportRadiusPx = siteImportRadiusPx(style)) != null ? _siteImportRadiusPx : 0) >= BADGE_MIN_RADIUS) return true;
|
|
688
|
+
}
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* The filled square an icon sits in: the nearest element above it, within
|
|
693
|
+
* two levels and inside its item, holding nothing but the icon, no wider
|
|
694
|
+
* than a tile, whose fill is not the ground under it.
|
|
695
|
+
*/ tileOf(icon, item) {
|
|
696
|
+
var _ref, _ref1;
|
|
697
|
+
var _this_elements_icon_element, _this_elements_at;
|
|
698
|
+
for(let at = (_ref = (_this_elements_icon_element = this.elements[icon.element]) == null ? void 0 : _this_elements_icon_element.parent) != null ? _ref : -1, depth = 0; at >= 0 && depth < 2 && at !== item; at = (_ref1 = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref1 : -1, depth += 1){
|
|
699
|
+
var _style_get;
|
|
700
|
+
if (this.leaves(at).some((leaf)=>leaf.kind === 'line')) return undefined;
|
|
701
|
+
const style = this.style(at);
|
|
702
|
+
const fill = siteImportBackgroundOf(style).color;
|
|
703
|
+
if (!fill || fill.a < 0.5 || siteImportHex(fill) === this.backgroundUnder(at)) continue;
|
|
704
|
+
const width = siteImportLengthPx((_style_get = style.get('width')) != null ? _style_get : '');
|
|
705
|
+
if (width === null || width > TILE_MAX_PX) continue;
|
|
706
|
+
const radius = siteImportRadiusPx(style);
|
|
707
|
+
return {
|
|
708
|
+
fill: siteImportHex(fill),
|
|
709
|
+
radius: radius === null ? 0 : Math.min(radius, 999),
|
|
710
|
+
color: this.inkOf(icon.element)
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
return undefined;
|
|
589
714
|
}
|
|
590
715
|
/** The nearest element of these tags at or above `element`, within `depth` levels. */ wrapperOf(element, tags, depth) {
|
|
591
716
|
let at = element;
|
|
@@ -602,6 +727,58 @@ let LayoutReader = class LayoutReader {
|
|
|
602
727
|
const anchor = this.structure.anchors.find((entry)=>entry.element === element);
|
|
603
728
|
return (_ref = anchor == null ? void 0 : anchor.href) != null ? _ref : null;
|
|
604
729
|
}
|
|
730
|
+
/*---------------- videos (AGL-4140) ----------------*/ /** A video where it sits: its poster, the picture inside its marker, and whether the box it plays in casts a shadow. */ videoNode(element, range) {
|
|
731
|
+
var _ref;
|
|
732
|
+
var _this_elements_at;
|
|
733
|
+
const node = this.elements[element];
|
|
734
|
+
const poster = this.leaves(element).find((leaf)=>{
|
|
735
|
+
var _this_block;
|
|
736
|
+
return leaf.kind === 'line' && this.inRange(leaf, range) && ((_this_block = this.block(leaf)) == null ? void 0 : _this_block.kind) === 'image';
|
|
737
|
+
});
|
|
738
|
+
let shadow = false;
|
|
739
|
+
// The box around it, as far up as a wrapper holds nothing else.
|
|
740
|
+
for(let at = element, depth = 0; at >= 0 && depth < 3 && !shadow; at = (_ref = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref : -1, depth += 1){
|
|
741
|
+
if (this.leaves(at).some((leaf)=>leaf.kind === 'line' && leaf.element !== (poster == null ? void 0 : poster.element))) break;
|
|
742
|
+
shadow = siteImportHasShadow(this.style(at));
|
|
743
|
+
}
|
|
744
|
+
const fit = poster ? this.pictureFit(poster) : undefined;
|
|
745
|
+
return _extends({
|
|
746
|
+
kind: 'video',
|
|
747
|
+
video: node.video
|
|
748
|
+
}, poster ? {
|
|
749
|
+
poster: poster.ref
|
|
750
|
+
} : {}, fit ? {
|
|
751
|
+
fit
|
|
752
|
+
} : {}, shadow ? {
|
|
753
|
+
shadow: true
|
|
754
|
+
} : {});
|
|
755
|
+
}
|
|
756
|
+
/** The video marker an element sits in, or is, within a few levels; `null` for none. */ videoHolding(element) {
|
|
757
|
+
var _ref;
|
|
758
|
+
var _this_elements_at;
|
|
759
|
+
for(let at = element, depth = 0; at >= 0 && depth < 4; at = (_ref = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref : -1, depth += 1){
|
|
760
|
+
var _this_elements_at1;
|
|
761
|
+
if (((_this_elements_at1 = this.elements[at]) == null ? void 0 : _this_elements_at1.video) !== undefined) return at;
|
|
762
|
+
}
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* The film a section plays on its own behind its words (AGL-4140): one that
|
|
767
|
+
* starts by itself, its place laid over the section (absolute or fixed, at
|
|
768
|
+
* most three levels up), as a picture behind the words is.
|
|
769
|
+
*/ videoBehind(nodes) {
|
|
770
|
+
for (const node of siteImportVideoNodes(nodes)){
|
|
771
|
+
var _ref, _ref1;
|
|
772
|
+
var _this_videos_node_video, _this_elements_at;
|
|
773
|
+
if (!((_this_videos_node_video = this.videos[node.video]) == null ? void 0 : _this_videos_node_video.autoplay)) continue;
|
|
774
|
+
const element = this.elements.find((entry)=>entry.video === node.video);
|
|
775
|
+
for(let at = (_ref = element == null ? void 0 : element.id) != null ? _ref : -1, depth = 0; at >= 0 && depth < 4; at = (_ref1 = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.parent) != null ? _ref1 : -1, depth += 1){
|
|
776
|
+
const position = this.style(at).get('position');
|
|
777
|
+
if (position === 'absolute' || position === 'fixed') return node;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
605
782
|
/** How the source draws a line as a button, when it does. */ buttonStyle(leaf) {
|
|
606
783
|
var _siteImportButtonStyleOf;
|
|
607
784
|
const block = this.block(leaf);
|
|
@@ -626,24 +803,20 @@ let LayoutReader = class LayoutReader {
|
|
|
626
803
|
const page = siteImportBackgroundOf(this.style(-2)).color;
|
|
627
804
|
return page ? siteImportHex(page) : '#ffffff';
|
|
628
805
|
}
|
|
629
|
-
/** An eyebrow, a lede or a note, where the source's styling says so. */ roleOf(leaf) {
|
|
806
|
+
/** An eyebrow, a lede, a statement or a note, where the source's styling says so. */ roleOf(leaf) {
|
|
630
807
|
const block = this.block(leaf);
|
|
631
808
|
if ((block == null ? void 0 : block.kind) !== 'paragraph') return undefined;
|
|
632
809
|
const style = this.style(leaf.element);
|
|
633
810
|
if (this.looksLikeEyebrow(leaf, block.text)) return 'eyebrow';
|
|
634
811
|
const size = siteImportFontSizePx(style);
|
|
812
|
+
// A paragraph set as large as a heading, and bold, is a statement (AGL-4138): "Most website builders hand you a blank page…".
|
|
813
|
+
if (size !== null && (size >= this.bodySize * STATEMENT_SCALE || size >= STATEMENT_MIN_PX) && siteImportFontWeight(style) >= STATEMENT_MIN_WEIGHT && block.text.length > 40) return 'statement';
|
|
635
814
|
if (size !== null && size >= this.bodySize * 1.12 && block.text.length > 40) return 'lede';
|
|
636
815
|
if (size !== null && size <= this.bodySize * 0.875 && block.text.length <= 160) return 'note';
|
|
637
816
|
return undefined;
|
|
638
817
|
}
|
|
639
818
|
looksLikeEyebrow(leaf, text) {
|
|
640
|
-
|
|
641
|
-
const words = (_text_match = text.match(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}]+", "gu"))) != null ? _text_match : [];
|
|
642
|
-
if (text.length > 60 || words.length > 10) return false;
|
|
643
|
-
const style = this.style(leaf.element);
|
|
644
|
-
const letters = text.replace(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}]", "gu"), '');
|
|
645
|
-
const caps = letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase();
|
|
646
|
-
return caps || style.get('text-transform') === 'uppercase';
|
|
819
|
+
return siteImportIsEyebrowText(text, this.style(leaf.element));
|
|
647
820
|
}
|
|
648
821
|
/*---------------- rows ----------------*/ isRow(element) {
|
|
649
822
|
var _node_attrs_class, _style_get, _style_get1;
|
|
@@ -665,7 +838,9 @@ let LayoutReader = class LayoutReader {
|
|
|
665
838
|
const substantial = parts.filter((part)=>{
|
|
666
839
|
if (!isElementPart(part)) return false;
|
|
667
840
|
return this.leaves(part.element).some((leaf)=>{
|
|
668
|
-
if (!this.inRange(leaf, range)
|
|
841
|
+
if (!this.inRange(leaf, range)) return false;
|
|
842
|
+
if (leaf.kind === 'video') return true;
|
|
843
|
+
if (leaf.kind !== 'line') return false;
|
|
669
844
|
const block = this.block(leaf);
|
|
670
845
|
return (block == null ? void 0 : block.kind) === 'image' || (block == null ? void 0 : block.kind) === 'heading' || ((block == null ? void 0 : block.kind) === 'paragraph' || (block == null ? void 0 : block.kind) === 'list-item' || (block == null ? void 0 : block.kind) === 'quote') && !this.buttonStyle(leaf);
|
|
671
846
|
});
|
|
@@ -686,17 +861,24 @@ let LayoutReader = class LayoutReader {
|
|
|
686
861
|
var _groups_;
|
|
687
862
|
return group && !group.inline && group.group === ((_groups_ = groups[0]) == null ? void 0 : _groups_.group) && group.columns === 1;
|
|
688
863
|
})) {
|
|
864
|
+
var _groups_find;
|
|
689
865
|
const first = groups[0];
|
|
690
|
-
|
|
866
|
+
const boxed = groups.every((group)=>group == null ? void 0 : group.boxed);
|
|
867
|
+
// Framed in every cell but not boxed in all of them: the rule they draw (AGL-4138).
|
|
868
|
+
const rule = !boxed && groups.every((group)=>(group == null ? void 0 : group.boxed) || (group == null ? void 0 : group.rule)) ? (_groups_find = groups.find((group)=>group == null ? void 0 : group.rule)) == null ? void 0 : _groups_find.rule : undefined;
|
|
869
|
+
return _extends({
|
|
691
870
|
kind: 'group',
|
|
692
871
|
group: first.group,
|
|
693
872
|
columns: cells.length,
|
|
694
|
-
boxed
|
|
873
|
+
boxed
|
|
874
|
+
}, rule ? {
|
|
875
|
+
rule
|
|
876
|
+
} : {}, {
|
|
695
877
|
items: groups.flatMap((group)=>{
|
|
696
878
|
var _ref;
|
|
697
879
|
return (_ref = group == null ? void 0 : group.items) != null ? _ref : [];
|
|
698
880
|
})
|
|
699
|
-
};
|
|
881
|
+
});
|
|
700
882
|
}
|
|
701
883
|
return {
|
|
702
884
|
kind: 'row',
|
|
@@ -795,7 +977,7 @@ let LayoutReader = class LayoutReader {
|
|
|
795
977
|
let end = index + 1;
|
|
796
978
|
while(end < parts.length && keys[end] !== null && (keys[end] === key || loose[end] === kind && !!kind && kind.includes(',')))end += 1;
|
|
797
979
|
const count = end - index;
|
|
798
|
-
const boxed = count === 2 && row && parts.slice(index, end).every((part)=>isElementPart(part) && this.
|
|
980
|
+
const boxed = count === 2 && row && parts.slice(index, end).every((part)=>isElementPart(part) && this.framed(part.element));
|
|
799
981
|
// One element alone (a single list item) is not a group; a heading leaf is never an item.
|
|
800
982
|
const items = parts.slice(index, end);
|
|
801
983
|
const headings = items.every((part)=>{
|
|
@@ -832,30 +1014,74 @@ let LayoutReader = class LayoutReader {
|
|
|
832
1014
|
const leaves = this.leaves(element).filter((leaf)=>this.inRange(leaf, range));
|
|
833
1015
|
const lines = leaves.filter((leaf)=>leaf.kind === 'line');
|
|
834
1016
|
if (lines.length !== 1) return false;
|
|
1017
|
+
// A short line with a mark of its own and no pill around it is a checklist's line, not a tag (AGL-4138).
|
|
1018
|
+
if (leaves.some((leaf)=>leaf.kind === 'icon') && !this.framed(element)) return false;
|
|
835
1019
|
const block = this.block(lines[0]);
|
|
836
1020
|
return !!block && block.kind !== 'image' && block.kind !== 'heading' && block.text.length <= 40;
|
|
837
1021
|
}
|
|
838
|
-
|
|
1022
|
+
/**
|
|
1023
|
+
* How an item is drawn apart from the page (AGL-4138), it and the wrappers
|
|
1024
|
+
* inside it that hold all it holds: a BOX is a shadow, a fill of its own or
|
|
1025
|
+
* a border on two sides or more; a RULE a border on one side only, a step's
|
|
1026
|
+
* line over its number. Either one makes it framed.
|
|
1027
|
+
*/ frameOf(element) {
|
|
1028
|
+
let rule = null;
|
|
839
1029
|
let at = element;
|
|
840
1030
|
for(let depth = 0; depth < 3 && at >= 0; depth += 1){
|
|
841
1031
|
var _ref;
|
|
842
1032
|
var _this_elements_at;
|
|
843
1033
|
const style = this.style(at);
|
|
844
|
-
if (
|
|
1034
|
+
if (siteImportHasShadow(style)) return {
|
|
1035
|
+
box: true,
|
|
1036
|
+
rule: null
|
|
1037
|
+
};
|
|
845
1038
|
const fill = siteImportBackgroundOf(style).color;
|
|
846
|
-
if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)) return
|
|
1039
|
+
if (fill && fill.a >= 0.5 && siteImportHex(fill) !== this.backgroundUnder(at)) return {
|
|
1040
|
+
box: true,
|
|
1041
|
+
rule: null
|
|
1042
|
+
};
|
|
1043
|
+
const sides = siteImportBorderSides(style);
|
|
1044
|
+
const drawn = Object.keys(sides).filter((side)=>sides[side]);
|
|
1045
|
+
if (drawn.length >= 2) return {
|
|
1046
|
+
box: true,
|
|
1047
|
+
rule: null
|
|
1048
|
+
};
|
|
1049
|
+
const side = drawn[0];
|
|
1050
|
+
if (side && !rule) {
|
|
1051
|
+
var _this_backgroundUnder;
|
|
1052
|
+
const border = sides[side];
|
|
1053
|
+
const under = siteImportColorOf((_this_backgroundUnder = this.backgroundUnder(at)) != null ? _this_backgroundUnder : undefined);
|
|
1054
|
+
rule = {
|
|
1055
|
+
side,
|
|
1056
|
+
width: Math.max(1, Math.round(border.width)),
|
|
1057
|
+
color: border.color && border.color.a >= 0.05 ? siteImportHex(siteImportOpaque(border.color, under)) : null
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
847
1060
|
const children = ((_ref = (_this_elements_at = this.elements[at]) == null ? void 0 : _this_elements_at.children) != null ? _ref : []).filter((child)=>this.leaves(child).length);
|
|
848
1061
|
if (children.length !== 1) break;
|
|
849
1062
|
at = children[0];
|
|
850
1063
|
}
|
|
851
|
-
return
|
|
1064
|
+
return {
|
|
1065
|
+
box: false,
|
|
1066
|
+
rule
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
/** Whether an item is drawn apart from the page at all: a box or a rule (a border on any side, a shadow, a fill of its own). */ framed(element) {
|
|
1070
|
+
const frame = this.frameOf(element);
|
|
1071
|
+
return frame.box || !!frame.rule;
|
|
852
1072
|
}
|
|
853
1073
|
group(container, parts, range) {
|
|
1074
|
+
var _ref, _ref1;
|
|
1075
|
+
var _frames_find, _parts_;
|
|
854
1076
|
const items = parts.map((part)=>this.item(part.element, range));
|
|
855
1077
|
const chips = parts.length >= 4 && this.isRow(container) && parts.every((part)=>this.isChip(part.element, range));
|
|
856
1078
|
const kind = chips ? 'logos' : this.groupKind(parts.map((part)=>part.element), items, range);
|
|
857
1079
|
const columns = this.columnsOf(container, parts);
|
|
858
|
-
const
|
|
1080
|
+
const frames = parts.map((part)=>this.frameOf(part.element));
|
|
1081
|
+
const half = Math.ceil(parts.length / 2);
|
|
1082
|
+
const boxed = parts.length > 0 && frames.filter((frame)=>frame.box).length >= half;
|
|
1083
|
+
// Framed, most of them, but not boxed: the rule the first of them draws (AGL-4138).
|
|
1084
|
+
const ruled = !boxed && frames.filter((frame)=>frame.box || frame.rule).length >= half ? (_ref = (_frames_find = frames.find((frame)=>frame.rule)) == null ? void 0 : _frames_find.rule) != null ? _ref : null : null;
|
|
859
1085
|
// A step's number and a stat's figure lead their item.
|
|
860
1086
|
if (kind === 'steps' || kind === 'stats') {
|
|
861
1087
|
for (const item of items){
|
|
@@ -866,11 +1092,11 @@ let LayoutReader = class LayoutReader {
|
|
|
866
1092
|
if (lead !== undefined && (kind === 'steps' ? STEP_NUMBER.test(text.trim()) : FIGURE.test(text.trim()) || text.length <= 14)) {
|
|
867
1093
|
item.figure = lead;
|
|
868
1094
|
if (item.title === lead) {
|
|
869
|
-
var
|
|
1095
|
+
var _ref2;
|
|
870
1096
|
var _item_text1, _item_text2;
|
|
871
1097
|
delete item.title;
|
|
872
1098
|
const next = (_item_text1 = item.text) == null ? void 0 : _item_text1.find((ref)=>this.lineText(ref).length <= 80);
|
|
873
|
-
if (next !== undefined && ((
|
|
1099
|
+
if (next !== undefined && ((_ref2 = (_item_text2 = item.text) == null ? void 0 : _item_text2.length) != null ? _ref2 : 0) > 1) {
|
|
874
1100
|
item.title = next;
|
|
875
1101
|
dropLine(item, 'text', next);
|
|
876
1102
|
}
|
|
@@ -878,6 +1104,14 @@ let LayoutReader = class LayoutReader {
|
|
|
878
1104
|
if (item.text && !item.text.length) delete item.text;
|
|
879
1105
|
}
|
|
880
1106
|
}
|
|
1107
|
+
// A step's number the source sets in its muted words' grey, not its brand (AGL-4138).
|
|
1108
|
+
items.forEach((item, at)=>{
|
|
1109
|
+
var _ref;
|
|
1110
|
+
var _parts_at;
|
|
1111
|
+
const leaf = item.figure === undefined ? undefined : this.leaves((_ref = (_parts_at = parts[at]) == null ? void 0 : _parts_at.element) != null ? _ref : -1).find((entry)=>entry.kind === 'line' && entry.ref === item.figure);
|
|
1112
|
+
const ink = leaf ? this.inkOf(leaf.element) : null;
|
|
1113
|
+
if (ink && siteImportIsMutedInk(ink)) item.figureMuted = true;
|
|
1114
|
+
});
|
|
881
1115
|
}
|
|
882
1116
|
if (kind === 'faq') {
|
|
883
1117
|
for (const item of items){
|
|
@@ -916,17 +1150,63 @@ let LayoutReader = class LayoutReader {
|
|
|
916
1150
|
return this.takeBadge(item, (_parts_at = parts[at]) == null ? void 0 : _parts_at.element, range);
|
|
917
1151
|
});
|
|
918
1152
|
const inline = columns === 1 && (kind === 'cards' || kind === 'pricing') && parts.every((part)=>this.isWordRow(part.element, range));
|
|
1153
|
+
const columnsSm = this.columnsSmOf(container, parts, columns);
|
|
1154
|
+
const align = this.itemsAlignOf((_ref1 = (_parts_ = parts[0]) == null ? void 0 : _parts_.element) != null ? _ref1 : -1, items[0], range);
|
|
919
1155
|
return _extends({
|
|
920
1156
|
kind: 'group',
|
|
921
1157
|
group: kind,
|
|
922
|
-
columns
|
|
1158
|
+
columns
|
|
1159
|
+
}, columnsSm !== null ? {
|
|
1160
|
+
columnsSm
|
|
1161
|
+
} : {}, {
|
|
923
1162
|
boxed
|
|
924
|
-
},
|
|
1163
|
+
}, ruled ? {
|
|
1164
|
+
rule: ruled
|
|
1165
|
+
} : {}, align ? {
|
|
1166
|
+
align
|
|
1167
|
+
} : {}, inline ? {
|
|
925
1168
|
inline: true
|
|
926
1169
|
} : {}, {
|
|
927
1170
|
items
|
|
928
1171
|
});
|
|
929
1172
|
}
|
|
1173
|
+
/**
|
|
1174
|
+
* How an item's words are set (AGL-4138): centered where its name's
|
|
1175
|
+
* element centers its text or its own column centers what it holds, else
|
|
1176
|
+
* at the start. `keepOwnAlign` drops it where the section reads the same.
|
|
1177
|
+
*/ itemsAlignOf(element, item, range) {
|
|
1178
|
+
var _ref, _column_get, _column_get1;
|
|
1179
|
+
var _item_text;
|
|
1180
|
+
const ref = (_ref = item == null ? void 0 : item.title) != null ? _ref : item == null ? void 0 : (_item_text = item.text) == null ? void 0 : _item_text[0];
|
|
1181
|
+
if (element < 0 || ref === undefined) return null;
|
|
1182
|
+
const leaf = this.leaves(element).find((entry)=>entry.kind === 'line' && entry.ref === ref);
|
|
1183
|
+
if (!leaf) return null;
|
|
1184
|
+
if (this.style(leaf.element).get('text-align') === 'center') return 'center';
|
|
1185
|
+
const column = this.style(this.unwrap(element, range));
|
|
1186
|
+
if (/\bflex\b/.test((_column_get = column.get('display')) != null ? _column_get : '') && /column/.test((_column_get1 = column.get('flex-direction')) != null ? _column_get1 : '') && column.get('align-items') === 'center') return 'center';
|
|
1187
|
+
return 'start';
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* The columns a group's items sit in on a tablet (AGL-4138), where it is
|
|
1191
|
+
* fewer than on a wide screen and more than one: a framework's `sm` size on
|
|
1192
|
+
* its cells, else the grid the container lays out at a tablet's width.
|
|
1193
|
+
*/ columnsSmOf(container, parts, columns) {
|
|
1194
|
+
var _ref, _ref1, _exec;
|
|
1195
|
+
var _this_elements_, _parts_;
|
|
1196
|
+
if (columns <= 2) return null;
|
|
1197
|
+
const classes = (_ref = (_this_elements_ = this.elements[(_ref1 = (_parts_ = parts[0]) == null ? void 0 : _parts_.element) != null ? _ref1 : -1]) == null ? void 0 : _this_elements_.attrs.class) != null ? _ref : '';
|
|
1198
|
+
const sized = (_exec = /\bMuiGrid-grid-sm-(\d+)\b/.exec(classes)) != null ? _exec : /\bcol-sm-(\d{1,2})\b/.exec(classes);
|
|
1199
|
+
let count = null;
|
|
1200
|
+
if (sized) count = Math.round(12 / Math.max(1, Number(sized[1])));
|
|
1201
|
+
else {
|
|
1202
|
+
var _this_tabletStyles, _style_get;
|
|
1203
|
+
(_this_tabletStyles = this.tabletStyles) != null ? _this_tabletStyles : this.tabletStyles = this.tabletStylesOf();
|
|
1204
|
+
const style = this.tabletStyles.of(container);
|
|
1205
|
+
const template = /\bgrid\b/.test((_style_get = style.get('display')) != null ? _style_get : '') ? siteImportGridColumns(style.get('grid-template-columns')) : null;
|
|
1206
|
+
if (template) count = template.length;
|
|
1207
|
+
}
|
|
1208
|
+
return count !== null && count >= 2 && count < columns ? count : null;
|
|
1209
|
+
}
|
|
930
1210
|
/** The line of an item that says what its price is for, beside the price: taken out of its words. */ takePeriod(item, element, range) {
|
|
931
1211
|
var _item_text;
|
|
932
1212
|
if (item.figure === undefined) return;
|
|
@@ -991,6 +1271,7 @@ let LayoutReader = class LayoutReader {
|
|
|
991
1271
|
return block.kind === 'image' ? block.alt : block.text;
|
|
992
1272
|
}
|
|
993
1273
|
/** One item's lines, each in exactly one of its parts. */ item(element, range) {
|
|
1274
|
+
var _ref;
|
|
994
1275
|
var _this_elements_element;
|
|
995
1276
|
const leaves = this.leaves(element).filter((leaf)=>this.inRange(leaf, range));
|
|
996
1277
|
const item = {
|
|
@@ -1019,11 +1300,21 @@ let LayoutReader = class LayoutReader {
|
|
|
1019
1300
|
}
|
|
1020
1301
|
if (item.icon !== undefined && item.icon === item.listIcon && !lines.length) delete item.icon;
|
|
1021
1302
|
const rest = lines.filter((leaf)=>!listed.has(leaf.ref));
|
|
1022
|
-
|
|
1303
|
+
// A film the item holds (AGL-4140): its poster is the item's picture.
|
|
1304
|
+
const film = leaves.find((leaf)=>leaf.kind === 'video');
|
|
1305
|
+
if (film) item.video = film.ref;
|
|
1306
|
+
const image = (_ref = film ? rest.find((leaf)=>{
|
|
1307
|
+
var _this_block;
|
|
1308
|
+
return ((_this_block = this.block(leaf)) == null ? void 0 : _this_block.kind) === 'image' && this.videoHolding(leaf.element) === film.element;
|
|
1309
|
+
}) : undefined) != null ? _ref : rest.find((leaf)=>{
|
|
1023
1310
|
var _this_block;
|
|
1024
1311
|
return ((_this_block = this.block(leaf)) == null ? void 0 : _this_block.kind) === 'image';
|
|
1025
1312
|
});
|
|
1026
|
-
if (image)
|
|
1313
|
+
if (image) {
|
|
1314
|
+
item.image = image.ref;
|
|
1315
|
+
const fit = this.pictureFit(image);
|
|
1316
|
+
if (fit) item.imageFit = fit;
|
|
1317
|
+
}
|
|
1027
1318
|
const words = rest.filter((leaf)=>leaf !== image);
|
|
1028
1319
|
// Its own calls to action: every link it draws as a button, wherever it
|
|
1029
1320
|
// sits (a plan's button sits above its features), and the links and
|
|
@@ -1082,9 +1373,47 @@ let LayoutReader = class LayoutReader {
|
|
|
1082
1373
|
const href = wrap !== null ? this.anchorHref(wrap) : null;
|
|
1083
1374
|
if (href) item.to = href;
|
|
1084
1375
|
}
|
|
1376
|
+
// The square its lead icon sits in, and the arrow at the end of its first row (AGL-4138).
|
|
1377
|
+
if (leadIcon) {
|
|
1378
|
+
const tile = this.tileOf(leadIcon, element);
|
|
1379
|
+
if (tile) item.tile = tile;
|
|
1380
|
+
}
|
|
1381
|
+
const mark = this.markOf(leaves, leadIcon, listed, element, item.to);
|
|
1382
|
+
if (mark !== undefined) item.mark = mark;
|
|
1085
1383
|
return item;
|
|
1086
1384
|
}
|
|
1087
1385
|
/**
|
|
1386
|
+
* A second icon of an item that says where it goes (AGL-4138): an icon
|
|
1387
|
+
* alone in a link to the item's own address (a card's "↗"), or one in the
|
|
1388
|
+
* row its lead icon sits in. Never a bullet's mark.
|
|
1389
|
+
*/ markOf(leaves, lead, listed, item, to) {
|
|
1390
|
+
var _ref;
|
|
1391
|
+
var _this_elements_leaf_element;
|
|
1392
|
+
const bullets = new Set();
|
|
1393
|
+
for (const leaf of leaves)if (leaf.kind === 'line' && listed.has(leaf.ref)) bullets.add((_ref = (_this_elements_leaf_element = this.elements[leaf.element]) == null ? void 0 : _this_elements_leaf_element.parent) != null ? _ref : -1);
|
|
1394
|
+
const same = (a, b)=>!!a && !!b && a.replace(/\/+$/, '') === b.replace(/\/+$/, '');
|
|
1395
|
+
for (const leaf of leaves){
|
|
1396
|
+
var _ref1, _ref2;
|
|
1397
|
+
var _this_elements_leaf_element1, _this_elements_parent;
|
|
1398
|
+
if (leaf.kind !== 'icon' || leaf === lead) continue;
|
|
1399
|
+
const parent = (_ref1 = (_this_elements_leaf_element1 = this.elements[leaf.element]) == null ? void 0 : _this_elements_leaf_element1.parent) != null ? _ref1 : -1;
|
|
1400
|
+
if (bullets.has(parent) || bullets.has((_ref2 = (_this_elements_parent = this.elements[parent]) == null ? void 0 : _this_elements_parent.parent) != null ? _ref2 : -1)) continue;
|
|
1401
|
+
const link = this.wrapperOf(leaf.element, [
|
|
1402
|
+
'a'
|
|
1403
|
+
], 3);
|
|
1404
|
+
if (link !== null && link !== item && this.refsIn(link, [
|
|
1405
|
+
-1,
|
|
1406
|
+
Number.POSITIVE_INFINITY
|
|
1407
|
+
]).length === 0 && same(this.anchorHref(link), to)) return leaf.ref;
|
|
1408
|
+
const row = lead ? this.commonAncestor([
|
|
1409
|
+
lead.element,
|
|
1410
|
+
leaf.element
|
|
1411
|
+
]) : null;
|
|
1412
|
+
if (row !== null && row !== item && this.contains(item, row) && this.isRow(row) && !this.leaves(row).some((entry)=>entry.kind === 'line')) return leaf.ref;
|
|
1413
|
+
}
|
|
1414
|
+
return undefined;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1088
1417
|
* Runs of three or more one-line entries built alike anywhere inside an
|
|
1089
1418
|
* item (a plan's features, each a check mark and a line), each run its
|
|
1090
1419
|
* entries' elements. The item itself is never one of them.
|
|
@@ -1132,7 +1461,7 @@ let LayoutReader = class LayoutReader {
|
|
|
1132
1461
|
var _item_text;
|
|
1133
1462
|
return item.title !== undefined && ((_ref = (_item_text = item.text) == null ? void 0 : _item_text.length) != null ? _ref : 0) > 0;
|
|
1134
1463
|
});
|
|
1135
|
-
const boxed = elements.filter((element)=>this.
|
|
1464
|
+
const boxed = elements.filter((element)=>this.framed(element)).length >= Math.ceil(elements.length / 2);
|
|
1136
1465
|
if (visual >= 0.6 && titled >= 0.6 || boxed && share((item)=>item.lines.length >= 2) >= 0.6) return 'cards';
|
|
1137
1466
|
if (share((item)=>item.lines.length === 1) >= 0.8) return 'list';
|
|
1138
1467
|
if (titled >= 0.6) return 'cards';
|
|
@@ -1394,7 +1723,7 @@ let LayoutReader = class LayoutReader {
|
|
|
1394
1723
|
return false;
|
|
1395
1724
|
}
|
|
1396
1725
|
/*---------------- the hero ----------------*/ markHero(sections) {
|
|
1397
|
-
var _hero_backdrop;
|
|
1726
|
+
var _hero_backdrop, _hero_backdrop1;
|
|
1398
1727
|
const mainBlocks = this.mainBlocks();
|
|
1399
1728
|
const hero = sections.find((section)=>section.lines.some((ref)=>{
|
|
1400
1729
|
var _mainBlocks_ref;
|
|
@@ -1402,7 +1731,7 @@ let LayoutReader = class LayoutReader {
|
|
|
1402
1731
|
}));
|
|
1403
1732
|
if (!hero) return;
|
|
1404
1733
|
let picture = null;
|
|
1405
|
-
if (((_hero_backdrop = hero.backdrop) == null ? void 0 : _hero_backdrop.kind) === 'picture') picture = 'behind';
|
|
1734
|
+
if (((_hero_backdrop = hero.backdrop) == null ? void 0 : _hero_backdrop.kind) === 'picture' || ((_hero_backdrop1 = hero.backdrop) == null ? void 0 : _hero_backdrop1.kind) === 'video') picture = 'behind';
|
|
1406
1735
|
else {
|
|
1407
1736
|
const h1 = hero.lines.find((ref)=>{
|
|
1408
1737
|
var _mainBlocks_ref;
|
|
@@ -1443,16 +1772,19 @@ let LayoutReader = class LayoutReader {
|
|
|
1443
1772
|
linesOf(nodes) {
|
|
1444
1773
|
return siteImportLayoutLines(nodes);
|
|
1445
1774
|
}
|
|
1446
|
-
constructor(structure, blocks, styles, wideStylesOf){
|
|
1775
|
+
constructor(structure, blocks, styles, wideStylesOf, tabletStylesOf = ()=>styles, videos = []){
|
|
1447
1776
|
var _siteImportFontSizePx;
|
|
1448
1777
|
this.structure = structure;
|
|
1449
1778
|
this.blocks = blocks;
|
|
1450
1779
|
this.styles = styles;
|
|
1451
1780
|
this.wideStylesOf = wideStylesOf;
|
|
1781
|
+
this.tabletStylesOf = tabletStylesOf;
|
|
1782
|
+
this.videos = videos;
|
|
1452
1783
|
/** Each element's leaves, its subtree's, in order (memoized). */ this.leafMemo = new Map();
|
|
1453
1784
|
/** Tab panels a tab strip has read already. */ this.usedPanels = new Set();
|
|
1454
1785
|
this.bodySize = 16;
|
|
1455
1786
|
this.wideStyles = null;
|
|
1787
|
+
this.tabletStyles = null;
|
|
1456
1788
|
this.mainBlocksMemo = null;
|
|
1457
1789
|
this.tabsMemo = null;
|
|
1458
1790
|
this.elements = structure.elements;
|
|
@@ -1474,8 +1806,8 @@ let LayoutReader = class LayoutReader {
|
|
|
1474
1806
|
});
|
|
1475
1807
|
});
|
|
1476
1808
|
for (const element of this.elements){
|
|
1477
|
-
var _element_order, _element_order1;
|
|
1478
|
-
var _this_own_element_id, _this_own_element_id1;
|
|
1809
|
+
var _element_order, _element_order1, _element_order2;
|
|
1810
|
+
var _this_own_element_id, _this_own_element_id1, _this_own_element_id2;
|
|
1479
1811
|
if (element.region !== 'main' || element.nav) continue;
|
|
1480
1812
|
if (element.icon !== undefined) (_this_own_element_id = this.own[element.id]) == null ? void 0 : _this_own_element_id.push({
|
|
1481
1813
|
order: (_element_order = element.order) != null ? _element_order : 0,
|
|
@@ -1489,17 +1821,92 @@ let LayoutReader = class LayoutReader {
|
|
|
1489
1821
|
ref: element.form,
|
|
1490
1822
|
element: element.id
|
|
1491
1823
|
});
|
|
1824
|
+
if (element.video !== undefined) (_this_own_element_id2 = this.own[element.id]) == null ? void 0 : _this_own_element_id2.push({
|
|
1825
|
+
order: (_element_order2 = element.order) != null ? _element_order2 : 0,
|
|
1826
|
+
kind: 'video',
|
|
1827
|
+
ref: element.video,
|
|
1828
|
+
element: element.id
|
|
1829
|
+
});
|
|
1492
1830
|
}
|
|
1493
1831
|
const body = structure.body >= 0 ? structure.body : -2;
|
|
1494
1832
|
this.bodySize = (_siteImportFontSizePx = siteImportFontSizePx(styles.of(body))) != null ? _siteImportFontSizePx : 16;
|
|
1495
1833
|
}
|
|
1496
1834
|
};
|
|
1835
|
+
/** Drops a group's own alignment where its section reads the same (AGL-4138): only an item set apart from its section says how. */ function keepOwnAlign(nodes, align) {
|
|
1836
|
+
for (const node of nodes){
|
|
1837
|
+
if (node.kind === 'group' && node.align === align) delete node.align;
|
|
1838
|
+
else if (node.kind === 'row') for (const cell of node.cells)keepOwnAlign(cell.nodes, align);
|
|
1839
|
+
else if (node.kind === 'tabs') for (const tab of node.tabs)keepOwnAlign(tab.panel, align);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
/** Whether a short line reads as an eyebrow: ten words at most, in capitals or set in them. */ export function siteImportIsEyebrowText(text, style) {
|
|
1843
|
+
var _text_match;
|
|
1844
|
+
const words = (_text_match = text.match(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}]+", "gu"))) != null ? _text_match : [];
|
|
1845
|
+
if (text.length > 60 || words.length > 10) return false;
|
|
1846
|
+
const letters = text.replace(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}]", "gu"), '');
|
|
1847
|
+
const caps = letters.length >= 3 && letters === letters.toUpperCase() && letters !== letters.toLowerCase();
|
|
1848
|
+
return caps || style.get('text-transform') === 'uppercase';
|
|
1849
|
+
}
|
|
1850
|
+
/** A font weight as a number: `700`, `bold` 700, `normal` 400. */ export function siteImportFontWeight(style) {
|
|
1851
|
+
var _ref;
|
|
1852
|
+
var _style_get;
|
|
1853
|
+
const value = (_ref = (_style_get = style.get('font-weight')) == null ? void 0 : _style_get.trim()) != null ? _ref : '';
|
|
1854
|
+
if (/^\d{3}$/.test(value)) return Number(value);
|
|
1855
|
+
if (/^(?:bold|bolder)$/.test(value)) return 700;
|
|
1856
|
+
if (value === 'lighter') return 300;
|
|
1857
|
+
return 400;
|
|
1858
|
+
}
|
|
1859
|
+
/** Whether a color is a muted words' grey (AGL-4138): no hue to speak of, lighter than the words' ink and darker than a rule. */ export function siteImportIsMutedInk(hex) {
|
|
1860
|
+
const color = siteImportColorOf(hex);
|
|
1861
|
+
if (!color) return false;
|
|
1862
|
+
const light = siteImportLuminance(color);
|
|
1863
|
+
return siteImportSaturation(color) < 0.15 && light >= 0.06 && light <= 0.6;
|
|
1864
|
+
}
|
|
1497
1865
|
/** Takes a line out of one of an item's lists; a list left empty goes, never left undefined (Firestore holds no undefined). */ function dropLine(item, key, ref) {
|
|
1498
1866
|
var _item_key;
|
|
1499
1867
|
const list = (_item_key = item[key]) == null ? void 0 : _item_key.filter((entry)=>entry !== ref);
|
|
1500
1868
|
if (list == null ? void 0 : list.length) item[key] = list;
|
|
1501
1869
|
else delete item[key];
|
|
1502
1870
|
}
|
|
1871
|
+
/** Every video node of a section, rows and tab panels opened (AGL-4140). */ function siteImportVideoNodes(nodes) {
|
|
1872
|
+
return nodes.flatMap((node)=>{
|
|
1873
|
+
if (node.kind === 'video') return [
|
|
1874
|
+
node
|
|
1875
|
+
];
|
|
1876
|
+
if (node.kind === 'row') return node.cells.flatMap((cell)=>siteImportVideoNodes(cell.nodes));
|
|
1877
|
+
if (node.kind === 'tabs') return node.tabs.flatMap((tab)=>siteImportVideoNodes(tab.panel));
|
|
1878
|
+
return [];
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
/** A section's nodes with one video taken out, as its backdrop takes it; a cell or a row left empty goes. */ function withoutVideo(nodes, video) {
|
|
1882
|
+
return nodes.flatMap((node)=>{
|
|
1883
|
+
if (node.kind === 'video') return node.video === video ? [] : [
|
|
1884
|
+
node
|
|
1885
|
+
];
|
|
1886
|
+
if (node.kind === 'row') {
|
|
1887
|
+
const cells = node.cells.map((cell)=>({
|
|
1888
|
+
nodes: withoutVideo(cell.nodes, video)
|
|
1889
|
+
}));
|
|
1890
|
+
const kept = cells.filter((cell)=>cell.nodes.length);
|
|
1891
|
+
if (!kept.length) return [];
|
|
1892
|
+
return kept.length === 1 ? kept[0].nodes : [
|
|
1893
|
+
_extends({}, node, {
|
|
1894
|
+
cells
|
|
1895
|
+
})
|
|
1896
|
+
];
|
|
1897
|
+
}
|
|
1898
|
+
if (node.kind === 'tabs') return [
|
|
1899
|
+
_extends({}, node, {
|
|
1900
|
+
tabs: node.tabs.map((tab)=>_extends({}, tab, {
|
|
1901
|
+
panel: withoutVideo(tab.panel, video)
|
|
1902
|
+
}))
|
|
1903
|
+
})
|
|
1904
|
+
];
|
|
1905
|
+
return [
|
|
1906
|
+
node
|
|
1907
|
+
];
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1503
1910
|
/** Rows of cells of lines, as objects: a Firestore document holds no array inside an array. */ function tableRows(rows) {
|
|
1504
1911
|
return rows.map((row)=>({
|
|
1505
1912
|
cells: row.map((lines)=>({
|
|
@@ -1571,13 +1978,14 @@ function mode(values) {
|
|
|
1571
1978
|
}
|
|
1572
1979
|
return families;
|
|
1573
1980
|
}
|
|
1574
|
-
/** The look facts of a page read with its structure, through its linked stylesheets' text. */ export function siteImportLookOf(page, stylesheets = []) {
|
|
1981
|
+
/** The look facts of a page read with its structure, through its linked stylesheets' text; its blocks, where given, for its eyebrows' color. */ export function siteImportLookOf(page, stylesheets = []) {
|
|
1982
|
+
var _page_blocks;
|
|
1575
1983
|
if (!page.structure) return null;
|
|
1576
1984
|
const css = siteImportCssOf([
|
|
1577
1985
|
...page.structure.styles,
|
|
1578
1986
|
...stylesheets
|
|
1579
1987
|
]);
|
|
1580
|
-
return siteImportLookFacts(page.structure, siteImportStylesOf(page.structure, css), css.fontFaces);
|
|
1988
|
+
return siteImportLookFacts(page.structure, siteImportStylesOf(page.structure, css), css.fontFaces, (_page_blocks = page.blocks) != null ? _page_blocks : []);
|
|
1581
1989
|
}
|
|
1582
1990
|
/**
|
|
1583
1991
|
* The look facts of a page's markup and the stylesheets it links (AGL-4106),
|
|
@@ -1593,15 +2001,64 @@ function mode(values) {
|
|
|
1593
2001
|
structure: true
|
|
1594
2002
|
});
|
|
1595
2003
|
return extract.structure ? siteImportLookOf({
|
|
1596
|
-
structure: extract.structure
|
|
2004
|
+
structure: extract.structure,
|
|
2005
|
+
blocks: extract.blocks
|
|
1597
2006
|
}, stylesheets) : null;
|
|
1598
2007
|
}
|
|
2008
|
+
/** How far two colors may sit apart and still be one (AGL-4138), in OKLab. */ const SAME_COLOR = 0.1;
|
|
2009
|
+
/**
|
|
2010
|
+
* The color most of a page's eyebrows are drawn in (AGL-4138), where it is a
|
|
2011
|
+
* color of its own: not the words' ink, the buttons' fill, the links' color
|
|
2012
|
+
* or white, and no grey. `null` where its eyebrows are none, or drawn in one
|
|
2013
|
+
* of those.
|
|
2014
|
+
*/ function eyebrowColorOf(structure, styles, blocks, not) {
|
|
2015
|
+
var _sort_;
|
|
2016
|
+
const counts = new Map();
|
|
2017
|
+
const inControl = (element)=>{
|
|
2018
|
+
var _ref;
|
|
2019
|
+
var _structure_elements_at;
|
|
2020
|
+
for(let at = element, depth = 0; at >= 0 && depth <= 3; at = (_ref = (_structure_elements_at = structure.elements[at]) == null ? void 0 : _structure_elements_at.parent) != null ? _ref : -1, depth += 1){
|
|
2021
|
+
var _ref1;
|
|
2022
|
+
var _structure_elements_at1;
|
|
2023
|
+
if (/^(?:a|button)$/.test((_ref1 = (_structure_elements_at1 = structure.elements[at]) == null ? void 0 : _structure_elements_at1.tag) != null ? _ref1 : '')) return true;
|
|
2024
|
+
}
|
|
2025
|
+
return false;
|
|
2026
|
+
};
|
|
2027
|
+
structure.blockElement.forEach((element, index)=>{
|
|
2028
|
+
var _counts_get;
|
|
2029
|
+
const block = blocks[index];
|
|
2030
|
+
// A button's or a link's words set in capitals are no eyebrow.
|
|
2031
|
+
if ((block == null ? void 0 : block.kind) !== 'paragraph' || block.region !== 'main' || inControl(element)) return;
|
|
2032
|
+
const style = styles.of(element);
|
|
2033
|
+
if (!siteImportIsEyebrowText(block.text, style)) return;
|
|
2034
|
+
const color = siteImportColorOf(style.get('color'));
|
|
2035
|
+
if (!color || color.a < 0.5) return;
|
|
2036
|
+
const hex = siteImportHex(siteImportOpaque(color));
|
|
2037
|
+
counts.set(hex, ((_counts_get = counts.get(hex)) != null ? _counts_get : 0) + 1);
|
|
2038
|
+
});
|
|
2039
|
+
const top = (_sort_ = [
|
|
2040
|
+
...counts.entries()
|
|
2041
|
+
].sort((a, b)=>b[1] - a[1])[0]) == null ? void 0 : _sort_[0];
|
|
2042
|
+
const own = top ? siteImportColorOf(top) : null;
|
|
2043
|
+
// A grey is the words' own muted color, never a color of the site's.
|
|
2044
|
+
if (!top || !own || siteImportSaturation(own) < 0.25) return null;
|
|
2045
|
+
const others = [
|
|
2046
|
+
...not,
|
|
2047
|
+
'#ffffff'
|
|
2048
|
+
].flatMap((hex)=>{
|
|
2049
|
+
const color = siteImportColorOf(hex != null ? hex : undefined);
|
|
2050
|
+
return color ? [
|
|
2051
|
+
siteImportOpaque(color)
|
|
2052
|
+
] : [];
|
|
2053
|
+
});
|
|
2054
|
+
return others.some((other)=>siteImportColorDistance(own, other) < SAME_COLOR) ? null : top;
|
|
2055
|
+
}
|
|
1599
2056
|
/**
|
|
1600
2057
|
* What the source's look is made of (AGL-4106): its fonts, its page's
|
|
1601
2058
|
* background and text, its filled buttons' fill, text and corners, its links'
|
|
1602
|
-
* color
|
|
1603
|
-
*/ export function siteImportLookFacts(structure, styles, fontFaces = []) {
|
|
1604
|
-
var _ref, _siteImportFontFamilies_, _elements_find, _siteImportFontFamilies_1, _siteImportBackgroundOf_color, _ref1, _ref2, _elements_find1, _ref3, _ref4, _ref5;
|
|
2059
|
+
* color, its header's background, and its eyebrows' own color (AGL-4138).
|
|
2060
|
+
*/ export function siteImportLookFacts(structure, styles, fontFaces = [], blocks = []) {
|
|
2061
|
+
var _ref, _siteImportFontFamilies_, _elements_find, _siteImportFontFamilies_1, _siteImportBackgroundOf_color, _ref1, _ref2, _elements_find1, _ref3, _ref4, _ref5, _ref6;
|
|
1605
2062
|
var _filter_sort_;
|
|
1606
2063
|
const { elements } = structure;
|
|
1607
2064
|
const body = structure.body >= 0 ? structure.body : -2;
|
|
@@ -1626,13 +2083,13 @@ function mode(values) {
|
|
|
1626
2083
|
const fills = new Map();
|
|
1627
2084
|
const linkColors = new Map();
|
|
1628
2085
|
for (const element of elements){
|
|
1629
|
-
var
|
|
2086
|
+
var _ref7;
|
|
1630
2087
|
var _elements_at;
|
|
1631
2088
|
if (element.tag !== 'a' && element.tag !== 'button') continue;
|
|
1632
2089
|
if (element.region === 'footer') continue;
|
|
1633
2090
|
const style = styles.of(element.id);
|
|
1634
2091
|
let under = null;
|
|
1635
|
-
for(let at = element.parent; at >= 0; at = (
|
|
2092
|
+
for(let at = element.parent; at >= 0; at = (_ref7 = (_elements_at = elements[at]) == null ? void 0 : _elements_at.parent) != null ? _ref7 : -1){
|
|
1636
2093
|
const color = siteImportBackgroundOf(styles.of(at)).color;
|
|
1637
2094
|
if (color && color.a >= 0.5) {
|
|
1638
2095
|
under = siteImportHex(color);
|
|
@@ -1672,14 +2129,14 @@ function mode(values) {
|
|
|
1672
2129
|
const header = (_elements_find1 = elements.find((element)=>element.tag === 'header' && element.region === 'header')) != null ? _elements_find1 : elements.find((element)=>element.attrs.role === 'banner');
|
|
1673
2130
|
let headerFill = null;
|
|
1674
2131
|
for(let at = (_ref3 = header == null ? void 0 : header.id) != null ? _ref3 : -1, depth = 0; at >= 0 && depth < 3; depth += 1){
|
|
1675
|
-
var
|
|
2132
|
+
var _ref8;
|
|
1676
2133
|
var _elements_at1;
|
|
1677
2134
|
const color = siteImportBackgroundOf(styles.of(at)).color;
|
|
1678
2135
|
if (color && color.a >= 0.5) {
|
|
1679
2136
|
headerFill = siteImportHex(color);
|
|
1680
2137
|
break;
|
|
1681
2138
|
}
|
|
1682
|
-
const children = (
|
|
2139
|
+
const children = (_ref8 = (_elements_at1 = elements[at]) == null ? void 0 : _elements_at1.children) != null ? _ref8 : [];
|
|
1683
2140
|
at = children.length === 1 ? children[0] : -1;
|
|
1684
2141
|
}
|
|
1685
2142
|
return {
|
|
@@ -1694,7 +2151,13 @@ function mode(values) {
|
|
|
1694
2151
|
buttonText: (_ref5 = topFill == null ? void 0 : topFill[1].text) != null ? _ref5 : null,
|
|
1695
2152
|
buttonRadius: radii.length ? radii.sort((a, b)=>a - b)[Math.floor(radii.length / 2)] : null,
|
|
1696
2153
|
link,
|
|
1697
|
-
header: headerFill
|
|
2154
|
+
header: headerFill,
|
|
2155
|
+
// Its eyebrows' own color: none of its words', its buttons' or its links', which the theme draws already.
|
|
2156
|
+
eyebrow: blocks.length ? eyebrowColorOf(structure, styles, blocks, [
|
|
2157
|
+
text,
|
|
2158
|
+
(_ref6 = topFill == null ? void 0 : topFill[0]) != null ? _ref6 : null,
|
|
2159
|
+
link
|
|
2160
|
+
]) : null
|
|
1698
2161
|
};
|
|
1699
2162
|
}
|
|
1700
2163
|
/** Counts a layout's sections, bands, rows, groups, pictures, icons and buttons. */ export function siteImportLayoutCounts(layout, blocks = []) {
|
|
@@ -1710,6 +2173,7 @@ function mode(values) {
|
|
|
1710
2173
|
icons: 0,
|
|
1711
2174
|
buttons: 0,
|
|
1712
2175
|
forms: 0,
|
|
2176
|
+
videos: 0,
|
|
1713
2177
|
lines: 0
|
|
1714
2178
|
};
|
|
1715
2179
|
const main = blocks.filter((block)=>block.region === 'main');
|
|
@@ -1732,6 +2196,11 @@ function mode(values) {
|
|
|
1732
2196
|
case 'form':
|
|
1733
2197
|
counts.forms += 1;
|
|
1734
2198
|
break;
|
|
2199
|
+
case 'video':
|
|
2200
|
+
// Its poster is a picture of the page, as it was before the film was read.
|
|
2201
|
+
counts.videos += 1;
|
|
2202
|
+
if (node.poster !== undefined) counts.pictures += 1;
|
|
2203
|
+
break;
|
|
1735
2204
|
case 'row':
|
|
1736
2205
|
if (node.cells.length >= 2) counts.rows += 1;
|
|
1737
2206
|
for (const cell of node.cells)visit(cell.nodes);
|
|
@@ -1744,8 +2213,10 @@ function mode(values) {
|
|
|
1744
2213
|
var _ref;
|
|
1745
2214
|
var _item_list;
|
|
1746
2215
|
if (item.icon !== undefined) counts.icons += 1;
|
|
2216
|
+
if (item.mark !== undefined) counts.icons += 1;
|
|
1747
2217
|
if (item.listIcon !== undefined) counts.icons += (_ref = (_item_list = item.list) == null ? void 0 : _item_list.length) != null ? _ref : 0;
|
|
1748
2218
|
if (item.image !== undefined || main.length && item.lines.some(isPicture)) counts.pictures += 1;
|
|
2219
|
+
if (item.video !== undefined) counts.videos += 1;
|
|
1749
2220
|
}
|
|
1750
2221
|
break;
|
|
1751
2222
|
case 'table':
|
|
@@ -1761,7 +2232,12 @@ function mode(values) {
|
|
|
1761
2232
|
}
|
|
1762
2233
|
};
|
|
1763
2234
|
for (const section of layout.sections){
|
|
2235
|
+
var _section_backdrop;
|
|
1764
2236
|
visit(section.nodes);
|
|
2237
|
+
if (((_section_backdrop = section.backdrop) == null ? void 0 : _section_backdrop.kind) === 'video') {
|
|
2238
|
+
counts.videos += 1;
|
|
2239
|
+
if (section.backdrop.poster !== undefined) counts.pictures += 1;
|
|
2240
|
+
}
|
|
1765
2241
|
counts.lines += section.lines.length;
|
|
1766
2242
|
}
|
|
1767
2243
|
return counts;
|