@monospaced/set-core 0.12.0 → 0.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/helpers/node.ts","../src/helpers/string.ts","../src/components/icon/icons.generated.ts","../src/components/icon/icon.ts","../src/components/button/button.ts","../src/components/alert/alert.ts","../src/components/link/link.ts","../src/components/banner/banner.ts","../src/components/lightswitch/lightswitch.ts","../src/components/menu/menu.ts","../src/components/expander/expander.ts","../src/components/nav/nav.ts","../src/components/range/range.ts","../src/components/sidebar/sidebar.ts","../src/components/video/video.ts","../src/components/avatar/get-initials.ts","../src/components/avatar/avatar.ts","../src/components/badge/badge.ts","../src/components/text/text.ts","../src/components/blockquote/blockquote.ts","../src/components/box/box.ts","../src/components/card/card.ts","../src/components/checkbox/checkbox.ts","../src/components/container/container.ts","../src/components/details/details.ts","../src/components/divider/divider.ts","../src/components/fieldset/fieldset.ts","../src/components/figure/figure.ts","../src/components/grid/grid.ts","../src/components/heading/heading.ts","../src/components/image/image.ts","../src/components/inline/inline.ts","../src/components/input/input.ts","../src/components/logo/logos-animated.ts","../src/components/logo/logo.ts","../src/components/page/page.ts","../src/components/panel/panel.ts","../src/components/pattern/pattern.ts","../src/components/poster/poster.ts","../src/components/prose/prose.ts","../src/components/radios/radios.ts","../src/components/root/root.ts","../src/components/spinner/spinner.ts","../src/components/stack/stack.ts","../src/components/surface/surface.ts","../src/components/switch/switch.ts","../src/components/textarea/textarea.ts","../src/index.ts"],"sourcesContent":["/**\n * Intermediate representation for rendered markup.\n *\n * Core renderers produce a `SetNode` tree which can be either:\n * - serialized to an HTML string for SSR/Web Components, or\n * - walked by a framework adapter (e.g. React) to produce native elements.\n */\nexport type SetNode =\n | {\n kind: \"element\";\n tag: string;\n attrs: Record<string, string | boolean | undefined>;\n children: SetNode[];\n }\n | { kind: \"text\"; value: string }\n | { kind: \"raw\"; html: string };\n\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nfunction escapeHtml(value: string): string {\n return value\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"'\", \"&#39;\");\n}\n\nfunction serializeAttrs(\n record: Record<string, string | boolean | undefined>,\n): string {\n return Object.entries(record)\n .flatMap(([key, value]) => {\n if (value === false || value == null) return [];\n if (value === true) return [key];\n return [`${key}=\"${escapeHtml(String(value))}\"`];\n })\n .join(\" \");\n}\n\n/** Serializes a `SetNode` tree to an HTML string. */\nexport function serializeSetNode(node: SetNode): string {\n if (node.kind === \"text\") return escapeHtml(node.value);\n if (node.kind === \"raw\") return node.html;\n const attrString = serializeAttrs(node.attrs);\n const open = attrString ? `<${node.tag} ${attrString}>` : `<${node.tag}>`;\n if (VOID_ELEMENTS.has(node.tag)) return open;\n const inner = node.children.map(serializeSetNode).join(\"\");\n return `${open}${inner}</${node.tag}>`;\n}\n","/** Validates whether a string is a safe HTML id token. */\nexport function isValidHtmlId(value: string): boolean {\n return /^[A-Za-z][\\w:-]*$/.test(value);\n}\n\n/**\n * Normalises an optional consumer-provided id. Returns the trimmed id when\n * present and syntactically valid; returns `undefined` when the input is\n * absent, empty, or whitespace-only. Throws when a non-empty input fails\n * the HTML id syntax check.\n */\nexport function normalizeOptionalHtmlId(\n id: string | undefined,\n): string | undefined {\n if (id === undefined) return undefined;\n\n const trimmed = id.trim();\n\n if (!trimmed) return undefined;\n\n if (!isValidHtmlId(trimmed)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n return trimmed;\n}\n\n/** Trims and collapses internal whitespace; returns `undefined` for empty input. */\nexport function collapseWhitespace(\n value: string | undefined,\n): string | undefined {\n if (value == null) return undefined;\n\n const normalized = value.trim().replace(/\\s+/g, \" \");\n\n return normalized || undefined;\n}\n","// Generated by scripts/generate-icons.mjs — do not edit directly.\n// The shipped icons: the TDesign names in icons-tdesign.ts plus the first-party\n// icons in icons-custom.ts.\n// Regenerate with `pnpm icons:generate`.\n\nexport interface IconNode {\n tag: string;\n attrs: Record<string, string>;\n children?: IconNode[];\n}\n\nexport const ICON_NODES: Record<string, IconNode[]> = {\n adjustment: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21 5L10 5M10 5C10 6.10457 9.10457 7 8 7C6.89543 7 6 6.10457 6 5M10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5M6 5L3 5M21 19H10M10 19C10 20.1046 9.10457 21 8 21C6.89543 21 6 20.1046 6 19M10 19C10 17.8954 9.10457 17 8 17C6.89543 17 6 17.8954 6 19M3 12H14M14 12C14 13.1046 14.8954 14 16 14C17.1046 14 18 13.1046 18 12M14 12C14 10.8954 14.8954 10 16 10C17.1046 10 18 10.8954 18 12M6 19H3M18 12H21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-down\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 13.6L12 19.1L6.5 13.6M12 17.85V4.85\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-left\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M11 6.5L5.5 12L11 17.5M6.75 12H19.75\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-left-right-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M15.5 4L19 7.5L15.5 11M17.75 7.5H5.5M8.5 20L5 16.5L8.5 13M6.25 16.5H18.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-right\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M13 17.5L18.5 12L13 6.5M17.25 12L4.25 12\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-up\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 10.5L12 5L6.5 10.5M12 6.25V19.25\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-up-down-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M7.5 6.25V18.5M13 15.5L16.5 19L20 15.5M16.5 17.75V5.50001M11 8.5L7.5 5L4 8.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n check: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5708 7.37842L10.3785 16.5708L5.42871 11.6211\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"check-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M16.5 9L10.5 15L7.5 12\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"chevron-down\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 9.5L12 15L6.5 9.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"chevron-right\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9.5 17.5L15 12L9.5 6.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n circle: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"circle\",\n attrs: {\n cx: \"12\",\n cy: \"12\",\n r: \"10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"city-6\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M12 21V16M7 21H2V9H7V21ZM22 7V21H17V7H22Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M17 3H7V21H17V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n close: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n copy: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M10 10H21V21H10V10Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M14 6.5V3L3 3L3 14H6.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n download: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16.5 10.5L12 15L7.5 10.5M12 13.75V4\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M20.5 15V20H3.5V15\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n enter: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M5.75 16H16C17.6569 16 19 14.6569 19 13L19 5M8 12.5L4.5 16L8 19.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"error-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 7.5V13M12 16.5H12.0039V16.5039H12V16.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"error-triangle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M12.0003 3L22.2194 20.7H1.78125L12.0003 3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 10.5V14M12 17.5H12.0039V17.5039H12V17.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n horizontal: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 11H21V21H3V11Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V7H3V3Z\",\n },\n },\n ],\n },\n ],\n },\n ],\n image: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 16V3H21V21H20M3 16V21H20M3 16L9 10L20 21\",\n },\n },\n {\n tag: \"circle\",\n attrs: {\n cx: \"15.75\",\n cy: \"8.25\",\n r: \"2\",\n },\n },\n ],\n },\n ],\n \"info-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 16.5L12 11M12 7.5L11.9961 7.5L11.9961 7.49609L12 7.49609L12 7.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n jump: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9 4L4 4L4 20L20 20L20 15\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M19.25 4.75L12 12M14 4H20L20 10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n layers: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M4.5 6.125L12 3L19.5 6.125L12 9.25L4.5 6.125Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M3 11.5005L12 15.3771L21 11.5005M21 17.5005L12 21.3771L3 17.5005\",\n },\n },\n ],\n },\n ],\n link: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M11.6762 6.99023L13.9998 4.6666C15.4726 3.19382 17.8604 3.19382 19.3332 4.6666C20.806 6.13938 20.806 8.52723 19.3332 10L17.0096 12.3236M6.98974 11.6766L4.66611 14.0003C3.19333 15.4731 3.19333 17.8609 4.66611 19.3337C6.13889 20.8065 8.52675 20.8065 9.99953 19.3337L12.3232 17.0101M13.9985 9.99989L9.99847 14\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n member: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16 20V19C16 16.7909 14.2091 15 12 15H5C2.79086 15 1 16.7909 1 19V20M12.5 7C12.5 9.20914 10.7091 11 8.5 11C6.29086 11 4.5 9.20914 4.5 7C4.5 4.79086 6.29086 3 8.5 3C10.7091 3 12.5 4.79086 12.5 7Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M15.5 11C17.7091 11 19.5 9.20914 19.5 7C19.5 4.79086 17.7091 3 15.5 3M23 20V19C23 16.7909 21.2091 15 19 15\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n moon: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M20.5387 14.8522C20.0408 14.9492 19.5263 15 19 15C14.5817 15 11 11.4183 11 7C11 5.54296 11.3194 4.17663 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C15.9737 21 19.3459 18.4248 20.5387 14.8522Z\",\n },\n },\n ],\n },\n ],\n \"panel-left\": [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V21H3V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M9 3V21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n pantone: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3.35389 10.3333L20.8245 10.3333L19.0009 5L3.35389 10.3333ZM3.35389 10.3333L17.1433 5.63318L14.1465 1.43164L2.99942 10.3359M3.35389 10.3333L2.99942 10.3359M2.99942 10.3359H2.5\",\n },\n },\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M6.28516 15.1641H6.28906V15.168H6.28516V15.1641Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M22 10.333V19.9997L2 19.9997L2 10.333L22 10.333Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n },\n ],\n play: [\n {\n tag: \"path\",\n attrs: {\n fill: \"currentColor\",\n d: \"M18.25 11.9998L8.5 17.6289L8.5 6.37061L18.25 11.9998Z\",\n },\n },\n ],\n rectangle: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V21H3z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n refresh: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21.448 13C20.9483 17.7767 16.909 21.5 12 21.5C8.18227 21.5 4.89052 19.248 3.38065 16M2.5 20.5V15.5H5.5M2.55176 11C3.05145 6.22334 7.09079 2.5 11.9998 2.5C15.8175 2.5 19.1092 4.75197 20.6191 8M21.4998 3.5V8.5H18.4998\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"robot-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5 21V19.5C19.5 17.2909 17.7091 15.5 15.5 15.5H8.5C6.29086 15.5 4.5 17.2909 4.5 19.5V21M12 4V2M10 12H14C16.2091 12 18 10.2091 18 8C18 5.79086 16.2091 4 14 4H10C7.79086 4 6 5.79086 6 8C6 10.2091 7.79086 12 10 12ZM10.25 8C10.25 8.13807 10.1381 8.25 10 8.25C9.86193 8.25 9.75 8.13807 9.75 8C9.75 7.86193 9.86193 7.75 10 7.75C10.1381 7.75 10.25 7.86193 10.25 8ZM14 8.25C13.8619 8.25 13.75 8.13807 13.75 8C13.75 7.86193 13.8619 7.75 14 7.75C14.1381 7.75 14.25 7.86193 14.25 8C14.25 8.13807 14.1381 8.25 14 8.25Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n search: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M15.8027 15.8037L21.106 21.107\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M15.8033 15.8033C12.8744 18.7322 8.12563 18.7322 5.1967 15.8033C2.26777 12.8744 2.26777 8.12563 5.1967 5.1967C8.12563 2.26777 12.8744 2.26777 15.8033 5.1967C18.7322 8.12563 18.7322 12.8744 15.8033 15.8033Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"setting-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9.40811 4.95996L10.0001 2H14.0001L14.5921 4.95996C15.4027 5.25851 16.1475 5.69306 16.7989 6.23595L19.6604 5.26796L21.6604 8.73206L19.3922 10.7254C19.4632 11.1396 19.5001 11.5655 19.5001 12C19.5001 12.4345 19.4632 12.8604 19.3922 13.2747L21.6604 15.268L19.6604 18.7321L16.7989 17.7641C16.1475 18.3069 15.4027 18.7415 14.5921 19.04L14.0001 22H10.0001L9.40811 19.04C8.5975 18.7415 7.85268 18.3069 7.20131 17.7641L4.33984 18.7321L2.33984 15.268L4.60798 13.2747C4.53705 12.8604 4.5001 12.4345 4.5001 12C4.5001 11.5655 4.53705 11.1396 4.60797 10.7254L2.33984 8.73206L4.33984 5.26796L7.20129 6.23595C7.85266 5.69306 8.59749 5.25851 9.40811 4.95996Z\",\n \"fill-rule\": \"evenodd\",\n \"stroke-linecap\": \"square\",\n \"clip-rule\": \"evenodd\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"sticky-note\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M20 14H14V20M3 3H21V14L14 21H3V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M7 9H17M7 13H10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n sunny: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 21V22M12 2V3M3 12H2M22 12H21M5.63603 18.3635L4.92892 19.0706M19.0711 4.92848L18.364 5.63559M5.63601 5.63563L4.9289 4.92852M19.071 19.0707L18.3639 18.3636\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n swap: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21 14.5H4L9 19.5M3 9.5L20 9.5L15 4.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"user-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5 20V19C19.5 16.7909 17.7091 15 15.5 15H8.5C6.29086 15 4.5 16.7909 4.5 19V20M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"view-list\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 5H21M3 12H21M3 19H21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { ICON_NODES, type IconNode } from \"./icons.generated\";\nimport type { SET_ICON_CUSTOM } from \"./icons-custom\";\nimport type { TDESIGN_ICON_NAMES } from \"./icons-tdesign\";\n\nexport type SetIconMirrorMode = \"always\" | \"rtl\";\nexport type SetIconName =\n | (typeof TDESIGN_ICON_NAMES)[number]\n | keyof typeof SET_ICON_CUSTOM;\nexport type SetIconSize = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"fill\";\n\nexport const SET_ICON_NAMES = Object.keys(ICON_NODES) as SetIconName[];\n\nexport interface SetIconProps {\n /** Emits `aria-hidden=\"true\"` when true. @default true */\n ariaHidden?: boolean;\n /** DOM id. Required when `ariaHidden` is false. */\n id?: string;\n /** SVG title text. Required when `ariaHidden` is false. */\n title?: string;\n /** Set icon name. */\n name: SetIconName;\n /** Horizontal mirroring behavior. Omit for no mirroring. */\n mirrored?: SetIconMirrorMode;\n /** Size variant. @default \"md\" */\n size?: SetIconSize;\n}\n\nfunction iconNodesToSetNodes(nodes: IconNode[]): SetNode[] {\n return nodes.map((node) => ({\n kind: \"element\",\n tag: node.tag,\n attrs: node.attrs,\n children: node.children ? iconNodesToSetNodes(node.children) : [],\n }));\n}\n\n/**\n * Builds the IR tree for the Set icon component.\n *\n * Emits inline `<svg>` markup for a Set icon. Stroke, fill, and linecap are\n * authored per-path in the source SVGs, so the SVG root does not set them.\n *\n * @param props - Icon component props.\n * @returns IR node for the Set icon component.\n */\nexport function buildSetIcon({\n ariaHidden = true,\n id,\n mirrored,\n name,\n size = \"md\",\n title,\n}: SetIconProps): SetNode {\n const iconNodes = ICON_NODES[name];\n\n if (!iconNodes) {\n throw new Error(`Unknown icon name: ${name}`);\n }\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedTitle = title?.trim();\n\n if (!ariaHidden && !normalizedTitle) {\n throw new Error(\"title must be non-empty when ariaHidden is false.\");\n }\n\n if (!ariaHidden && !normalizedId) {\n throw new Error(\"id must be provided when ariaHidden is false.\");\n }\n\n const titleId = !ariaHidden ? `${normalizedId}-title` : undefined;\n\n const children: SetNode[] = [];\n if (!ariaHidden) {\n children.push({\n kind: \"element\",\n tag: \"title\",\n attrs: { id: titleId },\n children: [{ kind: \"text\", value: normalizedTitle! }],\n });\n }\n children.push(...iconNodesToSetNodes(iconNodes));\n\n return {\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": ariaHidden ? \"true\" : undefined,\n \"aria-labelledby\": titleId,\n class: \"set-icon\",\n \"data-mirrored\": mirrored,\n \"data-size\": size,\n fill: \"none\",\n height: \"24\",\n id: normalizedId,\n role: !ariaHidden ? \"img\" : undefined,\n stroke: \"currentColor\",\n \"stroke-width\": \"1.75\",\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\",\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set icon component.\n *\n * Emits inline `<svg>` markup for a Set icon.\n *\n * @param props - Icon component props.\n * @returns HTML string for the Set icon component.\n */\nexport function renderSetIcon(props: SetIconProps): string {\n return serializeSetNode(buildSetIcon(props));\n}\n\n/** Declarative icon contract mirror for tooling, docs, and adapters. */\nexport const SET_ICON_SPEC: SetComponentSpec = {\n name: \"icon\",\n description: \"Use `icon` to render a Set icon.\",\n output: { element: \"svg\", class: \"set-icon\" },\n content: { kind: \"none\" },\n props: {\n ariaHidden: {\n default: true,\n description:\n \"Hides the icon from assistive technology. Decorative by default; set to false for a labelled icon (then `title` and `id` are required).\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`ariaHidden` is false\",\n type: { kind: \"string\" },\n },\n mirrored: {\n description: \"Mirrors the icon horizontally.\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n name: {\n description: \"Set icon name.\",\n required: true,\n type: { kind: \"iconName\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"fill\"],\n },\n },\n title: {\n description: \"Accessible title announced by assistive technology.\",\n requiredWhen: \"`ariaHidden` is false\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"aria-hidden\",\n condition: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-mirrored\",\n condition: { kind: \"when-provided\", prop: \"mirrored\" },\n value: { kind: \"prop\", prop: \"mirrored\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"fill\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"height\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"24\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"not\",\n of: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n },\n value: { kind: \"literal\", text: \"img\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"stroke\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"currentColor\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"stroke-width\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"1.75\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"viewBox\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"0 0 24 24\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"xmlns\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"http://www.w3.org/2000/svg\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n renderSetIcon,\n type SetIconMirrorMode,\n type SetIconName,\n} from \"../icon/icon\";\n\nexport type SetButtonAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetButtonHasPopup = \"menu\";\nexport type SetButtonLabelVisibility =\n | \"visible\"\n | \"hidden\"\n | \"hiddenBelowTablet\";\nexport type SetButtonPlacement = \"start\" | \"end\";\nexport type SetButtonSize = \"sm\" | \"md\" | \"lg\";\nexport type SetButtonTone = \"default\" | \"neutral\";\nexport type SetButtonType = \"button\" | \"submit\";\n\nexport interface SetButtonProps {\n /**\n * Structural style.\n * @default \"outline\"\n */\n appearance?: SetButtonAppearance;\n /**\n * Controlled element id for disclosure-style button interactions.\n * Ignored when `disclosure` is false or omitted.\n */\n controls?: string;\n /**\n * Disables interaction.\n * @default false\n */\n disabled?: boolean;\n /**\n * Emits `aria-expanded=\"false\"` for disclosure-style button interactions.\n * SSR renderers are expected to update the attribute at runtime if state changes.\n * @default false\n */\n disclosure?: boolean;\n /** Optional form owner ID. */\n form?: string;\n /**\n * Popup type for button interactions.\n */\n haspopup?: SetButtonHasPopup;\n /** DOM id. */\n id?: string;\n /** Optional icon name. */\n icon?: SetIconName;\n /** Optional icon mirroring mode. Ignored when `icon` is omitted. */\n iconMirrored?: SetIconMirrorMode;\n /**\n * Icon placement when icon is present.\n * @default \"start\"\n */\n iconPlacement?: SetButtonPlacement;\n /** Accessible name text rendered as content (escaped before render). */\n label: string;\n /**\n * Controls whether the visible label is shown alongside the icon.\n * Non-visible values require `icon`.\n * @default \"visible\"\n */\n labelVisibility?: SetButtonLabelVisibility;\n /** Optional submitted field name. */\n name?: string;\n /**\n * Size variant.\n * @default \"md\"\n */\n size?: SetButtonSize;\n /**\n * Semantic color intent.\n * @default \"default\"\n */\n tone?: SetButtonTone;\n /**\n * Native button type.\n * @default \"button\"\n */\n type?: SetButtonType;\n /** Optional submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the `SetNode` IR for the Set button component.\n *\n * This is the shape consumed by framework adapters. The SSR renderer\n * `renderSetButton` is implemented as `serialize(buildSetButton(props))`.\n */\nexport function buildSetButton(props: SetButtonProps): SetNode {\n const {\n appearance = \"outline\",\n controls,\n disabled,\n disclosure,\n form,\n haspopup,\n id,\n icon,\n iconMirrored,\n iconPlacement = \"start\",\n label,\n labelVisibility = \"visible\",\n name,\n size = \"md\",\n tone = \"default\",\n type,\n value,\n } = props;\n\n const normalizedIconName = icon || undefined;\n const hasIcon = Boolean(normalizedIconName);\n\n if (labelVisibility !== \"visible\" && !hasIcon) {\n throw new Error(\"labelVisibility requires icon when label is not visible.\");\n }\n\n const iconNode: SetNode | null =\n hasIcon && normalizedIconName\n ? {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n {\n kind: \"raw\",\n html: renderSetIcon({\n ariaHidden: true,\n mirrored: iconMirrored,\n name: normalizedIconName,\n size: \"fill\",\n }),\n },\n ],\n }\n : null;\n\n const labelNode: SetNode = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n };\n\n const children: SetNode[] = iconNode\n ? iconPlacement === \"end\"\n ? [labelNode, iconNode]\n : [iconNode, labelNode]\n : [labelNode];\n\n return {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-controls\": disclosure ? controls || undefined : undefined,\n \"aria-expanded\": disclosure ? \"false\" : undefined,\n \"aria-haspopup\": haspopup || undefined,\n class: \"set-button\",\n \"data-appearance\": appearance,\n \"data-label-visibility\":\n labelVisibility === \"visible\" ? undefined : labelVisibility,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n disabled: Boolean(disabled),\n form: form || undefined,\n id: id || undefined,\n name: name || undefined,\n type: type || \"button\",\n value: value || undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set button component.\n *\n * @param props - Button component props.\n * @returns HTML string for a `<button>` element.\n */\nexport function renderSetButton(props: SetButtonProps): string {\n return serializeSetNode(buildSetButton(props));\n}\n\n/** Declarative button contract mirror for tooling, docs, and adapters. */\nexport const SET_BUTTON_SPEC: SetComponentSpec = {\n name: \"button\",\n description: \"Use `button` to let users trigger actions.\",\n output: { element: \"button\", class: \"set-button\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n appearance: {\n default: \"outline\",\n description: \"Visual appearance.\",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n controls: {\n description: \"`id` of the element this button controls.\",\n ignoredWhen: \"`disclosure` is false\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n disclosure: {\n default: false,\n description:\n \"Marks the button as a disclosure toggle for another element.\",\n type: { kind: \"boolean\" },\n },\n form: {\n description: \"`id` of the form this button belongs to.\",\n type: { kind: \"string\" },\n },\n haspopup: {\n description:\n \"Signals that activating the button opens a popup of this type.\",\n type: { kind: \"enum\", values: [\"menu\"] },\n },\n icon: {\n description: \"Icon shown alongside the label.\",\n requiredWhen: \"`labelVisibility` is hidden or hiddenBelowTablet\",\n type: { kind: \"iconName\" },\n },\n iconMirrored: {\n description: \"Mirrors the icon horizontally.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n iconPlacement: {\n default: \"start\",\n description: \"Where the icon sits relative to the label.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description: \"`id` for the button.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"text\" },\n },\n labelVisibility: {\n default: \"visible\",\n description: \"How the label is shown. Hidden values require an icon.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n type: {\n default: \"button\",\n description: \"Native button type.\",\n type: { kind: \"enum\", values: [\"button\", \"submit\"] },\n },\n value: {\n description: \"Value submitted with the form.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-appearance\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-label-visibility\",\n condition: {\n kind: \"when-in\",\n prop: \"labelVisibility\",\n values: [\"hidden\", \"hiddenBelowTablet\"],\n },\n value: { kind: \"prop\", prop: \"labelVisibility\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-expanded\",\n condition: { kind: \"when-truthy\", prop: \"disclosure\" },\n value: { kind: \"literal\", text: \"false\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-controls\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"disclosure\" },\n { kind: \"when-non-empty\", prop: \"controls\" },\n ],\n },\n value: { kind: \"prop\", prop: \"controls\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-haspopup\",\n condition: { kind: \"when-provided\", prop: \"haspopup\" },\n value: { kind: \"prop\", prop: \"haspopup\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"form\",\n condition: { kind: \"when-non-empty\", prop: \"form\" },\n value: { kind: \"prop\", prop: \"form\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"type\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\nimport { renderSetButton } from \"../button/button\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\n\nexport const SET_ALERT_TAG_NAME = \"set-alert\";\nexport const SET_ALERT_EVENT_BEFORE_DISMISS = \"set-alert-before-dismiss\";\nexport const SET_ALERT_EVENT_DISMISS = \"set-alert-dismiss\";\n\nconst dismissibleLabelDefault = \"Dismiss alert\";\n\nexport type SetAlertSize = \"sm\" | \"md\";\n\nexport type SetAlertTone = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface SetAlertProps {\n /** Whether the runtime custom element should inject a dismiss control. @default false */\n dismissible?: boolean;\n /** Accessible label for the runtime dismiss control. Ignored when not dismissible. @default \"Dismiss alert\" */\n dismissibleLabel?: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Alert body text (escaped before render). */\n message: string;\n /** Size variant. @default \"md\" */\n size?: SetAlertSize;\n /** Semantic message intent. */\n tone?: SetAlertTone;\n /** Optional short heading/title text (escaped before render). */\n title?: string;\n}\n\nfunction createDismissButtonElement(\n dismissibleLabel: string,\n document: Document,\n): HTMLElement {\n const wrapper = document.createElement(\"div\");\n wrapper.setAttribute(\"data-part\", \"close\");\n wrapper.innerHTML = renderSetButton({\n appearance: \"text\",\n icon: \"close\",\n label: dismissibleLabel,\n labelVisibility: \"hidden\",\n size: \"sm\",\n tone: \"neutral\",\n });\n return wrapper;\n}\n\nfunction getAlertIconName(tone?: SetAlertTone): SetIconName {\n switch (tone) {\n case \"success\":\n return \"check-circle\";\n case \"warning\":\n return \"error-triangle\";\n case \"error\":\n return \"error-circle\";\n case \"info\":\n return \"info-circle\";\n default:\n return \"sticky-note\";\n }\n}\n\nfunction getAlertRole(tone?: SetAlertTone): \"status\" | \"alert\" {\n return tone === \"warning\" || tone === \"error\" ? \"alert\" : \"status\";\n}\n\n/**\n * Builds the IR tree for the Set alert component.\n *\n * @param props - Alert component props.\n * @returns IR node for a `set-alert` host.\n */\nexport function buildSetAlert({\n dismissible,\n dismissibleLabel = dismissibleLabelDefault,\n id,\n inlineSize = \"full\",\n message,\n size = \"md\",\n tone,\n title,\n}: SetAlertProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDismissibleLabel =\n dismissibleLabel.trim() === \"\" ? dismissibleLabelDefault : dismissibleLabel;\n\n const contentChildren: SetNode[] = [];\n if (title) {\n contentChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"title\" },\n children: [{ kind: \"text\", value: title }],\n });\n }\n contentChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"message\" },\n children: [{ kind: \"text\", value: message }],\n });\n\n return {\n kind: \"element\",\n tag: SET_ALERT_TAG_NAME,\n attrs: {\n class: \"set-alert\",\n \"data-dismissible\": dismissible,\n \"data-dismissible-label\": dismissible\n ? normalizedDismissibleLabel\n : undefined,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n \"data-size\": size,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n role: getAlertRole(tone),\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: getAlertIconName(tone),\n size,\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: contentChildren,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set alert component.\n *\n * Emits meaningful light-DOM HTML inside a `set-alert` host. When\n * `dismissible` is true, runtime hydration may add a dismiss button and remove\n * the host element when that control is activated, subject to the cancelable\n * before-dismiss event.\n *\n * @param props - Alert component props.\n * @returns HTML string for a `set-alert` host.\n */\nexport function renderSetAlert(props: SetAlertProps): string {\n return serializeSetNode(buildSetAlert(props));\n}\n\n/**\n * Defines the `set-alert` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-alert` hosts will\n * upgrade in place and, when dismissible, receive an interactive dismiss\n * control in light DOM.\n *\n * Class declaration is nested so importing this module in environments\n * without an `HTMLElement` global (Node-based tooling like the adapter\n * codegen) doesn't throw at load time.\n */\nexport function defineSetAlert(): void {\n if (customElements.get(SET_ALERT_TAG_NAME)) return;\n\n class SetAlertElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"close\"]')) return;\n\n const beforeDismissEvent = new CustomEvent(\n SET_ALERT_EVENT_BEFORE_DISMISS,\n {\n bubbles: true,\n cancelable: true,\n },\n );\n\n if (!this.dispatchEvent(beforeDismissEvent)) return;\n\n this.dispatchEvent(\n new CustomEvent(SET_ALERT_EVENT_DISMISS, {\n bubbles: true,\n }),\n );\n this.remove();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n\n if (!this.hasAttribute(\"data-dismissible\")) return;\n\n this.#ensureDismissControl();\n this.addEventListener(\"click\", this.#onClick);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #ensureDismissControl(): void {\n if (this.querySelector('[data-part=\"close\"]')) return;\n\n this.append(\n createDismissButtonElement(\n this.getAttribute(\"data-dismissible-label\") ??\n dismissibleLabelDefault,\n this.ownerDocument,\n ),\n );\n }\n }\n\n customElements.define(SET_ALERT_TAG_NAME, SetAlertElement);\n}\n\n/** Declarative alert contract mirror for tooling, docs, and adapters. */\nexport const SET_ALERT_SPEC: SetComponentSpec = {\n name: \"alert\",\n description: \"Use `alert` to surface short, important messages.\",\n output: {\n element: SET_ALERT_TAG_NAME,\n class: \"set-alert\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"title\", kind: \"text\" },\n { prop: \"message\", kind: \"text\" },\n ],\n },\n props: {\n dismissible: {\n default: false,\n description: \"Shows a dismiss control that removes the alert.\",\n type: { kind: \"boolean\" },\n },\n dismissibleLabel: {\n default: dismissibleLabelDefault,\n description: \"Accessible label for the dismiss control.\",\n ignoredWhen: \"`dismissible` is false\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the alert fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n message: {\n description: \"Body text of the alert.\",\n required: true,\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n title: {\n description: \"Bold text above the message.\",\n type: { kind: \"text\" },\n },\n tone: {\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"info\", \"success\", \"warning\", \"error\"] },\n },\n },\n events: {\n [SET_ALERT_EVENT_BEFORE_DISMISS]: {\n bubbles: true,\n cancelable: true,\n description:\n \"Fired before the alert is removed by a dismiss action. Call `preventDefault()` to keep the alert mounted.\",\n },\n [SET_ALERT_EVENT_DISMISS]: {\n bubbles: true,\n description:\n \"Fired after the alert has been removed by an allowed dismiss action.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"warning\", \"error\"],\n },\n value: { kind: \"literal\", text: \"alert\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"not\",\n of: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"warning\", \"error\"],\n },\n },\n value: { kind: \"literal\", text: \"status\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible\",\n condition: { kind: \"when-truthy\", prop: \"dismissible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"dismissible\" },\n { kind: \"when-non-empty\", prop: \"dismissibleLabel\" },\n ],\n },\n value: { kind: \"prop\", prop: \"dismissibleLabel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"dismissible\" },\n {\n kind: \"not\",\n of: { kind: \"when-non-empty\", prop: \"dismissibleLabel\" },\n },\n ],\n },\n value: { kind: \"literal\", text: dismissibleLabelDefault },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetLinkAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetLinkCurrent = \"page\";\nexport type SetLinkLabelVisibility = \"visible\" | \"hidden\" | \"hiddenBelowTablet\";\nexport type SetLinkPlacement = \"start\" | \"end\";\nexport type SetLinkSize = \"sm\" | \"md\" | \"lg\";\nexport type SetLinkTarget = \"_blank\" | \"_parent\" | \"_self\" | \"_top\";\nexport type SetLinkTone = \"default\" | \"neutral\";\n\nexport interface SetLinkProps {\n /**\n * Visual appearance. Defaults to the plain link style (`\"text\"`); set\n * `\"outline\"` or `\"solid\"` for button-like treatments.\n * @default \"text\"\n */\n appearance?: SetLinkAppearance;\n /** Emits `aria-current` with this value. */\n current?: SetLinkCurrent;\n /** Optional `download` attribute (`true` or suggested filename). */\n download?: boolean | string;\n /** Link destination. */\n href: string;\n /** DOM id. */\n id?: string;\n /** Optional icon markup rendered alongside the label. Caller sanitizes untrusted content. */\n icon?: string;\n /**\n * Icon placement when icon is present.\n * @default \"start\"\n */\n iconPlacement?: SetLinkPlacement;\n /** Accessible label text rendered as content (escaped before render). */\n label: string;\n /**\n * Controls whether the visible label is shown alongside the icon.\n * Non-visible values require `icon`.\n * @default \"visible\"\n */\n labelVisibility?: SetLinkLabelVisibility;\n /** Optional explicit `rel` value. Ignored when `download` is set. */\n rel?: string;\n /** Size variant. @default \"md\" */\n size?: SetLinkSize;\n /** Optional link target. Ignored when `download` is set. */\n target?: SetLinkTarget;\n /** Tone variant. @default \"default\" */\n tone?: SetLinkTone;\n /**\n * Underline variant; emits `data-underline` only when true.\n * Ignored when `appearance` is not `\"text\"`.\n * @default false\n */\n underline?: boolean;\n}\n\nfunction normalizeDownload(\n value?: boolean | string,\n): string | boolean | undefined {\n if (!value) return undefined;\n if (value === true) return true;\n return value;\n}\n\n/**\n * Builds the IR tree for the Set link component.\n *\n * @param props - Link component props.\n * @returns IR node for an `<a>` element.\n * @remarks\n * - `label` is escaped before render\n * - `icon`, when provided, is rendered as trusted inline markup\n */\nexport function buildSetLink(props: SetLinkProps): SetNode {\n const {\n appearance = \"text\",\n current,\n download,\n href,\n id,\n icon,\n iconPlacement = \"start\",\n label,\n labelVisibility = \"visible\",\n rel,\n size = \"md\",\n target,\n tone = \"default\",\n underline,\n } = props;\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedIcon = icon?.trim() || undefined;\n const hasIcon = Boolean(normalizedIcon);\n\n if (labelVisibility !== \"visible\" && !hasIcon) {\n throw new Error(\"labelVisibility requires icon when label is not visible.\");\n }\n\n const normalizedDownload = normalizeDownload(download);\n\n const iconNode: SetNode | null = normalizedIcon\n ? {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [{ kind: \"raw\", html: normalizedIcon }],\n }\n : null;\n\n const labelNode: SetNode = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n };\n\n const children: SetNode[] = iconNode\n ? iconPlacement === \"end\"\n ? [labelNode, iconNode]\n : [iconNode, labelNode]\n : [labelNode];\n\n return {\n kind: \"element\",\n tag: \"a\",\n attrs: {\n \"aria-current\": current,\n class: \"set-link\",\n \"data-appearance\": appearance === \"text\" ? undefined : appearance,\n \"data-label-visibility\":\n labelVisibility === \"visible\" ? undefined : labelVisibility,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n \"data-underline\": underline && appearance === \"text\" ? true : undefined,\n download: normalizedDownload,\n href,\n id: normalizedId,\n rel: normalizedDownload ? undefined : rel || undefined,\n target: normalizedDownload ? undefined : target || undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set link component.\n *\n * @param props - Link component props.\n * @returns HTML string for an `<a>` element.\n */\nexport function renderSetLink(props: SetLinkProps): string {\n return serializeSetNode(buildSetLink(props));\n}\n\n/** Declarative link contract mirror for tooling, docs, and adapters. */\nexport const SET_LINK_SPEC: SetComponentSpec = {\n name: \"link\",\n description: \"Use `link` to navigate to another page or resource.\",\n output: { element: \"a\", class: \"set-link\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"icon\", kind: \"html\" },\n ],\n },\n props: {\n appearance: {\n default: \"text\",\n description:\n \"Visual appearance. `text` is a standard link; `outline` and `solid` give button-styled treatments. \",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n current: {\n description:\n \"Marks the link as the current item in its set; emits `aria-current` with this value.\",\n type: { kind: \"enum\", values: [\"page\"] },\n },\n download: {\n description:\n \"Saves the target instead of navigating. Pass a filename or `true`.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"boolean\" }, { kind: \"string\" }],\n },\n },\n href: {\n description: \"Link destination.\",\n required: true,\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n icon: {\n description:\n \"Icon markup shown alongside the label. Set icon component, or SVG markup from https://simpleicons.org/ for third-party logos.\",\n requiredWhen: \"`labelVisibility` is hidden or hiddenBelowTablet\",\n type: { kind: \"html\" },\n },\n iconPlacement: {\n default: \"start\",\n description: \"Where the icon sits relative to the label.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"text\" },\n },\n labelVisibility: {\n default: \"visible\",\n description: \"How the label is shown. Hidden values require an icon.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n rel: {\n description: \"Explicit `rel` attribute.\",\n ignoredWhen: \"`download` is set\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n target: {\n description: \"Where to open the link.\",\n ignoredWhen: \"`download` is set\",\n type: {\n kind: \"enum\",\n values: [\"_blank\", \"_parent\", \"_self\", \"_top\"],\n },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n underline: {\n default: false,\n description: \"Underlines the link.\",\n ignoredWhen: \"`appearance` is not `text`\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"href\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"href\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-current\",\n condition: { kind: \"when-provided\", prop: \"current\" },\n value: { kind: \"prop\", prop: \"current\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"download\",\n condition: { kind: \"when-truthy\", prop: \"download\" },\n value: { kind: \"prop\", prop: \"download\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"rel\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-non-empty\", prop: \"rel\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"download\" } },\n ],\n },\n value: { kind: \"prop\", prop: \"rel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"target\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"target\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"download\" } },\n ],\n },\n value: { kind: \"prop\", prop: \"target\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-appearance\",\n condition: {\n kind: \"when-in\",\n prop: \"appearance\",\n values: [\"outline\", \"solid\"],\n },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-label-visibility\",\n condition: {\n kind: \"when-in\",\n prop: \"labelVisibility\",\n values: [\"hidden\", \"hiddenBelowTablet\"],\n },\n value: { kind: \"prop\", prop: \"labelVisibility\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-underline\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"underline\" },\n { kind: \"when-equals\", prop: \"appearance\", to: \"text\" },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetButton } from \"../button/button\";\nimport { buildSetLink } from \"../link/link\";\n\nexport const SET_BANNER_TAG_NAME = \"set-banner\";\n\nexport type SetBannerTone = \"info\" | \"warning\" | \"error\";\nexport const SET_BANNER_EVENT_BEFORE_DISMISS = \"set-banner-before-dismiss\";\nexport const SET_BANNER_EVENT_DISMISS = \"set-banner-dismiss\";\n\nconst dismissibleLabelDefault = \"Dismiss banner\";\n\nexport interface SetBannerProps {\n /** URL for an optional secondary link action rendered inline within the message.\n * Must be provided together with `actionLabel`. */\n actionHref?: string;\n /** Text label for an optional secondary link action rendered inline within the message.\n * Must be provided together with `actionHref`. */\n actionLabel?: string;\n /** Whether the runtime custom element should inject a dismiss control. @default true */\n dismissible?: boolean;\n /** Accessible label for the runtime dismiss control. Ignored when not dismissible.\n * @default \"Dismiss banner\" */\n dismissibleLabel?: string;\n /** DOM id. */\n id?: string;\n /** Banner body text (escaped before render). */\n message: string;\n /** Semantic message intent. */\n tone?: SetBannerTone;\n}\n\nfunction createDismissButtonElement(\n dismissibleLabel: string,\n document: Document,\n): HTMLElement {\n const wrapper = document.createElement(\"div\");\n wrapper.setAttribute(\"data-part\", \"close\");\n wrapper.innerHTML = renderSetButton({\n appearance: \"text\",\n icon: \"close\",\n label: dismissibleLabel,\n labelVisibility: \"hidden\",\n size: \"sm\",\n tone: \"neutral\",\n });\n return wrapper;\n}\n\n/**\n * Builds the IR tree for the Set banner component.\n *\n * @param props - Banner component props.\n * @returns IR node for a `set-banner` host.\n */\nexport function buildSetBanner({\n actionHref,\n actionLabel,\n dismissible = true,\n dismissibleLabel = dismissibleLabelDefault,\n id,\n message,\n tone,\n}: SetBannerProps): SetNode {\n if (Boolean(actionHref) !== Boolean(actionLabel)) {\n throw new Error(\"actionHref and actionLabel must be provided together.\");\n }\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDismissibleLabel =\n dismissibleLabel.trim() === \"\" ? dismissibleLabelDefault : dismissibleLabel;\n\n const messageChildren: SetNode[] = [{ kind: \"text\", value: message }];\n\n if (actionHref && actionLabel) {\n messageChildren.push({ kind: \"text\", value: \" \" });\n messageChildren.push(\n buildSetLink({\n href: actionHref,\n label: actionLabel,\n underline: true,\n }),\n );\n }\n\n return {\n kind: \"element\",\n tag: SET_BANNER_TAG_NAME,\n attrs: {\n class: \"set-banner\",\n \"data-set-content-theme\": \"dark\",\n \"data-set-surface\": \"default\",\n \"data-dismissible\": dismissible,\n \"data-dismissible-label\": dismissible\n ? normalizedDismissibleLabel\n : undefined,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"message\" },\n children: messageChildren,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set banner component.\n *\n * Emits meaningful light-DOM HTML inside a `set-banner` host. When\n * `dismissible` is true, runtime hydration may add a dismiss button and remove\n * the host element when that control is activated, subject to the cancelable\n * before-dismiss event.\n *\n * @param props - Banner component props.\n * @returns HTML string for a `set-banner` host.\n */\nexport function renderSetBanner(props: SetBannerProps): string {\n return serializeSetNode(buildSetBanner(props));\n}\n\n/**\n * Defines the `set-banner` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-banner` hosts will\n * upgrade in place and, when dismissible, receive an interactive dismiss\n * control in light DOM.\n */\nexport function defineSetBanner(): void {\n if (customElements.get(SET_BANNER_TAG_NAME)) return;\n\n class SetBannerElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"close\"]')) return;\n\n const beforeDismissEvent = new CustomEvent(\n SET_BANNER_EVENT_BEFORE_DISMISS,\n {\n bubbles: true,\n cancelable: true,\n },\n );\n\n if (!this.dispatchEvent(beforeDismissEvent)) return;\n\n this.dispatchEvent(\n new CustomEvent(SET_BANNER_EVENT_DISMISS, {\n bubbles: true,\n }),\n );\n this.remove();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n\n if (!this.hasAttribute(\"data-dismissible\")) return;\n\n this.#ensureDismissControl();\n this.addEventListener(\"click\", this.#onClick);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #ensureDismissControl(): void {\n if (this.querySelector('[data-part=\"close\"]')) return;\n\n this.append(\n createDismissButtonElement(\n this.getAttribute(\"data-dismissible-label\") ??\n dismissibleLabelDefault,\n this.ownerDocument,\n ),\n );\n }\n }\n\n customElements.define(SET_BANNER_TAG_NAME, SetBannerElement);\n}\n\n/** Declarative banner contract mirror for tooling, docs, and adapters. */\nexport const SET_BANNER_SPEC: SetComponentSpec = {\n name: \"banner\",\n description: \"Use `banner` to display a prominent site-wide message.\",\n output: { element: SET_BANNER_TAG_NAME, class: \"set-banner\" },\n content: { kind: \"text\", prop: \"message\" },\n props: {\n actionHref: {\n description:\n \"URL for an inline link action rendered after the `message`.\",\n requiredWhen: \"`actionLabel` is provided\",\n type: { kind: \"string\" },\n },\n actionLabel: {\n description:\n \"Text label for an inline link action rendered after the `message`.\",\n requiredWhen: \"`actionHref` is provided\",\n type: { kind: \"text\" },\n },\n dismissible: {\n default: true,\n description: \"Shows a dismiss control that removes the banner.\",\n type: { kind: \"boolean\" },\n },\n dismissibleLabel: {\n default: dismissibleLabelDefault,\n description: \"Accessible label for the dismiss control.\",\n ignoredWhen: \"`dismissible` is false\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n message: {\n description: \"Body text of the banner.\",\n required: true,\n type: { kind: \"text\" },\n },\n tone: {\n description: \"Semantic tone.\",\n type: {\n kind: \"enum\",\n values: [\"info\", \"warning\", \"error\"],\n },\n },\n },\n events: {\n [SET_BANNER_EVENT_BEFORE_DISMISS]: {\n bubbles: true,\n cancelable: true,\n description:\n \"Fired before the banner is removed by a dismiss action. Call `preventDefault()` to keep the banner mounted.\",\n },\n [SET_BANNER_EVENT_DISMISS]: {\n bubbles: true,\n description:\n \"Fired after the banner has been removed by an allowed dismiss action.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"dark\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"default\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible\",\n condition: { kind: \"when-truthy\", prop: \"dismissible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\nimport type { SetTheme } from \"../root/root\";\n\nexport const SET_LIGHTSWITCH_TAG_NAME = \"set-lightswitch\";\nexport const SET_LIGHTSWITCH_EVENT_CHANGE = \"set-lightswitch-change\";\nexport const SET_LIGHTSWITCH_STORAGE_KEY = \"set-theme\";\n\nconst labelDarkDefault = \"Switch to dark theme\";\nconst labelLightDefault = \"Switch to light theme\";\n\nexport type SetLightswitchAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetLightswitchSize = \"sm\" | \"md\" | \"lg\";\n\nfunction oppositeTheme(theme: SetTheme): SetTheme {\n return theme === \"dark\" ? \"light\" : \"dark\";\n}\n\nfunction themeIconName(target: SetTheme): SetIconName {\n return target === \"dark\" ? \"moon\" : \"sunny\";\n}\n\nexport interface SetLightswitchProps {\n /** Structural style of the toggle button. @default \"text\" */\n appearance?: SetLightswitchAppearance;\n /** DOM id. */\n id?: string;\n /** Accessible label of the switch-to-dark action. @default \"Switch to dark theme\" */\n labelDark?: string;\n /** Accessible label of the switch-to-light action. @default \"Switch to light theme\" */\n labelLight?: string;\n /** Size variant. @default \"md\" */\n size?: SetLightswitchSize;\n}\n\nfunction buildOption(target: SetTheme, label: string): SetNode {\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"option\", \"data-option\": target },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: themeIconName(target),\n size: \"fill\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n },\n ],\n };\n}\n\n/**\n * Builds the IR tree for the Set lightswitch component.\n *\n * @param props - Lightswitch component props.\n * @returns IR node for a `set-lightswitch` host.\n */\nexport function buildSetLightswitch({\n appearance = \"text\",\n id,\n labelDark = labelDarkDefault,\n labelLight = labelLightDefault,\n size = \"md\",\n}: SetLightswitchProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedLabelDark =\n labelDark.trim() === \"\" ? labelDarkDefault : labelDark;\n const normalizedLabelLight =\n labelLight.trim() === \"\" ? labelLightDefault : labelLight;\n\n return {\n kind: \"element\",\n tag: SET_LIGHTSWITCH_TAG_NAME,\n attrs: {\n class: \"set-lightswitch\",\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n class: \"toggle\",\n \"data-appearance\": appearance,\n \"data-size\": size,\n type: \"button\",\n },\n children: [\n buildOption(\"dark\", normalizedLabelDark),\n buildOption(\"light\", normalizedLabelLight),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set lightswitch component.\n *\n * Emits an icon-only theme toggle button inside a `set-lightswitch` host. Both\n * actions (switch to dark, switch to light) are rendered; CSS shows the one\n * opposing the resolved theme, driven by `data-set-theme` on the Set root and\n * falling back to `prefers-color-scheme`, so the control is correct before —\n * and without — the runtime.\n *\n * @param props - Lightswitch component props.\n * @returns HTML string for a `set-lightswitch` host.\n */\nexport function renderSetLightswitch(props: SetLightswitchProps): string {\n return serializeSetNode(buildSetLightswitch(props));\n}\n\n/**\n * Defines the `set-lightswitch` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-lightswitch` hosts will\n * upgrade in place.\n *\n * The toggle shows two states but persists three: no stored value follows the\n * system preference, a stored `\"light\"`/`\"dark\"` (localStorage\n * `SET_LIGHTSWITCH_STORAGE_KEY`) overrides it. Activation targets the opposite of\n * the current resolved theme; when the target equals the system preference\n * the override is cleared instead of stored, so a value matching the system\n * is never pinned. Storage is only evaluated on user interaction — a system\n * preference change never rewrites the stored value. The theme is applied by\n * setting or removing `data-set-theme` on the closest Set root; the control's\n * face follows via CSS.\n */\nexport function defineSetLightswitch(): void {\n if (customElements.get(SET_LIGHTSWITCH_TAG_NAME)) return;\n\n class SetLightswitchElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest(\"button\")) return;\n\n const next = oppositeTheme(this.#resolvedTheme());\n\n if (next === this.#systemTheme()) {\n this.#clearStoredTheme();\n } else {\n this.#storeTheme(next);\n }\n\n this.#applyTheme();\n\n this.dispatchEvent(\n new CustomEvent(SET_LIGHTSWITCH_EVENT_CHANGE, {\n bubbles: true,\n detail: { stored: Boolean(this.#storedTheme()), theme: next },\n }),\n );\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n this.addEventListener(\"click\", this.#onClick);\n\n if (this.#storedTheme()) {\n this.#applyTheme();\n }\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #storage(): Storage | undefined {\n try {\n return this.ownerDocument.defaultView?.localStorage;\n } catch {\n return undefined;\n }\n }\n\n #storedTheme(): SetTheme | undefined {\n try {\n const value = this.#storage()?.getItem(SET_LIGHTSWITCH_STORAGE_KEY);\n return value === \"light\" || value === \"dark\" ? value : undefined;\n } catch {\n return undefined;\n }\n }\n\n #storeTheme(theme: SetTheme): void {\n try {\n this.#storage()?.setItem(SET_LIGHTSWITCH_STORAGE_KEY, theme);\n } catch {\n /* storage unavailable — theme still applies for this page */\n }\n }\n\n #clearStoredTheme(): void {\n try {\n this.#storage()?.removeItem(SET_LIGHTSWITCH_STORAGE_KEY);\n } catch {\n /* storage unavailable — nothing to clear */\n }\n }\n\n #systemTheme(): SetTheme {\n const windowRef = this.ownerDocument.defaultView;\n if (!windowRef || typeof windowRef.matchMedia !== \"function\") {\n return \"light\";\n }\n return windowRef.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n }\n\n #root(): Element | null {\n return this.closest(\".set\");\n }\n\n #rootTheme(): SetTheme | undefined {\n const value = this.#root()?.getAttribute(\"data-set-theme\");\n return value === \"light\" || value === \"dark\" ? value : undefined;\n }\n\n #resolvedTheme(): SetTheme {\n return this.#storedTheme() ?? this.#rootTheme() ?? this.#systemTheme();\n }\n\n #applyTheme(): void {\n const root = this.#root();\n if (!root) return;\n\n const stored = this.#storedTheme();\n if (stored) {\n root.setAttribute(\"data-set-theme\", stored);\n } else {\n root.removeAttribute(\"data-set-theme\");\n }\n }\n }\n\n customElements.define(SET_LIGHTSWITCH_TAG_NAME, SetLightswitchElement);\n}\n\n/** Declarative lightswitch contract mirror for tooling, docs, and adapters. */\nexport const SET_LIGHTSWITCH_SPEC: SetComponentSpec = {\n name: \"lightswitch\",\n description:\n \"Use `lightswitch` to let users toggle between light and dark themes.\",\n output: { element: SET_LIGHTSWITCH_TAG_NAME, class: \"set-lightswitch\" },\n content: { kind: \"none\" },\n props: {\n appearance: {\n default: \"text\",\n description: \"Visual appearance of the toggle button.\",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n labelDark: {\n default: labelDarkDefault,\n description: \"Accessible label of the switch-to-dark action.\",\n type: { kind: \"string\" },\n },\n labelLight: {\n default: labelLightDefault,\n description: \"Accessible label of the switch-to-light action.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n },\n events: {\n [SET_LIGHTSWITCH_EVENT_CHANGE]: {\n bubbles: true,\n description:\n \"Fired after activation applies a theme. `detail.theme` is the theme switched to; `detail.stored` is false when the change cleared the override to follow the system preference again.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"toggle\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"data-appearance\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"button\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\nimport {\n buildSetButton,\n type SetButtonLabelVisibility,\n type SetButtonPlacement,\n} from \"../button/button\";\nimport type { SetIconMirrorMode, SetIconName } from \"../icon/icon\";\n\nexport const SET_MENU_TAG_NAME = \"set-menu\";\nexport const SET_MENU_EVENT_CHOOSE = \"set-menu-choose\";\nexport type SetMenuAlign = \"start\" | \"end\";\n\nexport interface SetMenuItem {\n /** Disables selection for this item. */\n disabled?: boolean;\n /** Optional authored identifier surfaced in the choose event payload. */\n id?: string;\n /** Visible item label text. Escaped before render. */\n label: string;\n}\n\nexport interface SetMenuProps {\n /** Popup alignment relative to the trigger. @default \"start\" */\n align?: SetMenuAlign;\n /** DOM id applied to the host. Trigger and popup ids are derived as `${id}-button` and `${id}-popup`. */\n id: string;\n /** Action items rendered inside the popup menu. */\n items: SetMenuItem[];\n /** Control size applied to the host and composed trigger button. @default \"md\" */\n size?: SetControlSize;\n /** Icon name for the trigger button. */\n triggerIcon?: SetIconName;\n /** Icon mirroring mode for the trigger button icon. */\n triggerIconMirrored?: SetIconMirrorMode;\n /** Icon placement within the trigger button. @default \"start\" */\n triggerIconPlacement?: SetButtonPlacement;\n /** Accessible and visible trigger label text. Escaped before render. */\n triggerLabel: string;\n /** Trigger label visibility treatment. @default \"visible\" */\n triggerLabelVisibility?: SetButtonLabelVisibility;\n}\n\n/**\n * Builds the IR tree for the Set menu component.\n *\n * @param props - Menu component props.\n * @returns IR node for a `set-menu` host.\n */\nexport function buildSetMenu({\n align = \"start\",\n id,\n items,\n size = \"md\",\n triggerIcon,\n triggerIconMirrored,\n triggerIconPlacement,\n triggerLabel,\n triggerLabelVisibility,\n}: SetMenuProps): SetNode {\n const normalizedId = id.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!Array.isArray(items)) {\n throw new Error(\"items must be an array.\");\n }\n\n const triggerId = `${normalizedId}-button`;\n const menuId = `${normalizedId}-popup`;\n\n const itemNodes: SetNode[] = items.map((item) => ({\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-disabled\": item.disabled ? \"true\" : undefined,\n \"data-item-id\": item.id || undefined,\n role: \"menuitem\",\n tabindex: \"-1\",\n type: \"button\",\n },\n children: [{ kind: \"text\", value: item.label }],\n }));\n\n return {\n kind: \"element\",\n tag: SET_MENU_TAG_NAME,\n attrs: {\n class: \"set-menu\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"trigger\" },\n children: [\n buildSetButton({\n appearance: \"outline\",\n controls: menuId,\n disclosure: true,\n haspopup: \"menu\",\n icon: triggerIcon,\n iconMirrored: triggerIconMirrored,\n iconPlacement: triggerIconPlacement,\n id: triggerId,\n label: triggerLabel,\n labelVisibility: triggerLabelVisibility,\n size,\n tone: \"neutral\",\n type: \"button\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n \"aria-labelledby\": triggerId,\n class: \"popup\",\n hidden: true,\n id: menuId,\n role: \"menu\",\n },\n children: itemNodes,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set menu component.\n *\n * Emits a `set-menu` host containing a trigger button and a semantic\n * `role=\"menu\"` menu of button actions. Interactive open/close, focus\n * management, and choose events are deferred to custom element upgrade.\n *\n * @param props - Menu component props.\n * @returns HTML string for a `set-menu` host.\n */\nexport function renderSetMenu(props: SetMenuProps): string {\n return serializeSetNode(buildSetMenu(props));\n}\n\n/**\n * Defines the `set-menu` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-menu` hosts upgrade\n * in place and receive menu interaction behavior.\n */\nexport function defineSetMenu(): void {\n if (customElements.get(SET_MENU_TAG_NAME)) return;\n\n class SetMenuElement extends HTMLElement {\n #onClick?: (event: Event) => void;\n #onDocumentClick?: (event: Event) => void;\n #onFocusOut?: (event: FocusEvent) => void;\n #onKeyDown?: (event: KeyboardEvent) => void;\n\n connectedCallback(): void {\n this.#teardownListeners();\n this.#close(false);\n this.#setupListeners();\n }\n\n disconnectedCallback(): void {\n this.#teardownListeners();\n }\n\n #getTriggerButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"trigger\"] .set-button',\n );\n }\n\n #getMenu(): HTMLElement | null {\n return this.querySelector<HTMLElement>('[role=\"menu\"]');\n }\n\n #getMenuItems(): HTMLButtonElement[] {\n return Array.from(\n this.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]'),\n );\n }\n\n #isMenuItemDisabled(item: HTMLButtonElement): boolean {\n return item.getAttribute(\"aria-disabled\") === \"true\";\n }\n\n #isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n #setFocusedItem(index: number): void {\n const items = this.#getMenuItems();\n\n if (items.length === 0) return;\n\n const normalizedIndex =\n ((index % items.length) + items.length) % items.length;\n\n items[normalizedIndex]?.focus();\n }\n\n #open(focusIndex = 0): void {\n const menu = this.#getMenu();\n const trigger = this.#getTriggerButton();\n\n if (!menu || !trigger) return;\n\n menu.hidden = false;\n this.setAttribute(\"data-open\", \"\");\n trigger.setAttribute(\"aria-expanded\", \"true\");\n this.#setFocusedItem(focusIndex);\n }\n\n #close(restoreTriggerFocus = false): void {\n const menu = this.#getMenu();\n const trigger = this.#getTriggerButton();\n\n if (!menu || !trigger) return;\n\n menu.hidden = true;\n this.removeAttribute(\"data-open\");\n trigger.setAttribute(\"aria-expanded\", \"false\");\n\n if (restoreTriggerFocus) {\n trigger.focus();\n }\n }\n\n #choose(item: HTMLButtonElement): void {\n const allItems = Array.from(\n this.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]'),\n );\n const index = allItems.indexOf(item);\n\n this.dispatchEvent(\n new CustomEvent(SET_MENU_EVENT_CHOOSE, {\n bubbles: true,\n detail: {\n id: item.getAttribute(\"data-item-id\") || undefined,\n index,\n label: item.textContent || \"\",\n },\n }),\n );\n }\n\n #setupListeners(): void {\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n\n if (target.closest('[data-part=\"trigger\"] .set-button')) {\n if (this.#isOpen()) {\n this.#close();\n return;\n }\n\n this.#open(0);\n return;\n }\n\n const menuItem = target.closest<HTMLButtonElement>('[role=\"menuitem\"]');\n\n if (menuItem && this.contains(menuItem)) {\n if (!this.#isMenuItemDisabled(menuItem)) {\n this.#choose(menuItem);\n this.#close(true);\n }\n return;\n }\n };\n\n this.#onDocumentClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Node)) return;\n\n if (this.#isOpen() && !this.contains(target)) {\n this.#close();\n }\n };\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n const trigger = this.#getTriggerButton();\n const menu = this.#getMenu();\n\n if (!trigger || !menu) return;\n\n if ((event.key === \"Escape\" || event.key === \"Esc\") && this.#isOpen()) {\n event.preventDefault();\n this.#close(true);\n return;\n }\n\n const activeElement = this.ownerDocument.activeElement;\n const items = this.#getMenuItems();\n const currentIndex = items.indexOf(activeElement as HTMLButtonElement);\n\n if (activeElement === trigger) {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.#open(0);\n }\n\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.#open(0);\n }\n\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.#open(items.length - 1);\n }\n\n return;\n }\n\n if (!menu.contains(activeElement)) return;\n\n if (\n activeElement instanceof HTMLButtonElement &&\n (event.key === \"Enter\" || event.key === \" \")\n ) {\n event.preventDefault();\n\n if (!this.#isMenuItemDisabled(activeElement)) {\n this.#choose(activeElement);\n this.#close(true);\n }\n\n return;\n }\n\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.#setFocusedItem(currentIndex + 1);\n }\n\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.#setFocusedItem(currentIndex - 1);\n }\n\n if (event.key === \"Home\") {\n event.preventDefault();\n this.#setFocusedItem(0);\n }\n\n if (event.key === \"End\") {\n event.preventDefault();\n this.#setFocusedItem(items.length - 1);\n }\n\n if (event.key === \"Tab\") {\n this.#close(false);\n }\n };\n\n this.#onFocusOut = (event: FocusEvent) => {\n const nextTarget = event.relatedTarget;\n\n if (!(nextTarget instanceof Node)) {\n this.#close();\n return;\n }\n\n if (!this.contains(nextTarget)) {\n this.#close();\n }\n };\n\n this.addEventListener(\"click\", this.#onClick);\n this.addEventListener(\"keydown\", this.#onKeyDown);\n this.addEventListener(\"focusout\", this.#onFocusOut);\n this.ownerDocument.addEventListener(\"click\", this.#onDocumentClick);\n }\n\n #teardownListeners(): void {\n if (this.#onClick) {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n if (this.#onDocumentClick) {\n this.ownerDocument.removeEventListener(\"click\", this.#onDocumentClick);\n }\n\n if (this.#onKeyDown) {\n this.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#onFocusOut) {\n this.removeEventListener(\"focusout\", this.#onFocusOut);\n }\n\n this.#onClick = undefined;\n this.#onDocumentClick = undefined;\n this.#onFocusOut = undefined;\n this.#onKeyDown = undefined;\n }\n }\n\n customElements.define(SET_MENU_TAG_NAME, SetMenuElement);\n}\n\n/** Declarative menu contract mirror for tooling, docs, and adapters. */\nexport const SET_MENU_SPEC: SetComponentSpec = {\n name: \"menu\",\n description: \"Use `menu` to show a list of actions from a trigger button.\",\n output: {\n element: SET_MENU_TAG_NAME,\n class: \"set-menu\",\n },\n content: {\n kind: \"structured\",\n prop: \"items\",\n },\n props: {\n align: {\n default: \"start\",\n description: \"Popup alignment relative to the trigger.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description:\n \"DOM id applied to the host. Trigger and popup ids are derived as `${id}-button` and `${id}-popup`.\",\n required: true,\n type: { kind: \"string\" },\n },\n items: {\n description: \"Action items listed inside the popup.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n disabled: {\n default: false,\n description: \"Disables selection for this item.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description:\n \"Optional authored identifier surfaced in the choose event payload.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Visible item label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n triggerIcon: {\n description: \"Icon name for the trigger button.\",\n type: { kind: \"iconName\" },\n },\n triggerIconMirrored: {\n description: \"Icon mirroring mode for the trigger button icon.\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n triggerIconPlacement: {\n default: \"start\",\n description: \"Icon placement within the trigger button.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n triggerLabel: {\n description: \"Accessible and visible trigger label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n triggerLabelVisibility: {\n default: \"visible\",\n description: \"Trigger label visibility treatment.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n },\n events: {\n [SET_MENU_EVENT_CHOOSE]: {\n bubbles: true,\n description: \"Fired when a menu item is activated.\",\n detail: \"{ id?: string; index: number; label: string }\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: { kind: \"when-equals\", prop: \"align\", to: \"end\" },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: {\n on: \"descendant\",\n selector: 'div[data-part=\"trigger\"] button',\n },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-button\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-popup\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"aria-labelledby\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-button\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"role\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"menu\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"hidden\",\n condition: { kind: \"always\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetExpanderSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface SetExpanderProps {\n /** Optional id of the controlled element (emitted as `aria-controls`). */\n controlsId?: string;\n /** Expanded state. @default false */\n expanded?: boolean;\n /** DOM id. */\n id?: string;\n /** Accessible label for the toggle control. @default \"Menu\" */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetExpanderSize;\n}\n\nconst expanderLabelDefault = \"Menu\";\n\n/**\n * Builds the IR tree for the Set expander control.\n *\n * @param props - Expander component props.\n * @returns IR node for a toggle button.\n */\nexport function buildSetExpander({\n controlsId,\n expanded,\n id,\n label = expanderLabelDefault,\n size = \"md\",\n}: SetExpanderProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedLabel = label.trim() === \"\" ? expanderLabelDefault : label;\n\n return {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-controls\": controlsId || undefined,\n \"aria-expanded\": expanded ? \"true\" : \"false\",\n class: \"set-expander\",\n \"data-size\": size,\n id: normalizedId,\n type: \"button\",\n },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"expander-box\" },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"expander-inner\" },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: normalizedLabel }],\n },\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set expander control.\n *\n * Emits a semantic `button` with accessible text and animated line glyph\n * wrapper markup.\n *\n * @param props - Expander component props.\n * @returns HTML string for a toggle button.\n */\nexport function renderSetExpander(props: SetExpanderProps = {}): string {\n return serializeSetNode(buildSetExpander(props));\n}\n\n/** Declarative expander contract mirror for tooling, docs, and adapters. */\nexport const SET_EXPANDER_SPEC: SetComponentSpec = {\n name: \"expander\",\n description:\n \"Use `expander` as a toggle for disclosure regions such as menus.\",\n output: { element: \"button\", class: \"set-expander\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n controlsId: {\n description: \"`id` of the element this toggle controls.\",\n type: { kind: \"string\" },\n },\n expanded: {\n default: false,\n description: \"Whether the controlled region is expanded.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n default: expanderLabelDefault,\n description: \"Accessible label.\",\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"button\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-expanded\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{expanded}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-controls\",\n condition: { kind: \"when-non-empty\", prop: \"controlsId\" },\n value: { kind: \"prop\", prop: \"controlsId\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId, normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetExpander } from \"../expander/expander\";\n\nexport const SET_NAV_TAG_NAME = \"set-nav\";\nexport type SetNavCollapsible = \"always\" | \"belowTablet\";\nexport type SetNavExpanderPosition = \"start\" | \"end\";\nexport type SetNavSize = \"sm\" | \"md\";\nconst scrollLockAttr = \"data-set-scroll-locked\";\n\nexport interface SetNavItem {\n /** Emits `aria-current=\"page\"` when true. @default false */\n current?: boolean;\n /** Link destination. */\n href: string;\n /** Link label (escaped before render). */\n label: string;\n}\n\nexport interface SetNavProps {\n /** Collapsible nav behavior. Emits `data-collapsible` as a structural hook for runtime enhancement. */\n collapsible?: SetNavCollapsible;\n /** ID applied to `.content`; also used as expander `aria-controls`. Required when `collapsible` is set. */\n contentId?: string;\n /** Accessible label for the runtime expander button when `collapsible` is set. */\n expanderLabel?: string;\n /** Expander placement when collapsible. @default \"start\" */\n expanderPosition?: SetNavExpanderPosition;\n /** DOM id. */\n id?: string;\n /** Nav items rendered as semantic list links. */\n items: SetNavItem[];\n /** Accessible nav label. */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetNavSize;\n}\n\n/**\n * Builds the IR tree for the Set nav component.\n *\n * @param props - Nav component props.\n * @returns IR node for a nav wrapper.\n */\nexport function buildSetNav({\n collapsible,\n contentId,\n expanderLabel,\n expanderPosition = \"start\",\n id,\n items,\n label,\n size = \"md\",\n}: SetNavProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedExpanderLabel = expanderLabel?.trim() || undefined;\n const normalizedContentId = contentId?.trim();\n\n if (collapsible && !normalizedContentId) {\n throw new Error(\n \"contentId must be a non-empty string when collapsible is set.\",\n );\n }\n\n if (normalizedContentId && !isValidHtmlId(normalizedContentId)) {\n throw new Error(\n \"contentId must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const listItems: SetNode[] = items.map((item) => ({\n kind: \"element\",\n tag: \"li\",\n attrs: {},\n children: [\n {\n kind: \"element\",\n tag: \"a\",\n attrs: {\n \"aria-current\": item.current ? \"page\" : undefined,\n class: \"item\",\n href: item.href,\n },\n children: [{ kind: \"text\", value: item.label }],\n },\n ],\n }));\n\n return {\n kind: \"element\",\n tag: SET_NAV_TAG_NAME,\n attrs: {\n class: \"set-nav\",\n \"data-collapsible\": collapsible,\n \"data-expander-label\":\n collapsible && normalizedExpanderLabel\n ? normalizedExpanderLabel\n : undefined,\n \"data-expander-position\": collapsible ? expanderPosition : undefined,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"nav\",\n attrs: {\n \"aria-label\": label || undefined,\n class: \"nav\",\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"content\",\n id: normalizedContentId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"ul\",\n attrs: { class: \"list\" },\n children: listItems,\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set nav component.\n *\n * Emits semantic `nav > ul > li > a` markup inside a `set-nav` host. When\n * `collapsible` is provided, the renderer emits structural hooks only;\n * interactive expander/menu behavior is deferred to custom element upgrade.\n *\n * @param props - Nav component props.\n * @returns HTML string for a nav wrapper.\n */\nexport function renderSetNav(props: SetNavProps): string {\n return serializeSetNode(buildSetNav(props));\n}\n\n/**\n * Defines the `set-nav` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-nav` hosts upgrade\n * in place and receive collapsible runtime behavior when configured.\n */\nexport function defineSetNav(): void {\n if (customElements.get(SET_NAV_TAG_NAME)) return;\n\n class SetNavElement extends HTMLElement {\n #onClick?: (event: Event) => void;\n #mediaQueryList?: MediaQueryList;\n #onKeyDown?: (event: KeyboardEvent) => void;\n #onMediaQueryChange?: (event: MediaQueryListEvent) => void;\n\n connectedCallback(): void {\n this.#teardownClickListener();\n this.#teardownRuntimeListeners();\n this.#ensureExpander();\n this.#setupClickListener();\n this.#setupRuntimeListeners();\n }\n\n disconnectedCallback(): void {\n this.#setExpanded(false);\n this.#teardownClickListener();\n this.#teardownRuntimeListeners();\n }\n\n #getNav(): HTMLElement | null {\n if (!this.hasAttribute(\"data-collapsible\")) return null;\n\n return this.querySelector<HTMLElement>(\".nav\");\n }\n\n #getExpanderButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"expander\"] .set-expander',\n );\n }\n\n #ensureExpander(): void {\n const nav = this.#getNav();\n\n if (!nav) return;\n if (nav.querySelector('[data-part=\"expander\"]')) return;\n\n const content = nav.querySelector<HTMLElement>(\".content\");\n\n if (!content) return;\n\n nav.insertAdjacentHTML(\n \"afterbegin\",\n `<div data-part=\"expander\">${renderSetExpander({\n controlsId: content.id || undefined,\n label: this.getAttribute(\"data-expander-label\") || undefined,\n size: this.getAttribute(\"data-size\") === \"sm\" ? \"md\" : \"lg\",\n })}</div>`,\n );\n }\n\n #setExpanded(expanded: boolean): void {\n const button = this.#getExpanderButton();\n\n if (!button) return;\n\n const isOpen = button.getAttribute(\"aria-expanded\") === \"true\";\n\n if (isOpen === expanded) return;\n\n button.setAttribute(\"aria-expanded\", expanded ? \"true\" : \"false\");\n this.#setScrollLocked(expanded);\n }\n\n #setupClickListener(): void {\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"expander\"] .set-expander')) return;\n\n const button = this.#getExpanderButton();\n\n if (!button) return;\n\n this.#setExpanded(button.getAttribute(\"aria-expanded\") !== \"true\");\n };\n\n this.addEventListener(\"click\", this.#onClick);\n }\n\n #setupRuntimeListeners(): void {\n const nav = this.#getNav();\n const windowRef = this.ownerDocument.defaultView;\n\n if (!nav || !windowRef) return;\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" && event.key !== \"Esc\") return;\n this.#setExpanded(false);\n };\n\n windowRef.addEventListener(\"keydown\", this.#onKeyDown);\n\n if (this.getAttribute(\"data-collapsible\") !== \"belowTablet\") return;\n if (typeof windowRef.matchMedia !== \"function\") return;\n\n const mediaQueryList = windowRef.matchMedia(\"(min-width: 48em)\");\n\n this.#mediaQueryList = mediaQueryList;\n this.#onMediaQueryChange = (event: MediaQueryListEvent) => {\n if (!event.matches) return;\n this.#setExpanded(false);\n };\n\n mediaQueryList.addEventListener(\"change\", this.#onMediaQueryChange);\n }\n\n #setScrollLocked(locked: boolean): void {\n const root = this.ownerDocument.documentElement;\n\n if (!root) return;\n\n if (locked) {\n root.setAttribute(scrollLockAttr, \"\");\n return;\n }\n\n root.removeAttribute(scrollLockAttr);\n }\n\n #teardownClickListener(): void {\n if (!this.#onClick) return;\n\n this.removeEventListener(\"click\", this.#onClick);\n this.#onClick = undefined;\n }\n\n #teardownRuntimeListeners(): void {\n const windowRef = this.ownerDocument.defaultView;\n\n if (this.#onKeyDown && windowRef) {\n windowRef.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#mediaQueryList && this.#onMediaQueryChange) {\n this.#mediaQueryList.removeEventListener(\n \"change\",\n this.#onMediaQueryChange,\n );\n }\n\n this.#onKeyDown = undefined;\n this.#onMediaQueryChange = undefined;\n this.#mediaQueryList = undefined;\n }\n }\n\n customElements.define(SET_NAV_TAG_NAME, SetNavElement);\n}\n\n/** Declarative nav contract mirror for tooling, docs, and adapters. */\nexport const SET_NAV_SPEC: SetComponentSpec = {\n name: \"nav\",\n description: \"Use `nav` to render a primary navigation list.\",\n output: { element: SET_NAV_TAG_NAME, class: \"set-nav\" },\n content: { kind: \"structured\", prop: \"items\" },\n props: {\n items: {\n description: \"Nav links shown in the list.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n current: {\n default: false,\n description: 'Emits `aria-current=\"page\"` when true.',\n type: { kind: \"boolean\" },\n },\n href: {\n description: \"Link destination.\",\n required: true,\n type: { kind: \"string\" },\n },\n label: {\n description: \"Link label.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n },\n },\n label: {\n description: \"Accessible label for the nav landmark.\",\n type: { kind: \"string\" },\n },\n expanderLabel: {\n description: \"Accessible label for the collapsible expander button.\",\n type: { kind: \"string\" },\n },\n expanderPosition: {\n default: \"start\",\n description: \"Where the expander sits within the composition.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n collapsible: {\n description: \"When to collapse the nav behind an expander.\",\n type: { kind: \"enum\", values: [\"always\", \"belowTablet\"] },\n },\n contentId: {\n description: \"`id` for the collapsible content region.\",\n requiredWhen: \"`collapsible` is provided\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-collapsible\",\n condition: { kind: \"when-provided\", prop: \"collapsible\" },\n value: { kind: \"prop\", prop: \"collapsible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-expander-position\",\n condition: { kind: \"when-provided\", prop: \"collapsible\" },\n value: { kind: \"prop\", prop: \"expanderPosition\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-expander-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"collapsible\" },\n { kind: \"when-non-empty\", prop: \"expanderLabel\" },\n ],\n },\n value: { kind: \"prop\", prop: \"expanderLabel\" },\n },\n {\n target: { on: \"descendant\", selector: \"nav\" },\n attribute: \"aria-label\",\n condition: { kind: \"when-non-empty\", prop: \"label\" },\n value: { kind: \"prop\", prop: \"label\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.content\" },\n attribute: \"id\",\n condition: { kind: \"when-provided\", prop: \"contentId\" },\n value: { kind: \"prop\", prop: \"contentId\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport const SET_RANGE_TAG_NAME = \"set-range\";\n\nexport interface SetRangeProps {\n /** Helper text rendered after the range. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Range id; used for input/output/label wiring. */\n id: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Label text content (escaped before render). */\n label: string;\n /** Maximum value. */\n max?: number;\n /** Minimum value. */\n min?: number;\n /** Field name. */\n name?: string;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Step value. */\n step?: number;\n /** Current value. */\n value?: number;\n}\n\n/**\n * Builds the IR tree for the Set range component.\n *\n * @param props - Range component props.\n * @returns IR node for a `set-range` host.\n */\nexport function buildSetRange({\n description,\n disabled,\n id,\n inlineSize = \"full\",\n label,\n max,\n min,\n name,\n size = \"md\",\n step,\n value,\n}: SetRangeProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedName = name?.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"label-wrapper\" },\n children: [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"output\",\n attrs: { class: \"output\", for: normalizedId },\n children:\n value != null ? [{ kind: \"text\", value: String(value) }] : [],\n },\n ],\n },\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n class: \"range\",\n disabled: Boolean(disabled),\n id: normalizedId,\n max: max != null ? String(max) : undefined,\n min: min != null ? String(min) : undefined,\n name: normalizedName || undefined,\n step: step != null ? String(step) : undefined,\n type: \"range\",\n value: value != null ? String(value) : undefined,\n },\n children: [],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: SET_RANGE_TAG_NAME,\n attrs: {\n class: \"set-range\",\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n \"data-size\": size,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set range component.\n *\n * Emits semantic range markup inside a `set-range` host. The runtime custom\n * element hydrates the `.output` element from the current input value.\n *\n * @param props - Range component props.\n * @returns HTML string for a `set-range` host.\n */\nexport function renderSetRange(props: SetRangeProps): string {\n return serializeSetNode(buildSetRange(props));\n}\n\n/**\n * Defines the `set-range` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-range` hosts\n * upgrade in place and keep `.output` synchronized with the current value.\n */\nexport function defineSetRange(): void {\n if (customElements.get(SET_RANGE_TAG_NAME)) return;\n\n class SetRangeElement extends HTMLElement {\n #inputWithValueSync: HTMLInputElement | undefined;\n\n #onInput = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof HTMLInputElement)) return;\n if (!target.matches(\".range\")) return;\n\n this.#syncOutput();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"input\", this.#onInput);\n this.#installValueSync();\n this.#syncOutput();\n this.addEventListener(\"input\", this.#onInput);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"input\", this.#onInput);\n this.#removeValueSync();\n }\n\n #syncOutput(): void {\n const input = this.querySelector<HTMLInputElement>(\".range\");\n const output = this.querySelector<HTMLOutputElement>(\".output\");\n\n if (!input || !output) return;\n\n this.#setOutputText(output, input.value);\n }\n\n #setOutputText(output: HTMLOutputElement, value: string): void {\n const child = output.firstChild;\n\n if (\n child?.nodeType === Node.TEXT_NODE &&\n output.childNodes.length === 1\n ) {\n if (child.nodeValue !== value) child.nodeValue = value;\n return;\n }\n\n if (output.textContent !== value) output.textContent = value;\n }\n\n // Programmatic `input.value = x` (controlled frameworks, scripts) does\n // not fire an `input` event, so the output wouldn't track it. Override\n // the instance's `value` accessor to sync the output on set, restoring\n // the prototype behaviour on disconnect.\n #installValueSync(): void {\n const input = this.querySelector<HTMLInputElement>(\".range\");\n if (!input || input === this.#inputWithValueSync) return;\n\n this.#removeValueSync();\n\n const descriptor = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n );\n if (!descriptor?.get || !descriptor.set) return;\n\n const getValue = descriptor.get;\n const setValue = descriptor.set;\n const syncOutput = () => this.#syncOutput();\n Object.defineProperty(input, \"value\", {\n configurable: true,\n enumerable: descriptor.enumerable,\n get(): string {\n return getValue.call(this) as string;\n },\n set(value: string): void {\n setValue.call(this, value);\n syncOutput();\n },\n });\n\n this.#inputWithValueSync = input;\n }\n\n #removeValueSync(): void {\n if (!this.#inputWithValueSync) return;\n delete (this.#inputWithValueSync as { value?: string }).value;\n this.#inputWithValueSync = undefined;\n }\n }\n\n customElements.define(SET_RANGE_TAG_NAME, SetRangeElement);\n}\n\n/** Declarative range contract mirror for tooling, docs, and adapters. */\nexport const SET_RANGE_SPEC: SetComponentSpec = {\n name: \"range\",\n description: \"Use `range` to let users pick a numeric value along a scale.\",\n output: { element: SET_RANGE_TAG_NAME, class: \"set-range\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n description: {\n description: \"Helper text shown below the range.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the range.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` used to associate the input with its label.\",\n required: true,\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"How the range fills its container.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n max: {\n description: \"Maximum value.\",\n type: { kind: \"number\" },\n },\n min: {\n description: \"Minimum value.\",\n type: { kind: \"number\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n step: {\n description: \"Granularity of value changes.\",\n type: { kind: \"number\" },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"range\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"range\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"min\",\n condition: { kind: \"when-provided\", prop: \"min\" },\n value: { kind: \"template\", pattern: \"{min}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"max\",\n condition: { kind: \"when-provided\", prop: \"max\" },\n value: { kind: \"template\", pattern: \"{max}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"step\",\n condition: { kind: \"when-provided\", prop: \"step\" },\n value: { kind: \"template\", pattern: \"{step}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-provided\", prop: \"value\" },\n value: { kind: \"template\", pattern: \"{value}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"template\", pattern: \"{name}\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n buildSetButton,\n renderSetButton,\n type SetButtonSize,\n} from \"../button/button\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport const SET_SIDEBAR_TAG_NAME = \"set-sidebar\";\nexport type SetSidebarAboveNotebook = \"persistent\" | \"collapsible\" | \"overlay\";\n\nconst aboveNotebookMedia = \"(min-width: 68em)\";\nconst collapseLabelDefault = \"Collapse sidebar\";\nconst triggerLabelDefault = \"Open sidebar\";\n\nexport interface SetSidebarProps {\n /** Behavior above the notebook breakpoint. @default \"persistent\" */\n aboveNotebook?: SetSidebarAboveNotebook;\n /** Size of the trigger and collapse buttons. @default \"md\" */\n buttonSize?: SetButtonSize;\n /** Content region markup rendered inside `.content`. Caller sanitizes untrusted content. */\n children?: string;\n /** Accessible label for the runtime collapse/close button. @default \"Collapse sidebar\" */\n collapseLabel?: string;\n /** Optional footer region markup. Caller sanitizes untrusted content. */\n footer?: string;\n /** Optional header region markup. Caller sanitizes untrusted content. */\n header?: string;\n /** DOM id applied to the host. The inner panel id is derived as `${id}-panel` and referenced by the trigger via `aria-controls`. */\n id: string;\n /** Surface context. Emits `data-set-surface` on the inner panel when provided. */\n surface?: SetSurfaceVariant;\n /** Accessible label for the component-owned trigger. @default \"Open sidebar\" */\n triggerLabel?: string;\n}\n\nfunction createCloseButtonMarkup(\n label: string,\n buttonSize: SetButtonSize,\n): string {\n return `<div data-part=\"close\">${renderSetButton({\n appearance: \"text\",\n icon: \"panel-left\",\n iconMirrored: \"rtl\",\n label,\n labelVisibility: \"hidden\",\n size: buttonSize,\n tone: \"neutral\",\n type: \"button\",\n })}</div>`;\n}\n\n/**\n * Builds the IR tree for the Set sidebar component.\n *\n * @param props - Sidebar component props.\n * @returns IR node for a `set-sidebar` host.\n */\nexport function buildSetSidebar({\n aboveNotebook = \"persistent\",\n buttonSize = \"md\",\n children,\n collapseLabel = collapseLabelDefault,\n footer,\n header,\n id,\n surface,\n triggerLabel = triggerLabelDefault,\n}: SetSidebarProps): SetNode {\n const normalizedId = id.trim();\n const normalizedCollapseLabel = collapseLabel.trim() || collapseLabelDefault;\n const normalizedTriggerLabel = triggerLabel.trim() || triggerLabelDefault;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const sidebarChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"header\" },\n children: header ? [{ kind: \"raw\", html: header }] : [],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ];\n\n if (footer) {\n sidebarChildren.push({\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"footer\" },\n children: [{ kind: \"raw\", html: footer }],\n });\n }\n\n const panelId = `${normalizedId}-panel`;\n\n return {\n kind: \"element\",\n tag: SET_SIDEBAR_TAG_NAME,\n attrs: {\n class: \"set-sidebar\",\n \"data-above-notebook\": aboveNotebook,\n \"data-collapse-label\":\n normalizedCollapseLabel !== collapseLabelDefault\n ? normalizedCollapseLabel\n : undefined,\n \"data-button-size\": buttonSize,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"trigger\" },\n children: [\n buildSetButton({\n appearance: \"text\",\n controls: panelId,\n disclosure: true,\n icon: \"panel-left\",\n iconMirrored: \"rtl\",\n label: normalizedTriggerLabel,\n labelVisibility: \"hidden\",\n size: buttonSize,\n tone: \"neutral\",\n type: \"button\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"sidebar\",\n \"data-set-surface\": surface,\n id: panelId,\n tabindex: \"-1\",\n },\n children: sidebarChildren,\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"backdrop\" },\n children: [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set sidebar component.\n *\n * Emits a component-owned trigger plus structural sidebar markup inside a\n * `set-sidebar` host. The host also owns a backdrop element used for overlay\n * dismissal on narrow screens. Above notebook width, behavior is controlled by\n * `aboveNotebook`. Page-shell layout decisions are intentionally left to parent\n * composition.\n *\n * @param props - Sidebar component props.\n * @returns HTML string for a `set-sidebar` host.\n */\nexport function renderSetSidebar(props: SetSidebarProps): string {\n return serializeSetNode(buildSetSidebar(props));\n}\n\n/**\n * Defines the `set-sidebar` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-sidebar` hosts\n * upgrade in place and receive owned-trigger open/close behavior.\n */\nexport function defineSetSidebar(): void {\n if (customElements.get(SET_SIDEBAR_TAG_NAME)) return;\n\n class SetSidebarElement extends HTMLElement {\n #mediaQuery?: MediaQueryList;\n #onClick?: (event: Event) => void;\n #onKeyDown?: (event: KeyboardEvent) => void;\n #onMediaChange?: (event: MediaQueryListEvent) => void;\n\n connectedCallback(): void {\n this.#teardownListeners();\n this.#ensureCloseControl();\n this.#syncResponsiveState();\n this.#setupListeners();\n }\n\n disconnectedCallback(): void {\n this.close();\n this.#teardownListeners();\n }\n\n open(): void {\n this.#setOpen(true);\n }\n\n close(): void {\n this.#setOpen(false);\n }\n\n #getSidebar(): HTMLElement | null {\n return this.querySelector<HTMLElement>(\".sidebar\");\n }\n\n #getCloseButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"close\"] .set-button',\n );\n }\n\n #getTriggerButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"trigger\"] .set-button',\n );\n }\n\n #isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n #isCollapsed(): boolean {\n return this.hasAttribute(\"data-collapsed\");\n }\n\n #getAboveNotebook(): SetSidebarAboveNotebook {\n const value = this.getAttribute(\"data-above-notebook\");\n\n if (value === \"collapsible\" || value === \"overlay\") return value;\n\n return \"persistent\";\n }\n\n #ensureCloseControl(): void {\n const sidebar = this.#getSidebar();\n\n if (!sidebar) return;\n if (sidebar.querySelector('[data-part=\"close\"]')) return;\n\n const header = sidebar.querySelector<HTMLElement>(\".header\");\n const collapseLabel =\n this.getAttribute(\"data-collapse-label\") || collapseLabelDefault;\n const buttonSize = (this.getAttribute(\"data-button-size\") ??\n \"md\") as SetButtonSize;\n\n header?.insertAdjacentHTML(\n \"beforeend\",\n createCloseButtonMarkup(collapseLabel, buttonSize),\n );\n }\n\n #removeCloseControl(): void {\n this.querySelector('[data-part=\"close\"]')?.remove();\n }\n\n #focusSidebar(): void {\n const closeButton = this.#getCloseButton();\n\n if (closeButton) {\n closeButton.focus();\n return;\n }\n\n this.#getSidebar()?.focus();\n }\n\n #isAboveNotebook(): boolean {\n return this.#mediaQuery?.matches ?? false;\n }\n\n #setState({\n collapsed,\n open,\n }: {\n collapsed: boolean;\n open: boolean;\n }): void {\n const trigger = this.#getTriggerButton();\n\n this.toggleAttribute(\"data-open\", open);\n this.toggleAttribute(\"data-collapsed\", collapsed);\n trigger?.setAttribute(\"aria-expanded\", open ? \"true\" : \"false\");\n }\n\n #syncResponsiveState(): void {\n const aboveNotebook = this.#getAboveNotebook();\n\n if (this.#isAboveNotebook()) {\n if (aboveNotebook === \"overlay\") {\n this.#ensureCloseControl();\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n\n return;\n }\n\n if (aboveNotebook === \"collapsible\") {\n this.#ensureCloseControl();\n this.#setState({\n collapsed: this.#isCollapsed(),\n open: true,\n });\n this.#setScrollLocked(false);\n\n return;\n }\n\n this.#removeCloseControl();\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(false);\n\n return;\n }\n\n this.#ensureCloseControl();\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n }\n\n #setOpen(open: boolean): void {\n const aboveNotebook = this.#getAboveNotebook();\n\n if (this.#isAboveNotebook()) {\n if (aboveNotebook === \"persistent\") {\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(false);\n\n return;\n }\n\n if (aboveNotebook === \"collapsible\") {\n this.#setState({ collapsed: !open, open: true });\n this.#setScrollLocked(false);\n\n if (open) this.#focusSidebar();\n\n return;\n }\n }\n\n if (this.#isOpen() === open) return;\n\n if (open) {\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(true);\n this.#focusSidebar();\n\n return;\n }\n\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n this.#getTriggerButton()?.focus();\n }\n\n #setScrollLocked(locked: boolean): void {\n const root = this.ownerDocument.documentElement;\n\n if (!root) return;\n\n if (locked) {\n root.setAttribute(\"data-set-scroll-locked\", \"\");\n return;\n }\n\n root.removeAttribute(\"data-set-scroll-locked\");\n }\n\n #setupListeners(): void {\n const windowRef = this.ownerDocument.defaultView;\n\n if (!windowRef) return;\n\n if (typeof windowRef.matchMedia === \"function\") {\n this.#mediaQuery = windowRef.matchMedia(aboveNotebookMedia);\n this.#onMediaChange = () => {\n this.#syncResponsiveState();\n };\n this.#mediaQuery.addEventListener(\"change\", this.#onMediaChange);\n this.#syncResponsiveState();\n }\n\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n\n if (target.closest('[data-part=\"trigger\"] .set-button')) {\n this.open();\n return;\n }\n\n if (target.closest('[data-part=\"close\"] .set-button')) {\n if (\n this.#isAboveNotebook() &&\n this.#getAboveNotebook() === \"collapsible\"\n ) {\n this.#setOpen(this.#isCollapsed());\n return;\n }\n\n this.close();\n return;\n }\n\n if (target.closest('[data-part=\"backdrop\"]')) {\n this.close();\n }\n };\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" && event.key !== \"Esc\") return;\n this.close();\n };\n\n this.addEventListener(\"click\", this.#onClick);\n this.addEventListener(\"keydown\", this.#onKeyDown);\n }\n\n #teardownListeners(): void {\n if (this.#onClick) {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n if (this.#onKeyDown) {\n this.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#mediaQuery && this.#onMediaChange) {\n this.#mediaQuery.removeEventListener(\"change\", this.#onMediaChange);\n }\n\n this.#onClick = undefined;\n this.#onKeyDown = undefined;\n this.#mediaQuery = undefined;\n this.#onMediaChange = undefined;\n }\n }\n\n customElements.define(SET_SIDEBAR_TAG_NAME, SetSidebarElement);\n}\n\n/** Declarative sidebar contract mirror for tooling, docs, and adapters. */\nexport const SET_SIDEBAR_SPEC: SetComponentSpec = {\n name: \"sidebar\",\n description: \"Use `sidebar` for a side panel alongside main content.\",\n output: {\n element: SET_SIDEBAR_TAG_NAME,\n class: \"set-sidebar\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"header\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n { prop: \"footer\", kind: \"html\" },\n ],\n },\n props: {\n aboveNotebook: {\n default: \"persistent\",\n description: \"Layout behaviour on wider screens.\",\n type: {\n kind: \"enum\",\n values: [\"persistent\", \"collapsible\", \"overlay\"],\n },\n },\n buttonSize: {\n default: \"md\",\n description: \"Size of the trigger and collapse buttons.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n children: {\n description: \"Sidebar body content.\",\n type: { kind: \"html\" },\n },\n collapseLabel: {\n default: collapseLabelDefault,\n description: \"Accessible label for the collapse button.\",\n type: { kind: \"string\" },\n },\n footer: {\n description: \"Content rendered in the sidebar footer.\",\n type: { kind: \"html\" },\n },\n header: {\n description: \"Content rendered in the sidebar header.\",\n type: { kind: \"html\" },\n },\n id: {\n description:\n \"DOM id applied to the host. The inner panel id is derived as `${id}-panel` and wired to the trigger via `aria-controls`.\",\n required: true,\n type: { kind: \"string\" },\n },\n surface: {\n description: \"Surface context. Applied to the inner panel.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n triggerLabel: {\n default: triggerLabelDefault,\n description: \"Accessible label for the open button.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-above-notebook\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"aboveNotebook\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-button-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"buttonSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-collapse-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-non-empty\", prop: \"collapseLabel\" },\n {\n kind: \"not\",\n of: {\n kind: \"when-equals\",\n prop: \"collapseLabel\",\n to: collapseLabelDefault,\n },\n },\n ],\n },\n value: { kind: \"prop\", prop: \"collapseLabel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-panel\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"tabindex\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"-1\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport const SET_VIDEO_TAG_NAME = \"set-video\";\n\nexport type SetVideoFit = \"intrinsic\" | \"fluid\";\nexport type SetVideoPreload = \"auto\" | \"metadata\" | \"none\";\n\nexport interface SetVideoProps {\n /** Starts playback automatically. @default false */\n autoPlay?: boolean;\n /** Shows native playback controls. @default false */\n controls?: boolean;\n /** Layout mode. @default \"intrinsic\" */\n fit?: SetVideoFit;\n /** Intrinsic height in pixels. */\n height?: number;\n /** DOM id. */\n id?: string;\n /** Restarts playback when the video ends. @default false */\n loop?: boolean;\n /** Starts playback silent. @default false */\n muted?: boolean;\n /** Plays inline instead of fullscreen on iOS. @default false */\n playsInline?: boolean;\n /** Image URL shown before playback begins. */\n poster?: string;\n /** Preload hint (HTML `video[preload]`). */\n preload?: SetVideoPreload;\n /** Video source URL. */\n src: string;\n /** Intrinsic width in pixels. */\n width?: number;\n}\n\n/**\n * Builds the IR tree for the Set video component.\n *\n * @param props - Video component props.\n * @returns IR node for video markup.\n */\nexport function buildSetVideo({\n autoPlay,\n controls,\n fit = \"intrinsic\",\n height,\n id,\n loop,\n muted,\n playsInline,\n poster,\n preload,\n src,\n width,\n}: SetVideoProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedSrc = src.trim();\n const normalizedPoster = poster?.trim();\n\n if (!normalizedSrc) {\n throw new Error(\"src must be a non-empty string.\");\n }\n\n const videoNode: SetNode = {\n kind: \"element\",\n tag: \"video\",\n attrs: {\n autoplay: Boolean(autoPlay),\n class: \"video\",\n controls: Boolean(controls),\n height: height ? String(height) : undefined,\n loop: Boolean(loop),\n muted: Boolean(muted),\n playsinline: Boolean(playsInline),\n poster: normalizedPoster || undefined,\n preload,\n src: normalizedSrc,\n width: width ? String(width) : undefined,\n },\n children: [],\n };\n\n return {\n kind: \"element\",\n tag: SET_VIDEO_TAG_NAME,\n attrs: {\n class: \"set-video\",\n \"data-fluid\": fit === \"fluid\",\n id: normalizedId,\n },\n children: [videoNode],\n };\n}\n\n/**\n * SSR renderer for the Set video component.\n *\n * Emits meaningful light-DOM HTML inside a `set-video` host. When `autoPlay`\n * is set, runtime hydration pauses playback while the user prefers reduced\n * motion and resumes it if the preference relaxes.\n *\n * @param props - Video component props.\n * @returns HTML string for video markup.\n */\nexport function renderSetVideo(props: SetVideoProps): string {\n return serializeSetNode(buildSetVideo(props));\n}\n\nconst reducedMotionMedia = \"(prefers-reduced-motion: reduce)\";\n\n/**\n * Defines the `set-video` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-video` hosts will\n * upgrade in place. Hosts whose video declares `autoplay` are paused while\n * `(prefers-reduced-motion: reduce)` matches — the `autoplay` attribute is\n * withdrawn so pending playback cannot start — and resume when it stops\n * matching.\n */\nexport function defineSetVideo(): void {\n if (customElements.get(SET_VIDEO_TAG_NAME)) return;\n\n class SetVideoElement extends HTMLElement {\n #autoPlayIntent = false;\n #mediaQuery: MediaQueryList | undefined;\n #onMediaChange: (() => void) | undefined;\n\n connectedCallback(): void {\n const video = this.querySelector(\"video\");\n if (!video) return;\n\n this.#autoPlayIntent ||= video.hasAttribute(\"autoplay\");\n if (!this.#autoPlayIntent) return;\n\n const windowRef = this.ownerDocument.defaultView;\n if (!windowRef || typeof windowRef.matchMedia !== \"function\") return;\n\n this.#mediaQuery = windowRef.matchMedia(reducedMotionMedia);\n this.#onMediaChange = () => {\n this.#syncPlayback();\n };\n this.#mediaQuery.addEventListener(\"change\", this.#onMediaChange);\n this.#syncPlayback();\n }\n\n disconnectedCallback(): void {\n if (this.#mediaQuery && this.#onMediaChange) {\n this.#mediaQuery.removeEventListener(\"change\", this.#onMediaChange);\n }\n this.#mediaQuery = undefined;\n this.#onMediaChange = undefined;\n }\n\n #syncPlayback(): void {\n const video = this.querySelector(\"video\");\n if (!video || !this.#mediaQuery) return;\n\n if (this.#mediaQuery.matches) {\n video.removeAttribute(\"autoplay\");\n video.pause();\n } else {\n video.setAttribute(\"autoplay\", \"\");\n if (video.paused) {\n void video.play()?.catch?.(() => {});\n }\n }\n }\n }\n\n customElements.define(SET_VIDEO_TAG_NAME, SetVideoElement);\n}\n\n/** Declarative video contract mirror for tooling, docs, and adapters. */\nexport const SET_VIDEO_SPEC: SetComponentSpec = {\n name: \"video\",\n description:\n \"Use `video` to render a video with intrinsic or fluid fit and native playback behavior.\",\n output: { element: SET_VIDEO_TAG_NAME, class: \"set-video\" },\n content: { kind: \"none\" },\n props: {\n autoPlay: {\n default: false,\n description:\n \"Starts playback automatically. Browsers only honor this when `muted` is also set. Suspended when the user prefers reduced motion.\",\n type: { kind: \"boolean\" },\n },\n controls: {\n default: false,\n description: \"Shows the browser's native playback controls.\",\n type: { kind: \"boolean\" },\n },\n fit: {\n default: \"intrinsic\",\n description:\n \"Layout mode. `intrinsic` renders at the video's own dimensions, `fluid` scales to the container's full inline size at the video's aspect ratio.\",\n type: { kind: \"enum\", values: [\"intrinsic\", \"fluid\"] },\n },\n height: {\n description:\n \"Intrinsic height in pixels. With `width`, reserves the correctly shaped box before the media loads; rendered height always follows the aspect ratio.\",\n type: { kind: \"number\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n loop: {\n default: false,\n description: \"Restarts playback when the video ends.\",\n type: { kind: \"boolean\" },\n },\n muted: {\n default: false,\n description:\n \"Starts playback silent. Required for `autoPlay` to take effect in most browsers.\",\n type: { kind: \"boolean\" },\n },\n playsInline: {\n default: false,\n description:\n \"Plays inline instead of fullscreen on iOS. Required for `autoPlay` on iOS.\",\n type: { kind: \"boolean\" },\n },\n poster: {\n description: \"Image URL shown before playback begins.\",\n type: { kind: \"string\" },\n },\n preload: {\n description:\n \"Preload hint. Omitted by default, deferring to the browser.\",\n type: { kind: \"enum\", values: [\"auto\", \"metadata\", \"none\"] },\n },\n src: {\n description: \"Video source URL.\",\n required: true,\n type: { kind: \"string\" },\n },\n width: {\n description:\n \"Intrinsic width in pixels. Sets the rendered width, capped at the container; under `fluid`, an aspect-ratio hint only.\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-fluid\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"fluid\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"video\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"src\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{src}\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"autoplay\",\n condition: { kind: \"when-truthy\", prop: \"autoPlay\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"controls\",\n condition: { kind: \"when-truthy\", prop: \"controls\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"loop\",\n condition: { kind: \"when-truthy\", prop: \"loop\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"muted\",\n condition: { kind: \"when-truthy\", prop: \"muted\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"playsinline\",\n condition: { kind: \"when-truthy\", prop: \"playsInline\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"poster\",\n condition: { kind: \"when-non-empty\", prop: \"poster\" },\n value: { kind: \"prop\", prop: \"poster\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"preload\",\n condition: { kind: \"when-provided\", prop: \"preload\" },\n value: { kind: \"prop\", prop: \"preload\" },\n },\n ],\n },\n};\n","import { collapseWhitespace } from \"../../helpers/string\";\n\nfunction isLatinChar(char: string | undefined): boolean {\n if (!char) return false;\n\n return /[A-Za-z]/.test(char);\n}\n\nfunction isLowercaseToken(token: string): boolean {\n return /^[a-z]/.test(token);\n}\n\nfunction leadingInitialFromToken(token: string): string | undefined {\n const leadingChar = token.charAt(0);\n\n return isLatinChar(leadingChar) ? leadingChar : undefined;\n}\n\n/**\n * Derives avatar initials from a full name.\n *\n * Rules:\n * - Empty/whitespace-only input returns `undefined`\n * - Leading non-Latin first token returns `undefined`\n * - First initial is always uppercased\n * - Single-word names return exactly one initial\n * - Two/three-word names return initials from each word\n * - Four+ words return first + last initials\n * - Lowercase surname particles (for example `da`, `de`, `van`) override\n * multi-word fallback and produce first initial + particle initial\n * - Hyphenation in first token yields one first initial only\n * - In two-word names, a second-token two-part hyphen surname contributes a\n * third initial (for example `Ocasio-Cortez` -> `OC`)\n */\nexport function getSetInitials(name: string | undefined): string | undefined {\n const normalizedName = collapseWhitespace(name);\n\n if (!normalizedName) return undefined;\n\n const words = normalizedName.split(\" \");\n const firstTokenInitial = leadingInitialFromToken(words[0]);\n\n if (!firstTokenInitial) return undefined;\n\n const initials: string[] = [firstTokenInitial.toUpperCase()];\n\n if (words.length === 1) {\n return initials[0];\n }\n\n const lowercaseSurnameToken = words.slice(1).find(isLowercaseToken);\n\n if (lowercaseSurnameToken) {\n const particleInitial = leadingInitialFromToken(lowercaseSurnameToken);\n\n return particleInitial ? `${initials[0]}${particleInitial}` : undefined;\n }\n\n if (words.length === 2) {\n const secondInitial = leadingInitialFromToken(words[1]);\n\n if (!secondInitial) return undefined;\n\n initials.push(secondInitial);\n\n const hyphenParts = words[1].split(\"-\").filter(Boolean);\n\n if (hyphenParts.length === 2) {\n const secondPartInitial = leadingInitialFromToken(hyphenParts[1]);\n\n if (secondPartInitial) initials.push(secondPartInitial);\n }\n\n return initials.slice(0, 3).join(\"\");\n }\n\n if (words.length === 3) {\n const secondInitial = leadingInitialFromToken(words[1]);\n\n const thirdInitial = leadingInitialFromToken(words[2]);\n\n if (!secondInitial || !thirdInitial) return undefined;\n\n initials.push(secondInitial, thirdInitial);\n\n return initials.slice(0, 3).join(\"\");\n }\n\n const lastTokenInitial = leadingInitialFromToken(words.at(-1) || \"\");\n\n if (!lastTokenInitial) return undefined;\n\n initials.push(lastTokenInitial);\n\n return initials.slice(0, 3).join(\"\");\n}\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport {\n collapseWhitespace,\n normalizeOptionalHtmlId,\n} from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\nimport { getSetInitials } from \"./get-initials\";\n\nexport type SetAvatarColor =\n | \"neutral\"\n | \"01\"\n | \"02\"\n | \"03\"\n | \"04\"\n | \"05\"\n | \"06\"\n | \"07\"\n | \"08\"\n | \"09\";\nexport type SetAvatarEntity = \"bot\" | \"organization\" | \"person\" | \"team\";\nexport type SetAvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst ENTITY_ICON_MAP: Record<SetAvatarEntity, SetIconName> = {\n bot: \"robot-1\",\n organization: \"city-6\",\n person: \"user-1\",\n team: \"member\",\n};\n\nconst COLOR_HASH = [\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n] as const;\n\nexport interface SetAvatarProps {\n /** Optional explicit accessible label. Used before `name` fallback text. */\n alt?: string;\n /** Emits `aria-hidden=\"true\"` on the wrapper when true. @default false */\n ariaHidden?: boolean;\n /** Icon fallback identity when `src`, `initials`, and `name` are absent.\n * @default \"person\" */\n entity?: SetAvatarEntity;\n /** Avatar background color token. If omitted and `name` exists, color is hash-derived (01..09). */\n color?: SetAvatarColor;\n /** DOM id. */\n id?: string;\n /** Explicit initials override. Trimmed and whitespace-collapsed; alphabetic only, 1-3 characters. */\n initials?: string;\n /** Full name used for accessible-label fallback and initials derivation. */\n name?: string;\n /** Avatar size. @default \"md\" */\n size?: SetAvatarSize;\n /** Image source URL. Empty/whitespace is treated as missing. */\n src?: string;\n}\n\nfunction hashString(value: string): number {\n // djb2 seed constant for stable non-cryptographic string hashing.\n let hash = 5381;\n\n for (const char of value) {\n // djb2 mixes each char code with a 33x multiplier.\n hash = (hash * 33) ^ char.charCodeAt(0);\n }\n\n return hash >>> 0;\n}\n\nfunction normalizeInitials(initials: string | undefined): string | undefined {\n if (initials == null) return undefined;\n\n const normalized = collapseWhitespace(initials);\n\n if (!normalized) {\n return undefined;\n }\n\n if (normalized.length > 3) {\n throw new Error(\"initials must normalize to 3 characters or fewer.\");\n }\n\n if (!/^[A-Za-z]{1,3}$/.test(normalized)) {\n throw new Error(\"initials must contain only alphabetic characters.\");\n }\n\n return normalized;\n}\n\nfunction resolveAccessibleLabel({\n alt,\n ariaHidden,\n name,\n}: {\n alt?: string;\n ariaHidden?: boolean;\n name?: string;\n}): string | undefined {\n if (ariaHidden) return undefined;\n\n return collapseWhitespace(alt) || collapseWhitespace(name) || \"Avatar\";\n}\n\nfunction resolveAvatarColor({\n color,\n name,\n}: {\n color?: SetAvatarColor;\n name?: string;\n}): SetAvatarColor {\n if (color) return color;\n\n if (name) {\n const index = hashString(name) % COLOR_HASH.length;\n return COLOR_HASH[index];\n }\n\n return \"neutral\";\n}\n\n/**\n * Builds the IR tree for the Set avatar component.\n *\n * @param props - Avatar component props.\n * @returns IR node for an avatar wrapper with image/initials/icon content.\n */\nexport function buildSetAvatar({\n alt,\n ariaHidden,\n color,\n entity = \"person\",\n id,\n initials,\n name,\n size = \"md\",\n src,\n}: SetAvatarProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedInitials = normalizeInitials(initials);\n const normalizedName = collapseWhitespace(name);\n const normalizedSrc = collapseWhitespace(src);\n const accessibleLabel = resolveAccessibleLabel({\n alt,\n ariaHidden,\n name: normalizedName,\n });\n const derivedInitials = normalizedInitials || getSetInitials(normalizedName);\n const renderAsImage = Boolean(normalizedSrc);\n const resolvedColor = resolveAvatarColor({\n color,\n name: normalizedName,\n });\n\n const avatarAttrs = {\n \"aria-hidden\": ariaHidden ? \"true\" : undefined,\n \"aria-label\": !ariaHidden && !renderAsImage ? accessibleLabel : undefined,\n class: \"set-avatar\",\n \"data-color\": resolvedColor === \"neutral\" ? undefined : resolvedColor,\n \"data-entity\": entity === \"person\" ? undefined : entity,\n \"data-size\": size,\n id: normalizedId,\n role: !ariaHidden && !renderAsImage ? \"img\" : undefined,\n };\n\n let child: SetNode;\n if (renderAsImage) {\n child = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt: ariaHidden ? \"\" : accessibleLabel || \"\",\n class: \"img\",\n src: normalizedSrc,\n },\n children: [],\n };\n } else if (derivedInitials) {\n child = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"initials\" },\n children: [{ kind: \"text\", value: derivedInitials }],\n };\n } else {\n child = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: ENTITY_ICON_MAP[entity],\n size: \"fill\",\n }),\n ],\n };\n }\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: avatarAttrs,\n children: [child],\n };\n}\n\n/**\n * SSR renderer for the Set avatar component.\n *\n * @param props - Avatar component props.\n * @returns HTML string for an avatar wrapper with image/initials/icon content.\n */\nexport function renderSetAvatar(props: SetAvatarProps): string {\n return serializeSetNode(buildSetAvatar(props));\n}\n\n/** Declarative avatar contract mirror for tooling, docs, and adapters. */\nexport const SET_AVATAR_SPEC: SetComponentSpec = {\n name: \"avatar\",\n description: \"Use `avatar` to visually represent a person, team, or entity.\",\n output: { element: \"span\", class: \"set-avatar\" },\n content: { kind: \"none\" },\n props: {\n alt: {\n description: \"Accessible label for the avatar, overrides name.\",\n type: { kind: \"string\" },\n },\n ariaHidden: {\n default: false,\n description: \"Hides the avatar from assistive technology.\",\n type: { kind: \"boolean\" },\n },\n entity: {\n default: \"person\",\n description: \"Type of subject the avatar represents.\",\n type: {\n kind: \"enum\",\n values: [\"bot\", \"organization\", \"person\", \"team\"],\n },\n },\n color: {\n description: \"Background color swatch. Derived from name when omitted.\",\n type: {\n kind: \"enum\",\n values: [\n \"neutral\",\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n ],\n },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n initials: {\n description:\n \"Initials to display. 1–3 alphabetic characters. Overrides name-derived initials.\",\n type: { kind: \"string\" },\n },\n name: {\n description: \"Full name. Used for the label and to derive initials.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n src: {\n description: \"Image source URL.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-entity\",\n condition: {\n kind: \"when-in\",\n prop: \"entity\",\n values: [\"bot\", \"organization\", \"team\"],\n },\n value: { kind: \"prop\", prop: \"entity\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-color\",\n condition: {\n kind: \"when-in\",\n prop: \"color\",\n values: [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\"],\n },\n value: { kind: \"prop\", prop: \"color\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-hidden\",\n condition: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n\nexport { getSetInitials } from \"./get-initials\";\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetBadgeSize = \"sm\" | \"md\";\nexport type SetBadgeTone =\n | \"notification\"\n | \"live\"\n | \"pending\"\n | \"success\"\n | \"warning\"\n | \"error\";\n\nexport interface SetBadgeProps {\n /** Positions the badge as a floating overlay. */\n floating?: boolean;\n /** DOM id. */\n id?: string;\n /** Badge text content. Escaped as plain text. */\n label: string;\n /** Badge size. @default \"md\" */\n size?: SetBadgeSize;\n /** Semantic tone variant. */\n tone?: SetBadgeTone;\n}\n\n/**\n * Builds the IR tree for the Set badge component.\n *\n * @param props - Badge component props.\n * @returns IR node for a badge element.\n */\nexport function buildSetBadge({\n floating,\n id,\n label,\n size = \"md\",\n tone,\n}: SetBadgeProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: {\n class: \"set-badge\",\n \"data-floating\": floating,\n \"data-size\": size,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n },\n children: [{ kind: \"text\", value: label }],\n };\n}\n\n/**\n * SSR renderer for the Set badge component.\n *\n * @param props - Badge component props.\n * @returns HTML string for a badge element.\n */\nexport function renderSetBadge(props: SetBadgeProps): string {\n return serializeSetNode(buildSetBadge(props));\n}\n\n/** Declarative badge contract mirror for tooling, docs, and adapters. */\nexport const SET_BADGE_SPEC: SetComponentSpec = {\n name: \"badge\",\n description: \"Use `badge` to annotate content with a short label.\",\n output: { element: \"span\", class: \"set-badge\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n floating: {\n default: false,\n description: \"Positions the badge as a floating overlay.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Badge text.\",\n required: true,\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n tone: {\n description: \"Semantic tone.\",\n type: {\n kind: \"enum\",\n values: [\n \"notification\",\n \"live\",\n \"pending\",\n \"success\",\n \"warning\",\n \"error\",\n ],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-floating\",\n condition: { kind: \"when-truthy\", prop: \"floating\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetTextAs = \"p\" | \"span\";\nexport type SetTextSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type SetTextTone = \"default\" | \"muted\";\n\nexport interface SetTextProps {\n /** Text content. Supports inline markup such as `<em>`, `<strong>`, `<a>`, `<code>`, `<cite>`, etc. */\n children: string;\n /** Element tag. @default \"span\" */\n as?: SetTextAs;\n /** Text alignment. Ignored when `as` is `span`. @default \"start\" */\n align?: SetAlign;\n /** DOM id. */\n id?: string;\n /** Enables visited-state styling for links inside text. @default true */\n linkVisited?: boolean;\n /** Applies max measure constraints for long-form readability. Ignored when `as` is `span`. @default true */\n measured?: boolean;\n /** Applies monospaced word spacing throughout. @default false */\n monospaced?: boolean;\n /** Enables breakpoint-responsive body scale. @default false */\n responsive?: boolean;\n /** Text size. @default \"md\" */\n size?: SetTextSize;\n /** Tone variant. @default \"default\" */\n tone?: SetTextTone;\n}\n\n/**\n * Builds the IR tree for the Set text component.\n *\n * @param props - Text component props.\n * @returns IR node for a text paragraph or span element.\n */\nexport function buildSetText({\n align,\n as,\n children,\n id,\n linkVisited = true,\n measured,\n monospaced,\n responsive,\n size = \"md\",\n tone = \"default\",\n}: SetTextProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const tag: SetTextAs = as === \"p\" ? \"p\" : \"span\";\n const isParagraph = tag === \"p\";\n const resolvedAlign = isParagraph ? (align ?? \"start\") : undefined;\n const resolvedMeasured = isParagraph ? (measured ?? true) : undefined;\n\n return {\n kind: \"element\",\n tag,\n attrs: {\n class: \"set-text\",\n \"data-align\":\n resolvedAlign && resolvedAlign !== \"start\" ? resolvedAlign : undefined,\n \"data-link-visited\": linkVisited ? undefined : \"off\",\n \"data-measured\": resolvedMeasured,\n \"data-monospaced\": monospaced,\n \"data-responsive\": responsive,\n \"data-size\": size,\n \"data-tone\": tone === \"muted\" ? \"muted\" : undefined,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set text component.\n *\n * @param props - Text component props.\n * @returns HTML string for a text paragraph or span element.\n */\nexport function renderSetText(props: SetTextProps): string {\n return serializeSetNode(buildSetText(props));\n}\n\n/** Declarative text contract mirror for tooling, docs, and adapters. */\nexport const SET_TEXT_SPEC: SetComponentSpec = {\n name: \"text\",\n description: \"Use `text` for inline or paragraph body copy.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { p: \"p\", span: \"span\" } },\n class: \"set-text\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n as: {\n default: \"span\",\n description: \"HTML element used for the text.\",\n type: { kind: \"enum\", values: [\"p\", \"span\"] },\n },\n children: {\n description:\n \"Text content. Supports inline markup such as `<em>`, `<strong>`, `<a>`, `<code>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n linkVisited: {\n default: true,\n description: \"Styles visited links inside the text.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales text across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n ignoredWhen: \"`as` is span\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n ignoredWhen: \"`as` is span\",\n type: { kind: \"boolean\" },\n },\n monospaced: {\n default: false,\n description: \"Applies monospaced word spacing throughout.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"muted\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-equals\", prop: \"as\", to: \"p\" },\n { kind: \"when-in\", prop: \"align\", values: [\"center\", \"end\"] },\n ],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-link-visited\",\n condition: { kind: \"when-equals\", prop: \"linkVisited\", to: false },\n value: { kind: \"literal\", text: \"off\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-measured\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-equals\", prop: \"as\", to: \"p\" },\n { kind: \"when-truthy\", prop: \"measured\" },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-monospaced\",\n condition: { kind: \"when-truthy\", prop: \"monospaced\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"muted\" },\n value: { kind: \"literal\", text: \"muted\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\nimport { buildSetText } from \"../text/text\";\n\nexport type SetBlockquoteSize = \"md\" | \"lg\";\n\nexport interface SetBlockquoteProps {\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** Trusted attribution HTML. */\n attribution: string;\n /** DOM id. */\n id?: string;\n /** Applies max measure constraints for long-form readability. @default true */\n measured?: boolean;\n /** Trusted quote HTML. */\n quote: string;\n /** Enables breakpoint-responsive type sizing. @default false */\n responsive?: boolean;\n /** Quote size. @default \"md\" */\n size?: SetBlockquoteSize;\n}\n\n/**\n * Builds the IR tree for the Set blockquote component.\n *\n * @param props - Blockquote component props.\n * @returns IR node for a blockquote wrapper.\n */\nexport function buildSetBlockquote({\n align = \"start\",\n attribution,\n id,\n measured = true,\n quote,\n responsive = false,\n size = \"md\",\n}: SetBlockquoteProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"figure\",\n attrs: {\n class: \"set-blockquote\",\n \"data-align\": align === \"start\" ? undefined : align,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"blockquote\",\n attrs: { class: \"quote\" },\n children: [\n buildSetText({\n align,\n as: \"p\",\n children: quote,\n measured,\n responsive,\n size,\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"figcaption\",\n attrs: { class: \"attribution\" },\n children: [\n buildSetText({\n as: \"span\",\n children: attribution,\n responsive,\n size: \"sm\",\n }),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set blockquote component.\n *\n * @param props - Blockquote component props.\n * @returns HTML string for a blockquote wrapper.\n */\nexport function renderSetBlockquote(props: SetBlockquoteProps): string {\n return serializeSetNode(buildSetBlockquote(props));\n}\n\n/** Declarative blockquote contract mirror for tooling, docs, and adapters. */\nexport const SET_BLOCKQUOTE_SPEC: SetComponentSpec = {\n name: \"blockquote\",\n description: \"Use `blockquote` to display a quote with attribution.\",\n output: { element: \"figure\", class: \"set-blockquote\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"quote\", kind: \"html\" },\n { prop: \"attribution\", kind: \"html\" },\n ],\n },\n props: {\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n attribution: {\n description:\n \"Attribution shown beneath the quote. Supports inline markup such as `<a>`, `<cite>`, `<em>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n type: { kind: \"boolean\" },\n },\n quote: {\n description:\n \"Quote content. Supports inline markup such as `<em>`, `<strong>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n responsive: {\n default: false,\n description: \"Scales type across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant for the quote.\",\n type: { kind: \"enum\", values: [\"md\", \"lg\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetBoxBackground = \"default\" | \"panel\" | \"transparent\";\nexport type SetBoxPadding =\n | \"none\"\n | \"2xs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\";\nexport type SetBoxRadius = \"sm\" | \"md\";\n\nexport interface SetBoxProps {\n /** Background treatment. @default \"default\" */\n background?: SetBoxBackground;\n /** Subtle border. @default false */\n border?: boolean;\n /** Trusted inner HTML. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inner block-axis spacing scale. @default \"md\" */\n paddingBlock?: SetBoxPadding;\n /** Inner inline-axis spacing scale. @default \"md\" */\n paddingInline?: SetBoxPadding;\n /** Corner radius size. */\n radius?: SetBoxRadius;\n /** Responsive block-axis padding. @default false */\n responsive?: boolean;\n /** Surface context. */\n surface?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set box component.\n *\n * @param props - Box component props.\n * @returns IR node for a box wrapper.\n */\nexport function buildSetBox({\n background = \"default\",\n border,\n children,\n id,\n paddingBlock = \"md\",\n paddingInline = \"md\",\n radius,\n responsive,\n surface,\n}: SetBoxProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-box\",\n \"data-background\": background === \"default\" ? undefined : background,\n \"data-border\": border,\n \"data-set-surface\": surface,\n \"data-padding-block\": paddingBlock,\n \"data-padding-inline\": paddingInline,\n \"data-radius\": radius,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set box component.\n *\n * @param props - Box component props.\n * @returns HTML string for a box wrapper.\n */\nexport function renderSetBox(props: SetBoxProps): string {\n return serializeSetNode(buildSetBox(props));\n}\n\n/** Declarative box contract mirror for tooling, docs, and adapters. */\nexport const SET_BOX_SPEC: SetComponentSpec = {\n name: \"box\",\n description: \"Use `box` to inset content.\",\n output: { element: \"div\", class: \"set-box\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n background: {\n default: \"default\",\n description: \"Background treatment.\",\n type: { kind: \"enum\", values: [\"default\", \"panel\", \"transparent\"] },\n },\n border: {\n default: false,\n description: \"Shows a subtle border around the box.\",\n type: { kind: \"boolean\" },\n },\n children: {\n description: \"Content rendered inside the box.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n paddingBlock: {\n default: \"md\",\n description: \"Vertical padding.\",\n type: {\n kind: \"enum\",\n values: [\"none\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"],\n },\n },\n paddingInline: {\n default: \"md\",\n description: \"Horizontal padding.\",\n type: {\n kind: \"enum\",\n values: [\"none\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"],\n },\n },\n radius: {\n description: \"Corner radius.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n responsive: {\n default: false,\n description: \"Scales vertical padding across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-background\",\n condition: {\n kind: \"when-in\",\n prop: \"background\",\n values: [\"panel\", \"transparent\"],\n },\n value: { kind: \"prop\", prop: \"background\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-border\",\n condition: { kind: \"when-truthy\", prop: \"border\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-padding-block\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"paddingBlock\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-padding-inline\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"paddingInline\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-radius\",\n condition: { kind: \"when-provided\", prop: \"radius\" },\n value: { kind: \"prop\", prop: \"radius\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetHeadingLevel } from \"../../types\";\nimport { buildSetIcon } from \"../icon/icon\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport interface SetCardProps {\n /** Description HTML content. Caller sanitizes untrusted content. */\n description: string;\n /** Optional heading level for the title. Omit to render a `div.title`. */\n headingLevel?: SetHeadingLevel;\n /** Optional link destination for the title. Adds a trailing arrow icon when `note` is also provided. */\n href?: string;\n /** DOM id. */\n id?: string;\n /** Optional note HTML content. Caller sanitizes untrusted content. */\n note?: string;\n /** Surface context. Emits `data-set-surface` when provided. */\n surface?: SetSurfaceVariant;\n /** Card title text content (escaped before render). */\n title: string;\n}\n\n/**\n * Builds the IR tree for the Set card component.\n *\n * @param props - Card component props.\n * @returns IR node for a card wrapper.\n */\nexport function buildSetCard({\n description,\n headingLevel,\n href,\n id,\n note,\n surface,\n title,\n}: SetCardProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const headingTag = headingLevel ? `h${headingLevel}` : \"div\";\n const titleChildren: SetNode[] = href\n ? [\n {\n kind: \"element\",\n tag: \"a\",\n attrs: { href },\n children: [{ kind: \"text\", value: title }],\n },\n ]\n : [{ kind: \"text\", value: title }];\n\n const noteChildren: SetNode[] = note ? [{ kind: \"raw\", html: note }] : [];\n\n if (note && href) {\n noteChildren.push({\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n mirrored: \"rtl\",\n name: \"arrow-right\",\n size: \"xs\",\n }),\n ],\n });\n }\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"dots\" },\n children: [{ kind: \"element\", tag: \"span\", attrs: {}, children: [] }],\n },\n {\n kind: \"element\",\n tag: headingTag,\n attrs: { class: \"title\" },\n children: titleChildren,\n },\n {\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\" },\n children: [{ kind: \"raw\", html: description }],\n },\n ];\n\n if (note) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"note\" },\n children: noteChildren,\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-card\",\n \"data-set-surface\": surface,\n id: normalizedId,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set card component.\n *\n * Emits a `div.card` root with decorative dots, a title, supporting description,\n * and optional note. When `href` is provided, the title becomes a link; when\n * both `href` and `note` are provided, the note includes a trailing decorative\n * arrow icon.\n *\n * @param props - Card component props.\n * @returns HTML string for a card wrapper.\n */\nexport function renderSetCard(props: SetCardProps): string {\n return serializeSetNode(buildSetCard(props));\n}\n\n/** Declarative card contract mirror for tooling, docs, and adapters. */\nexport const SET_CARD_SPEC: SetComponentSpec = {\n name: \"card\",\n description: \"Use `card` to display a summary for a single topic.\",\n output: {\n element: \"div\",\n class: \"set-card\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"title\", kind: \"text\" },\n { prop: \"description\", kind: \"html\" },\n { prop: \"note\", kind: \"html\" },\n ],\n },\n props: {\n description: {\n description: \"Supporting description shown below the `title`.\",\n required: true,\n type: { kind: \"html\" },\n },\n headingLevel: {\n description:\n \"Semantic heading level for the title. Renders a `<div>` when omitted.\",\n type: { kind: \"enum\", values: [1, 2, 3, 4, 5, 6] },\n },\n href: {\n description: \"Link destination for the `title`.\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n note: {\n description: \"Short note shown beneath the `description`.\",\n type: { kind: \"html\" },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n title: {\n description: \"Card title.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\n\nexport interface SetCheckboxProps {\n /** Checked state. @default false */\n checked?: boolean;\n /** Helper text rendered after the label. Requires `id`. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** DOM id applied to the underlying input. Required when `description` is provided. */\n id?: string;\n /** Invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Form field name. */\n name?: string;\n /** Required state. @default false */\n required?: boolean;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set checkbox component.\n *\n * @param props - Checkbox component props.\n * @returns IR node for a checkbox field wrapper.\n */\nexport function buildSetCheckbox({\n checked,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n required,\n size = \"md\",\n value,\n}: SetCheckboxProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDescription = description?.trim();\n\n if (normalizedDescription && !normalizedId) {\n throw new Error(\"id must be provided when description is provided.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isInvalid = !isDisabled && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n checked: Boolean(checked),\n class: \"checkbox\",\n disabled: isDisabled,\n id: normalizedId,\n name: name || undefined,\n required: Boolean(required),\n type: \"checkbox\",\n value: value || undefined,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: label }],\n },\n ],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"set-checkbox\", \"data-size\": size },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set checkbox component.\n *\n * @param props - Checkbox component props.\n * @returns HTML string for a checkbox field wrapper.\n */\nexport function renderSetCheckbox(props: SetCheckboxProps): string {\n return serializeSetNode(buildSetCheckbox(props));\n}\n\n/** Declarative checkbox contract mirror for tooling, docs, and adapters. */\nexport const SET_CHECKBOX_SPEC: SetComponentSpec = {\n name: \"checkbox\",\n description: \"Use `checkbox` to let users toggle a single option on or off.\",\n output: { element: \"div\", class: \"set-checkbox\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n checked: {\n default: false,\n description: \"Whether the checkbox is checked.\",\n type: { kind: \"boolean\" },\n },\n description: {\n description: \"Helper text shown below the label.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`description` is provided\",\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the checkbox as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label shown next to the checkbox.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n required: {\n default: false,\n description: \"Marks the checkbox as required.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Value submitted with the form.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"checked\",\n condition: { kind: \"when-truthy\", prop: \"checked\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetContainerGutter = \"default\" | \"narrow\" | \"none\";\nexport type SetContainerMaxInlineSize = \"default\" | \"wide\" | \"none\";\n\nexport interface SetContainerProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Inline gutter behavior. @default \"default\" */\n gutter?: SetContainerGutter;\n /** DOM id. */\n id?: string;\n /** Max-inline-size behavior. Effect is only visible on wider viewports. @default \"default\" */\n maxInlineSize?: SetContainerMaxInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set container component.\n *\n * @param props - Container component props.\n * @returns IR node for a container wrapper.\n */\nexport function buildSetContainer({\n children,\n gutter = \"default\",\n id,\n maxInlineSize = \"default\",\n}: SetContainerProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-container\",\n \"data-gutter\": gutter === \"default\" ? undefined : gutter,\n \"data-max-inline-size\":\n maxInlineSize === \"default\" ? undefined : maxInlineSize,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set container component.\n *\n * @param props - Container component props.\n * @returns HTML string for a container wrapper.\n */\nexport function renderSetContainer(props: SetContainerProps): string {\n return serializeSetNode(buildSetContainer(props));\n}\n\n/** Declarative container contract mirror for tooling, docs, and adapters. */\nexport const SET_CONTAINER_SPEC: SetComponentSpec = {\n name: \"container\",\n description: \"Use `container` to wrap page-level content.\",\n output: { element: \"div\", class: \"set-container\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the container.\",\n type: { kind: \"html\" },\n },\n gutter: {\n default: \"default\",\n description: \"Horizontal gutter width.\",\n type: { kind: \"enum\", values: [\"default\", \"narrow\", \"none\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n maxInlineSize: {\n default: \"default\",\n description:\n \"Maximum content width. Effect is only visible in wider viewports.\",\n type: { kind: \"enum\", values: [\"default\", \"wide\", \"none\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-max-inline-size\",\n condition: {\n kind: \"when-in\",\n prop: \"maxInlineSize\",\n values: [\"wide\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"maxInlineSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gutter\",\n condition: {\n kind: \"when-in\",\n prop: \"gutter\",\n values: [\"narrow\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"gutter\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\nimport { buildSetIcon } from \"../icon/icon\";\n\nexport interface SetDetailsProps {\n /** Content markup inside the details panel. Caller sanitizes untrusted content. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Whether the details is initially open. @default false */\n open?: boolean;\n /** Summary text content. Escaped before render. */\n summary: string;\n}\n\n/**\n * Builds the IR tree for the Set details component.\n *\n * @param props - Details component props.\n * @returns IR node for a details element.\n */\nexport function buildSetDetails({\n children,\n id,\n open,\n summary,\n inlineSize = \"full\",\n}: SetDetailsProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"details\",\n attrs: {\n class: \"set-details\",\n open,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"summary\",\n attrs: { class: \"summary\" },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"marker\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: \"chevron-right\",\n size: \"sm\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: summary }],\n },\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set details component.\n *\n * Emits native `<details>`/`<summary>` markup with trusted HTML content in a\n * `.content` wrapper, and a decorative chevron icon marker in the summary.\n *\n * @param props - Details component props.\n * @returns HTML string for a details element.\n */\nexport function renderSetDetails(props: SetDetailsProps): string {\n return serializeSetNode(buildSetDetails(props));\n}\n\n/** Declarative details contract mirror for tooling, docs, and adapters. */\nexport const SET_DETAILS_SPEC: SetComponentSpec = {\n name: \"details\",\n description:\n \"Use `details` to let users expand and collapse a section of content.\",\n output: { element: \"details\", class: \"set-details\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"summary\", kind: \"text\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Content revealed when the details is open.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the details fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n open: {\n default: false,\n description: \"Opens the details by default.\",\n type: { kind: \"boolean\" },\n },\n summary: {\n description: \"Summary shown in the toggle.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"open\",\n condition: { kind: \"when-truthy\", prop: \"open\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetDividerOrientation = \"horizontal\" | \"vertical\";\nexport type SetDividerTone = \"default\" | \"subtle\" | \"brand\";\n\nexport interface SetDividerProps {\n /** DOM id. */\n id?: string;\n /** Divider orientation. @default \"horizontal\" */\n orientation?: SetDividerOrientation;\n /** Tone variant. @default \"default\" */\n tone?: SetDividerTone;\n}\n\n/**\n * Builds the IR tree for the Set divider component.\n *\n * @param props - Divider component props.\n * @returns IR node for a separator element.\n */\nexport function buildSetDivider({\n id,\n orientation = \"horizontal\",\n tone = \"default\",\n}: SetDividerProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: orientation === \"horizontal\" ? \"hr\" : \"span\",\n attrs: {\n \"aria-orientation\": orientation === \"vertical\" ? \"vertical\" : undefined,\n class: \"set-divider\",\n \"data-tone\": tone === \"subtle\" || tone === \"brand\" ? tone : undefined,\n id: normalizedId,\n role: orientation === \"vertical\" ? \"separator\" : undefined,\n },\n children: [],\n };\n}\n\n/**\n * SSR renderer for the Set divider component.\n *\n * @param props - Divider component props.\n * @returns HTML string for a separator element.\n */\nexport function renderSetDivider(props: SetDividerProps = {}): string {\n return serializeSetNode(buildSetDivider(props));\n}\n\n/** Declarative divider contract mirror for tooling, docs, and adapters. */\nexport const SET_DIVIDER_SPEC: SetComponentSpec = {\n name: \"divider\",\n description: \"Use `divider` to separate sections with a rule.\",\n output: {\n element: {\n kind: \"switch\",\n prop: \"orientation\",\n cases: { horizontal: \"hr\", vertical: \"span\" },\n },\n class: \"set-divider\",\n },\n content: { kind: \"none\" },\n props: {\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n orientation: {\n default: \"horizontal\",\n description: \"Divider orientation.\",\n type: { kind: \"enum\", values: [\"horizontal\", \"vertical\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"subtle\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: { kind: \"when-equals\", prop: \"orientation\", to: \"vertical\" },\n value: { kind: \"literal\", text: \"separator\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-orientation\",\n condition: { kind: \"when-equals\", prop: \"orientation\", to: \"vertical\" },\n value: { kind: \"literal\", text: \"vertical\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"subtle\", \"brand\"],\n },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\n\nexport interface SetFieldsetProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Group description rendered below legend. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Fieldset id used for description id derivation. */\n id: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Fieldset legend text (escaped before render). */\n legend: string;\n}\n\n/**\n * Builds the IR tree for the Set fieldset component.\n *\n * @param props - Fieldset component props.\n * @returns IR node for a fieldset wrapper.\n */\nexport function buildSetFieldset({\n children,\n description,\n disabled,\n id,\n invalid,\n legend,\n inlineSize = \"full\",\n}: SetFieldsetProps): SetNode {\n const normalizedDescription = description?.trim();\n const normalizedId = id.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const derivedDescriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isInvalid = !isDisabled && Boolean(invalid);\n\n const fieldsetChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"legend\",\n attrs: { class: \"legend\" },\n children: [{ kind: \"text\", value: legend }],\n },\n ];\n\n if (normalizedDescription) {\n fieldsetChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: derivedDescriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n if (children) {\n fieldsetChildren.push({ kind: \"raw\", html: children });\n }\n\n return {\n kind: \"element\",\n tag: \"fieldset\",\n attrs: {\n \"aria-describedby\": normalizedDescription\n ? derivedDescriptionId\n : undefined,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n class: \"set-fieldset\",\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n disabled: isDisabled,\n id: normalizedId,\n },\n children: fieldsetChildren,\n };\n}\n\n/**\n * SSR renderer for the Set fieldset component.\n *\n * @param props - Fieldset component props.\n * @returns HTML string for a fieldset wrapper.\n */\nexport function renderSetFieldset(props: SetFieldsetProps): string {\n return serializeSetNode(buildSetFieldset(props));\n}\n\n/** Declarative fieldset contract mirror for tooling, docs, and adapters. */\nexport const SET_FIELDSET_SPEC: SetComponentSpec = {\n name: \"fieldset\",\n description: \"Use `fieldset` to group related form controls under a legend.\",\n output: { element: \"fieldset\", class: \"set-fieldset\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"legend\", kind: \"text\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Form controls grouped inside the fieldset.\",\n type: { kind: \"html\" },\n },\n description: {\n description:\n \"Description shown below the legend; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction with controls in the group.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` for the fieldset.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the group as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n legend: {\n description: \"Legend shown above the group.\",\n required: true,\n type: { kind: \"text\" },\n },\n inlineSize: {\n default: \"full\",\n description:\n \"Whether the fieldset fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign, SetInlineSize } from \"../../types\";\nimport { buildSetText } from \"../text/text\";\n\nexport interface SetFigureProps {\n /** Alignment within available space. @default \"start\" */\n align?: SetAlign;\n /** Trusted caption HTML. */\n caption: string;\n /** Trusted media HTML (typically a `renderSetImage` result). */\n children: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Enables breakpoint-responsive type sizing for the caption. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set figure component.\n *\n * @param props - Figure component props.\n * @returns IR node for a figure wrapper.\n */\nexport function buildSetFigure({\n align = \"start\",\n caption,\n children,\n id,\n inlineSize = \"full\",\n responsive = false,\n}: SetFigureProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"figure\",\n attrs: {\n class: \"set-figure\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-inline-size\": inlineSize === \"full\" ? undefined : inlineSize,\n id: normalizedId,\n },\n children: [\n { kind: \"raw\", html: children },\n {\n kind: \"element\",\n tag: \"figcaption\",\n attrs: { class: \"figcaption\" },\n children: [\n buildSetText({\n as: \"span\",\n children: caption,\n responsive,\n size: \"sm\",\n }),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set figure component.\n *\n * @param props - Figure component props.\n * @returns HTML string for a figure wrapper.\n */\nexport function renderSetFigure(props: SetFigureProps): string {\n return serializeSetNode(buildSetFigure(props));\n}\n\n/** Declarative figure contract mirror for tooling, docs, and adapters. */\nexport const SET_FIGURE_SPEC: SetComponentSpec = {\n name: \"figure\",\n description: \"Use `figure` to present media with a caption.\",\n output: { element: \"figure\", class: \"set-figure\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"children\", kind: \"html\" },\n { prop: \"caption\", kind: \"html\" },\n ],\n },\n props: {\n align: {\n default: \"start\",\n description: \"Alignment within available space.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n caption: {\n description:\n \"Caption shown below the media. Supports inline markup such as `<em>`, `<strong>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n children: {\n description: \"Media rendered inside the figure.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description:\n \"Whether the figure fills its container or shrinks to fit the media.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n responsive: {\n default: false,\n description: \"Scales the caption across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetGridGap = \"default\" | \"expanded\" | \"none\";\nexport type SetGridTrack = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\nexport interface SetGridProps {\n /** Trusted inner HTML (typically grid items). */\n children?: string;\n /** Gap behavior. @default \"default\" */\n gap?: SetGridGap;\n /** DOM id. */\n id?: string;\n}\n\nexport interface SetGridItemProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Align-self. */\n align?: SetAlign;\n /** Column span at default container threshold. */\n colSpan?: SetGridTrack;\n /** Column span at narrow container threshold. */\n colSpanNarrow?: SetGridTrack;\n /** Column span at wide container threshold. Effect is only visible above the wide breakpoint. */\n colSpanWide?: SetGridTrack;\n /** Column start at default container threshold. */\n colStart?: SetGridTrack;\n /** Column start at narrow container threshold. */\n colStartNarrow?: SetGridTrack;\n /** Column start at wide container threshold. Effect is only visible above the wide breakpoint. */\n colStartWide?: SetGridTrack;\n /** DOM id. */\n id?: string;\n /** Justify-self. */\n justify?: SetAlign;\n /** Row span at default container threshold. */\n rowSpan?: SetGridTrack;\n /** Row span at narrow container threshold. */\n rowSpanNarrow?: SetGridTrack;\n /** Row span at wide container threshold. Effect is only visible above the wide breakpoint. */\n rowSpanWide?: SetGridTrack;\n /** Row start at default container threshold. */\n rowStart?: SetGridTrack;\n /** Row start at narrow container threshold. */\n rowStartNarrow?: SetGridTrack;\n /** Row start at wide container threshold. Effect is only visible above the wide breakpoint. */\n rowStartWide?: SetGridTrack;\n}\n\nconst validateGridTrack = (\n value: SetGridTrack | undefined,\n): string | undefined => {\n if (value === undefined) return undefined;\n\n return String(value);\n};\n\n/**\n * Builds the IR tree for the Set grid component.\n *\n * @param props - Grid component props.\n * @returns IR node for a grid wrapper.\n */\nexport function buildSetGrid({\n children,\n gap = \"default\",\n id,\n}: SetGridProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-grid\",\n \"data-gap\": gap === \"default\" ? undefined : gap,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"grid\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set grid component.\n *\n * @param props - Grid component props.\n * @returns HTML string for a grid wrapper.\n */\nexport function renderSetGrid(props: SetGridProps): string {\n return serializeSetNode(buildSetGrid(props));\n}\n\n/**\n * Builds the IR tree for the Set grid-item component.\n *\n * @param props - Grid-item component props.\n * @returns IR node for a grid item.\n */\nexport function buildSetGridItem({\n align,\n children,\n colSpan,\n colSpanNarrow,\n colSpanWide,\n colStart,\n colStartNarrow,\n colStartWide,\n id,\n justify,\n rowSpan,\n rowSpanNarrow,\n rowSpanWide,\n rowStart,\n rowStartNarrow,\n rowStartWide,\n}: SetGridItemProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-grid-item\",\n \"data-align\": align,\n \"data-justify\": justify,\n \"data-col-span-narrow\": validateGridTrack(colSpanNarrow),\n \"data-col-start-narrow\": validateGridTrack(colStartNarrow),\n \"data-col-span\": validateGridTrack(colSpan),\n \"data-col-start\": validateGridTrack(colStart),\n \"data-col-span-wide\": validateGridTrack(colSpanWide),\n \"data-col-start-wide\": validateGridTrack(colStartWide),\n \"data-row-span-narrow\": validateGridTrack(rowSpanNarrow),\n \"data-row-start-narrow\": validateGridTrack(rowStartNarrow),\n \"data-row-span\": validateGridTrack(rowSpan),\n \"data-row-start\": validateGridTrack(rowStart),\n \"data-row-span-wide\": validateGridTrack(rowSpanWide),\n \"data-row-start-wide\": validateGridTrack(rowStartWide),\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set grid-item component.\n *\n * @param props - Grid-item component props.\n * @returns HTML string for a grid item.\n */\nexport function renderSetGridItem(props: SetGridItemProps): string {\n return serializeSetNode(buildSetGridItem(props));\n}\n\n/** Declarative grid contract mirror for tooling, docs, and adapters. */\nexport const SET_GRID_SPEC: SetComponentSpec = {\n name: \"grid\",\n description: \"Use `grid` to lay out content in a 12-column responsive grid.\",\n output: { element: \"div\", class: \"set-grid\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"`grid-item` components rendered inside the grid.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"default\",\n description: \"Space between the `grid-item` components.\",\n type: { kind: \"enum\", values: [\"default\", \"expanded\", \"none\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: {\n kind: \"when-in\",\n prop: \"gap\",\n values: [\"expanded\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n\nconst gridTrackType = {\n kind: \"number\",\n min: 1,\n max: 12,\n integer: true,\n} as const;\n\n/** Declarative grid-item contract mirror for tooling, docs, and adapters. */\nexport const SET_GRID_ITEM_SPEC: SetComponentSpec = {\n name: \"grid-item\",\n description: \"Use `grid-item` to place content within a `grid` layout.\",\n output: { element: \"div\", class: \"set-grid-item\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the grid item.\",\n type: { kind: \"html\" },\n },\n align: {\n description: \"Block-axis alignment within the grid cell.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n justify: {\n description: \"Inline-axis alignment within the grid cell.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n colSpan: {\n description: \"Columns spanned at the default breakpoint.\",\n type: gridTrackType,\n },\n colStart: {\n description: \"Starting column at the default breakpoint.\",\n type: gridTrackType,\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n rowSpan: {\n description: \"Rows spanned at the default breakpoint.\",\n type: gridTrackType,\n },\n rowSpanNarrow: {\n description: \"Rows spanned at the narrow breakpoint.\",\n type: gridTrackType,\n },\n rowSpanWide: {\n description:\n \"Rows spanned at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n rowStart: {\n description: \"Starting row at the default breakpoint.\",\n type: gridTrackType,\n },\n rowStartNarrow: {\n description: \"Starting row at the narrow breakpoint.\",\n type: gridTrackType,\n },\n rowStartWide: {\n description:\n \"Starting row at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n colSpanNarrow: {\n description: \"Columns spanned at the narrow breakpoint.\",\n type: gridTrackType,\n },\n colStartNarrow: {\n description: \"Starting column at the narrow breakpoint.\",\n type: gridTrackType,\n },\n colSpanWide: {\n description:\n \"Columns spanned at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n colStartWide: {\n description:\n \"Starting column at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: { kind: \"when-provided\", prop: \"align\" },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-justify\",\n condition: { kind: \"when-provided\", prop: \"justify\" },\n value: { kind: \"prop\", prop: \"justify\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span\",\n condition: { kind: \"when-provided\", prop: \"colSpan\" },\n value: { kind: \"prop\", prop: \"colSpan\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start\",\n condition: { kind: \"when-provided\", prop: \"colStart\" },\n value: { kind: \"prop\", prop: \"colStart\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span-narrow\",\n condition: { kind: \"when-provided\", prop: \"colSpanNarrow\" },\n value: { kind: \"prop\", prop: \"colSpanNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start-narrow\",\n condition: { kind: \"when-provided\", prop: \"colStartNarrow\" },\n value: { kind: \"prop\", prop: \"colStartNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span-wide\",\n condition: { kind: \"when-provided\", prop: \"colSpanWide\" },\n value: { kind: \"prop\", prop: \"colSpanWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start-wide\",\n condition: { kind: \"when-provided\", prop: \"colStartWide\" },\n value: { kind: \"prop\", prop: \"colStartWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span\",\n condition: { kind: \"when-provided\", prop: \"rowSpan\" },\n value: { kind: \"prop\", prop: \"rowSpan\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start\",\n condition: { kind: \"when-provided\", prop: \"rowStart\" },\n value: { kind: \"prop\", prop: \"rowStart\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span-narrow\",\n condition: { kind: \"when-provided\", prop: \"rowSpanNarrow\" },\n value: { kind: \"prop\", prop: \"rowSpanNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start-narrow\",\n condition: { kind: \"when-provided\", prop: \"rowStartNarrow\" },\n value: { kind: \"prop\", prop: \"rowStartNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span-wide\",\n condition: { kind: \"when-provided\", prop: \"rowSpanWide\" },\n value: { kind: \"prop\", prop: \"rowSpanWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start-wide\",\n condition: { kind: \"when-provided\", prop: \"rowStartWide\" },\n value: { kind: \"prop\", prop: \"rowStartWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign, SetHeadingLevel } from \"../../types\";\nexport type SetHeadingSize =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"3xl\"\n | \"4xl\"\n | \"5xl\";\n\nexport interface SetHeadingProps {\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** DOM id. */\n id?: string;\n /** Semantic heading level; omit to render a `span`. */\n level?: SetHeadingLevel;\n /** Enables optical alignment for left sidebearing-heavy glyphs. @default false */\n opticalAlign?: boolean;\n /** Enables breakpoint-responsive heading scale. @default false */\n responsive?: boolean;\n /** Heading size. @default \"md\" */\n size?: SetHeadingSize;\n /** Heading text content (escaped before render). */\n text: string;\n}\n\n/**\n * Builds the IR tree for the Set heading component.\n *\n * @param props - Heading component props.\n * @returns IR node for a heading element (`h1`..`h6`) or `span`.\n */\nexport function buildSetHeading({\n align = \"start\",\n id,\n level,\n opticalAlign,\n responsive,\n size = \"md\",\n text,\n}: SetHeadingProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const tag = level ? (`h${level}` as const) : \"span\";\n return {\n kind: \"element\",\n tag,\n attrs: {\n class: \"set-heading\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-optical-align\": opticalAlign,\n \"data-responsive\": responsive,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [{ kind: \"text\", value: text }],\n };\n}\n\n/**\n * SSR renderer for the Set heading component.\n *\n * @param props - Heading component props.\n * @returns HTML string for a heading element (`h1`..`h6`) or `span`.\n */\nexport function renderSetHeading(props: SetHeadingProps): string {\n return serializeSetNode(buildSetHeading(props));\n}\n\n/** Declarative heading contract mirror for tooling, docs, and adapters. */\nexport const SET_HEADING_SPEC: SetComponentSpec = {\n name: \"heading\",\n description: \"Use `heading` to render heading text with consistent type.\",\n output: {\n element: {\n kind: \"switch\",\n prop: \"level\",\n cases: {\n \"1\": \"h1\",\n \"2\": \"h2\",\n \"3\": \"h3\",\n \"4\": \"h4\",\n \"5\": \"h5\",\n \"6\": \"h6\",\n },\n },\n class: \"set-heading\",\n },\n content: { kind: \"text\", prop: \"text\" },\n props: {\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n level: {\n description: \"Semantic heading level. Renders a `<span>` when omitted.\",\n type: { kind: \"enum\", values: [1, 2, 3, 4, 5, 6] },\n },\n opticalAlign: {\n default: false,\n description:\n \"Optically aligns left sidebearing-heavy glyphs with the content edge.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales type across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\", \"4xl\", \"5xl\"],\n },\n },\n text: {\n description: \"Heading text.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-optical-align\",\n condition: { kind: \"when-truthy\", prop: \"opticalAlign\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetImageAspectRatio = \"1:1\" | \"4:5\" | \"3:2\" | \"16:9\" | \"21:9\";\nexport type SetImageFit = \"intrinsic\" | \"fluid\" | \"cover\";\nexport type SetImageGravity =\n | \"N\"\n | \"NE\"\n | \"E\"\n | \"SE\"\n | \"S\"\n | \"SW\"\n | \"W\"\n | \"NW\"\n | \"C\";\nexport type SetImageScheme = \"light\" | \"dark\";\nexport interface SetImageSource {\n /**\n * The intrinsic height of the source, in pixels.\n */\n height?: number;\n /**\n * Media condition that is evaluated for the source.\n * Same format as the HTML `source[media]` attribute.\n */\n media?: string;\n /**\n * The HTML `sizes` attribute for the source.\n */\n sizes?: string;\n /**\n * A comma-separated list of candidate image sources.\n * Same format as the HTML `source[srcset]` attribute.\n */\n srcSet: string;\n /**\n * MIME type for the `srcSet` resources.\n */\n type?: string;\n /**\n * The intrinsic width of the source, in pixels.\n */\n width?: number;\n}\n\nexport interface SetImageProps {\n /** Show the light or dark variant to match the surrounding scheme. @default false */\n adaptive?: boolean;\n /** Alternative text. Empty string is valid and used by default. @default \"\" */\n alt?: string;\n /** Aspect ratio applied to the wrapper. */\n aspectRatio?: SetImageAspectRatio;\n /** Layout mode. @default \"intrinsic\" */\n fit?: SetImageFit;\n /** Enables default image shadow treatment. @default false */\n shadow?: boolean;\n /** Height in pixels. */\n height?: number;\n /** DOM id. */\n id?: string;\n /** Emit `loading=\"lazy\"` on the image. @default false */\n lazy?: boolean;\n /** Emit `fetchpriority=\"high\"` and suppress `loading=\"lazy\"`. @default false */\n priority?: boolean;\n /** Focal gravity for the cover crop. @default \"C\" */\n gravity?: SetImageGravity;\n /** Applies the default corner radius. @default false */\n radius?: boolean;\n /** HTML `sizes` attribute. */\n sizes?: string;\n /** Responsive source-set definitions for `<picture>`. */\n sources?: SetImageSource[];\n /** Candidate sources for the fallback `<img>` (HTML `img[srcset]` format). */\n srcSet?: string;\n /** Image source URL. */\n src: string;\n /** Width in pixels. */\n width?: number;\n}\n\n/**\n * Builds the IR tree for the Set image component.\n *\n * @param props - Image component props.\n * @returns IR node for image/picture markup.\n */\nexport function buildSetImage({\n adaptive,\n alt = \"\",\n aspectRatio,\n fit = \"intrinsic\",\n gravity = \"C\",\n height,\n id,\n lazy,\n priority,\n radius,\n shadow,\n sizes,\n sources,\n src,\n srcSet,\n width,\n}: SetImageProps): SetNode {\n const cover = fit === \"cover\";\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedSrc = src.trim();\n const normalizedSrcSet = srcSet?.trim();\n const normalizedSizes = sizes?.trim();\n const normalizedSources =\n sources?.map((source, index) => {\n const normalizedSrcSet = source.srcSet.trim();\n const normalizedMedia = source.media?.trim();\n const normalizedType = source.type?.trim();\n const normalizedSourceSizes = source.sizes?.trim();\n\n if (!normalizedSrcSet) {\n throw new Error(`sources[${index}].srcSet must be non-empty.`);\n }\n\n return {\n height: source.height,\n media: normalizedMedia || undefined,\n sizes: normalizedSourceSizes || undefined,\n srcSet: normalizedSrcSet,\n type: normalizedType || undefined,\n width: source.width,\n };\n }) || [];\n\n if (!normalizedSrc) {\n throw new Error(\"src must be a non-empty string.\");\n }\n\n if (\n adaptive &&\n [\n normalizedSrc,\n normalizedSrcSet,\n ...normalizedSources.map((source) => source.srcSet),\n ].some((url) => url?.includes(\"#\"))\n ) {\n throw new Error(\"adaptive sources must not contain URL fragments.\");\n }\n\n // Split like the browser: comma + whitespace, so embedded URL commas\n // survive. Anything beyond URL + one descriptor is ambiguous — throw.\n const withScheme = (srcSet: string, scheme: SetImageScheme): string =>\n srcSet\n .split(/,\\s+/)\n .map((candidate) => {\n const [url, ...descriptor] = candidate.trim().split(/\\s+/);\n if (!url || descriptor.length > 1) {\n throw new Error(\n \"adaptive srcSet candidates must be a URL plus at most one descriptor, separated by a comma and whitespace.\",\n );\n }\n return [`${url}#${scheme}`, ...descriptor].join(\" \");\n })\n .join(\", \");\n\n const buildMediaNode = (scheme?: SetImageScheme): SetNode => {\n const imgNode: SetNode = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt,\n class: \"img\",\n \"data-scheme\":\n scheme && normalizedSources.length === 0 ? scheme : undefined,\n fetchpriority: priority ? \"high\" : undefined,\n height: cover ? undefined : height ? String(height) : undefined,\n loading: lazy && !priority ? \"lazy\" : undefined,\n sizes:\n normalizedSources.length > 0\n ? undefined\n : normalizedSizes || undefined,\n src: scheme ? `${normalizedSrc}#${scheme}` : normalizedSrc,\n srcset:\n normalizedSrcSet && scheme\n ? withScheme(normalizedSrcSet, scheme)\n : normalizedSrcSet || undefined,\n width: cover ? undefined : width ? String(width) : undefined,\n },\n children: [],\n };\n\n if (normalizedSources.length === 0) {\n return imgNode;\n }\n\n const sourceNodes: SetNode[] = normalizedSources.map((source) => ({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n height: source.height ? String(source.height) : undefined,\n media: source.media,\n sizes: source.sizes,\n srcset: scheme ? withScheme(source.srcSet, scheme) : source.srcSet,\n type: source.type,\n width: source.width ? String(source.width) : undefined,\n },\n children: [],\n }));\n return {\n kind: \"element\",\n tag: \"picture\",\n attrs: { \"data-scheme\": scheme },\n children: [...sourceNodes, imgNode],\n };\n };\n\n const mediaNodes: SetNode[] = adaptive\n ? [buildMediaNode(\"light\"), buildMediaNode(\"dark\")]\n : [buildMediaNode()];\n\n const styleChunks: string[] = [];\n if (height) styleChunks.push(`--set-image-block-size: ${height / 16}rem`);\n if (width) styleChunks.push(`--set-image-inline-size: ${width / 16}rem`);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-image\",\n \"data-adaptive\": Boolean(adaptive),\n \"data-aspect-ratio\": cover && !height ? aspectRatio : undefined,\n \"data-fluid\": fit === \"fluid\",\n \"data-gravity\": cover && gravity !== \"C\" ? gravity : undefined,\n \"data-shadow\": Boolean(shadow),\n \"data-object-fit\": cover ? \"cover\" : undefined,\n \"data-radius\": Boolean(radius),\n id: normalizedId,\n style: styleChunks.length > 0 ? styleChunks.join(\"; \") : undefined,\n },\n children: mediaNodes,\n };\n}\n\n/**\n * SSR renderer for the Set image component.\n *\n * @param props - Image component props.\n * @returns HTML string for image/picture markup.\n */\nexport function renderSetImage(props: SetImageProps): string {\n return serializeSetNode(buildSetImage(props));\n}\n\n/** Declarative image contract mirror for tooling, docs, and adapters. */\nexport const SET_IMAGE_SPEC: SetComponentSpec = {\n name: \"image\",\n description:\n \"Use `image` to render a responsive image with intrinsic, fluid, or cover fit, and optional art-directed `sources`.\",\n output: { element: \"div\", class: \"set-image\" },\n content: { kind: \"none\" },\n props: {\n adaptive: {\n default: false,\n description:\n \"Shows the image's light or dark variant to match the surrounding color scheme. Use with adaptive assets exported from Screen, which carry both variants in one file; the component selects one by adding `#light`/`#dark` to the URL.\",\n type: { kind: \"boolean\" },\n },\n alt: {\n default: \"\",\n description: \"Alternative text. Leave empty for decorative images.\",\n type: { kind: \"string\" },\n },\n gravity: {\n default: \"C\",\n description: \"Focal point used when cropping.\",\n ignoredWhen: '`fit` is not `\"cover\"`',\n type: {\n kind: \"enum\",\n values: [\"N\", \"NE\", \"E\", \"SE\", \"S\", \"SW\", \"W\", \"NW\", \"C\"],\n },\n },\n radius: {\n default: false,\n description: \"Applies the default corner radius.\",\n type: { kind: \"boolean\" },\n },\n aspectRatio: {\n description: \"Aspect ratio applied to the wrapper.\",\n ignoredWhen: '`fit` is not `\"cover\"`, or `height` is set',\n type: {\n kind: \"enum\",\n values: [\"1:1\", \"4:5\", \"3:2\", \"16:9\", \"21:9\"],\n },\n },\n fit: {\n default: \"intrinsic\",\n description:\n \"Layout mode. `intrinsic` renders at the image's own dimensions, `fluid` scales to the container's full inline size at the active source's aspect ratio, `cover` renders a cropped fill (`object-fit: cover`) sized by the wrapper. For `fluid`, provide candidates sized for large viewports via `srcSet`/`sources` so upscaled rendering stays sharp.\",\n type: { kind: \"enum\", values: [\"intrinsic\", \"fluid\", \"cover\"] },\n },\n shadow: {\n default: false,\n description: \"Applies a drop shadow to the image.\",\n type: { kind: \"boolean\" },\n },\n height: {\n description:\n \"Height in pixels. Under `intrinsic` and `fluid`, an aspect-ratio hint — with `width`, reserves the correctly shaped box before load; rendered height follows the aspect ratio. Under `cover`, the wrapper's block size, overriding `aspectRatio`.\",\n type: { kind: \"number\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n lazy: {\n default: false,\n description: \"Defers loading until the image is near the viewport.\",\n type: { kind: \"boolean\" },\n },\n priority: {\n default: false,\n description: \"Marks the image as high priority for fetch.\",\n type: { kind: \"boolean\" },\n },\n sizes: {\n description: \"`sizes` attribute used with `srcSet`.\",\n ignoredWhen: \"`sources` are provided\",\n type: { kind: \"string\" },\n },\n sources: {\n description: \"Responsive sources rendered inside a `<picture>`.\",\n type: {\n kind: \"array\",\n itemShape: {\n height: {\n description: \"Intrinsic height in pixels.\",\n type: { kind: \"number\" },\n },\n media: {\n description: \"`media` condition evaluated for the source.\",\n type: { kind: \"string\" },\n },\n sizes: {\n description: \"`sizes` attribute for the source.\",\n type: { kind: \"string\" },\n },\n srcSet: {\n description: \"Candidate sources for this media entry.\",\n required: true,\n type: { kind: \"string\" },\n },\n type: {\n description: \"MIME type for the source resources.\",\n type: { kind: \"string\" },\n },\n width: {\n description: \"Intrinsic width in pixels.\",\n type: { kind: \"number\" },\n },\n },\n },\n },\n srcSet: {\n description: \"Candidate sources for the fallback image.\",\n type: { kind: \"string\" },\n },\n src: {\n description: \"Image source URL.\",\n required: true,\n type: { kind: \"string\" },\n },\n width: {\n description:\n \"Width in pixels. Under `intrinsic`, the rendered width, capped at the container; under `fluid`, an aspect-ratio hint; under `cover`, the wrapper's inline size (`aspectRatio` still derives the block size while `height` is unset).\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-adaptive\",\n condition: { kind: \"when-truthy\", prop: \"adaptive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-object-fit\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"cover\" },\n value: { kind: \"literal\", text: \"cover\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-shadow\",\n condition: { kind: \"when-truthy\", prop: \"shadow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-radius\",\n condition: { kind: \"when-truthy\", prop: \"radius\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-fluid\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"fluid\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"img\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"alt\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"alt\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"src\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{src}\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"srcset\",\n condition: { kind: \"when-non-empty\", prop: \"srcSet\" },\n value: { kind: \"prop\", prop: \"srcSet\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"fetchpriority\",\n condition: { kind: \"when-truthy\", prop: \"priority\" },\n value: { kind: \"literal\", text: \"high\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"loading\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"lazy\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"priority\" } },\n ],\n },\n value: { kind: \"literal\", text: \"lazy\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetInlineAs = \"div\" | \"ul\";\nexport type SetInlineGap = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type SetInlineJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\nexport interface SetInlineProps {\n /** Element tag. @default \"div\" */\n as?: SetInlineAs;\n /** Cross-axis alignment. @default \"center\" */\n align?: SetAlign;\n /** Trusted inner HTML. */\n children?: string;\n /** Spacing gap size. @default \"md\" */\n gap?: SetInlineGap;\n /** DOM id. */\n id?: string;\n /** Main-axis distribution. @default \"start\" */\n justify?: SetInlineJustify;\n /** Prevents wrapping of inline children. */\n nowrap?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set inline component.\n *\n * @param props - Inline component props.\n * @returns IR node for an inline wrapper.\n */\nexport function buildSetInline({\n align = \"center\",\n as = \"div\",\n children,\n gap = \"md\",\n id,\n justify = \"start\",\n nowrap,\n}: SetInlineProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: as,\n attrs: {\n class: \"set-inline\",\n \"data-align\": align === \"center\" ? undefined : align,\n \"data-gap\": gap,\n \"data-justify\": justify === \"start\" ? undefined : justify,\n \"data-nowrap\": nowrap,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set inline component.\n *\n * @param props - Inline component props.\n * @returns HTML string for an inline wrapper.\n */\nexport function renderSetInline(props: SetInlineProps): string {\n return serializeSetNode(buildSetInline(props));\n}\n\n/** Declarative inline contract mirror for tooling, docs, and adapters. */\nexport const SET_INLINE_SPEC: SetComponentSpec = {\n name: \"inline\",\n description: \"Use `inline` to lay out content in a horizontal row.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { div: \"div\", ul: \"ul\" } },\n class: \"set-inline\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n as: {\n default: \"div\",\n description: \"Element tag to render. `ul` children must be `<li>`.\",\n type: { kind: \"enum\", values: [\"div\", \"ul\"] },\n },\n align: {\n default: \"center\",\n description: \"Aligns items on the cross axis.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n children: {\n description: \"Items laid out in a row.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"md\",\n description: \"Space between children.\",\n type: { kind: \"enum\", values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n justify: {\n default: \"start\",\n description: \"Distributes items along the main axis.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\", \"between\"] },\n },\n nowrap: {\n description: \"Prevents items from wrapping onto new lines.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"start\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-justify\",\n condition: {\n kind: \"when-in\",\n prop: \"justify\",\n values: [\"center\", \"end\", \"between\"],\n },\n value: { kind: \"prop\", prop: \"justify\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-nowrap\",\n condition: { kind: \"when-truthy\", prop: \"nowrap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport type SetInputType =\n | \"text\"\n | \"email\"\n | \"password\"\n | \"tel\"\n | \"url\"\n | \"numeric\";\n\nexport interface SetInputProps {\n /** Autocomplete hint; `false` emits `autocomplete=\"off\"`. */\n autocomplete?: string | false;\n /** Helper text rendered after the input (reused as validation guidance when `invalid`). */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Input id; used for `input[id]` and `label[for]`. */\n id: string;\n /** Invalid state. Ignored when `disabled` or `readOnly`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Field name attribute. */\n name?: string;\n /** Pattern attribute. */\n pattern?: string;\n /** Read-only state. Ignored when `disabled`. @default false */\n readOnly?: boolean;\n /** Required state. @default false */\n required?: boolean;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Spellcheck behavior. Defaults to `false` for `type=\"numeric\"` unless explicit. */\n spellcheck?: boolean;\n /** Input type; `numeric` maps to `type=\"text\"` with `inputmode=\"numeric\"`. @default \"text\" */\n type?: SetInputType;\n /** Current value. */\n value?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set input component.\n *\n * @param props - Input component props.\n * @returns IR node for a labeled input field wrapper.\n */\nexport function buildSetInput({\n autocomplete,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n pattern,\n readOnly,\n required,\n size = \"md\",\n spellcheck,\n type = \"text\",\n value,\n inlineSize = \"full\",\n}: SetInputProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedAutocomplete =\n autocomplete === false ? false : autocomplete?.trim();\n const normalizedName = name?.trim();\n const normalizedPattern = pattern?.trim();\n // Preserve the field value exactly as provided. Leading/trailing spaces can\n // be meaningful user input, and adapters use `\"\"` to keep cleared fields\n // controlled.\n const normalizedValue = value;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isNumeric = type === \"numeric\";\n const resolvedType = isNumeric ? \"text\" : type;\n const resolvedPattern =\n normalizedPattern || (isNumeric ? \"^[0-9]*$\" : undefined);\n const resolvedSpellcheck =\n spellcheck === undefined && isNumeric ? false : spellcheck;\n const isDisabled = Boolean(disabled);\n const isReadOnly = !isDisabled && Boolean(readOnly);\n const isInvalid = !isDisabled && !isReadOnly && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n autocomplete:\n normalizedAutocomplete === false\n ? \"off\"\n : normalizedAutocomplete || undefined,\n class: \"input\",\n disabled: isDisabled,\n id: normalizedId,\n inputmode: isNumeric ? \"numeric\" : undefined,\n name: normalizedName || undefined,\n pattern: resolvedPattern,\n readonly: isReadOnly,\n required: Boolean(required),\n spellcheck:\n resolvedSpellcheck === undefined\n ? undefined\n : String(resolvedSpellcheck),\n type: resolvedType,\n value: normalizedValue,\n },\n children: [],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-input\",\n \"data-size\": size,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set input component.\n *\n * @param props - Input component props.\n * @returns HTML string for a labeled input field wrapper.\n */\nexport function renderSetInput(props: SetInputProps): string {\n return serializeSetNode(buildSetInput(props));\n}\n\n/** Declarative input contract mirror for tooling, docs, and adapters. */\nexport const SET_INPUT_SPEC: SetComponentSpec = {\n name: \"input\",\n description: \"Use `input` to collect a single line of text from users.\",\n output: { element: \"div\", class: \"set-input\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n autocomplete: {\n description: \"Autocomplete hint. Pass `false` to disable autocomplete.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"string\" }, { kind: \"boolean\" }],\n },\n },\n description: {\n description:\n \"Helper text shown below the input; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` linking the label to the input.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the input as invalid.\",\n ignoredWhen: \"`disabled` is true or `readOnly` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label shown above the input.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n pattern: {\n description: \"Regex pattern the value must match.\",\n type: { kind: \"string\" },\n },\n readOnly: {\n default: false,\n description: \"Makes the input read-only.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n required: {\n default: false,\n description: \"Marks the input as required.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n spellcheck: {\n description: \"Enables browser spellchecking.\",\n type: { kind: \"boolean\" },\n },\n type: {\n default: \"text\",\n description: \"Input type.\",\n type: {\n kind: \"enum\",\n values: [\"text\", \"email\", \"password\", \"tel\", \"url\", \"numeric\"],\n },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the field fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"descendant\", selector: \"label\" },\n attribute: \"for\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"input\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-provided\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"readonly\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"readOnly\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"readOnly\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"inputmode\",\n condition: { kind: \"when-equals\", prop: \"type\", to: \"numeric\" },\n value: { kind: \"literal\", text: \"numeric\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"when-equals\", prop: \"type\", to: \"numeric\" },\n value: { kind: \"literal\", text: \"text\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"when-not-in\", prop: \"type\", values: [\"numeric\"] },\n value: { kind: \"prop\", prop: \"type\" },\n },\n ],\n },\n};\n","import type { SetNode } from \"../../helpers/node\";\n\n// The boot animation needs the mark decomposed into addressable cells —\n// structure the single-path shape tokens cannot carry. Keep the artwork in\n// step with `primitive.shape.logo.*`.\n\nconst PRIMARY_VIEWBOX = \"0 0 6714.6 1200\";\nconst GRAPHIC_VIEWBOX = \"0 0 600 1200\";\n\n/** Cells in boot order; logo.css keys the keyframes by nth-child. */\nconst MARK_CELLS: ReadonlyArray<{ x: number; y: number }> = [\n { x: 0, y: 0 },\n { x: 300, y: 0 },\n { x: 150, y: 300 },\n { x: 450, y: 300 },\n { x: 0, y: 600 },\n { x: 300, y: 600 },\n { x: 150, y: 900 },\n { x: 450, y: 900 },\n];\n\n// Verbatim copy of `primitive.shape.logo.typographic.path` (drift-guarded\n// by logo.test.ts), offset into the primary lockup's space.\nconst WORD_PATH =\n \"M0 956h98V571L87 391h2l124 320h89l123-320h3l-11 180v385h98V276H384L260 608h-5L131 276H0zm879.94 10c184 0 223-46 223-272 0-225-39-271-223-271-186 0-224 46-224 271 0 226 38 272 224 272m0-93c-102 0-123-30-123-179 0-147 21-177 123-177 100 0 121 30 121 177 0 149-21 179-121 179m361.44 83h103V686c0-141 20-169 112-169 73 0 88 18 88 107v332h103V624c0-167-28-202-163-202-95 0-120 16-147 92h-5v-82h-91zm769.16 10c184 0 223-46 223-272 0-225-39-271-223-271-186 0-224 46-224 271 0 226 38 272 224 272m0-93c-102 0-123-30-123-179 0-147 21-177 123-177 100 0 121 30 121 177 0 149-21 179-121 179m363.25-65c-4 132 30 158 202 158 173 0 208-25 208-150 0-118-33-146-191-170-94-14-114-26-114-74 0-50 18-60 103-60 76 0 92 9 96 52h97c-3-118-36-142-194-142-166 0-201 25-201 146 0 114 31 141 182 162 101 13 122 28 122 82 0 53-18 64-103 64-88 0-107-11-110-68zm558.97 363h102V902h5c20 54 41 64 123 64 160 0 193-45 193-270 0-227-34-274-198-274-83 0-105 11-123 65h-4v-55h-98zm209-298c-93 0-112-30-112-179 0-148 19-178 112-178s113 30 113 179c0 148-20 178-113 178m656.46 83h88V610c0-156-34-187-197-187-150 0-181 27-179 157h97c1-61 15-74 85-74 82 0 99 18 99 105v24h-72c-187 0-226 30-226 179 0 126 28 152 162 152 92 0 116-13 138-74h5zm-8-243c-1 135-22 163-119 163-65 0-79-13-79-75 0-74 18-88 107-88zm551.75 95c-10 56-26 67-89 67-100 0-121-31-121-181s20-181 117-181c65 0 81 14 91 79h101c-4-141-37-170-188-170-185 0-224 46-224 272s39 272 226 272c147 0 179-26 186-158zm547.03 9c-15 48-31 58-96 58-96 0-117-23-123-136h324c5-263-32-317-214-317-172 0-207 46-207 271 0 227 38 273 223 273 139 0 172-25 190-149zm-218-160c4-122 24-146 114-146 88 0 108 24 112 146zm787.56 299h93l-1-734h-102l1 266h-5c-19-54-40-65-120-65-162 0-196 46-196 272s35 271 200 271c84 0 105-11 125-65h5zm-115-82c-94 0-114-30-114-180s20-180 114-180c93 0 112 30 112 180s-19 180-112 180\";\nconst WORD_OFFSET = 1163;\n\nconst markGroup = (): SetNode => ({\n kind: \"element\",\n tag: \"g\",\n attrs: { class: \"mark\" },\n children: MARK_CELLS.map(({ x, y }) => ({\n kind: \"element\" as const,\n tag: \"rect\",\n attrs: {\n height: \"300\",\n width: \"150\",\n x: String(x),\n y: String(y),\n },\n children: [],\n })),\n});\n\nconst wordGroup = (): SetNode => ({\n kind: \"element\",\n tag: \"g\",\n attrs: { class: \"word\", transform: `translate(${WORD_OFFSET} 0)` },\n children: [\n {\n kind: \"element\",\n tag: \"path\",\n attrs: { d: WORD_PATH },\n children: [],\n },\n ],\n});\n\nconst animatedSvg = (viewBox: string, children: SetNode[]): SetNode => ({\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": \"true\",\n viewBox,\n xmlns: \"http://www.w3.org/2000/svg\",\n },\n children,\n});\n\n/** Builds the animated primary logo SVG (mark plus wordmark). */\nexport function buildSetLogoAnimatedPrimary(): SetNode {\n return animatedSvg(PRIMARY_VIEWBOX, [markGroup(), wordGroup()]);\n}\n\n/** Builds the animated graphic logo SVG (mark only). */\nexport function buildSetLogoAnimatedGraphic(): SetNode {\n return animatedSvg(GRAPHIC_VIEWBOX, [markGroup()]);\n}\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n buildSetLogoAnimatedGraphic,\n buildSetLogoAnimatedPrimary,\n} from \"./logos-animated\";\n\nexport type SetLogoTone = \"default\" | \"neutral\";\nexport type SetLogoSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fill\";\nexport type SetLogoVariant =\n | \"primary\"\n | \"secondary\"\n | \"typographic\"\n | \"graphic\";\n\nexport interface SetLogoProps {\n /** Plays the logo's boot animation. Primary and graphic only; other variants render static. @default false */\n animated?: boolean;\n /** DOM id. */\n id?: string;\n /** Accessible label. */\n label: string;\n /** Size. @default \"md\" */\n size?: SetLogoSize;\n /** Tone. @default \"default\" */\n tone?: SetLogoTone;\n /** Variant. @default \"primary\" */\n variant?: SetLogoVariant;\n}\n\n/**\n * Builds the IR tree for the Set logo component.\n *\n * @param props - Logo component props.\n * @returns IR node for a masked logo element.\n */\nexport function buildSetLogo({\n animated,\n id,\n label,\n size = \"md\",\n tone = \"default\",\n variant = \"primary\",\n}: SetLogoProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const isAnimated =\n Boolean(animated) && (variant === \"primary\" || variant === \"graphic\");\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: label }],\n },\n ];\n\n if (isAnimated) {\n children.push(\n variant === \"graphic\"\n ? buildSetLogoAnimatedGraphic()\n : buildSetLogoAnimatedPrimary(),\n );\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-logo\",\n \"data-animated\": isAnimated,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n \"data-variant\": variant === \"primary\" ? undefined : variant,\n id: normalizedId,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set logo component.\n *\n * @param props - Logo component props.\n * @returns HTML string for a masked logo element.\n */\nexport function renderSetLogo(props: SetLogoProps): string {\n return serializeSetNode(buildSetLogo(props));\n}\n\n/** Declarative logo contract mirror for tooling, docs, and adapters. */\nexport const SET_LOGO_SPEC: SetComponentSpec = {\n name: \"logo\",\n description: \"Use `logo` to display the brand mark.\",\n output: { element: \"div\", class: \"set-logo\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n animated: {\n default: false,\n description:\n \"Plays the logo's boot animation once on render. Animates the `primary` and `graphic` variants; others render static.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\", \"xl\", \"fill\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n variant: {\n default: \"primary\",\n description: \"Logo variant.\",\n type: {\n kind: \"enum\",\n values: [\"primary\", \"secondary\", \"typographic\", \"graphic\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-animated\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"animated\" },\n {\n kind: \"when-in\",\n prop: \"variant\",\n values: [\"primary\", \"graphic\"],\n },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-variant\",\n condition: {\n kind: \"when-in\",\n prop: \"variant\",\n values: [\"secondary\", \"typographic\", \"graphic\"],\n },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetPageHeaderBorder = \"always\" | \"scroll\";\nexport type SetPageHeaderSize = \"sm\" | \"md\" | \"lg\";\nexport type SetPageStickyHeader = \"always\" | \"belowNotebook\";\n\nexport interface SetPageProps {\n /** Optional banner region markup rendered before the header. Caller sanitizes untrusted content. */\n banner?: string;\n /** Centers the main region within the page shell. Emits `data-center-main` only when true. @default false */\n centerMain?: boolean;\n /** Main region markup rendered inside the page-owned `<main>`. Caller sanitizes untrusted content. */\n children?: string;\n /** Header region markup. Caller sanitizes untrusted content. */\n header: string;\n /** Bottom border on the header. `\"scroll\"` requires `stickyHeader`. */\n headerBorder?: SetPageHeaderBorder;\n /** Header size. Reserves a minimum block size on the header. @default \"md\" */\n headerSize?: SetPageHeaderSize;\n /** DOM id. */\n id?: string;\n /** Sticky header behavior. Emits `data-sticky-header` when provided. */\n stickyHeader?: SetPageStickyHeader;\n /** Footer region markup. Caller sanitizes untrusted content. */\n footer: string;\n}\n\n/**\n * Builds the IR tree for the Set page shell.\n *\n * @param props - Page shell props.\n * @returns IR node for a page wrapper.\n */\nexport function buildSetPage({\n banner,\n centerMain,\n children,\n footer,\n header,\n headerBorder,\n headerSize = \"md\",\n id,\n stickyHeader,\n}: SetPageProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const regionChildren: SetNode[] = [];\n\n if (banner) regionChildren.push({ kind: \"raw\", html: banner });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"header\",\n attrs: { class: \"header\" },\n children: [{ kind: \"raw\", html: header }],\n });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"main\",\n attrs: { class: \"main\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"footer\",\n attrs: { class: \"footer\" },\n children: [{ kind: \"raw\", html: footer }],\n });\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-page\",\n \"data-center-main\": centerMain,\n \"data-header-border\": headerBorder,\n \"data-header-size\": headerSize,\n \"data-sticky-header\": stickyHeader,\n id: normalizedId,\n },\n children: regionChildren,\n };\n}\n\n/**\n * SSR renderer for the Set page shell.\n *\n * Emits a prescribed page structure with an optional banner region followed by\n * header, main, and footer content. The page shell owns the outer layout\n * wrapper and region elements so the internal page layout can evolve without\n * changing the consumer-facing region contract.\n *\n * @param props - Page shell props.\n * @returns HTML string for a page wrapper.\n */\nexport function renderSetPage(props: SetPageProps): string {\n return serializeSetNode(buildSetPage(props));\n}\n\n/** Declarative page contract mirror for tooling, docs, and adapters. */\nexport const SET_PAGE_SPEC: SetComponentSpec = {\n name: \"page\",\n description:\n \"Use `page` as the primary layout for header, main, and footer regions.\",\n output: { element: \"div\", class: \"set-page\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"banner\", kind: \"html\" },\n { prop: \"header\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n { prop: \"footer\", kind: \"html\" },\n ],\n },\n props: {\n banner: {\n description: \"Banner rendered above the header.\",\n type: { kind: \"html\" },\n },\n children: {\n description: \"Main content of the page.\",\n type: { kind: \"html\" },\n },\n centerMain: {\n default: false,\n description: \"Centers the main region within the page shell.\",\n type: { kind: \"boolean\" },\n },\n header: {\n description: \"Header content.\",\n required: true,\n type: { kind: \"html\" },\n },\n headerBorder: {\n description:\n \"Bottom border on the header. `'always'` is persistent; `'scroll'` fades in only when a sticky header is stuck (browsers without `container-type: scroll-state` fall back to always-on).\",\n type: { kind: \"enum\", values: [\"always\", \"scroll\"] },\n },\n headerSize: {\n default: \"md\",\n description:\n \"Reserves a minimum block size on the header. `--set-page-header-block-size` is exposed to descendants so persistent panels can open below the header band.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n stickyHeader: {\n description: \"When the header stays stuck to the top of the viewport.\",\n type: { kind: \"enum\", values: [\"always\", \"belowNotebook\"] },\n },\n footer: {\n description: \"Footer content.\",\n required: true,\n type: { kind: \"html\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-center-main\",\n condition: { kind: \"when-truthy\", prop: \"centerMain\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-header-border\",\n condition: { kind: \"when-provided\", prop: \"headerBorder\" },\n value: { kind: \"prop\", prop: \"headerBorder\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-header-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"headerSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-sticky-header\",\n condition: { kind: \"when-provided\", prop: \"stickyHeader\" },\n value: { kind: \"prop\", prop: \"stickyHeader\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetPanelPadding = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface SetPanelProps {\n /** Trusted inner HTML. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inner spacing scale. @default \"md\" */\n padding?: SetPanelPadding;\n /** Surface context. */\n surface?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set panel component.\n *\n * @param props - Panel component props.\n * @returns IR node for a panel wrapper.\n */\nexport function buildSetPanel({\n children,\n id,\n padding = \"md\",\n surface,\n}: SetPanelProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-panel\",\n \"data-padding\": padding,\n \"data-set-surface\": surface,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set panel component.\n *\n * @param props - Panel component props.\n * @returns HTML string for a panel wrapper.\n */\nexport function renderSetPanel(props: SetPanelProps): string {\n return serializeSetNode(buildSetPanel(props));\n}\n\n/** Declarative panel contract mirror for tooling, docs, and adapters. */\nexport const SET_PANEL_SPEC: SetComponentSpec = {\n name: \"panel\",\n description: \"Use `panel` to group related content in a contained region.\",\n output: { element: \"div\", class: \"set-panel\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the panel.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n padding: {\n default: \"md\",\n description: \"Inner spacing scale.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-padding\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"padding\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetPatternSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fill\";\nexport type SetPatternTone = \"default\" | \"subtle\" | \"support\";\nexport type SetPatternVariant = \"tile\" | \"tileLight\" | \"tileDark\";\n\nexport interface SetPatternProps {\n /** Trusted inner HTML rendered inside the pattern container. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Pattern variant. @default \"tile\" */\n variant?: SetPatternVariant;\n /** Tone. @default \"default\" */\n tone?: SetPatternTone;\n /** Size mode. @default \"md\" */\n size?: SetPatternSize;\n}\n\n/**\n * Builds the IR tree for the Set pattern component.\n *\n * @param props - Pattern component props.\n * @returns IR node for a pattern container.\n */\nexport function buildSetPattern({\n children,\n id,\n size = \"md\",\n tone = \"default\",\n variant = \"tile\",\n}: SetPatternProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-pattern\",\n \"data-size\": size,\n \"data-tone\": tone === \"default\" ? undefined : tone,\n \"data-variant\": variant,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set pattern component.\n *\n * @param props - Pattern component props.\n * @returns HTML string for a pattern container.\n */\nexport function renderSetPattern(props: SetPatternProps = {}): string {\n return serializeSetNode(buildSetPattern(props));\n}\n\n/** Declarative pattern contract mirror for tooling, docs, and adapters. */\nexport const SET_PATTERN_SPEC: SetComponentSpec = {\n name: \"pattern\",\n description:\n \"Use `pattern` to render repeated visual language components behind content.\",\n output: { element: \"div\", class: \"set-pattern\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered above the pattern.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"subtle\", \"support\"] },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"fill\"] },\n },\n variant: {\n default: \"tile\",\n description: \"Shape used for the pattern tile.\",\n type: {\n kind: \"enum\",\n values: [\"tile\", \"tileLight\", \"tileDark\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-variant\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"subtle\", \"support\"],\n },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetImage, type SetImageGravity } from \"../image/image\";\nimport type { SetTheme } from \"../root/root\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetPosterSurface = Exclude<\n SetSurfaceVariant,\n \"inverse\" | \"brand-inverse\"\n>;\n\ndeclare const __posterMediaTag: unique symbol;\n/**\n * HTML string returned by `renderSetPosterImage`. The tagged type forces\n * consumers through the helper, which locks the cover/priority defaults\n * Poster's layout needs.\n */\nexport type SetPosterMedia = string & {\n readonly [__posterMediaTag]: true;\n};\n\ndeclare const __posterAdaptiveMediaTag: unique symbol;\n/**\n * HTML string returned by `renderSetPosterImage` for adaptive media. The\n * separate tag lets Poster reject `contentTheme` at the type level:\n * adaptive media follows the ambient scheme, so a lock would strand the\n * other variant.\n */\nexport type SetPosterAdaptiveMedia = string & {\n readonly [__posterAdaptiveMediaTag]: true;\n};\n\nexport interface SetPosterImageProps {\n /** Show the light or dark variant to match the surrounding scheme. @default false */\n adaptive?: boolean;\n /** Focal gravity for the cover crop. @default \"C\" */\n gravity?: SetImageGravity;\n /** HTML `sizes` attribute. */\n sizes?: string;\n /** Image source URL. */\n src: string;\n /** Candidate sources for the image (HTML `img[srcset]` format). */\n srcSet?: string;\n}\n\n/**\n * Renders the image media for a Poster. `fit` and `priority` are locked\n * to the values Poster's layout needs; `alt` is empty because Poster's\n * image is decorative (content-over-background).\n *\n * @param props - Poster image props.\n * @returns HTML string suitable for Poster's `media` prop.\n */\nexport function renderSetPosterImage(\n props: SetPosterImageProps & { adaptive: true },\n): SetPosterAdaptiveMedia;\nexport function renderSetPosterImage(\n props: SetPosterImageProps & { adaptive?: false },\n): SetPosterMedia;\nexport function renderSetPosterImage(\n props: SetPosterImageProps,\n): SetPosterMedia | SetPosterAdaptiveMedia {\n return renderSetImage({\n ...props,\n alt: \"\",\n fit: \"cover\",\n priority: true,\n }) as SetPosterMedia | SetPosterAdaptiveMedia;\n}\n\ninterface SetPosterBaseProps {\n /** Foreground HTML content above the media. Caller sanitizes untrusted content. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Surface context. Emits `data-set-surface` when provided. */\n surface?: SetPosterSurface;\n}\n\nexport type SetPosterProps = SetPosterBaseProps &\n (\n | {\n /** Absolute theme lock for foreground content over non-themeable media. */\n contentTheme?: SetTheme;\n /** Background media; build with `renderSetPosterImage`. */\n media: SetPosterMedia;\n }\n | {\n /** Adaptive media follows the ambient scheme; a lock is incoherent. */\n contentTheme?: never;\n /** Adaptive background media; build with `renderSetPosterImage`. */\n media: SetPosterAdaptiveMedia;\n }\n );\n\n/**\n * Builds the IR tree for the Set poster component.\n *\n * Accepts the props union loosely: adapters route media through slots,\n * so the adaptive/contentTheme exclusion is enforced by `SetPosterProps`\n * at authoring surfaces rather than here.\n *\n * @param props - Poster component props.\n * @returns IR node for a poster container.\n */\nexport function buildSetPoster({\n children,\n contentTheme,\n id,\n media,\n surface,\n}: SetPosterBaseProps & {\n contentTheme?: SetTheme;\n media: SetPosterMedia | SetPosterAdaptiveMedia;\n}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const resolvedSurface = contentTheme ? (surface ?? \"default\") : surface;\n const posterChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"image-wrapper\" },\n children: [{ kind: \"raw\", html: media }],\n },\n ];\n\n if (children) {\n posterChildren.push({\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: [{ kind: \"raw\", html: children }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-poster\",\n \"data-set-content-theme\": contentTheme,\n \"data-set-surface\": resolvedSurface,\n id: normalizedId,\n },\n children: posterChildren,\n };\n}\n\n/**\n * SSR renderer for the Set poster component.\n *\n * Emits a single `div.poster` root containing a media wrapper behind optional\n * trusted foreground content. `contentTheme`, when provided, is an absolute\n * local foreground theme override intended for poster-like content over\n * non-themeable media.\n *\n * @param props - Poster component props.\n * @returns HTML string for a poster container.\n */\nexport function renderSetPoster(props: SetPosterProps): string {\n return serializeSetNode(buildSetPoster(props));\n}\n\n/** Declarative poster contract mirror for tooling, docs, and adapters. */\nexport const SET_POSTER_SPEC: SetComponentSpec = {\n name: \"poster\",\n description: \"Use `poster` to layer content over background media.\",\n output: { element: \"div\", class: \"set-poster\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"media\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Foreground content rendered over the media.\",\n type: { kind: \"html\" },\n },\n contentTheme: {\n description:\n \"Absolute theme lock for foreground content over non-themeable media.\",\n ignoredWhen:\n \"`media` is adaptive (it matches the surrounding scheme by itself)\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n media: {\n description:\n \"Background media markup. Build with `renderSetPosterImage`.\",\n required: true,\n type: { kind: \"html\" },\n },\n surface: {\n description: \"Surface context.\",\n type: { kind: \"enum\", values: [\"default\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"when-provided\", prop: \"contentTheme\" },\n value: { kind: \"prop\", prop: \"contentTheme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"contentTheme\" },\n { kind: \"not\", of: { kind: \"when-provided\", prop: \"surface\" } },\n ],\n },\n value: { kind: \"literal\", text: \"default\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetProseHangingPunctuation = \"always\" | \"notebook\";\n\nexport interface SetProseProps {\n /** Trusted inner HTML. */\n children: string;\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** Hanging-indent layout behavior. */\n hangingPunctuation?: SetProseHangingPunctuation;\n /** DOM id. */\n id?: string;\n /** Enables visited-state styling for links inside prose. @default true */\n linkVisited?: boolean;\n /** Applies max measure constraints for long-form readability. @default true */\n measured?: boolean;\n /** Applies monospaced word spacing throughout. @default false */\n monospaced?: boolean;\n /** Enables breakpoint-responsive body scale. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set prose component.\n *\n * @param props - Prose component props.\n * @returns IR node for a prose wrapper.\n */\nexport function buildSetProse({\n align = \"start\",\n children,\n hangingPunctuation,\n id,\n linkVisited = true,\n measured = true,\n monospaced,\n responsive,\n}: SetProseProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-prose\",\n \"data-align\": align !== \"start\" ? align : undefined,\n \"data-hanging-punctuation\": hangingPunctuation,\n \"data-link-visited\": linkVisited ? undefined : \"off\",\n \"data-measured\": measured,\n \"data-monospaced\": monospaced,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set prose component.\n *\n * @param props - Prose component props.\n * @returns HTML string for a prose wrapper.\n */\nexport function renderSetProse(props: SetProseProps): string {\n return serializeSetNode(buildSetProse(props));\n}\n\n/** Declarative prose contract mirror for tooling, docs, and adapters. */\nexport const SET_PROSE_SPEC: SetComponentSpec = {\n name: \"prose\",\n description: \"Use `prose` to style rich-text markup.\",\n output: { element: \"div\", class: \"set-prose\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the prose wrapper.\",\n required: true,\n type: { kind: \"html\" },\n },\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n hangingPunctuation: {\n description:\n \"Position list markers and leading quote marks in the margin, with text aligned.\",\n type: { kind: \"enum\", values: [\"always\", \"notebook\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n linkVisited: {\n default: true,\n description: \"Styles visited links inside the prose.\",\n type: { kind: \"boolean\" },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n type: { kind: \"boolean\" },\n },\n monospaced: {\n default: false,\n description: \"Applies monospaced word spacing throughout.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales body text across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-hanging-punctuation\",\n condition: { kind: \"when-provided\", prop: \"hangingPunctuation\" },\n value: { kind: \"prop\", prop: \"hangingPunctuation\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-link-visited\",\n condition: { kind: \"when-equals\", prop: \"linkVisited\", to: false },\n value: { kind: \"literal\", text: \"off\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-measured\",\n condition: { kind: \"when-truthy\", prop: \"measured\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-monospaced\",\n condition: { kind: \"when-truthy\", prop: \"monospaced\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\nimport { buildSetFieldset } from \"../fieldset/fieldset\";\n\nexport type SetRadiosOrientation = \"vertical\" | \"horizontal\";\n\nexport interface SetRadioItem {\n /** Optional per-item helper text. */\n description?: string;\n /**\n * Optional per-item disabled override.\n * @default false\n */\n disabled?: boolean;\n /** Radio option label (escaped before render). */\n label: string;\n /** Option value (submitted value and selection key). */\n value: string;\n}\n\nexport interface SetRadiosProps {\n /** Group description rendered below legend. */\n description?: string;\n /** Group disabled state. @default false */\n disabled?: boolean;\n /** Group id used for group and per-item description id derivation. */\n id: string;\n /** Group invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Radio options. Must include at least 2 options. */\n radios: SetRadioItem[];\n /** Group legend text (escaped before render). */\n legend: string;\n /** Shared radio name applied to all options. */\n name: string;\n /** Layout orientation. @default \"vertical\" */\n orientation?: SetRadiosOrientation;\n /** Required selection state. @default false */\n required?: boolean;\n /** Size variant for all radios in the group. @default \"md\" */\n size?: SetControlSize;\n /** Selected option value. When unmatched, no option is checked. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set radios component.\n *\n * @param props - Radios component props.\n * @returns IR node for a radios fieldset.\n */\nexport function buildSetRadios({\n description,\n disabled,\n id,\n invalid,\n radios,\n legend,\n name,\n orientation = \"vertical\",\n required,\n size = \"md\",\n value,\n}: SetRadiosProps): SetNode {\n const normalizedId = id.trim();\n const normalizedName = name.trim();\n const normalizedValue = value?.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!normalizedName) {\n throw new Error(\"name must be a non-empty string.\");\n }\n\n if (radios.length < 2) {\n throw new Error(\"radios must include at least 2 options.\");\n }\n\n const normalizedRadios = radios.map((item, index) => {\n const itemValue = item.value.trim();\n const itemLabel = item.label.trim();\n const itemDescription = item.description?.trim();\n\n if (!itemValue) {\n throw new Error(`radios[${index}].value must be non-empty.`);\n }\n\n if (!itemLabel) {\n throw new Error(`radios[${index}].label must be non-empty.`);\n }\n\n return {\n description: itemDescription,\n disabled: Boolean(item.disabled),\n label: itemLabel,\n value: itemValue,\n };\n });\n\n const itemValueSet = new Set(normalizedRadios.map((item) => item.value));\n\n if (itemValueSet.size !== normalizedRadios.length) {\n throw new Error(\"radios values must be unique.\");\n }\n\n const isGroupDisabled = Boolean(disabled);\n\n const optionNodes: SetNode[] = normalizedRadios.map((item) => {\n const isItemDisabled = Boolean(item.disabled);\n const itemDescriptionId = item.description\n ? `${normalizedId}-${item.value}-description`\n : undefined;\n\n const fieldChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": itemDescriptionId,\n checked: normalizedValue === item.value,\n class: \"radio\",\n disabled: isItemDisabled,\n name: normalizedName,\n required:\n Boolean(required) && !isGroupDisabled && !isItemDisabled,\n type: \"radio\",\n value: item.value,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: item.label }],\n },\n ],\n },\n ];\n\n if (item.description) {\n fieldChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"radio-description\", id: itemDescriptionId },\n children: [{ kind: \"text\", value: item.description }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"radio-field\" },\n children: fieldChildren,\n };\n });\n\n const radiosNode: SetNode = {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-radios\",\n \"data-orientation\": orientation,\n \"data-size\": size,\n },\n children: optionNodes,\n };\n\n return buildSetFieldset({\n children: serializeSetNode(radiosNode),\n description,\n disabled: isGroupDisabled,\n id: normalizedId,\n invalid,\n legend,\n });\n}\n\n/**\n * SSR renderer for the Set radios component.\n *\n * @param props - Radios component props.\n * @returns HTML string for a radios fieldset.\n */\nexport function renderSetRadios(props: SetRadiosProps): string {\n return serializeSetNode(buildSetRadios(props));\n}\n\n/** Declarative radios contract mirror for tooling, docs, and adapters. */\nexport const SET_RADIOS_SPEC: SetComponentSpec = {\n name: \"radios\",\n description: \"Use `radios` to let users select one option from a short list.\",\n output: { element: \"fieldset\", class: \"set-fieldset\" },\n content: { kind: \"structured\", prop: \"radios\" },\n props: {\n description: {\n description: \"Helper text shown below the legend.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables every option in the group.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description:\n \"Unique id used to associate the group with its descriptions.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the group as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n radios: {\n description: \"Options shown in the group.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n description: {\n description: \"Optional per-item helper text.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Optional per-item disabled override.\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Radio option label.\",\n required: true,\n type: { kind: \"text\" },\n },\n value: {\n description: \"Submitted value and selection key.\",\n required: true,\n type: { kind: \"string\" },\n },\n },\n },\n },\n legend: {\n description: \"Group label.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name shared by all options.\",\n required: true,\n type: { kind: \"string\" },\n },\n orientation: {\n default: \"vertical\",\n description: \"Layout direction.\",\n type: { kind: \"enum\", values: [\"vertical\", \"horizontal\"] },\n },\n required: {\n default: false,\n description: \"Requires a selection before submission.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Currently selected value.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.set-radios\" },\n attribute: \"data-orientation\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"orientation\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.set-radios\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"radio\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"radio\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetBrand = \"mnsp\" | \"wrfr\";\nexport type SetDirection = \"ltr\" | \"rtl\";\nexport type SetAppOverscrollBehavior = \"none\";\nexport type SetTheme = \"light\" | \"dark\";\n\nexport interface SetRootProps {\n /** Marks this root as the owning app root; emits `data-app-root` when true. @default false */\n appRoot?: boolean;\n /** Opts into `overscroll-behavior: none` integration hooks; emits `data-app-overscroll-behavior=\"none\"`. */\n appOverscrollBehavior?: SetAppOverscrollBehavior;\n /** Brand variant applied to the root wrapper. @default \"mnsp\" */\n brand?: SetBrand;\n /** Inner HTML content. Caller sanitizes untrusted content. */\n children: string;\n /** Optional explicit text direction. */\n dir?: SetDirection;\n /** DOM id. */\n id?: string;\n /** Optional BCP47 language tag (e.g. `en-GB`). */\n lang?: string;\n /** Optional explicit theme variant. */\n theme?: SetTheme;\n}\n\n/**\n * Builds the IR tree for the Set root component.\n *\n * @param props - Root component props.\n * @returns IR node for the Set root component.\n */\nexport function buildSetRoot({\n appOverscrollBehavior,\n appRoot,\n brand = \"mnsp\",\n children,\n dir,\n id,\n lang,\n theme,\n}: SetRootProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set\",\n \"data-app-root\": appRoot,\n \"data-app-overscroll-behavior\":\n appOverscrollBehavior === \"none\" ? \"none\" : undefined,\n \"data-set-brand\": brand,\n \"data-set-theme\": theme,\n id: normalizedId,\n lang: lang === \"\" ? undefined : lang,\n dir,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set root component.\n *\n * Emits a `<div>` with the Set root class, required `data-set-brand`,\n * optional `data-set-theme`, and optional `dir`/`lang` attributes, then injects\n * the provided HTML content inside.\n *\n * @param props - Root component props.\n * @returns HTML string for the Set root component.\n */\nexport function renderSetRoot(props: SetRootProps): string {\n return serializeSetNode(buildSetRoot(props));\n}\n\n/** Declarative root contract mirror for tooling, docs, and adapters. */\nexport const SET_ROOT_SPEC: SetComponentSpec = {\n name: \"root\",\n description: \"Mandatory top-level `root` wrapper for the Set system.\",\n output: { element: \"div\", class: \"set\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n appOverscrollBehavior: {\n description: \"Disables overscroll bounce for app-shell integrations.\",\n type: { kind: \"enum\", values: [\"none\"] },\n },\n appRoot: {\n default: false,\n description: \"Marks this wrapper as the app root.\",\n type: { kind: \"boolean\" },\n },\n brand: {\n default: \"mnsp\",\n description: \"Brand identity applied to the wrapper.\",\n type: { kind: \"enum\", values: [\"mnsp\", \"wrfr\"] },\n },\n children: {\n description: \"Content rendered inside the root.\",\n required: true,\n type: { kind: \"html\" },\n },\n dir: {\n description: \"Text direction.\",\n type: { kind: \"enum\", values: [\"ltr\", \"rtl\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n lang: {\n description: \"BCP47 language tag (e.g. `en-GB`).\",\n type: { kind: \"string\" },\n },\n theme: {\n description: \"Colour theme.\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-app-overscroll-behavior\",\n condition: {\n kind: \"when-equals\",\n prop: \"appOverscrollBehavior\",\n to: \"none\",\n },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-app-root\",\n condition: { kind: \"when-truthy\", prop: \"appRoot\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-brand\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"brand\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-theme\",\n condition: { kind: \"when-provided\", prop: \"theme\" },\n value: { kind: \"prop\", prop: \"theme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"dir\",\n condition: { kind: \"when-provided\", prop: \"dir\" },\n value: { kind: \"prop\", prop: \"dir\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"lang\",\n condition: { kind: \"when-non-empty\", prop: \"lang\" },\n value: { kind: \"prop\", prop: \"lang\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetSpinnerSize =\n | \"2xs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"fill\";\nexport type SetSpinnerTone = \"default\" | \"brand\";\n\nexport interface SetSpinnerProps {\n /** DOM id. */\n id?: string;\n /** Accessible status label. */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetSpinnerSize;\n /** Tone variant. @default \"default\" */\n tone?: SetSpinnerTone;\n}\n\n/**\n * Builds the IR tree for the Set spinner component.\n *\n * @param props - Spinner component props.\n * @returns IR node for a spinner element.\n */\nexport function buildSetSpinner({\n id,\n label,\n size = \"md\",\n tone = \"default\",\n}: SetSpinnerProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const cells: Array<readonly [number, number]> = [\n [60, 60],\n [60, 360],\n [60, 660],\n [60, 960],\n [360, 960],\n [360, 660],\n [360, 360],\n [360, 60],\n ];\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": \"true\",\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 600 1200\",\n fill: \"currentColor\",\n },\n children: cells.map(([x, y]) => ({\n kind: \"element\",\n tag: \"rect\",\n attrs: {\n class: \"cell\",\n x: String(x),\n y: String(y),\n width: \"180\",\n height: \"180\",\n },\n children: [],\n })),\n },\n ];\n\n if (label) {\n children.push({\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: label }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: {\n class: \"set-spinner\",\n \"data-size\": size,\n \"data-tone\": tone === \"brand\" ? \"brand\" : undefined,\n id: normalizedId,\n role: label ? \"status\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set spinner component.\n *\n * @param props - Spinner component props.\n * @returns HTML string for a spinner element.\n */\nexport function renderSetSpinner(props: SetSpinnerProps = {}): string {\n return serializeSetNode(buildSetSpinner(props));\n}\n\n/** Declarative spinner contract mirror for tooling, docs, and adapters. */\nexport const SET_SPINNER_SPEC: SetComponentSpec = {\n name: \"spinner\",\n description: \"Use `spinner` to indicate loading or in-progress state.\",\n output: { element: \"span\", class: \"set-spinner\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible status label announced to assistive tech.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"fill\"],\n },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"brand\" },\n value: { kind: \"literal\", text: \"brand\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: { kind: \"when-non-empty\", prop: \"label\" },\n value: { kind: \"literal\", text: \"status\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetStackAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type SetStackAs = \"div\" | \"ul\";\nexport type SetStackGap = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface SetStackProps {\n /** Cross-axis alignment. @default \"stretch\" */\n align?: SetStackAlign;\n /** Element tag. @default \"div\" */\n as?: SetStackAs;\n /** Trusted inner HTML. */\n children?: string;\n /** Spacing gap size. @default \"md\" */\n gap?: SetStackGap;\n /** DOM id. */\n id?: string;\n /** Enables layout-context responsive spacing scale. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set stack component.\n *\n * @param props - Stack component props.\n * @returns IR node for a stack wrapper.\n */\nexport function buildSetStack({\n align = \"stretch\",\n as = \"div\",\n children,\n gap = \"md\",\n id,\n responsive,\n}: SetStackProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: as,\n attrs: {\n class: \"set-stack\",\n \"data-align\": align === \"stretch\" ? undefined : align,\n \"data-gap\": gap,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set stack component.\n *\n * @param props - Stack component props.\n * @returns HTML string for a stack wrapper.\n */\nexport function renderSetStack(props: SetStackProps): string {\n return serializeSetNode(buildSetStack(props));\n}\n\n/** Declarative stack contract mirror for tooling, docs, and adapters. */\nexport const SET_STACK_SPEC: SetComponentSpec = {\n name: \"stack\",\n description: \"Use `stack` to lay out content in a vertical column.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { div: \"div\", ul: \"ul\" } },\n class: \"set-stack\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n align: {\n default: \"stretch\",\n description: \"Aligns items on the cross axis.\",\n type: { kind: \"enum\", values: [\"stretch\", \"start\", \"center\", \"end\"] },\n },\n as: {\n default: \"div\",\n description: \"Element tag to render. `ul` children must be `<li>`.\",\n type: { kind: \"enum\", values: [\"div\", \"ul\"] },\n },\n children: {\n description: \"Items laid out in a column.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"md\",\n description: \"Space between children.\",\n type: { kind: \"enum\", values: [\"none\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n responsive: {\n default: false,\n description: \"Scales spacing across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"start\", \"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetTheme } from \"../root/root\";\n\nexport type SetSurfaceVariant =\n | \"default\"\n | \"brand\"\n | \"inverse\"\n | \"brand-inverse\";\n\nexport interface SetSurfaceProps {\n /** Trusted inner HTML. */\n children: string;\n /** Absolute theme lock for content rendered inside the surface. */\n contentTheme?: SetTheme;\n /** DOM id. */\n id?: string;\n /** Surface variant. @default \"default\" */\n variant?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set surface component.\n *\n * @param props - Surface component props.\n * @returns IR node for a surface wrapper.\n */\nexport function buildSetSurface({\n children,\n contentTheme,\n id,\n variant = \"default\",\n}: SetSurfaceProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-surface\",\n \"data-set-content-theme\": contentTheme,\n \"data-set-surface\": variant,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set surface component.\n *\n * @param props - Surface component props.\n * @returns HTML string for a surface wrapper.\n */\nexport function renderSetSurface(props: SetSurfaceProps): string {\n return serializeSetNode(buildSetSurface(props));\n}\n\n/** Declarative surface contract mirror for tooling, docs, and adapters. */\nexport const SET_SURFACE_SPEC: SetComponentSpec = {\n name: \"surface\",\n description: \"Use `surface` to set a colour context for nested content.\",\n output: { element: \"div\", class: \"set-surface\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the surface.\",\n required: true,\n type: { kind: \"html\" },\n },\n contentTheme: {\n description:\n \"Absolute theme lock for content rendered inside the surface.\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n variant: {\n default: \"default\",\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"when-provided\", prop: \"contentTheme\" },\n value: { kind: \"prop\", prop: \"contentTheme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\n\nexport interface SetSwitchProps {\n /** Checked state. @default false */\n checked?: boolean;\n /** Helper text rendered after the label. Requires `id`. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** DOM id applied to the underlying input. Required when `description` is provided. */\n id?: string;\n /** Label text content (escaped before render). */\n label: string;\n /** Form field name. */\n name?: string;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set switch component.\n *\n * @param props - Switch component props.\n * @returns IR node for a switch field wrapper.\n */\nexport function buildSetSwitch({\n checked,\n description,\n disabled,\n id,\n label,\n name,\n size = \"md\",\n value,\n}: SetSwitchProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDescription = description?.trim();\n\n if (normalizedDescription && !normalizedId) {\n throw new Error(\"id must be provided when description is provided.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n checked: Boolean(checked),\n class: \"switch\",\n disabled: Boolean(disabled),\n id: normalizedId,\n name: name || undefined,\n role: \"switch\",\n type: \"checkbox\",\n value: value || undefined,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: label }],\n },\n ],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"set-switch\", \"data-size\": size },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set switch component.\n *\n * @param props - Switch component props.\n * @returns HTML string for a switch field wrapper.\n */\nexport function renderSetSwitch(props: SetSwitchProps): string {\n return serializeSetNode(buildSetSwitch(props));\n}\n\n/** Declarative switch contract mirror for tooling, docs, and adapters. */\nexport const SET_SWITCH_SPEC: SetComponentSpec = {\n name: \"switch\",\n description:\n \"Use `switch` to let users instantly toggle a setting on or off.\",\n output: { element: \"div\", class: \"set-switch\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n checked: {\n default: false,\n description: \"Whether the switch is on.\",\n type: { kind: \"boolean\" },\n },\n description: {\n description: \"Helper text shown below the label.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the switch.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`description` is provided\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Submitted value when checked.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"switch\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"role\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"switch\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"checked\",\n condition: { kind: \"when-truthy\", prop: \"checked\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport type SetTextareaResize = \"vertical\" | \"none\";\n\nexport interface SetTextareaProps {\n /** Autocomplete hint; `false` emits `autocomplete=\"off\"`. */\n autocomplete?: string | false;\n /** Helper text rendered after the textarea (reused as validation guidance when `invalid`). */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Textarea id; used for `textarea[id]` and `label[for]`. */\n id: string;\n /** Invalid state. Ignored when `disabled` or `readOnly`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Field name attribute. */\n name?: string;\n /** Read-only state. Ignored when `disabled`. @default false */\n readOnly?: boolean;\n /** Required state. @default false */\n required?: boolean;\n /** Resize behavior. @default \"vertical\" */\n resize?: SetTextareaResize;\n /** Number of visible text rows. Must be an integer >= 2. @default 2 */\n rows?: number;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Spellcheck behavior. Omitted by default. */\n spellcheck?: boolean;\n /** Current value. */\n value?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set textarea component.\n *\n * @param props - Textarea component props.\n * @returns IR node for a labeled textarea field wrapper.\n */\nexport function buildSetTextarea({\n autocomplete,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n readOnly,\n required,\n resize = \"vertical\",\n rows = 2,\n size = \"md\",\n spellcheck,\n value,\n inlineSize = \"full\",\n}: SetTextareaProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedAutocomplete =\n autocomplete === false ? false : autocomplete?.trim();\n const normalizedName = name?.trim();\n const normalizedValue = value;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!Number.isInteger(rows) || rows < 2) {\n throw new Error(\"rows must be an integer greater than or equal to 2.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isReadOnly = !isDisabled && Boolean(readOnly);\n const isInvalid = !isDisabled && !isReadOnly && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"textarea\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n autocomplete:\n normalizedAutocomplete === false\n ? \"off\"\n : normalizedAutocomplete || undefined,\n class: \"textarea\",\n disabled: isDisabled,\n id: normalizedId,\n name: normalizedName || undefined,\n readonly: isReadOnly,\n required: Boolean(required),\n rows: String(rows),\n spellcheck: spellcheck === undefined ? undefined : String(spellcheck),\n },\n children: [{ kind: \"text\", value: normalizedValue || \"\" }],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-textarea\",\n \"data-resize\": resize === \"none\" ? \"none\" : undefined,\n \"data-size\": size,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set textarea component.\n *\n * @param props - Textarea component props.\n * @returns HTML string for a labeled textarea field wrapper.\n */\nexport function renderSetTextarea(props: SetTextareaProps): string {\n return serializeSetNode(buildSetTextarea(props));\n}\n\n/** Declarative textarea contract mirror for tooling, docs, and adapters. */\nexport const SET_TEXTAREA_SPEC: SetComponentSpec = {\n name: \"textarea\",\n description: \"Use `textarea` to collect multiple lines of text from users.\",\n output: { element: \"div\", class: \"set-textarea\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"value\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n autocomplete: {\n description: \"Browser autocomplete hint. Pass `false` to disable.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"string\" }, { kind: \"boolean\" }],\n },\n },\n description: {\n description:\n \"Helper text shown below the textarea; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the textarea.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` used to associate the textarea with its label.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the textarea as invalid.\",\n ignoredWhen: \"`disabled` is true or `readOnly` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n readOnly: {\n default: false,\n description: \"Prevents editing while keeping the value visible.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n required: {\n default: false,\n description: \"Requires a value before submission.\",\n type: { kind: \"boolean\" },\n },\n resize: {\n default: \"vertical\",\n description: \"How the user can resize the textarea.\",\n type: { kind: \"enum\", values: [\"vertical\", \"none\"] },\n },\n rows: {\n default: 2,\n description: \"Number of visible rows.\",\n type: { kind: \"number\", min: 2, max: 10, integer: true },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n spellcheck: {\n description: \"Whether the browser checks spelling.\",\n type: { kind: \"boolean\" },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"How the textarea fills its container.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-resize\",\n condition: { kind: \"when-equals\", prop: \"resize\", to: \"none\" },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"descendant\", selector: \"label\" },\n attribute: \"for\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"textarea\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"rows\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"rows\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"readonly\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"readOnly\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"readOnly\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"spellcheck\",\n condition: { kind: \"when-provided\", prop: \"spellcheck\" },\n value: { kind: \"prop\", prop: \"spellcheck\" },\n },\n ],\n },\n};\n","import \"./styles.css\";\n\nimport { defineSetAlert } from \"./components/alert/alert\";\nimport { defineSetBanner } from \"./components/banner/banner\";\nimport { defineSetLightswitch } from \"./components/lightswitch/lightswitch\";\nimport { defineSetMenu } from \"./components/menu/menu\";\nimport { defineSetNav } from \"./components/nav/nav\";\nimport { defineSetRange } from \"./components/range/range\";\nimport { defineSetSidebar } from \"./components/sidebar/sidebar\";\nimport { defineSetVideo } from \"./components/video/video\";\n\n/**\n * Defines all available Set runtime custom elements.\n *\n * Safe to call multiple times. Each component-level define function is\n * responsible for guarding its own registration.\n */\nexport function defineSetComponents(): void {\n defineSetAlert();\n defineSetBanner();\n defineSetLightswitch();\n defineSetMenu();\n defineSetNav();\n defineSetRange();\n defineSetSidebar();\n defineSetVideo();\n}\n\nexport {\n buildSetAlert,\n defineSetAlert,\n renderSetAlert,\n SET_ALERT_EVENT_BEFORE_DISMISS,\n SET_ALERT_EVENT_DISMISS,\n SET_ALERT_SPEC,\n SET_ALERT_TAG_NAME,\n type SetAlertProps,\n type SetAlertSize,\n type SetAlertTone,\n} from \"./components/alert/alert\";\nexport {\n buildSetAvatar,\n getSetInitials,\n renderSetAvatar,\n SET_AVATAR_SPEC,\n type SetAvatarColor,\n type SetAvatarEntity,\n type SetAvatarProps,\n type SetAvatarSize,\n} from \"./components/avatar/avatar\";\nexport {\n buildSetBadge,\n renderSetBadge,\n SET_BADGE_SPEC,\n type SetBadgeProps,\n type SetBadgeSize,\n type SetBadgeTone,\n} from \"./components/badge/badge\";\nexport {\n buildSetBanner,\n defineSetBanner,\n renderSetBanner,\n SET_BANNER_EVENT_BEFORE_DISMISS,\n SET_BANNER_EVENT_DISMISS,\n SET_BANNER_SPEC,\n SET_BANNER_TAG_NAME,\n type SetBannerProps,\n type SetBannerTone,\n} from \"./components/banner/banner\";\nexport {\n buildSetBlockquote,\n renderSetBlockquote,\n SET_BLOCKQUOTE_SPEC,\n type SetBlockquoteProps,\n type SetBlockquoteSize,\n} from \"./components/blockquote/blockquote\";\nexport {\n buildSetBox,\n renderSetBox,\n SET_BOX_SPEC,\n type SetBoxBackground,\n type SetBoxPadding,\n type SetBoxProps,\n type SetBoxRadius,\n} from \"./components/box/box\";\nexport {\n buildSetButton,\n renderSetButton,\n SET_BUTTON_SPEC,\n type SetButtonAppearance,\n type SetButtonHasPopup,\n type SetButtonLabelVisibility,\n type SetButtonPlacement,\n type SetButtonProps,\n type SetButtonSize,\n type SetButtonTone,\n type SetButtonType,\n} from \"./components/button/button\";\nexport {\n buildSetCard,\n renderSetCard,\n SET_CARD_SPEC,\n type SetCardProps,\n} from \"./components/card/card\";\nexport {\n buildSetCheckbox,\n renderSetCheckbox,\n SET_CHECKBOX_SPEC,\n type SetCheckboxProps,\n} from \"./components/checkbox/checkbox\";\nexport {\n buildSetContainer,\n renderSetContainer,\n SET_CONTAINER_SPEC,\n type SetContainerGutter,\n type SetContainerMaxInlineSize,\n type SetContainerProps,\n} from \"./components/container/container\";\nexport {\n buildSetDetails,\n renderSetDetails,\n SET_DETAILS_SPEC,\n type SetDetailsProps,\n} from \"./components/details/details\";\nexport {\n buildSetDivider,\n renderSetDivider,\n SET_DIVIDER_SPEC,\n type SetDividerOrientation,\n type SetDividerProps,\n type SetDividerTone,\n} from \"./components/divider/divider\";\nexport {\n buildSetExpander,\n renderSetExpander,\n SET_EXPANDER_SPEC,\n type SetExpanderProps,\n type SetExpanderSize,\n} from \"./components/expander/expander\";\nexport {\n buildSetFieldset,\n renderSetFieldset,\n SET_FIELDSET_SPEC,\n type SetFieldsetProps,\n} from \"./components/fieldset/fieldset\";\nexport {\n buildSetFigure,\n renderSetFigure,\n SET_FIGURE_SPEC,\n type SetFigureProps,\n} from \"./components/figure/figure\";\nexport {\n buildSetGrid,\n buildSetGridItem,\n renderSetGrid,\n renderSetGridItem,\n SET_GRID_ITEM_SPEC,\n SET_GRID_SPEC,\n type SetGridGap,\n type SetGridItemProps,\n type SetGridProps,\n type SetGridTrack,\n} from \"./components/grid/grid\";\nexport {\n buildSetHeading,\n renderSetHeading,\n SET_HEADING_SPEC,\n type SetHeadingProps,\n type SetHeadingSize,\n} from \"./components/heading/heading\";\nexport {\n buildSetIcon,\n renderSetIcon,\n SET_ICON_NAMES,\n SET_ICON_SPEC,\n type SetIconMirrorMode,\n type SetIconProps,\n type SetIconSize,\n} from \"./components/icon/icon\";\nexport {\n buildSetImage,\n renderSetImage,\n SET_IMAGE_SPEC,\n type SetImageAspectRatio,\n type SetImageFit,\n type SetImageGravity,\n type SetImageProps,\n type SetImageScheme,\n type SetImageSource,\n} from \"./components/image/image\";\nexport {\n buildSetInline,\n renderSetInline,\n SET_INLINE_SPEC,\n type SetInlineGap,\n type SetInlineJustify,\n type SetInlineProps,\n} from \"./components/inline/inline\";\nexport {\n buildSetInput,\n renderSetInput,\n SET_INPUT_SPEC,\n type SetInputProps,\n type SetInputType,\n} from \"./components/input/input\";\nexport {\n buildSetLightswitch,\n defineSetLightswitch,\n renderSetLightswitch,\n SET_LIGHTSWITCH_EVENT_CHANGE,\n SET_LIGHTSWITCH_SPEC,\n SET_LIGHTSWITCH_STORAGE_KEY,\n SET_LIGHTSWITCH_TAG_NAME,\n type SetLightswitchAppearance,\n type SetLightswitchProps,\n type SetLightswitchSize,\n} from \"./components/lightswitch/lightswitch\";\nexport {\n buildSetLink,\n renderSetLink,\n SET_LINK_SPEC,\n type SetLinkAppearance,\n type SetLinkCurrent,\n type SetLinkLabelVisibility,\n type SetLinkPlacement,\n type SetLinkProps,\n type SetLinkSize,\n type SetLinkTarget,\n type SetLinkTone,\n} from \"./components/link/link\";\nexport {\n buildSetLogo,\n renderSetLogo,\n SET_LOGO_SPEC,\n type SetLogoProps,\n type SetLogoSize,\n type SetLogoTone,\n type SetLogoVariant,\n} from \"./components/logo/logo\";\nexport {\n buildSetMenu,\n defineSetMenu,\n renderSetMenu,\n SET_MENU_EVENT_CHOOSE,\n SET_MENU_SPEC,\n SET_MENU_TAG_NAME,\n type SetMenuItem,\n type SetMenuProps,\n} from \"./components/menu/menu\";\nexport {\n buildSetNav,\n defineSetNav,\n renderSetNav,\n SET_NAV_SPEC,\n SET_NAV_TAG_NAME,\n type SetNavItem,\n type SetNavProps,\n} from \"./components/nav/nav\";\nexport {\n buildSetPage,\n renderSetPage,\n SET_PAGE_SPEC,\n type SetPageHeaderBorder,\n type SetPageHeaderSize,\n type SetPageProps,\n type SetPageStickyHeader,\n} from \"./components/page/page\";\nexport {\n buildSetPanel,\n renderSetPanel,\n SET_PANEL_SPEC,\n type SetPanelPadding,\n type SetPanelProps,\n} from \"./components/panel/panel\";\nexport {\n buildSetPattern,\n renderSetPattern,\n SET_PATTERN_SPEC,\n type SetPatternProps,\n type SetPatternSize,\n type SetPatternTone,\n type SetPatternVariant,\n} from \"./components/pattern/pattern\";\nexport {\n buildSetPoster,\n renderSetPoster,\n renderSetPosterImage,\n SET_POSTER_SPEC,\n type SetPosterAdaptiveMedia,\n type SetPosterImageProps,\n type SetPosterMedia,\n type SetPosterProps,\n type SetPosterSurface,\n} from \"./components/poster/poster\";\nexport {\n buildSetProse,\n renderSetProse,\n SET_PROSE_SPEC,\n type SetProseHangingPunctuation,\n type SetProseProps,\n} from \"./components/prose/prose\";\nexport {\n buildSetRadios,\n renderSetRadios,\n SET_RADIOS_SPEC,\n type SetRadioItem,\n type SetRadiosOrientation,\n type SetRadiosProps,\n} from \"./components/radios/radios\";\nexport {\n buildSetRange,\n defineSetRange,\n renderSetRange,\n SET_RANGE_SPEC,\n SET_RANGE_TAG_NAME,\n type SetRangeProps,\n} from \"./components/range/range\";\nexport {\n buildSetRoot,\n renderSetRoot,\n SET_ROOT_SPEC,\n type SetAppOverscrollBehavior,\n type SetBrand,\n type SetDirection,\n type SetRootProps,\n type SetTheme,\n} from \"./components/root/root\";\nexport {\n buildSetSidebar,\n defineSetSidebar,\n renderSetSidebar,\n SET_SIDEBAR_SPEC,\n SET_SIDEBAR_TAG_NAME,\n type SetSidebarAboveNotebook,\n type SetSidebarProps,\n} from \"./components/sidebar/sidebar\";\nexport {\n buildSetSpinner,\n renderSetSpinner,\n SET_SPINNER_SPEC,\n type SetSpinnerProps,\n type SetSpinnerSize,\n type SetSpinnerTone,\n} from \"./components/spinner/spinner\";\nexport {\n buildSetStack,\n renderSetStack,\n SET_STACK_SPEC,\n type SetStackAlign,\n type SetStackGap,\n type SetStackProps,\n} from \"./components/stack/stack\";\nexport {\n buildSetSurface,\n renderSetSurface,\n SET_SURFACE_SPEC,\n type SetSurfaceProps,\n type SetSurfaceVariant,\n} from \"./components/surface/surface\";\nexport {\n buildSetSwitch,\n renderSetSwitch,\n SET_SWITCH_SPEC,\n type SetSwitchProps,\n} from \"./components/switch/switch\";\nexport {\n buildSetText,\n renderSetText,\n SET_TEXT_SPEC,\n type SetTextAs,\n type SetTextProps,\n type SetTextSize,\n type SetTextTone,\n} from \"./components/text/text\";\nexport {\n buildSetTextarea,\n renderSetTextarea,\n SET_TEXTAREA_SPEC,\n type SetTextareaProps,\n type SetTextareaResize,\n} from \"./components/textarea/textarea\";\nexport {\n buildSetVideo,\n defineSetVideo,\n renderSetVideo,\n SET_VIDEO_SPEC,\n SET_VIDEO_TAG_NAME,\n type SetVideoFit,\n type SetVideoPreload,\n type SetVideoProps,\n} from \"./components/video/video\";\nexport { serializeSetNode, type SetNode } from \"./helpers/node\";\nexport type {\n SetComponentSpec,\n SetComponentSpecEvent,\n SetComponentSpecProp,\n SetSpecAttributeRule,\n SetSpecCondition,\n SetSpecContent,\n SetSpecElement,\n SetSpecOutput,\n SetSpecPropType,\n SetSpecTarget,\n SetSpecValue,\n} from \"./spec\";\nexport type {\n SetAlign,\n SetControlSize,\n SetHeadingLevel,\n SetInlineSize,\n} from \"./types\";\n"],"names":["VOID_ELEMENTS","escapeHtml","value","serializeAttrs","record","key","serializeSetNode","node","attrString","open","inner","isValidHtmlId","normalizeOptionalHtmlId","id","trimmed","collapseWhitespace","ICON_NODES","SET_ICON_NAMES","iconNodesToSetNodes","nodes","buildSetIcon","ariaHidden","mirrored","name","size","title","iconNodes","normalizedId","normalizedTitle","titleId","children","renderSetIcon","props","SET_ICON_SPEC","buildSetButton","appearance","controls","disabled","disclosure","form","haspopup","icon","iconMirrored","iconPlacement","label","labelVisibility","tone","type","normalizedIconName","hasIcon","iconNode","labelNode","renderSetButton","SET_BUTTON_SPEC","SET_ALERT_TAG_NAME","SET_ALERT_EVENT_BEFORE_DISMISS","SET_ALERT_EVENT_DISMISS","dismissibleLabelDefault","createDismissButtonElement","dismissibleLabel","document","wrapper","getAlertIconName","getAlertRole","buildSetAlert","dismissible","inlineSize","message","normalizedDismissibleLabel","contentChildren","renderSetAlert","defineSetAlert","SetAlertElement","#onClick","event","target","beforeDismissEvent","#ensureDismissControl","SET_ALERT_SPEC","normalizeDownload","buildSetLink","current","download","href","rel","underline","normalizedIcon","normalizedDownload","renderSetLink","SET_LINK_SPEC","SET_BANNER_TAG_NAME","SET_BANNER_EVENT_BEFORE_DISMISS","SET_BANNER_EVENT_DISMISS","buildSetBanner","actionHref","actionLabel","messageChildren","renderSetBanner","defineSetBanner","SetBannerElement","SET_BANNER_SPEC","SET_LIGHTSWITCH_TAG_NAME","SET_LIGHTSWITCH_EVENT_CHANGE","SET_LIGHTSWITCH_STORAGE_KEY","labelDarkDefault","labelLightDefault","oppositeTheme","theme","themeIconName","buildOption","buildSetLightswitch","labelDark","labelLight","normalizedLabelDark","normalizedLabelLight","renderSetLightswitch","defineSetLightswitch","SetLightswitchElement","next","#resolvedTheme","#systemTheme","#clearStoredTheme","#storeTheme","#applyTheme","#storedTheme","#storage","windowRef","#root","#rootTheme","root","stored","SET_LIGHTSWITCH_SPEC","SET_MENU_TAG_NAME","SET_MENU_EVENT_CHOOSE","buildSetMenu","align","items","triggerIcon","triggerIconMirrored","triggerIconPlacement","triggerLabel","triggerLabelVisibility","triggerId","menuId","itemNodes","item","renderSetMenu","defineSetMenu","SetMenuElement","#onDocumentClick","#onFocusOut","#onKeyDown","#teardownListeners","#close","#setupListeners","#getTriggerButton","#getMenu","#getMenuItems","#isMenuItemDisabled","#isOpen","#setFocusedItem","index","normalizedIndex","#open","focusIndex","menu","trigger","restoreTriggerFocus","#choose","menuItem","activeElement","currentIndex","nextTarget","SET_MENU_SPEC","expanderLabelDefault","buildSetExpander","controlsId","expanded","normalizedLabel","renderSetExpander","SET_EXPANDER_SPEC","SET_NAV_TAG_NAME","scrollLockAttr","buildSetNav","collapsible","contentId","expanderLabel","expanderPosition","normalizedExpanderLabel","normalizedContentId","listItems","renderSetNav","defineSetNav","SetNavElement","#mediaQueryList","#onMediaQueryChange","#teardownClickListener","#teardownRuntimeListeners","#ensureExpander","#setupClickListener","#setupRuntimeListeners","#setExpanded","#getNav","#getExpanderButton","nav","content","button","#setScrollLocked","mediaQueryList","locked","SET_NAV_SPEC","SET_RANGE_TAG_NAME","buildSetRange","description","max","min","step","normalizedDescription","normalizedName","descriptionId","renderSetRange","defineSetRange","SetRangeElement","#inputWithValueSync","#onInput","#syncOutput","#installValueSync","#removeValueSync","input","output","#setOutputText","child","descriptor","getValue","setValue","syncOutput","SET_RANGE_SPEC","SET_SIDEBAR_TAG_NAME","aboveNotebookMedia","collapseLabelDefault","triggerLabelDefault","createCloseButtonMarkup","buttonSize","buildSetSidebar","aboveNotebook","collapseLabel","footer","header","surface","normalizedCollapseLabel","normalizedTriggerLabel","sidebarChildren","panelId","renderSetSidebar","defineSetSidebar","SetSidebarElement","#mediaQuery","#onMediaChange","#ensureCloseControl","#syncResponsiveState","#setOpen","#getSidebar","#getCloseButton","#isCollapsed","#getAboveNotebook","sidebar","#removeCloseControl","#focusSidebar","closeButton","#isAboveNotebook","#setState","collapsed","SET_SIDEBAR_SPEC","SET_VIDEO_TAG_NAME","buildSetVideo","autoPlay","fit","height","loop","muted","playsInline","poster","preload","src","width","normalizedSrc","normalizedPoster","videoNode","renderSetVideo","reducedMotionMedia","defineSetVideo","SetVideoElement","#autoPlayIntent","video","#syncPlayback","SET_VIDEO_SPEC","isLatinChar","char","isLowercaseToken","token","leadingInitialFromToken","leadingChar","getSetInitials","words","firstTokenInitial","initials","lowercaseSurnameToken","particleInitial","secondInitial","hyphenParts","secondPartInitial","thirdInitial","lastTokenInitial","ENTITY_ICON_MAP","COLOR_HASH","hashString","hash","normalizeInitials","normalized","resolveAccessibleLabel","alt","resolveAvatarColor","color","buildSetAvatar","entity","normalizedInitials","accessibleLabel","derivedInitials","renderAsImage","resolvedColor","avatarAttrs","renderSetAvatar","SET_AVATAR_SPEC","buildSetBadge","floating","renderSetBadge","SET_BADGE_SPEC","buildSetText","as","linkVisited","measured","monospaced","responsive","tag","isParagraph","resolvedAlign","renderSetText","SET_TEXT_SPEC","buildSetBlockquote","attribution","quote","renderSetBlockquote","SET_BLOCKQUOTE_SPEC","buildSetBox","background","border","paddingBlock","paddingInline","radius","renderSetBox","SET_BOX_SPEC","buildSetCard","headingLevel","note","headingTag","titleChildren","noteChildren","renderSetCard","SET_CARD_SPEC","buildSetCheckbox","checked","invalid","required","isDisabled","renderSetCheckbox","SET_CHECKBOX_SPEC","buildSetContainer","gutter","maxInlineSize","renderSetContainer","SET_CONTAINER_SPEC","buildSetDetails","summary","renderSetDetails","SET_DETAILS_SPEC","buildSetDivider","orientation","renderSetDivider","SET_DIVIDER_SPEC","buildSetFieldset","legend","derivedDescriptionId","isInvalid","fieldsetChildren","renderSetFieldset","SET_FIELDSET_SPEC","buildSetFigure","caption","renderSetFigure","SET_FIGURE_SPEC","validateGridTrack","buildSetGrid","gap","renderSetGrid","buildSetGridItem","colSpan","colSpanNarrow","colSpanWide","colStart","colStartNarrow","colStartWide","justify","rowSpan","rowSpanNarrow","rowSpanWide","rowStart","rowStartNarrow","rowStartWide","renderSetGridItem","SET_GRID_SPEC","gridTrackType","SET_GRID_ITEM_SPEC","buildSetHeading","level","opticalAlign","text","renderSetHeading","SET_HEADING_SPEC","buildSetImage","adaptive","aspectRatio","gravity","lazy","priority","shadow","sizes","sources","srcSet","cover","normalizedSrcSet","normalizedSizes","normalizedSources","source","normalizedMedia","normalizedType","normalizedSourceSizes","url","withScheme","scheme","candidate","buildMediaNode","imgNode","sourceNodes","mediaNodes","styleChunks","renderSetImage","SET_IMAGE_SPEC","buildSetInline","nowrap","renderSetInline","SET_INLINE_SPEC","buildSetInput","autocomplete","pattern","readOnly","spellcheck","normalizedAutocomplete","normalizedPattern","normalizedValue","isNumeric","resolvedType","resolvedPattern","resolvedSpellcheck","isReadOnly","renderSetInput","SET_INPUT_SPEC","PRIMARY_VIEWBOX","GRAPHIC_VIEWBOX","MARK_CELLS","WORD_PATH","WORD_OFFSET","markGroup","x","y","wordGroup","animatedSvg","viewBox","buildSetLogoAnimatedPrimary","buildSetLogoAnimatedGraphic","buildSetLogo","animated","variant","isAnimated","renderSetLogo","SET_LOGO_SPEC","buildSetPage","banner","centerMain","headerBorder","headerSize","stickyHeader","regionChildren","renderSetPage","SET_PAGE_SPEC","buildSetPanel","padding","renderSetPanel","SET_PANEL_SPEC","buildSetPattern","renderSetPattern","SET_PATTERN_SPEC","renderSetPosterImage","buildSetPoster","contentTheme","media","resolvedSurface","posterChildren","renderSetPoster","SET_POSTER_SPEC","buildSetProse","hangingPunctuation","renderSetProse","SET_PROSE_SPEC","buildSetRadios","radios","normalizedRadios","itemValue","itemLabel","itemDescription","isGroupDisabled","optionNodes","isItemDisabled","itemDescriptionId","fieldChildren","renderSetRadios","SET_RADIOS_SPEC","buildSetRoot","appOverscrollBehavior","appRoot","brand","dir","lang","renderSetRoot","SET_ROOT_SPEC","buildSetSpinner","renderSetSpinner","SET_SPINNER_SPEC","buildSetStack","renderSetStack","SET_STACK_SPEC","buildSetSurface","renderSetSurface","SET_SURFACE_SPEC","buildSetSwitch","renderSetSwitch","SET_SWITCH_SPEC","buildSetTextarea","resize","rows","renderSetTextarea","SET_TEXTAREA_SPEC","defineSetComponents"],"mappings":"gFAiBA,MAAMA,OAAoB,IAAI,CAC5B,OACA,OACA,KACA,MACA,QACA,KACA,MACA,QACA,OACA,OACA,SACA,QACA,KACF,CAAC,EAED,SAASC,GAAWC,EAAuB,CACzC,OAAOA,EACJ,WAAW,IAAK,OAAO,EACvB,WAAW,IAAK,MAAM,EACtB,WAAW,IAAK,MAAM,EACtB,WAAW,IAAK,QAAQ,EACxB,WAAW,IAAK,OAAO,CAC5B,CAEA,SAASC,GACPC,EACQ,CACR,OAAO,OAAO,QAAQA,CAAM,EACzB,QAAQ,CAAC,CAACC,EAAKH,CAAK,IACfA,IAAU,IAASA,GAAS,KAAa,CAAA,EACzCA,IAAU,GAAa,CAACG,CAAG,EACxB,CAAC,GAAGA,CAAG,KAAKJ,GAAW,OAAOC,CAAK,CAAC,CAAC,GAAG,CAChD,EACA,KAAK,GAAG,CACb,CAGO,SAASI,EAAiBC,EAAuB,CACtD,GAAIA,EAAK,OAAS,OAAQ,OAAON,GAAWM,EAAK,KAAK,EACtD,GAAIA,EAAK,OAAS,MAAO,OAAOA,EAAK,KACrC,MAAMC,EAAaL,GAAeI,EAAK,KAAK,EACtCE,EAAOD,EAAa,IAAID,EAAK,GAAG,IAAIC,CAAU,IAAM,IAAID,EAAK,GAAG,IACtE,GAAIP,GAAc,IAAIO,EAAK,GAAG,EAAG,OAAOE,EACxC,MAAMC,EAAQH,EAAK,SAAS,IAAID,CAAgB,EAAE,KAAK,EAAE,EACzD,MAAO,GAAGG,CAAI,GAAGC,CAAK,KAAKH,EAAK,GAAG,GACrC,CC9DO,SAASI,EAAcT,EAAwB,CACpD,MAAO,oBAAoB,KAAKA,CAAK,CACvC,CAQO,SAASU,EACdC,EACoB,CACpB,GAAIA,IAAO,OAAW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IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,yBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,0BACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,gBAAiB,CACf,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,0BACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,SACL,MAAO,CACL,GAAI,KACJ,GAAI,KACJ,EAAG,KACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,4CACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,mBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,+GACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,sBACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,yBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,uCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,qBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oEACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,8CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,iBAAkB,CAChB,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,6CACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,+CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,WAAY,CACV,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mBAAA,CACL,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,gBAAA,CACL,CACF,CACF,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,6CAAA,CACL,EAEF,CACE,IAAK,SACL,MAAO,CACL,GAAI,QACJ,GAAI,OACJ,EAAG,GAAA,CACL,CACF,CACF,CACF,EAEF,cAAe,CACb,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,uEACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,4BACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,kCACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,+CAAA,CACL,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,kEAAA,CACL,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qTACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qMACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,6GACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,8MAAA,CACL,CACF,CACF,CACF,EAEF,aAAc,CACZ,CACE,IAAK,OACL,MAAO,CACL,EAAG,kBACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,UACH,iBAAkB,QAAA,CACpB,CACF,EAEF,QAAS,CACP,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,iLAAA,CACL,EAEF,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,OACL,MAAO,CACL,KAAM,eACN,EAAG,uDAAA,CACL,CACF,EAEF,UAAW,CACT,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,gBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,QAAS,CACP,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,2NACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,UAAW,CACT,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,ggBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,iCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,gNACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,YAAa,CACX,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qoBACH,YAAa,UACb,iBAAkB,SAClB,YAAa,SAAA,CACf,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,oHACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,cAAe,CACb,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,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AM,cAAe,KAAM,UAAA,CAAW,EAErD,CACE,OAAQ,CAAE,GAAI,aAAc,SAAU,UAAA,EACtC,UAAW,WACX,UAAW,CAAE,KAAM,cAAe,KAAM,UAAA,CAAW,EAErD,CACE,OAAQ,CAAE,GAAI,aAAc,SAAU,UAAA,EACtC,UAAW,WACX,UAAW,CACT,KAAM,MACN,GAAI,CACF,CAAE,KAAM,cAAe,KAAM,UAAA,EAC7B,CAAE,KAAM,MAAO,GAAI,CAAE,KAAM,cAAe,KAAM,UAAA,CAAW,CAAE,CAC/D,CACF,EAEF,CACE,OAAQ,CAAE,GAAI,aAAc,SAAU,UAAA,EACtC,UAAW,eACX,UAAW,CACT,KAAM,MACN,GAAI,CACF,CAAE,KAAM,cAAe,KAAM,SAAA,EAC7B,CAAE,KAAM,MAAO,GAAI,CAAE,KAAM,cAAe,KAAM,WAAW,EAC3D,CAAE,KAAM,MAAO,GAAI,CAAE,KAAM,cAAe,KAAM,UAAA,CAAW,CAAE,CAC/D,EAEF,MAAO,CAAE,KAAM,UAAW,KAAM,MAAA,CAAO,EAEzC,CACE,OAAQ,CAAE,GAAI,aAAc,SAAU,UAAA,EACtC,UAAW,mBACX,UAAW,CAAE,KAAM,iBAAkB,KAAM,aAAA,EAC3C,MAAO,CAAE,KAAM,WAAY,QAAS,kBAAA,CAAmB,EAEzD,CACE,OAAQ,CAAE,GAAI,aAAc,SAAU,UAAA,EACtC,UAAW,aACX,UAAW,CAAE,KAAM,gBAAiB,KAAM,YAAA,EAC1C,MAAO,CAAE,KAAM,OAAQ,KAAM,YAAA,CAAa,CAC5C,CACF,CAEJ,ECvUO,SAASC,IAA4B,CAC1C1e,GAAA,EACA2B,GAAA,EACAkB,GAAA,EACA+B,GAAA,EACA6C,GAAA,EACA6B,GAAA,EACAiC,GAAA,EACAoC,GAAA,CACF"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/helpers/node.ts","../src/helpers/string.ts","../src/components/icon/icons.generated.ts","../src/components/icon/icon.ts","../src/components/button/button.ts","../src/components/alert/alert.ts","../src/components/link/link.ts","../src/components/banner/banner.ts","../src/components/image/image.ts","../src/components/lightswitch/lightswitch.ts","../src/components/menu/menu.ts","../src/components/expander/expander.ts","../src/components/nav/nav.ts","../src/components/range/range.ts","../src/components/sidebar/sidebar.ts","../src/components/video/video.ts","../src/components/avatar/get-initials.ts","../src/components/avatar/avatar.ts","../src/components/badge/badge.ts","../src/components/text/text.ts","../src/components/blockquote/blockquote.ts","../src/components/box/box.ts","../src/components/card/card.ts","../src/components/checkbox/checkbox.ts","../src/components/container/container.ts","../src/components/details/details.ts","../src/components/divider/divider.ts","../src/components/fieldset/fieldset.ts","../src/components/figure/figure.ts","../src/components/grid/grid.ts","../src/components/heading/heading.ts","../src/components/inline/inline.ts","../src/components/input/input.ts","../src/components/logo/logos-animated.ts","../src/components/logo/logo.ts","../src/components/page/page.ts","../src/components/panel/panel.ts","../src/components/pattern/pattern.ts","../src/components/poster/poster.ts","../src/components/prose/prose.ts","../src/components/radios/radios.ts","../src/components/root/root.ts","../src/components/spinner/spinner.ts","../src/components/stack/stack.ts","../src/components/surface/surface.ts","../src/components/switch/switch.ts","../src/components/textarea/textarea.ts","../src/index.ts"],"sourcesContent":["/**\n * Intermediate representation for rendered markup.\n *\n * Core renderers produce a `SetNode` tree which can be either:\n * - serialized to an HTML string for SSR/Web Components, or\n * - walked by a framework adapter (e.g. React) to produce native elements.\n */\nexport type SetNode =\n | {\n kind: \"element\";\n tag: string;\n attrs: Record<string, string | boolean | undefined>;\n children: SetNode[];\n }\n | { kind: \"text\"; value: string }\n | { kind: \"raw\"; html: string };\n\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nfunction escapeHtml(value: string): string {\n return value\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"'\", \"&#39;\");\n}\n\nfunction serializeAttrs(\n record: Record<string, string | boolean | undefined>,\n): string {\n return Object.entries(record)\n .flatMap(([key, value]) => {\n if (value === false || value == null) return [];\n if (value === true) return [key];\n return [`${key}=\"${escapeHtml(String(value))}\"`];\n })\n .join(\" \");\n}\n\n/** Serializes a `SetNode` tree to an HTML string. */\nexport function serializeSetNode(node: SetNode): string {\n if (node.kind === \"text\") return escapeHtml(node.value);\n if (node.kind === \"raw\") return node.html;\n const attrString = serializeAttrs(node.attrs);\n const open = attrString ? `<${node.tag} ${attrString}>` : `<${node.tag}>`;\n if (VOID_ELEMENTS.has(node.tag)) return open;\n const inner = node.children.map(serializeSetNode).join(\"\");\n return `${open}${inner}</${node.tag}>`;\n}\n","/** Validates whether a string is a safe HTML id token. */\nexport function isValidHtmlId(value: string): boolean {\n return /^[A-Za-z][\\w:-]*$/.test(value);\n}\n\n/**\n * Normalises an optional consumer-provided id. Returns the trimmed id when\n * present and syntactically valid; returns `undefined` when the input is\n * absent, empty, or whitespace-only. Throws when a non-empty input fails\n * the HTML id syntax check.\n */\nexport function normalizeOptionalHtmlId(\n id: string | undefined,\n): string | undefined {\n if (id === undefined) return undefined;\n\n const trimmed = id.trim();\n\n if (!trimmed) return undefined;\n\n if (!isValidHtmlId(trimmed)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n return trimmed;\n}\n\n/** Trims and collapses internal whitespace; returns `undefined` for empty input. */\nexport function collapseWhitespace(\n value: string | undefined,\n): string | undefined {\n if (value == null) return undefined;\n\n const normalized = value.trim().replace(/\\s+/g, \" \");\n\n return normalized || undefined;\n}\n","// Generated by scripts/generate-icons.mjs — do not edit directly.\n// The shipped icons: the TDesign names in icons-tdesign.ts plus the first-party\n// icons in icons-custom.ts.\n// Regenerate with `pnpm icons:generate`.\n\nexport interface IconNode {\n tag: string;\n attrs: Record<string, string>;\n children?: IconNode[];\n}\n\nexport const ICON_NODES: Record<string, IconNode[]> = {\n adjustment: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21 5L10 5M10 5C10 6.10457 9.10457 7 8 7C6.89543 7 6 6.10457 6 5M10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5M6 5L3 5M21 19H10M10 19C10 20.1046 9.10457 21 8 21C6.89543 21 6 20.1046 6 19M10 19C10 17.8954 9.10457 17 8 17C6.89543 17 6 17.8954 6 19M3 12H14M14 12C14 13.1046 14.8954 14 16 14C17.1046 14 18 13.1046 18 12M14 12C14 10.8954 14.8954 10 16 10C17.1046 10 18 10.8954 18 12M6 19H3M18 12H21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-down\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 13.6L12 19.1L6.5 13.6M12 17.85V4.85\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-left\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M11 6.5L5.5 12L11 17.5M6.75 12H19.75\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-left-right-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M15.5 4L19 7.5L15.5 11M17.75 7.5H5.5M8.5 20L5 16.5L8.5 13M6.25 16.5H18.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-right\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M13 17.5L18.5 12L13 6.5M17.25 12L4.25 12\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-up\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 10.5L12 5L6.5 10.5M12 6.25V19.25\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"arrow-up-down-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M7.5 6.25V18.5M13 15.5L16.5 19L20 15.5M16.5 17.75V5.50001M11 8.5L7.5 5L4 8.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n check: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5708 7.37842L10.3785 16.5708L5.42871 11.6211\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"check-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M16.5 9L10.5 15L7.5 12\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"chevron-down\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17.5 9.5L12 15L6.5 9.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"chevron-right\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9.5 17.5L15 12L9.5 6.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n circle: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"circle\",\n attrs: {\n cx: \"12\",\n cy: \"12\",\n r: \"10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"city-6\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M12 21V16M7 21H2V9H7V21ZM22 7V21H17V7H22Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M17 3H7V21H17V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n close: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n copy: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M10 10H21V21H10V10Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M14 6.5V3L3 3L3 14H6.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n download: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16.5 10.5L12 15L7.5 10.5M12 13.75V4\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M20.5 15V20H3.5V15\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n enter: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M5.75 16H16C17.6569 16 19 14.6569 19 13L19 5M8 12.5L4.5 16L8 19.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"error-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 7.5V13M12 16.5H12.0039V16.5039H12V16.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"error-triangle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M12.0003 3L22.2194 20.7H1.78125L12.0003 3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 10.5V14M12 17.5H12.0039V17.5039H12V17.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n horizontal: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 11H21V21H3V11Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V7H3V3Z\",\n },\n },\n ],\n },\n ],\n },\n ],\n image: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 16V3H21V21H20M3 16V21H20M3 16L9 10L20 21\",\n },\n },\n {\n tag: \"circle\",\n attrs: {\n cx: \"15.75\",\n cy: \"8.25\",\n r: \"2\",\n },\n },\n ],\n },\n ],\n \"info-circle\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 16.5L12 11M12 7.5L11.9961 7.5L11.9961 7.49609L12 7.49609L12 7.5Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n jump: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9 4L4 4L4 20L20 20L20 15\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M19.25 4.75L12 12M14 4H20L20 10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n layers: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M4.5 6.125L12 3L19.5 6.125L12 9.25L4.5 6.125Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M3 11.5005L12 15.3771L21 11.5005M21 17.5005L12 21.3771L3 17.5005\",\n },\n },\n ],\n },\n ],\n link: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M11.6762 6.99023L13.9998 4.6666C15.4726 3.19382 17.8604 3.19382 19.3332 4.6666C20.806 6.13938 20.806 8.52723 19.3332 10L17.0096 12.3236M6.98974 11.6766L4.66611 14.0003C3.19333 15.4731 3.19333 17.8609 4.66611 19.3337C6.13889 20.8065 8.52675 20.8065 9.99953 19.3337L12.3232 17.0101M13.9985 9.99989L9.99847 14\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n member: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M16 20V19C16 16.7909 14.2091 15 12 15H5C2.79086 15 1 16.7909 1 19V20M12.5 7C12.5 9.20914 10.7091 11 8.5 11C6.29086 11 4.5 9.20914 4.5 7C4.5 4.79086 6.29086 3 8.5 3C10.7091 3 12.5 4.79086 12.5 7Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M15.5 11C17.7091 11 19.5 9.20914 19.5 7C19.5 4.79086 17.7091 3 15.5 3M23 20V19C23 16.7909 21.2091 15 19 15\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n moon: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M20.5387 14.8522C20.0408 14.9492 19.5263 15 19 15C14.5817 15 11 11.4183 11 7C11 5.54296 11.3194 4.17663 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C15.9737 21 19.3459 18.4248 20.5387 14.8522Z\",\n },\n },\n ],\n },\n ],\n \"panel-left\": [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V21H3V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M9 3V21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n pantone: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3.35389 10.3333L20.8245 10.3333L19.0009 5L3.35389 10.3333ZM3.35389 10.3333L17.1433 5.63318L14.1465 1.43164L2.99942 10.3359M3.35389 10.3333L2.99942 10.3359M2.99942 10.3359H2.5\",\n },\n },\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M6.28516 15.1641H6.28906V15.168H6.28516V15.1641Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M22 10.333V19.9997L2 19.9997L2 10.333L22 10.333Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n },\n ],\n play: [\n {\n tag: \"path\",\n attrs: {\n fill: \"currentColor\",\n d: \"M18.25 11.9998L8.5 17.6289L8.5 6.37061L18.25 11.9998Z\",\n },\n },\n ],\n rectangle: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 3H21V21H3z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n refresh: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21.448 13C20.9483 17.7767 16.909 21.5 12 21.5C8.18227 21.5 4.89052 19.248 3.38065 16M2.5 20.5V15.5H5.5M2.55176 11C3.05145 6.22334 7.09079 2.5 11.9998 2.5C15.8175 2.5 19.1092 4.75197 20.6191 8M21.4998 3.5V8.5H18.4998\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"robot-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5 21V19.5C19.5 17.2909 17.7091 15.5 15.5 15.5H8.5C6.29086 15.5 4.5 17.2909 4.5 19.5V21M12 4V2M10 12H14C16.2091 12 18 10.2091 18 8C18 5.79086 16.2091 4 14 4H10C7.79086 4 6 5.79086 6 8C6 10.2091 7.79086 12 10 12ZM10.25 8C10.25 8.13807 10.1381 8.25 10 8.25C9.86193 8.25 9.75 8.13807 9.75 8C9.75 7.86193 9.86193 7.75 10 7.75C10.1381 7.75 10.25 7.86193 10.25 8ZM14 8.25C13.8619 8.25 13.75 8.13807 13.75 8C13.75 7.86193 13.8619 7.75 14 7.75C14.1381 7.75 14.25 7.86193 14.25 8C14.25 8.13807 14.1381 8.25 14 8.25Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n search: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M15.8027 15.8037L21.106 21.107\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M15.8033 15.8033C12.8744 18.7322 8.12563 18.7322 5.1967 15.8033C2.26777 12.8744 2.26777 8.12563 5.1967 5.1967C8.12563 2.26777 12.8744 2.26777 15.8033 5.1967C18.7322 8.12563 18.7322 12.8744 15.8033 15.8033Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"setting-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M9.40811 4.95996L10.0001 2H14.0001L14.5921 4.95996C15.4027 5.25851 16.1475 5.69306 16.7989 6.23595L19.6604 5.26796L21.6604 8.73206L19.3922 10.7254C19.4632 11.1396 19.5001 11.5655 19.5001 12C19.5001 12.4345 19.4632 12.8604 19.3922 13.2747L21.6604 15.268L19.6604 18.7321L16.7989 17.7641C16.1475 18.3069 15.4027 18.7415 14.5921 19.04L14.0001 22H10.0001L9.40811 19.04C8.5975 18.7415 7.85268 18.3069 7.20131 17.7641L4.33984 18.7321L2.33984 15.268L4.60798 13.2747C4.53705 12.8604 4.5001 12.4345 4.5001 12C4.5001 11.5655 4.53705 11.1396 4.60797 10.7254L2.33984 8.73206L4.33984 5.26796L7.20129 6.23595C7.85266 5.69306 8.59749 5.25851 9.40811 4.95996Z\",\n \"fill-rule\": \"evenodd\",\n \"stroke-linecap\": \"square\",\n \"clip-rule\": \"evenodd\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"sticky-note\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M20 14H14V20M3 3H21V14L14 21H3V3Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M7 9H17M7 13H10\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n sunny: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z\",\n },\n },\n {\n tag: \"path\",\n attrs: {\n d: \"M12 21V22M12 2V3M3 12H2M22 12H21M5.63603 18.3635L4.92892 19.0706M19.0711 4.92848L18.364 5.63559M5.63601 5.63563L4.9289 4.92852M19.071 19.0707L18.3639 18.3636\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n swap: [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M21 14.5H4L9 19.5M3 9.5L20 9.5L15 4.5\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"user-1\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M19.5 20V19C19.5 16.7909 17.7091 15 15.5 15H8.5C6.29086 15 4.5 16.7909 4.5 19V20M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n \"view-list\": [\n {\n tag: \"g\",\n attrs: {},\n children: [\n {\n tag: \"path\",\n attrs: {\n d: \"M3 5H21M3 12H21M3 19H21\",\n \"stroke-linecap\": \"square\",\n },\n },\n ],\n },\n ],\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { ICON_NODES, type IconNode } from \"./icons.generated\";\nimport type { SET_ICON_CUSTOM } from \"./icons-custom\";\nimport type { TDESIGN_ICON_NAMES } from \"./icons-tdesign\";\n\nexport type SetIconMirrorMode = \"always\" | \"rtl\";\nexport type SetIconName =\n | (typeof TDESIGN_ICON_NAMES)[number]\n | keyof typeof SET_ICON_CUSTOM;\nexport type SetIconSize = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"fill\";\n\nexport const SET_ICON_NAMES = Object.keys(ICON_NODES) as SetIconName[];\n\nexport interface SetIconProps {\n /** Emits `aria-hidden=\"true\"` when true. @default true */\n ariaHidden?: boolean;\n /** DOM id. Required when `ariaHidden` is false. */\n id?: string;\n /** SVG title text. Required when `ariaHidden` is false. */\n title?: string;\n /** Set icon name. */\n name: SetIconName;\n /** Horizontal mirroring behavior. Omit for no mirroring. */\n mirrored?: SetIconMirrorMode;\n /** Size variant. @default \"md\" */\n size?: SetIconSize;\n}\n\nfunction iconNodesToSetNodes(nodes: IconNode[]): SetNode[] {\n return nodes.map((node) => ({\n kind: \"element\",\n tag: node.tag,\n attrs: node.attrs,\n children: node.children ? iconNodesToSetNodes(node.children) : [],\n }));\n}\n\n/**\n * Builds the IR tree for the Set icon component.\n *\n * Emits inline `<svg>` markup for a Set icon. Stroke, fill, and linecap are\n * authored per-path in the source SVGs, so the SVG root does not set them.\n *\n * @param props - Icon component props.\n * @returns IR node for the Set icon component.\n */\nexport function buildSetIcon({\n ariaHidden = true,\n id,\n mirrored,\n name,\n size = \"md\",\n title,\n}: SetIconProps): SetNode {\n const iconNodes = ICON_NODES[name];\n\n if (!iconNodes) {\n throw new Error(`Unknown icon name: ${name}`);\n }\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedTitle = title?.trim();\n\n if (!ariaHidden && !normalizedTitle) {\n throw new Error(\"title must be non-empty when ariaHidden is false.\");\n }\n\n if (!ariaHidden && !normalizedId) {\n throw new Error(\"id must be provided when ariaHidden is false.\");\n }\n\n const titleId = !ariaHidden ? `${normalizedId}-title` : undefined;\n\n const children: SetNode[] = [];\n if (!ariaHidden) {\n children.push({\n kind: \"element\",\n tag: \"title\",\n attrs: { id: titleId },\n children: [{ kind: \"text\", value: normalizedTitle! }],\n });\n }\n children.push(...iconNodesToSetNodes(iconNodes));\n\n return {\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": ariaHidden ? \"true\" : undefined,\n \"aria-labelledby\": titleId,\n class: \"set-icon\",\n \"data-mirrored\": mirrored,\n \"data-size\": size,\n fill: \"none\",\n height: \"24\",\n id: normalizedId,\n role: !ariaHidden ? \"img\" : undefined,\n stroke: \"currentColor\",\n \"stroke-width\": \"1.75\",\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\",\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set icon component.\n *\n * Emits inline `<svg>` markup for a Set icon.\n *\n * @param props - Icon component props.\n * @returns HTML string for the Set icon component.\n */\nexport function renderSetIcon(props: SetIconProps): string {\n return serializeSetNode(buildSetIcon(props));\n}\n\n/** Declarative icon contract mirror for tooling, docs, and adapters. */\nexport const SET_ICON_SPEC: SetComponentSpec = {\n name: \"icon\",\n description: \"Use `icon` to render a Set icon.\",\n output: { element: \"svg\", class: \"set-icon\" },\n content: { kind: \"none\" },\n props: {\n ariaHidden: {\n default: true,\n description:\n \"Hides the icon from assistive technology. Decorative by default; set to false for a labelled icon (then `title` and `id` are required).\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`ariaHidden` is false\",\n type: { kind: \"string\" },\n },\n mirrored: {\n description: \"Mirrors the icon horizontally.\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n name: {\n description: \"Set icon name.\",\n required: true,\n type: { kind: \"iconName\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"fill\"],\n },\n },\n title: {\n description: \"Accessible title announced by assistive technology.\",\n requiredWhen: \"`ariaHidden` is false\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"aria-hidden\",\n condition: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-mirrored\",\n condition: { kind: \"when-provided\", prop: \"mirrored\" },\n value: { kind: \"prop\", prop: \"mirrored\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"fill\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"height\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"24\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"not\",\n of: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n },\n value: { kind: \"literal\", text: \"img\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"stroke\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"currentColor\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"stroke-width\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"1.75\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"viewBox\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"0 0 24 24\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"xmlns\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"http://www.w3.org/2000/svg\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n renderSetIcon,\n type SetIconMirrorMode,\n type SetIconName,\n} from \"../icon/icon\";\n\nexport type SetButtonAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetButtonHasPopup = \"menu\";\nexport type SetButtonLabelVisibility =\n | \"visible\"\n | \"hidden\"\n | \"hiddenBelowTablet\";\nexport type SetButtonPlacement = \"start\" | \"end\";\nexport type SetButtonSize = \"sm\" | \"md\" | \"lg\";\nexport type SetButtonTone = \"default\" | \"neutral\";\nexport type SetButtonType = \"button\" | \"submit\";\n\nexport interface SetButtonProps {\n /**\n * Structural style.\n * @default \"outline\"\n */\n appearance?: SetButtonAppearance;\n /**\n * Controlled element id for disclosure-style button interactions.\n * Ignored when `disclosure` is false or omitted.\n */\n controls?: string;\n /**\n * Disables interaction.\n * @default false\n */\n disabled?: boolean;\n /**\n * Emits `aria-expanded=\"false\"` for disclosure-style button interactions.\n * SSR renderers are expected to update the attribute at runtime if state changes.\n * @default false\n */\n disclosure?: boolean;\n /** Optional form owner ID. */\n form?: string;\n /**\n * Popup type for button interactions.\n */\n haspopup?: SetButtonHasPopup;\n /** DOM id. */\n id?: string;\n /** Optional icon name. */\n icon?: SetIconName;\n /** Optional icon mirroring mode. Ignored when `icon` is omitted. */\n iconMirrored?: SetIconMirrorMode;\n /**\n * Icon placement when icon is present.\n * @default \"start\"\n */\n iconPlacement?: SetButtonPlacement;\n /** Accessible name text rendered as content (escaped before render). */\n label: string;\n /**\n * Controls whether the visible label is shown alongside the icon.\n * Non-visible values require `icon`.\n * @default \"visible\"\n */\n labelVisibility?: SetButtonLabelVisibility;\n /** Optional submitted field name. */\n name?: string;\n /**\n * Size variant.\n * @default \"md\"\n */\n size?: SetButtonSize;\n /**\n * Semantic color intent.\n * @default \"default\"\n */\n tone?: SetButtonTone;\n /**\n * Native button type.\n * @default \"button\"\n */\n type?: SetButtonType;\n /** Optional submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the `SetNode` IR for the Set button component.\n *\n * This is the shape consumed by framework adapters. The SSR renderer\n * `renderSetButton` is implemented as `serialize(buildSetButton(props))`.\n */\nexport function buildSetButton(props: SetButtonProps): SetNode {\n const {\n appearance = \"outline\",\n controls,\n disabled,\n disclosure,\n form,\n haspopup,\n id,\n icon,\n iconMirrored,\n iconPlacement = \"start\",\n label,\n labelVisibility = \"visible\",\n name,\n size = \"md\",\n tone = \"default\",\n type,\n value,\n } = props;\n\n const normalizedIconName = icon || undefined;\n const hasIcon = Boolean(normalizedIconName);\n\n if (labelVisibility !== \"visible\" && !hasIcon) {\n throw new Error(\"labelVisibility requires icon when label is not visible.\");\n }\n\n const iconNode: SetNode | null =\n hasIcon && normalizedIconName\n ? {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n {\n kind: \"raw\",\n html: renderSetIcon({\n ariaHidden: true,\n mirrored: iconMirrored,\n name: normalizedIconName,\n size: \"fill\",\n }),\n },\n ],\n }\n : null;\n\n const labelNode: SetNode = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n };\n\n const children: SetNode[] = iconNode\n ? iconPlacement === \"end\"\n ? [labelNode, iconNode]\n : [iconNode, labelNode]\n : [labelNode];\n\n return {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-controls\": disclosure ? controls || undefined : undefined,\n \"aria-expanded\": disclosure ? \"false\" : undefined,\n \"aria-haspopup\": haspopup || undefined,\n class: \"set-button\",\n \"data-appearance\": appearance,\n \"data-label-visibility\":\n labelVisibility === \"visible\" ? undefined : labelVisibility,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n disabled: Boolean(disabled),\n form: form || undefined,\n id: id || undefined,\n name: name || undefined,\n type: type || \"button\",\n value: value || undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set button component.\n *\n * @param props - Button component props.\n * @returns HTML string for a `<button>` element.\n */\nexport function renderSetButton(props: SetButtonProps): string {\n return serializeSetNode(buildSetButton(props));\n}\n\n/** Declarative button contract mirror for tooling, docs, and adapters. */\nexport const SET_BUTTON_SPEC: SetComponentSpec = {\n name: \"button\",\n description: \"Use `button` to let users trigger actions.\",\n output: { element: \"button\", class: \"set-button\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n appearance: {\n default: \"outline\",\n description: \"Visual appearance.\",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n controls: {\n description: \"`id` of the element this button controls.\",\n ignoredWhen: \"`disclosure` is false\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n disclosure: {\n default: false,\n description:\n \"Marks the button as a disclosure toggle for another element.\",\n type: { kind: \"boolean\" },\n },\n form: {\n description: \"`id` of the form this button belongs to.\",\n type: { kind: \"string\" },\n },\n haspopup: {\n description:\n \"Signals that activating the button opens a popup of this type.\",\n type: { kind: \"enum\", values: [\"menu\"] },\n },\n icon: {\n description: \"Icon shown alongside the label.\",\n requiredWhen: \"`labelVisibility` is hidden or hiddenBelowTablet\",\n type: { kind: \"iconName\" },\n },\n iconMirrored: {\n description: \"Mirrors the icon horizontally.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n iconPlacement: {\n default: \"start\",\n description: \"Where the icon sits relative to the label.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description: \"`id` for the button.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"text\" },\n },\n labelVisibility: {\n default: \"visible\",\n description: \"How the label is shown. Hidden values require an icon.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n type: {\n default: \"button\",\n description: \"Native button type.\",\n type: { kind: \"enum\", values: [\"button\", \"submit\"] },\n },\n value: {\n description: \"Value submitted with the form.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-appearance\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-label-visibility\",\n condition: {\n kind: \"when-in\",\n prop: \"labelVisibility\",\n values: [\"hidden\", \"hiddenBelowTablet\"],\n },\n value: { kind: \"prop\", prop: \"labelVisibility\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-expanded\",\n condition: { kind: \"when-truthy\", prop: \"disclosure\" },\n value: { kind: \"literal\", text: \"false\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-controls\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"disclosure\" },\n { kind: \"when-non-empty\", prop: \"controls\" },\n ],\n },\n value: { kind: \"prop\", prop: \"controls\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-haspopup\",\n condition: { kind: \"when-provided\", prop: \"haspopup\" },\n value: { kind: \"prop\", prop: \"haspopup\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"form\",\n condition: { kind: \"when-non-empty\", prop: \"form\" },\n value: { kind: \"prop\", prop: \"form\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"type\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\nimport { renderSetButton } from \"../button/button\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\n\nexport const SET_ALERT_TAG_NAME = \"set-alert\";\nexport const SET_ALERT_EVENT_BEFORE_DISMISS = \"set-alert-before-dismiss\";\nexport const SET_ALERT_EVENT_DISMISS = \"set-alert-dismiss\";\n\nconst dismissibleLabelDefault = \"Dismiss alert\";\n\nexport type SetAlertSize = \"sm\" | \"md\";\n\nexport type SetAlertTone = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface SetAlertProps {\n /** Whether the runtime custom element should inject a dismiss control. @default false */\n dismissible?: boolean;\n /** Accessible label for the runtime dismiss control. Ignored when not dismissible. @default \"Dismiss alert\" */\n dismissibleLabel?: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Alert body text (escaped before render). */\n message: string;\n /** Size variant. @default \"md\" */\n size?: SetAlertSize;\n /** Semantic message intent. */\n tone?: SetAlertTone;\n /** Optional short heading/title text (escaped before render). */\n title?: string;\n}\n\nfunction createDismissButtonElement(\n dismissibleLabel: string,\n document: Document,\n): HTMLElement {\n const wrapper = document.createElement(\"div\");\n wrapper.setAttribute(\"data-part\", \"close\");\n wrapper.innerHTML = renderSetButton({\n appearance: \"text\",\n icon: \"close\",\n label: dismissibleLabel,\n labelVisibility: \"hidden\",\n size: \"sm\",\n tone: \"neutral\",\n });\n return wrapper;\n}\n\nfunction getAlertIconName(tone?: SetAlertTone): SetIconName {\n switch (tone) {\n case \"success\":\n return \"check-circle\";\n case \"warning\":\n return \"error-triangle\";\n case \"error\":\n return \"error-circle\";\n case \"info\":\n return \"info-circle\";\n default:\n return \"sticky-note\";\n }\n}\n\nfunction getAlertRole(tone?: SetAlertTone): \"status\" | \"alert\" {\n return tone === \"warning\" || tone === \"error\" ? \"alert\" : \"status\";\n}\n\n/**\n * Builds the IR tree for the Set alert component.\n *\n * @param props - Alert component props.\n * @returns IR node for a `set-alert` host.\n */\nexport function buildSetAlert({\n dismissible,\n dismissibleLabel = dismissibleLabelDefault,\n id,\n inlineSize = \"full\",\n message,\n size = \"md\",\n tone,\n title,\n}: SetAlertProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDismissibleLabel =\n dismissibleLabel.trim() === \"\" ? dismissibleLabelDefault : dismissibleLabel;\n\n const contentChildren: SetNode[] = [];\n if (title) {\n contentChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"title\" },\n children: [{ kind: \"text\", value: title }],\n });\n }\n contentChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"message\" },\n children: [{ kind: \"text\", value: message }],\n });\n\n return {\n kind: \"element\",\n tag: SET_ALERT_TAG_NAME,\n attrs: {\n class: \"set-alert\",\n \"data-dismissible\": dismissible,\n \"data-dismissible-label\": dismissible\n ? normalizedDismissibleLabel\n : undefined,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n \"data-size\": size,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n role: getAlertRole(tone),\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: getAlertIconName(tone),\n size,\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: contentChildren,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set alert component.\n *\n * Emits meaningful light-DOM HTML inside a `set-alert` host. When\n * `dismissible` is true, runtime hydration may add a dismiss button and remove\n * the host element when that control is activated, subject to the cancelable\n * before-dismiss event.\n *\n * @param props - Alert component props.\n * @returns HTML string for a `set-alert` host.\n */\nexport function renderSetAlert(props: SetAlertProps): string {\n return serializeSetNode(buildSetAlert(props));\n}\n\n/**\n * Defines the `set-alert` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-alert` hosts will\n * upgrade in place and, when dismissible, receive an interactive dismiss\n * control in light DOM.\n *\n * Class declaration is nested so importing this module in environments\n * without an `HTMLElement` global (Node-based tooling like the adapter\n * codegen) doesn't throw at load time.\n */\nexport function defineSetAlert(): void {\n if (customElements.get(SET_ALERT_TAG_NAME)) return;\n\n class SetAlertElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"close\"]')) return;\n\n const beforeDismissEvent = new CustomEvent(\n SET_ALERT_EVENT_BEFORE_DISMISS,\n {\n bubbles: true,\n cancelable: true,\n },\n );\n\n if (!this.dispatchEvent(beforeDismissEvent)) return;\n\n this.dispatchEvent(\n new CustomEvent(SET_ALERT_EVENT_DISMISS, {\n bubbles: true,\n }),\n );\n this.remove();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n\n if (!this.hasAttribute(\"data-dismissible\")) return;\n\n this.#ensureDismissControl();\n this.addEventListener(\"click\", this.#onClick);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #ensureDismissControl(): void {\n if (this.querySelector('[data-part=\"close\"]')) return;\n\n this.append(\n createDismissButtonElement(\n this.getAttribute(\"data-dismissible-label\") ??\n dismissibleLabelDefault,\n this.ownerDocument,\n ),\n );\n }\n }\n\n customElements.define(SET_ALERT_TAG_NAME, SetAlertElement);\n}\n\n/** Declarative alert contract mirror for tooling, docs, and adapters. */\nexport const SET_ALERT_SPEC: SetComponentSpec = {\n name: \"alert\",\n description: \"Use `alert` to surface short, important messages.\",\n output: {\n element: SET_ALERT_TAG_NAME,\n class: \"set-alert\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"title\", kind: \"text\" },\n { prop: \"message\", kind: \"text\" },\n ],\n },\n props: {\n dismissible: {\n default: false,\n description: \"Shows a dismiss control that removes the alert.\",\n type: { kind: \"boolean\" },\n },\n dismissibleLabel: {\n default: dismissibleLabelDefault,\n description: \"Accessible label for the dismiss control.\",\n ignoredWhen: \"`dismissible` is false\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the alert fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n message: {\n description: \"Body text of the alert.\",\n required: true,\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n title: {\n description: \"Bold text above the message.\",\n type: { kind: \"text\" },\n },\n tone: {\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"info\", \"success\", \"warning\", \"error\"] },\n },\n },\n events: {\n [SET_ALERT_EVENT_BEFORE_DISMISS]: {\n bubbles: true,\n cancelable: true,\n description:\n \"Fired before the alert is removed by a dismiss action. Call `preventDefault()` to keep the alert mounted.\",\n },\n [SET_ALERT_EVENT_DISMISS]: {\n bubbles: true,\n description:\n \"Fired after the alert has been removed by an allowed dismiss action.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"warning\", \"error\"],\n },\n value: { kind: \"literal\", text: \"alert\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: {\n kind: \"not\",\n of: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"warning\", \"error\"],\n },\n },\n value: { kind: \"literal\", text: \"status\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible\",\n condition: { kind: \"when-truthy\", prop: \"dismissible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"dismissible\" },\n { kind: \"when-non-empty\", prop: \"dismissibleLabel\" },\n ],\n },\n value: { kind: \"prop\", prop: \"dismissibleLabel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"dismissible\" },\n {\n kind: \"not\",\n of: { kind: \"when-non-empty\", prop: \"dismissibleLabel\" },\n },\n ],\n },\n value: { kind: \"literal\", text: dismissibleLabelDefault },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetLinkAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetLinkCurrent = \"page\";\nexport type SetLinkLabelVisibility = \"visible\" | \"hidden\" | \"hiddenBelowTablet\";\nexport type SetLinkPlacement = \"start\" | \"end\";\nexport type SetLinkSize = \"sm\" | \"md\" | \"lg\";\nexport type SetLinkTarget = \"_blank\" | \"_parent\" | \"_self\" | \"_top\";\nexport type SetLinkTone = \"default\" | \"neutral\";\n\nexport interface SetLinkProps {\n /**\n * Visual appearance. Defaults to the plain link style (`\"text\"`); set\n * `\"outline\"` or `\"solid\"` for button-like treatments.\n * @default \"text\"\n */\n appearance?: SetLinkAppearance;\n /** Emits `aria-current` with this value. */\n current?: SetLinkCurrent;\n /** Optional `download` attribute (`true` or suggested filename). */\n download?: boolean | string;\n /** Link destination. */\n href: string;\n /** DOM id. */\n id?: string;\n /** Optional icon markup rendered alongside the label. Caller sanitizes untrusted content. */\n icon?: string;\n /**\n * Icon placement when icon is present.\n * @default \"start\"\n */\n iconPlacement?: SetLinkPlacement;\n /** Accessible label text rendered as content (escaped before render). */\n label: string;\n /**\n * Controls whether the visible label is shown alongside the icon.\n * Non-visible values require `icon`.\n * @default \"visible\"\n */\n labelVisibility?: SetLinkLabelVisibility;\n /** Optional explicit `rel` value. Ignored when `download` is set. */\n rel?: string;\n /** Size variant. @default \"md\" */\n size?: SetLinkSize;\n /** Optional link target. Ignored when `download` is set. */\n target?: SetLinkTarget;\n /** Tone variant. @default \"default\" */\n tone?: SetLinkTone;\n /**\n * Underline variant; emits `data-underline` only when true.\n * Ignored when `appearance` is not `\"text\"`.\n * @default false\n */\n underline?: boolean;\n}\n\nfunction normalizeDownload(\n value?: boolean | string,\n): string | boolean | undefined {\n if (!value) return undefined;\n if (value === true) return true;\n return value;\n}\n\n/**\n * Builds the IR tree for the Set link component.\n *\n * @param props - Link component props.\n * @returns IR node for an `<a>` element.\n * @remarks\n * - `label` is escaped before render\n * - `icon`, when provided, is rendered as trusted inline markup\n */\nexport function buildSetLink(props: SetLinkProps): SetNode {\n const {\n appearance = \"text\",\n current,\n download,\n href,\n id,\n icon,\n iconPlacement = \"start\",\n label,\n labelVisibility = \"visible\",\n rel,\n size = \"md\",\n target,\n tone = \"default\",\n underline,\n } = props;\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedIcon = icon?.trim() || undefined;\n const hasIcon = Boolean(normalizedIcon);\n\n if (labelVisibility !== \"visible\" && !hasIcon) {\n throw new Error(\"labelVisibility requires icon when label is not visible.\");\n }\n\n const normalizedDownload = normalizeDownload(download);\n\n const iconNode: SetNode | null = normalizedIcon\n ? {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [{ kind: \"raw\", html: normalizedIcon }],\n }\n : null;\n\n const labelNode: SetNode = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n };\n\n const children: SetNode[] = iconNode\n ? iconPlacement === \"end\"\n ? [labelNode, iconNode]\n : [iconNode, labelNode]\n : [labelNode];\n\n return {\n kind: \"element\",\n tag: \"a\",\n attrs: {\n \"aria-current\": current,\n class: \"set-link\",\n \"data-appearance\": appearance === \"text\" ? undefined : appearance,\n \"data-label-visibility\":\n labelVisibility === \"visible\" ? undefined : labelVisibility,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n \"data-underline\": underline && appearance === \"text\" ? true : undefined,\n download: normalizedDownload,\n href,\n id: normalizedId,\n rel: normalizedDownload ? undefined : rel || undefined,\n target: normalizedDownload ? undefined : target || undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set link component.\n *\n * @param props - Link component props.\n * @returns HTML string for an `<a>` element.\n */\nexport function renderSetLink(props: SetLinkProps): string {\n return serializeSetNode(buildSetLink(props));\n}\n\n/** Declarative link contract mirror for tooling, docs, and adapters. */\nexport const SET_LINK_SPEC: SetComponentSpec = {\n name: \"link\",\n description: \"Use `link` to navigate to another page or resource.\",\n output: { element: \"a\", class: \"set-link\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"icon\", kind: \"html\" },\n ],\n },\n props: {\n appearance: {\n default: \"text\",\n description:\n \"Visual appearance. `text` is a standard link; `outline` and `solid` give button-styled treatments. \",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n current: {\n description:\n \"Marks the link as the current item in its set; emits `aria-current` with this value.\",\n type: { kind: \"enum\", values: [\"page\"] },\n },\n download: {\n description:\n \"Saves the target instead of navigating. Pass a filename or `true`.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"boolean\" }, { kind: \"string\" }],\n },\n },\n href: {\n description: \"Link destination.\",\n required: true,\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n icon: {\n description:\n \"Icon markup shown alongside the label. Set icon component, or SVG markup from https://simpleicons.org/ for third-party logos.\",\n requiredWhen: \"`labelVisibility` is hidden or hiddenBelowTablet\",\n type: { kind: \"html\" },\n },\n iconPlacement: {\n default: \"start\",\n description: \"Where the icon sits relative to the label.\",\n ignoredWhen: \"`icon` is omitted\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"text\" },\n },\n labelVisibility: {\n default: \"visible\",\n description: \"How the label is shown. Hidden values require an icon.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n rel: {\n description: \"Explicit `rel` attribute.\",\n ignoredWhen: \"`download` is set\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n target: {\n description: \"Where to open the link.\",\n ignoredWhen: \"`download` is set\",\n type: {\n kind: \"enum\",\n values: [\"_blank\", \"_parent\", \"_self\", \"_top\"],\n },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n underline: {\n default: false,\n description: \"Underlines the link.\",\n ignoredWhen: \"`appearance` is not `text`\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"href\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"href\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-current\",\n condition: { kind: \"when-provided\", prop: \"current\" },\n value: { kind: \"prop\", prop: \"current\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"download\",\n condition: { kind: \"when-truthy\", prop: \"download\" },\n value: { kind: \"prop\", prop: \"download\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"rel\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-non-empty\", prop: \"rel\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"download\" } },\n ],\n },\n value: { kind: \"prop\", prop: \"rel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"target\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"target\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"download\" } },\n ],\n },\n value: { kind: \"prop\", prop: \"target\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-appearance\",\n condition: {\n kind: \"when-in\",\n prop: \"appearance\",\n values: [\"outline\", \"solid\"],\n },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-label-visibility\",\n condition: {\n kind: \"when-in\",\n prop: \"labelVisibility\",\n values: [\"hidden\", \"hiddenBelowTablet\"],\n },\n value: { kind: \"prop\", prop: \"labelVisibility\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-underline\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"underline\" },\n { kind: \"when-equals\", prop: \"appearance\", to: \"text\" },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetButton } from \"../button/button\";\nimport { buildSetLink } from \"../link/link\";\n\nexport const SET_BANNER_TAG_NAME = \"set-banner\";\n\nexport type SetBannerTone = \"info\" | \"warning\" | \"error\";\nexport const SET_BANNER_EVENT_BEFORE_DISMISS = \"set-banner-before-dismiss\";\nexport const SET_BANNER_EVENT_DISMISS = \"set-banner-dismiss\";\n\nconst dismissibleLabelDefault = \"Dismiss banner\";\n\nexport interface SetBannerProps {\n /** URL for an optional secondary link action rendered inline within the message.\n * Must be provided together with `actionLabel`. */\n actionHref?: string;\n /** Text label for an optional secondary link action rendered inline within the message.\n * Must be provided together with `actionHref`. */\n actionLabel?: string;\n /** Whether the runtime custom element should inject a dismiss control. @default true */\n dismissible?: boolean;\n /** Accessible label for the runtime dismiss control. Ignored when not dismissible.\n * @default \"Dismiss banner\" */\n dismissibleLabel?: string;\n /** DOM id. */\n id?: string;\n /** Banner body text (escaped before render). */\n message: string;\n /** Semantic message intent. */\n tone?: SetBannerTone;\n}\n\nfunction createDismissButtonElement(\n dismissibleLabel: string,\n document: Document,\n): HTMLElement {\n const wrapper = document.createElement(\"div\");\n wrapper.setAttribute(\"data-part\", \"close\");\n wrapper.innerHTML = renderSetButton({\n appearance: \"text\",\n icon: \"close\",\n label: dismissibleLabel,\n labelVisibility: \"hidden\",\n size: \"sm\",\n tone: \"neutral\",\n });\n return wrapper;\n}\n\n/**\n * Builds the IR tree for the Set banner component.\n *\n * @param props - Banner component props.\n * @returns IR node for a `set-banner` host.\n */\nexport function buildSetBanner({\n actionHref,\n actionLabel,\n dismissible = true,\n dismissibleLabel = dismissibleLabelDefault,\n id,\n message,\n tone,\n}: SetBannerProps): SetNode {\n if (Boolean(actionHref) !== Boolean(actionLabel)) {\n throw new Error(\"actionHref and actionLabel must be provided together.\");\n }\n\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDismissibleLabel =\n dismissibleLabel.trim() === \"\" ? dismissibleLabelDefault : dismissibleLabel;\n\n const messageChildren: SetNode[] = [{ kind: \"text\", value: message }];\n\n if (actionHref && actionLabel) {\n messageChildren.push({ kind: \"text\", value: \" \" });\n messageChildren.push(\n buildSetLink({\n href: actionHref,\n label: actionLabel,\n underline: true,\n }),\n );\n }\n\n return {\n kind: \"element\",\n tag: SET_BANNER_TAG_NAME,\n attrs: {\n class: \"set-banner\",\n \"data-set-content-theme\": \"dark\",\n \"data-set-surface\": \"default\",\n \"data-dismissible\": dismissible,\n \"data-dismissible-label\": dismissible\n ? normalizedDismissibleLabel\n : undefined,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"message\" },\n children: messageChildren,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set banner component.\n *\n * Emits meaningful light-DOM HTML inside a `set-banner` host. When\n * `dismissible` is true, runtime hydration may add a dismiss button and remove\n * the host element when that control is activated, subject to the cancelable\n * before-dismiss event.\n *\n * @param props - Banner component props.\n * @returns HTML string for a `set-banner` host.\n */\nexport function renderSetBanner(props: SetBannerProps): string {\n return serializeSetNode(buildSetBanner(props));\n}\n\n/**\n * Defines the `set-banner` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-banner` hosts will\n * upgrade in place and, when dismissible, receive an interactive dismiss\n * control in light DOM.\n */\nexport function defineSetBanner(): void {\n if (customElements.get(SET_BANNER_TAG_NAME)) return;\n\n class SetBannerElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"close\"]')) return;\n\n const beforeDismissEvent = new CustomEvent(\n SET_BANNER_EVENT_BEFORE_DISMISS,\n {\n bubbles: true,\n cancelable: true,\n },\n );\n\n if (!this.dispatchEvent(beforeDismissEvent)) return;\n\n this.dispatchEvent(\n new CustomEvent(SET_BANNER_EVENT_DISMISS, {\n bubbles: true,\n }),\n );\n this.remove();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n\n if (!this.hasAttribute(\"data-dismissible\")) return;\n\n this.#ensureDismissControl();\n this.addEventListener(\"click\", this.#onClick);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #ensureDismissControl(): void {\n if (this.querySelector('[data-part=\"close\"]')) return;\n\n this.append(\n createDismissButtonElement(\n this.getAttribute(\"data-dismissible-label\") ??\n dismissibleLabelDefault,\n this.ownerDocument,\n ),\n );\n }\n }\n\n customElements.define(SET_BANNER_TAG_NAME, SetBannerElement);\n}\n\n/** Declarative banner contract mirror for tooling, docs, and adapters. */\nexport const SET_BANNER_SPEC: SetComponentSpec = {\n name: \"banner\",\n description: \"Use `banner` to display a prominent site-wide message.\",\n output: { element: SET_BANNER_TAG_NAME, class: \"set-banner\" },\n content: { kind: \"text\", prop: \"message\" },\n props: {\n actionHref: {\n description:\n \"URL for an inline link action rendered after the `message`.\",\n requiredWhen: \"`actionLabel` is provided\",\n type: { kind: \"string\" },\n },\n actionLabel: {\n description:\n \"Text label for an inline link action rendered after the `message`.\",\n requiredWhen: \"`actionHref` is provided\",\n type: { kind: \"text\" },\n },\n dismissible: {\n default: true,\n description: \"Shows a dismiss control that removes the banner.\",\n type: { kind: \"boolean\" },\n },\n dismissibleLabel: {\n default: dismissibleLabelDefault,\n description: \"Accessible label for the dismiss control.\",\n ignoredWhen: \"`dismissible` is false\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n message: {\n description: \"Body text of the banner.\",\n required: true,\n type: { kind: \"text\" },\n },\n tone: {\n description: \"Semantic tone.\",\n type: {\n kind: \"enum\",\n values: [\"info\", \"warning\", \"error\"],\n },\n },\n },\n events: {\n [SET_BANNER_EVENT_BEFORE_DISMISS]: {\n bubbles: true,\n cancelable: true,\n description:\n \"Fired before the banner is removed by a dismiss action. Call `preventDefault()` to keep the banner mounted.\",\n },\n [SET_BANNER_EVENT_DISMISS]: {\n bubbles: true,\n description:\n \"Fired after the banner has been removed by an allowed dismiss action.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"dark\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"default\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-dismissible\",\n condition: { kind: \"when-truthy\", prop: \"dismissible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport const SET_IMAGE_TAG_NAME = \"set-image\";\n\nexport type SetImageAspectRatio = \"1:1\" | \"4:5\" | \"3:2\" | \"16:9\" | \"21:9\";\nexport type SetImageFit = \"intrinsic\" | \"fluid\" | \"cover\";\nexport type SetImageGravity =\n | \"N\"\n | \"NE\"\n | \"E\"\n | \"SE\"\n | \"S\"\n | \"SW\"\n | \"W\"\n | \"NW\"\n | \"C\";\nexport type SetImageScheme = \"light\" | \"dark\";\nexport interface SetImageSource {\n /**\n * The intrinsic height of the source, in pixels.\n */\n height?: number;\n /**\n * Media condition that is evaluated for the source.\n * Same format as the HTML `source[media]` attribute.\n */\n media?: string;\n /**\n * The HTML `sizes` attribute for the source.\n */\n sizes?: string;\n /**\n * A comma-separated list of candidate image sources.\n * Same format as the HTML `source[srcset]` attribute.\n */\n srcSet: string;\n /**\n * Intro overlay for this source in an `animated` sequence.\n */\n leadSrc?: string;\n /**\n * Reduced-motion still for this source, used when `animated`.\n */\n still?: string;\n /**\n * MIME type for the `srcSet` resources.\n */\n type?: string;\n /**\n * The intrinsic width of the source, in pixels.\n */\n width?: number;\n}\n\nexport interface SetImageProps {\n /** Show the light or dark variant to match the surrounding scheme. @default false */\n adaptive?: boolean;\n /** Render an animated image with a reduced-motion still. @default false */\n animated?: boolean;\n /** Alternative text. Empty string is valid and used by default. @default \"\" */\n alt?: string;\n /** Aspect ratio applied to the wrapper. */\n aspectRatio?: SetImageAspectRatio;\n /** Layout mode. @default \"intrinsic\" */\n fit?: SetImageFit;\n /** Enables default image shadow treatment. @default false */\n shadow?: boolean;\n /** Height in pixels. */\n height?: number;\n /** DOM id. */\n id?: string;\n /** Emit `loading=\"lazy\"` on the image. @default false */\n lazy?: boolean;\n /** Intro overlay that plays once, then reveals `src`, when `animated`. */\n leadSrc?: string;\n /** Emit `fetchpriority=\"high\"` and suppress `loading=\"lazy\"`. @default false */\n priority?: boolean;\n /** Focal gravity for the cover crop. @default \"C\" */\n gravity?: SetImageGravity;\n /** Applies the default corner radius. @default false */\n radius?: boolean;\n /** HTML `sizes` attribute. */\n sizes?: string;\n /** Responsive source-set definitions for `<picture>`. */\n sources?: SetImageSource[];\n /** Candidate sources for the fallback `<img>` (HTML `img[srcset]` format). */\n srcSet?: string;\n /** Reduced-motion still, used when `animated`. */\n still?: string;\n /** Image source URL. */\n src: string;\n /** Width in pixels. */\n width?: number;\n}\n\n/**\n * Builds the IR tree for the Set image component.\n *\n * @param props - Image component props.\n * @returns IR node for image/picture markup.\n */\nexport function buildSetImage({\n adaptive,\n animated,\n alt = \"\",\n aspectRatio,\n fit = \"intrinsic\",\n gravity = \"C\",\n height,\n id,\n lazy,\n leadSrc,\n priority,\n radius,\n shadow,\n sizes,\n sources,\n src,\n srcSet,\n still,\n width,\n}: SetImageProps): SetNode {\n const cover = fit === \"cover\";\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedSrc = src.trim();\n const normalizedSrcSet = srcSet?.trim();\n const normalizedLeadSrc = leadSrc?.trim();\n const normalizedStill = still?.trim();\n const normalizedSizes = sizes?.trim();\n const normalizedSources =\n sources?.map((source, index) => {\n const normalizedSrcSet = source.srcSet.trim();\n const normalizedMedia = source.media?.trim();\n const normalizedType = source.type?.trim();\n const normalizedSourceSizes = source.sizes?.trim();\n const normalizedSourceLeadSrc = source.leadSrc?.trim();\n const normalizedSourceStill = source.still?.trim();\n\n if (!normalizedSrcSet) {\n throw new Error(`sources[${index}].srcSet must be non-empty.`);\n }\n\n return {\n height: source.height,\n leadSrc: normalizedSourceLeadSrc || undefined,\n media: normalizedMedia || undefined,\n sizes: normalizedSourceSizes || undefined,\n srcSet: normalizedSrcSet,\n still: normalizedSourceStill || undefined,\n type: normalizedType || undefined,\n width: source.width,\n };\n }) || [];\n\n if (!normalizedSrc) {\n throw new Error(\"src must be a non-empty string.\");\n }\n\n if (\n adaptive &&\n [\n normalizedSrc,\n normalizedSrcSet,\n ...normalizedSources.map((source) => source.srcSet),\n ].some((url) => url?.includes(\"#\"))\n ) {\n throw new Error(\"adaptive sources must not contain URL fragments.\");\n }\n\n // `adaptive` drives scheme pairing for animated too: `adaptive animated` pairs\n // light/dark webp by substituting a `{scheme}` token, while `animated` alone\n // renders a single unthemed asset. The still is the reduced-motion fallback.\n const animatedPaired = Boolean(animated && adaptive);\n // A `leadSrc` opts into sequencing: it plays once as an overlay, then fades\n // to reveal `src`.\n const sequenced = Boolean(animated && normalizedLeadSrc);\n const hasLeadSrc =\n Boolean(normalizedLeadSrc) ||\n normalizedSources.some((source) => source.leadSrc);\n\n if (!animated && hasLeadSrc) {\n throw new Error(\"leadSrc requires animated.\");\n }\n\n if (animated) {\n const motionUrls = [\n normalizedSrc,\n normalizedSrcSet,\n normalizedLeadSrc,\n ...normalizedSources.flatMap((source) => [source.srcSet, source.leadSrc]),\n ].filter((url): url is string => Boolean(url));\n const tokened = motionUrls.filter((url) => url.includes(\"{scheme}\"));\n\n if (adaptive && tokened.length !== motionUrls.length) {\n throw new Error(\n \"adaptive animated sources must contain a {scheme} placeholder.\",\n );\n }\n\n if (!adaptive && tokened.length > 0) {\n throw new Error(\n \"the {scheme} placeholder requires adaptive to enable light/dark.\",\n );\n }\n\n if (!normalizedStill) {\n throw new Error(\"animated requires a still.\");\n }\n\n const stillUrls = [\n normalizedStill,\n ...normalizedSources.map((source) => source.still),\n ].filter((url): url is string => Boolean(url));\n\n if (stillUrls.some((url) => url.includes(\"#\"))) {\n throw new Error(\"animated still must not contain URL fragments.\");\n }\n }\n\n // Split like the browser: comma + whitespace, so embedded URL commas\n // survive. Anything beyond URL + one descriptor is ambiguous — throw.\n const withScheme = (srcSet: string, scheme: SetImageScheme): string =>\n srcSet\n .split(/,\\s+/)\n .map((candidate) => {\n const [url, ...descriptor] = candidate.trim().split(/\\s+/);\n if (!url || descriptor.length > 1) {\n throw new Error(\n \"adaptive srcSet candidates must be a URL plus at most one descriptor, separated by a comma and whitespace.\",\n );\n }\n return [`${url}#${scheme}`, ...descriptor].join(\" \");\n })\n .join(\", \");\n\n const buildMediaNode = (scheme?: SetImageScheme): SetNode => {\n const imgNode: SetNode = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt,\n class: \"img\",\n \"data-scheme\":\n scheme && normalizedSources.length === 0 ? scheme : undefined,\n fetchpriority: priority ? \"high\" : undefined,\n height: cover ? undefined : height ? String(height) : undefined,\n loading: lazy && !priority ? \"lazy\" : undefined,\n sizes:\n normalizedSources.length > 0\n ? undefined\n : normalizedSizes || undefined,\n src: scheme ? `${normalizedSrc}#${scheme}` : normalizedSrc,\n srcset:\n normalizedSrcSet && scheme\n ? withScheme(normalizedSrcSet, scheme)\n : normalizedSrcSet || undefined,\n width: cover ? undefined : width ? String(width) : undefined,\n },\n children: [],\n };\n\n if (normalizedSources.length === 0) {\n return imgNode;\n }\n\n const sourceNodes: SetNode[] = normalizedSources.map((source) => ({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n height: source.height ? String(source.height) : undefined,\n media: source.media,\n sizes: source.sizes,\n srcset: scheme ? withScheme(source.srcSet, scheme) : source.srcSet,\n type: source.type,\n width: source.width ? String(source.width) : undefined,\n },\n children: [],\n }));\n return {\n kind: \"element\",\n tag: \"picture\",\n attrs: { \"data-scheme\": scheme },\n children: [...sourceNodes, imgNode],\n };\n };\n\n // Two scheme mechanisms: motion URLs substitute a `{scheme}` token per file;\n // the still appends a `#light`/`#dark` fragment. Both no-op without a scheme.\n const reducedMotion = \"(prefers-reduced-motion: reduce)\";\n const substituteScheme = (url: string, scheme?: SetImageScheme): string =>\n scheme ? url.replaceAll(\"{scheme}\", scheme) : url;\n const withStillScheme = (url: string, scheme?: SetImageScheme): string =>\n scheme ? `${url}#${scheme}` : url;\n\n // Stills are placed first: `<picture>` uses the first matching source, so\n // under reduced motion the browser downloads only the still.\n const buildAnimatedMediaNode = (scheme?: SetImageScheme): SetNode => {\n const stillSources: SetNode[] = normalizedSources\n .filter((source) => source.still)\n .map((source) => ({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n height: source.height ? String(source.height) : undefined,\n media: source.media\n ? `${reducedMotion} and ${source.media}`\n : reducedMotion,\n srcset: withStillScheme(source.still as string, scheme),\n width: source.width ? String(source.width) : undefined,\n },\n children: [],\n }));\n\n stillSources.push({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n media: reducedMotion,\n srcset: withStillScheme(normalizedStill as string, scheme),\n },\n children: [],\n });\n\n const motionSources: SetNode[] = normalizedSources.map((source) => ({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n height: source.height ? String(source.height) : undefined,\n media: source.media,\n sizes: source.sizes,\n srcset: substituteScheme(source.srcSet, scheme),\n type: source.type,\n width: source.width ? String(source.width) : undefined,\n },\n children: [],\n }));\n\n const imgNode: SetNode = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt,\n class: \"img\",\n fetchpriority: priority ? \"high\" : undefined,\n height: cover ? undefined : height ? String(height) : undefined,\n loading: lazy && !priority ? \"lazy\" : undefined,\n sizes:\n normalizedSources.length > 0\n ? undefined\n : normalizedSizes || undefined,\n src: substituteScheme(normalizedSrc, scheme),\n srcset: normalizedSrcSet\n ? substituteScheme(normalizedSrcSet, scheme)\n : undefined,\n width: cover ? undefined : width ? String(width) : undefined,\n },\n children: [],\n };\n\n return {\n kind: \"element\",\n tag: \"picture\",\n attrs: { \"data-scheme\": scheme },\n children: [...stillSources, ...motionSources, imgNode],\n };\n };\n\n // The lead overlay plays once, then CSS fades it to reveal `src`. Its motion\n // is gated to `prefers-reduced-motion: no-preference` so it neither loads nor\n // shows under reduced motion; the still stands in as its fallback image. It\n // is decorative (empty alt): the base layer is always in the DOM and its img\n // carries the alt, so the overlay must not announce a duplicate.\n const buildAnimatedLead = (scheme?: SetImageScheme): SetNode => {\n const noPreference = \"(prefers-reduced-motion: no-preference)\";\n const motionSources: SetNode[] = normalizedSources\n .map((source): SetNode | undefined => {\n if (!source.leadSrc) return undefined;\n return {\n kind: \"element\",\n tag: \"source\",\n attrs: {\n height: source.height ? String(source.height) : undefined,\n media: source.media\n ? `${noPreference} and ${source.media}`\n : noPreference,\n sizes: source.sizes,\n srcset: substituteScheme(source.leadSrc, scheme),\n type: source.type,\n width: source.width ? String(source.width) : undefined,\n },\n children: [],\n };\n })\n .filter((node): node is SetNode => Boolean(node));\n\n motionSources.push({\n kind: \"element\",\n tag: \"source\",\n attrs: {\n media: noPreference,\n sizes:\n normalizedSources.length > 0\n ? undefined\n : normalizedSizes || undefined,\n srcset: substituteScheme(normalizedLeadSrc as string, scheme),\n },\n children: [],\n });\n\n const imgNode: SetNode = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt: \"\",\n class: \"img\",\n height: cover ? undefined : height ? String(height) : undefined,\n src: withStillScheme(normalizedStill as string, scheme),\n width: cover ? undefined : width ? String(width) : undefined,\n },\n children: [],\n };\n\n return {\n kind: \"element\",\n tag: \"picture\",\n attrs: { \"data-scheme\": scheme, \"data-layer\": \"lead\" },\n children: [...motionSources, imgNode],\n };\n };\n\n // Sequence overlays a lead layer (plays once, fades) on the base `src`\n // picture; otherwise just the base picture.\n const buildAnimatedScheme = (scheme?: SetImageScheme): SetNode[] =>\n sequenced\n ? [buildAnimatedMediaNode(scheme), buildAnimatedLead(scheme)]\n : [buildAnimatedMediaNode(scheme)];\n\n const mediaNodes: SetNode[] = animated\n ? animatedPaired\n ? [...buildAnimatedScheme(\"light\"), ...buildAnimatedScheme(\"dark\")]\n : buildAnimatedScheme()\n : adaptive\n ? [buildMediaNode(\"light\"), buildMediaNode(\"dark\")]\n : [buildMediaNode()];\n\n const styleChunks: string[] = [];\n if (height) styleChunks.push(`--set-image-block-size: ${height / 16}rem`);\n if (width) styleChunks.push(`--set-image-inline-size: ${width / 16}rem`);\n\n return {\n kind: \"element\",\n tag: SET_IMAGE_TAG_NAME,\n attrs: {\n class: \"set-image\",\n \"data-adaptive\": Boolean(adaptive),\n \"data-animated\": Boolean(animated),\n \"data-sequenced\": sequenced,\n \"data-aspect-ratio\": cover && !height ? aspectRatio : undefined,\n \"data-fluid\": fit === \"fluid\",\n \"data-gravity\": cover && gravity !== \"C\" ? gravity : undefined,\n \"data-shadow\": Boolean(shadow),\n \"data-object-fit\": cover ? \"cover\" : undefined,\n \"data-radius\": Boolean(radius),\n id: normalizedId,\n style: styleChunks.length > 0 ? styleChunks.join(\"; \") : undefined,\n },\n children: mediaNodes,\n };\n}\n\n/**\n * SSR renderer for the Set image component.\n *\n * Emits meaningful light-DOM HTML inside a `set-image` host. The output is\n * fully functional without JS — scheme selection, the reduced-motion still,\n * and the sequenced hand-off are CSS-driven; `defineSetImage` only enhances\n * sequenced images.\n *\n * @param props - Image component props.\n * @returns HTML string for image/picture markup.\n */\nexport function renderSetImage(props: SetImageProps): string {\n return serializeSetNode(buildSetImage(props));\n}\n\n/**\n * Defines the `set-image` custom element runtime.\n *\n * Safe to call multiple times, and entirely optional — SSR output works without\n * it. Upgrading only enhances *sequenced* (`leadSrc`) images: it anchors each\n * lead overlay's hide to when that overlay's frames have loaded, rather than a\n * fixed delay from render (which can clip the hand-off on slow connections).\n * Non-sequenced images upgrade to an inert host.\n */\nexport function defineSetImage(): void {\n if (customElements.get(SET_IMAGE_TAG_NAME)) return;\n\n const reducedMotionMedia = \"(prefers-reduced-motion: reduce)\";\n\n class SetImageElement extends HTMLElement {\n connectedCallback(): void {\n // Only sequenced images (lead overlays) have anything to enhance; a\n // paired image has one lead per scheme, so anchor every one.\n const leads = this.querySelectorAll<HTMLElement>('[data-layer=\"lead\"]');\n if (leads.length === 0) return;\n\n // Reduced motion: CSS hides the overlays — leave the sequence alone.\n const windowRef = this.ownerDocument.defaultView;\n if (windowRef?.matchMedia?.(reducedMotionMedia).matches) return;\n\n for (const lead of leads) this.#anchor(lead);\n }\n\n // Drive the overlay's hide from playback readiness rather than render, so a\n // slow connection can't clip the hand-off before the frames have loaded.\n #anchor(lead: HTMLElement): void {\n const img = lead.querySelector(\"img\");\n if (!img) return;\n\n // Cancel the render-anchored CSS hide; re-enable it once the frames load.\n lead.style.animation = \"none\";\n const start = (): void => {\n void lead.offsetWidth; // flush `animation: none` so re-enabling restarts it\n lead.style.animation = \"\";\n };\n if (img.complete) start();\n else img.addEventListener(\"load\", start, { once: true });\n }\n }\n\n customElements.define(SET_IMAGE_TAG_NAME, SetImageElement);\n}\n\n/** Declarative image contract mirror for tooling, docs, and adapters. */\nexport const SET_IMAGE_SPEC: SetComponentSpec = {\n name: \"image\",\n description:\n \"Use `image` to render a responsive image with intrinsic, fluid, or cover fit, and optional art-directed `sources`.\",\n output: { element: SET_IMAGE_TAG_NAME, class: \"set-image\" },\n content: { kind: \"none\" },\n props: {\n adaptive: {\n default: false,\n description:\n \"Shows the image's light or dark variant to match the surrounding color scheme. Use with adaptive assets exported from Screen, which carry both variants in one file; the component selects one by adding `#light`/`#dark` to the URL. With `animated`, it pairs light/dark webp instead, via a `{scheme}` placeholder in the URLs.\",\n type: { kind: \"boolean\" },\n },\n animated: {\n default: false,\n description:\n \"Renders an animated image (e.g. `webp`) with a required `still` shown when the user prefers reduced motion. Combine with `adaptive` for light/dark theming: the `src`/`srcSet`/`sources` URLs then carry no Cloudinary version and a `{scheme}` placeholder — matching Screen's animated exports — which the component substitutes across a light/dark pair. The `still` gets `#light`/`#dark` appended. Without `adaptive`, renders a single, unthemed animated asset. Add a `leadSrc` to sequence: it plays once as an overlay, then reveals `src` after a fixed hold.\",\n type: { kind: \"boolean\" },\n },\n alt: {\n default: \"\",\n description: \"Alternative text. Leave empty for decorative images.\",\n type: { kind: \"string\" },\n },\n gravity: {\n default: \"C\",\n description: \"Focal point used when cropping.\",\n ignoredWhen: '`fit` is not `\"cover\"`',\n type: {\n kind: \"enum\",\n values: [\"N\", \"NE\", \"E\", \"SE\", \"S\", \"SW\", \"W\", \"NW\", \"C\"],\n },\n },\n radius: {\n default: false,\n description: \"Applies the default corner radius.\",\n type: { kind: \"boolean\" },\n },\n aspectRatio: {\n description: \"Aspect ratio applied to the wrapper.\",\n ignoredWhen: '`fit` is not `\"cover\"`, or `height` is set',\n type: {\n kind: \"enum\",\n values: [\"1:1\", \"4:5\", \"3:2\", \"16:9\", \"21:9\"],\n },\n },\n fit: {\n default: \"intrinsic\",\n description:\n \"Layout mode. `intrinsic` renders at the image's own dimensions, `fluid` scales to the container's full inline size at the active source's aspect ratio, `cover` renders a cropped fill (`object-fit: cover`) sized by the wrapper. For `fluid`, provide candidates sized for large viewports via `srcSet`/`sources` so upscaled rendering stays sharp.\",\n type: { kind: \"enum\", values: [\"intrinsic\", \"fluid\", \"cover\"] },\n },\n shadow: {\n default: false,\n description: \"Applies a drop shadow to the image.\",\n type: { kind: \"boolean\" },\n },\n height: {\n description:\n \"Height in pixels. Under `intrinsic` and `fluid`, an aspect-ratio hint — with `width`, reserves the correctly shaped box before load; rendered height follows the aspect ratio. Under `cover`, the wrapper's block size, overriding `aspectRatio`.\",\n type: { kind: \"number\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n lazy: {\n default: false,\n description: \"Defers loading until the image is near the viewport.\",\n type: { kind: \"boolean\" },\n },\n priority: {\n default: false,\n description: \"Marks the image as high priority for fetch.\",\n type: { kind: \"boolean\" },\n },\n sizes: {\n description: \"`sizes` attribute used with `srcSet`.\",\n ignoredWhen: \"`sources` are provided\",\n type: { kind: \"string\" },\n },\n sources: {\n description: \"Responsive sources rendered inside a `<picture>`.\",\n type: {\n kind: \"array\",\n itemShape: {\n height: {\n description: \"Intrinsic height in pixels.\",\n type: { kind: \"number\" },\n },\n media: {\n description: \"`media` condition evaluated for the source.\",\n type: { kind: \"string\" },\n },\n sizes: {\n description: \"`sizes` attribute for the source.\",\n type: { kind: \"string\" },\n },\n srcSet: {\n description: \"Candidate sources for this media entry.\",\n required: true,\n type: { kind: \"string\" },\n },\n leadSrc: {\n description:\n \"Intro overlay for this source in an `animated` sequence.\",\n type: { kind: \"string\" },\n },\n still: {\n description:\n \"Reduced-motion still for this source, used when `animated`. For a light/dark still, use an adaptive SVG.\",\n type: { kind: \"string\" },\n },\n type: {\n description: \"MIME type for the source resources.\",\n type: { kind: \"string\" },\n },\n width: {\n description: \"Intrinsic width in pixels.\",\n type: { kind: \"number\" },\n },\n },\n },\n },\n srcSet: {\n description: \"Candidate sources for the fallback image.\",\n type: { kind: \"string\" },\n },\n leadSrc: {\n description:\n \"An intro overlay that sequences an `animated` image: `leadSrc` plays once, then the component reveals `src` after a fixed hold. Follows the same `{scheme}` rules as `animated` sources.\",\n type: { kind: \"string\" },\n },\n still: {\n description:\n \"Reduced-motion still shown when `animated` and the user prefers reduced motion. Any image works; for a light/dark still use an adaptive SVG exported from Screen, which the component selects with `#light`/`#dark` when combined with `adaptive`.\",\n requiredWhen: \"`animated` is set\",\n type: { kind: \"string\" },\n },\n src: {\n description: \"Image source URL.\",\n required: true,\n type: { kind: \"string\" },\n },\n width: {\n description:\n \"Width in pixels. Under `intrinsic`, the rendered width, capped at the container; under `fluid`, an aspect-ratio hint; under `cover`, the wrapper's inline size (`aspectRatio` still derives the block size while `height` is unset).\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-adaptive\",\n condition: { kind: \"when-truthy\", prop: \"adaptive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-animated\",\n condition: { kind: \"when-truthy\", prop: \"animated\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-sequenced\",\n condition: { kind: \"when-non-empty\", prop: \"leadSrc\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-object-fit\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"cover\" },\n value: { kind: \"literal\", text: \"cover\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-shadow\",\n condition: { kind: \"when-truthy\", prop: \"shadow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-radius\",\n condition: { kind: \"when-truthy\", prop: \"radius\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-fluid\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"fluid\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"img\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"alt\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"alt\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"src\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{src}\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"srcset\",\n condition: { kind: \"when-non-empty\", prop: \"srcSet\" },\n value: { kind: \"prop\", prop: \"srcSet\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"fetchpriority\",\n condition: { kind: \"when-truthy\", prop: \"priority\" },\n value: { kind: \"literal\", text: \"high\" },\n },\n {\n target: { on: \"descendant\", selector: \"img\" },\n attribute: \"loading\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"lazy\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"priority\" } },\n ],\n },\n value: { kind: \"literal\", text: \"lazy\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\nimport type { SetTheme } from \"../root/root\";\n\nexport const SET_LIGHTSWITCH_TAG_NAME = \"set-lightswitch\";\nexport const SET_LIGHTSWITCH_EVENT_CHANGE = \"set-lightswitch-change\";\nexport const SET_LIGHTSWITCH_STORAGE_KEY = \"set-theme\";\n\nconst labelDarkDefault = \"Switch to dark theme\";\nconst labelLightDefault = \"Switch to light theme\";\n\nexport type SetLightswitchAppearance = \"outline\" | \"solid\" | \"text\";\nexport type SetLightswitchSize = \"sm\" | \"md\" | \"lg\";\n\nfunction oppositeTheme(theme: SetTheme): SetTheme {\n return theme === \"dark\" ? \"light\" : \"dark\";\n}\n\nfunction themeIconName(target: SetTheme): SetIconName {\n return target === \"dark\" ? \"moon\" : \"sunny\";\n}\n\nexport interface SetLightswitchProps {\n /** Structural style of the toggle button. @default \"text\" */\n appearance?: SetLightswitchAppearance;\n /** DOM id. */\n id?: string;\n /** Accessible label of the switch-to-dark action. @default \"Switch to dark theme\" */\n labelDark?: string;\n /** Accessible label of the switch-to-light action. @default \"Switch to light theme\" */\n labelLight?: string;\n /** Size variant. @default \"md\" */\n size?: SetLightswitchSize;\n}\n\nfunction buildOption(target: SetTheme, label: string): SetNode {\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"option\", \"data-option\": target },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: themeIconName(target),\n size: \"fill\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"label\" },\n children: [{ kind: \"text\", value: label }],\n },\n ],\n };\n}\n\n/**\n * Builds the IR tree for the Set lightswitch component.\n *\n * @param props - Lightswitch component props.\n * @returns IR node for a `set-lightswitch` host.\n */\nexport function buildSetLightswitch({\n appearance = \"text\",\n id,\n labelDark = labelDarkDefault,\n labelLight = labelLightDefault,\n size = \"md\",\n}: SetLightswitchProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedLabelDark =\n labelDark.trim() === \"\" ? labelDarkDefault : labelDark;\n const normalizedLabelLight =\n labelLight.trim() === \"\" ? labelLightDefault : labelLight;\n\n return {\n kind: \"element\",\n tag: SET_LIGHTSWITCH_TAG_NAME,\n attrs: {\n class: \"set-lightswitch\",\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n class: \"toggle\",\n \"data-appearance\": appearance,\n \"data-size\": size,\n type: \"button\",\n },\n children: [\n buildOption(\"dark\", normalizedLabelDark),\n buildOption(\"light\", normalizedLabelLight),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set lightswitch component.\n *\n * Emits an icon-only theme toggle button inside a `set-lightswitch` host. Both\n * actions (switch to dark, switch to light) are rendered; CSS shows the one\n * opposing the resolved theme, driven by `data-set-theme` on the Set root and\n * falling back to `prefers-color-scheme`, so the control is correct before —\n * and without — the runtime.\n *\n * @param props - Lightswitch component props.\n * @returns HTML string for a `set-lightswitch` host.\n */\nexport function renderSetLightswitch(props: SetLightswitchProps): string {\n return serializeSetNode(buildSetLightswitch(props));\n}\n\n/**\n * Defines the `set-lightswitch` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-lightswitch` hosts will\n * upgrade in place.\n *\n * The toggle shows two states but persists three: no stored value follows the\n * system preference, a stored `\"light\"`/`\"dark\"` (localStorage\n * `SET_LIGHTSWITCH_STORAGE_KEY`) overrides it. Activation targets the opposite of\n * the current resolved theme; when the target equals the system preference\n * the override is cleared instead of stored, so a value matching the system\n * is never pinned. Storage is only evaluated on user interaction — a system\n * preference change never rewrites the stored value. The theme is applied by\n * setting or removing `data-set-theme` on the closest Set root; the control's\n * face follows via CSS.\n */\nexport function defineSetLightswitch(): void {\n if (customElements.get(SET_LIGHTSWITCH_TAG_NAME)) return;\n\n class SetLightswitchElement extends HTMLElement {\n #onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest(\"button\")) return;\n\n const next = oppositeTheme(this.#resolvedTheme());\n\n if (next === this.#systemTheme()) {\n this.#clearStoredTheme();\n } else {\n this.#storeTheme(next);\n }\n\n this.#applyTheme();\n\n this.dispatchEvent(\n new CustomEvent(SET_LIGHTSWITCH_EVENT_CHANGE, {\n bubbles: true,\n detail: { stored: Boolean(this.#storedTheme()), theme: next },\n }),\n );\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n this.addEventListener(\"click\", this.#onClick);\n\n if (this.#storedTheme()) {\n this.#applyTheme();\n }\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n #storage(): Storage | undefined {\n try {\n return this.ownerDocument.defaultView?.localStorage;\n } catch {\n return undefined;\n }\n }\n\n #storedTheme(): SetTheme | undefined {\n try {\n const value = this.#storage()?.getItem(SET_LIGHTSWITCH_STORAGE_KEY);\n return value === \"light\" || value === \"dark\" ? value : undefined;\n } catch {\n return undefined;\n }\n }\n\n #storeTheme(theme: SetTheme): void {\n try {\n this.#storage()?.setItem(SET_LIGHTSWITCH_STORAGE_KEY, theme);\n } catch {\n /* storage unavailable — theme still applies for this page */\n }\n }\n\n #clearStoredTheme(): void {\n try {\n this.#storage()?.removeItem(SET_LIGHTSWITCH_STORAGE_KEY);\n } catch {\n /* storage unavailable — nothing to clear */\n }\n }\n\n #systemTheme(): SetTheme {\n const windowRef = this.ownerDocument.defaultView;\n if (!windowRef || typeof windowRef.matchMedia !== \"function\") {\n return \"light\";\n }\n return windowRef.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n }\n\n #root(): Element | null {\n return this.closest(\".set\");\n }\n\n #rootTheme(): SetTheme | undefined {\n const value = this.#root()?.getAttribute(\"data-set-theme\");\n return value === \"light\" || value === \"dark\" ? value : undefined;\n }\n\n #resolvedTheme(): SetTheme {\n return this.#storedTheme() ?? this.#rootTheme() ?? this.#systemTheme();\n }\n\n #applyTheme(): void {\n const root = this.#root();\n if (!root) return;\n\n const stored = this.#storedTheme();\n if (stored) {\n root.setAttribute(\"data-set-theme\", stored);\n } else {\n root.removeAttribute(\"data-set-theme\");\n }\n }\n }\n\n customElements.define(SET_LIGHTSWITCH_TAG_NAME, SetLightswitchElement);\n}\n\n/** Declarative lightswitch contract mirror for tooling, docs, and adapters. */\nexport const SET_LIGHTSWITCH_SPEC: SetComponentSpec = {\n name: \"lightswitch\",\n description:\n \"Use `lightswitch` to let users toggle between light and dark themes.\",\n output: { element: SET_LIGHTSWITCH_TAG_NAME, class: \"set-lightswitch\" },\n content: { kind: \"none\" },\n props: {\n appearance: {\n default: \"text\",\n description: \"Visual appearance of the toggle button.\",\n type: { kind: \"enum\", values: [\"outline\", \"solid\", \"text\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n labelDark: {\n default: labelDarkDefault,\n description: \"Accessible label of the switch-to-dark action.\",\n type: { kind: \"string\" },\n },\n labelLight: {\n default: labelLightDefault,\n description: \"Accessible label of the switch-to-light action.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n },\n events: {\n [SET_LIGHTSWITCH_EVENT_CHANGE]: {\n bubbles: true,\n description:\n \"Fired after activation applies a theme. `detail.theme` is the theme switched to; `detail.stored` is false when the change cleared the override to follow the system preference again.\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"toggle\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"data-appearance\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"appearance\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"button\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"button\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\nimport {\n buildSetButton,\n type SetButtonLabelVisibility,\n type SetButtonPlacement,\n} from \"../button/button\";\nimport type { SetIconMirrorMode, SetIconName } from \"../icon/icon\";\n\nexport const SET_MENU_TAG_NAME = \"set-menu\";\nexport const SET_MENU_EVENT_CHOOSE = \"set-menu-choose\";\nexport type SetMenuAlign = \"start\" | \"end\";\n\nexport interface SetMenuItem {\n /** Disables selection for this item. */\n disabled?: boolean;\n /** Optional authored identifier surfaced in the choose event payload. */\n id?: string;\n /** Visible item label text. Escaped before render. */\n label: string;\n}\n\nexport interface SetMenuProps {\n /** Popup alignment relative to the trigger. @default \"start\" */\n align?: SetMenuAlign;\n /** DOM id applied to the host. Trigger and popup ids are derived as `${id}-button` and `${id}-popup`. */\n id: string;\n /** Action items rendered inside the popup menu. */\n items: SetMenuItem[];\n /** Control size applied to the host and composed trigger button. @default \"md\" */\n size?: SetControlSize;\n /** Icon name for the trigger button. */\n triggerIcon?: SetIconName;\n /** Icon mirroring mode for the trigger button icon. */\n triggerIconMirrored?: SetIconMirrorMode;\n /** Icon placement within the trigger button. @default \"start\" */\n triggerIconPlacement?: SetButtonPlacement;\n /** Accessible and visible trigger label text. Escaped before render. */\n triggerLabel: string;\n /** Trigger label visibility treatment. @default \"visible\" */\n triggerLabelVisibility?: SetButtonLabelVisibility;\n}\n\n/**\n * Builds the IR tree for the Set menu component.\n *\n * @param props - Menu component props.\n * @returns IR node for a `set-menu` host.\n */\nexport function buildSetMenu({\n align = \"start\",\n id,\n items,\n size = \"md\",\n triggerIcon,\n triggerIconMirrored,\n triggerIconPlacement,\n triggerLabel,\n triggerLabelVisibility,\n}: SetMenuProps): SetNode {\n const normalizedId = id.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!Array.isArray(items)) {\n throw new Error(\"items must be an array.\");\n }\n\n const triggerId = `${normalizedId}-button`;\n const menuId = `${normalizedId}-popup`;\n\n const itemNodes: SetNode[] = items.map((item) => ({\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-disabled\": item.disabled ? \"true\" : undefined,\n \"data-item-id\": item.id || undefined,\n role: \"menuitem\",\n tabindex: \"-1\",\n type: \"button\",\n },\n children: [{ kind: \"text\", value: item.label }],\n }));\n\n return {\n kind: \"element\",\n tag: SET_MENU_TAG_NAME,\n attrs: {\n class: \"set-menu\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"trigger\" },\n children: [\n buildSetButton({\n appearance: \"outline\",\n controls: menuId,\n disclosure: true,\n haspopup: \"menu\",\n icon: triggerIcon,\n iconMirrored: triggerIconMirrored,\n iconPlacement: triggerIconPlacement,\n id: triggerId,\n label: triggerLabel,\n labelVisibility: triggerLabelVisibility,\n size,\n tone: \"neutral\",\n type: \"button\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n \"aria-labelledby\": triggerId,\n class: \"popup\",\n hidden: true,\n id: menuId,\n role: \"menu\",\n },\n children: itemNodes,\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set menu component.\n *\n * Emits a `set-menu` host containing a trigger button and a semantic\n * `role=\"menu\"` menu of button actions. Interactive open/close, focus\n * management, and choose events are deferred to custom element upgrade.\n *\n * @param props - Menu component props.\n * @returns HTML string for a `set-menu` host.\n */\nexport function renderSetMenu(props: SetMenuProps): string {\n return serializeSetNode(buildSetMenu(props));\n}\n\n/**\n * Defines the `set-menu` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-menu` hosts upgrade\n * in place and receive menu interaction behavior.\n */\nexport function defineSetMenu(): void {\n if (customElements.get(SET_MENU_TAG_NAME)) return;\n\n class SetMenuElement extends HTMLElement {\n #onClick?: (event: Event) => void;\n #onDocumentClick?: (event: Event) => void;\n #onFocusOut?: (event: FocusEvent) => void;\n #onKeyDown?: (event: KeyboardEvent) => void;\n\n connectedCallback(): void {\n this.#teardownListeners();\n this.#close(false);\n this.#setupListeners();\n }\n\n disconnectedCallback(): void {\n this.#teardownListeners();\n }\n\n #getTriggerButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"trigger\"] .set-button',\n );\n }\n\n #getMenu(): HTMLElement | null {\n return this.querySelector<HTMLElement>('[role=\"menu\"]');\n }\n\n #getMenuItems(): HTMLButtonElement[] {\n return Array.from(\n this.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]'),\n );\n }\n\n #isMenuItemDisabled(item: HTMLButtonElement): boolean {\n return item.getAttribute(\"aria-disabled\") === \"true\";\n }\n\n #isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n #setFocusedItem(index: number): void {\n const items = this.#getMenuItems();\n\n if (items.length === 0) return;\n\n const normalizedIndex =\n ((index % items.length) + items.length) % items.length;\n\n items[normalizedIndex]?.focus();\n }\n\n #open(focusIndex = 0): void {\n const menu = this.#getMenu();\n const trigger = this.#getTriggerButton();\n\n if (!menu || !trigger) return;\n\n menu.hidden = false;\n this.setAttribute(\"data-open\", \"\");\n trigger.setAttribute(\"aria-expanded\", \"true\");\n this.#setFocusedItem(focusIndex);\n }\n\n #close(restoreTriggerFocus = false): void {\n const menu = this.#getMenu();\n const trigger = this.#getTriggerButton();\n\n if (!menu || !trigger) return;\n\n menu.hidden = true;\n this.removeAttribute(\"data-open\");\n trigger.setAttribute(\"aria-expanded\", \"false\");\n\n if (restoreTriggerFocus) {\n trigger.focus();\n }\n }\n\n #choose(item: HTMLButtonElement): void {\n const allItems = Array.from(\n this.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]'),\n );\n const index = allItems.indexOf(item);\n\n this.dispatchEvent(\n new CustomEvent(SET_MENU_EVENT_CHOOSE, {\n bubbles: true,\n detail: {\n id: item.getAttribute(\"data-item-id\") || undefined,\n index,\n label: item.textContent || \"\",\n },\n }),\n );\n }\n\n #setupListeners(): void {\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n\n if (target.closest('[data-part=\"trigger\"] .set-button')) {\n if (this.#isOpen()) {\n this.#close();\n return;\n }\n\n this.#open(0);\n return;\n }\n\n const menuItem = target.closest<HTMLButtonElement>('[role=\"menuitem\"]');\n\n if (menuItem && this.contains(menuItem)) {\n if (!this.#isMenuItemDisabled(menuItem)) {\n this.#choose(menuItem);\n this.#close(true);\n }\n return;\n }\n };\n\n this.#onDocumentClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Node)) return;\n\n if (this.#isOpen() && !this.contains(target)) {\n this.#close();\n }\n };\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n const trigger = this.#getTriggerButton();\n const menu = this.#getMenu();\n\n if (!trigger || !menu) return;\n\n if ((event.key === \"Escape\" || event.key === \"Esc\") && this.#isOpen()) {\n event.preventDefault();\n this.#close(true);\n return;\n }\n\n const activeElement = this.ownerDocument.activeElement;\n const items = this.#getMenuItems();\n const currentIndex = items.indexOf(activeElement as HTMLButtonElement);\n\n if (activeElement === trigger) {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.#open(0);\n }\n\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.#open(0);\n }\n\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.#open(items.length - 1);\n }\n\n return;\n }\n\n if (!menu.contains(activeElement)) return;\n\n if (\n activeElement instanceof HTMLButtonElement &&\n (event.key === \"Enter\" || event.key === \" \")\n ) {\n event.preventDefault();\n\n if (!this.#isMenuItemDisabled(activeElement)) {\n this.#choose(activeElement);\n this.#close(true);\n }\n\n return;\n }\n\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.#setFocusedItem(currentIndex + 1);\n }\n\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.#setFocusedItem(currentIndex - 1);\n }\n\n if (event.key === \"Home\") {\n event.preventDefault();\n this.#setFocusedItem(0);\n }\n\n if (event.key === \"End\") {\n event.preventDefault();\n this.#setFocusedItem(items.length - 1);\n }\n\n if (event.key === \"Tab\") {\n this.#close(false);\n }\n };\n\n this.#onFocusOut = (event: FocusEvent) => {\n const nextTarget = event.relatedTarget;\n\n if (!(nextTarget instanceof Node)) {\n this.#close();\n return;\n }\n\n if (!this.contains(nextTarget)) {\n this.#close();\n }\n };\n\n this.addEventListener(\"click\", this.#onClick);\n this.addEventListener(\"keydown\", this.#onKeyDown);\n this.addEventListener(\"focusout\", this.#onFocusOut);\n this.ownerDocument.addEventListener(\"click\", this.#onDocumentClick);\n }\n\n #teardownListeners(): void {\n if (this.#onClick) {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n if (this.#onDocumentClick) {\n this.ownerDocument.removeEventListener(\"click\", this.#onDocumentClick);\n }\n\n if (this.#onKeyDown) {\n this.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#onFocusOut) {\n this.removeEventListener(\"focusout\", this.#onFocusOut);\n }\n\n this.#onClick = undefined;\n this.#onDocumentClick = undefined;\n this.#onFocusOut = undefined;\n this.#onKeyDown = undefined;\n }\n }\n\n customElements.define(SET_MENU_TAG_NAME, SetMenuElement);\n}\n\n/** Declarative menu contract mirror for tooling, docs, and adapters. */\nexport const SET_MENU_SPEC: SetComponentSpec = {\n name: \"menu\",\n description: \"Use `menu` to show a list of actions from a trigger button.\",\n output: {\n element: SET_MENU_TAG_NAME,\n class: \"set-menu\",\n },\n content: {\n kind: \"structured\",\n prop: \"items\",\n },\n props: {\n align: {\n default: \"start\",\n description: \"Popup alignment relative to the trigger.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description:\n \"DOM id applied to the host. Trigger and popup ids are derived as `${id}-button` and `${id}-popup`.\",\n required: true,\n type: { kind: \"string\" },\n },\n items: {\n description: \"Action items listed inside the popup.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n disabled: {\n default: false,\n description: \"Disables selection for this item.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description:\n \"Optional authored identifier surfaced in the choose event payload.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Visible item label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n triggerIcon: {\n description: \"Icon name for the trigger button.\",\n type: { kind: \"iconName\" },\n },\n triggerIconMirrored: {\n description: \"Icon mirroring mode for the trigger button icon.\",\n type: { kind: \"enum\", values: [\"always\", \"rtl\"] },\n },\n triggerIconPlacement: {\n default: \"start\",\n description: \"Icon placement within the trigger button.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n triggerLabel: {\n description: \"Accessible and visible trigger label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n triggerLabelVisibility: {\n default: \"visible\",\n description: \"Trigger label visibility treatment.\",\n type: {\n kind: \"enum\",\n values: [\"visible\", \"hidden\", \"hiddenBelowTablet\"],\n },\n },\n },\n events: {\n [SET_MENU_EVENT_CHOOSE]: {\n bubbles: true,\n description: \"Fired when a menu item is activated.\",\n detail: \"{ id?: string; index: number; label: string }\",\n },\n },\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: { kind: \"when-equals\", prop: \"align\", to: \"end\" },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: {\n on: \"descendant\",\n selector: 'div[data-part=\"trigger\"] button',\n },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-button\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-popup\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"aria-labelledby\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-button\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"role\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"menu\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.popup\" },\n attribute: \"hidden\",\n condition: { kind: \"always\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetExpanderSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface SetExpanderProps {\n /** Optional id of the controlled element (emitted as `aria-controls`). */\n controlsId?: string;\n /** Expanded state. @default false */\n expanded?: boolean;\n /** DOM id. */\n id?: string;\n /** Accessible label for the toggle control. @default \"Menu\" */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetExpanderSize;\n}\n\nconst expanderLabelDefault = \"Menu\";\n\n/**\n * Builds the IR tree for the Set expander control.\n *\n * @param props - Expander component props.\n * @returns IR node for a toggle button.\n */\nexport function buildSetExpander({\n controlsId,\n expanded,\n id,\n label = expanderLabelDefault,\n size = \"md\",\n}: SetExpanderProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedLabel = label.trim() === \"\" ? expanderLabelDefault : label;\n\n return {\n kind: \"element\",\n tag: \"button\",\n attrs: {\n \"aria-controls\": controlsId || undefined,\n \"aria-expanded\": expanded ? \"true\" : \"false\",\n class: \"set-expander\",\n \"data-size\": size,\n id: normalizedId,\n type: \"button\",\n },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"expander-box\" },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"expander-inner\" },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: normalizedLabel }],\n },\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set expander control.\n *\n * Emits a semantic `button` with accessible text and animated line glyph\n * wrapper markup.\n *\n * @param props - Expander component props.\n * @returns HTML string for a toggle button.\n */\nexport function renderSetExpander(props: SetExpanderProps = {}): string {\n return serializeSetNode(buildSetExpander(props));\n}\n\n/** Declarative expander contract mirror for tooling, docs, and adapters. */\nexport const SET_EXPANDER_SPEC: SetComponentSpec = {\n name: \"expander\",\n description:\n \"Use `expander` as a toggle for disclosure regions such as menus.\",\n output: { element: \"button\", class: \"set-expander\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n controlsId: {\n description: \"`id` of the element this toggle controls.\",\n type: { kind: \"string\" },\n },\n expanded: {\n default: false,\n description: \"Whether the controlled region is expanded.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n default: expanderLabelDefault,\n description: \"Accessible label.\",\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"button\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-expanded\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{expanded}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-controls\",\n condition: { kind: \"when-non-empty\", prop: \"controlsId\" },\n value: { kind: \"prop\", prop: \"controlsId\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId, normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetExpander } from \"../expander/expander\";\n\nexport const SET_NAV_TAG_NAME = \"set-nav\";\nexport type SetNavCollapsible = \"always\" | \"belowTablet\";\nexport type SetNavExpanderPosition = \"start\" | \"end\";\nexport type SetNavSize = \"sm\" | \"md\";\nconst scrollLockAttr = \"data-set-scroll-locked\";\n\nexport interface SetNavItem {\n /** Emits `aria-current=\"page\"` when true. @default false */\n current?: boolean;\n /** Link destination. */\n href: string;\n /** Link label (escaped before render). */\n label: string;\n}\n\nexport interface SetNavProps {\n /** Collapsible nav behavior. Emits `data-collapsible` as a structural hook for runtime enhancement. */\n collapsible?: SetNavCollapsible;\n /** ID applied to `.content`; also used as expander `aria-controls`. Required when `collapsible` is set. */\n contentId?: string;\n /** Accessible label for the runtime expander button when `collapsible` is set. */\n expanderLabel?: string;\n /** Expander placement when collapsible. @default \"start\" */\n expanderPosition?: SetNavExpanderPosition;\n /** DOM id. */\n id?: string;\n /** Nav items rendered as semantic list links. */\n items: SetNavItem[];\n /** Accessible nav label. */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetNavSize;\n}\n\n/**\n * Builds the IR tree for the Set nav component.\n *\n * @param props - Nav component props.\n * @returns IR node for a nav wrapper.\n */\nexport function buildSetNav({\n collapsible,\n contentId,\n expanderLabel,\n expanderPosition = \"start\",\n id,\n items,\n label,\n size = \"md\",\n}: SetNavProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedExpanderLabel = expanderLabel?.trim() || undefined;\n const normalizedContentId = contentId?.trim();\n\n if (collapsible && !normalizedContentId) {\n throw new Error(\n \"contentId must be a non-empty string when collapsible is set.\",\n );\n }\n\n if (normalizedContentId && !isValidHtmlId(normalizedContentId)) {\n throw new Error(\n \"contentId must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const listItems: SetNode[] = items.map((item) => ({\n kind: \"element\",\n tag: \"li\",\n attrs: {},\n children: [\n {\n kind: \"element\",\n tag: \"a\",\n attrs: {\n \"aria-current\": item.current ? \"page\" : undefined,\n class: \"item\",\n href: item.href,\n },\n children: [{ kind: \"text\", value: item.label }],\n },\n ],\n }));\n\n return {\n kind: \"element\",\n tag: SET_NAV_TAG_NAME,\n attrs: {\n class: \"set-nav\",\n \"data-collapsible\": collapsible,\n \"data-expander-label\":\n collapsible && normalizedExpanderLabel\n ? normalizedExpanderLabel\n : undefined,\n \"data-expander-position\": collapsible ? expanderPosition : undefined,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"nav\",\n attrs: {\n \"aria-label\": label || undefined,\n class: \"nav\",\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"content\",\n id: normalizedContentId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"ul\",\n attrs: { class: \"list\" },\n children: listItems,\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set nav component.\n *\n * Emits semantic `nav > ul > li > a` markup inside a `set-nav` host. When\n * `collapsible` is provided, the renderer emits structural hooks only;\n * interactive expander/menu behavior is deferred to custom element upgrade.\n *\n * @param props - Nav component props.\n * @returns HTML string for a nav wrapper.\n */\nexport function renderSetNav(props: SetNavProps): string {\n return serializeSetNode(buildSetNav(props));\n}\n\n/**\n * Defines the `set-nav` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-nav` hosts upgrade\n * in place and receive collapsible runtime behavior when configured.\n */\nexport function defineSetNav(): void {\n if (customElements.get(SET_NAV_TAG_NAME)) return;\n\n class SetNavElement extends HTMLElement {\n #onClick?: (event: Event) => void;\n #mediaQueryList?: MediaQueryList;\n #onKeyDown?: (event: KeyboardEvent) => void;\n #onMediaQueryChange?: (event: MediaQueryListEvent) => void;\n\n connectedCallback(): void {\n this.#teardownClickListener();\n this.#teardownRuntimeListeners();\n this.#ensureExpander();\n this.#setupClickListener();\n this.#setupRuntimeListeners();\n }\n\n disconnectedCallback(): void {\n this.#setExpanded(false);\n this.#teardownClickListener();\n this.#teardownRuntimeListeners();\n }\n\n #getNav(): HTMLElement | null {\n if (!this.hasAttribute(\"data-collapsible\")) return null;\n\n return this.querySelector<HTMLElement>(\".nav\");\n }\n\n #getExpanderButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"expander\"] .set-expander',\n );\n }\n\n #ensureExpander(): void {\n const nav = this.#getNav();\n\n if (!nav) return;\n if (nav.querySelector('[data-part=\"expander\"]')) return;\n\n const content = nav.querySelector<HTMLElement>(\".content\");\n\n if (!content) return;\n\n nav.insertAdjacentHTML(\n \"afterbegin\",\n `<div data-part=\"expander\">${renderSetExpander({\n controlsId: content.id || undefined,\n label: this.getAttribute(\"data-expander-label\") || undefined,\n size: this.getAttribute(\"data-size\") === \"sm\" ? \"md\" : \"lg\",\n })}</div>`,\n );\n }\n\n #setExpanded(expanded: boolean): void {\n const button = this.#getExpanderButton();\n\n if (!button) return;\n\n const isOpen = button.getAttribute(\"aria-expanded\") === \"true\";\n\n if (isOpen === expanded) return;\n\n button.setAttribute(\"aria-expanded\", expanded ? \"true\" : \"false\");\n this.#setScrollLocked(expanded);\n }\n\n #setupClickListener(): void {\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n if (!target.closest('[data-part=\"expander\"] .set-expander')) return;\n\n const button = this.#getExpanderButton();\n\n if (!button) return;\n\n this.#setExpanded(button.getAttribute(\"aria-expanded\") !== \"true\");\n };\n\n this.addEventListener(\"click\", this.#onClick);\n }\n\n #setupRuntimeListeners(): void {\n const nav = this.#getNav();\n const windowRef = this.ownerDocument.defaultView;\n\n if (!nav || !windowRef) return;\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" && event.key !== \"Esc\") return;\n this.#setExpanded(false);\n };\n\n windowRef.addEventListener(\"keydown\", this.#onKeyDown);\n\n if (this.getAttribute(\"data-collapsible\") !== \"belowTablet\") return;\n if (typeof windowRef.matchMedia !== \"function\") return;\n\n const mediaQueryList = windowRef.matchMedia(\"(min-width: 48em)\");\n\n this.#mediaQueryList = mediaQueryList;\n this.#onMediaQueryChange = (event: MediaQueryListEvent) => {\n if (!event.matches) return;\n this.#setExpanded(false);\n };\n\n mediaQueryList.addEventListener(\"change\", this.#onMediaQueryChange);\n }\n\n #setScrollLocked(locked: boolean): void {\n const root = this.ownerDocument.documentElement;\n\n if (!root) return;\n\n if (locked) {\n root.setAttribute(scrollLockAttr, \"\");\n return;\n }\n\n root.removeAttribute(scrollLockAttr);\n }\n\n #teardownClickListener(): void {\n if (!this.#onClick) return;\n\n this.removeEventListener(\"click\", this.#onClick);\n this.#onClick = undefined;\n }\n\n #teardownRuntimeListeners(): void {\n const windowRef = this.ownerDocument.defaultView;\n\n if (this.#onKeyDown && windowRef) {\n windowRef.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#mediaQueryList && this.#onMediaQueryChange) {\n this.#mediaQueryList.removeEventListener(\n \"change\",\n this.#onMediaQueryChange,\n );\n }\n\n this.#onKeyDown = undefined;\n this.#onMediaQueryChange = undefined;\n this.#mediaQueryList = undefined;\n }\n }\n\n customElements.define(SET_NAV_TAG_NAME, SetNavElement);\n}\n\n/** Declarative nav contract mirror for tooling, docs, and adapters. */\nexport const SET_NAV_SPEC: SetComponentSpec = {\n name: \"nav\",\n description: \"Use `nav` to render a primary navigation list.\",\n output: { element: SET_NAV_TAG_NAME, class: \"set-nav\" },\n content: { kind: \"structured\", prop: \"items\" },\n props: {\n items: {\n description: \"Nav links shown in the list.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n current: {\n default: false,\n description: 'Emits `aria-current=\"page\"` when true.',\n type: { kind: \"boolean\" },\n },\n href: {\n description: \"Link destination.\",\n required: true,\n type: { kind: \"string\" },\n },\n label: {\n description: \"Link label.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n },\n },\n label: {\n description: \"Accessible label for the nav landmark.\",\n type: { kind: \"string\" },\n },\n expanderLabel: {\n description: \"Accessible label for the collapsible expander button.\",\n type: { kind: \"string\" },\n },\n expanderPosition: {\n default: \"start\",\n description: \"Where the expander sits within the composition.\",\n type: { kind: \"enum\", values: [\"start\", \"end\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n collapsible: {\n description: \"When to collapse the nav behind an expander.\",\n type: { kind: \"enum\", values: [\"always\", \"belowTablet\"] },\n },\n contentId: {\n description: \"`id` for the collapsible content region.\",\n requiredWhen: \"`collapsible` is provided\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-collapsible\",\n condition: { kind: \"when-provided\", prop: \"collapsible\" },\n value: { kind: \"prop\", prop: \"collapsible\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-expander-position\",\n condition: { kind: \"when-provided\", prop: \"collapsible\" },\n value: { kind: \"prop\", prop: \"expanderPosition\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-expander-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"collapsible\" },\n { kind: \"when-non-empty\", prop: \"expanderLabel\" },\n ],\n },\n value: { kind: \"prop\", prop: \"expanderLabel\" },\n },\n {\n target: { on: \"descendant\", selector: \"nav\" },\n attribute: \"aria-label\",\n condition: { kind: \"when-non-empty\", prop: \"label\" },\n value: { kind: \"prop\", prop: \"label\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.content\" },\n attribute: \"id\",\n condition: { kind: \"when-provided\", prop: \"contentId\" },\n value: { kind: \"prop\", prop: \"contentId\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport const SET_RANGE_TAG_NAME = \"set-range\";\n\nexport interface SetRangeProps {\n /** Helper text rendered after the range. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Range id; used for input/output/label wiring. */\n id: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Label text content (escaped before render). */\n label: string;\n /** Maximum value. */\n max?: number;\n /** Minimum value. */\n min?: number;\n /** Field name. */\n name?: string;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Step value. */\n step?: number;\n /** Current value. */\n value?: number;\n}\n\n/**\n * Builds the IR tree for the Set range component.\n *\n * @param props - Range component props.\n * @returns IR node for a `set-range` host.\n */\nexport function buildSetRange({\n description,\n disabled,\n id,\n inlineSize = \"full\",\n label,\n max,\n min,\n name,\n size = \"md\",\n step,\n value,\n}: SetRangeProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedName = name?.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"label-wrapper\" },\n children: [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"output\",\n attrs: { class: \"output\", for: normalizedId },\n children:\n value != null ? [{ kind: \"text\", value: String(value) }] : [],\n },\n ],\n },\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n class: \"range\",\n disabled: Boolean(disabled),\n id: normalizedId,\n max: max != null ? String(max) : undefined,\n min: min != null ? String(min) : undefined,\n name: normalizedName || undefined,\n step: step != null ? String(step) : undefined,\n type: \"range\",\n value: value != null ? String(value) : undefined,\n },\n children: [],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: SET_RANGE_TAG_NAME,\n attrs: {\n class: \"set-range\",\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n \"data-size\": size,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set range component.\n *\n * Emits semantic range markup inside a `set-range` host. The runtime custom\n * element hydrates the `.output` element from the current input value.\n *\n * @param props - Range component props.\n * @returns HTML string for a `set-range` host.\n */\nexport function renderSetRange(props: SetRangeProps): string {\n return serializeSetNode(buildSetRange(props));\n}\n\n/**\n * Defines the `set-range` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-range` hosts\n * upgrade in place and keep `.output` synchronized with the current value.\n */\nexport function defineSetRange(): void {\n if (customElements.get(SET_RANGE_TAG_NAME)) return;\n\n class SetRangeElement extends HTMLElement {\n #inputWithValueSync: HTMLInputElement | undefined;\n\n #onInput = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof HTMLInputElement)) return;\n if (!target.matches(\".range\")) return;\n\n this.#syncOutput();\n };\n\n connectedCallback(): void {\n this.removeEventListener(\"input\", this.#onInput);\n this.#installValueSync();\n this.#syncOutput();\n this.addEventListener(\"input\", this.#onInput);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"input\", this.#onInput);\n this.#removeValueSync();\n }\n\n #syncOutput(): void {\n const input = this.querySelector<HTMLInputElement>(\".range\");\n const output = this.querySelector<HTMLOutputElement>(\".output\");\n\n if (!input || !output) return;\n\n this.#setOutputText(output, input.value);\n }\n\n #setOutputText(output: HTMLOutputElement, value: string): void {\n const child = output.firstChild;\n\n if (\n child?.nodeType === Node.TEXT_NODE &&\n output.childNodes.length === 1\n ) {\n if (child.nodeValue !== value) child.nodeValue = value;\n return;\n }\n\n if (output.textContent !== value) output.textContent = value;\n }\n\n // Programmatic `input.value = x` (controlled frameworks, scripts) does\n // not fire an `input` event, so the output wouldn't track it. Override\n // the instance's `value` accessor to sync the output on set, restoring\n // the prototype behaviour on disconnect.\n #installValueSync(): void {\n const input = this.querySelector<HTMLInputElement>(\".range\");\n if (!input || input === this.#inputWithValueSync) return;\n\n this.#removeValueSync();\n\n const descriptor = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n );\n if (!descriptor?.get || !descriptor.set) return;\n\n const getValue = descriptor.get;\n const setValue = descriptor.set;\n const syncOutput = () => this.#syncOutput();\n Object.defineProperty(input, \"value\", {\n configurable: true,\n enumerable: descriptor.enumerable,\n get(): string {\n return getValue.call(this) as string;\n },\n set(value: string): void {\n setValue.call(this, value);\n syncOutput();\n },\n });\n\n this.#inputWithValueSync = input;\n }\n\n #removeValueSync(): void {\n if (!this.#inputWithValueSync) return;\n delete (this.#inputWithValueSync as { value?: string }).value;\n this.#inputWithValueSync = undefined;\n }\n }\n\n customElements.define(SET_RANGE_TAG_NAME, SetRangeElement);\n}\n\n/** Declarative range contract mirror for tooling, docs, and adapters. */\nexport const SET_RANGE_SPEC: SetComponentSpec = {\n name: \"range\",\n description: \"Use `range` to let users pick a numeric value along a scale.\",\n output: { element: SET_RANGE_TAG_NAME, class: \"set-range\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n description: {\n description: \"Helper text shown below the range.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the range.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` used to associate the input with its label.\",\n required: true,\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"How the range fills its container.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n max: {\n description: \"Maximum value.\",\n type: { kind: \"number\" },\n },\n min: {\n description: \"Minimum value.\",\n type: { kind: \"number\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n step: {\n description: \"Granularity of value changes.\",\n type: { kind: \"number\" },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"range\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"range\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"min\",\n condition: { kind: \"when-provided\", prop: \"min\" },\n value: { kind: \"template\", pattern: \"{min}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"max\",\n condition: { kind: \"when-provided\", prop: \"max\" },\n value: { kind: \"template\", pattern: \"{max}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"step\",\n condition: { kind: \"when-provided\", prop: \"step\" },\n value: { kind: \"template\", pattern: \"{step}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-provided\", prop: \"value\" },\n value: { kind: \"template\", pattern: \"{value}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"template\", pattern: \"{name}\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n buildSetButton,\n renderSetButton,\n type SetButtonSize,\n} from \"../button/button\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport const SET_SIDEBAR_TAG_NAME = \"set-sidebar\";\nexport type SetSidebarAboveNotebook = \"persistent\" | \"collapsible\" | \"overlay\";\n\nconst aboveNotebookMedia = \"(min-width: 68em)\";\nconst collapseLabelDefault = \"Collapse sidebar\";\nconst triggerLabelDefault = \"Open sidebar\";\n\nexport interface SetSidebarProps {\n /** Behavior above the notebook breakpoint. @default \"persistent\" */\n aboveNotebook?: SetSidebarAboveNotebook;\n /** Size of the trigger and collapse buttons. @default \"md\" */\n buttonSize?: SetButtonSize;\n /** Content region markup rendered inside `.content`. Caller sanitizes untrusted content. */\n children?: string;\n /** Accessible label for the runtime collapse/close button. @default \"Collapse sidebar\" */\n collapseLabel?: string;\n /** Optional footer region markup. Caller sanitizes untrusted content. */\n footer?: string;\n /** Optional header region markup. Caller sanitizes untrusted content. */\n header?: string;\n /** DOM id applied to the host. The inner panel id is derived as `${id}-panel` and referenced by the trigger via `aria-controls`. */\n id: string;\n /** Surface context. Emits `data-set-surface` on the inner panel when provided. */\n surface?: SetSurfaceVariant;\n /** Accessible label for the component-owned trigger. @default \"Open sidebar\" */\n triggerLabel?: string;\n}\n\nfunction createCloseButtonMarkup(\n label: string,\n buttonSize: SetButtonSize,\n): string {\n return `<div data-part=\"close\">${renderSetButton({\n appearance: \"text\",\n icon: \"panel-left\",\n iconMirrored: \"rtl\",\n label,\n labelVisibility: \"hidden\",\n size: buttonSize,\n tone: \"neutral\",\n type: \"button\",\n })}</div>`;\n}\n\n/**\n * Builds the IR tree for the Set sidebar component.\n *\n * @param props - Sidebar component props.\n * @returns IR node for a `set-sidebar` host.\n */\nexport function buildSetSidebar({\n aboveNotebook = \"persistent\",\n buttonSize = \"md\",\n children,\n collapseLabel = collapseLabelDefault,\n footer,\n header,\n id,\n surface,\n triggerLabel = triggerLabelDefault,\n}: SetSidebarProps): SetNode {\n const normalizedId = id.trim();\n const normalizedCollapseLabel = collapseLabel.trim() || collapseLabelDefault;\n const normalizedTriggerLabel = triggerLabel.trim() || triggerLabelDefault;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const sidebarChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"header\" },\n children: header ? [{ kind: \"raw\", html: header }] : [],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ];\n\n if (footer) {\n sidebarChildren.push({\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"footer\" },\n children: [{ kind: \"raw\", html: footer }],\n });\n }\n\n const panelId = `${normalizedId}-panel`;\n\n return {\n kind: \"element\",\n tag: SET_SIDEBAR_TAG_NAME,\n attrs: {\n class: \"set-sidebar\",\n \"data-above-notebook\": aboveNotebook,\n \"data-collapse-label\":\n normalizedCollapseLabel !== collapseLabelDefault\n ? normalizedCollapseLabel\n : undefined,\n \"data-button-size\": buttonSize,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"trigger\" },\n children: [\n buildSetButton({\n appearance: \"text\",\n controls: panelId,\n disclosure: true,\n icon: \"panel-left\",\n iconMirrored: \"rtl\",\n label: normalizedTriggerLabel,\n labelVisibility: \"hidden\",\n size: buttonSize,\n tone: \"neutral\",\n type: \"button\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"sidebar\",\n \"data-set-surface\": surface,\n id: panelId,\n tabindex: \"-1\",\n },\n children: sidebarChildren,\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { \"data-part\": \"backdrop\" },\n children: [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set sidebar component.\n *\n * Emits a component-owned trigger plus structural sidebar markup inside a\n * `set-sidebar` host. The host also owns a backdrop element used for overlay\n * dismissal on narrow screens. Above notebook width, behavior is controlled by\n * `aboveNotebook`. Page-shell layout decisions are intentionally left to parent\n * composition.\n *\n * @param props - Sidebar component props.\n * @returns HTML string for a `set-sidebar` host.\n */\nexport function renderSetSidebar(props: SetSidebarProps): string {\n return serializeSetNode(buildSetSidebar(props));\n}\n\n/**\n * Defines the `set-sidebar` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-sidebar` hosts\n * upgrade in place and receive owned-trigger open/close behavior.\n */\nexport function defineSetSidebar(): void {\n if (customElements.get(SET_SIDEBAR_TAG_NAME)) return;\n\n class SetSidebarElement extends HTMLElement {\n #mediaQuery?: MediaQueryList;\n #onClick?: (event: Event) => void;\n #onKeyDown?: (event: KeyboardEvent) => void;\n #onMediaChange?: (event: MediaQueryListEvent) => void;\n\n connectedCallback(): void {\n this.#teardownListeners();\n this.#ensureCloseControl();\n this.#syncResponsiveState();\n this.#setupListeners();\n }\n\n disconnectedCallback(): void {\n this.close();\n this.#teardownListeners();\n }\n\n open(): void {\n this.#setOpen(true);\n }\n\n close(): void {\n this.#setOpen(false);\n }\n\n #getSidebar(): HTMLElement | null {\n return this.querySelector<HTMLElement>(\".sidebar\");\n }\n\n #getCloseButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"close\"] .set-button',\n );\n }\n\n #getTriggerButton(): HTMLButtonElement | null {\n return this.querySelector<HTMLButtonElement>(\n '[data-part=\"trigger\"] .set-button',\n );\n }\n\n #isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n #isCollapsed(): boolean {\n return this.hasAttribute(\"data-collapsed\");\n }\n\n #getAboveNotebook(): SetSidebarAboveNotebook {\n const value = this.getAttribute(\"data-above-notebook\");\n\n if (value === \"collapsible\" || value === \"overlay\") return value;\n\n return \"persistent\";\n }\n\n #ensureCloseControl(): void {\n const sidebar = this.#getSidebar();\n\n if (!sidebar) return;\n if (sidebar.querySelector('[data-part=\"close\"]')) return;\n\n const header = sidebar.querySelector<HTMLElement>(\".header\");\n const collapseLabel =\n this.getAttribute(\"data-collapse-label\") || collapseLabelDefault;\n const buttonSize = (this.getAttribute(\"data-button-size\") ??\n \"md\") as SetButtonSize;\n\n header?.insertAdjacentHTML(\n \"beforeend\",\n createCloseButtonMarkup(collapseLabel, buttonSize),\n );\n }\n\n #removeCloseControl(): void {\n this.querySelector('[data-part=\"close\"]')?.remove();\n }\n\n #focusSidebar(): void {\n const closeButton = this.#getCloseButton();\n\n if (closeButton) {\n closeButton.focus();\n return;\n }\n\n this.#getSidebar()?.focus();\n }\n\n #isAboveNotebook(): boolean {\n return this.#mediaQuery?.matches ?? false;\n }\n\n #setState({\n collapsed,\n open,\n }: {\n collapsed: boolean;\n open: boolean;\n }): void {\n const trigger = this.#getTriggerButton();\n\n this.toggleAttribute(\"data-open\", open);\n this.toggleAttribute(\"data-collapsed\", collapsed);\n trigger?.setAttribute(\"aria-expanded\", open ? \"true\" : \"false\");\n }\n\n #syncResponsiveState(): void {\n const aboveNotebook = this.#getAboveNotebook();\n\n if (this.#isAboveNotebook()) {\n if (aboveNotebook === \"overlay\") {\n this.#ensureCloseControl();\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n\n return;\n }\n\n if (aboveNotebook === \"collapsible\") {\n this.#ensureCloseControl();\n this.#setState({\n collapsed: this.#isCollapsed(),\n open: true,\n });\n this.#setScrollLocked(false);\n\n return;\n }\n\n this.#removeCloseControl();\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(false);\n\n return;\n }\n\n this.#ensureCloseControl();\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n }\n\n #setOpen(open: boolean): void {\n const aboveNotebook = this.#getAboveNotebook();\n\n if (this.#isAboveNotebook()) {\n if (aboveNotebook === \"persistent\") {\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(false);\n\n return;\n }\n\n if (aboveNotebook === \"collapsible\") {\n this.#setState({ collapsed: !open, open: true });\n this.#setScrollLocked(false);\n\n if (open) this.#focusSidebar();\n\n return;\n }\n }\n\n if (this.#isOpen() === open) return;\n\n if (open) {\n this.#setState({ collapsed: false, open: true });\n this.#setScrollLocked(true);\n this.#focusSidebar();\n\n return;\n }\n\n this.#setState({ collapsed: false, open: false });\n this.#setScrollLocked(false);\n this.#getTriggerButton()?.focus();\n }\n\n #setScrollLocked(locked: boolean): void {\n const root = this.ownerDocument.documentElement;\n\n if (!root) return;\n\n if (locked) {\n root.setAttribute(\"data-set-scroll-locked\", \"\");\n return;\n }\n\n root.removeAttribute(\"data-set-scroll-locked\");\n }\n\n #setupListeners(): void {\n const windowRef = this.ownerDocument.defaultView;\n\n if (!windowRef) return;\n\n if (typeof windowRef.matchMedia === \"function\") {\n this.#mediaQuery = windowRef.matchMedia(aboveNotebookMedia);\n this.#onMediaChange = () => {\n this.#syncResponsiveState();\n };\n this.#mediaQuery.addEventListener(\"change\", this.#onMediaChange);\n this.#syncResponsiveState();\n }\n\n this.#onClick = (event: Event) => {\n const target = event.target;\n\n if (!(target instanceof Element)) return;\n\n if (target.closest('[data-part=\"trigger\"] .set-button')) {\n this.open();\n return;\n }\n\n if (target.closest('[data-part=\"close\"] .set-button')) {\n if (\n this.#isAboveNotebook() &&\n this.#getAboveNotebook() === \"collapsible\"\n ) {\n this.#setOpen(this.#isCollapsed());\n return;\n }\n\n this.close();\n return;\n }\n\n if (target.closest('[data-part=\"backdrop\"]')) {\n this.close();\n }\n };\n\n this.#onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" && event.key !== \"Esc\") return;\n this.close();\n };\n\n this.addEventListener(\"click\", this.#onClick);\n this.addEventListener(\"keydown\", this.#onKeyDown);\n }\n\n #teardownListeners(): void {\n if (this.#onClick) {\n this.removeEventListener(\"click\", this.#onClick);\n }\n\n if (this.#onKeyDown) {\n this.removeEventListener(\"keydown\", this.#onKeyDown);\n }\n\n if (this.#mediaQuery && this.#onMediaChange) {\n this.#mediaQuery.removeEventListener(\"change\", this.#onMediaChange);\n }\n\n this.#onClick = undefined;\n this.#onKeyDown = undefined;\n this.#mediaQuery = undefined;\n this.#onMediaChange = undefined;\n }\n }\n\n customElements.define(SET_SIDEBAR_TAG_NAME, SetSidebarElement);\n}\n\n/** Declarative sidebar contract mirror for tooling, docs, and adapters. */\nexport const SET_SIDEBAR_SPEC: SetComponentSpec = {\n name: \"sidebar\",\n description: \"Use `sidebar` for a side panel alongside main content.\",\n output: {\n element: SET_SIDEBAR_TAG_NAME,\n class: \"set-sidebar\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"header\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n { prop: \"footer\", kind: \"html\" },\n ],\n },\n props: {\n aboveNotebook: {\n default: \"persistent\",\n description: \"Layout behaviour on wider screens.\",\n type: {\n kind: \"enum\",\n values: [\"persistent\", \"collapsible\", \"overlay\"],\n },\n },\n buttonSize: {\n default: \"md\",\n description: \"Size of the trigger and collapse buttons.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n children: {\n description: \"Sidebar body content.\",\n type: { kind: \"html\" },\n },\n collapseLabel: {\n default: collapseLabelDefault,\n description: \"Accessible label for the collapse button.\",\n type: { kind: \"string\" },\n },\n footer: {\n description: \"Content rendered in the sidebar footer.\",\n type: { kind: \"html\" },\n },\n header: {\n description: \"Content rendered in the sidebar header.\",\n type: { kind: \"html\" },\n },\n id: {\n description:\n \"DOM id applied to the host. The inner panel id is derived as `${id}-panel` and wired to the trigger via `aria-controls`.\",\n required: true,\n type: { kind: \"string\" },\n },\n surface: {\n description: \"Surface context. Applied to the inner panel.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n triggerLabel: {\n default: triggerLabelDefault,\n description: \"Accessible label for the open button.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-above-notebook\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"aboveNotebook\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-button-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"buttonSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-collapse-label\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-non-empty\", prop: \"collapseLabel\" },\n {\n kind: \"not\",\n of: {\n kind: \"when-equals\",\n prop: \"collapseLabel\",\n to: collapseLabelDefault,\n },\n },\n ],\n },\n value: { kind: \"prop\", prop: \"collapseLabel\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}-panel\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"tabindex\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"-1\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.sidebar\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport const SET_VIDEO_TAG_NAME = \"set-video\";\n\nexport type SetVideoFit = \"intrinsic\" | \"fluid\";\nexport type SetVideoPreload = \"auto\" | \"metadata\" | \"none\";\n\nexport interface SetVideoProps {\n /** Starts playback automatically. @default false */\n autoPlay?: boolean;\n /** Shows native playback controls. @default false */\n controls?: boolean;\n /** Layout mode. @default \"intrinsic\" */\n fit?: SetVideoFit;\n /** Intrinsic height in pixels. */\n height?: number;\n /** DOM id. */\n id?: string;\n /** Restarts playback when the video ends. @default false */\n loop?: boolean;\n /** Starts playback silent. @default false */\n muted?: boolean;\n /** Plays inline instead of fullscreen on iOS. @default false */\n playsInline?: boolean;\n /** Image URL shown before playback begins. */\n poster?: string;\n /** Preload hint (HTML `video[preload]`). */\n preload?: SetVideoPreload;\n /** Video source URL. */\n src: string;\n /** Intrinsic width in pixels. */\n width?: number;\n}\n\n/**\n * Builds the IR tree for the Set video component.\n *\n * @param props - Video component props.\n * @returns IR node for video markup.\n */\nexport function buildSetVideo({\n autoPlay,\n controls,\n fit = \"intrinsic\",\n height,\n id,\n loop,\n muted,\n playsInline,\n poster,\n preload,\n src,\n width,\n}: SetVideoProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedSrc = src.trim();\n const normalizedPoster = poster?.trim();\n\n if (!normalizedSrc) {\n throw new Error(\"src must be a non-empty string.\");\n }\n\n const videoNode: SetNode = {\n kind: \"element\",\n tag: \"video\",\n attrs: {\n autoplay: Boolean(autoPlay),\n class: \"video\",\n controls: Boolean(controls),\n height: height ? String(height) : undefined,\n loop: Boolean(loop),\n muted: Boolean(muted),\n playsinline: Boolean(playsInline),\n poster: normalizedPoster || undefined,\n preload,\n src: normalizedSrc,\n width: width ? String(width) : undefined,\n },\n children: [],\n };\n\n return {\n kind: \"element\",\n tag: SET_VIDEO_TAG_NAME,\n attrs: {\n class: \"set-video\",\n \"data-fluid\": fit === \"fluid\",\n id: normalizedId,\n },\n children: [videoNode],\n };\n}\n\n/**\n * SSR renderer for the Set video component.\n *\n * Emits meaningful light-DOM HTML inside a `set-video` host. When `autoPlay`\n * is set, runtime hydration pauses playback while the user prefers reduced\n * motion and resumes it if the preference relaxes.\n *\n * @param props - Video component props.\n * @returns HTML string for video markup.\n */\nexport function renderSetVideo(props: SetVideoProps): string {\n return serializeSetNode(buildSetVideo(props));\n}\n\nconst reducedMotionMedia = \"(prefers-reduced-motion: reduce)\";\n\n/**\n * Defines the `set-video` custom element runtime.\n *\n * Safe to call multiple times. Existing SSR-rendered `set-video` hosts will\n * upgrade in place. Hosts whose video declares `autoplay` are paused while\n * `(prefers-reduced-motion: reduce)` matches — the `autoplay` attribute is\n * withdrawn so pending playback cannot start — and resume when it stops\n * matching.\n */\nexport function defineSetVideo(): void {\n if (customElements.get(SET_VIDEO_TAG_NAME)) return;\n\n class SetVideoElement extends HTMLElement {\n #autoPlayIntent = false;\n #mediaQuery: MediaQueryList | undefined;\n #onMediaChange: (() => void) | undefined;\n\n connectedCallback(): void {\n const video = this.querySelector(\"video\");\n if (!video) return;\n\n this.#autoPlayIntent ||= video.hasAttribute(\"autoplay\");\n if (!this.#autoPlayIntent) return;\n\n const windowRef = this.ownerDocument.defaultView;\n if (!windowRef || typeof windowRef.matchMedia !== \"function\") return;\n\n this.#mediaQuery = windowRef.matchMedia(reducedMotionMedia);\n this.#onMediaChange = () => {\n this.#syncPlayback();\n };\n this.#mediaQuery.addEventListener(\"change\", this.#onMediaChange);\n this.#syncPlayback();\n }\n\n disconnectedCallback(): void {\n if (this.#mediaQuery && this.#onMediaChange) {\n this.#mediaQuery.removeEventListener(\"change\", this.#onMediaChange);\n }\n this.#mediaQuery = undefined;\n this.#onMediaChange = undefined;\n }\n\n #syncPlayback(): void {\n const video = this.querySelector(\"video\");\n if (!video || !this.#mediaQuery) return;\n\n if (this.#mediaQuery.matches) {\n video.removeAttribute(\"autoplay\");\n video.pause();\n } else {\n video.setAttribute(\"autoplay\", \"\");\n if (video.paused) {\n void video.play()?.catch?.(() => {});\n }\n }\n }\n }\n\n customElements.define(SET_VIDEO_TAG_NAME, SetVideoElement);\n}\n\n/** Declarative video contract mirror for tooling, docs, and adapters. */\nexport const SET_VIDEO_SPEC: SetComponentSpec = {\n name: \"video\",\n description:\n \"Use `video` to render a video with intrinsic or fluid fit and native playback behavior.\",\n output: { element: SET_VIDEO_TAG_NAME, class: \"set-video\" },\n content: { kind: \"none\" },\n props: {\n autoPlay: {\n default: false,\n description:\n \"Starts playback automatically. Browsers only honor this when `muted` is also set. Suspended when the user prefers reduced motion.\",\n type: { kind: \"boolean\" },\n },\n controls: {\n default: false,\n description: \"Shows the browser's native playback controls.\",\n type: { kind: \"boolean\" },\n },\n fit: {\n default: \"intrinsic\",\n description:\n \"Layout mode. `intrinsic` renders at the video's own dimensions, `fluid` scales to the container's full inline size at the video's aspect ratio.\",\n type: { kind: \"enum\", values: [\"intrinsic\", \"fluid\"] },\n },\n height: {\n description:\n \"Intrinsic height in pixels. With `width`, reserves the correctly shaped box before the media loads; rendered height always follows the aspect ratio.\",\n type: { kind: \"number\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n loop: {\n default: false,\n description: \"Restarts playback when the video ends.\",\n type: { kind: \"boolean\" },\n },\n muted: {\n default: false,\n description:\n \"Starts playback silent. Required for `autoPlay` to take effect in most browsers.\",\n type: { kind: \"boolean\" },\n },\n playsInline: {\n default: false,\n description:\n \"Plays inline instead of fullscreen on iOS. Required for `autoPlay` on iOS.\",\n type: { kind: \"boolean\" },\n },\n poster: {\n description: \"Image URL shown before playback begins.\",\n type: { kind: \"string\" },\n },\n preload: {\n description:\n \"Preload hint. Omitted by default, deferring to the browser.\",\n type: { kind: \"enum\", values: [\"auto\", \"metadata\", \"none\"] },\n },\n src: {\n description: \"Video source URL.\",\n required: true,\n type: { kind: \"string\" },\n },\n width: {\n description:\n \"Intrinsic width in pixels. Sets the rendered width, capped at the container; under `fluid`, an aspect-ratio hint only.\",\n type: { kind: \"number\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-fluid\",\n condition: { kind: \"when-equals\", prop: \"fit\", to: \"fluid\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"video\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"src\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{src}\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"autoplay\",\n condition: { kind: \"when-truthy\", prop: \"autoPlay\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"controls\",\n condition: { kind: \"when-truthy\", prop: \"controls\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"loop\",\n condition: { kind: \"when-truthy\", prop: \"loop\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"muted\",\n condition: { kind: \"when-truthy\", prop: \"muted\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"playsinline\",\n condition: { kind: \"when-truthy\", prop: \"playsInline\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"poster\",\n condition: { kind: \"when-non-empty\", prop: \"poster\" },\n value: { kind: \"prop\", prop: \"poster\" },\n },\n {\n target: { on: \"descendant\", selector: \"video\" },\n attribute: \"preload\",\n condition: { kind: \"when-provided\", prop: \"preload\" },\n value: { kind: \"prop\", prop: \"preload\" },\n },\n ],\n },\n};\n","import { collapseWhitespace } from \"../../helpers/string\";\n\nfunction isLatinChar(char: string | undefined): boolean {\n if (!char) return false;\n\n return /[A-Za-z]/.test(char);\n}\n\nfunction isLowercaseToken(token: string): boolean {\n return /^[a-z]/.test(token);\n}\n\nfunction leadingInitialFromToken(token: string): string | undefined {\n const leadingChar = token.charAt(0);\n\n return isLatinChar(leadingChar) ? leadingChar : undefined;\n}\n\n/**\n * Derives avatar initials from a full name.\n *\n * Rules:\n * - Empty/whitespace-only input returns `undefined`\n * - Leading non-Latin first token returns `undefined`\n * - First initial is always uppercased\n * - Single-word names return exactly one initial\n * - Two/three-word names return initials from each word\n * - Four+ words return first + last initials\n * - Lowercase surname particles (for example `da`, `de`, `van`) override\n * multi-word fallback and produce first initial + particle initial\n * - Hyphenation in first token yields one first initial only\n * - In two-word names, a second-token two-part hyphen surname contributes a\n * third initial (for example `Ocasio-Cortez` -> `OC`)\n */\nexport function getSetInitials(name: string | undefined): string | undefined {\n const normalizedName = collapseWhitespace(name);\n\n if (!normalizedName) return undefined;\n\n const words = normalizedName.split(\" \");\n const firstTokenInitial = leadingInitialFromToken(words[0]);\n\n if (!firstTokenInitial) return undefined;\n\n const initials: string[] = [firstTokenInitial.toUpperCase()];\n\n if (words.length === 1) {\n return initials[0];\n }\n\n const lowercaseSurnameToken = words.slice(1).find(isLowercaseToken);\n\n if (lowercaseSurnameToken) {\n const particleInitial = leadingInitialFromToken(lowercaseSurnameToken);\n\n return particleInitial ? `${initials[0]}${particleInitial}` : undefined;\n }\n\n if (words.length === 2) {\n const secondInitial = leadingInitialFromToken(words[1]);\n\n if (!secondInitial) return undefined;\n\n initials.push(secondInitial);\n\n const hyphenParts = words[1].split(\"-\").filter(Boolean);\n\n if (hyphenParts.length === 2) {\n const secondPartInitial = leadingInitialFromToken(hyphenParts[1]);\n\n if (secondPartInitial) initials.push(secondPartInitial);\n }\n\n return initials.slice(0, 3).join(\"\");\n }\n\n if (words.length === 3) {\n const secondInitial = leadingInitialFromToken(words[1]);\n\n const thirdInitial = leadingInitialFromToken(words[2]);\n\n if (!secondInitial || !thirdInitial) return undefined;\n\n initials.push(secondInitial, thirdInitial);\n\n return initials.slice(0, 3).join(\"\");\n }\n\n const lastTokenInitial = leadingInitialFromToken(words.at(-1) || \"\");\n\n if (!lastTokenInitial) return undefined;\n\n initials.push(lastTokenInitial);\n\n return initials.slice(0, 3).join(\"\");\n}\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport {\n collapseWhitespace,\n normalizeOptionalHtmlId,\n} from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { buildSetIcon, type SetIconName } from \"../icon/icon\";\nimport { getSetInitials } from \"./get-initials\";\n\nexport type SetAvatarColor =\n | \"neutral\"\n | \"01\"\n | \"02\"\n | \"03\"\n | \"04\"\n | \"05\"\n | \"06\"\n | \"07\"\n | \"08\"\n | \"09\";\nexport type SetAvatarEntity = \"bot\" | \"organization\" | \"person\" | \"team\";\nexport type SetAvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst ENTITY_ICON_MAP: Record<SetAvatarEntity, SetIconName> = {\n bot: \"robot-1\",\n organization: \"city-6\",\n person: \"user-1\",\n team: \"member\",\n};\n\nconst COLOR_HASH = [\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n] as const;\n\nexport interface SetAvatarProps {\n /** Optional explicit accessible label. Used before `name` fallback text. */\n alt?: string;\n /** Emits `aria-hidden=\"true\"` on the wrapper when true. @default false */\n ariaHidden?: boolean;\n /** Icon fallback identity when `src`, `initials`, and `name` are absent.\n * @default \"person\" */\n entity?: SetAvatarEntity;\n /** Avatar background color token. If omitted and `name` exists, color is hash-derived (01..09). */\n color?: SetAvatarColor;\n /** DOM id. */\n id?: string;\n /** Explicit initials override. Trimmed and whitespace-collapsed; alphabetic only, 1-3 characters. */\n initials?: string;\n /** Full name used for accessible-label fallback and initials derivation. */\n name?: string;\n /** Avatar size. @default \"md\" */\n size?: SetAvatarSize;\n /** Image source URL. Empty/whitespace is treated as missing. */\n src?: string;\n}\n\nfunction hashString(value: string): number {\n // djb2 seed constant for stable non-cryptographic string hashing.\n let hash = 5381;\n\n for (const char of value) {\n // djb2 mixes each char code with a 33x multiplier.\n hash = (hash * 33) ^ char.charCodeAt(0);\n }\n\n return hash >>> 0;\n}\n\nfunction normalizeInitials(initials: string | undefined): string | undefined {\n if (initials == null) return undefined;\n\n const normalized = collapseWhitespace(initials);\n\n if (!normalized) {\n return undefined;\n }\n\n if (normalized.length > 3) {\n throw new Error(\"initials must normalize to 3 characters or fewer.\");\n }\n\n if (!/^[A-Za-z]{1,3}$/.test(normalized)) {\n throw new Error(\"initials must contain only alphabetic characters.\");\n }\n\n return normalized;\n}\n\nfunction resolveAccessibleLabel({\n alt,\n ariaHidden,\n name,\n}: {\n alt?: string;\n ariaHidden?: boolean;\n name?: string;\n}): string | undefined {\n if (ariaHidden) return undefined;\n\n return collapseWhitespace(alt) || collapseWhitespace(name) || \"Avatar\";\n}\n\nfunction resolveAvatarColor({\n color,\n name,\n}: {\n color?: SetAvatarColor;\n name?: string;\n}): SetAvatarColor {\n if (color) return color;\n\n if (name) {\n const index = hashString(name) % COLOR_HASH.length;\n return COLOR_HASH[index];\n }\n\n return \"neutral\";\n}\n\n/**\n * Builds the IR tree for the Set avatar component.\n *\n * @param props - Avatar component props.\n * @returns IR node for an avatar wrapper with image/initials/icon content.\n */\nexport function buildSetAvatar({\n alt,\n ariaHidden,\n color,\n entity = \"person\",\n id,\n initials,\n name,\n size = \"md\",\n src,\n}: SetAvatarProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedInitials = normalizeInitials(initials);\n const normalizedName = collapseWhitespace(name);\n const normalizedSrc = collapseWhitespace(src);\n const accessibleLabel = resolveAccessibleLabel({\n alt,\n ariaHidden,\n name: normalizedName,\n });\n const derivedInitials = normalizedInitials || getSetInitials(normalizedName);\n const renderAsImage = Boolean(normalizedSrc);\n const resolvedColor = resolveAvatarColor({\n color,\n name: normalizedName,\n });\n\n const avatarAttrs = {\n \"aria-hidden\": ariaHidden ? \"true\" : undefined,\n \"aria-label\": !ariaHidden && !renderAsImage ? accessibleLabel : undefined,\n class: \"set-avatar\",\n \"data-color\": resolvedColor === \"neutral\" ? undefined : resolvedColor,\n \"data-entity\": entity === \"person\" ? undefined : entity,\n \"data-size\": size,\n id: normalizedId,\n role: !ariaHidden && !renderAsImage ? \"img\" : undefined,\n };\n\n let child: SetNode;\n if (renderAsImage) {\n child = {\n kind: \"element\",\n tag: \"img\",\n attrs: {\n alt: ariaHidden ? \"\" : accessibleLabel || \"\",\n class: \"img\",\n src: normalizedSrc,\n },\n children: [],\n };\n } else if (derivedInitials) {\n child = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"initials\" },\n children: [{ kind: \"text\", value: derivedInitials }],\n };\n } else {\n child = {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: ENTITY_ICON_MAP[entity],\n size: \"fill\",\n }),\n ],\n };\n }\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: avatarAttrs,\n children: [child],\n };\n}\n\n/**\n * SSR renderer for the Set avatar component.\n *\n * @param props - Avatar component props.\n * @returns HTML string for an avatar wrapper with image/initials/icon content.\n */\nexport function renderSetAvatar(props: SetAvatarProps): string {\n return serializeSetNode(buildSetAvatar(props));\n}\n\n/** Declarative avatar contract mirror for tooling, docs, and adapters. */\nexport const SET_AVATAR_SPEC: SetComponentSpec = {\n name: \"avatar\",\n description: \"Use `avatar` to visually represent a person, team, or entity.\",\n output: { element: \"span\", class: \"set-avatar\" },\n content: { kind: \"none\" },\n props: {\n alt: {\n description: \"Accessible label for the avatar, overrides name.\",\n type: { kind: \"string\" },\n },\n ariaHidden: {\n default: false,\n description: \"Hides the avatar from assistive technology.\",\n type: { kind: \"boolean\" },\n },\n entity: {\n default: \"person\",\n description: \"Type of subject the avatar represents.\",\n type: {\n kind: \"enum\",\n values: [\"bot\", \"organization\", \"person\", \"team\"],\n },\n },\n color: {\n description: \"Background color swatch. Derived from name when omitted.\",\n type: {\n kind: \"enum\",\n values: [\n \"neutral\",\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n ],\n },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n initials: {\n description:\n \"Initials to display. 1–3 alphabetic characters. Overrides name-derived initials.\",\n type: { kind: \"string\" },\n },\n name: {\n description: \"Full name. Used for the label and to derive initials.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n src: {\n description: \"Image source URL.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-entity\",\n condition: {\n kind: \"when-in\",\n prop: \"entity\",\n values: [\"bot\", \"organization\", \"team\"],\n },\n value: { kind: \"prop\", prop: \"entity\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-color\",\n condition: {\n kind: \"when-in\",\n prop: \"color\",\n values: [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\"],\n },\n value: { kind: \"prop\", prop: \"color\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-hidden\",\n condition: { kind: \"when-truthy\", prop: \"ariaHidden\" },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n\nexport { getSetInitials } from \"./get-initials\";\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetBadgeSize = \"sm\" | \"md\";\nexport type SetBadgeTone =\n | \"notification\"\n | \"live\"\n | \"pending\"\n | \"success\"\n | \"warning\"\n | \"error\";\n\nexport interface SetBadgeProps {\n /** Positions the badge as a floating overlay. */\n floating?: boolean;\n /** DOM id. */\n id?: string;\n /** Badge text content. Escaped as plain text. */\n label: string;\n /** Badge size. @default \"md\" */\n size?: SetBadgeSize;\n /** Semantic tone variant. */\n tone?: SetBadgeTone;\n}\n\n/**\n * Builds the IR tree for the Set badge component.\n *\n * @param props - Badge component props.\n * @returns IR node for a badge element.\n */\nexport function buildSetBadge({\n floating,\n id,\n label,\n size = \"md\",\n tone,\n}: SetBadgeProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: {\n class: \"set-badge\",\n \"data-floating\": floating,\n \"data-size\": size,\n \"data-tone\": tone || undefined,\n id: normalizedId,\n },\n children: [{ kind: \"text\", value: label }],\n };\n}\n\n/**\n * SSR renderer for the Set badge component.\n *\n * @param props - Badge component props.\n * @returns HTML string for a badge element.\n */\nexport function renderSetBadge(props: SetBadgeProps): string {\n return serializeSetNode(buildSetBadge(props));\n}\n\n/** Declarative badge contract mirror for tooling, docs, and adapters. */\nexport const SET_BADGE_SPEC: SetComponentSpec = {\n name: \"badge\",\n description: \"Use `badge` to annotate content with a short label.\",\n output: { element: \"span\", class: \"set-badge\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n floating: {\n default: false,\n description: \"Positions the badge as a floating overlay.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Badge text.\",\n required: true,\n type: { kind: \"text\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n tone: {\n description: \"Semantic tone.\",\n type: {\n kind: \"enum\",\n values: [\n \"notification\",\n \"live\",\n \"pending\",\n \"success\",\n \"warning\",\n \"error\",\n ],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-floating\",\n condition: { kind: \"when-truthy\", prop: \"floating\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-provided\", prop: \"tone\" },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetTextAs = \"p\" | \"span\";\nexport type SetTextSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type SetTextTone = \"default\" | \"muted\";\n\nexport interface SetTextProps {\n /** Text content. Supports inline markup such as `<em>`, `<strong>`, `<a>`, `<code>`, `<cite>`, etc. */\n children: string;\n /** Element tag. @default \"span\" */\n as?: SetTextAs;\n /** Text alignment. Ignored when `as` is `span`. @default \"start\" */\n align?: SetAlign;\n /** DOM id. */\n id?: string;\n /** Enables visited-state styling for links inside text. @default true */\n linkVisited?: boolean;\n /** Applies max measure constraints for long-form readability. Ignored when `as` is `span`. @default true */\n measured?: boolean;\n /** Applies monospaced word spacing throughout. @default false */\n monospaced?: boolean;\n /** Enables breakpoint-responsive body scale. @default false */\n responsive?: boolean;\n /** Text size. @default \"md\" */\n size?: SetTextSize;\n /** Tone variant. @default \"default\" */\n tone?: SetTextTone;\n}\n\n/**\n * Builds the IR tree for the Set text component.\n *\n * @param props - Text component props.\n * @returns IR node for a text paragraph or span element.\n */\nexport function buildSetText({\n align,\n as,\n children,\n id,\n linkVisited = true,\n measured,\n monospaced,\n responsive,\n size = \"md\",\n tone = \"default\",\n}: SetTextProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const tag: SetTextAs = as === \"p\" ? \"p\" : \"span\";\n const isParagraph = tag === \"p\";\n const resolvedAlign = isParagraph ? (align ?? \"start\") : undefined;\n const resolvedMeasured = isParagraph ? (measured ?? true) : undefined;\n\n return {\n kind: \"element\",\n tag,\n attrs: {\n class: \"set-text\",\n \"data-align\":\n resolvedAlign && resolvedAlign !== \"start\" ? resolvedAlign : undefined,\n \"data-link-visited\": linkVisited ? undefined : \"off\",\n \"data-measured\": resolvedMeasured,\n \"data-monospaced\": monospaced,\n \"data-responsive\": responsive,\n \"data-size\": size,\n \"data-tone\": tone === \"muted\" ? \"muted\" : undefined,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set text component.\n *\n * @param props - Text component props.\n * @returns HTML string for a text paragraph or span element.\n */\nexport function renderSetText(props: SetTextProps): string {\n return serializeSetNode(buildSetText(props));\n}\n\n/** Declarative text contract mirror for tooling, docs, and adapters. */\nexport const SET_TEXT_SPEC: SetComponentSpec = {\n name: \"text\",\n description: \"Use `text` for inline or paragraph body copy.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { p: \"p\", span: \"span\" } },\n class: \"set-text\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n as: {\n default: \"span\",\n description: \"HTML element used for the text.\",\n type: { kind: \"enum\", values: [\"p\", \"span\"] },\n },\n children: {\n description:\n \"Text content. Supports inline markup such as `<em>`, `<strong>`, `<a>`, `<code>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n linkVisited: {\n default: true,\n description: \"Styles visited links inside the text.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales text across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n ignoredWhen: \"`as` is span\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n ignoredWhen: \"`as` is span\",\n type: { kind: \"boolean\" },\n },\n monospaced: {\n default: false,\n description: \"Applies monospaced word spacing throughout.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"muted\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-equals\", prop: \"as\", to: \"p\" },\n { kind: \"when-in\", prop: \"align\", values: [\"center\", \"end\"] },\n ],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-link-visited\",\n condition: { kind: \"when-equals\", prop: \"linkVisited\", to: false },\n value: { kind: \"literal\", text: \"off\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-measured\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-equals\", prop: \"as\", to: \"p\" },\n { kind: \"when-truthy\", prop: \"measured\" },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-monospaced\",\n condition: { kind: \"when-truthy\", prop: \"monospaced\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"muted\" },\n value: { kind: \"literal\", text: \"muted\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\nimport { buildSetText } from \"../text/text\";\n\nexport type SetBlockquoteSize = \"md\" | \"lg\";\n\nexport interface SetBlockquoteProps {\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** Trusted attribution HTML. */\n attribution: string;\n /** DOM id. */\n id?: string;\n /** Applies max measure constraints for long-form readability. @default true */\n measured?: boolean;\n /** Trusted quote HTML. */\n quote: string;\n /** Enables breakpoint-responsive type sizing. @default false */\n responsive?: boolean;\n /** Quote size. @default \"md\" */\n size?: SetBlockquoteSize;\n}\n\n/**\n * Builds the IR tree for the Set blockquote component.\n *\n * @param props - Blockquote component props.\n * @returns IR node for a blockquote wrapper.\n */\nexport function buildSetBlockquote({\n align = \"start\",\n attribution,\n id,\n measured = true,\n quote,\n responsive = false,\n size = \"md\",\n}: SetBlockquoteProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"figure\",\n attrs: {\n class: \"set-blockquote\",\n \"data-align\": align === \"start\" ? undefined : align,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"blockquote\",\n attrs: { class: \"quote\" },\n children: [\n buildSetText({\n align,\n as: \"p\",\n children: quote,\n measured,\n responsive,\n size,\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"figcaption\",\n attrs: { class: \"attribution\" },\n children: [\n buildSetText({\n as: \"span\",\n children: attribution,\n responsive,\n size: \"sm\",\n }),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set blockquote component.\n *\n * @param props - Blockquote component props.\n * @returns HTML string for a blockquote wrapper.\n */\nexport function renderSetBlockquote(props: SetBlockquoteProps): string {\n return serializeSetNode(buildSetBlockquote(props));\n}\n\n/** Declarative blockquote contract mirror for tooling, docs, and adapters. */\nexport const SET_BLOCKQUOTE_SPEC: SetComponentSpec = {\n name: \"blockquote\",\n description: \"Use `blockquote` to display a quote with attribution.\",\n output: { element: \"figure\", class: \"set-blockquote\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"quote\", kind: \"html\" },\n { prop: \"attribution\", kind: \"html\" },\n ],\n },\n props: {\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n attribution: {\n description:\n \"Attribution shown beneath the quote. Supports inline markup such as `<a>`, `<cite>`, `<em>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n type: { kind: \"boolean\" },\n },\n quote: {\n description:\n \"Quote content. Supports inline markup such as `<em>`, `<strong>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n responsive: {\n default: false,\n description: \"Scales type across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant for the quote.\",\n type: { kind: \"enum\", values: [\"md\", \"lg\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetBoxBackground = \"default\" | \"panel\" | \"transparent\";\nexport type SetBoxPadding =\n | \"none\"\n | \"2xs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\";\nexport type SetBoxRadius = \"sm\" | \"md\";\n\nexport interface SetBoxProps {\n /** Background treatment. @default \"default\" */\n background?: SetBoxBackground;\n /** Subtle border. @default false */\n border?: boolean;\n /** Trusted inner HTML. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inner block-axis spacing scale. @default \"md\" */\n paddingBlock?: SetBoxPadding;\n /** Inner inline-axis spacing scale. @default \"md\" */\n paddingInline?: SetBoxPadding;\n /** Corner radius size. */\n radius?: SetBoxRadius;\n /** Responsive block-axis padding. @default false */\n responsive?: boolean;\n /** Surface context. */\n surface?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set box component.\n *\n * @param props - Box component props.\n * @returns IR node for a box wrapper.\n */\nexport function buildSetBox({\n background = \"default\",\n border,\n children,\n id,\n paddingBlock = \"md\",\n paddingInline = \"md\",\n radius,\n responsive,\n surface,\n}: SetBoxProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-box\",\n \"data-background\": background === \"default\" ? undefined : background,\n \"data-border\": border,\n \"data-set-surface\": surface,\n \"data-padding-block\": paddingBlock,\n \"data-padding-inline\": paddingInline,\n \"data-radius\": radius,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set box component.\n *\n * @param props - Box component props.\n * @returns HTML string for a box wrapper.\n */\nexport function renderSetBox(props: SetBoxProps): string {\n return serializeSetNode(buildSetBox(props));\n}\n\n/** Declarative box contract mirror for tooling, docs, and adapters. */\nexport const SET_BOX_SPEC: SetComponentSpec = {\n name: \"box\",\n description: \"Use `box` to inset content.\",\n output: { element: \"div\", class: \"set-box\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n background: {\n default: \"default\",\n description: \"Background treatment.\",\n type: { kind: \"enum\", values: [\"default\", \"panel\", \"transparent\"] },\n },\n border: {\n default: false,\n description: \"Shows a subtle border around the box.\",\n type: { kind: \"boolean\" },\n },\n children: {\n description: \"Content rendered inside the box.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n paddingBlock: {\n default: \"md\",\n description: \"Vertical padding.\",\n type: {\n kind: \"enum\",\n values: [\"none\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"],\n },\n },\n paddingInline: {\n default: \"md\",\n description: \"Horizontal padding.\",\n type: {\n kind: \"enum\",\n values: [\"none\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"],\n },\n },\n radius: {\n description: \"Corner radius.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n responsive: {\n default: false,\n description: \"Scales vertical padding across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-background\",\n condition: {\n kind: \"when-in\",\n prop: \"background\",\n values: [\"panel\", \"transparent\"],\n },\n value: { kind: \"prop\", prop: \"background\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-border\",\n condition: { kind: \"when-truthy\", prop: \"border\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-padding-block\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"paddingBlock\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-padding-inline\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"paddingInline\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-radius\",\n condition: { kind: \"when-provided\", prop: \"radius\" },\n value: { kind: \"prop\", prop: \"radius\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetHeadingLevel } from \"../../types\";\nimport { buildSetIcon } from \"../icon/icon\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport interface SetCardProps {\n /** Description HTML content. Caller sanitizes untrusted content. */\n description: string;\n /** Optional heading level for the title. Omit to render a `div.title`. */\n headingLevel?: SetHeadingLevel;\n /** Optional link destination for the title. Adds a trailing arrow icon when `note` is also provided. */\n href?: string;\n /** DOM id. */\n id?: string;\n /** Optional note HTML content. Caller sanitizes untrusted content. */\n note?: string;\n /** Surface context. Emits `data-set-surface` when provided. */\n surface?: SetSurfaceVariant;\n /** Card title text content (escaped before render). */\n title: string;\n}\n\n/**\n * Builds the IR tree for the Set card component.\n *\n * @param props - Card component props.\n * @returns IR node for a card wrapper.\n */\nexport function buildSetCard({\n description,\n headingLevel,\n href,\n id,\n note,\n surface,\n title,\n}: SetCardProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const headingTag = headingLevel ? `h${headingLevel}` : \"div\";\n const titleChildren: SetNode[] = href\n ? [\n {\n kind: \"element\",\n tag: \"a\",\n attrs: { href },\n children: [{ kind: \"text\", value: title }],\n },\n ]\n : [{ kind: \"text\", value: title }];\n\n const noteChildren: SetNode[] = note ? [{ kind: \"raw\", html: note }] : [];\n\n if (note && href) {\n noteChildren.push({\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"icon-wrapper\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n mirrored: \"rtl\",\n name: \"arrow-right\",\n size: \"xs\",\n }),\n ],\n });\n }\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"dots\" },\n children: [{ kind: \"element\", tag: \"span\", attrs: {}, children: [] }],\n },\n {\n kind: \"element\",\n tag: headingTag,\n attrs: { class: \"title\" },\n children: titleChildren,\n },\n {\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\" },\n children: [{ kind: \"raw\", html: description }],\n },\n ];\n\n if (note) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"note\" },\n children: noteChildren,\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-card\",\n \"data-set-surface\": surface,\n id: normalizedId,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set card component.\n *\n * Emits a `div.card` root with decorative dots, a title, supporting description,\n * and optional note. When `href` is provided, the title becomes a link; when\n * both `href` and `note` are provided, the note includes a trailing decorative\n * arrow icon.\n *\n * @param props - Card component props.\n * @returns HTML string for a card wrapper.\n */\nexport function renderSetCard(props: SetCardProps): string {\n return serializeSetNode(buildSetCard(props));\n}\n\n/** Declarative card contract mirror for tooling, docs, and adapters. */\nexport const SET_CARD_SPEC: SetComponentSpec = {\n name: \"card\",\n description: \"Use `card` to display a summary for a single topic.\",\n output: {\n element: \"div\",\n class: \"set-card\",\n },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"title\", kind: \"text\" },\n { prop: \"description\", kind: \"html\" },\n { prop: \"note\", kind: \"html\" },\n ],\n },\n props: {\n description: {\n description: \"Supporting description shown below the `title`.\",\n required: true,\n type: { kind: \"html\" },\n },\n headingLevel: {\n description:\n \"Semantic heading level for the title. Renders a `<div>` when omitted.\",\n type: { kind: \"enum\", values: [1, 2, 3, 4, 5, 6] },\n },\n href: {\n description: \"Link destination for the `title`.\",\n type: { kind: \"string\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n note: {\n description: \"Short note shown beneath the `description`.\",\n type: { kind: \"html\" },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n title: {\n description: \"Card title.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\n\nexport interface SetCheckboxProps {\n /** Checked state. @default false */\n checked?: boolean;\n /** Helper text rendered after the label. Requires `id`. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** DOM id applied to the underlying input. Required when `description` is provided. */\n id?: string;\n /** Invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Form field name. */\n name?: string;\n /** Required state. @default false */\n required?: boolean;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set checkbox component.\n *\n * @param props - Checkbox component props.\n * @returns IR node for a checkbox field wrapper.\n */\nexport function buildSetCheckbox({\n checked,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n required,\n size = \"md\",\n value,\n}: SetCheckboxProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDescription = description?.trim();\n\n if (normalizedDescription && !normalizedId) {\n throw new Error(\"id must be provided when description is provided.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isInvalid = !isDisabled && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n checked: Boolean(checked),\n class: \"checkbox\",\n disabled: isDisabled,\n id: normalizedId,\n name: name || undefined,\n required: Boolean(required),\n type: \"checkbox\",\n value: value || undefined,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: label }],\n },\n ],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"set-checkbox\", \"data-size\": size },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set checkbox component.\n *\n * @param props - Checkbox component props.\n * @returns HTML string for a checkbox field wrapper.\n */\nexport function renderSetCheckbox(props: SetCheckboxProps): string {\n return serializeSetNode(buildSetCheckbox(props));\n}\n\n/** Declarative checkbox contract mirror for tooling, docs, and adapters. */\nexport const SET_CHECKBOX_SPEC: SetComponentSpec = {\n name: \"checkbox\",\n description: \"Use `checkbox` to let users toggle a single option on or off.\",\n output: { element: \"div\", class: \"set-checkbox\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n checked: {\n default: false,\n description: \"Whether the checkbox is checked.\",\n type: { kind: \"boolean\" },\n },\n description: {\n description: \"Helper text shown below the label.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`description` is provided\",\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the checkbox as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label shown next to the checkbox.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n required: {\n default: false,\n description: \"Marks the checkbox as required.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Value submitted with the form.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"checked\",\n condition: { kind: \"when-truthy\", prop: \"checked\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetContainerGutter = \"default\" | \"narrow\" | \"none\";\nexport type SetContainerMaxInlineSize = \"default\" | \"wide\" | \"none\";\n\nexport interface SetContainerProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Inline gutter behavior. @default \"default\" */\n gutter?: SetContainerGutter;\n /** DOM id. */\n id?: string;\n /** Max-inline-size behavior. Effect is only visible on wider viewports. @default \"default\" */\n maxInlineSize?: SetContainerMaxInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set container component.\n *\n * @param props - Container component props.\n * @returns IR node for a container wrapper.\n */\nexport function buildSetContainer({\n children,\n gutter = \"default\",\n id,\n maxInlineSize = \"default\",\n}: SetContainerProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-container\",\n \"data-gutter\": gutter === \"default\" ? undefined : gutter,\n \"data-max-inline-size\":\n maxInlineSize === \"default\" ? undefined : maxInlineSize,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set container component.\n *\n * @param props - Container component props.\n * @returns HTML string for a container wrapper.\n */\nexport function renderSetContainer(props: SetContainerProps): string {\n return serializeSetNode(buildSetContainer(props));\n}\n\n/** Declarative container contract mirror for tooling, docs, and adapters. */\nexport const SET_CONTAINER_SPEC: SetComponentSpec = {\n name: \"container\",\n description: \"Use `container` to wrap page-level content.\",\n output: { element: \"div\", class: \"set-container\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the container.\",\n type: { kind: \"html\" },\n },\n gutter: {\n default: \"default\",\n description: \"Horizontal gutter width.\",\n type: { kind: \"enum\", values: [\"default\", \"narrow\", \"none\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n maxInlineSize: {\n default: \"default\",\n description:\n \"Maximum content width. Effect is only visible in wider viewports.\",\n type: { kind: \"enum\", values: [\"default\", \"wide\", \"none\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-max-inline-size\",\n condition: {\n kind: \"when-in\",\n prop: \"maxInlineSize\",\n values: [\"wide\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"maxInlineSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gutter\",\n condition: {\n kind: \"when-in\",\n prop: \"gutter\",\n values: [\"narrow\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"gutter\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\nimport { buildSetIcon } from \"../icon/icon\";\n\nexport interface SetDetailsProps {\n /** Content markup inside the details panel. Caller sanitizes untrusted content. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Whether the details is initially open. @default false */\n open?: boolean;\n /** Summary text content. Escaped before render. */\n summary: string;\n}\n\n/**\n * Builds the IR tree for the Set details component.\n *\n * @param props - Details component props.\n * @returns IR node for a details element.\n */\nexport function buildSetDetails({\n children,\n id,\n open,\n summary,\n inlineSize = \"full\",\n}: SetDetailsProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"details\",\n attrs: {\n class: \"set-details\",\n open,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"summary\",\n attrs: { class: \"summary\" },\n children: [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"marker\" },\n children: [\n buildSetIcon({\n ariaHidden: true,\n name: \"chevron-right\",\n size: \"sm\",\n }),\n ],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: summary }],\n },\n ],\n },\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set details component.\n *\n * Emits native `<details>`/`<summary>` markup with trusted HTML content in a\n * `.content` wrapper, and a decorative chevron icon marker in the summary.\n *\n * @param props - Details component props.\n * @returns HTML string for a details element.\n */\nexport function renderSetDetails(props: SetDetailsProps): string {\n return serializeSetNode(buildSetDetails(props));\n}\n\n/** Declarative details contract mirror for tooling, docs, and adapters. */\nexport const SET_DETAILS_SPEC: SetComponentSpec = {\n name: \"details\",\n description:\n \"Use `details` to let users expand and collapse a section of content.\",\n output: { element: \"details\", class: \"set-details\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"summary\", kind: \"text\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Content revealed when the details is open.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the details fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n open: {\n default: false,\n description: \"Opens the details by default.\",\n type: { kind: \"boolean\" },\n },\n summary: {\n description: \"Summary shown in the toggle.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"open\",\n condition: { kind: \"when-truthy\", prop: \"open\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetDividerOrientation = \"horizontal\" | \"vertical\";\nexport type SetDividerTone = \"default\" | \"subtle\" | \"brand\";\n\nexport interface SetDividerProps {\n /** DOM id. */\n id?: string;\n /** Divider orientation. @default \"horizontal\" */\n orientation?: SetDividerOrientation;\n /** Tone variant. @default \"default\" */\n tone?: SetDividerTone;\n}\n\n/**\n * Builds the IR tree for the Set divider component.\n *\n * @param props - Divider component props.\n * @returns IR node for a separator element.\n */\nexport function buildSetDivider({\n id,\n orientation = \"horizontal\",\n tone = \"default\",\n}: SetDividerProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: orientation === \"horizontal\" ? \"hr\" : \"span\",\n attrs: {\n \"aria-orientation\": orientation === \"vertical\" ? \"vertical\" : undefined,\n class: \"set-divider\",\n \"data-tone\": tone === \"subtle\" || tone === \"brand\" ? tone : undefined,\n id: normalizedId,\n role: orientation === \"vertical\" ? \"separator\" : undefined,\n },\n children: [],\n };\n}\n\n/**\n * SSR renderer for the Set divider component.\n *\n * @param props - Divider component props.\n * @returns HTML string for a separator element.\n */\nexport function renderSetDivider(props: SetDividerProps = {}): string {\n return serializeSetNode(buildSetDivider(props));\n}\n\n/** Declarative divider contract mirror for tooling, docs, and adapters. */\nexport const SET_DIVIDER_SPEC: SetComponentSpec = {\n name: \"divider\",\n description: \"Use `divider` to separate sections with a rule.\",\n output: {\n element: {\n kind: \"switch\",\n prop: \"orientation\",\n cases: { horizontal: \"hr\", vertical: \"span\" },\n },\n class: \"set-divider\",\n },\n content: { kind: \"none\" },\n props: {\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n orientation: {\n default: \"horizontal\",\n description: \"Divider orientation.\",\n type: { kind: \"enum\", values: [\"horizontal\", \"vertical\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"subtle\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: { kind: \"when-equals\", prop: \"orientation\", to: \"vertical\" },\n value: { kind: \"literal\", text: \"separator\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-orientation\",\n condition: { kind: \"when-equals\", prop: \"orientation\", to: \"vertical\" },\n value: { kind: \"literal\", text: \"vertical\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"subtle\", \"brand\"],\n },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetInlineSize } from \"../../types\";\n\nexport interface SetFieldsetProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Group description rendered below legend. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Fieldset id used for description id derivation. */\n id: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Fieldset legend text (escaped before render). */\n legend: string;\n}\n\n/**\n * Builds the IR tree for the Set fieldset component.\n *\n * @param props - Fieldset component props.\n * @returns IR node for a fieldset wrapper.\n */\nexport function buildSetFieldset({\n children,\n description,\n disabled,\n id,\n invalid,\n legend,\n inlineSize = \"full\",\n}: SetFieldsetProps): SetNode {\n const normalizedDescription = description?.trim();\n const normalizedId = id.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const derivedDescriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isInvalid = !isDisabled && Boolean(invalid);\n\n const fieldsetChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"legend\",\n attrs: { class: \"legend\" },\n children: [{ kind: \"text\", value: legend }],\n },\n ];\n\n if (normalizedDescription) {\n fieldsetChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: derivedDescriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n if (children) {\n fieldsetChildren.push({ kind: \"raw\", html: children });\n }\n\n return {\n kind: \"element\",\n tag: \"fieldset\",\n attrs: {\n \"aria-describedby\": normalizedDescription\n ? derivedDescriptionId\n : undefined,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n class: \"set-fieldset\",\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n disabled: isDisabled,\n id: normalizedId,\n },\n children: fieldsetChildren,\n };\n}\n\n/**\n * SSR renderer for the Set fieldset component.\n *\n * @param props - Fieldset component props.\n * @returns HTML string for a fieldset wrapper.\n */\nexport function renderSetFieldset(props: SetFieldsetProps): string {\n return serializeSetNode(buildSetFieldset(props));\n}\n\n/** Declarative fieldset contract mirror for tooling, docs, and adapters. */\nexport const SET_FIELDSET_SPEC: SetComponentSpec = {\n name: \"fieldset\",\n description: \"Use `fieldset` to group related form controls under a legend.\",\n output: { element: \"fieldset\", class: \"set-fieldset\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"legend\", kind: \"text\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Form controls grouped inside the fieldset.\",\n type: { kind: \"html\" },\n },\n description: {\n description:\n \"Description shown below the legend; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction with controls in the group.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` for the fieldset.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the group as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n legend: {\n description: \"Legend shown above the group.\",\n required: true,\n type: { kind: \"text\" },\n },\n inlineSize: {\n default: \"full\",\n description:\n \"Whether the fieldset fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign, SetInlineSize } from \"../../types\";\nimport { buildSetText } from \"../text/text\";\n\nexport interface SetFigureProps {\n /** Alignment within available space. @default \"start\" */\n align?: SetAlign;\n /** Trusted caption HTML. */\n caption: string;\n /** Trusted media HTML (typically a `renderSetImage` result). */\n children: string;\n /** DOM id. */\n id?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n /** Enables breakpoint-responsive type sizing for the caption. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set figure component.\n *\n * @param props - Figure component props.\n * @returns IR node for a figure wrapper.\n */\nexport function buildSetFigure({\n align = \"start\",\n caption,\n children,\n id,\n inlineSize = \"full\",\n responsive = false,\n}: SetFigureProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"figure\",\n attrs: {\n class: \"set-figure\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-inline-size\": inlineSize === \"full\" ? undefined : inlineSize,\n id: normalizedId,\n },\n children: [\n { kind: \"raw\", html: children },\n {\n kind: \"element\",\n tag: \"figcaption\",\n attrs: { class: \"figcaption\" },\n children: [\n buildSetText({\n as: \"span\",\n children: caption,\n responsive,\n size: \"sm\",\n }),\n ],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set figure component.\n *\n * @param props - Figure component props.\n * @returns HTML string for a figure wrapper.\n */\nexport function renderSetFigure(props: SetFigureProps): string {\n return serializeSetNode(buildSetFigure(props));\n}\n\n/** Declarative figure contract mirror for tooling, docs, and adapters. */\nexport const SET_FIGURE_SPEC: SetComponentSpec = {\n name: \"figure\",\n description: \"Use `figure` to present media with a caption.\",\n output: { element: \"figure\", class: \"set-figure\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"children\", kind: \"html\" },\n { prop: \"caption\", kind: \"html\" },\n ],\n },\n props: {\n align: {\n default: \"start\",\n description: \"Alignment within available space.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n caption: {\n description:\n \"Caption shown below the media. Supports inline markup such as `<em>`, `<strong>`, `<cite>`, etc.\",\n required: true,\n type: { kind: \"html\" },\n },\n children: {\n description: \"Media rendered inside the figure.\",\n required: true,\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description:\n \"Whether the figure fills its container or shrinks to fit the media.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n responsive: {\n default: false,\n description: \"Scales the caption across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetGridGap = \"default\" | \"expanded\" | \"none\";\nexport type SetGridTrack = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\nexport interface SetGridProps {\n /** Trusted inner HTML (typically grid items). */\n children?: string;\n /** Gap behavior. @default \"default\" */\n gap?: SetGridGap;\n /** DOM id. */\n id?: string;\n}\n\nexport interface SetGridItemProps {\n /** Trusted inner HTML. */\n children?: string;\n /** Align-self. */\n align?: SetAlign;\n /** Column span at default container threshold. */\n colSpan?: SetGridTrack;\n /** Column span at narrow container threshold. */\n colSpanNarrow?: SetGridTrack;\n /** Column span at wide container threshold. Effect is only visible above the wide breakpoint. */\n colSpanWide?: SetGridTrack;\n /** Column start at default container threshold. */\n colStart?: SetGridTrack;\n /** Column start at narrow container threshold. */\n colStartNarrow?: SetGridTrack;\n /** Column start at wide container threshold. Effect is only visible above the wide breakpoint. */\n colStartWide?: SetGridTrack;\n /** DOM id. */\n id?: string;\n /** Justify-self. */\n justify?: SetAlign;\n /** Row span at default container threshold. */\n rowSpan?: SetGridTrack;\n /** Row span at narrow container threshold. */\n rowSpanNarrow?: SetGridTrack;\n /** Row span at wide container threshold. Effect is only visible above the wide breakpoint. */\n rowSpanWide?: SetGridTrack;\n /** Row start at default container threshold. */\n rowStart?: SetGridTrack;\n /** Row start at narrow container threshold. */\n rowStartNarrow?: SetGridTrack;\n /** Row start at wide container threshold. Effect is only visible above the wide breakpoint. */\n rowStartWide?: SetGridTrack;\n}\n\nconst validateGridTrack = (\n value: SetGridTrack | undefined,\n): string | undefined => {\n if (value === undefined) return undefined;\n\n return String(value);\n};\n\n/**\n * Builds the IR tree for the Set grid component.\n *\n * @param props - Grid component props.\n * @returns IR node for a grid wrapper.\n */\nexport function buildSetGrid({\n children,\n gap = \"default\",\n id,\n}: SetGridProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-grid\",\n \"data-gap\": gap === \"default\" ? undefined : gap,\n id: normalizedId,\n },\n children: [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"grid\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n },\n ],\n };\n}\n\n/**\n * SSR renderer for the Set grid component.\n *\n * @param props - Grid component props.\n * @returns HTML string for a grid wrapper.\n */\nexport function renderSetGrid(props: SetGridProps): string {\n return serializeSetNode(buildSetGrid(props));\n}\n\n/**\n * Builds the IR tree for the Set grid-item component.\n *\n * @param props - Grid-item component props.\n * @returns IR node for a grid item.\n */\nexport function buildSetGridItem({\n align,\n children,\n colSpan,\n colSpanNarrow,\n colSpanWide,\n colStart,\n colStartNarrow,\n colStartWide,\n id,\n justify,\n rowSpan,\n rowSpanNarrow,\n rowSpanWide,\n rowStart,\n rowStartNarrow,\n rowStartWide,\n}: SetGridItemProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-grid-item\",\n \"data-align\": align,\n \"data-justify\": justify,\n \"data-col-span-narrow\": validateGridTrack(colSpanNarrow),\n \"data-col-start-narrow\": validateGridTrack(colStartNarrow),\n \"data-col-span\": validateGridTrack(colSpan),\n \"data-col-start\": validateGridTrack(colStart),\n \"data-col-span-wide\": validateGridTrack(colSpanWide),\n \"data-col-start-wide\": validateGridTrack(colStartWide),\n \"data-row-span-narrow\": validateGridTrack(rowSpanNarrow),\n \"data-row-start-narrow\": validateGridTrack(rowStartNarrow),\n \"data-row-span\": validateGridTrack(rowSpan),\n \"data-row-start\": validateGridTrack(rowStart),\n \"data-row-span-wide\": validateGridTrack(rowSpanWide),\n \"data-row-start-wide\": validateGridTrack(rowStartWide),\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set grid-item component.\n *\n * @param props - Grid-item component props.\n * @returns HTML string for a grid item.\n */\nexport function renderSetGridItem(props: SetGridItemProps): string {\n return serializeSetNode(buildSetGridItem(props));\n}\n\n/** Declarative grid contract mirror for tooling, docs, and adapters. */\nexport const SET_GRID_SPEC: SetComponentSpec = {\n name: \"grid\",\n description: \"Use `grid` to lay out content in a 12-column responsive grid.\",\n output: { element: \"div\", class: \"set-grid\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"`grid-item` components rendered inside the grid.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"default\",\n description: \"Space between the `grid-item` components.\",\n type: { kind: \"enum\", values: [\"default\", \"expanded\", \"none\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: {\n kind: \"when-in\",\n prop: \"gap\",\n values: [\"expanded\", \"none\"],\n },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n\nconst gridTrackType = {\n kind: \"number\",\n min: 1,\n max: 12,\n integer: true,\n} as const;\n\n/** Declarative grid-item contract mirror for tooling, docs, and adapters. */\nexport const SET_GRID_ITEM_SPEC: SetComponentSpec = {\n name: \"grid-item\",\n description: \"Use `grid-item` to place content within a `grid` layout.\",\n output: { element: \"div\", class: \"set-grid-item\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the grid item.\",\n type: { kind: \"html\" },\n },\n align: {\n description: \"Block-axis alignment within the grid cell.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n justify: {\n description: \"Inline-axis alignment within the grid cell.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n colSpan: {\n description: \"Columns spanned at the default breakpoint.\",\n type: gridTrackType,\n },\n colStart: {\n description: \"Starting column at the default breakpoint.\",\n type: gridTrackType,\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n rowSpan: {\n description: \"Rows spanned at the default breakpoint.\",\n type: gridTrackType,\n },\n rowSpanNarrow: {\n description: \"Rows spanned at the narrow breakpoint.\",\n type: gridTrackType,\n },\n rowSpanWide: {\n description:\n \"Rows spanned at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n rowStart: {\n description: \"Starting row at the default breakpoint.\",\n type: gridTrackType,\n },\n rowStartNarrow: {\n description: \"Starting row at the narrow breakpoint.\",\n type: gridTrackType,\n },\n rowStartWide: {\n description:\n \"Starting row at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n colSpanNarrow: {\n description: \"Columns spanned at the narrow breakpoint.\",\n type: gridTrackType,\n },\n colStartNarrow: {\n description: \"Starting column at the narrow breakpoint.\",\n type: gridTrackType,\n },\n colSpanWide: {\n description:\n \"Columns spanned at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n colStartWide: {\n description:\n \"Starting column at the wide breakpoint. Effect is only visible above the wide breakpoint.\",\n type: gridTrackType,\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: { kind: \"when-provided\", prop: \"align\" },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-justify\",\n condition: { kind: \"when-provided\", prop: \"justify\" },\n value: { kind: \"prop\", prop: \"justify\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span\",\n condition: { kind: \"when-provided\", prop: \"colSpan\" },\n value: { kind: \"prop\", prop: \"colSpan\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start\",\n condition: { kind: \"when-provided\", prop: \"colStart\" },\n value: { kind: \"prop\", prop: \"colStart\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span-narrow\",\n condition: { kind: \"when-provided\", prop: \"colSpanNarrow\" },\n value: { kind: \"prop\", prop: \"colSpanNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start-narrow\",\n condition: { kind: \"when-provided\", prop: \"colStartNarrow\" },\n value: { kind: \"prop\", prop: \"colStartNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-span-wide\",\n condition: { kind: \"when-provided\", prop: \"colSpanWide\" },\n value: { kind: \"prop\", prop: \"colSpanWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-col-start-wide\",\n condition: { kind: \"when-provided\", prop: \"colStartWide\" },\n value: { kind: \"prop\", prop: \"colStartWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span\",\n condition: { kind: \"when-provided\", prop: \"rowSpan\" },\n value: { kind: \"prop\", prop: \"rowSpan\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start\",\n condition: { kind: \"when-provided\", prop: \"rowStart\" },\n value: { kind: \"prop\", prop: \"rowStart\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span-narrow\",\n condition: { kind: \"when-provided\", prop: \"rowSpanNarrow\" },\n value: { kind: \"prop\", prop: \"rowSpanNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start-narrow\",\n condition: { kind: \"when-provided\", prop: \"rowStartNarrow\" },\n value: { kind: \"prop\", prop: \"rowStartNarrow\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-span-wide\",\n condition: { kind: \"when-provided\", prop: \"rowSpanWide\" },\n value: { kind: \"prop\", prop: \"rowSpanWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-row-start-wide\",\n condition: { kind: \"when-provided\", prop: \"rowStartWide\" },\n value: { kind: \"prop\", prop: \"rowStartWide\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign, SetHeadingLevel } from \"../../types\";\nexport type SetHeadingSize =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"3xl\"\n | \"4xl\"\n | \"5xl\";\n\nexport interface SetHeadingProps {\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** DOM id. */\n id?: string;\n /** Semantic heading level; omit to render a `span`. */\n level?: SetHeadingLevel;\n /** Enables optical alignment for left sidebearing-heavy glyphs. @default false */\n opticalAlign?: boolean;\n /** Enables breakpoint-responsive heading scale. @default false */\n responsive?: boolean;\n /** Heading size. @default \"md\" */\n size?: SetHeadingSize;\n /** Heading text content (escaped before render). */\n text: string;\n}\n\n/**\n * Builds the IR tree for the Set heading component.\n *\n * @param props - Heading component props.\n * @returns IR node for a heading element (`h1`..`h6`) or `span`.\n */\nexport function buildSetHeading({\n align = \"start\",\n id,\n level,\n opticalAlign,\n responsive,\n size = \"md\",\n text,\n}: SetHeadingProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const tag = level ? (`h${level}` as const) : \"span\";\n return {\n kind: \"element\",\n tag,\n attrs: {\n class: \"set-heading\",\n \"data-align\": align === \"start\" ? undefined : align,\n \"data-optical-align\": opticalAlign,\n \"data-responsive\": responsive,\n \"data-size\": size,\n id: normalizedId,\n },\n children: [{ kind: \"text\", value: text }],\n };\n}\n\n/**\n * SSR renderer for the Set heading component.\n *\n * @param props - Heading component props.\n * @returns HTML string for a heading element (`h1`..`h6`) or `span`.\n */\nexport function renderSetHeading(props: SetHeadingProps): string {\n return serializeSetNode(buildSetHeading(props));\n}\n\n/** Declarative heading contract mirror for tooling, docs, and adapters. */\nexport const SET_HEADING_SPEC: SetComponentSpec = {\n name: \"heading\",\n description: \"Use `heading` to render heading text with consistent type.\",\n output: {\n element: {\n kind: \"switch\",\n prop: \"level\",\n cases: {\n \"1\": \"h1\",\n \"2\": \"h2\",\n \"3\": \"h3\",\n \"4\": \"h4\",\n \"5\": \"h5\",\n \"6\": \"h6\",\n },\n },\n class: \"set-heading\",\n },\n content: { kind: \"text\", prop: \"text\" },\n props: {\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n level: {\n description: \"Semantic heading level. Renders a `<span>` when omitted.\",\n type: { kind: \"enum\", values: [1, 2, 3, 4, 5, 6] },\n },\n opticalAlign: {\n default: false,\n description:\n \"Optically aligns left sidebearing-heavy glyphs with the content edge.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales type across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\", \"4xl\", \"5xl\"],\n },\n },\n text: {\n description: \"Heading text.\",\n required: true,\n type: { kind: \"text\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-optical-align\",\n condition: { kind: \"when-truthy\", prop: \"opticalAlign\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetInlineAs = \"div\" | \"ul\";\nexport type SetInlineGap = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type SetInlineJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\nexport interface SetInlineProps {\n /** Element tag. @default \"div\" */\n as?: SetInlineAs;\n /** Cross-axis alignment. @default \"center\" */\n align?: SetAlign;\n /** Trusted inner HTML. */\n children?: string;\n /** Spacing gap size. @default \"md\" */\n gap?: SetInlineGap;\n /** DOM id. */\n id?: string;\n /** Main-axis distribution. @default \"start\" */\n justify?: SetInlineJustify;\n /** Prevents wrapping of inline children. */\n nowrap?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set inline component.\n *\n * @param props - Inline component props.\n * @returns IR node for an inline wrapper.\n */\nexport function buildSetInline({\n align = \"center\",\n as = \"div\",\n children,\n gap = \"md\",\n id,\n justify = \"start\",\n nowrap,\n}: SetInlineProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: as,\n attrs: {\n class: \"set-inline\",\n \"data-align\": align === \"center\" ? undefined : align,\n \"data-gap\": gap,\n \"data-justify\": justify === \"start\" ? undefined : justify,\n \"data-nowrap\": nowrap,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set inline component.\n *\n * @param props - Inline component props.\n * @returns HTML string for an inline wrapper.\n */\nexport function renderSetInline(props: SetInlineProps): string {\n return serializeSetNode(buildSetInline(props));\n}\n\n/** Declarative inline contract mirror for tooling, docs, and adapters. */\nexport const SET_INLINE_SPEC: SetComponentSpec = {\n name: \"inline\",\n description: \"Use `inline` to lay out content in a horizontal row.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { div: \"div\", ul: \"ul\" } },\n class: \"set-inline\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n as: {\n default: \"div\",\n description: \"Element tag to render. `ul` children must be `<li>`.\",\n type: { kind: \"enum\", values: [\"div\", \"ul\"] },\n },\n align: {\n default: \"center\",\n description: \"Aligns items on the cross axis.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n children: {\n description: \"Items laid out in a row.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"md\",\n description: \"Space between children.\",\n type: { kind: \"enum\", values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n justify: {\n default: \"start\",\n description: \"Distributes items along the main axis.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\", \"between\"] },\n },\n nowrap: {\n description: \"Prevents items from wrapping onto new lines.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"start\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-justify\",\n condition: {\n kind: \"when-in\",\n prop: \"justify\",\n values: [\"center\", \"end\", \"between\"],\n },\n value: { kind: \"prop\", prop: \"justify\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-nowrap\",\n condition: { kind: \"when-truthy\", prop: \"nowrap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport type SetInputType =\n | \"text\"\n | \"email\"\n | \"password\"\n | \"tel\"\n | \"url\"\n | \"numeric\";\n\nexport interface SetInputProps {\n /** Autocomplete hint; `false` emits `autocomplete=\"off\"`. */\n autocomplete?: string | false;\n /** Helper text rendered after the input (reused as validation guidance when `invalid`). */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Input id; used for `input[id]` and `label[for]`. */\n id: string;\n /** Invalid state. Ignored when `disabled` or `readOnly`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Field name attribute. */\n name?: string;\n /** Pattern attribute. */\n pattern?: string;\n /** Read-only state. Ignored when `disabled`. @default false */\n readOnly?: boolean;\n /** Required state. @default false */\n required?: boolean;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Spellcheck behavior. Defaults to `false` for `type=\"numeric\"` unless explicit. */\n spellcheck?: boolean;\n /** Input type; `numeric` maps to `type=\"text\"` with `inputmode=\"numeric\"`. @default \"text\" */\n type?: SetInputType;\n /** Current value. */\n value?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set input component.\n *\n * @param props - Input component props.\n * @returns IR node for a labeled input field wrapper.\n */\nexport function buildSetInput({\n autocomplete,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n pattern,\n readOnly,\n required,\n size = \"md\",\n spellcheck,\n type = \"text\",\n value,\n inlineSize = \"full\",\n}: SetInputProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedAutocomplete =\n autocomplete === false ? false : autocomplete?.trim();\n const normalizedName = name?.trim();\n const normalizedPattern = pattern?.trim();\n // Preserve the field value exactly as provided. Leading/trailing spaces can\n // be meaningful user input, and adapters use `\"\"` to keep cleared fields\n // controlled.\n const normalizedValue = value;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isNumeric = type === \"numeric\";\n const resolvedType = isNumeric ? \"text\" : type;\n const resolvedPattern =\n normalizedPattern || (isNumeric ? \"^[0-9]*$\" : undefined);\n const resolvedSpellcheck =\n spellcheck === undefined && isNumeric ? false : spellcheck;\n const isDisabled = Boolean(disabled);\n const isReadOnly = !isDisabled && Boolean(readOnly);\n const isInvalid = !isDisabled && !isReadOnly && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n autocomplete:\n normalizedAutocomplete === false\n ? \"off\"\n : normalizedAutocomplete || undefined,\n class: \"input\",\n disabled: isDisabled,\n id: normalizedId,\n inputmode: isNumeric ? \"numeric\" : undefined,\n name: normalizedName || undefined,\n pattern: resolvedPattern,\n readonly: isReadOnly,\n required: Boolean(required),\n spellcheck:\n resolvedSpellcheck === undefined\n ? undefined\n : String(resolvedSpellcheck),\n type: resolvedType,\n value: normalizedValue,\n },\n children: [],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-input\",\n \"data-size\": size,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set input component.\n *\n * @param props - Input component props.\n * @returns HTML string for a labeled input field wrapper.\n */\nexport function renderSetInput(props: SetInputProps): string {\n return serializeSetNode(buildSetInput(props));\n}\n\n/** Declarative input contract mirror for tooling, docs, and adapters. */\nexport const SET_INPUT_SPEC: SetComponentSpec = {\n name: \"input\",\n description: \"Use `input` to collect a single line of text from users.\",\n output: { element: \"div\", class: \"set-input\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n autocomplete: {\n description: \"Autocomplete hint. Pass `false` to disable autocomplete.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"string\" }, { kind: \"boolean\" }],\n },\n },\n description: {\n description:\n \"Helper text shown below the input; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Prevents interaction.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` linking the label to the input.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the input as invalid.\",\n ignoredWhen: \"`disabled` is true or `readOnly` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label shown above the input.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Name submitted with the form.\",\n type: { kind: \"string\" },\n },\n pattern: {\n description: \"Regex pattern the value must match.\",\n type: { kind: \"string\" },\n },\n readOnly: {\n default: false,\n description: \"Makes the input read-only.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n required: {\n default: false,\n description: \"Marks the input as required.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n spellcheck: {\n description: \"Enables browser spellchecking.\",\n type: { kind: \"boolean\" },\n },\n type: {\n default: \"text\",\n description: \"Input type.\",\n type: {\n kind: \"enum\",\n values: [\"text\", \"email\", \"password\", \"tel\", \"url\", \"numeric\"],\n },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"Whether the field fills its container or shrinks to fit.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"descendant\", selector: \"label\" },\n attribute: \"for\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"input\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-provided\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"readonly\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"readOnly\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"readOnly\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"inputmode\",\n condition: { kind: \"when-equals\", prop: \"type\", to: \"numeric\" },\n value: { kind: \"literal\", text: \"numeric\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"when-equals\", prop: \"type\", to: \"numeric\" },\n value: { kind: \"literal\", text: \"text\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"when-not-in\", prop: \"type\", values: [\"numeric\"] },\n value: { kind: \"prop\", prop: \"type\" },\n },\n ],\n },\n};\n","import type { SetNode } from \"../../helpers/node\";\n\n// The boot animation needs the mark decomposed into addressable cells —\n// structure the single-path shape tokens cannot carry. Keep the artwork in\n// step with `primitive.shape.logo.*`.\n\nconst PRIMARY_VIEWBOX = \"0 0 6714.6 1200\";\nconst GRAPHIC_VIEWBOX = \"0 0 600 1200\";\n\n/** Cells in boot order; logo.css keys the keyframes by nth-child. */\nconst MARK_CELLS: ReadonlyArray<{ x: number; y: number }> = [\n { x: 0, y: 0 },\n { x: 300, y: 0 },\n { x: 150, y: 300 },\n { x: 450, y: 300 },\n { x: 0, y: 600 },\n { x: 300, y: 600 },\n { x: 150, y: 900 },\n { x: 450, y: 900 },\n];\n\n// Verbatim copy of `primitive.shape.logo.typographic.path` (drift-guarded\n// by logo.test.ts), offset into the primary lockup's space.\nconst WORD_PATH =\n \"M0 956h98V571L87 391h2l124 320h89l123-320h3l-11 180v385h98V276H384L260 608h-5L131 276H0zm879.94 10c184 0 223-46 223-272 0-225-39-271-223-271-186 0-224 46-224 271 0 226 38 272 224 272m0-93c-102 0-123-30-123-179 0-147 21-177 123-177 100 0 121 30 121 177 0 149-21 179-121 179m361.44 83h103V686c0-141 20-169 112-169 73 0 88 18 88 107v332h103V624c0-167-28-202-163-202-95 0-120 16-147 92h-5v-82h-91zm769.16 10c184 0 223-46 223-272 0-225-39-271-223-271-186 0-224 46-224 271 0 226 38 272 224 272m0-93c-102 0-123-30-123-179 0-147 21-177 123-177 100 0 121 30 121 177 0 149-21 179-121 179m363.25-65c-4 132 30 158 202 158 173 0 208-25 208-150 0-118-33-146-191-170-94-14-114-26-114-74 0-50 18-60 103-60 76 0 92 9 96 52h97c-3-118-36-142-194-142-166 0-201 25-201 146 0 114 31 141 182 162 101 13 122 28 122 82 0 53-18 64-103 64-88 0-107-11-110-68zm558.97 363h102V902h5c20 54 41 64 123 64 160 0 193-45 193-270 0-227-34-274-198-274-83 0-105 11-123 65h-4v-55h-98zm209-298c-93 0-112-30-112-179 0-148 19-178 112-178s113 30 113 179c0 148-20 178-113 178m656.46 83h88V610c0-156-34-187-197-187-150 0-181 27-179 157h97c1-61 15-74 85-74 82 0 99 18 99 105v24h-72c-187 0-226 30-226 179 0 126 28 152 162 152 92 0 116-13 138-74h5zm-8-243c-1 135-22 163-119 163-65 0-79-13-79-75 0-74 18-88 107-88zm551.75 95c-10 56-26 67-89 67-100 0-121-31-121-181s20-181 117-181c65 0 81 14 91 79h101c-4-141-37-170-188-170-185 0-224 46-224 272s39 272 226 272c147 0 179-26 186-158zm547.03 9c-15 48-31 58-96 58-96 0-117-23-123-136h324c5-263-32-317-214-317-172 0-207 46-207 271 0 227 38 273 223 273 139 0 172-25 190-149zm-218-160c4-122 24-146 114-146 88 0 108 24 112 146zm787.56 299h93l-1-734h-102l1 266h-5c-19-54-40-65-120-65-162 0-196 46-196 272s35 271 200 271c84 0 105-11 125-65h5zm-115-82c-94 0-114-30-114-180s20-180 114-180c93 0 112 30 112 180s-19 180-112 180\";\nconst WORD_OFFSET = 1163;\n\nconst markGroup = (): SetNode => ({\n kind: \"element\",\n tag: \"g\",\n attrs: { class: \"mark\" },\n children: MARK_CELLS.map(({ x, y }) => ({\n kind: \"element\" as const,\n tag: \"rect\",\n attrs: {\n height: \"300\",\n width: \"150\",\n x: String(x),\n y: String(y),\n },\n children: [],\n })),\n});\n\nconst wordGroup = (): SetNode => ({\n kind: \"element\",\n tag: \"g\",\n attrs: { class: \"word\", transform: `translate(${WORD_OFFSET} 0)` },\n children: [\n {\n kind: \"element\",\n tag: \"path\",\n attrs: { d: WORD_PATH },\n children: [],\n },\n ],\n});\n\nconst animatedSvg = (viewBox: string, children: SetNode[]): SetNode => ({\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": \"true\",\n viewBox,\n xmlns: \"http://www.w3.org/2000/svg\",\n },\n children,\n});\n\n/** Builds the animated primary logo SVG (mark plus wordmark). */\nexport function buildSetLogoAnimatedPrimary(): SetNode {\n return animatedSvg(PRIMARY_VIEWBOX, [markGroup(), wordGroup()]);\n}\n\n/** Builds the animated graphic logo SVG (mark only). */\nexport function buildSetLogoAnimatedGraphic(): SetNode {\n return animatedSvg(GRAPHIC_VIEWBOX, [markGroup()]);\n}\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport {\n buildSetLogoAnimatedGraphic,\n buildSetLogoAnimatedPrimary,\n} from \"./logos-animated\";\n\nexport type SetLogoTone = \"default\" | \"neutral\";\nexport type SetLogoSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fill\";\nexport type SetLogoVariant =\n | \"primary\"\n | \"secondary\"\n | \"typographic\"\n | \"graphic\";\n\nexport interface SetLogoProps {\n /** Plays the logo's boot animation. Primary and graphic only; other variants render static. @default false */\n animated?: boolean;\n /** DOM id. */\n id?: string;\n /** Accessible label. */\n label: string;\n /** Size. @default \"md\" */\n size?: SetLogoSize;\n /** Tone. @default \"default\" */\n tone?: SetLogoTone;\n /** Variant. @default \"primary\" */\n variant?: SetLogoVariant;\n}\n\n/**\n * Builds the IR tree for the Set logo component.\n *\n * @param props - Logo component props.\n * @returns IR node for a masked logo element.\n */\nexport function buildSetLogo({\n animated,\n id,\n label,\n size = \"md\",\n tone = \"default\",\n variant = \"primary\",\n}: SetLogoProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const isAnimated =\n Boolean(animated) && (variant === \"primary\" || variant === \"graphic\");\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: label }],\n },\n ];\n\n if (isAnimated) {\n children.push(\n variant === \"graphic\"\n ? buildSetLogoAnimatedGraphic()\n : buildSetLogoAnimatedPrimary(),\n );\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-logo\",\n \"data-animated\": isAnimated,\n \"data-size\": size,\n \"data-tone\": tone === \"neutral\" ? \"neutral\" : undefined,\n \"data-variant\": variant === \"primary\" ? undefined : variant,\n id: normalizedId,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set logo component.\n *\n * @param props - Logo component props.\n * @returns HTML string for a masked logo element.\n */\nexport function renderSetLogo(props: SetLogoProps): string {\n return serializeSetNode(buildSetLogo(props));\n}\n\n/** Declarative logo contract mirror for tooling, docs, and adapters. */\nexport const SET_LOGO_SPEC: SetComponentSpec = {\n name: \"logo\",\n description: \"Use `logo` to display the brand mark.\",\n output: { element: \"div\", class: \"set-logo\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n animated: {\n default: false,\n description:\n \"Plays the logo's boot animation once on render. Animates the `primary` and `graphic` variants; others render static.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible label.\",\n required: true,\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\", \"xl\", \"fill\"] },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"neutral\"] },\n },\n variant: {\n default: \"primary\",\n description: \"Logo variant.\",\n type: {\n kind: \"enum\",\n values: [\"primary\", \"secondary\", \"typographic\", \"graphic\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-animated\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"animated\" },\n {\n kind: \"when-in\",\n prop: \"variant\",\n values: [\"primary\", \"graphic\"],\n },\n ],\n },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"neutral\" },\n value: { kind: \"literal\", text: \"neutral\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-variant\",\n condition: {\n kind: \"when-in\",\n prop: \"variant\",\n values: [\"secondary\", \"typographic\", \"graphic\"],\n },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetPageHeaderBorder = \"always\" | \"scroll\";\nexport type SetPageHeaderSize = \"sm\" | \"md\" | \"lg\";\nexport type SetPageStickyHeader = \"always\" | \"belowNotebook\";\n\nexport interface SetPageProps {\n /** Optional banner region markup rendered before the header. Caller sanitizes untrusted content. */\n banner?: string;\n /** Centers the main region within the page shell. Emits `data-center-main` only when true. @default false */\n centerMain?: boolean;\n /** Main region markup rendered inside the page-owned `<main>`. Caller sanitizes untrusted content. */\n children?: string;\n /** Header region markup. Caller sanitizes untrusted content. */\n header: string;\n /** Bottom border on the header. `\"scroll\"` requires `stickyHeader`. */\n headerBorder?: SetPageHeaderBorder;\n /** Header size. Reserves a minimum block size on the header. @default \"md\" */\n headerSize?: SetPageHeaderSize;\n /** DOM id. */\n id?: string;\n /** Sticky header behavior. Emits `data-sticky-header` when provided. */\n stickyHeader?: SetPageStickyHeader;\n /** Footer region markup. Caller sanitizes untrusted content. */\n footer: string;\n}\n\n/**\n * Builds the IR tree for the Set page shell.\n *\n * @param props - Page shell props.\n * @returns IR node for a page wrapper.\n */\nexport function buildSetPage({\n banner,\n centerMain,\n children,\n footer,\n header,\n headerBorder,\n headerSize = \"md\",\n id,\n stickyHeader,\n}: SetPageProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const regionChildren: SetNode[] = [];\n\n if (banner) regionChildren.push({ kind: \"raw\", html: banner });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"header\",\n attrs: { class: \"header\" },\n children: [{ kind: \"raw\", html: header }],\n });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"main\",\n attrs: { class: \"main\" },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n });\n\n regionChildren.push({\n kind: \"element\",\n tag: \"footer\",\n attrs: { class: \"footer\" },\n children: [{ kind: \"raw\", html: footer }],\n });\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-page\",\n \"data-center-main\": centerMain,\n \"data-header-border\": headerBorder,\n \"data-header-size\": headerSize,\n \"data-sticky-header\": stickyHeader,\n id: normalizedId,\n },\n children: regionChildren,\n };\n}\n\n/**\n * SSR renderer for the Set page shell.\n *\n * Emits a prescribed page structure with an optional banner region followed by\n * header, main, and footer content. The page shell owns the outer layout\n * wrapper and region elements so the internal page layout can evolve without\n * changing the consumer-facing region contract.\n *\n * @param props - Page shell props.\n * @returns HTML string for a page wrapper.\n */\nexport function renderSetPage(props: SetPageProps): string {\n return serializeSetNode(buildSetPage(props));\n}\n\n/** Declarative page contract mirror for tooling, docs, and adapters. */\nexport const SET_PAGE_SPEC: SetComponentSpec = {\n name: \"page\",\n description:\n \"Use `page` as the primary layout for header, main, and footer regions.\",\n output: { element: \"div\", class: \"set-page\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"banner\", kind: \"html\" },\n { prop: \"header\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n { prop: \"footer\", kind: \"html\" },\n ],\n },\n props: {\n banner: {\n description: \"Banner rendered above the header.\",\n type: { kind: \"html\" },\n },\n children: {\n description: \"Main content of the page.\",\n type: { kind: \"html\" },\n },\n centerMain: {\n default: false,\n description: \"Centers the main region within the page shell.\",\n type: { kind: \"boolean\" },\n },\n header: {\n description: \"Header content.\",\n required: true,\n type: { kind: \"html\" },\n },\n headerBorder: {\n description:\n \"Bottom border on the header. `'always'` is persistent; `'scroll'` fades in only when a sticky header is stuck (browsers without `container-type: scroll-state` fall back to always-on).\",\n type: { kind: \"enum\", values: [\"always\", \"scroll\"] },\n },\n headerSize: {\n default: \"md\",\n description:\n \"Reserves a minimum block size on the header. `--set-page-header-block-size` is exposed to descendants so persistent panels can open below the header band.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\", \"lg\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n stickyHeader: {\n description: \"When the header stays stuck to the top of the viewport.\",\n type: { kind: \"enum\", values: [\"always\", \"belowNotebook\"] },\n },\n footer: {\n description: \"Footer content.\",\n required: true,\n type: { kind: \"html\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-center-main\",\n condition: { kind: \"when-truthy\", prop: \"centerMain\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-header-border\",\n condition: { kind: \"when-provided\", prop: \"headerBorder\" },\n value: { kind: \"prop\", prop: \"headerBorder\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-header-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"headerSize\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-sticky-header\",\n condition: { kind: \"when-provided\", prop: \"stickyHeader\" },\n value: { kind: \"prop\", prop: \"stickyHeader\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetPanelPadding = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface SetPanelProps {\n /** Trusted inner HTML. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Inner spacing scale. @default \"md\" */\n padding?: SetPanelPadding;\n /** Surface context. */\n surface?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set panel component.\n *\n * @param props - Panel component props.\n * @returns IR node for a panel wrapper.\n */\nexport function buildSetPanel({\n children,\n id,\n padding = \"md\",\n surface,\n}: SetPanelProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-panel\",\n \"data-padding\": padding,\n \"data-set-surface\": surface,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set panel component.\n *\n * @param props - Panel component props.\n * @returns HTML string for a panel wrapper.\n */\nexport function renderSetPanel(props: SetPanelProps): string {\n return serializeSetNode(buildSetPanel(props));\n}\n\n/** Declarative panel contract mirror for tooling, docs, and adapters. */\nexport const SET_PANEL_SPEC: SetComponentSpec = {\n name: \"panel\",\n description: \"Use `panel` to group related content in a contained region.\",\n output: { element: \"div\", class: \"set-panel\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the panel.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n padding: {\n default: \"md\",\n description: \"Inner spacing scale.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n surface: {\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-padding\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"padding\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetPatternSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fill\";\nexport type SetPatternTone = \"default\" | \"subtle\" | \"support\";\nexport type SetPatternVariant = \"tile\" | \"tileLight\" | \"tileDark\";\n\nexport interface SetPatternProps {\n /** Trusted inner HTML rendered inside the pattern container. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Pattern variant. @default \"tile\" */\n variant?: SetPatternVariant;\n /** Tone. @default \"default\" */\n tone?: SetPatternTone;\n /** Size mode. @default \"md\" */\n size?: SetPatternSize;\n}\n\n/**\n * Builds the IR tree for the Set pattern component.\n *\n * @param props - Pattern component props.\n * @returns IR node for a pattern container.\n */\nexport function buildSetPattern({\n children,\n id,\n size = \"md\",\n tone = \"default\",\n variant = \"tile\",\n}: SetPatternProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-pattern\",\n \"data-size\": size,\n \"data-tone\": tone === \"default\" ? undefined : tone,\n \"data-variant\": variant,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set pattern component.\n *\n * @param props - Pattern component props.\n * @returns HTML string for a pattern container.\n */\nexport function renderSetPattern(props: SetPatternProps = {}): string {\n return serializeSetNode(buildSetPattern(props));\n}\n\n/** Declarative pattern contract mirror for tooling, docs, and adapters. */\nexport const SET_PATTERN_SPEC: SetComponentSpec = {\n name: \"pattern\",\n description:\n \"Use `pattern` to render repeated visual language components behind content.\",\n output: { element: \"div\", class: \"set-pattern\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered above the pattern.\",\n type: { kind: \"html\" },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"subtle\", \"support\"] },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"fill\"] },\n },\n variant: {\n default: \"tile\",\n description: \"Shape used for the pattern tile.\",\n type: {\n kind: \"enum\",\n values: [\"tile\", \"tileLight\", \"tileDark\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-variant\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: {\n kind: \"when-in\",\n prop: \"tone\",\n values: [\"subtle\", \"support\"],\n },\n value: { kind: \"prop\", prop: \"tone\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport { renderSetImage, type SetImageGravity } from \"../image/image\";\nimport type { SetTheme } from \"../root/root\";\nimport type { SetSurfaceVariant } from \"../surface/surface\";\n\nexport type SetPosterSurface = Exclude<\n SetSurfaceVariant,\n \"inverse\" | \"brand-inverse\"\n>;\n\ndeclare const __posterMediaTag: unique symbol;\n/**\n * HTML string returned by `renderSetPosterImage`. The tagged type forces\n * consumers through the helper, which locks the cover/priority defaults\n * Poster's layout needs.\n */\nexport type SetPosterMedia = string & {\n readonly [__posterMediaTag]: true;\n};\n\ndeclare const __posterAdaptiveMediaTag: unique symbol;\n/**\n * HTML string returned by `renderSetPosterImage` for adaptive media. The\n * separate tag lets Poster reject `contentTheme` at the type level:\n * adaptive media follows the ambient scheme, so a lock would strand the\n * other variant.\n */\nexport type SetPosterAdaptiveMedia = string & {\n readonly [__posterAdaptiveMediaTag]: true;\n};\n\nexport interface SetPosterImageProps {\n /** Show the light or dark variant to match the surrounding scheme. @default false */\n adaptive?: boolean;\n /** Focal gravity for the cover crop. @default \"C\" */\n gravity?: SetImageGravity;\n /** HTML `sizes` attribute. */\n sizes?: string;\n /** Image source URL. */\n src: string;\n /** Candidate sources for the image (HTML `img[srcset]` format). */\n srcSet?: string;\n}\n\n/**\n * Renders the image media for a Poster. `fit` and `priority` are locked\n * to the values Poster's layout needs; `alt` is empty because Poster's\n * image is decorative (content-over-background).\n *\n * @param props - Poster image props.\n * @returns HTML string suitable for Poster's `media` prop.\n */\nexport function renderSetPosterImage(\n props: SetPosterImageProps & { adaptive: true },\n): SetPosterAdaptiveMedia;\nexport function renderSetPosterImage(\n props: SetPosterImageProps & { adaptive?: false },\n): SetPosterMedia;\nexport function renderSetPosterImage(\n props: SetPosterImageProps,\n): SetPosterMedia | SetPosterAdaptiveMedia {\n return renderSetImage({\n ...props,\n alt: \"\",\n fit: \"cover\",\n priority: true,\n }) as SetPosterMedia | SetPosterAdaptiveMedia;\n}\n\ninterface SetPosterBaseProps {\n /** Foreground HTML content above the media. Caller sanitizes untrusted content. */\n children?: string;\n /** DOM id. */\n id?: string;\n /** Surface context. Emits `data-set-surface` when provided. */\n surface?: SetPosterSurface;\n}\n\nexport type SetPosterProps = SetPosterBaseProps &\n (\n | {\n /** Absolute theme lock for foreground content over non-themeable media. */\n contentTheme?: SetTheme;\n /** Background media; build with `renderSetPosterImage`. */\n media: SetPosterMedia;\n }\n | {\n /** Adaptive media follows the ambient scheme; a lock is incoherent. */\n contentTheme?: never;\n /** Adaptive background media; build with `renderSetPosterImage`. */\n media: SetPosterAdaptiveMedia;\n }\n );\n\n/**\n * Builds the IR tree for the Set poster component.\n *\n * Accepts the props union loosely: adapters route media through slots,\n * so the adaptive/contentTheme exclusion is enforced by `SetPosterProps`\n * at authoring surfaces rather than here.\n *\n * @param props - Poster component props.\n * @returns IR node for a poster container.\n */\nexport function buildSetPoster({\n children,\n contentTheme,\n id,\n media,\n surface,\n}: SetPosterBaseProps & {\n contentTheme?: SetTheme;\n media: SetPosterMedia | SetPosterAdaptiveMedia;\n}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const resolvedSurface = contentTheme ? (surface ?? \"default\") : surface;\n const posterChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"image-wrapper\" },\n children: [{ kind: \"raw\", html: media }],\n },\n ];\n\n if (children) {\n posterChildren.push({\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"content\" },\n children: [{ kind: \"raw\", html: children }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-poster\",\n \"data-set-content-theme\": contentTheme,\n \"data-set-surface\": resolvedSurface,\n id: normalizedId,\n },\n children: posterChildren,\n };\n}\n\n/**\n * SSR renderer for the Set poster component.\n *\n * Emits a single `div.poster` root containing a media wrapper behind optional\n * trusted foreground content. `contentTheme`, when provided, is an absolute\n * local foreground theme override intended for poster-like content over\n * non-themeable media.\n *\n * @param props - Poster component props.\n * @returns HTML string for a poster container.\n */\nexport function renderSetPoster(props: SetPosterProps): string {\n return serializeSetNode(buildSetPoster(props));\n}\n\n/** Declarative poster contract mirror for tooling, docs, and adapters. */\nexport const SET_POSTER_SPEC: SetComponentSpec = {\n name: \"poster\",\n description: \"Use `poster` to layer content over background media.\",\n output: { element: \"div\", class: \"set-poster\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"media\", kind: \"html\" },\n { prop: \"children\", kind: \"html\" },\n ],\n },\n props: {\n children: {\n description: \"Foreground content rendered over the media.\",\n type: { kind: \"html\" },\n },\n contentTheme: {\n description:\n \"Absolute theme lock for foreground content over non-themeable media.\",\n ignoredWhen:\n \"`media` is adaptive (it matches the surrounding scheme by itself)\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n media: {\n description:\n \"Background media markup. Build with `renderSetPosterImage`.\",\n required: true,\n type: { kind: \"html\" },\n },\n surface: {\n description: \"Surface context.\",\n type: { kind: \"enum\", values: [\"default\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"when-provided\", prop: \"contentTheme\" },\n value: { kind: \"prop\", prop: \"contentTheme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-provided\", prop: \"contentTheme\" },\n { kind: \"not\", of: { kind: \"when-provided\", prop: \"surface\" } },\n ],\n },\n value: { kind: \"literal\", text: \"default\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"when-provided\", prop: \"surface\" },\n value: { kind: \"prop\", prop: \"surface\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetAlign } from \"../../types\";\n\nexport type SetProseHangingPunctuation = \"always\" | \"notebook\";\n\nexport interface SetProseProps {\n /** Trusted inner HTML. */\n children: string;\n /** Text alignment. @default \"start\" */\n align?: SetAlign;\n /** Hanging-indent layout behavior. */\n hangingPunctuation?: SetProseHangingPunctuation;\n /** DOM id. */\n id?: string;\n /** Enables visited-state styling for links inside prose. @default true */\n linkVisited?: boolean;\n /** Applies max measure constraints for long-form readability. @default true */\n measured?: boolean;\n /** Applies monospaced word spacing throughout. @default false */\n monospaced?: boolean;\n /** Enables breakpoint-responsive body scale. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set prose component.\n *\n * @param props - Prose component props.\n * @returns IR node for a prose wrapper.\n */\nexport function buildSetProse({\n align = \"start\",\n children,\n hangingPunctuation,\n id,\n linkVisited = true,\n measured = true,\n monospaced,\n responsive,\n}: SetProseProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-prose\",\n \"data-align\": align !== \"start\" ? align : undefined,\n \"data-hanging-punctuation\": hangingPunctuation,\n \"data-link-visited\": linkVisited ? undefined : \"off\",\n \"data-measured\": measured,\n \"data-monospaced\": monospaced,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set prose component.\n *\n * @param props - Prose component props.\n * @returns HTML string for a prose wrapper.\n */\nexport function renderSetProse(props: SetProseProps): string {\n return serializeSetNode(buildSetProse(props));\n}\n\n/** Declarative prose contract mirror for tooling, docs, and adapters. */\nexport const SET_PROSE_SPEC: SetComponentSpec = {\n name: \"prose\",\n description: \"Use `prose` to style rich-text markup.\",\n output: { element: \"div\", class: \"set-prose\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the prose wrapper.\",\n required: true,\n type: { kind: \"html\" },\n },\n align: {\n default: \"start\",\n description: \"Text alignment.\",\n type: { kind: \"enum\", values: [\"start\", \"center\", \"end\"] },\n },\n hangingPunctuation: {\n description:\n \"Position list markers and leading quote marks in the margin, with text aligned.\",\n type: { kind: \"enum\", values: [\"always\", \"notebook\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n linkVisited: {\n default: true,\n description: \"Styles visited links inside the prose.\",\n type: { kind: \"boolean\" },\n },\n measured: {\n default: true,\n description: \"Caps line length for comfortable reading.\",\n type: { kind: \"boolean\" },\n },\n monospaced: {\n default: false,\n description: \"Applies monospaced word spacing throughout.\",\n type: { kind: \"boolean\" },\n },\n responsive: {\n default: false,\n description: \"Scales body text across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-hanging-punctuation\",\n condition: { kind: \"when-provided\", prop: \"hangingPunctuation\" },\n value: { kind: \"prop\", prop: \"hangingPunctuation\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-link-visited\",\n condition: { kind: \"when-equals\", prop: \"linkVisited\", to: false },\n value: { kind: \"literal\", text: \"off\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-measured\",\n condition: { kind: \"when-truthy\", prop: \"measured\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-monospaced\",\n condition: { kind: \"when-truthy\", prop: \"monospaced\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\nimport { buildSetFieldset } from \"../fieldset/fieldset\";\n\nexport type SetRadiosOrientation = \"vertical\" | \"horizontal\";\n\nexport interface SetRadioItem {\n /** Optional per-item helper text. */\n description?: string;\n /**\n * Optional per-item disabled override.\n * @default false\n */\n disabled?: boolean;\n /** Radio option label (escaped before render). */\n label: string;\n /** Option value (submitted value and selection key). */\n value: string;\n}\n\nexport interface SetRadiosProps {\n /** Group description rendered below legend. */\n description?: string;\n /** Group disabled state. @default false */\n disabled?: boolean;\n /** Group id used for group and per-item description id derivation. */\n id: string;\n /** Group invalid state. Ignored when `disabled`. @default false */\n invalid?: boolean;\n /** Radio options. Must include at least 2 options. */\n radios: SetRadioItem[];\n /** Group legend text (escaped before render). */\n legend: string;\n /** Shared radio name applied to all options. */\n name: string;\n /** Layout orientation. @default \"vertical\" */\n orientation?: SetRadiosOrientation;\n /** Required selection state. @default false */\n required?: boolean;\n /** Size variant for all radios in the group. @default \"md\" */\n size?: SetControlSize;\n /** Selected option value. When unmatched, no option is checked. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set radios component.\n *\n * @param props - Radios component props.\n * @returns IR node for a radios fieldset.\n */\nexport function buildSetRadios({\n description,\n disabled,\n id,\n invalid,\n radios,\n legend,\n name,\n orientation = \"vertical\",\n required,\n size = \"md\",\n value,\n}: SetRadiosProps): SetNode {\n const normalizedId = id.trim();\n const normalizedName = name.trim();\n const normalizedValue = value?.trim();\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!normalizedName) {\n throw new Error(\"name must be a non-empty string.\");\n }\n\n if (radios.length < 2) {\n throw new Error(\"radios must include at least 2 options.\");\n }\n\n const normalizedRadios = radios.map((item, index) => {\n const itemValue = item.value.trim();\n const itemLabel = item.label.trim();\n const itemDescription = item.description?.trim();\n\n if (!itemValue) {\n throw new Error(`radios[${index}].value must be non-empty.`);\n }\n\n if (!itemLabel) {\n throw new Error(`radios[${index}].label must be non-empty.`);\n }\n\n return {\n description: itemDescription,\n disabled: Boolean(item.disabled),\n label: itemLabel,\n value: itemValue,\n };\n });\n\n const itemValueSet = new Set(normalizedRadios.map((item) => item.value));\n\n if (itemValueSet.size !== normalizedRadios.length) {\n throw new Error(\"radios values must be unique.\");\n }\n\n const isGroupDisabled = Boolean(disabled);\n\n const optionNodes: SetNode[] = normalizedRadios.map((item) => {\n const isItemDisabled = Boolean(item.disabled);\n const itemDescriptionId = item.description\n ? `${normalizedId}-${item.value}-description`\n : undefined;\n\n const fieldChildren: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": itemDescriptionId,\n checked: normalizedValue === item.value,\n class: \"radio\",\n disabled: isItemDisabled,\n name: normalizedName,\n required:\n Boolean(required) && !isGroupDisabled && !isItemDisabled,\n type: \"radio\",\n value: item.value,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: item.label }],\n },\n ],\n },\n ];\n\n if (item.description) {\n fieldChildren.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"radio-description\", id: itemDescriptionId },\n children: [{ kind: \"text\", value: item.description }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"radio-field\" },\n children: fieldChildren,\n };\n });\n\n const radiosNode: SetNode = {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-radios\",\n \"data-orientation\": orientation,\n \"data-size\": size,\n },\n children: optionNodes,\n };\n\n return buildSetFieldset({\n children: serializeSetNode(radiosNode),\n description,\n disabled: isGroupDisabled,\n id: normalizedId,\n invalid,\n legend,\n });\n}\n\n/**\n * SSR renderer for the Set radios component.\n *\n * @param props - Radios component props.\n * @returns HTML string for a radios fieldset.\n */\nexport function renderSetRadios(props: SetRadiosProps): string {\n return serializeSetNode(buildSetRadios(props));\n}\n\n/** Declarative radios contract mirror for tooling, docs, and adapters. */\nexport const SET_RADIOS_SPEC: SetComponentSpec = {\n name: \"radios\",\n description: \"Use `radios` to let users select one option from a short list.\",\n output: { element: \"fieldset\", class: \"set-fieldset\" },\n content: { kind: \"structured\", prop: \"radios\" },\n props: {\n description: {\n description: \"Helper text shown below the legend.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables every option in the group.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description:\n \"Unique id used to associate the group with its descriptions.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the group as invalid.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n radios: {\n description: \"Options shown in the group.\",\n required: true,\n type: {\n kind: \"array\",\n itemShape: {\n description: {\n description: \"Optional per-item helper text.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Optional per-item disabled override.\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Radio option label.\",\n required: true,\n type: { kind: \"text\" },\n },\n value: {\n description: \"Submitted value and selection key.\",\n required: true,\n type: { kind: \"string\" },\n },\n },\n },\n },\n legend: {\n description: \"Group label.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name shared by all options.\",\n required: true,\n type: { kind: \"string\" },\n },\n orientation: {\n default: \"vertical\",\n description: \"Layout direction.\",\n type: { kind: \"enum\", values: [\"vertical\", \"horizontal\"] },\n },\n required: {\n default: false,\n description: \"Requires a selection before submission.\",\n type: { kind: \"boolean\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Currently selected value.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.set-radios\" },\n attribute: \"data-orientation\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"orientation\" },\n },\n {\n target: { on: \"descendant\", selector: \"div.set-radios\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"radio\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"radio\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetBrand = \"mnsp\" | \"wrfr\";\nexport type SetDirection = \"ltr\" | \"rtl\";\nexport type SetAppOverscrollBehavior = \"none\";\nexport type SetTheme = \"light\" | \"dark\";\n\nexport interface SetRootProps {\n /** Marks this root as the owning app root; emits `data-app-root` when true. @default false */\n appRoot?: boolean;\n /** Opts into `overscroll-behavior: none` integration hooks; emits `data-app-overscroll-behavior=\"none\"`. */\n appOverscrollBehavior?: SetAppOverscrollBehavior;\n /** Brand variant applied to the root wrapper. @default \"mnsp\" */\n brand?: SetBrand;\n /** Inner HTML content. Caller sanitizes untrusted content. */\n children: string;\n /** Optional explicit text direction. */\n dir?: SetDirection;\n /** DOM id. */\n id?: string;\n /** Optional BCP47 language tag (e.g. `en-GB`). */\n lang?: string;\n /** Optional explicit theme variant. */\n theme?: SetTheme;\n}\n\n/**\n * Builds the IR tree for the Set root component.\n *\n * @param props - Root component props.\n * @returns IR node for the Set root component.\n */\nexport function buildSetRoot({\n appOverscrollBehavior,\n appRoot,\n brand = \"mnsp\",\n children,\n dir,\n id,\n lang,\n theme,\n}: SetRootProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set\",\n \"data-app-root\": appRoot,\n \"data-app-overscroll-behavior\":\n appOverscrollBehavior === \"none\" ? \"none\" : undefined,\n \"data-set-brand\": brand,\n \"data-set-theme\": theme,\n id: normalizedId,\n lang: lang === \"\" ? undefined : lang,\n dir,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set root component.\n *\n * Emits a `<div>` with the Set root class, required `data-set-brand`,\n * optional `data-set-theme`, and optional `dir`/`lang` attributes, then injects\n * the provided HTML content inside.\n *\n * @param props - Root component props.\n * @returns HTML string for the Set root component.\n */\nexport function renderSetRoot(props: SetRootProps): string {\n return serializeSetNode(buildSetRoot(props));\n}\n\n/** Declarative root contract mirror for tooling, docs, and adapters. */\nexport const SET_ROOT_SPEC: SetComponentSpec = {\n name: \"root\",\n description: \"Mandatory top-level `root` wrapper for the Set system.\",\n output: { element: \"div\", class: \"set\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n appOverscrollBehavior: {\n description: \"Disables overscroll bounce for app-shell integrations.\",\n type: { kind: \"enum\", values: [\"none\"] },\n },\n appRoot: {\n default: false,\n description: \"Marks this wrapper as the app root.\",\n type: { kind: \"boolean\" },\n },\n brand: {\n default: \"mnsp\",\n description: \"Brand identity applied to the wrapper.\",\n type: { kind: \"enum\", values: [\"mnsp\", \"wrfr\"] },\n },\n children: {\n description: \"Content rendered inside the root.\",\n required: true,\n type: { kind: \"html\" },\n },\n dir: {\n description: \"Text direction.\",\n type: { kind: \"enum\", values: [\"ltr\", \"rtl\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n lang: {\n description: \"BCP47 language tag (e.g. `en-GB`).\",\n type: { kind: \"string\" },\n },\n theme: {\n description: \"Colour theme.\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-app-overscroll-behavior\",\n condition: {\n kind: \"when-equals\",\n prop: \"appOverscrollBehavior\",\n to: \"none\",\n },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-app-root\",\n condition: { kind: \"when-truthy\", prop: \"appRoot\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-brand\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"brand\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-theme\",\n condition: { kind: \"when-provided\", prop: \"theme\" },\n value: { kind: \"prop\", prop: \"theme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"dir\",\n condition: { kind: \"when-provided\", prop: \"dir\" },\n value: { kind: \"prop\", prop: \"dir\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"lang\",\n condition: { kind: \"when-non-empty\", prop: \"lang\" },\n value: { kind: \"prop\", prop: \"lang\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetSpinnerSize =\n | \"2xs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"fill\";\nexport type SetSpinnerTone = \"default\" | \"brand\";\n\nexport interface SetSpinnerProps {\n /** DOM id. */\n id?: string;\n /** Accessible status label. */\n label?: string;\n /** Size variant. @default \"md\" */\n size?: SetSpinnerSize;\n /** Tone variant. @default \"default\" */\n tone?: SetSpinnerTone;\n}\n\n/**\n * Builds the IR tree for the Set spinner component.\n *\n * @param props - Spinner component props.\n * @returns IR node for a spinner element.\n */\nexport function buildSetSpinner({\n id,\n label,\n size = \"md\",\n tone = \"default\",\n}: SetSpinnerProps = {}): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const cells: Array<readonly [number, number]> = [\n [60, 60],\n [60, 360],\n [60, 660],\n [60, 960],\n [360, 960],\n [360, 660],\n [360, 360],\n [360, 60],\n ];\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"svg\",\n attrs: {\n \"aria-hidden\": \"true\",\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 600 1200\",\n fill: \"currentColor\",\n },\n children: cells.map(([x, y]) => ({\n kind: \"element\",\n tag: \"rect\",\n attrs: {\n class: \"cell\",\n x: String(x),\n y: String(y),\n width: \"180\",\n height: \"180\",\n },\n children: [],\n })),\n },\n ];\n\n if (label) {\n children.push({\n kind: \"element\",\n tag: \"span\",\n attrs: { class: \"visually-hidden\" },\n children: [{ kind: \"text\", value: label }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"span\",\n attrs: {\n class: \"set-spinner\",\n \"data-size\": size,\n \"data-tone\": tone === \"brand\" ? \"brand\" : undefined,\n id: normalizedId,\n role: label ? \"status\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set spinner component.\n *\n * @param props - Spinner component props.\n * @returns HTML string for a spinner element.\n */\nexport function renderSetSpinner(props: SetSpinnerProps = {}): string {\n return serializeSetNode(buildSetSpinner(props));\n}\n\n/** Declarative spinner contract mirror for tooling, docs, and adapters. */\nexport const SET_SPINNER_SPEC: SetComponentSpec = {\n name: \"spinner\",\n description: \"Use `spinner` to indicate loading or in-progress state.\",\n output: { element: \"span\", class: \"set-spinner\" },\n content: { kind: \"text\", prop: \"label\" },\n props: {\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Accessible status label announced to assistive tech.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: {\n kind: \"enum\",\n values: [\"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"fill\"],\n },\n },\n tone: {\n default: \"default\",\n description: \"Semantic tone.\",\n type: { kind: \"enum\", values: [\"default\", \"brand\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-tone\",\n condition: { kind: \"when-equals\", prop: \"tone\", to: \"brand\" },\n value: { kind: \"literal\", text: \"brand\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"role\",\n condition: { kind: \"when-non-empty\", prop: \"label\" },\n value: { kind: \"literal\", text: \"status\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\n\nexport type SetStackAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type SetStackAs = \"div\" | \"ul\";\nexport type SetStackGap = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface SetStackProps {\n /** Cross-axis alignment. @default \"stretch\" */\n align?: SetStackAlign;\n /** Element tag. @default \"div\" */\n as?: SetStackAs;\n /** Trusted inner HTML. */\n children?: string;\n /** Spacing gap size. @default \"md\" */\n gap?: SetStackGap;\n /** DOM id. */\n id?: string;\n /** Enables layout-context responsive spacing scale. @default false */\n responsive?: boolean;\n}\n\n/**\n * Builds the IR tree for the Set stack component.\n *\n * @param props - Stack component props.\n * @returns IR node for a stack wrapper.\n */\nexport function buildSetStack({\n align = \"stretch\",\n as = \"div\",\n children,\n gap = \"md\",\n id,\n responsive,\n}: SetStackProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: as,\n attrs: {\n class: \"set-stack\",\n \"data-align\": align === \"stretch\" ? undefined : align,\n \"data-gap\": gap,\n \"data-responsive\": responsive,\n id: normalizedId,\n },\n children: children ? [{ kind: \"raw\", html: children }] : [],\n };\n}\n\n/**\n * SSR renderer for the Set stack component.\n *\n * @param props - Stack component props.\n * @returns HTML string for a stack wrapper.\n */\nexport function renderSetStack(props: SetStackProps): string {\n return serializeSetNode(buildSetStack(props));\n}\n\n/** Declarative stack contract mirror for tooling, docs, and adapters. */\nexport const SET_STACK_SPEC: SetComponentSpec = {\n name: \"stack\",\n description: \"Use `stack` to lay out content in a vertical column.\",\n output: {\n element: { kind: \"switch\", prop: \"as\", cases: { div: \"div\", ul: \"ul\" } },\n class: \"set-stack\",\n },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n align: {\n default: \"stretch\",\n description: \"Aligns items on the cross axis.\",\n type: { kind: \"enum\", values: [\"stretch\", \"start\", \"center\", \"end\"] },\n },\n as: {\n default: \"div\",\n description: \"Element tag to render. `ul` children must be `<li>`.\",\n type: { kind: \"enum\", values: [\"div\", \"ul\"] },\n },\n children: {\n description: \"Items laid out in a column.\",\n type: { kind: \"html\" },\n },\n gap: {\n default: \"md\",\n description: \"Space between children.\",\n type: { kind: \"enum\", values: [\"none\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n responsive: {\n default: false,\n description: \"Scales spacing across breakpoints.\",\n type: { kind: \"boolean\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-align\",\n condition: {\n kind: \"when-in\",\n prop: \"align\",\n values: [\"start\", \"center\", \"end\"],\n },\n value: { kind: \"prop\", prop: \"align\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-gap\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"gap\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-responsive\",\n condition: { kind: \"when-truthy\", prop: \"responsive\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetTheme } from \"../root/root\";\n\nexport type SetSurfaceVariant =\n | \"default\"\n | \"brand\"\n | \"inverse\"\n | \"brand-inverse\";\n\nexport interface SetSurfaceProps {\n /** Trusted inner HTML. */\n children: string;\n /** Absolute theme lock for content rendered inside the surface. */\n contentTheme?: SetTheme;\n /** DOM id. */\n id?: string;\n /** Surface variant. @default \"default\" */\n variant?: SetSurfaceVariant;\n}\n\n/**\n * Builds the IR tree for the Set surface component.\n *\n * @param props - Surface component props.\n * @returns IR node for a surface wrapper.\n */\nexport function buildSetSurface({\n children,\n contentTheme,\n id,\n variant = \"default\",\n}: SetSurfaceProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-surface\",\n \"data-set-content-theme\": contentTheme,\n \"data-set-surface\": variant,\n id: normalizedId,\n },\n children: [{ kind: \"raw\", html: children }],\n };\n}\n\n/**\n * SSR renderer for the Set surface component.\n *\n * @param props - Surface component props.\n * @returns HTML string for a surface wrapper.\n */\nexport function renderSetSurface(props: SetSurfaceProps): string {\n return serializeSetNode(buildSetSurface(props));\n}\n\n/** Declarative surface contract mirror for tooling, docs, and adapters. */\nexport const SET_SURFACE_SPEC: SetComponentSpec = {\n name: \"surface\",\n description: \"Use `surface` to set a colour context for nested content.\",\n output: { element: \"div\", class: \"set-surface\" },\n content: { kind: \"html\", prop: \"children\" },\n props: {\n children: {\n description: \"Content rendered inside the surface.\",\n required: true,\n type: { kind: \"html\" },\n },\n contentTheme: {\n description:\n \"Absolute theme lock for content rendered inside the surface.\",\n type: { kind: \"enum\", values: [\"light\", \"dark\"] },\n },\n id: {\n description: \"DOM id.\",\n type: { kind: \"string\" },\n },\n variant: {\n default: \"default\",\n description: \"Surface context.\",\n type: {\n kind: \"enum\",\n values: [\"default\", \"brand\", \"inverse\", \"brand-inverse\"],\n },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-set-content-theme\",\n condition: { kind: \"when-provided\", prop: \"contentTheme\" },\n value: { kind: \"prop\", prop: \"contentTheme\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-set-surface\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"variant\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { normalizeOptionalHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize } from \"../../types\";\n\nexport interface SetSwitchProps {\n /** Checked state. @default false */\n checked?: boolean;\n /** Helper text rendered after the label. Requires `id`. */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** DOM id applied to the underlying input. Required when `description` is provided. */\n id?: string;\n /** Label text content (escaped before render). */\n label: string;\n /** Form field name. */\n name?: string;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Submitted field value. */\n value?: string;\n}\n\n/**\n * Builds the IR tree for the Set switch component.\n *\n * @param props - Switch component props.\n * @returns IR node for a switch field wrapper.\n */\nexport function buildSetSwitch({\n checked,\n description,\n disabled,\n id,\n label,\n name,\n size = \"md\",\n value,\n}: SetSwitchProps): SetNode {\n const normalizedId = normalizeOptionalHtmlId(id);\n const normalizedDescription = description?.trim();\n\n if (normalizedDescription && !normalizedId) {\n throw new Error(\"id must be provided when description is provided.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\" },\n children: [\n {\n kind: \"element\",\n tag: \"input\",\n attrs: {\n \"aria-describedby\": descriptionId,\n checked: Boolean(checked),\n class: \"switch\",\n disabled: Boolean(disabled),\n id: normalizedId,\n name: name || undefined,\n role: \"switch\",\n type: \"checkbox\",\n value: value || undefined,\n },\n children: [],\n },\n {\n kind: \"element\",\n tag: \"span\",\n attrs: {},\n children: [{ kind: \"text\", value: label }],\n },\n ],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: { class: \"set-switch\", \"data-size\": size },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set switch component.\n *\n * @param props - Switch component props.\n * @returns HTML string for a switch field wrapper.\n */\nexport function renderSetSwitch(props: SetSwitchProps): string {\n return serializeSetNode(buildSetSwitch(props));\n}\n\n/** Declarative switch contract mirror for tooling, docs, and adapters. */\nexport const SET_SWITCH_SPEC: SetComponentSpec = {\n name: \"switch\",\n description:\n \"Use `switch` to let users instantly toggle a setting on or off.\",\n output: { element: \"div\", class: \"set-switch\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n checked: {\n default: false,\n description: \"Whether the switch is on.\",\n type: { kind: \"boolean\" },\n },\n description: {\n description: \"Helper text shown below the label.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the switch.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"DOM id.\",\n requiredWhen: \"`description` is provided\",\n type: { kind: \"string\" },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n value: {\n description: \"Submitted value when checked.\",\n type: { kind: \"string\" },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"switch\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"type\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"checkbox\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"role\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"switch\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"checked\",\n condition: { kind: \"when-truthy\", prop: \"checked\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"value\",\n condition: { kind: \"when-non-empty\", prop: \"value\" },\n value: { kind: \"prop\", prop: \"value\" },\n },\n {\n target: { on: \"descendant\", selector: \"input\" },\n attribute: \"id\",\n condition: { kind: \"when-non-empty\", prop: \"id\" },\n value: { kind: \"prop\", prop: \"id\" },\n },\n ],\n },\n};\n","import { serializeSetNode, type SetNode } from \"../../helpers/node\";\nimport { isValidHtmlId } from \"../../helpers/string\";\nimport type { SetComponentSpec } from \"../../spec\";\nimport type { SetControlSize, SetInlineSize } from \"../../types\";\n\nexport type SetTextareaResize = \"vertical\" | \"none\";\n\nexport interface SetTextareaProps {\n /** Autocomplete hint; `false` emits `autocomplete=\"off\"`. */\n autocomplete?: string | false;\n /** Helper text rendered after the textarea (reused as validation guidance when `invalid`). */\n description?: string;\n /** Disabled state. @default false */\n disabled?: boolean;\n /** Textarea id; used for `textarea[id]` and `label[for]`. */\n id: string;\n /** Invalid state. Ignored when `disabled` or `readOnly`. @default false */\n invalid?: boolean;\n /** Label text content (escaped before render). */\n label: string;\n /** Field name attribute. */\n name?: string;\n /** Read-only state. Ignored when `disabled`. @default false */\n readOnly?: boolean;\n /** Required state. @default false */\n required?: boolean;\n /** Resize behavior. @default \"vertical\" */\n resize?: SetTextareaResize;\n /** Number of visible text rows. Must be an integer >= 2. @default 2 */\n rows?: number;\n /** Size variant. @default \"md\" */\n size?: SetControlSize;\n /** Spellcheck behavior. Omitted by default. */\n spellcheck?: boolean;\n /** Current value. */\n value?: string;\n /** Inline-size behavior. @default \"full\" */\n inlineSize?: SetInlineSize;\n}\n\n/**\n * Builds the IR tree for the Set textarea component.\n *\n * @param props - Textarea component props.\n * @returns IR node for a labeled textarea field wrapper.\n */\nexport function buildSetTextarea({\n autocomplete,\n description,\n disabled,\n id,\n invalid,\n label,\n name,\n readOnly,\n required,\n resize = \"vertical\",\n rows = 2,\n size = \"md\",\n spellcheck,\n value,\n inlineSize = \"full\",\n}: SetTextareaProps): SetNode {\n const normalizedId = id.trim();\n const normalizedDescription = description?.trim();\n const normalizedAutocomplete =\n autocomplete === false ? false : autocomplete?.trim();\n const normalizedName = name?.trim();\n const normalizedValue = value;\n\n if (!normalizedId) {\n throw new Error(\"id must be a non-empty string.\");\n }\n\n if (!isValidHtmlId(normalizedId)) {\n throw new Error(\n \"id must start with a letter and contain only letters, numbers, '_', '-', or ':'.\",\n );\n }\n\n if (!Number.isInteger(rows) || rows < 2) {\n throw new Error(\"rows must be an integer greater than or equal to 2.\");\n }\n\n const descriptionId = normalizedDescription\n ? `${normalizedId}-description`\n : undefined;\n\n const isDisabled = Boolean(disabled);\n const isReadOnly = !isDisabled && Boolean(readOnly);\n const isInvalid = !isDisabled && !isReadOnly && Boolean(invalid);\n\n const children: SetNode[] = [\n {\n kind: \"element\",\n tag: \"label\",\n attrs: { class: \"label\", for: normalizedId },\n children: [{ kind: \"text\", value: label }],\n },\n {\n kind: \"element\",\n tag: \"textarea\",\n attrs: {\n \"aria-describedby\": descriptionId,\n \"aria-invalid\": isInvalid ? \"true\" : undefined,\n autocomplete:\n normalizedAutocomplete === false\n ? \"off\"\n : normalizedAutocomplete || undefined,\n class: \"textarea\",\n disabled: isDisabled,\n id: normalizedId,\n name: normalizedName || undefined,\n readonly: isReadOnly,\n required: Boolean(required),\n rows: String(rows),\n spellcheck: spellcheck === undefined ? undefined : String(spellcheck),\n },\n children: [{ kind: \"text\", value: normalizedValue || \"\" }],\n },\n ];\n\n if (normalizedDescription) {\n children.push({\n kind: \"element\",\n tag: \"p\",\n attrs: { class: \"description\", id: descriptionId },\n children: [{ kind: \"text\", value: normalizedDescription }],\n });\n }\n\n return {\n kind: \"element\",\n tag: \"div\",\n attrs: {\n class: \"set-textarea\",\n \"data-resize\": resize === \"none\" ? \"none\" : undefined,\n \"data-size\": size,\n \"data-inline-size\": inlineSize === \"fit\" ? \"fit\" : undefined,\n },\n children,\n };\n}\n\n/**\n * SSR renderer for the Set textarea component.\n *\n * @param props - Textarea component props.\n * @returns HTML string for a labeled textarea field wrapper.\n */\nexport function renderSetTextarea(props: SetTextareaProps): string {\n return serializeSetNode(buildSetTextarea(props));\n}\n\n/** Declarative textarea contract mirror for tooling, docs, and adapters. */\nexport const SET_TEXTAREA_SPEC: SetComponentSpec = {\n name: \"textarea\",\n description: \"Use `textarea` to collect multiple lines of text from users.\",\n output: { element: \"div\", class: \"set-textarea\" },\n content: {\n kind: \"slots\",\n slots: [\n { prop: \"label\", kind: \"text\" },\n { prop: \"value\", kind: \"text\" },\n { prop: \"description\", kind: \"text\" },\n ],\n },\n props: {\n autocomplete: {\n description: \"Browser autocomplete hint. Pass `false` to disable.\",\n type: {\n kind: \"union\",\n variants: [{ kind: \"string\" }, { kind: \"boolean\" }],\n },\n },\n description: {\n description:\n \"Helper text shown below the textarea; also used for validation guidance.\",\n type: { kind: \"string\" },\n },\n disabled: {\n default: false,\n description: \"Disables the textarea.\",\n type: { kind: \"boolean\" },\n },\n id: {\n description: \"`id` used to associate the textarea with its label.\",\n required: true,\n type: { kind: \"string\" },\n },\n invalid: {\n default: false,\n description: \"Marks the textarea as invalid.\",\n ignoredWhen: \"`disabled` is true or `readOnly` is true\",\n type: { kind: \"boolean\" },\n },\n label: {\n description: \"Label text.\",\n required: true,\n type: { kind: \"text\" },\n },\n name: {\n description: \"Form field name.\",\n type: { kind: \"string\" },\n },\n readOnly: {\n default: false,\n description: \"Prevents editing while keeping the value visible.\",\n ignoredWhen: \"`disabled` is true\",\n type: { kind: \"boolean\" },\n },\n required: {\n default: false,\n description: \"Requires a value before submission.\",\n type: { kind: \"boolean\" },\n },\n resize: {\n default: \"vertical\",\n description: \"How the user can resize the textarea.\",\n type: { kind: \"enum\", values: [\"vertical\", \"none\"] },\n },\n rows: {\n default: 2,\n description: \"Number of visible rows.\",\n type: { kind: \"number\", min: 2, max: 10, integer: true },\n },\n size: {\n default: \"md\",\n description: \"Size variant.\",\n type: { kind: \"enum\", values: [\"sm\", \"md\"] },\n },\n spellcheck: {\n description: \"Whether the browser checks spelling.\",\n type: { kind: \"boolean\" },\n },\n value: {\n description: \"Current value.\",\n type: { kind: \"string\" },\n },\n inlineSize: {\n default: \"full\",\n description: \"How the textarea fills its container.\",\n type: { kind: \"enum\", values: [\"full\", \"fit\"] },\n },\n },\n events: {},\n rules: {\n attributes: [\n {\n target: { on: \"host\" },\n attribute: \"data-size\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"size\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-inline-size\",\n condition: { kind: \"when-equals\", prop: \"inlineSize\", to: \"fit\" },\n value: { kind: \"literal\", text: \"fit\" },\n },\n {\n target: { on: \"host\" },\n attribute: \"data-resize\",\n condition: { kind: \"when-equals\", prop: \"resize\", to: \"none\" },\n value: { kind: \"literal\", text: \"none\" },\n },\n {\n target: { on: \"descendant\", selector: \"label\" },\n attribute: \"for\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"class\",\n condition: { kind: \"always\" },\n value: { kind: \"literal\", text: \"textarea\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"id\",\n condition: { kind: \"always\" },\n value: { kind: \"template\", pattern: \"{id}\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"rows\",\n condition: { kind: \"always\" },\n value: { kind: \"prop\", prop: \"rows\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"name\",\n condition: { kind: \"when-non-empty\", prop: \"name\" },\n value: { kind: \"prop\", prop: \"name\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"disabled\",\n condition: { kind: \"when-truthy\", prop: \"disabled\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"required\",\n condition: { kind: \"when-truthy\", prop: \"required\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"readonly\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"readOnly\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n ],\n },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"aria-invalid\",\n condition: {\n kind: \"all\",\n of: [\n { kind: \"when-truthy\", prop: \"invalid\" },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"disabled\" } },\n { kind: \"not\", of: { kind: \"when-truthy\", prop: \"readOnly\" } },\n ],\n },\n value: { kind: \"literal\", text: \"true\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"aria-describedby\",\n condition: { kind: \"when-non-empty\", prop: \"description\" },\n value: { kind: \"template\", pattern: \"{id}-description\" },\n },\n {\n target: { on: \"descendant\", selector: \"textarea\" },\n attribute: \"spellcheck\",\n condition: { kind: \"when-provided\", prop: \"spellcheck\" },\n value: { kind: \"prop\", prop: \"spellcheck\" },\n },\n ],\n },\n};\n","import \"./styles.css\";\n\nimport { defineSetAlert } from \"./components/alert/alert\";\nimport { defineSetBanner } from \"./components/banner/banner\";\nimport { defineSetImage } from \"./components/image/image\";\nimport { defineSetLightswitch } from \"./components/lightswitch/lightswitch\";\nimport { defineSetMenu } from \"./components/menu/menu\";\nimport { defineSetNav } from \"./components/nav/nav\";\nimport { defineSetRange } from \"./components/range/range\";\nimport { defineSetSidebar } from \"./components/sidebar/sidebar\";\nimport { defineSetVideo } from \"./components/video/video\";\n\n/**\n * Defines all available Set runtime custom elements.\n *\n * Safe to call multiple times. Each component-level define function is\n * responsible for guarding its own registration.\n */\nexport function defineSetComponents(): void {\n defineSetAlert();\n defineSetBanner();\n defineSetImage();\n defineSetLightswitch();\n defineSetMenu();\n defineSetNav();\n defineSetRange();\n defineSetSidebar();\n defineSetVideo();\n}\n\nexport {\n buildSetAlert,\n defineSetAlert,\n renderSetAlert,\n SET_ALERT_EVENT_BEFORE_DISMISS,\n SET_ALERT_EVENT_DISMISS,\n SET_ALERT_SPEC,\n SET_ALERT_TAG_NAME,\n type SetAlertProps,\n type SetAlertSize,\n type SetAlertTone,\n} from \"./components/alert/alert\";\nexport {\n buildSetAvatar,\n getSetInitials,\n renderSetAvatar,\n SET_AVATAR_SPEC,\n type SetAvatarColor,\n type SetAvatarEntity,\n type SetAvatarProps,\n type SetAvatarSize,\n} from \"./components/avatar/avatar\";\nexport {\n buildSetBadge,\n renderSetBadge,\n SET_BADGE_SPEC,\n type SetBadgeProps,\n type SetBadgeSize,\n type SetBadgeTone,\n} from \"./components/badge/badge\";\nexport {\n buildSetBanner,\n defineSetBanner,\n renderSetBanner,\n SET_BANNER_EVENT_BEFORE_DISMISS,\n SET_BANNER_EVENT_DISMISS,\n SET_BANNER_SPEC,\n SET_BANNER_TAG_NAME,\n type SetBannerProps,\n type SetBannerTone,\n} from \"./components/banner/banner\";\nexport {\n buildSetBlockquote,\n renderSetBlockquote,\n SET_BLOCKQUOTE_SPEC,\n type SetBlockquoteProps,\n type SetBlockquoteSize,\n} from \"./components/blockquote/blockquote\";\nexport {\n buildSetBox,\n renderSetBox,\n SET_BOX_SPEC,\n type SetBoxBackground,\n type SetBoxPadding,\n type SetBoxProps,\n type SetBoxRadius,\n} from \"./components/box/box\";\nexport {\n buildSetButton,\n renderSetButton,\n SET_BUTTON_SPEC,\n type SetButtonAppearance,\n type SetButtonHasPopup,\n type SetButtonLabelVisibility,\n type SetButtonPlacement,\n type SetButtonProps,\n type SetButtonSize,\n type SetButtonTone,\n type SetButtonType,\n} from \"./components/button/button\";\nexport {\n buildSetCard,\n renderSetCard,\n SET_CARD_SPEC,\n type SetCardProps,\n} from \"./components/card/card\";\nexport {\n buildSetCheckbox,\n renderSetCheckbox,\n SET_CHECKBOX_SPEC,\n type SetCheckboxProps,\n} from \"./components/checkbox/checkbox\";\nexport {\n buildSetContainer,\n renderSetContainer,\n SET_CONTAINER_SPEC,\n type SetContainerGutter,\n type SetContainerMaxInlineSize,\n type SetContainerProps,\n} from \"./components/container/container\";\nexport {\n buildSetDetails,\n renderSetDetails,\n SET_DETAILS_SPEC,\n type SetDetailsProps,\n} from \"./components/details/details\";\nexport {\n buildSetDivider,\n renderSetDivider,\n SET_DIVIDER_SPEC,\n type SetDividerOrientation,\n type SetDividerProps,\n type SetDividerTone,\n} from \"./components/divider/divider\";\nexport {\n buildSetExpander,\n renderSetExpander,\n SET_EXPANDER_SPEC,\n type SetExpanderProps,\n type SetExpanderSize,\n} from \"./components/expander/expander\";\nexport {\n buildSetFieldset,\n renderSetFieldset,\n SET_FIELDSET_SPEC,\n type SetFieldsetProps,\n} from \"./components/fieldset/fieldset\";\nexport {\n buildSetFigure,\n renderSetFigure,\n SET_FIGURE_SPEC,\n type SetFigureProps,\n} from \"./components/figure/figure\";\nexport {\n buildSetGrid,\n buildSetGridItem,\n renderSetGrid,\n renderSetGridItem,\n SET_GRID_ITEM_SPEC,\n SET_GRID_SPEC,\n type SetGridGap,\n type SetGridItemProps,\n type SetGridProps,\n type SetGridTrack,\n} from \"./components/grid/grid\";\nexport {\n buildSetHeading,\n renderSetHeading,\n SET_HEADING_SPEC,\n type SetHeadingProps,\n type SetHeadingSize,\n} from \"./components/heading/heading\";\nexport {\n buildSetIcon,\n renderSetIcon,\n SET_ICON_NAMES,\n SET_ICON_SPEC,\n type SetIconMirrorMode,\n type SetIconProps,\n type SetIconSize,\n} from \"./components/icon/icon\";\nexport {\n buildSetImage,\n defineSetImage,\n renderSetImage,\n SET_IMAGE_SPEC,\n SET_IMAGE_TAG_NAME,\n type SetImageAspectRatio,\n type SetImageFit,\n type SetImageGravity,\n type SetImageProps,\n type SetImageScheme,\n type SetImageSource,\n} from \"./components/image/image\";\nexport {\n buildSetInline,\n renderSetInline,\n SET_INLINE_SPEC,\n type SetInlineGap,\n type SetInlineJustify,\n type SetInlineProps,\n} from \"./components/inline/inline\";\nexport {\n buildSetInput,\n renderSetInput,\n SET_INPUT_SPEC,\n type SetInputProps,\n type SetInputType,\n} from \"./components/input/input\";\nexport {\n buildSetLightswitch,\n defineSetLightswitch,\n renderSetLightswitch,\n SET_LIGHTSWITCH_EVENT_CHANGE,\n SET_LIGHTSWITCH_SPEC,\n SET_LIGHTSWITCH_STORAGE_KEY,\n SET_LIGHTSWITCH_TAG_NAME,\n type SetLightswitchAppearance,\n type SetLightswitchProps,\n type SetLightswitchSize,\n} from \"./components/lightswitch/lightswitch\";\nexport {\n buildSetLink,\n renderSetLink,\n SET_LINK_SPEC,\n type SetLinkAppearance,\n type SetLinkCurrent,\n type SetLinkLabelVisibility,\n type SetLinkPlacement,\n type SetLinkProps,\n type SetLinkSize,\n type SetLinkTarget,\n type SetLinkTone,\n} from \"./components/link/link\";\nexport {\n buildSetLogo,\n renderSetLogo,\n SET_LOGO_SPEC,\n type SetLogoProps,\n type SetLogoSize,\n type SetLogoTone,\n type SetLogoVariant,\n} from \"./components/logo/logo\";\nexport {\n buildSetMenu,\n defineSetMenu,\n renderSetMenu,\n SET_MENU_EVENT_CHOOSE,\n SET_MENU_SPEC,\n SET_MENU_TAG_NAME,\n type SetMenuItem,\n type SetMenuProps,\n} from \"./components/menu/menu\";\nexport {\n buildSetNav,\n defineSetNav,\n renderSetNav,\n SET_NAV_SPEC,\n SET_NAV_TAG_NAME,\n type SetNavItem,\n type SetNavProps,\n} from \"./components/nav/nav\";\nexport {\n buildSetPage,\n renderSetPage,\n SET_PAGE_SPEC,\n type SetPageHeaderBorder,\n type SetPageHeaderSize,\n type SetPageProps,\n type SetPageStickyHeader,\n} from \"./components/page/page\";\nexport {\n buildSetPanel,\n renderSetPanel,\n SET_PANEL_SPEC,\n type SetPanelPadding,\n type SetPanelProps,\n} from \"./components/panel/panel\";\nexport {\n buildSetPattern,\n renderSetPattern,\n SET_PATTERN_SPEC,\n type SetPatternProps,\n type SetPatternSize,\n type SetPatternTone,\n type SetPatternVariant,\n} from \"./components/pattern/pattern\";\nexport {\n buildSetPoster,\n renderSetPoster,\n renderSetPosterImage,\n SET_POSTER_SPEC,\n type SetPosterAdaptiveMedia,\n type SetPosterImageProps,\n type SetPosterMedia,\n type SetPosterProps,\n type SetPosterSurface,\n} from \"./components/poster/poster\";\nexport {\n buildSetProse,\n renderSetProse,\n SET_PROSE_SPEC,\n type SetProseHangingPunctuation,\n type SetProseProps,\n} from \"./components/prose/prose\";\nexport {\n buildSetRadios,\n renderSetRadios,\n SET_RADIOS_SPEC,\n type SetRadioItem,\n type SetRadiosOrientation,\n type SetRadiosProps,\n} from \"./components/radios/radios\";\nexport {\n buildSetRange,\n defineSetRange,\n renderSetRange,\n SET_RANGE_SPEC,\n SET_RANGE_TAG_NAME,\n type SetRangeProps,\n} from \"./components/range/range\";\nexport {\n buildSetRoot,\n renderSetRoot,\n SET_ROOT_SPEC,\n type SetAppOverscrollBehavior,\n type SetBrand,\n type SetDirection,\n type SetRootProps,\n type SetTheme,\n} from \"./components/root/root\";\nexport {\n buildSetSidebar,\n defineSetSidebar,\n renderSetSidebar,\n SET_SIDEBAR_SPEC,\n SET_SIDEBAR_TAG_NAME,\n type SetSidebarAboveNotebook,\n type SetSidebarProps,\n} from \"./components/sidebar/sidebar\";\nexport {\n buildSetSpinner,\n renderSetSpinner,\n SET_SPINNER_SPEC,\n type SetSpinnerProps,\n type SetSpinnerSize,\n type SetSpinnerTone,\n} from \"./components/spinner/spinner\";\nexport {\n buildSetStack,\n renderSetStack,\n SET_STACK_SPEC,\n type SetStackAlign,\n type SetStackGap,\n type SetStackProps,\n} from \"./components/stack/stack\";\nexport {\n buildSetSurface,\n renderSetSurface,\n SET_SURFACE_SPEC,\n type SetSurfaceProps,\n type SetSurfaceVariant,\n} from \"./components/surface/surface\";\nexport {\n buildSetSwitch,\n renderSetSwitch,\n SET_SWITCH_SPEC,\n type SetSwitchProps,\n} from \"./components/switch/switch\";\nexport {\n buildSetText,\n renderSetText,\n SET_TEXT_SPEC,\n type SetTextAs,\n type SetTextProps,\n type SetTextSize,\n type SetTextTone,\n} from \"./components/text/text\";\nexport {\n buildSetTextarea,\n renderSetTextarea,\n SET_TEXTAREA_SPEC,\n type SetTextareaProps,\n type SetTextareaResize,\n} from \"./components/textarea/textarea\";\nexport {\n buildSetVideo,\n defineSetVideo,\n renderSetVideo,\n SET_VIDEO_SPEC,\n SET_VIDEO_TAG_NAME,\n type SetVideoFit,\n type SetVideoPreload,\n type SetVideoProps,\n} from \"./components/video/video\";\nexport { serializeSetNode, type SetNode } from \"./helpers/node\";\nexport type {\n SetComponentSpec,\n SetComponentSpecEvent,\n SetComponentSpecProp,\n SetSpecAttributeRule,\n SetSpecCondition,\n SetSpecContent,\n SetSpecElement,\n SetSpecOutput,\n SetSpecPropType,\n SetSpecTarget,\n SetSpecValue,\n} from \"./spec\";\nexport type {\n SetAlign,\n SetControlSize,\n SetHeadingLevel,\n SetInlineSize,\n} from \"./types\";\n"],"names":["VOID_ELEMENTS","escapeHtml","value","serializeAttrs","record","key","serializeSetNode","node","attrString","open","inner","isValidHtmlId","normalizeOptionalHtmlId","id","trimmed","collapseWhitespace","ICON_NODES","SET_ICON_NAMES","iconNodesToSetNodes","nodes","buildSetIcon","ariaHidden","mirrored","name","size","title","iconNodes","normalizedId","normalizedTitle","titleId","children","renderSetIcon","props","SET_ICON_SPEC","buildSetButton","appearance","controls","disabled","disclosure","form","haspopup","icon","iconMirrored","iconPlacement","label","labelVisibility","tone","type","normalizedIconName","hasIcon","iconNode","labelNode","renderSetButton","SET_BUTTON_SPEC","SET_ALERT_TAG_NAME","SET_ALERT_EVENT_BEFORE_DISMISS","SET_ALERT_EVENT_DISMISS","dismissibleLabelDefault","createDismissButtonElement","dismissibleLabel","document","wrapper","getAlertIconName","getAlertRole","buildSetAlert","dismissible","inlineSize","message","normalizedDismissibleLabel","contentChildren","renderSetAlert","defineSetAlert","SetAlertElement","#onClick","event","target","beforeDismissEvent","#ensureDismissControl","SET_ALERT_SPEC","normalizeDownload","buildSetLink","current","download","href","rel","underline","normalizedIcon","normalizedDownload","renderSetLink","SET_LINK_SPEC","SET_BANNER_TAG_NAME","SET_BANNER_EVENT_BEFORE_DISMISS","SET_BANNER_EVENT_DISMISS","buildSetBanner","actionHref","actionLabel","messageChildren","renderSetBanner","defineSetBanner","SetBannerElement","SET_BANNER_SPEC","SET_IMAGE_TAG_NAME","buildSetImage","adaptive","animated","alt","aspectRatio","fit","gravity","height","lazy","leadSrc","priority","radius","shadow","sizes","sources","src","srcSet","still","width","cover","normalizedSrc","normalizedSrcSet","normalizedLeadSrc","normalizedStill","normalizedSizes","normalizedSources","source","index","normalizedMedia","normalizedType","normalizedSourceSizes","normalizedSourceLeadSrc","normalizedSourceStill","url","animatedPaired","sequenced","hasLeadSrc","motionUrls","tokened","withScheme","scheme","candidate","descriptor","buildMediaNode","imgNode","sourceNodes","reducedMotion","substituteScheme","withStillScheme","buildAnimatedMediaNode","stillSources","motionSources","buildAnimatedLead","noPreference","buildAnimatedScheme","mediaNodes","styleChunks","renderSetImage","defineSetImage","reducedMotionMedia","SetImageElement","leads","lead","#anchor","img","start","SET_IMAGE_SPEC","SET_LIGHTSWITCH_TAG_NAME","SET_LIGHTSWITCH_EVENT_CHANGE","SET_LIGHTSWITCH_STORAGE_KEY","labelDarkDefault","labelLightDefault","oppositeTheme","theme","themeIconName","buildOption","buildSetLightswitch","labelDark","labelLight","normalizedLabelDark","normalizedLabelLight","renderSetLightswitch","defineSetLightswitch","SetLightswitchElement","next","#resolvedTheme","#systemTheme","#clearStoredTheme","#storeTheme","#applyTheme","#storedTheme","#storage","windowRef","#root","#rootTheme","root","stored","SET_LIGHTSWITCH_SPEC","SET_MENU_TAG_NAME","SET_MENU_EVENT_CHOOSE","buildSetMenu","align","items","triggerIcon","triggerIconMirrored","triggerIconPlacement","triggerLabel","triggerLabelVisibility","triggerId","menuId","itemNodes","item","renderSetMenu","defineSetMenu","SetMenuElement","#onDocumentClick","#onFocusOut","#onKeyDown","#teardownListeners","#close","#setupListeners","#getTriggerButton","#getMenu","#getMenuItems","#isMenuItemDisabled","#isOpen","#setFocusedItem","normalizedIndex","#open","focusIndex","menu","trigger","restoreTriggerFocus","#choose","menuItem","activeElement","currentIndex","nextTarget","SET_MENU_SPEC","expanderLabelDefault","buildSetExpander","controlsId","expanded","normalizedLabel","renderSetExpander","SET_EXPANDER_SPEC","SET_NAV_TAG_NAME","scrollLockAttr","buildSetNav","collapsible","contentId","expanderLabel","expanderPosition","normalizedExpanderLabel","normalizedContentId","listItems","renderSetNav","defineSetNav","SetNavElement","#mediaQueryList","#onMediaQueryChange","#teardownClickListener","#teardownRuntimeListeners","#ensureExpander","#setupClickListener","#setupRuntimeListeners","#setExpanded","#getNav","#getExpanderButton","nav","content","button","#setScrollLocked","mediaQueryList","locked","SET_NAV_SPEC","SET_RANGE_TAG_NAME","buildSetRange","description","max","min","step","normalizedDescription","normalizedName","descriptionId","renderSetRange","defineSetRange","SetRangeElement","#inputWithValueSync","#onInput","#syncOutput","#installValueSync","#removeValueSync","input","output","#setOutputText","child","getValue","setValue","syncOutput","SET_RANGE_SPEC","SET_SIDEBAR_TAG_NAME","aboveNotebookMedia","collapseLabelDefault","triggerLabelDefault","createCloseButtonMarkup","buttonSize","buildSetSidebar","aboveNotebook","collapseLabel","footer","header","surface","normalizedCollapseLabel","normalizedTriggerLabel","sidebarChildren","panelId","renderSetSidebar","defineSetSidebar","SetSidebarElement","#mediaQuery","#onMediaChange","#ensureCloseControl","#syncResponsiveState","#setOpen","#getSidebar","#getCloseButton","#isCollapsed","#getAboveNotebook","sidebar","#removeCloseControl","#focusSidebar","closeButton","#isAboveNotebook","#setState","collapsed","SET_SIDEBAR_SPEC","SET_VIDEO_TAG_NAME","buildSetVideo","autoPlay","loop","muted","playsInline","poster","preload","normalizedPoster","videoNode","renderSetVideo","defineSetVideo","SetVideoElement","#autoPlayIntent","video","#syncPlayback","SET_VIDEO_SPEC","isLatinChar","char","isLowercaseToken","token","leadingInitialFromToken","leadingChar","getSetInitials","words","firstTokenInitial","initials","lowercaseSurnameToken","particleInitial","secondInitial","hyphenParts","secondPartInitial","thirdInitial","lastTokenInitial","ENTITY_ICON_MAP","COLOR_HASH","hashString","hash","normalizeInitials","normalized","resolveAccessibleLabel","resolveAvatarColor","color","buildSetAvatar","entity","normalizedInitials","accessibleLabel","derivedInitials","renderAsImage","resolvedColor","avatarAttrs","renderSetAvatar","SET_AVATAR_SPEC","buildSetBadge","floating","renderSetBadge","SET_BADGE_SPEC","buildSetText","as","linkVisited","measured","monospaced","responsive","tag","isParagraph","resolvedAlign","renderSetText","SET_TEXT_SPEC","buildSetBlockquote","attribution","quote","renderSetBlockquote","SET_BLOCKQUOTE_SPEC","buildSetBox","background","border","paddingBlock","paddingInline","renderSetBox","SET_BOX_SPEC","buildSetCard","headingLevel","note","headingTag","titleChildren","noteChildren","renderSetCard","SET_CARD_SPEC","buildSetCheckbox","checked","invalid","required","isDisabled","renderSetCheckbox","SET_CHECKBOX_SPEC","buildSetContainer","gutter","maxInlineSize","renderSetContainer","SET_CONTAINER_SPEC","buildSetDetails","summary","renderSetDetails","SET_DETAILS_SPEC","buildSetDivider","orientation","renderSetDivider","SET_DIVIDER_SPEC","buildSetFieldset","legend","derivedDescriptionId","isInvalid","fieldsetChildren","renderSetFieldset","SET_FIELDSET_SPEC","buildSetFigure","caption","renderSetFigure","SET_FIGURE_SPEC","validateGridTrack","buildSetGrid","gap","renderSetGrid","buildSetGridItem","colSpan","colSpanNarrow","colSpanWide","colStart","colStartNarrow","colStartWide","justify","rowSpan","rowSpanNarrow","rowSpanWide","rowStart","rowStartNarrow","rowStartWide","renderSetGridItem","SET_GRID_SPEC","gridTrackType","SET_GRID_ITEM_SPEC","buildSetHeading","level","opticalAlign","text","renderSetHeading","SET_HEADING_SPEC","buildSetInline","nowrap","renderSetInline","SET_INLINE_SPEC","buildSetInput","autocomplete","pattern","readOnly","spellcheck","normalizedAutocomplete","normalizedPattern","normalizedValue","isNumeric","resolvedType","resolvedPattern","resolvedSpellcheck","isReadOnly","renderSetInput","SET_INPUT_SPEC","PRIMARY_VIEWBOX","GRAPHIC_VIEWBOX","MARK_CELLS","WORD_PATH","WORD_OFFSET","markGroup","x","y","wordGroup","animatedSvg","viewBox","buildSetLogoAnimatedPrimary","buildSetLogoAnimatedGraphic","buildSetLogo","variant","isAnimated","renderSetLogo","SET_LOGO_SPEC","buildSetPage","banner","centerMain","headerBorder","headerSize","stickyHeader","regionChildren","renderSetPage","SET_PAGE_SPEC","buildSetPanel","padding","renderSetPanel","SET_PANEL_SPEC","buildSetPattern","renderSetPattern","SET_PATTERN_SPEC","renderSetPosterImage","buildSetPoster","contentTheme","media","resolvedSurface","posterChildren","renderSetPoster","SET_POSTER_SPEC","buildSetProse","hangingPunctuation","renderSetProse","SET_PROSE_SPEC","buildSetRadios","radios","normalizedRadios","itemValue","itemLabel","itemDescription","isGroupDisabled","optionNodes","isItemDisabled","itemDescriptionId","fieldChildren","renderSetRadios","SET_RADIOS_SPEC","buildSetRoot","appOverscrollBehavior","appRoot","brand","dir","lang","renderSetRoot","SET_ROOT_SPEC","buildSetSpinner","renderSetSpinner","SET_SPINNER_SPEC","buildSetStack","renderSetStack","SET_STACK_SPEC","buildSetSurface","renderSetSurface","SET_SURFACE_SPEC","buildSetSwitch","renderSetSwitch","SET_SWITCH_SPEC","buildSetTextarea","resize","rows","renderSetTextarea","SET_TEXTAREA_SPEC","defineSetComponents"],"mappings":"gFAiBA,MA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,KAAM,OAEAA,EAAM,KAAA,EAAO,QAAQ,OAAQ,GAAG,GAE9B,MACvB,CC3BO,MAAMc,GAAyC,CACpD,WAAY,CACV,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oZACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,aAAc,CACZ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,4CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,aAAc,CACZ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,uCACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,qBAAsB,CACpB,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,2EACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,cAAe,CACb,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,2CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,WAAY,CACV,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,yCACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,kBAAmB,CACjB,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,+EACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,yBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,0BACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,gBAAiB,CACf,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,0BACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,SACL,MAAO,CACL,GAAI,KACJ,GAAI,KACJ,EAAG,KACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,4CACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,mBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,+GACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,sBACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,yBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,uCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,qBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oEACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,eAAgB,CACd,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,8CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,iBAAkB,CAChB,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,6CACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,+CACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,WAAY,CACV,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mBAAA,CACL,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,gBAAA,CACL,CACF,CACF,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,6CAAA,CACL,EAEF,CACE,IAAK,SACL,MAAO,CACL,GAAI,QACJ,GAAI,OACJ,EAAG,GAAA,CACL,CACF,CACF,CACF,EAEF,cAAe,CACb,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mHACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,uEACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,4BACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,kCACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,+CAAA,CACL,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,kEAAA,CACL,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qTACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qMACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,6GACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,8MAAA,CACL,CACF,CACF,CACF,EAEF,aAAc,CACZ,CACE,IAAK,OACL,MAAO,CACL,EAAG,kBACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,UACH,iBAAkB,QAAA,CACpB,CACF,EAEF,QAAS,CACP,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,iLAAA,CACL,EAEF,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,mDACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,CACF,CACF,EAEF,KAAM,CACJ,CACE,IAAK,OACL,MAAO,CACL,KAAM,eACN,EAAG,uDAAA,CACL,CACF,EAEF,UAAW,CACT,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,gBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,QAAS,CACP,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,2NACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,UAAW,CACT,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,ggBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,OAAQ,CACN,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,iCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,gNACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,YAAa,CACX,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,qoBACH,YAAa,UACb,iBAAkB,SAClB,YAAa,SAAA,CACf,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,oHACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,cAAe,CACb,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,oCACH,iBAAkB,QAAA,CACpB,EAEF,CACE,IAAK,OACL,MAAO,CACL,EAAG,kBACH,iBAAkB,QAAA,CACpB,CACF,CACF,CACF,EAEF,MAAO,CACL,CACE,IAAK,IACL,MAAO,CAAA,EACP,SAAU,CACR,CACE,IAAK,OACL,MAAO,CACL,EAAG,mHAAA,CACL,EAEF,CACE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