@bison-lab/payload-blocks 3.5.0 → 3.20.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.
@@ -482,9 +482,9 @@ interface MegaMenuColumnData {
482
482
  sections?: MegaMenuSectionData[] | null;
483
483
  id?: string | null;
484
484
  }
485
- interface MegaMenuBlockData extends BlockRow<"megaMenu"> {
485
+ interface MegaMenuBlockData extends BlockRow<"megaMenu">, LinkDestination {
486
486
  label?: string | null;
487
- href?: string | null;
487
+ newTab?: boolean | null;
488
488
  panel?: {
489
489
  maxWidth?: ("narrow" | "standard" | "wide") | null;
490
490
  columns?: MegaMenuColumnData[] | null;
@@ -499,4 +499,4 @@ interface MegaMenuBlockData extends BlockRow<"megaMenu"> {
499
499
  interface NavLinkBlockData extends BlockRow<"navLink">, LinkValue {}
500
500
  //#endregion
501
501
  export { BlockImageProps as A, resolveLink$1 as C, newTabAttributes as D, DefaultBlockLink as E, renderLinkWith as O, linkTypeOf as S, BlockLinkProps as T, RenderBlocksProps as _, NavLinkBlockData as a, LinkValue as b, ShowcasePanelsBlockData as c, BLOCK_ID_ATTRIBUTE as d, BlockLike as f, RenderBlocks as g, DEFAULT_CONTAINER as h, NapBlockData as i, DefaultBlockImage as j, BlockImageComponent as k, StatsBandBlockData as l, BlockRendererProps as m, HeroBlockData as n, ProcessStepsBlockData as o, BlockRegistryFor as p, MegaMenuBlockData as r, RichTextBlockData as s, FaqColumnsBlockData as t, TestimonialMasonryBlockData as u, LinkDestination as v, BlockLinkComponent as w, ResolveLink as x, LinkPageDoc as y };
502
- //# sourceMappingURL=types-ODMRyOpH.d.mts.map
502
+ //# sourceMappingURL=types-DWEoAURf.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-ODMRyOpH.d.mts","names":[],"sources":["../src/image.tsx","../src/link.tsx","../src/fields/link.ts","../src/render-blocks.tsx","../src/media.ts","../src/types.ts"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;;;UA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EACA,IAAA;EACA,EAAA;AAAA;AAAA,UAGe,kBAAA,SAA2B,QAAA;EAC1C,OAAA;EACA,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,iBAAA;;EAER,OAAA;EACA,IAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,UAGe,iBAAA;EACf,IAAA;EACA,cAAA;EACA,SAAA;EACA,YAAA;EACA,EAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,QAAA;EACpC,YAAA;EACA,YAAA;EACA,OAAA;IACE,aAAA;IACA,eAAA;IACA,aAAA;IACA,UAAA;IACA,cAAA;EAAA;EAEF,WAAA,GAAc,iBAAA;EACd,GAAA;EACA,QAAA;EACA,YAAA;EACA,UAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,SAAA;EACxC,WAAA;EH5IgD;EG8IhD,OAAA;EH7IA;EG+IA,IAAA;EACA,EAAA;AAAA;AAAA,UAGe,mBAAA;EACf,OAAA;EACA,OAAA;EACA,wBAAA;EACA,KAAA,GAAQ,gBAAA;EACR,EAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,WAAA;EACA,OAAA;EACA,QAAA,GAAW,mBAAA;EACX,EAAA;AAAA;AAAA,UAGe,iBAAA,SAA0B,QAAA;EACzC,KAAA;EACA,IAAA;EACA,KAAA;IACE,QAAA;IACA,OAAA,GAAU,kBAAA;IACV,MAAA;MACE,QAAA,GAAW,SAAA;MACX,GAAA,GAAM,SAAA;IAAA;IAER,YAAA,mBF9MF;IEgNE,cAAA;EAAA;AAAA;AAAA,UAIa,gBAAA,SAAyB,QAAA,aAAqB,SAAA"}
1
+ {"version":3,"file":"types-DWEoAURf.d.mts","names":[],"sources":["../src/image.tsx","../src/link.tsx","../src/fields/link.ts","../src/render-blocks.tsx","../src/media.ts","../src/types.ts"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;;;UAAiB,eAAA;EACf,GAAA;EASQ;EAPR,GAAA;EACA,KAAA;EACA,MAAA;EACA,SAAA;EAO6D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KAAA;EACA,WAAA;EACA,KAAA,GAAQ,iBAAA;;EAER,OAAA;EACA,IAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,UAGe,iBAAA;EACf,IAAA;EACA,cAAA;EACA,SAAA;EACA,YAAA;EACA,EAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,QAAA;EACpC,YAAA;EACA,YAAA;EACA,OAAA;IACE,aAAA;IACA,eAAA;IACA,aAAA;IACA,UAAA;IACA,cAAA;EAAA;EAEF,WAAA,GAAc,iBAAA;EACd,GAAA;EACA,QAAA;EACA,YAAA;EACA,UAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,SAAA;EACxC,WAAA;EH5IgD;EG8IhD,OAAA;EH7IA;EG+IA,IAAA;EACA,EAAA;AAAA;AAAA,UAGe,mBAAA;EACf,OAAA;EACA,OAAA;EACA,wBAAA;EACA,KAAA,GAAQ,gBAAA;EACR,EAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,WAAA;EACA,OAAA;EACA,QAAA,GAAW,mBAAA;EACX,EAAA;AAAA;AAAA,UAGe,iBAAA,SAA0B,QAAA,cAAsB,eAAA;EAC/D,KAAA;EACA,MAAA;EACA,KAAA;IACE,QAAA;IACA,OAAA,GAAU,kBAAA;IACV,MAAA;MACE,QAAA,GAAW,SAAA;MACX,GAAA,GAAM,SAAA;IAAA;IAER,YAAA,mBF9MF;IEgNE,cAAA;EAAA;AAAA;AAAA,UAIa,gBAAA,SAAyB,QAAA,aAAqB,SAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-blocks",
3
- "version": "3.5.0",
3
+ "version": "3.20.0",
4
4
  "description": "Payload CMS block configs and renderers for the Bison Lab marketing blocks",
5
5
  "homepage": "https://components.bisonlab.ai",
6
6
  "repository": {
@@ -35,7 +35,11 @@
35
35
  "files": [
36
36
  "dist"
37
37
  ],
38
+ "dependencies": {
39
+ "@bison-lab/admin-ui": "3.20.0"
40
+ },
38
41
  "peerDependencies": {
42
+ "@bison-lab/payload-core": "^3.0.0",
39
43
  "@bison-lab/ui": "^3.0.0",
40
44
  "@payloadcms/richtext-lexical": "^3.0.0",
41
45
  "@payloadcms/ui": "^3.0.0",
@@ -74,7 +78,8 @@
74
78
  "tsdown": "^0.21.0",
75
79
  "typescript": "^5.9.3",
76
80
  "vitest": "^4.1.2",
77
- "@bison-lab/ui": "3.3.0"
81
+ "@bison-lab/payload-core": "3.20.0",
82
+ "@bison-lab/ui": "3.11.0"
78
83
  },
79
84
  "publishConfig": {
80
85
  "access": "public"
@@ -1,41 +0,0 @@
1
- "use client";
2
- //#region src/fields/link.ts
3
- /**
4
- * The package's resolver: a published, populated page is `/<slug>`; an
5
- * external link is its `href` as typed.
6
- *
7
- * A page that did not populate is `null`: Payload hands the public read the
8
- * bare id when the reader may not see the page, which is what an unpublished
9
- * page looks like from the site. A populated page whose `_status` is `draft`
10
- * is `null` too, for a read that can see drafts. A row from before links had
11
- * a `type` is an external link by `linkTypeOf`, here, in the stock fields'
12
- * conditions and in the picker alike: the site keeps rendering its `href`,
13
- * the admin shows it as an External chip, and the site's migration to
14
- * `type: external` only makes the stored row say what every reader already
15
- * assumes.
16
- */
17
- function resolveLink(link) {
18
- if (!link) return null;
19
- if (linkTypeOf(link) === "page") {
20
- const page = link.page;
21
- if (!page || typeof page !== "object") return null;
22
- if (page._status === "draft") return null;
23
- return page.slug ? `/${page.slug}` : null;
24
- }
25
- return link.href ? link.href : null;
26
- }
27
- /**
28
- * Which of the two stored destinations a row is using. `type` decides; a row
29
- * with no `type` yet (saved before links had one) is read by what it holds,
30
- * an `href` making it external, the same reading `resolveLink` and the picker
31
- * make, so all three agree on every row.
32
- */
33
- function linkTypeOf(link) {
34
- if (link?.type === "external") return "external";
35
- if (link?.type === "page") return "page";
36
- return link?.href ? "external" : "page";
37
- }
38
- //#endregion
39
- export { resolveLink as n, linkTypeOf as t };
40
-
41
- //# sourceMappingURL=link-CnwLtm47.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-CnwLtm47.mjs","names":[],"sources":["../src/fields/link.ts"],"sourcesContent":["import type { Condition, Field, GroupField, RowField } from \"payload\";\n\n/**\n * The import-map path of the link picker, `LinkField` in\n * `@bison-lab/payload-blocks/admin`.\n *\n * It sits on the row that holds a link's `type`, `page` and `href`, and\n * replaces those three inputs with one box: type to search published pages,\n * or paste a URL. Referenced here by package specifier, like\n * `MIN_ROWS_ARRAY_FIELD`; a site picks it up with `payload generate:importmap`.\n * Until it does, Payload logs the missing entry and renders the row as\n * nothing (a custom `Field` with no component behind it is an empty element,\n * not the stock fields), so the step is part of adopting this release.\n */\nexport const LINK_FIELD = \"@bison-lab/payload-blocks/admin#LinkField\";\n\nexport type LinkType = \"page\" | \"external\";\n\n/**\n * A page as the `page` relationship populates it: what `resolveLink` reads,\n * and what the picker shows. A site's generated `Page` is assignable to it.\n * `_status` is absent on a collection without drafts, which counts as\n * published.\n */\nexport interface LinkPageDoc {\n id: number | string;\n title?: string | null;\n slug?: string | null;\n _status?: (\"draft\" | \"published\") | null;\n}\n\n/** Where a link goes: the three fields the picker writes. */\nexport interface LinkDestination {\n /** `page` unless the editor pasted a URL. Rows saved before links had a type carry only `href`. */\n type?: LinkType | null;\n /** The page's id, or the page itself once a `depth >= 1` read populates it. */\n page?: LinkPageDoc | number | string | null;\n /** The pasted URL of an external link. */\n href?: string | null;\n}\n\n/** The shape `linkField`/`linkFields` produce once Payload generates types. */\nexport interface LinkValue extends LinkDestination {\n label?: string | null;\n newTab?: boolean | null;\n}\n\n/**\n * Turns a link's destination into the `href` a renderer emits, or `null`\n * when there is nothing to point at, in which case the renderer shows the\n * label as text. A site passes its own (`RenderBlocks`' `resolveLink`) when\n * a page's path is not `/<slug>`: the package has no way to know a site's\n * routes, the same reason it takes an `imageComponent`.\n */\nexport type ResolveLink = (link: LinkDestination) => string | null;\n\n/**\n * The package's resolver: a published, populated page is `/<slug>`; an\n * external link is its `href` as typed.\n *\n * A page that did not populate is `null`: Payload hands the public read the\n * bare id when the reader may not see the page, which is what an unpublished\n * page looks like from the site. A populated page whose `_status` is `draft`\n * is `null` too, for a read that can see drafts. A row from before links had\n * a `type` is an external link by `linkTypeOf`, here, in the stock fields'\n * conditions and in the picker alike: the site keeps rendering its `href`,\n * the admin shows it as an External chip, and the site's migration to\n * `type: external` only makes the stored row say what every reader already\n * assumes.\n */\nexport function resolveLink(\n link: LinkDestination | null | undefined,\n): string | null {\n if (!link) return null;\n if (linkTypeOf(link) === \"page\") {\n const page = link.page;\n if (!page || typeof page !== \"object\") return null;\n if (page._status === \"draft\") return null;\n return page.slug ? `/${page.slug}` : null;\n }\n return link.href ? link.href : null;\n}\n\n/**\n * Which of the two stored destinations a row is using. `type` decides; a row\n * with no `type` yet (saved before links had one) is read by what it holds,\n * an `href` making it external, the same reading `resolveLink` and the picker\n * make, so all three agree on every row.\n */\nexport function linkTypeOf(link: LinkDestination | null | undefined): LinkType {\n if (link?.type === \"external\") return \"external\";\n if (link?.type === \"page\") return \"page\";\n return link?.href ? \"external\" : \"page\";\n}\n\nconst whenPage: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"page\";\n\nconst whenExternal: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"external\";\n\nexport interface LinkDestinationOptions {\n /** Require a destination. Defaults to `false`. */\n required?: boolean;\n /** The collection a page link points into. Defaults to `pages`. */\n pagesCollection?: string;\n}\n\n/**\n * Where a link goes, as stored: `type`, `page` and `href` in one row.\n *\n * The row carries the picker (`LINK_FIELD`), which replaces all three inputs\n * with one box. The stored fields are the website template's shape and stay\n * editable on their own: `page` shows for a page link, `href` for an external\n * one, and `required` binds whichever is active, since Payload skips\n * validation on a field whose condition is false. `page` offers published\n * rows only, and Payload re-checks that on publish, so a page that was\n * unpublished after being picked has to be picked again or republished.\n */\nexport function linkDestinationFields({\n required = false,\n pagesCollection = \"pages\",\n}: LinkDestinationOptions = {}): RowField[] {\n return [\n {\n type: \"row\",\n admin: { components: { Field: LINK_FIELD } },\n fields: [\n {\n name: \"type\",\n type: \"radio\",\n label: \"Goes to\",\n defaultValue: \"page\",\n options: [\n { label: \"Page\", value: \"page\" },\n { label: \"URL\", value: \"external\" },\n ],\n admin: { layout: \"horizontal\" },\n },\n {\n name: \"page\",\n type: \"relationship\",\n relationTo: pagesCollection,\n required,\n filterOptions: { _status: { equals: \"published\" } },\n admin: { condition: whenPage },\n },\n {\n name: \"href\",\n type: \"text\",\n label: \"URL\",\n required,\n admin: {\n condition: whenExternal,\n description:\n 'A full URL (\"https://example.com\"), \"mailto:\" or \"tel:\", or a site path (\"/contact\").',\n },\n },\n ],\n },\n ];\n}\n\nexport interface LinkFieldsOptions extends LinkDestinationOptions {\n /** Require the label and destination. Defaults to `false`. */\n required?: boolean;\n /** Wording for the visible text field. Defaults to \"Label\". */\n labelFieldLabel?: string;\n}\n\n/**\n * The fields a call to action is made of, unwrapped: the destination row,\n * then the label and the new-tab flag.\n *\n * `newTab` drives `target=\"_blank\"` *and* the matching `rel`, which is why no\n * renderer takes one without the other.\n */\nexport function linkFields({\n required = false,\n labelFieldLabel = \"Label\",\n pagesCollection,\n}: LinkFieldsOptions = {}): Field[] {\n return [\n ...linkDestinationFields({ required, pagesCollection }),\n { name: \"label\", type: \"text\", label: labelFieldLabel, required },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n },\n ];\n}\n\nexport interface LinkFieldOptions extends LinkFieldsOptions {\n /** Field name. Defaults to `link`. */\n name?: string;\n label?: GroupField[\"label\"];\n admin?: GroupField[\"admin\"];\n}\n\n/** `linkFields()` as one named group, for a block with a single CTA. */\nexport function linkField({\n name = \"link\",\n label,\n admin,\n ...rest\n}: LinkFieldOptions = {}): GroupField {\n return {\n name,\n type: \"group\",\n fields: linkFields(rest),\n ...(label === undefined ? {} : { label }),\n ...(admin === undefined ? {} : { admin }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsEA,SAAgB,YACd,MACe;AACf,KAAI,CAAC,KAAM,QAAO;AAClB,KAAI,WAAW,KAAK,KAAK,QAAQ;EAC/B,MAAM,OAAO,KAAK;AAClB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,MAAI,KAAK,YAAY,QAAS,QAAO;AACrC,SAAO,KAAK,OAAO,IAAI,KAAK,SAAS;;AAEvC,QAAO,KAAK,OAAO,KAAK,OAAO;;;;;;;;AASjC,SAAgB,WAAW,MAAoD;AAC7E,KAAI,MAAM,SAAS,WAAY,QAAO;AACtC,KAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,QAAO,MAAM,OAAO,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"seam-CmLb3BSo.mjs","names":[],"sources":["../src/link.tsx","../src/cx.ts","../src/seam.ts"],"sourcesContent":["import type { AnchorHTMLAttributes, ComponentType, ReactNode } from \"react\";\nimport type { RenderLink } from \"@bison-lab/ui\";\n\n/**\n * The link injection point, the same shape as `BlockImageComponent`.\n *\n * A renderer never writes `<a>` directly. A site hands in one link component\n * and every CMS link routes through it — Next's `Link`, so navigation stays\n * client-side. It is a *component type*, not a render function, for the same\n * reason the image seam is: a Server Component can pass a client component\n * reference across the boundary, but not a closure.\n *\n * `newTab` is the flag from `linkFields()`; `target` and `rel` are always\n * already expanded from it by the time the component is called, so an adapter\n * that only spreads the anchor attributes onto its router link is still safe.\n * The one thing an adapter must do is drop `newTab` before spreading, or React\n * warns about an unknown DOM attribute — see the README's `next/link` adapter.\n */\nexport interface BlockLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n children: ReactNode;\n newTab?: boolean;\n className?: string;\n}\n\nexport type BlockLinkComponent = ComponentType<BlockLinkProps>;\n\n/** `target` and `rel` together, or neither: a bare `target` is a tabnabbing hole. */\nexport function newTabAttributes(\n newTab: boolean | null | undefined,\n): Pick<AnchorHTMLAttributes<HTMLAnchorElement>, \"target\" | \"rel\"> {\n return newTab ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {};\n}\n\n/**\n * The fallback when no `linkComponent` is supplied: a plain `<a>`. Correct\n * everywhere and client-side nowhere, which is the right default for a package\n * that cannot know what router it landed in.\n */\nexport function DefaultBlockLink({\n href,\n newTab,\n children,\n ...rest\n}: BlockLinkProps) {\n return (\n <a href={href} {...rest} {...newTabAttributes(newTab)}>\n {children}\n </a>\n );\n}\nDefaultBlockLink.displayName = \"DefaultBlockLink\";\n\n/**\n * Adapts the seam to the `renderLink` prop every `@bison-lab/ui` block takes.\n * The ui blocks hand over `target`/`rel` already expanded, so `newTab` is\n * read back off `target` to keep the flag and the attributes in step.\n *\n * An empty `href` is a link with no destination: a page link whose page is\n * missing or unpublished (`resolveLink` gave `null`). It renders as text in\n * the same place, with the same class, so a call to action never points\n * nowhere and never throws.\n */\nexport function renderLinkWith(Link: BlockLinkComponent): RenderLink {\n return ({ href, children, ...rest }) =>\n href ? (\n <Link href={href} newTab={rest.target === \"_blank\"} {...rest}>\n {children}\n </Link>\n ) : (\n <span className={rest.className}>{children}</span>\n );\n}\n","/**\n * Class joining, locally.\n *\n * `cn()` from `@bison-lab/ui` cannot be used here: that barrel is stamped\n * `\"use client\"`, so calling it from a Server Component throws. The renderers\n * only ever concatenate their own literals with a caller-supplied string —\n * there are no conflicting Tailwind utilities to merge — so a join is enough.\n */\nexport function cx(...parts: (string | false | null | undefined)[]): string {\n return parts.filter(Boolean).join(\" \");\n}\n","import { cx } from \"./cx\";\nimport type { BlockLike, BlockRendererProps } from \"./render-blocks\";\nimport type { StatsBandBlockData } from \"./types\";\n\n/**\n * The seam contract: how a block that floats across the join between two\n * bands gets its neighbours to make room.\n *\n * A floating block pulls itself up over the block above and down over the\n * block below with `SEAM_PULL_UP` / `SEAM_PULL_DOWN`, and each neighbour adds\n * the same distance on its own side, so the block sits across the seam\n * without covering copy. `RenderBlocks` decides which rows float (its\n * `floats` prop, defaulting to `overlapsSeam`) and hands every renderer two\n * booleans, `overlapAbove` and `overlapBelow`; a renderer's band wrapper adds\n * `seamClasses(props)` and never looks at a neighbour's row.\n *\n * The four distances are one number in two directions, which is why they all\n * live here: change 16/20 in one place.\n */\n\n/** How far a floating block pulls itself up over the block above. */\nexport const SEAM_PULL_UP = \"-mt-16 lg:-mt-20\";\n\n/** How far a floating block pulls itself down over the block below. */\nexport const SEAM_PULL_DOWN = \"-mb-16 lg:-mb-20\";\n\n/** Extra top padding for the block *below* a floating block. */\nexport const OVERLAP_ABOVE_CLEARANCE = \"pt-16 lg:pt-20\";\n\n/** Extra bottom padding for the block *above* a floating block. */\nexport const OVERLAP_BELOW_CLEARANCE = \"pb-16 lg:pb-20\";\n\n/**\n * The default `floats`: the package's stats band with `overlap` on. A site\n * with its own floating block composes it —\n * `floats={(row) => overlapsSeam(row) || row.blockType === \"bookingCard\"}`.\n */\nexport function overlapsSeam(block: BlockLike | undefined): boolean {\n return (\n block?.blockType === \"statsBand\" &&\n Boolean((block as StatsBandBlockData).overlap)\n );\n}\n\n/** The clearance a band wrapper needs for its neighbours, as one class string. */\nexport function seamClasses({\n overlapAbove,\n overlapBelow,\n}: Pick<BlockRendererProps, \"overlapAbove\" | \"overlapBelow\">): string {\n return cx(\n overlapAbove && OVERLAP_ABOVE_CLEARANCE,\n overlapBelow && OVERLAP_BELOW_CLEARANCE,\n );\n}\n"],"mappings":";;;;AA6BA,SAAgB,iBACd,QACiE;AACjE,QAAO,SAAS;EAAE,QAAQ;EAAU,KAAK;EAAuB,GAAG,EAAE;;;;;;;AAQvE,SAAgB,iBAAiB,EAC/B,MACA,QACA,UACA,GAAG,QACc;AACjB,QACE,oBAAC,KAAD;EAAS;EAAM,GAAI;EAAM,GAAI,iBAAiB,OAAO;EAClD;EACC,CAAA;;AAGR,iBAAiB,cAAc;;;;;;;;;;;AAY/B,SAAgB,eAAe,MAAsC;AACnE,SAAQ,EAAE,MAAM,UAAU,GAAG,WAC3B,OACE,oBAAC,MAAD;EAAY;EAAM,QAAQ,KAAK,WAAW;EAAU,GAAI;EACrD;EACI,CAAA,GAEP,oBAAC,QAAD;EAAM,WAAW,KAAK;EAAY;EAAgB,CAAA;;;;;;;;;;;;AC/DxD,SAAgB,GAAG,GAAG,OAAsD;AAC1E,QAAO,MAAM,OAAO,QAAQ,CAAC,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;ACYxC,MAAa,eAAe;;AAG5B,MAAa,iBAAiB;;AAG9B,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;;;;;AAOvC,SAAgB,aAAa,OAAuC;AAClE,QACE,OAAO,cAAc,eACrB,QAAS,MAA6B,QAAQ;;;AAKlD,SAAgB,YAAY,EAC1B,cACA,gBACoE;AACpE,QAAO,GACL,gBAAA,kBACA,gBAAA,iBACD"}