@atomic-ui/ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UQY6IUMW.js → chunk-TJOYBDKS.js} +4 -4
- package/dist/{chunk-UQY6IUMW.js.map → chunk-TJOYBDKS.js.map} +1 -1
- package/dist/{chunk-OXDMAJMZ.js → chunk-WRYV6QGA.js} +2 -2
- package/dist/{chunk-OXDMAJMZ.js.map → chunk-WRYV6QGA.js.map} +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/page.js +1 -1
- package/dist/index.js +2 -2
- package/dist/standalone/atomic-ui.js +5 -5
- package/dist/standalone/atomic-ui.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/css-tag.ts", "../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/reactive-element.ts", "../../../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/src/lit-html.ts", "../../../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/src/lit-element.ts", "../../src/base/tokens.ts", "../../src/base/styles.ts", "../../src/base/say.ts", "../../src/base/ImpaktElement.ts", "../../src/components/icon.ts", "../../src/components/button.ts", "../../src/base/FieldElement.ts", "../../src/components/text-input.ts", "../../src/components/select.ts", "../../src/components/checkbox.ts", "../../src/components/shell.ts", "../../src/base/locale.ts", "../../src/components/rows.ts", "../../src/components/switch.ts", "../../src/components/radio-group.ts", "../../src/components/alert.ts", "../../src/components/layout.ts", "../../src/components/link.ts", "../../src/components/media.ts", "../../src/components/price.ts", "../../src/components/summary-list.ts", "../../src/components/table.ts", "../../src/components/accordion.ts", "../../src/components/progress.ts", "../../src/base/tone.ts", "../../src/components/chip.ts", "../../src/components/badge.ts", "../../src/components/textarea.ts", "../../src/components/checkbox-group.ts", "../../src/components/date-input.ts", "../../src/base/scroll-lock.ts", "../../src/components/dialog.ts", "../../src/components/list.ts", "../../src/components/grid.ts", "../../src/components/help.ts", "../../src/components/page.ts", "../../src/components/navigation.ts", "../../src/components/blocks.ts", "../../src/components/fieldset.ts", "../../src/components/app-ui.ts", "../../src/components/journey.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets: boolean =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap<TemplateStringsArray, CSSStyleSheet>();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic the native feature](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array<CSSResultOrNative>\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n }\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n/**\n * Removes the `readonly` modifier from properties in the union K.\n *\n * This is a safer way to cast a value to a type with a mutable version of a\n * readonly field, than casting to an interface with the field re-declared\n * because it preserves the type of all the fields and warns on typos.\n */\ntype Mutable<T, K extends keyof T> = Omit<T, K> & {\n -readonly [P in keyof Pick<T, K>]: P extends K ? T[P] : never;\n};\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst {\n is,\n defineProperty,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n getPrototypeOf,\n} = Object;\n\nconst NODE_MODE = false;\n\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\n\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n });\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<ReactiveUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n | ComplexAttributeConverter<Type>\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n\n /**\n * Whether this property is wrapping accessors. This is set by `@property`\n * to control the initial value change and reflection logic.\n *\n * @internal\n */\n wrapped?: boolean;\n\n /**\n * When `true`, uses the initial value of the property as the default value,\n * which changes how attributes are handled:\n * - The initial value does *not* reflect, even if the `reflect` option is `true`.\n * Subsequent changes to the property will reflect, even if they are equal to the\n * default value.\n * - When the attribute is removed, the property is set to the default value\n * - The initial value will not trigger an old value in the `changedProperties` map\n * argument to update lifecycle methods.\n *\n * When set, properties must be initialized, either with a field initializer, or an\n * assignment in the constructor. Not initializing the property may lead to\n * improper handling of subsequent property assignments.\n *\n * While this behavior is opt-in, most properties that reflect to attributes should\n * use `useDefault: true` so that their initial values do not reflect.\n */\n useDefault?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues<this>` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map<PropertyKey, unknown>`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map<PropertyKey, unknown>`, but if a developer uses\n// `PropertyValues<this>` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues<T = any> = T extends object\n ? PropertyValueMap<T>\n : Map<PropertyKey, unknown>;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {\n get<K extends keyof T>(k: K): T[K] | undefined;\n set<K extends keyof T>(key: K, value: T[K]): this;\n has<K extends keyof T>(k: K): boolean;\n delete<K extends keyof T>(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean =>\n !is(value, old);\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n useDefault: false,\n hasChanged: notEqual,\n};\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind =\n | 'change-in-update'\n | 'migration'\n | 'async-perform-update';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\n// Temporary, until google3 is on TypeScript 5.2\ndeclare global {\n interface SymbolConstructor {\n readonly metadata: unique symbol;\n }\n}\n\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\n(Symbol as {metadata: symbol}).metadata ??= Symbol('metadata');\n\ndeclare global {\n // This is public global API, do not change!\n // eslint-disable-next-line no-var\n var litPropertyMetadata: WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n >;\n}\n\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n>();\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n // In the Node build, this `extends` clause will be substituted with\n // `(globalThis.HTMLElement ?? HTMLElement)`.\n //\n // This way, we will first prefer any global `HTMLElement` polyfill that the\n // user has assigned, and then fall back to the `HTMLElement` shim which has\n // been imported (see note at the top of this file about how this import is\n // generated by Rollup). Note that the `HTMLElement` variable has been\n // shadowed by this import, so it no longer refers to the global.\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having been finalized, which includes creating properties\n * from `static properties`, but does *not* include all properties created\n * from decorators.\n * @nocollapse\n */\n protected static finalized: true | undefined;\n\n /**\n * Memoized list of all element properties, including any superclass\n * properties. Created lazily on user subclasses when finalizing the class.\n *\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array<CSSResultOrNative> = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `<style>` tags when the browser doesn't\n * support adopted StyleSheets. To use such `<style>` tags with the style-src\n * CSP directive, the style-src value must either include 'unsafe-inline' or\n * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated\n * nonce.\n *\n * To provide a nonce to use on generated `<style>` elements, set\n * `window.litNonce` to a server-generated nonce in your page's HTML, before\n * loading application code:\n *\n * ```html\n * <script>\n * // Generated and unique per request:\n * window.litNonce = 'a1b2c3d4';\n * </script>\n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // Ensure we've created all properties\n this.finalize();\n // this.__attributeToPropertyMap is only undefined after finalize() in\n // ReactiveElement itself. ReactiveElement.observedAttributes is only\n // accessed with ReactiveElement as the receiver when a subclass or mixin\n // calls super.observedAttributes\n return (\n this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]\n );\n }\n\n private __instanceProperties?: PropertyValues = undefined;\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // If this is a state property, force the attribute to false.\n if (options.state) {\n (options as Mutable<PropertyDeclaration, 'attribute'>).attribute = false;\n }\n this.__prepare();\n // Whether this property is wrapping accessors.\n // Helps control the initial value change and reflection logic.\n if (this.prototype.hasOwnProperty(name)) {\n options = Object.create(options);\n options.wrapped = true;\n }\n this.elementProperties.set(name, options);\n if (!options.noAccessor) {\n const key = DEV_MODE\n ? // Use Symbol.for in dev mode to make it easier to maintain state\n // when doing HMR.\n Symbol.for(`${String(name)} (@property() cache)`)\n : Symbol();\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n defineProperty(this.prototype, name, descriptor);\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n const {get, set} = getOwnPropertyDescriptor(this.prototype, name) ?? {\n get(this: ReactiveElement) {\n return this[key as keyof typeof this];\n },\n set(this: ReactiveElement, v: unknown) {\n (this as unknown as Record<string | symbol, unknown>)[key] = v;\n },\n };\n if (DEV_MODE && get == null) {\n if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {\n throw new Error(\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it's actually declared as a value on the prototype. ` +\n `Usually this is due to using @property or @state on a method.`\n );\n }\n issueWarning(\n 'reactive-property-without-getter',\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it does not have a getter. This will be an error in a ` +\n `future version of Lit.`\n );\n }\n return {\n get,\n set(this: ReactiveElement, value: unknown) {\n const oldValue = get?.call(this);\n set?.call(this, value);\n this.requestUpdate(name, oldValue, options);\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) ?? defaultPropertyDeclaration;\n }\n\n // Temporary, until google3 is on TypeScript 5.2\n declare static [Symbol.metadata]: object & Record<PropertyKey, unknown>;\n\n /**\n * Initializes static own properties of the class used in bookkeeping\n * for element properties, initializers, etc.\n *\n * Can be called multiple times by code that needs to ensure these\n * properties exist before using them.\n *\n * This method ensures the superclass is finalized so that inherited\n * property metadata can be copied down.\n * @nocollapse\n */\n private static __prepare() {\n if (\n this.hasOwnProperty(JSCompiler_renameProperty('elementProperties', this))\n ) {\n // Already prepared\n return;\n }\n // Finalize any superclasses\n const superCtor = getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n // Initialize elementProperties from the superclass\n this.elementProperties = new Map(superCtor.elementProperties);\n }\n\n /**\n * Finishes setting up the class so that it's ready to be registered\n * as a custom element and instantiated.\n *\n * This method is called by the ReactiveElement.observedAttributes getter.\n * If you override the observedAttributes getter, you must either call\n * super.observedAttributes to trigger finalization, or call finalize()\n * yourself.\n *\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this))) {\n return;\n }\n this.finalized = true;\n this.__prepare();\n\n // Create properties from the static properties block:\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n const propKeys = [\n ...getOwnPropertyNames(props),\n ...getOwnPropertySymbols(props),\n ] as Array<keyof typeof props>;\n for (const p of propKeys) {\n this.createProperty(p, props[p]);\n }\n }\n\n // Create properties from standard decorator metadata:\n const metadata = this[Symbol.metadata];\n if (metadata !== null) {\n const properties = litPropertyMetadata.get(metadata);\n if (properties !== undefined) {\n for (const [p, options] of properties) {\n this.elementProperties.set(p, options);\n }\n }\n }\n\n // Create the attribute-to-property map\n this.__attributeToPropertyMap = new Map();\n for (const [p, options] of this.elementProperties) {\n const attr = this.__attributeNameForProperty(p, options);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n }\n }\n\n this.elementStyles = this.finalizeStyles(this.styles);\n\n if (DEV_MODE) {\n if (this.hasOwnProperty('createProperty')) {\n issueWarning(\n 'no-override-create-property',\n 'Overriding ReactiveElement.createProperty() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n if (this.hasOwnProperty('getPropertyDescriptor')) {\n issueWarning(\n 'no-override-get-property-descriptor',\n 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n }\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array<CSSResultOrNative> {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array<unknown> works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array<unknown>).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | DocumentFragment;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise<boolean>;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Records property default values when the\n * `useDefault` option is used.\n */\n private __defaultValues?: Map<PropertyKey, unknown>;\n\n /**\n * Properties that should be reflected when updated.\n */\n private __reflectingProperties?: Set<PropertyKey>;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: Set<ReactiveController>;\n\n constructor() {\n super();\n this.__initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n */\n private __initialize() {\n this.__updatePromise = new Promise<boolean>(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n // This enqueues a microtask that must run before the first update, so it\n // must be called before requestUpdate()\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= new Set()).add(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n this.__controllers?.delete(controller);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs.\n */\n private __saveInstanceProperties() {\n const instanceProperties = new Map<PropertyKey, unknown>();\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n for (const p of elementProperties.keys() as IterableIterator<keyof this>) {\n if (this.hasOwnProperty(p)) {\n instanceProperties.set(p, this[p]);\n delete this[p];\n }\n }\n if (instanceProperties.size > 0) {\n this.__instanceProperties = instanceProperties;\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // Create renderRoot before controllers `hostConnected`\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [responding to attribute changes](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(name: PropertyKey, value: unknown) {\n const elemProperties: PropertyDeclarationMap = (\n this.constructor as typeof ReactiveElement\n ).elementProperties;\n const options = elemProperties.get(name)!;\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'migration'\n ) &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n const convertedValue = converter.fromAttribute!(value, options.type);\n this[propName as keyof this] =\n convertedValue ??\n this.__defaultValues?.get(propName) ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (convertedValue as any);\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @param useNewValue if true, the newValue argument is used instead of\n * reading the property value. This is important to use if the reactive\n * property is a standard private accessor, as opposed to a plain\n * property, since private members can't be dynamically read by name.\n * @param newValue the new value of the property. This is only used if\n * `useNewValue` is true.\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n useNewValue = false,\n newValue?: unknown\n ): void {\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n if (DEV_MODE && (name as unknown) instanceof Event) {\n issueWarning(\n ``,\n `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`\n );\n }\n const ctor = this.constructor as typeof ReactiveElement;\n if (useNewValue === false) {\n newValue = this[name as keyof this];\n }\n options ??= ctor.getPropertyOptions(name);\n const changed =\n (options.hasChanged ?? notEqual)(newValue, oldValue) ||\n // When there is no change, check a corner case that can occur when\n // 1. there's a initial value which was not reflected\n // 2. the property is subsequently set to this value.\n // For example, `prop: {useDefault: true, reflect: true}`\n // and el.prop = 'foo'. This should be considered a change if the\n // attribute is not set because we will now reflect the property to the attribute.\n (options.useDefault &&\n options.reflect &&\n newValue === this.__defaultValues?.get(name) &&\n !this.hasAttribute(ctor.__attributeNameForProperty(name, options)!));\n if (changed) {\n this._$changeProperty(name, oldValue, options);\n } else {\n // Abort the request if the property should not be considered changed.\n return;\n }\n }\n if (this.isUpdatePending === false) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n }\n\n /**\n * @internal\n */\n _$changeProperty(\n name: PropertyKey,\n oldValue: unknown,\n {useDefault, reflect, wrapped}: PropertyDeclaration,\n initializeValue?: unknown\n ) {\n // Record default value when useDefault is used. This allows us to\n // restore this value when the attribute is removed.\n if (useDefault && !(this.__defaultValues ??= new Map()).has(name)) {\n this.__defaultValues.set(\n name,\n initializeValue ?? oldValue ?? this[name as keyof this]\n );\n // if this is not wrapping an accessor, it must be an initial setting\n // and in this case we do not want to record the change or reflect.\n if (wrapped !== true || initializeValue !== undefined) {\n return;\n }\n }\n // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(\n // vs just Map.set()\n if (!this._$changedProperties.has(name)) {\n // On the initial change, the old value should be `undefined`, except\n // with `useDefault`\n if (!this.hasUpdated && !useDefault) {\n oldValue = undefined;\n }\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `__reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (reflect === true && this.__reflectingProperty !== name) {\n (this.__reflectingProperties ??= new Set<PropertyKey>()).add(name);\n }\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise<unknown> {\n const result = this.performUpdate();\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'async-perform-update'\n ) &&\n typeof (result as unknown as Promise<unknown> | undefined)?.then ===\n 'function'\n ) {\n issueWarning(\n 'async-perform-update',\n `Element ${this.localName} returned a Promise from performUpdate(). ` +\n `This behavior is deprecated and will be removed in a future ` +\n `version of ReactiveElement.`\n );\n }\n return result;\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * @category updates\n */\n protected performUpdate(): void {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n if (!this.hasUpdated) {\n // Create renderRoot before first update. This occurs in `connectedCallback`\n // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n if (DEV_MODE) {\n // Produce warning if any reactive properties on the prototype are\n // shadowed by class fields. Instance fields set before upgrade are\n // deleted by this point, so any own property is caused by class field\n // initialization in the constructor.\n const ctor = this.constructor as typeof ReactiveElement;\n const shadowedProperties = [...ctor.elementProperties.keys()].filter(\n (p) => this.hasOwnProperty(p) && p in getPrototypeOf(this)\n );\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // TODO (justinfagnani): should we use the stored value? Could a new value\n // have been set since we stored the own property value?\n for (const [p, value] of this.__instanceProperties) {\n this[p as keyof this] = value as this[keyof this];\n }\n this.__instanceProperties = undefined;\n }\n // Trigger initial value reflection and populate the initial\n // `changedProperties` map, but only for the case of properties created\n // via `createProperty` on accessors, which will not have already\n // populated the `changedProperties` map since they are not set.\n // We can't know if these accessors had initializers, so we just set\n // them anyway - a difference from experimental decorators on fields and\n // standard decorators on auto-accessors.\n // For context see:\n // https://github.com/lit/lit/pull/4183#issuecomment-1711959635\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n if (elementProperties.size > 0) {\n for (const [p, options] of elementProperties) {\n const {wrapped} = options;\n const value = this[p as keyof this];\n if (\n wrapped === true &&\n !this._$changedProperties.has(p) &&\n value !== undefined\n ) {\n this._$changeProperty(p, undefined, options, value);\n }\n }\n }\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'change-in-update'\n )\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise<boolean> {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise<boolean> {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n // The forEach() expression will only run when __reflectingProperties is\n // defined, and it returns undefined, setting __reflectingProperties to\n // undefined\n this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) =>\n this.__propertyToAttribute(p, this[p as keyof this])\n ) as undefined;\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n// Assigned here to work around a jscompiler bug with static fields\n// when compiling to ES5.\n// https://github.com/google/closure-compiler/issues/3177\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('elementProperties', ReactiveElement)\n] = new Map();\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', ReactiveElement)\n] = new Map();\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = [\n 'change-in-update',\n 'async-perform-update',\n ];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (!this.enabledWarnings!.includes(warning)) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('2.1.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\nimport type {TrustedHTML, TrustedTypesWindow} from 'trusted-types/lib/index.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<LitUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n });\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? (global.ShadyDOM!.wrap as <T extends Node>(node: T) => T)\n : <T extends Node>(node: T) => node;\n\nconst trustedTypes = (global as unknown as TrustedTypesWindow).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n */\nexport type UncompiledTemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\n/**\n * This is a template result that may be either uncompiled or compiled.\n *\n * In the future, TemplateResult will be this type. If you want to explicitly\n * note that a template result is potentially compiled, you can reference this\n * type and it will continue to behave the same through the next major version\n * of Lit. This can be useful for code that wants to prepare for the next\n * major version of Lit.\n */\nexport type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =\n | UncompiledTemplateResult<T>\n | CompiledTemplateResult;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg}.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n * In Lit 4, this type will be an alias of\n * MaybeCompiledTemplateResult, so that code will get type errors if it assumes\n * that Lit templates are not compiled. When deliberately working with only\n * one, use either {@linkcode CompiledTemplateResult} or\n * {@linkcode UncompiledTemplateResult} explicitly.\n */\nexport type TemplateResult<T extends ResultType = ResultType> =\n UncompiledTemplateResult<T>;\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport type MathMLTemplateResult = TemplateResult<typeof MATHML_RESULT>;\n\n/**\n * A TemplateResult that has been compiled by @lit-labs/compiler, skipping the\n * prepare step.\n */\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n // The type is a TemplateStringsArray to guarantee that the value came from\n // source code, preventing a JSON injection attack.\n h: TemplateStringsArray;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (\n values.some((val) => (val as {_$litStatic$: unknown})?.['_$litStatic$'])\n ) {\n issueWarning(\n '',\n `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`\n );\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\n/**\n * The root DOM node for rendering.\n */\nexport type RenderRootNode = HTMLElement | SVGElement | DocumentFragment;\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\nfunction trustFromTemplateString(\n tsa: TemplateStringsArray,\n stringFromTSA: string\n): TrustedHTML {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : (stringFromTSA as unknown as TrustedHTML);\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string> = [];\n let html =\n type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: UncompiledTemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild!;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n for (const name of (node as Element).getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = (node as Element).getAttribute(name)!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n (node as Element).removeAttribute(name);\n } else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n (node as Element).removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(\n `Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`'\n );\n }\n }\n\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\nexport type {TemplateInstance};\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n _$template: Template;\n _$parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n readonly ctor: typeof AttributePart;\n readonly strings: ReadonlyArray<string>;\n};\ntype ChildTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | ChildTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unused otherwise. The\n * intention would be clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(\n `[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`\n );\n console.warn(\n `Attempted to render the template host`,\n value,\n `inside itself. This is almost always a mistake, and in dev mode `,\n `we render some warning text. In production however, we'll `,\n `render it, which will usually result in an error, and sometimes `,\n `in the element disappearing from the DOM.`\n );\n return;\n }\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(\n node,\n this._$endNode\n );\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling as Text,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as UncompiledTemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(\n trustFromTemplateString(type.h, type.h[0]),\n this.options\n )),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue as TemplateInstance,\n parts: (this._$committedValue as TemplateInstance)._$parts,\n options: this.options,\n values,\n });\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: UncompiledTemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives\n * in those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start !== this._$endNode) {\n // The non-null assertion is safe because if _$startNode.nextSibling is\n // null, then _$endNode is also null, and we would not have entered this\n // loop.\n const n = wrap(start!).nextSibling;\n wrap(start!).remove();\n start = n;\n }\n }\n\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was previously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type:\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART = ATTRIBUTE_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n (wrap(this.element) as Element).toggleAttribute(\n this.name,\n !!value && value !== nothing\n );\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.3');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n });\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (\n value: unknown,\n container: RenderRootNode,\n options?: RenderOptions\n): RootPart => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {PropertyValues, ReactiveElement} from '@lit/reactive-element';\nimport {render, RenderOptions, noChange, RootPart} from 'lit-html';\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\n\nimport {LitUnstable} from 'lit-html';\nimport {ReactiveUnstable} from '@lit/reactive-element';\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Unstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | LitUnstable.DebugLog.Entry\n | ReactiveUnstable.DebugLog.Entry;\n }\n}\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\nconst DEV_MODE = true;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nexport class LitElement extends ReactiveElement {\n // This property needs to remain unminified.\n static ['_$litElement$'] = true;\n\n /**\n * @category rendering\n */\n readonly renderOptions: RenderOptions = {host: this};\n\n private __childPart: RootPart | undefined = undefined;\n\n /**\n * @category rendering\n */\n protected override createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot!.firstChild as ChildNode;\n return renderRoot;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n protected override update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = render(value, this.renderRoot, this.renderOptions);\n }\n\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n override connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n protected render(): unknown {\n return noChange;\n }\n}\n\n/**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\n(LitElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', LitElement)\n] = true;\n\n// Install hydration if available\nglobal.litElementHydrateSupport?.({LitElement});\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litElementPolyfillSupportDevMode\n : global.litElementPolyfillSupport;\npolyfillSupport?.({LitElement});\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LE = {\n _$attributeToProperty: (\n el: LitElement,\n name: string,\n value: string | null\n ) => {\n // eslint-disable-next-line\n (el as any)._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el: LitElement) => (el as any)._$changedProperties,\n};\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(global.litElementVersions ??= []).push('4.2.2');\nif (DEV_MODE && global.litElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n", "/**\n * Token helpers.\n *\n * Components never name a colour, a size or a radius. They name a token, and a\n * brand decides what it holds \u2014 which is what makes a rebrand a content\n * publish rather than a rebuild\n * ([ADR 0005](https://github.com/matthill8286/strata/blob/main/docs/decisions/0005-design-tokens.md)).\n *\n * Every reference carries a fallback so that a component dropped onto a page\n * with no token stylesheet still renders something legible. An unstyled\n * component is indistinguishable from a broken one, and the fallback is what\n * keeps a missing stylesheet a visible annoyance rather than a blank screen.\n *\n * These return `CSSResult` rather than strings. Lit's `css` tag refuses plain\n * interpolated strings, which is a deliberate guard against injecting\n * attacker-controlled text into a stylesheet; `unsafeCSS` is the documented\n * way past it and is safe here because every value is a literal in this file,\n * never anything authored or fetched.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\n\n/** `color.brand.default` \u2192 `var(--impakt-color-brand-default, <fallback>)`. */\nexport const token = (path: string, fallback: string): CSSResult => unsafeCSS(`var(--impakt-${path.replace(/\\./g, '-')}, ${fallback})`);\n\nexport const t = {\n brand: token('color.brand.default', '#1f4ed8'),\n brandHover: token('color.brand.hover', '#1b45be'),\n brandActive: token('color.brand.active', '#183ba4'),\n brandSubtle: token('color.brand.subtle', '#e4eafa'),\n onBrand: token('color.text.on-brand', '#ffffff'),\n\n surfaceCard: token('color.surface.card', '#ffffff'),\n surfaceInset: token('color.surface.inset', '#f4f4f4'),\n surfaceSubtle: token('color.surface.subtle', '#e4eafa'),\n\n text: token('color.text.default', '#1a1a1a'),\n textMuted: token('color.text.muted', '#717171'),\n textPlaceholder: token('color.text.placeholder', '#767676'),\n textHeading: token('color.text.heading', '#1f4ed8'),\n link: token('color.text.link', '#1f4ed8'),\n linkHover: token('color.text.link-hover', '#193ead'),\n\n border: token('color.border.default', '#929292'),\n borderStrong: token('color.border.strong', '#818181'),\n\n danger: token('color.status.danger.default', '#c8102e'),\n dangerText: token('color.status.danger.text', '#c8102e'),\n dangerSubtle: token('color.status.danger.subtle', '#f8e2e6'),\n warning: token('color.status.warning.default', '#b45309'),\n warningText: token('color.status.warning.text', '#b45309'),\n warningSubtle: token('color.status.warning.subtle', '#f6eae1'),\n success: token('color.status.success.default', '#047857'),\n successText: token('color.status.success.text', '#047857'),\n successSubtle: token('color.status.success.subtle', '#e0f0ea'),\n info: token('color.status.info.default', '#1f4ed8'),\n infoText: token('color.status.info.text', '#1f4ed8'),\n infoSubtle: token('color.status.info.subtle', '#e4eafa'),\n\n fontBody: token('font.family.body', 'system-ui, sans-serif'),\n fontHeading: token('font.family.heading', 'system-ui, sans-serif'),\n /** Code-like labels: hashes, branches, version lines. */\n fontMono: token('font.family.mono', 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'),\n /** The small line above a heading: the body face, or the code face for a brand that asks. */\n fontEyebrow: token('font.family.eyebrow', 'inherit'),\n\n focusShadow: token('focus.ring.shadow', '0 0 0 2px #ffffff, 0 0 0 4px #1a1a1a'),\n focusOffset: token('focus.ring.offset', '2px'),\n\n targetMin: token('target.min', '24px'),\n\n radiusSm: token('radius.sm', '2px'),\n radius: token('radius.md', '4px'),\n radiusLg: token('radius.lg', '8px'),\n\n borderThin: token('border.width.thin', '1px'),\n borderThick: token('border.width.thick', '2px'),\n\n radiusXs: token('radius.xs', '2px'),\n radiusXl: token('radius.xl', '12px'),\n radius2xl: token('radius.2xl', '16px'),\n\n /** Hairline borders and rings, from the text colour, so they suit any surface. */\n hairline: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 10%, transparent)'),\n rule: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 15%, transparent)'),\n /** A wash of the text colour, for hover and pressed states on quiet controls. */\n wash: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 5%, transparent)'),\n /** The brand at a fifth, for focus halos round fields. */\n brandHalo: unsafeCSS('color-mix(in srgb, var(--impakt-color-brand-default, #1f4ed8) 22%, transparent)'),\n\n shadowXs: token('shadow.xs', '0 1px 2px 0 rgb(0 0 0 / 0.05)'),\n shadowSm: token('shadow.sm', '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)'),\n shadowMd: token('shadow.md', '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)'),\n shadowLg: token('shadow.lg', '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)'),\n shadowXl: token('shadow.xl', '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)'),\n\n trackingTight: token('font.tracking.tight', '-0.02em'),\n trackingWide: token('font.tracking.wide', '0.06em'),\n} as const;\n\n/**\n * A size on the type scale with its own line height, so text drawn at\n * `type('xl')` has the leading that size reads best at.\n */\nexport const type = (name: string): CSSResult =>\n unsafeCSS(`font-size: var(--impakt-font-size-${name}, 1rem); line-height: var(--impakt-font-leading-${name}, 1.5);`);\n\n/** `space(3)` \u2192 `space.3`, `space(0.5)` \u2192 `space.0-5`. Spacing is always a token, never a number. */\nexport const space = (step: number): CSSResult => token(`space.${String(step).replace('.', '-')}`, `${step * 4}px`);\n/** `font.size.lg` \u2192 the custom property. */\nexport const fontSize = (name: string): CSSResult => token(`font.size.${name}`, '1rem');\nexport const lineHeight = (name: string): CSSResult => token(`font.line-height.${name}`, '1.5');\nexport const fontWeight = (name: string): CSSResult => token(`font.weight.${name}`, '400');\n\n/**\n * Space above and below a section, from the spacing scale: `none`, `sm`,\n * `md`, `lg` or `xl`, set by `space-above` and `space-below`. A section names\n * a step rather than a size, so a page keeps the brand's rhythm.\n */\nexport const spaceAround: CSSResult = css`\n :host([space-above='sm']) { margin-block-start: ${space(2)}; }\n :host([space-above='md']) { margin-block-start: ${space(4)}; }\n :host([space-above='lg']) { margin-block-start: ${space(6)}; }\n :host([space-above='xl']) { margin-block-start: ${space(8)}; }\n :host([space-above='2xl']) { margin-block-start: clamp(${space(14)}, 8vw, ${space(28)}); }\n :host([space-below='sm']) { margin-block-end: ${space(2)}; }\n :host([space-below='md']) { margin-block-end: ${space(4)}; }\n :host([space-below='lg']) { margin-block-end: ${space(6)}; }\n :host([space-below='xl']) { margin-block-end: ${space(8)}; }\n :host([space-below='2xl']) { margin-block-end: clamp(${space(14)}, 8vw, ${space(28)}); }\n`;\n", "/**\n * Shared style fragments.\n *\n * Three of these carry an accessibility guarantee and are therefore not\n * negotiable per component: the focus ring, the minimum target size and the\n * reduced-motion rule. A component that wants its own focus treatment is a\n * component that will get it subtly wrong on one brand, so there is one.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\nimport { t } from './tokens';\n\n/**\n * The focus ring.\n *\n * `:focus-visible` rather than `:focus`, so a mouse click on a button does not\n * draw a ring the user did not ask for while keyboard focus still does.\n *\n * The ring is two-tone \u2014 a light inner band inside a dark outer one \u2014 drawn\n * with `box-shadow` and a transparent `outline` behind it. The outline is not\n * decoration: it is what survives Windows High Contrast Mode, where box-shadow\n * is dropped entirely and a shadow-only ring disappears for exactly the users\n * who most need it.\n *\n * The colours come from locked tokens a brand cannot reach\n * ([ADR 0010](https://github.com/matthill8286/strata/blob/main/docs/decisions/0010-what-a-brand-may-set.md)).\n */\nexport const focusRing = css`\n :host(:focus-visible),\n :host(:not([disabled])) :focus-visible {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n`;\n\n/**\n * WCAG 2.2, 2.5.8 Target Size (Minimum): 24 by 24 CSS pixels.\n *\n * Applied as a minimum rather than a fixed size so a control grows with its\n * content and never shrinks below the floor. It reads the locked token, which\n * is deliberately outside the spacing scale \u2014 otherwise a brand tightening its\n * spacing unit would shrink every tap target with it.\n */\nexport const targetSize = css`\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n`;\n\n/**\n * Visible to a screen reader, invisible on screen.\n *\n * `clip-path` with a 1px box rather than `display: none` or `visibility:\n * hidden`, both of which remove the text from the accessibility tree \u2014 which\n * is the one thing this must not do.\n */\nexport const visuallyHidden = css`\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n`;\n\n/**\n * 2.3.3 Animation from Interactions, and plain decency.\n *\n * `0.01ms` rather than `0` because a zero-duration transition does not fire a\n * `transitionend` event in every engine, and components that wait for one hang.\n */\nexport const reducedMotion = css`\n @media (prefers-reduced-motion: reduce) {\n :host,\n :host *,\n :host *::before,\n :host *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n`;\n\n/** The base every component starts from. */\nexport const base = css`\n :host {\n box-sizing: border-box;\n font-family: ${t.fontBody};\n color: ${t.text};\n }\n :host([hidden]) {\n display: none !important;\n }\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n`;\n\n/**\n * On a touch screen a control is at least 44 by 44 CSS pixels.\n *\n * The 24px floor above is WCAG 2.2's minimum, and it is right for a mouse. A finger\n * is broader, and the design guide sets 44px on a touch screen, which is also\n * 2.5.5's enhanced size. It is applied by pointer rather than by width, because a\n * small laptop window is still driven by a mouse and a large tablet by a finger.\n * Pass the selectors that are the controls, inside the component's shadow root.\n */\nexport const touchTarget = (selector: string): CSSResult =>\n // Under :host, so it outweighs the component's own rule for the same control whatever the order.\n unsafeCSS(`@media (pointer: coarse) { :host :is(${selector}) { min-block-size: 44px; min-inline-size: 44px; } }`);\n\n/**\n * `hide-on`: an element left out on a phone, or on anything wider, so a phone's\n * header is built from the same pieces as a wide one. The width is the one the\n * nav folds at. A component that offers `hideOn` reflects it as `hide-on` and\n * adds this to its styles.\n */\nexport const hideOn = css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }\n`;\n", "/**\n * The library's own words, in the page's language (ADR 0026).\n *\n * Every word a component shows that a page did not give it, such as \"Skip to\n * content\", \"Next slide\" or \"There is a problem\", goes through `say`. The\n * renderer puts the site's wording in place before it draws a page\n * (`applySiteLanguage` in `@atomic-ui/renderer-core`), translated into the page's\n * language and with any of the site's own rewording. Without it, the English\n * here is shown, which is what every site did before it had languages.\n *\n * The English is the key, with `{name}` for a value put in, so the list of\n * words to translate (`SITE_WORDING` in `@atomic-ui/content-schemas`) can be\n * checked against this library by a test.\n */\nconst WORDING = Symbol.for('strata.wording');\n\ntype Store = { words?: Record<string, string> };\n\nexport function say(english: string, values?: Record<string, string | number>): string {\n const words = (globalThis as Record<symbol, Store | undefined>)[WORDING]?.words;\n const chosen = words?.[english];\n const text = typeof chosen === 'string' && chosen.trim() ? chosen : english;\n return values ? text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in values ? String(values[name]) : whole)) : text;\n}\n", "import { LitElement, css } from 'lit';\nimport { base, reducedMotion } from './styles';\nimport { say } from './say';\n\nlet counter = 0;\n\n/**\n * The base every Impakt component extends.\n *\n * It carries the two style fragments that are not a per-component choice \u2014 the\n * reset and the reduced-motion rule \u2014 and a stable id generator for the ARIA\n * wiring. It deliberately carries nothing else: a base class that grows\n * behaviour becomes the place every component's exceptions are negotiated.\n */\nexport class ImpaktElement extends LitElement {\n static styles = [base, reducedMotion, css``];\n\n /**\n * A unique id for this instance, for `aria-describedby` and friends.\n *\n * Generated once in the constructor rather than in `render`, because an id\n * that changes between renders breaks the relationship it exists to express\n * \u2014 and it breaks it silently, since the markup still looks correct.\n */\n protected readonly uid = `impakt-${(counter += 1)}`;\n\n protected id_(part: string): string {\n return `${this.uid}-${part}`;\n }\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.sayDefaults();\n }\n\n /**\n * The words a component ships with, in the page's language (ADR 0026).\n *\n * Defaults stay plain English in the constructor, so the component manifest\n * still sees them (a prop with no default is read as required). When the\n * element joins the page, each word it holds is looked up in the site's\n * wording; anything that is not one of Strata's own words, such as a page's\n * own text or a variant name, is left exactly as it is.\n *\n * @ignore\n */\n private sayDefaults(): void {\n const props = (this.constructor as typeof LitElement).elementProperties;\n const self = this as unknown as Record<string, unknown>;\n for (const name of props.keys()) {\n const value = self[name as string];\n if (typeof value !== 'string' || !value) continue;\n const said = say(value);\n if (said !== value) self[name as string] = said;\n }\n }\n}\n", "import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n /** Two lines: a menu drawn quieter, as a round icon button. */\n 'menu-two': svg`<path d=\"M5 9.5h14M5 14.5h14\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n /** Product navigation and actions, drawn to Lucide's shapes so they sit beside its line weight. */\n grid: svg`<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>`,\n clipboard: svg`<rect x=\"8\" y=\"2\" width=\"8\" height=\"4\" rx=\"1\"/><path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01\"/>`,\n 'map-pinned': svg`<path d=\"M18 8c0 3.6-3.9 7.4-5.4 8.8a1 1 0 0 1-1.2 0C9.9 15.4 6 11.6 6 8a6 6 0 0 1 12 0\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/><path d=\"M8.7 14H5a1 1 0 0 0-.9.7l-2 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .9-1.3l-2-6a1 1 0 0 0-.9-.7h-3.7\"/>`,\n users: svg`<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8\"/>`,\n radio: svg`<path d=\"M4.9 19.1C1 15.2 1 8.8 4.9 4.9M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5M19.1 4.9C23 8.8 23 15.1 19.1 19\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/>`,\n settings: svg`<path d=\"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.5a2 2 0 0 1-1 1.8l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.8v-.5a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n 'log-out': svg`<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9\"/>`,\n 'arrow-up-right': svg`<path d=\"M7 7h10v10M7 17L17 7\"/>`,\n more: svg`<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>`,\n upload: svg`<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>`,\n image: svg`<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-3.1-3.1a2 2 0 0 0-2.8 0L6 21\"/>`,\n lock: svg`<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>`,\n eye: svg`<path d=\"M2.1 12.3a1 1 0 0 1 0-.7 10.8 10.8 0 0 1 19.8 0 1 1 0 0 1 0 .7 10.8 10.8 0 0 1-19.8 0\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n trash: svg`<path d=\"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6\"/>`,\n pencil: svg`<path d=\"M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8L2 21.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5zM15 5l4 4\"/>`,\n 'qr-code': svg`<rect x=\"3\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"16\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"M21 16h-3a2 2 0 0 0-2 2v3M21 21v.01M12 7v3a2 2 0 0 1-2 2H7M3 12h.01M12 3h.01M12 16v.01M16 12h1M21 12v.01M12 21v-1\"/>`,\n battery: svg`<rect x=\"2\" y=\"7\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M22 11v2M6 11v2M10 11v2\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpaktIcon extends ImpaktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name:\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impakt-icon', ImpaktIcon);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-icon': ImpaktIcon;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t, token, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document \u2014 at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * **A button that goes somewhere is a link.** With `href` set it renders an\n * `<a>` styled as a button, so it opens in a new tab, shows its address and is\n * announced as a link, which is what it is.\n *\n * **An icon-only button still has a name.** With `icon` set and no words, the\n * button shows the icon alone and `label` becomes its accessible name, so a\n * screen reader says \"Back\" rather than \"button\". Without a `label` an\n * icon-only button is not rendered as icon-only, because it would be nameless\n * (4.1.2).\n *\n * @category action\n * @icon button\n * @slot - The button label.\n * @fires click - When the button is pressed. Not while it is busy or disabled.\n */\nexport class ImpaktButton extends ImpaktElement {\n static formAssociated = true;\n\n static properties = {\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n fullOnPhone: { type: Boolean, attribute: 'full-on-phone', reflect: true },\n size: { type: String, reflect: true },\n iconBefore: { type: String, attribute: 'icon-before' },\n iconAfter: { type: String, attribute: 'icon-after' },\n href: { type: String },\n icon: { type: String },\n label: { type: String },\n };\n\n /** Leave it out on a phone, where a header has no room for it. */\n declare hideOn: 'never' | 'phone';\n /**\n * How much the button asks for attention. `dark` is the strong second\n * choice on a light page, `subtle` a quiet filled one, `danger` an\n * action that removes or cancels something, and `accent` the brand's\n * second colour, for the one action a page is built around.\n */\n declare variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent';\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n /** As wide as its space on a phone only, such as a form's send button. */\n declare fullOnPhone: boolean;\n declare size: 'sm' | 'md' | 'lg';\n /** An icon before the words, such as phone or calendar. */\n declare iconBefore:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** An icon after the words, such as arrow-right. */\n declare iconAfter:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** Where the button goes, when it opens a page rather than doing something here. */\n declare href: string;\n /** Draws the button as this icon alone, a round button. Needs `label`. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** The accessible name of an icon-only button, such as \"Back\" or \"More actions\". */\n declare label: string;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\n this.fullOnPhone = false;\n this.size = 'md';\n this.iconBefore = 'none';\n this.iconAfter = 'none';\n this.href = '';\n this.icon = 'none';\n this.label = '';\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button, a'),\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n :host {\n display: inline-block;\n }\n :host([full]) {\n display: block;\n }\n @media (max-width: 40rem) { :host([full-on-phone]) { display: block; } }\n button, a {\n ${targetSize}\n box-sizing: border-box;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(2)};\n inline-size: 100%;\n min-block-size: 40px;\n padding: ${space(2)} ${space(4)};\n font-family: inherit;\n ${type('sm')}\n font-weight: ${fontWeight('semibold')};\n border-radius: ${t.radiusLg};\n border: ${t.borderThin} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n :host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 48px; padding: ${space(3)} ${space(6)}; ${type('md')} }\n .icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n /* Solid: the brand, with a hairline highlight along the top edge. */\n .primary {\n background: ${t.brand};\n color: ${t.onBrand};\n box-shadow: ${t.shadowXs}, inset 0 1px 0 0 rgb(255 255 255 / 0.12);\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impakt-color-action-hover, ${t.brandHover});\n color: var(--impakt-color-action-on-hover, ${t.onBrand});\n }\n /* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */\n .after { transition: transform 160ms ease-out; }\n :is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impakt-motion-button-turn, 0deg)); }\n @media (prefers-reduced-motion: reduce) { .after { transition: none; } }\n .primary:active:not([aria-disabled='true']) {\n background: ${t.brandActive};\n }\n\n /* Outline: the card, a hairline border and the text colour, for the second choice. */\n .secondary {\n background: ${t.surfaceCard};\n color: ${t.text};\n border-color: ${t.rule};\n box-shadow: ${t.shadowXs};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n /* Dark: the text colour as a fill, the strong second choice on a light page. */\n .dark {\n background: ${t.text};\n color: ${t.surfaceCard};\n }\n .dark:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 14%);\n }\n .dark:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 24%);\n }\n\n /* Subtle: a quiet fill, for an action that sits beside the main one. */\n .subtle {\n background: ${t.surfaceInset};\n color: ${t.text};\n }\n .subtle:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 6%);\n }\n .subtle:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 12%);\n }\n\n /* Accent: the brand's second colour as a fill, for the one action a page is built around. The words on it are the colour the tokens measured against it. */\n .accent {\n background: ${token('color.accent.default', '#e2cc40')};\n color: ${token('color.accent.on', '#1a1a1a')};\n }\n .accent:hover:not([aria-disabled='true']) {\n background: ${token('color.accent.hover', '#c7b438')};\n }\n .accent:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${token('color.accent.hover', '#c7b438')}, ${token('color.accent.on', '#1a1a1a')} 10%);\n }\n\n /* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */\n .danger {\n background: ${t.dangerText};\n color: ${t.surfaceCard};\n }\n .danger:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 15%);\n }\n .danger:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 28%);\n }\n\n /* Icon only: a round button as tall as it is wide. */\n .icon-only {\n inline-size: 40px;\n min-inline-size: 40px;\n block-size: 40px;\n min-block-size: 40px;\n padding: 0;\n border-radius: 999px;\n }\n :host([size='sm']) .icon-only { inline-size: 32px; min-inline-size: 32px; block-size: 32px; min-block-size: 32px; padding: 0; }\n :host([size='lg']) .icon-only { inline-size: 48px; min-inline-size: 48px; block-size: 48px; min-block-size: 48px; padding: 0; }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button, a {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n const iconOnly = Boolean(this.icon && this.icon !== 'none' && this.label);\n const cls = iconOnly ? `${this.variant} icon-only` : this.variant;\n if (iconOnly) {\n const drawn = iconSvg(this.icon);\n if (this.href && !this.disabled) {\n return html`<a class=${cls} href=${this.href} part=\"button\" aria-label=${this.label}>${drawn}</a>`;\n }\n return html`\n <button\n class=${cls}\n type=\"button\"\n part=\"button\"\n aria-label=${this.label}\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${drawn}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n const words = html`${iconSvg(this.iconBefore)}<slot></slot>${this.iconAfter && this.iconAfter !== 'none' ? html`<span class=\"after\" aria-hidden=\"true\">${iconSvg(this.iconAfter)}</span>` : nothing}`;\n if (this.href && !this.disabled) {\n return html`<a class=${this.variant} href=${this.href} part=\"button\">${words}</a>`;\n }\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${words}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impakt-button', ImpaktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-button': ImpaktButton;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from './ImpaktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time \u2014 a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impakt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impakt-field-width: 100%; }\n :host([width='xs']) { --impakt-field-width: 8ch; }\n :host([width='sm']) { --impakt-field-width: 14ch; }\n :host([width='md']) { --impakt-field-width: 24ch; }\n :host([width='lg']) { --impakt-field-width: 40ch; }\n`;\n\n/**\n * The base of every form control.\n *\n * @fires {CustomEvent<{ value: string }>} impakt-change - When the answer changes. The answer is in detail.value.\n */\nexport abstract class FieldElement extends ImpaktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it \u2014 which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n line-height: ${lineHeight('normal')};\n margin-block-end: ${space(1)};\n color: ${t.text};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /*\n * Only the control is dimmed. Dimming the whole host took the question,\n * the hint and the error below 4.5:1, and a disabled field still has to\n * say what it is and why it cannot be changed. The native disabled\n * control itself is exempt from the contrast criterion.\n */\n :host([disabled]) :is(input, select, textarea, button) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /**\n * Focusing the element focuses its control, so `el.focus()` from an app, a\n * React ref or the error summary's link lands where someone can type, rather\n * than on a host that cannot take focus and so silently does nothing.\n */\n focus(options?: FocusOptions): void {\n const control =\n this.renderRoot?.querySelector<HTMLElement>(`#${this.controlId}`) ?? this.renderRoot?.querySelector<HTMLElement>('input, select, textarea, button');\n if (control) control.focus(options);\n else super.focus(options);\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls \u2014 radios, checkboxes \u2014\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: this.changeDetail(value), bubbles: true, composed: true }));\n }\n\n /** What `impakt-change` carries. A control with more to say than its value adds it here. */\n protected changeDetail(value: string): { value: string } {\n return { value };\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A single-line text field.\n *\n * `inputmode` and `autocomplete` are first-class properties rather than\n * afterthoughts. 1.3.5 Identify Input Purpose is a Level AA criterion that\n * autofill satisfies directly, and it is the single cheapest accessibility win\n * in a checkout journey \u2014 a form that fills itself is a form that someone with a\n * motor impairment can actually finish.\n\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n type: { type: String },\n placeholder: { type: String },\n autocomplete: { type: String },\n inputmode: { type: String },\n maxlength: { type: Number },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n /** `search` draws a search icon at the start and rounds the field, as a search box. */\n declare type: 'text' | 'email' | 'tel' | 'number' | 'password' | 'date' | 'search';\n /**\n * Keep the label for screen readers only, for a field whose purpose is plain\n * from where it sits, such as the search in a top bar. The label stays its\n * accessible name; a placeholder is never a substitute for it.\n */\n declare hideLabel: boolean;\n declare placeholder: string;\n /** A token from the HTML autofill list \u2014 `given-name`, `postal-code`, `tel`. */\n declare autocomplete: string;\n declare inputmode: string;\n declare maxlength: number | undefined;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.type = 'text';\n this.placeholder = '';\n this.autocomplete = '';\n this.inputmode = '';\n this.maxlength = undefined;\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n input {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n input:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n input:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n input::placeholder {\n color: ${t.textPlaceholder};\n }\n input:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n /* The border thickens as well as reddening. Colour alone would carry the\n error, which 1.4.1 forbids \u2014 and the message below says it in words. */\n :host([hide-label]) .label {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n .search {\n position: relative;\n display: block;\n inline-size: min(100%, var(--impakt-field-width));\n }\n .search input {\n inline-size: 100%;\n padding-inline-start: ${space(10)};\n border-radius: 999px;\n }\n .search .icon {\n position: absolute;\n inset-inline-start: ${space(3.5)};\n inset-block-start: 50%;\n transform: translateY(-50%);\n color: ${t.textMuted};\n pointer-events: none;\n }\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n const input = this.renderInput();\n return this.type === 'search' ? html`<span class=\"search\" part=\"search\">${iconSvg('search', '20px')}${input}</span>` : input;\n }\n\n private renderInput(): TemplateResult {\n return html`\n <input\n id=${this.controlId}\n part=\"input\"\n type=${this.type}\n name=${this.name || nothing}\n .value=${this.value}\n placeholder=${this.placeholder || nothing}\n autocomplete=${this.autocomplete || nothing}\n inputmode=${this.inputmode || nothing}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLInputElement).value)}\n />\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-text-input', ImpaktTextInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-text-input': ImpaktTextInput;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch \u2014 and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpaktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n declare options: SelectOption[];\n /**\n * Keep the label for screen readers only, for a picker whose purpose is\n * plain from where it sits, such as a filter above a table or a role in a\n * team row. The label stays its accessible name.\n */\n declare hideLabel: boolean;\n declare placeholder: string;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n :host([hide-label]) .label {\n ${visuallyHidden}\n }\n select {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n select:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n select:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n select:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n :host([invalid]) select {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}\n </select>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-select', ImpaktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-select': ImpaktSelect;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A single checkbox \u2014 a consent, an opt-in, a confirmation.\n *\n * The label sits beside the box rather than above it, so this overrides the\n * base layout. The whole `<label>` is the hit area: a 20px box is legal under\n * 2.5.8 and still unkind, and the row costs nothing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckbox extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n };\n\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n cursor: pointer;\n }\n input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([invalid]) .row {\n color: ${t.dangerText};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <input\n type=\"checkbox\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"text\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </span>\n </label>\n `;\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-checkbox', ImpaktCheckbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-checkbox': ImpaktCheckbox;\n }\n}\n", "import { html, css, nothing, unsafeCSS, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One destination in a product's navigation. */\nexport interface ShellNavItem {\n /** A stable name for the destination, sent back with `impakt-navigate`. */\n id?: string;\n label: string;\n href: string;\n /** An icon from `impakt-icon`'s set, such as `grid` or `users`. */\n icon?: string;\n}\n\n/** The phone layout starts below this width. Desktop and phone only; there is no tablet layout. */\nconst PHONE = unsafeCSS('48rem');\n\n/** Normalise a path so `/jobs/` and `/jobs` compare equal. */\nfunction pathOf(href: string): string | null {\n if (!href || href.startsWith('#')) return null;\n try {\n const base = typeof location === 'undefined' ? 'http://localhost/' : location.href;\n return new URL(href, base).pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n}\n\n/**\n * Whether an item is where the person is. `current` is the path the app's\n * router reports. Without it the browser's address is used, which is right\n * for a site and stale in a single-page app that never reloads.\n *\n * An item is current on its own path and on the paths below it, so Jobs stays\n * marked on `/jobs/123`. The root item, `/`, is current only on `/`.\n */\nexport function isCurrent(href: string, current: string): boolean {\n const path = pathOf(href);\n if (!path) return false;\n const here = pathOf(current || (typeof location === 'undefined' ? '' : location.pathname));\n if (!here) return false;\n if (path === here) return true;\n return path !== '/' && here.startsWith(`${path}/`);\n}\n\n/**\n * Tell the app a navigation link was followed, so a single-page app can route\n * without a reload. The event is cancelable: an app that calls\n * `preventDefault()` on it takes over, and the browser does not follow the\n * link. A click with a modifier key, or with any button but the main one, is\n * left to the browser, so \"open in a new tab\" keeps working.\n */\nexport function announceNavigate(host: HTMLElement, event: MouseEvent, item: { href: string; id?: string }): void {\n if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n const go = new CustomEvent('impakt-navigate', {\n detail: { href: item.href, id: item.id ?? item.href },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!host.dispatchEvent(go)) event.preventDefault();\n}\n\n/**\n * A product's main navigation down the side of the screen: an icon and a word\n * for each place, with a footer slot for an action that belongs at the bottom,\n * such as Sign out.\n *\n * **The place you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and it is\n * filled, so it does not rely on a colour change alone (1.4.1).\n *\n * **Every item has a word.** The icons are decorative and hidden from screen\n * readers, because an icon alone is a guess for anyone who has not learned the\n * product.\n *\n * **It works with an app's router.** Set `current` to the router's path, and\n * cancel `impakt-navigate` to route without a reload.\n *\n * @category action\n * @icon menu\n * @slot footer - An action pinned to the bottom of the side, such as Sign out.\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When an item is followed. Cancel it to route in the app instead of the browser.\n */\nexport class ImpaktSideNav extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n current: { type: String },\n };\n /** The places, in order. */\n declare items: ShellNavItem[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The path the person is on, from the app's router. Leave empty to use the address bar. */\n declare current: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Main';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: flex; flex-direction: column; gap: ${space(5)}; block-size: 100%; }\n .card { padding: ${space(2)}; border-radius: ${t.radiusXl}; background: ${t.surfaceCard}; }\n ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(0.5)}; }\n a {\n ${targetSize}\n display: flex;\n align-items: center;\n gap: ${space(3)};\n min-block-size: 44px;\n padding: 0 ${space(3.5)};\n border-radius: ${t.radiusLg};\n color: ${t.text};\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('medium')};\n text-decoration: none;\n transition: background-color 120ms ease-in-out, color 120ms ease-in-out;\n }\n a:hover { background: ${t.surfaceInset}; }\n a[aria-current='page'] { background: ${t.text}; color: ${t.surfaceCard}; }\n .icon { flex: none; }\n .footer { margin-block-start: auto; }\n .footer.empty { display: none; }\n @media (prefers-reduced-motion: reduce) { a { transition: none; } }\n @media (forced-colors: active) { a[aria-current='page'] { border: 2px solid Highlight; } }\n `,\n ];\n\n private footerFilled = false;\n\n private onFooter(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this.footerFilled = slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim() !== '');\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n return html`\n <nav class=\"card\" aria-label=${this.label} part=\"nav\">\n <ul part=\"list\">\n ${this.items.map(\n (item) => html`\n <li>\n <a\n href=${item.href}\n part=\"link\"\n aria-current=${isCurrent(item.href, this.current) ? 'page' : nothing}\n @click=${(e: MouseEvent) => announceNavigate(this, e, item)}\n >${iconSvg(item.icon, '20px')}<span>${item.label}</span></a>\n </li>\n `,\n )}\n </ul>\n </nav>\n <div class=\"card footer ${this.footerFilled ? '' : 'empty'}\" part=\"footer\"><slot name=\"footer\" @slotchange=${this.onFooter}></slot></div>\n `;\n }\n}\n\n/**\n * A product's main navigation along the bottom of a phone screen: four or five\n * places, each an icon above a word.\n *\n * It follows the same rules as `impakt-side-nav`: the current place carries\n * `aria-current=\"page\"` and is filled, every item has a word, and\n * `impakt-navigate` lets an app route without a reload. Each item is at least\n * 48px tall, above the 24px floor of 2.5.8, because it is pressed with a thumb.\n *\n * @category action\n * @icon menu\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When an item is followed. Cancel it to route in the app instead of the browser.\n */\nexport class ImpaktTabBar extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n current: { type: String },\n };\n /** The places, in order. Four or five fit a phone. */\n declare items: ShellNavItem[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The path the person is on, from the app's router. Leave empty to use the address bar. */\n declare current: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Main';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n nav { padding: ${space(1.5)}; border-radius: ${t.radiusXl}; background: ${t.text}; box-shadow: ${t.shadowLg}; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; }\n li { flex: 1 1 0; min-inline-size: 0; }\n a {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: ${space(1)};\n min-block-size: 50px;\n padding: ${space(1)};\n border-radius: ${t.radiusLg};\n /* The resting items are a blend of the card and text colours that keeps 4.5:1 on the bar. */\n color: color-mix(in srgb, ${t.surfaceCard} 74%, ${t.text});\n font-size: 11px;\n font-weight: ${fontWeight('medium')};\n line-height: 1.25;\n text-decoration: none;\n text-align: center;\n }\n a:hover { color: ${t.surfaceCard}; }\n a[aria-current='page'] { background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 16%); color: ${t.surfaceCard}; }\n span.word { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n @media (forced-colors: active) { a[aria-current='page'] { border: 2px solid Highlight; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <nav aria-label=${this.label} part=\"nav\">\n <ul part=\"list\">\n ${this.items.map(\n (item) => html`\n <li>\n <a\n href=${item.href}\n part=\"link\"\n aria-current=${isCurrent(item.href, this.current) ? 'page' : nothing}\n @click=${(e: MouseEvent) => announceNavigate(this, e, item)}\n >${iconSvg(item.icon, '22px')}<span class=\"word\">${item.label}</span></a>\n </li>\n `,\n )}\n </ul>\n </nav>\n `;\n }\n}\n\n/**\n * The frame a signed-in product sits in, on a desktop and on a phone.\n *\n * On a desktop it is a rounded frame on a darker canvas, with the brand and\n * the side navigation on the left, a top bar along the top and the page's\n * content below it. On a phone the side navigation and the top bar step aside:\n * the page's own header sits on a dark band, the content rises over it on a\n * light sheet, and the tab bar floats at the bottom.\n *\n * **It gives the page its landmarks.** The content is the `main` landmark, the\n * top bar is a `header`, and a Skip to content link is the first thing a\n * keyboard reaches. The navigation elements bring their own `nav` landmarks.\n *\n * **Both navigations are in the page; only one is shown.** The side\n * navigation is hidden on a phone and the tab bar on a desktop, with\n * `display: none`, so a screen reader meets the one that is on screen.\n *\n * @category layout\n * @icon layout\n * @slot - The page's content.\n * @slot brand - The product's logo, at the top of the side.\n * @slot nav - The side navigation, an `impakt-side-nav`.\n * @slot workspace - The start of the top bar, such as the workspace's name.\n * @slot search - The middle of the top bar, such as a search field.\n * @slot actions - The end of the top bar: the main action and the account.\n * @slot phone-header - The page's header on a phone, on the dark band above the content.\n * @slot tab-bar - The phone navigation, an `impakt-tab-bar`.\n */\nexport class ImpaktAppShell extends ImpaktElement {\n static properties = {\n skipText: { type: String, attribute: 'skip-text' },\n topBarLabel: { type: String, attribute: 'top-bar-label' },\n };\n /** The words of the link that skips to the content. */\n declare skipText: string;\n /** What the top bar is called for a screen reader. Leave empty when there is only one top bar, as there usually is. */\n declare topBarLabel: string;\n\n constructor() {\n super();\n this.skipText = 'Skip to content';\n this.topBarLabel = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n min-block-size: 100svh;\n background: var(--impakt-shell-canvas, ${t.surfaceInset});\n color: ${t.text};\n /* The text and card colours, kept before the phone header turns them round. */\n --impakt-shell-ink: ${t.text};\n --impakt-shell-paper: ${t.surfaceCard};\n }\n .frame {\n position: relative;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: var(--impakt-shell-side, 190px) minmax(0, 1fr);\n grid-template-rows: auto 1fr;\n grid-template-areas: 'brand top' 'side main';\n gap: ${space(5)};\n min-block-size: calc(100svh - 2 * ${space(5)});\n margin: ${space(5)};\n padding: ${space(5)};\n border-radius: var(--impakt-shell-radius, 36px);\n background: ${token('color.surface.page', '#f2f5f4')};\n }\n .brand { grid-area: brand; display: flex; align-items: center; min-block-size: 52px; }\n .side { grid-area: side; display: flex; flex-direction: column; min-block-size: 0; }\n .side ::slotted(*) { flex: 1; }\n header { grid-area: top; display: flex; align-items: center; gap: ${space(5)}; min-inline-size: 0; }\n .workspace { flex: none; }\n .search { flex: 1 1 auto; display: flex; justify-content: center; min-inline-size: 0; }\n .search ::slotted(*) { inline-size: min(100%, 420px); }\n .actions { flex: none; display: flex; align-items: center; gap: ${space(3)}; }\n main { grid-area: main; min-inline-size: 0; }\n main:focus { outline: none; }\n .phone-header, .tab-bar { display: none; }\n .skip {\n position: absolute;\n inset-inline-start: ${space(2)};\n inset-block-start: ${space(2)};\n z-index: 20;\n padding: ${space(2)} ${space(4)};\n background: ${t.surfaceCard};\n color: ${t.link};\n border-radius: ${t.radius};\n transform: translateY(-200%);\n }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n\n @media (max-width: ${PHONE}) {\n :host { background: ${t.text}; }\n .frame {\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n border-radius: 0;\n min-block-size: 100svh;\n background: transparent;\n }\n .brand, .side, header { display: none; }\n /* The page's header sits on the dark band, so the elements slotted into it\n are given the card colour as their text colour. Custom properties\n inherit through the slot, so an impakt-heading or impakt-text there\n reads light without being told. */\n .phone-header {\n display: block;\n padding: calc(${space(4)} + env(safe-area-inset-top)) ${space(5)} ${space(10)};\n color: var(--impakt-shell-paper);\n --impakt-color-text-default: var(--impakt-shell-paper);\n --impakt-color-text-heading: var(--impakt-shell-paper);\n --impakt-color-text-muted: color-mix(in srgb, var(--impakt-shell-paper) 74%, var(--impakt-shell-ink));\n --impakt-color-link: var(--impakt-shell-paper);\n }\n main {\n position: relative;\n flex: 1;\n margin-block-start: calc(-1 * ${space(6)});\n /* Room for the floating tab bar, so the last of the content can scroll clear of it. */\n padding: ${space(4)} ${space(4)} calc(96px + env(safe-area-inset-bottom));\n border-radius: 28px 28px 0 0;\n background: ${token('color.surface.page', '#f2f5f4')};\n }\n .tab-bar {\n display: block;\n position: fixed;\n z-index: 10;\n inset-inline: ${space(4)};\n inset-block-end: calc(${space(3)} + env(safe-area-inset-bottom));\n }\n }\n `,\n ];\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n <div class=\"brand\" part=\"brand\"><slot name=\"brand\"></slot></div>\n <div class=\"side\" part=\"side\"><slot name=\"nav\"></slot></div>\n <header aria-label=${this.topBarLabel || nothing} part=\"top-bar\">\n <div class=\"workspace\"><slot name=\"workspace\"></slot></div>\n <div class=\"search\"><slot name=\"search\"></slot></div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </header>\n <div class=\"phone-header\" part=\"phone-header\"><slot name=\"phone-header\"></slot></div>\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><slot></slot></main>\n <div class=\"tab-bar\" part=\"tab-bar\"><slot name=\"tab-bar\"></slot></div>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-side-nav', ImpaktSideNav);\ncustomElements.define('impakt-tab-bar', ImpaktTabBar);\ncustomElements.define('impakt-app-shell', ImpaktAppShell);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-side-nav': ImpaktSideNav;\n 'impakt-tab-bar': ImpaktTabBar;\n 'impakt-app-shell': ImpaktAppShell;\n }\n}\n", "/**\n * The locale a component formats dates, numbers and money in: the language of\n * the page around it (ADR 0026). A delivered page sets `lang` on its root, or\n * on a part of the page in another language, and every component reads the\n * nearest one. English is British English, which is what Strata's sites wrote\n * before they had languages.\n */\nexport function pageLocale(el?: Element | null): string {\n const fromElement = el?.closest?.('[lang]')?.getAttribute('lang');\n const fromHost = !fromElement && el ? ((el.getRootNode?.() as ShadowRoot | undefined)?.host?.closest?.('[lang]')?.getAttribute('lang') ?? '') : '';\n const fromPage = typeof document !== 'undefined' ? document.documentElement.lang : '';\n const lang = (fromElement || fromHost || fromPage || '').trim();\n if (!lang || lang.toLowerCase() === 'en') return 'en-GB';\n return lang;\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { pageLocale } from '../base/locale';\nimport { iconSvg } from './icon';\n\n/** The light weight large numbers are set in, 300 when the theme does not say. */\nconst LIGHT = token('font.weight.light', '300');\n\n/**\n * A count with its name: \"UK 4\", \"Active import jobs 12\". A dashboard shows a\n * row of them.\n *\n * **The name comes before the number in the reading order.** A screen reader\n * says \"UK, 4\", which makes sense heard on its own; \"4, UK\" does not. With\n * `href` the whole tile is one link, named by the label, the value and the\n * caption together.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktStatTile extends ImpaktElement {\n static properties = {\n label: { type: String },\n value: { type: String },\n caption: { type: String },\n href: { type: String },\n tone: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n /** What is counted, such as \"UK\" or \"Active import jobs\". */\n declare label: string;\n /** The count or figure, such as \"4\". */\n declare value: string;\n /** A line under the figure, such as \"3 arriving in the next two weeks\". */\n declare caption: string;\n /** Where the tile goes when it is pressed, such as the list it counts. */\n declare href: string;\n /** `plain` is a quiet tile on a card; `brand` is the one figure a screen leads with. */\n declare tone: 'plain' | 'brand';\n /** `lg` sets the figure larger, for the lead figure. */\n declare size: 'md' | 'lg';\n\n constructor() {\n super();\n this.label = '';\n this.value = '';\n this.caption = '';\n this.href = '';\n this.tone = 'plain';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n .tile {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: ${space(1)};\n block-size: 100%;\n min-block-size: 84px;\n padding: ${space(3)} ${space(4)};\n border-radius: ${t.radiusLg};\n background: ${t.surfaceInset};\n color: ${t.text};\n text-decoration: none;\n }\n a.tile:hover { background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 5%); }\n .label { font-size: 11px; font-weight: ${fontWeight('medium')}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: ${t.textMuted}; }\n .value { margin-block-start: auto; font-size: 34px; line-height: 1.1; font-weight: ${LIGHT}; font-variant-numeric: tabular-nums; }\n .caption { font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n :host([size='lg']) .tile { min-block-size: 200px; padding: ${space(6)}; border-radius: ${t.radiusXl}; }\n :host([size='lg']) .label { font-size: ${fontSize('sm')}; letter-spacing: normal; text-transform: none; }\n :host([size='lg']) .value { font-size: 64px; line-height: 1; }\n :host([tone='brand']) .tile { background: ${t.brand}; color: ${t.onBrand}; }\n :host([tone='brand']) a.tile:hover { background: ${t.brandHover}; }\n :host([tone='brand']) .label, :host([tone='brand']) .caption { color: ${t.onBrand}; }\n @media (forced-colors: active) { .tile { border: 1px solid CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const inner = html`\n <span class=\"label\" part=\"label\">${this.label}</span>\n <span class=\"value\" part=\"value\">${this.value}</span>\n ${this.caption ? html`<span class=\"caption\" part=\"caption\">${this.caption}</span>` : nothing}\n `;\n return this.href ? html`<a class=\"tile\" href=${this.href} part=\"tile\">${inner}</a>` : html`<div class=\"tile\" part=\"tile\">${inner}</div>`;\n }\n}\n\n/**\n * A date as a small block of month and day: \"DEC 2\". It sits at the start of a\n * row, beside what happens on that date.\n *\n * **The full date is what a screen reader hears.** The short month and day are\n * hidden from it, and the date is read in full in the page's language, such as\n * \"2 December 2026\", because \"DEC 2\" said aloud is ambiguous.\n *\n * @category content\n * @icon calendar\n */\nexport class ImpaktDateTile extends ImpaktElement {\n static properties = {\n date: { type: String },\n tone: { type: String, reflect: true },\n };\n /** The date, as YYYY-MM-DD. */\n declare date: string;\n /** `brand` is filled with the brand colour; `plain` is a quiet tile. */\n declare tone: 'brand' | 'plain';\n\n constructor() {\n super();\n this.date = '';\n this.tone = 'brand';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-block; flex: none; }\n time {\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: 48px;\n block-size: 52px;\n border-radius: ${t.radiusLg};\n background: ${t.brand};\n color: ${t.onBrand};\n line-height: 1;\n }\n :host([tone='plain']) time { background: ${t.surfaceInset}; color: ${t.text}; }\n .month { font-size: 10px; font-weight: ${fontWeight('medium')}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; }\n .day { margin-block-start: ${space(1)}; font-size: 20px; font-weight: ${fontWeight('medium')}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { time { border: 1px solid CanvasText; } }\n `,\n ];\n\n private parts(): { month: string; day: string; full: string } | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(this.date ?? '');\n if (!match) return null;\n // Noon UTC, so no time zone moves the date to the day before or after.\n const when = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), 12));\n if (Number.isNaN(when.getTime())) return null;\n const locale = pageLocale(this);\n const say = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).format(when);\n return { month: say({ month: 'short' }).replace('.', ''), day: say({ day: 'numeric' }), full: say({ day: 'numeric', month: 'long', year: 'numeric' }) };\n }\n\n render(): TemplateResult {\n const parts = this.parts();\n if (!parts) return html`${nothing}`;\n return html`<time datetime=${this.date} part=\"tile\">\n <span class=\"month\" aria-hidden=\"true\">${parts.month}</span>\n <span class=\"day\" aria-hidden=\"true\">${parts.day}</span>\n <span class=\"sr-only\">${parts.full}</span>\n </time>`;\n }\n}\n\n/**\n * One line in a list: a title, a line of detail under it, and room at the\n * start and the end. It is the task with its tick, the job that needs\n * attention, the delivery with its date, the setting with its arrow.\n *\n * **With `href` the whole row is one target, without nesting controls in a\n * link.** The title is the link, and it is stretched over the row, so the row\n * can be pressed anywhere. Anything in the `end` slot, such as a button, sits\n * above the stretched link and stays its own control, because a button inside\n * a link is two controls a screen reader cannot tell apart (4.1.2).\n *\n * A chevron is drawn at the end of a row that is a link, as the sign that it\n * goes somewhere. Put rows in an element with `role=\"list\"` and give each\n * `role=\"listitem\"` when they are a list, so a screen reader says how many\n * there are.\n *\n * @category content\n * @icon list\n * @slot start - Before the title: a dot, a date tile, a checkbox.\n * @slot end - After the title: a badge, a button.\n */\nexport class ImpaktRow extends ImpaktElement {\n static properties = {\n heading: { type: String },\n meta: { type: String },\n href: { type: String },\n divided: { type: Boolean, reflect: true },\n muted: { type: Boolean, reflect: true },\n };\n /** The row's title. */\n declare heading: string;\n /** The line of detail under the title, such as \"CY-2026-00421 \u00B7 Due 20 Nov 2026\". */\n declare meta: string;\n /** Where the row goes when it is pressed. */\n declare href: string;\n /** Draw a hairline above the row, for rows stacked on a card. */\n declare divided: boolean;\n /** Set the title quieter, for something finished, such as a done task. */\n declare muted: boolean;\n\n constructor() {\n super();\n this.heading = '';\n this.meta = '';\n this.href = '';\n this.divided = false;\n this.muted = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n :host([divided]) .row { border-block-start: ${t.borderThin} solid ${t.hairline}; }\n .row { position: relative; display: flex; align-items: center; gap: ${space(3)}; padding-block: ${space(3)}; }\n .text { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: ${space(0.5)}; }\n .title { font-size: ${fontSize('md')}; font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([muted]) .title { color: ${t.textMuted}; font-weight: ${fontWeight('regular')}; }\n .meta { font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n a { color: inherit; text-decoration: none; }\n /* The link is stretched over the row, so the row is one target. */\n a::after { content: ''; position: absolute; inset: 0; border-radius: ${t.radius}; }\n a:focus-visible { outline: none; }\n a:focus-visible::after { box-shadow: ${t.focusShadow}; }\n .row:has(a):hover .title { text-decoration: underline; text-underline-offset: 0.2em; }\n .start, .end { flex: none; display: flex; align-items: center; gap: ${space(2)}; }\n .start.empty, .end.empty { display: none; }\n /* Controls at the end stay pressable above the stretched link. */\n .end { position: relative; z-index: 1; }\n .chevron { flex: none; color: ${t.textMuted}; }\n `,\n ];\n\n private filled = { start: false, end: false };\n\n private onSlot(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as 'start' | 'end';\n this.filled = {\n ...this.filled,\n [name]: slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim() !== ''),\n };\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const title = this.href\n ? html`<a class=\"title\" href=${this.href} part=\"link\">${this.heading}</a>`\n : html`<span class=\"title\" part=\"title\">${this.heading}</span>`;\n return html`<div class=\"row\" part=\"row\">\n <div class=\"start ${this.filled.start ? '' : 'empty'}\"><slot name=\"start\" @slotchange=${this.onSlot}></slot></div>\n <div class=\"text\">${title}${this.meta ? html`<span class=\"meta\" part=\"meta\">${this.meta}</span>` : nothing}</div>\n <div class=\"end ${this.filled.end ? '' : 'empty'}\"><slot name=\"end\" @slotchange=${this.onSlot}></slot></div>\n ${this.href ? html`<span class=\"chevron\" aria-hidden=\"true\">${iconSvg('chevron-right', '20px')}</span>` : nothing}\n </div>`;\n }\n}\n\n/**\n * A pressable filter: \"UK 4\", \"Completed 27\". A row of them narrows a list.\n *\n * **It is a toggle button.** It carries `aria-pressed`, so a screen reader says\n * whether the filter is on, and it is filled when it is on, so that does not\n * rest on colour alone (1.4.1). When only one filter in a row can be on, the\n * app turns the others off when it hears `impakt-change`.\n *\n * The count is read with the label. Set `count-label` when the number needs its\n * noun to make sense aloud, such as \"4 jobs\".\n *\n * @category action\n * @icon badge\n * @fires {CustomEvent<{ pressed: boolean }>} impakt-change - When the filter is turned on or off.\n */\nexport class ImpaktFilterChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n count: { type: Number },\n countLabel: { type: String, attribute: 'count-label' },\n pressed: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n declare label: string;\n /** How many things the filter would show. Left out when not set. */\n declare count: number | undefined;\n /** The count in words for a screen reader, such as \"4 jobs\". The number alone when empty. */\n declare countLabel: string;\n declare pressed: boolean;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.label = '';\n this.count = undefined;\n this.countLabel = '';\n this.pressed = false;\n this.disabled = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button'),\n css`\n :host { display: inline-block; }\n /* The containing block for the words kept for screen readers, so a control scrolled out of a row cannot widen the page. */\n button {\n ${targetSize}\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: ${space(2)};\n min-block-size: 36px;\n padding: 0 ${space(3.5)};\n font: inherit;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.hairline};\n border-radius: 999px;\n cursor: pointer;\n white-space: nowrap;\n }\n button:hover:not(:disabled) { background: ${t.surfaceInset}; }\n button[aria-pressed='true'] { background: ${t.text}; color: ${t.surfaceCard}; border-color: ${t.text}; }\n button:disabled { cursor: not-allowed; opacity: 0.5; }\n .count { font-variant-numeric: tabular-nums; color: ${t.textMuted}; }\n button[aria-pressed='true'] .count { color: inherit; opacity: 0.8; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { button[aria-pressed='true'] { border: 2px solid Highlight; } }\n `,\n ];\n\n private toggle(): void {\n if (this.disabled) return;\n this.pressed = !this.pressed;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { pressed: this.pressed }, bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const hasCount = typeof this.count === 'number' && !Number.isNaN(this.count);\n return html`<button type=\"button\" part=\"button\" aria-pressed=${this.pressed ? 'true' : 'false'} ?disabled=${this.disabled} @click=${this.toggle}>\n <span>${this.label}</span>\n ${\n hasCount\n ? this.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${this.count}</span><span class=\"sr-only\">${this.countLabel}</span>`\n : html`<span class=\"count\">${this.count}</span>`\n : nothing\n }\n </button>`;\n }\n}\n\ncustomElements.define('impakt-stat-tile', ImpaktStatTile);\ncustomElements.define('impakt-date-tile', ImpaktDateTile);\ncustomElements.define('impakt-row', ImpaktRow);\ncustomElements.define('impakt-filter-chip', ImpaktFilterChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stat-tile': ImpaktStatTile;\n 'impakt-date-tile': ImpaktDateTile;\n 'impakt-row': ImpaktRow;\n 'impakt-filter-chip': ImpaktFilterChip;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * An on and off setting that takes effect at once: \"Show to customer\",\n * \"Visible to customer\".\n *\n * **It is a checkbox with the switch role.** A native\n * `<input type=\"checkbox\" role=\"switch\">` keeps Space to toggle, form\n * submission and the label's hit area, and the role makes a screen reader say\n * \"on\" and \"off\" rather than \"checked\". A switch is for a setting that applies\n * straight away. When the choice is only sent with a form, use\n * `impakt-checkbox` instead.\n *\n * **The state is not carried by colour alone.** The knob moves from one end of\n * the track to the other, so the position says on or off without the fill\n * (1.4.1).\n *\n * **Set `hide-label` in a row that already names the setting**, such as a\n * table row whose first cell says what is being switched. The label stays the\n * switch's accessible name.\n *\n * @category form\n * @icon checkbox\n * @fires {CustomEvent<{ value: string; checked: boolean }>} impakt-change - When it is switched. detail.checked says whether it is now on, and detail.value is the form value, \"on\" or empty.\n */\nexport class ImpaktSwitch extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n declare checked: boolean;\n /** Keep the label for screen readers only, when the row around it already names the setting. */\n declare hideLabel: boolean;\n\n constructor() {\n super();\n this.checked = false;\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n cursor: pointer;\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([hide-label]) .row {\n justify-content: flex-start;\n }\n :host([hide-label]) .text {\n ${visuallyHidden}\n }\n .control {\n position: relative;\n flex: none;\n inline-size: 46px;\n block-size: 28px;\n }\n input {\n ${targetSize}\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n .track {\n position: absolute;\n inset: 0;\n border-radius: 999px;\n background: ${t.borderStrong};\n transition: background-color 120ms ease-in-out;\n pointer-events: none;\n }\n .knob {\n position: absolute;\n inset-block-start: 3px;\n inset-inline-start: 3px;\n inline-size: 22px;\n block-size: 22px;\n border-radius: 999px;\n background: ${t.surfaceCard};\n box-shadow: ${t.shadowXs};\n transition: transform 120ms ease-in-out;\n }\n :host([checked]) .track {\n background: ${t.brand};\n }\n :host([checked]) .knob {\n transform: translateX(18px);\n }\n :host(:dir(rtl)[checked]) .knob {\n transform: translateX(-18px);\n }\n input:focus-visible + .track {\n box-shadow: ${t.focusShadow};\n }\n input:disabled {\n cursor: not-allowed;\n }\n :host([disabled]) .track {\n opacity: 0.5;\n }\n @media (prefers-reduced-motion: reduce) {\n .track, .knob { transition: none; }\n }\n @media (forced-colors: active) {\n .track { border: 1px solid CanvasText; }\n .knob { background: CanvasText; }\n :host([checked]) .track { background: Highlight; }\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <span class=\"text\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </span>\n <span class=\"control\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n aria-checked=${this.checked ? 'true' : 'false'}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"track\" part=\"track\"><span class=\"knob\" part=\"knob\"></span></span>\n </span>\n </label>\n `;\n }\n\n /** Whether it is on, so a handler need not read \"on\" or an empty string. */\n protected changeDetail(value: string): { value: string; checked: boolean } {\n return { value, checked: this.checked };\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\nexport interface SegmentOption {\n value: string;\n label: string;\n}\n\n/**\n * Two to four choices drawn as one joined control: \"Internal\" or \"Visible to\n * customer\", \"Cost\" or \"Charge\".\n *\n * **It is a radio group underneath.** Native radios sharing a name give arrow\n * keys, one tab stop and the right announcement with no script, exactly as in\n * `impakt-radio-group`. Only the drawing differs. The label is a `<legend>`, so\n * the question is asked of the set; set `hide-label` when the words around it\n * already ask it, and the legend stays for screen readers.\n *\n * @category form\n * @icon radio\n */\nexport class ImpaktSegmentedControl extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n full: { type: Boolean, reflect: true },\n };\n\n declare options: SegmentOption[];\n /** Keep the question for screen readers only, when the words around it already ask it. */\n declare hideLabel: boolean;\n /** As wide as its space, with the segments sharing it equally. */\n declare full: boolean;\n\n constructor() {\n super();\n this.options = [];\n this.hideLabel = false;\n this.full = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n :host([hide-label]) legend {\n ${visuallyHidden}\n }\n .segments {\n display: inline-flex;\n gap: ${space(1)};\n padding: ${space(1)};\n border-radius: 999px;\n background: ${t.surfaceInset};\n }\n :host([full]) .segments {\n display: flex;\n }\n :host([full]) .segment {\n flex: 1;\n }\n .segment {\n position: relative;\n display: inline-flex;\n }\n input {\n ${targetSize}\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n .face {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: 100%;\n min-block-size: 32px;\n padding: ${space(1.5)} ${space(4)};\n border-radius: 999px;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n color: ${t.textMuted};\n pointer-events: none;\n transition: background-color 120ms ease-in-out, color 120ms ease-in-out;\n }\n .segment:hover .face {\n color: ${t.text};\n }\n input:checked + .face {\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: ${t.shadowXs};\n }\n input:focus-visible + .face {\n box-shadow: ${t.focusShadow};\n }\n input:disabled {\n cursor: not-allowed;\n }\n :host([disabled]) .segments {\n opacity: 0.5;\n }\n @media (prefers-reduced-motion: reduce) {\n .face { transition: none; }\n }\n @media (forced-colors: active) {\n .segments { border: 1px solid CanvasText; }\n input:checked + .face { border: 2px solid Highlight; }\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"segments\" part=\"segments\">\n ${this.options.map((option, i) => {\n const id = this.id_(`seg-${i}`);\n return html`\n <label class=\"segment\" part=\"segment\" for=${id}>\n <input\n type=\"radio\"\n id=${id}\n name=${this.uid}\n value=${option.value}\n .checked=${this.value === option.value}\n ?disabled=${this.disabled}\n ?required=${this.required && i === 0}\n @change=${() => {\n this.value = option.value;\n this.setFormValue(option.value);\n }}\n />\n <span class=\"face\">${option.label}</span>\n </label>\n `;\n })}\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset\n part=\"fieldset\"\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n >\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-switch', ImpaktSwitch);\ncustomElements.define('impakt-segmented-control', ImpaktSegmentedControl);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-switch': ImpaktSwitch;\n 'impakt-segmented-control': ImpaktSegmentedControl;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface RadioOption {\n value: string;\n label: string;\n description?: string;\n}\n\n/**\n * A choose-one group.\n *\n * **It renders native radios, and that is the whole design.** A group of\n * `<input type=\"radio\">` sharing a name already has roving tabindex, arrow-key\n * navigation that wraps, Home and End, selection-follows-focus, and the right\n * announcement in every screen reader \u2014 all of it, correctly, with no\n * JavaScript. Hand-rolling that is the single most commonly attempted and most\n * commonly botched widget in any design system, and every version of it is a\n * worse version of what the platform ships.\n *\n * Because the radios share one shadow root, their `name` scopes to this\n * component and cannot collide with another group on the page.\n *\n * The label is a `<legend>` inside a `<fieldset>`, not a `<label for>`:\n * `for` names one control, and the question here is asked of the set.\n\n *\n * @category form\n * @icon radio\n */\nexport class ImpaktRadioGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n };\n\n declare options: RadioOption[];\n\n constructor() {\n super();\n this.options = [];\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .option {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n padding: ${space(3)};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n margin-block-end: ${space(2)};\n cursor: pointer;\n }\n .option:hover {\n background: ${t.surfaceSubtle};\n }\n /* The whole row is the target, not the 20px dot \u2014 2.5.8 is a floor and\n a comfortable target is the actual goal. */\n .option input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .option-text {\n display: block;\n font-size: ${fontSize('md')};\n }\n .option-description {\n display: block;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n margin-block-start: ${space(1)};\n }\n :host([invalid]) .option {\n border-color: ${t.danger};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n protected renderControl(): TemplateResult {\n return html`\n ${this.options.map((option, i) => {\n const id = this.id_(`opt-${i}`);\n const descId = option.description ? this.id_(`opt-${i}-desc`) : undefined;\n return html`\n <label class=\"option\" part=\"option\" for=${id}>\n <input\n type=\"radio\"\n id=${id}\n name=${this.uid}\n value=${option.value}\n .checked=${this.value === option.value}\n ?disabled=${this.disabled}\n ?required=${this.required && i === 0}\n aria-describedby=${descId ?? nothing}\n @change=${() => this.setFormValue(option.value)}\n />\n <span>\n <span class=\"option-text\">${option.label}</span>\n ${option.description ? html`<span class=\"option-description\" id=${descId!}>${option.description}</span>` : nothing}\n </span>\n </label>\n `;\n })}\n `;\n }\n\n /**\n * The fieldset wraps everything, so the whole field is rebuilt here rather\n * than relying on the base class's flat order.\n */\n render(): TemplateResult {\n return html`\n <fieldset\n part=\"fieldset\"\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n >\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">\n ${this.error || nothing}\n </div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-radio-group', ImpaktRadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-radio-group': ImpaktRadioGroup;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out \u2014 at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpaktAlert extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || say(ImpaktAlert.TONE_WORDS[this.tone]);\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${\n this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing\n }\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-alert', ImpaktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-alert': ImpaktAlert;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { visuallyHidden as hiddenStyle } from '../base/styles';\nimport { fontSize, fontWeight, lineHeight, space, spaceAround, t, type } from '../base/tokens';\n\n/**\n * Layout and typography primitives.\n *\n * These are the components a composition is mostly made of, and they are\n * deliberately dull. Their one job is that spacing, type and colour come from\n * tokens, so that a page built in the CMS cannot contain a hard-coded 13px.\n */\n\n/** Vertical rhythm. Every gap is a spacing token, never a number.\n *\n * @category layout\n * @icon stack\n * @slot - The things being stacked.\n */\nexport class ImpaktStack extends ImpaktElement {\n static properties = {\n gap: { type: String, reflect: true },\n align: { type: String, reflect: true },\n direction: { type: String, reflect: true },\n justify: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare gap: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** How the items line up across the stack. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Down the page, or along a row that wraps when it runs out of room, such as a row of buttons. */\n declare direction: 'vertical' | 'horizontal';\n /** Where the items sit along a row. */\n declare justify: 'start' | 'center' | 'end' | 'between';\n /** Space before the stack, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the stack, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.gap = 'md';\n this.align = 'stretch';\n this.direction = 'vertical';\n this.justify = 'start';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n :host([gap='none']) { gap: 0; }\n :host([gap='xs']) { gap: ${space(1)}; }\n :host([align='start']) { align-items: flex-start; }\n :host([align='center']) { align-items: center; text-align: center; }\n :host([align='end']) { align-items: flex-end; }\n :host([direction='horizontal']) { flex-direction: row; flex-wrap: wrap; align-items: center; }\n :host([direction='horizontal'][align='start']) { align-items: flex-start; }\n :host([direction='horizontal'][align='end']) { align-items: flex-end; }\n :host([direction='horizontal'][align='center']) { text-align: start; }\n :host([justify='center']) { justify-content: center; }\n :host([justify='end']) { justify-content: flex-end; }\n :host([justify='between']) { justify-content: space-between; }\n :host([gap='sm']) { gap: ${space(2)}; }\n :host([gap='md']) { gap: ${space(4)}; }\n :host([gap='lg']) { gap: ${space(6)}; }\n :host([gap='xl']) { gap: ${space(8)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** A surface. What text is read against, and what contrast is measured from.\n *\n * @category layout\n * @icon card\n * @slot - What sits on the card.\n */\nexport class ImpaktCard extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n imageSrc: { type: String, attribute: 'image-src' },\n imageAlt: { type: String, attribute: 'image-alt' },\n ratio: { type: String, reflect: true },\n badge: { type: String },\n raised: { type: Boolean, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The card's surface. Text on a brand card takes the brand's text colour. */\n declare tone: 'default' | 'subtle' | 'brand' | 'outline' | 'plain';\n /** Space inside the card. */\n declare padding: 'none' | 'sm' | 'md' | 'lg';\n /** A picture across the top of the card. */\n declare imageSrc: string;\n /** What the picture shows. Leave empty only when it is decoration. */\n declare imageAlt: string;\n /** A short label on the picture, such as \"3 left\". */\n declare badge: string;\n /** The picture's shape. */\n declare ratio: '16:9' | '4:3' | '3:2' | '1:1';\n /** Lifted off the page with a soft shadow and no edge, as a form that floats beside its words is. */\n declare raised: boolean;\n /** Space before the card, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the card, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'default';\n this.padding = 'lg';\n this.imageSrc = '';\n this.imageAlt = '';\n this.ratio = '16:9';\n this.badge = '';\n this.raised = false;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.hairline};\n border-radius: ${t.radiusXl};\n box-shadow: ${t.shadowSm};\n overflow: hidden;\n --ratio: 16 / 9;\n }\n :host([tone='subtle']) { background: ${t.surfaceSubtle}; border-color: transparent; box-shadow: none; }\n :host([tone='brand']) { background: ${t.brand}; border-color: transparent; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; }\n :host([tone='outline']) { background: transparent; box-shadow: none; border-color: ${t.rule}; }\n :host([raised]) { border-color: transparent; box-shadow: 0 24px 60px rgb(16 19 23 / 12%), 0 2px 6px rgb(16 19 23 / 6%); border-radius: ${t.radius2xl}; }\n :host([tone='plain']) { background: transparent; border-color: transparent; border-radius: 0; box-shadow: none; }\n :host([ratio='4:3']) { --ratio: 4 / 3; }\n :host([ratio='3:2']) { --ratio: 3 / 2; }\n :host([ratio='1:1']) { --ratio: 1 / 1; }\n .body { padding: ${space(6)}; flex: 1; display: flex; flex-direction: column; }\n :host([padding='none']) .body { padding: 0; }\n :host([padding='sm']) .body { padding: ${space(3)}; }\n :host([padding='md']) .body { padding: ${space(4)}; }\n :host([tone='plain']) .body { padding-inline: 0; }\n img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }\n .picture { position: relative; }\n .tag { position: absolute; inset-block-start: ${space(4)}; inset-inline-start: ${space(4)}; padding: ${space(1.5)} ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: 999px; }\n @media (forced-colors: active) { :host { border-color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`${this.imageSrc ? html`<div class=\"picture\"><img src=${this.imageSrc} alt=${this.imageAlt} part=\"image\" />${this.badge ? html`<span class=\"tag\">${this.badge}</span>` : nothing}</div>` : nothing}<div class=\"body\" part=\"body\"><slot></slot></div>`;\n }\n}\n\n/**\n * A heading.\n *\n * `level` is required and renders the matching `<h1>`\u2013`<h6>`, because heading\n * level is document structure rather than appearance: a screen-reader user\n * navigates by it, and a page whose levels skip is a page they cannot skim.\n * Size is a separate property, so a visually small `<h2>` needs no lie about\n * its level \u2014 which is the usual reason levels end up wrong.\n\n *\n * @category typography\n * @icon heading\n * @role heading\n * @slot - The heading text.\n */\nexport class ImpaktHeading extends ImpaktElement {\n static properties = {\n level: { type: Number, reflect: true },\n size: { type: String, reflect: true },\n eyebrow: { type: String, reflect: true },\n align: { type: String, reflect: true },\n screenReaderOnly: { type: Boolean, reflect: true, attribute: 'screen-reader-only' },\n };\n\n declare level: 1 | 2 | 3 | 4 | 5 | 6;\n declare size: '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm';\n /** A short label above the heading, such as \"Why Larkfield\". Part of the heading, read before it. */\n declare eyebrow: string;\n declare align: 'start' | 'center';\n /**\n * Read by screen readers and search engines, but not drawn: for a heading\n * whose words are already in a picture, such as a hero drawn as artwork.\n * The page still has its heading; nobody sees it twice. An eyebrow still shows.\n */\n declare screenReaderOnly: boolean;\n\n constructor() {\n super();\n this.level = 2;\n this.size = 'xl';\n this.eyebrow = '';\n this.align = 'start';\n this.screenReaderOnly = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n color: ${t.textHeading};\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n line-height: ${lineHeight('tight')};\n }\n :host([size='5xl']) { ${type('5xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='4xl']) { ${type('4xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='3xl']) { ${type('3xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='2xl']) { ${type('2xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='xl']) { ${type('xl')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='md']) { ${type('md')} }\n :host([size='sm']) { ${type('sm')} }\n .h { text-wrap: balance; }\n .h {\n margin: 0;\n font: inherit;\n color: inherit;\n }\n :host([align='center']) { text-align: center; }\n /* Only the words go: an eyebrow over a heading drawn as a picture still shows. */\n :host([screen-reader-only]) .words { ${hiddenStyle} }\n :host([screen-reader-only]:not([eyebrow])) { ${hiddenStyle} }\n .eyebrow {\n display: block;\n margin-block-end: ${space(2)};\n color: var(--impakt-eyebrow, var(--impakt-color-text-eyebrow, ${t.brand}));\n font-family: var(--impakt-font-family-eyebrow, ${t.fontBody});\n font-size: var(--impakt-font-size-eyebrow, ${fontSize('sm')});\n font-weight: var(--impakt-font-weight-eyebrow, ${fontWeight('semibold')});\n letter-spacing: 0.06em;\n text-transform: uppercase;\n }\n `,\n ];\n\n render(): TemplateResult {\n // A `role=\"heading\"` with `aria-level` rather than six branches of\n // template. The native element would be marginally better; this is the one\n // place where Lit's lack of a dynamic tag makes the explicit role the\n // honest trade, and the role is fully supported.\n return html`<div class=\"h\" role=\"heading\" aria-level=${this.level} part=\"heading\">\n ${this.eyebrow ? html`<span class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}<span style=\"position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)\">: </span></span>` : nothing}<span class=\"words\"><slot></slot></span>\n </div>`;\n }\n}\n\n/** A paragraph.\n *\n * @category typography\n * @icon text\n * @slot - The paragraph text.\n */\nexport class ImpaktText extends ImpaktElement {\n static properties = {\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n align: { type: String, reflect: true },\n look: { type: String, reflect: true },\n };\n\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'default' | 'muted';\n declare align: 'start' | 'center';\n /** `code` sets the words in the brand's monospace face on a faint panel, for a line like \"base: main \u2190 compare: you/idea\". */\n declare look: 'prose' | 'code';\n\n constructor() {\n super();\n this.size = 'md';\n this.tone = 'default';\n this.align = 'start';\n this.look = 'prose';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n /* 1.4.8 asks for 1.5 within a paragraph, and it is the default here\n rather than an option, because body text is what it is about. */\n line-height: ${lineHeight('normal')};\n /* 1.4.12 Text Spacing: a user stylesheet must be able to widen this\n without clipping, which a max-width in ch units survives and a\n fixed pixel height does not. */\n max-inline-size: 70ch;\n }\n :host([size='sm']) { ${type('sm')} }\n :host([size='md']) { ${type('md')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='xl']) { ${type('xl')} }\n p { text-wrap: pretty; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n :host([align='center']) { text-align: center; margin-inline: auto; }\n :host([look='code']) { font-family: ${t.fontMono}; ${type('sm')} padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 6%, transparent); max-inline-size: none; }\n p {\n margin: 0;\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`<p part=\"text\"><slot></slot></p>`;\n }\n}\n\ncustomElements.define('impakt-stack', ImpaktStack);\ncustomElements.define('impakt-card', ImpaktCard);\ncustomElements.define('impakt-heading', ImpaktHeading);\ncustomElements.define('impakt-text', ImpaktText);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stack': ImpaktStack;\n 'impakt-card': ImpaktCard;\n 'impakt-heading': ImpaktHeading;\n 'impakt-text': ImpaktText;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A link.\n *\n * **A new tab is always announced.** When `external` is set, the accessible\n * name gains \"opens in a new tab\" \u2014 not as a tooltip, which no screen reader\n * reads, and not as an icon alone, which carries no text. An unannounced new\n * tab breaks the back button for someone who cannot see that the window\n * changed, and that is what 3.2.5 is about.\n *\n * **It is underlined.** 1.4.1 Use of Colour: a link distinguished from body\n * text only by being a different colour is not distinguished at all for a\n * reader who cannot tell the two colours apart.\n\n *\n * @category action\n * @icon link\n * @slot - The link text.\n */\nexport class ImpaktLink extends ImpaktElement {\n static properties = {\n href: { type: String },\n external: { type: Boolean, reflect: true },\n externalText: { type: String, attribute: 'external-text' },\n variant: { type: String, reflect: true },\n icon: { type: String },\n };\n\n declare href: string;\n declare external: boolean;\n declare externalText: string;\n /** In a sentence, or on its own line as a call to action, bolder and with an arrow. */\n declare variant: 'inline' | 'standalone';\n /** An icon after the words. A standalone link has an arrow unless it says otherwise. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n\n constructor() {\n super();\n this.href = '';\n this.external = false;\n this.externalText = 'opens in a new tab';\n this.variant = 'inline';\n this.icon = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: inline;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n border-radius: ${t.radiusSm};\n }\n a:hover {\n color: ${t.linkHover};\n }\n :host([variant='standalone']) { display: inline-block; }\n :host([variant='standalone']) a { display: inline-flex; align-items: center; gap: ${space(1)}; font-weight: ${fontWeight('semibold')}; text-decoration-thickness: 1px; }\n :host([variant='standalone']) a:hover .icon { transform: translateX(2px); }\n .icon { flex: none; transition: transform 120ms ease-in-out; }\n .sr-only {\n ${visuallyHidden}\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <a\n part=\"link\"\n href=${this.href || nothing}\n target=${this.external ? '_blank' : nothing}\n rel=${this.external ? 'noopener noreferrer' : nothing}\n >\n <slot></slot>${iconSvg(this.icon !== 'none' ? this.icon : this.variant === 'standalone' ? (this.external ? 'external' : 'arrow-right') : undefined, '1em')}${this.external ? html`<span class=\"sr-only\"> (${this.externalText})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impakt-link', ImpaktLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-link': ImpaktLink;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * An image.\n *\n * `alt` is required and may be the empty string, which is a decision rather\n * than laxity: an empty alt is the correct and only way to mark an image as\n * decorative, and a missing alt is a different thing entirely \u2014 it leaves a\n * screen reader to read the file name. Making the property required forces the\n * author to say which they meant.\n *\n * `width` and `height` are the intrinsic pixel size. Without them the browser\n * cannot reserve space and the page jumps as each image loads, which is a\n * usability problem for everyone and a serious one for anyone using a screen\n * magnifier, who loses their place entirely.\n\n *\n * @category media\n * @icon image\n * @role image\n */\nexport class ImpaktImage extends ImpaktElement {\n static properties = {\n src: { type: String },\n alt: { type: String },\n decorative: { type: Boolean, reflect: true },\n width: { type: Number },\n height: { type: Number },\n focalX: { type: Number, attribute: 'focal-x' },\n focalY: { type: Number, attribute: 'focal-y' },\n loading: { type: String },\n ratio: { type: String, reflect: true },\n rounded: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n\n /**\n * Leave it out on a phone, or on anything wider, for a picture drawn twice:\n * once for a wide screen and once for a narrow one. Never both.\n */\n declare hideOn: 'never' | 'phone' | 'wide';\n declare src: string;\n declare alt: string;\n /**\n * This image says nothing a reader needs.\n *\n * An empty `alt` is the correct way to mark a decorative image AND what a\n * missing one looks like, so the two are indistinguishable to anything\n * downstream \u2014 which is why the commonest accessibility failure on the web\n * survives every automated check. Only the author knows which they meant,\n * so this is where they say it, and the publish gate holds them to it.\n */\n declare decorative: boolean;\n declare width: number | undefined;\n declare height: number | undefined;\n /** The fraction of the image that must survive a crop. */\n declare focalX: number;\n declare focalY: number;\n declare loading: 'lazy' | 'eager';\n /** The picture's shape. It is cropped to fit, keeping the focal point in view. */\n declare ratio: 'natural' | '16:9' | '4:3' | '3:2' | '1:1';\n /** How round the corners are. */\n declare rounded: 'none' | 'sm' | 'lg' | 'full';\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.ratio = 'natural';\n this.rounded = 'none';\n this.src = '';\n this.alt = '';\n this.decorative = false;\n this.width = undefined;\n this.height = undefined;\n this.focalX = 0.5;\n this.focalY = 0.5;\n this.loading = 'lazy';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }\n :host {\n display: block;\n }\n img {\n display: block;\n max-inline-size: 100%;\n block-size: auto;\n object-fit: cover;\n }\n :host(:not([ratio='natural'])) img { inline-size: 100%; }\n :host([ratio='16:9']) img { aspect-ratio: 16 / 9; }\n :host([ratio='4:3']) img { aspect-ratio: 4 / 3; }\n :host([ratio='3:2']) img { aspect-ratio: 3 / 2; }\n :host([ratio='1:1']) img { aspect-ratio: 1 / 1; }\n :host([rounded='sm']) img { border-radius: ${t.radius}; }\n :host([rounded='lg']) img { border-radius: ${t.radiusLg}; }\n :host([rounded='full']) img { border-radius: 50%; }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <img\n part=\"image\"\n src=${this.src}\n alt=${this.decorative ? '' : this.alt}\n role=${this.decorative ? 'presentation' : nothing}\n width=${this.width ?? nothing}\n height=${this.height ?? nothing}\n loading=${this.loading}\n style=\"object-position: ${this.focalX * 100}% ${this.focalY * 100}%\"\n />\n `;\n }\n}\n\n/**\n * The partner's logo.\n *\n * Separate from `impakt-image` for one reason: it is the most prominent image on\n * every page and its alt text is the brand name, so it should not be possible\n * to ship it with an empty alt by copying a decorative image. `src` and `alt`\n * come from the brand's assets.\n *\n * `on-dark` picks the dark-surface variant where the brand supplies one. A\n * logo that disappears into a dark footer is not a styling problem, it is a\n * missing piece of information.\n\n *\n * @category media\n * @icon logo\n */\nexport class ImpaktLogo extends ImpaktElement {\n static properties = {\n src: { type: String },\n srcDark: { type: String, attribute: 'src-dark' },\n alt: { type: String },\n onDark: { type: Boolean, attribute: 'on-dark', reflect: true },\n height: { type: Number },\n };\n\n declare src: string;\n declare srcDark: string;\n declare alt: string;\n declare onDark: boolean;\n declare height: number;\n\n constructor() {\n super();\n this.src = '';\n this.srcDark = '';\n this.alt = '';\n this.onDark = false;\n this.height = 32;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-block;\n }\n img {\n display: block;\n inline-size: auto;\n }\n `,\n ];\n\n render(): TemplateResult {\n const src = this.onDark && this.srcDark ? this.srcDark : this.src;\n return html`<img part=\"logo\" src=${src} alt=${this.alt} style=\"height: ${this.height}px\" />`;\n }\n}\n\n/**\n * A downloadable document \u2014 terms of service, a product sheet, a price list.\n *\n * The file type and size are part of the accessible name, not decoration\n * beside it. A list of links all named \"Download\" fails 2.4.4 Link Purpose,\n * and a reader tabbing between them cannot tell which document they are on.\n\n *\n * @category media\n * @icon document\n */\nexport class ImpaktDocumentLink extends ImpaktElement {\n static properties = {\n href: { type: String },\n label: { type: String },\n fileType: { type: String, attribute: 'file-type' },\n byteSize: { type: Number, attribute: 'byte-size' },\n };\n\n declare href: string;\n declare label: string;\n declare fileType: string;\n declare byteSize: number | undefined;\n\n constructor() {\n super();\n this.href = '';\n this.label = '';\n this.fileType = '';\n this.byteSize = undefined;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n gap: 0.5ch;\n align-items: baseline;\n min-block-size: ${t.targetMin};\n }\n .meta {\n color: ${t.textMuted};\n }\n `,\n ];\n\n /** \"240 KB\". Rounded, because the exact byte count helps nobody. */\n private get size(): string {\n if (!this.byteSize) return '';\n const kb = this.byteSize / 1024;\n return kb >= 1024 ? `${(kb / 1024).toFixed(1)} MB` : `${Math.round(kb)} KB`;\n }\n\n render(): TemplateResult {\n const meta = [this.fileType, this.size].filter(Boolean).join(', ');\n return html`\n <a part=\"link\" href=${this.href || nothing} download>\n <span>${this.label}</span>${meta ? html`<span class=\"meta\">(${meta})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impakt-image', ImpaktImage);\ncustomElements.define('impakt-logo', ImpaktLogo);\ncustomElements.define('impakt-document-link', ImpaktDocumentLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-image': ImpaktImage;\n 'impakt-logo': ImpaktLogo;\n 'impakt-document-link': ImpaktDocumentLink;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A money amount.\n *\n * This component exists because of a decision taken in the content model: a\n * binding names a source and cannot compute\n * ([ADR 0003](https://github.com/matthill8286/strata/blob/main/docs/decisions/0003-binding-expressions.md)). The\n * consequence is that formatting lives here, where the locale and the currency\n * are known, rather than in authored content \u2014 so there is one place that\n * decides what \"\u00A324.99\" looks like, and nobody writes a format string into a\n * CMS field.\n *\n * **The amount is one text node.** Splitting the pounds and the pence into\n * separate elements for typographic effect makes some screen readers read them\n * as two numbers, and \"twenty-four ninety-nine\" becomes \"twenty four, ninety\n * nine\". The visual emphasis is done with CSS over one node instead.\n *\n * **Minor units in, major units out.** `amount` is in pence, because a price\n * that arrives from a pricing API as a float has already lost money to binary\n * rounding before it reaches the screen.\n\n *\n * @category content\n * @icon price\n */\nexport class ImpaktPrice extends ImpaktElement {\n static properties = {\n amount: { type: Number },\n currency: { type: String },\n locale: { type: String },\n prefix: { type: String },\n period: { type: String },\n size: { type: String, reflect: true },\n pending: { type: String },\n };\n\n /** In minor units \u2014 pence, cents. */\n declare amount: number | undefined;\n declare currency: string;\n declare locale: string;\n /** \"From\", \"Guide\". Read before the amount. */\n declare prefix: string;\n /** \"a month\", \"a year\". Read after the amount. */\n declare period: string;\n declare size: 'md' | 'lg' | 'xl';\n /** Shown while there is no amount yet. A price takes seconds to arrive. */\n declare pending: string;\n\n constructor() {\n super();\n this.amount = undefined;\n this.currency = 'GBP';\n this.locale = '';\n this.prefix = '';\n this.period = '';\n this.size = 'xl';\n this.pending = '\u2014';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-flex;\n align-items: baseline;\n gap: ${space(1)};\n color: ${t.text};\n }\n .amount {\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n /* Tabular figures so a price does not reflow as the digits change,\n which otherwise makes a recalculating price jitter. */\n font-variant-numeric: tabular-nums;\n }\n :host([size='md']) .amount { font-size: ${fontSize('lg')}; }\n :host([size='lg']) .amount { font-size: ${fontSize('2xl')}; }\n :host([size='xl']) .amount { font-size: ${fontSize('3xl')}; }\n .period {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n `,\n ];\n\n private get formatted(): string {\n if (this.amount === undefined || Number.isNaN(this.amount)) return this.pending;\n try {\n return new Intl.NumberFormat(this.locale || pageLocale(this), {\n style: 'currency',\n currency: this.currency,\n // A house price reads as \u00A3385,000. Pence only mean something on small amounts.\n ...(this.amount >= 100000 && this.amount % 100 === 0 ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : {}),\n }).format(this.amount / 100);\n } catch {\n // An unknown currency or locale must not take the page down. The number\n // is still the most useful thing on the screen.\n return (this.amount / 100).toFixed(2);\n }\n }\n\n render(): TemplateResult {\n return html`\n ${this.prefix ? html`<span class=\"period\" part=\"prefix\">${this.prefix}</span>` : nothing}\n <span class=\"amount\" part=\"amount\">${this.formatted}</span>\n ${this.period ? html`<span class=\"period\" part=\"period\">${this.period}</span>` : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-price', ImpaktPrice);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-price': ImpaktPrice;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, touchTarget } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface SummaryRow {\n key: string;\n value: string;\n /** Where \"Change\" goes. Omitted rows show no action. */\n changeHref?: string;\n}\n\n/**\n * Key and value pairs \u2014 an order summary, a confirmation, a check-your-answers\n * screen.\n *\n * **It is a description list.** `<dl>` with `<dt>` and `<dd>` says these are\n * pairs; a stack of divs says nothing, and a table claims a grid that a\n * two-column list does not have.\n *\n * **Every \"Change\" names what it changes.** The visible text stays short, and\n * the accessible name is completed with visually hidden words, so a reader\n * tabbing through hears \"Change date of birth\" rather than six links all called\n * \"Change\". This is 2.4.4 Link Purpose, and it is the single most common\n * failure on a check-your-answers page.\n\n *\n * @category content\n * @icon list\n */\nexport class ImpaktSummaryList extends ImpaktElement {\n static properties = {\n rows: { type: Array },\n changeText: { type: String, attribute: 'change-text' },\n };\n\n declare rows: SummaryRow[];\n declare changeText: string;\n\n constructor() {\n super();\n this.rows = [];\n this.changeText = 'Change';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('dd a'),\n css`\n :host {\n display: block;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: minmax(8rem, 1fr) 2fr;\n }\n /* A <dl> group may hold only dt and dd \u2014 not a third sibling \u2014 so the\n action lives inside the value it changes, which is also where it\n belongs semantically. The row uses display:contents so both cells stay\n in the parent grid. */\n .row {\n display: contents;\n }\n dt,\n dd {\n padding: ${space(3)} 0;\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n dt {\n font-weight: ${fontWeight('semibold')};\n font-size: ${fontSize('sm')};\n }\n dd {\n margin: 0;\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: ${space(3)};\n }\n dd a {\n flex: none;\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n align-items: center;\n min-block-size: ${t.targetMin};\n }\n .sr-only {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n /* One column on a narrow screen. 1.4.10 Reflow: two columns at 320px\n forces horizontal scrolling, and a summary is read, not scanned\n across. */\n @media (max-width: 30rem) {\n dl {\n grid-template-columns: 1fr;\n }\n dt {\n border-block-end: 0;\n padding-block-end: 0;\n }\n dd {\n padding-block-start: 0;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <dl part=\"list\">\n ${this.rows.map(\n (row) => html`\n <div class=\"row\" part=\"row\">\n <dt part=\"key\">${row.key}</dt>\n <dd part=\"value\">\n <span>${row.value}</span>\n ${\n row.changeHref\n ? html`<a href=${row.changeHref} part=\"action\"\n >${this.changeText}<span class=\"sr-only\"> ${row.key}</span></a\n >`\n : nothing\n }\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impakt-summary-list', ImpaktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-summary-list': ImpaktSummaryList;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { pageLocale } from '../base/locale';\nimport { focusRing, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\nexport interface TableColumn {\n key: string;\n label: string;\n numeric?: boolean;\n /** Let the rows be sorted by this column. Its heading becomes a button. */\n sortable?: boolean;\n}\n\n/** Which way a sorted column runs, in the words `aria-sort` uses. */\nexport type SortDirection = 'ascending' | 'descending';\n\n/**\n * A data table \u2014 a plan comparison, a payment schedule, a list of cases.\n *\n * **The caption is required.** It is the table's name, and a page with three\n * unnamed tables is a page a screen-reader user has to read in full to tell\n * apart. Visually it can be the heading they would have written anyway.\n *\n * **It scrolls, and the scroller is focusable.** A wide table cannot reflow to\n * 320px without becoming unreadable, so it scrolls horizontally \u2014 and a region\n * that scrolls must be reachable by keyboard, or a keyboard user simply cannot\n * see the right-hand columns. `tabindex=\"0\"` with a role and a name is the\n * established fix, and the name is why the role is there: a bare focusable div\n * announces nothing.\n *\n * **Or it stacks.** With `stack`, a narrow table turns each row into a card,\n * with each value under the name of its column, so a phone reads a list of\n * cases rather than scrolling a grid. The table keeps its roles written out,\n * because some browsers drop a table's meaning once it is no longer drawn as one.\n *\n * **Sorting is announced.** A sortable column's heading is a button, and the\n * column the rows are sorted by carries `aria-sort`, so a screen reader says\n * \"Opened, sorted descending\" rather than leaving the order to be guessed. The\n * table sorts its own rows unless `manual-sort` says the app does it, as an app\n * that pages its rows on the server must.\n *\n * **Rows can be chosen.** With `selectable`, each row has a checkbox named by\n * the row's first cell, and the heading has one for every row. A row is known by\n * its `id`, or by the key `row-key` names.\n *\n * A cell can hold more than words: give the table a child with\n * `slot=\"cell:{row id}:{column key}\"`, such as a badge, and it is drawn in that\n * cell. With no rows the table says `empty-text`, or shows a child with\n * `slot=\"empty\"`.\n *\n * @category content\n * @icon table\n * @slot empty - What to show when there are no rows, in place of the empty text.\n * @fires {CustomEvent<{ key: string; direction: SortDirection }>} impakt-sort - When a column heading is pressed to sort the rows.\n * @fires {CustomEvent<{ selected: string[] }>} impakt-selection - When rows are chosen or let go. The ids are in detail.selected.\n */\nexport class ImpaktTable extends ImpaktElement {\n static properties = {\n caption: { type: String },\n columns: { type: Array },\n rows: { type: Array },\n sortKey: { type: String, attribute: 'sort-key', reflect: true },\n sortDirection: { type: String, attribute: 'sort-direction', reflect: true },\n manualSort: { type: Boolean, attribute: 'manual-sort' },\n selectable: { type: Boolean, reflect: true },\n selected: { type: Array },\n rowKey: { type: String, attribute: 'row-key' },\n stack: { type: Boolean, reflect: true },\n emptyText: { type: String, attribute: 'empty-text' },\n selectAllText: { type: String, attribute: 'select-all-text' },\n selectRowText: { type: String, attribute: 'select-row-text' },\n };\n\n declare caption: string;\n declare columns: TableColumn[];\n declare rows: Array<Record<string, string>>;\n /** The key of the column the rows are sorted by. Empty leaves them in the order given. */\n declare sortKey: string;\n declare sortDirection: SortDirection;\n /** The app sorts the rows itself, on `impakt-sort`. The table only shows which column and which way. */\n declare manualSort: boolean;\n /** Each row has a checkbox, and the heading one for every row. */\n declare selectable: boolean;\n /** The ids of the chosen rows. */\n declare selected: string[];\n /** The key in each row that tells rows apart. */\n declare rowKey: string;\n /** On a narrow screen, draw each row as a card rather than scroll the table sideways. */\n declare stack: boolean;\n /** What the table says when it has no rows. */\n declare emptyText: string;\n /** The name of the checkbox that chooses every row. */\n declare selectAllText: string;\n /** The name of each row's checkbox, with `{row}` for the row's first cell. */\n declare selectRowText: string;\n\n constructor() {\n super();\n this.caption = '';\n this.columns = [];\n this.rows = [];\n this.sortKey = '';\n this.sortDirection = 'ascending';\n this.manualSort = false;\n this.selectable = false;\n this.selected = [];\n this.rowKey = 'id';\n this.stack = false;\n this.emptyText = 'Nothing to show';\n this.selectAllText = 'Select all rows';\n this.selectRowText = 'Select {row}';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.sort, .pick label'),\n css`\n :host {\n display: block;\n }\n :host([stack]) {\n container-type: inline-size;\n }\n .scroller {\n overflow-x: auto;\n }\n table {\n inline-size: 100%;\n border-collapse: collapse;\n font-size: ${fontSize('md')};\n }\n caption {\n text-align: start;\n font-weight: ${fontWeight('semibold')};\n padding-block-end: ${space(2)};\n }\n th,\n td {\n text-align: start;\n padding: ${space(3)};\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n thead th {\n font-weight: ${fontWeight('semibold')};\n background: ${t.surfaceInset};\n }\n tbody th {\n font-weight: ${fontWeight('semibold')};\n }\n .numeric {\n /* A figure read across a line break is a different figure. */\n white-space: nowrap;\n text-align: end;\n font-variant-numeric: tabular-nums;\n }\n th.sortable {\n padding: ${space(1)};\n }\n .sort {\n display: inline-flex;\n align-items: center;\n gap: ${space(1)};\n min-block-size: ${t.targetMin};\n padding: ${space(2)};\n font: inherit;\n color: inherit;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n cursor: pointer;\n }\n .sort:hover {\n background: ${t.wash};\n }\n .numeric .sort {\n flex-direction: row-reverse;\n }\n .arrow {\n display: inline-flex;\n color: ${t.textMuted};\n transition: transform 140ms ease-in-out;\n }\n [aria-sort] .arrow {\n color: inherit;\n }\n [aria-sort='ascending'] .arrow {\n transform: rotate(180deg);\n }\n :not([aria-sort]) > .sort .arrow {\n opacity: 0.45;\n }\n .pick {\n inline-size: 1%;\n padding-block: 0;\n padding-inline-end: 0;\n }\n .pick label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n cursor: pointer;\n }\n .pick input {\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n accent-color: ${t.brand};\n cursor: pointer;\n }\n tr.chosen > * {\n background: ${t.brandSubtle};\n }\n .empty {\n padding-block: ${space(6)};\n text-align: center;\n color: ${t.textMuted};\n }\n .label {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /* Stacked: each row a card, each value under its column's name. */\n @container (max-width: 36rem) {\n table, tbody, tr, tbody th, tbody td {\n display: block;\n }\n thead tr {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: ${space(1)};\n margin-block-end: ${space(3)};\n }\n thead th {\n display: none;\n padding: 0;\n border: 0;\n background: none;\n }\n thead th.sortable, thead th.pick {\n display: block;\n inline-size: auto;\n }\n thead .sort {\n border: ${t.borderThin} solid ${t.rule};\n border-radius: 999px;\n padding-inline: ${space(3)};\n background: ${t.surfaceCard};\n }\n tbody tr {\n position: relative;\n margin-block-end: ${space(3)};\n padding: ${space(3)} ${space(4)};\n border: ${t.borderThin} solid ${t.rule};\n border-radius: ${t.radiusXl};\n background: ${t.surfaceCard};\n }\n tbody tr.chosen {\n background: ${t.brandSubtle};\n }\n tr.chosen > * {\n background: none;\n }\n tbody th, tbody td {\n display: grid;\n grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr);\n gap: ${space(3)};\n padding: ${space(1.5)} 0;\n border: 0;\n text-align: start;\n white-space: normal;\n }\n tbody td.numeric {\n text-align: start;\n }\n tbody .pick {\n display: block;\n position: absolute;\n inset-block-start: ${space(1)};\n inset-inline-end: ${space(1)};\n inline-size: auto;\n padding: 0;\n }\n tbody tr:has(.pick) > th {\n padding-inline-end: ${space(10)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.textMuted};\n }\n .empty {\n display: block;\n border: 0;\n }\n }\n `,\n ];\n\n private keyOf(row: Record<string, string>, index: number): string {\n const key = row?.[this.rowKey];\n return key === undefined || key === null || key === '' ? String(index) : String(key);\n }\n\n /** The rows in the order they are drawn: as given, or sorted by the chosen column. */\n private ordered(): Array<{ row: Record<string, string>; key: string }> {\n const rows = (this.rows ?? []).map((row, i) => ({ row, key: this.keyOf(row, i) }));\n const column = (this.columns ?? []).find((c) => c.key === this.sortKey && c.sortable);\n if (!column || this.manualSort) return rows;\n const way = this.sortDirection === 'descending' ? -1 : 1;\n const locale = pageLocale(this);\n const figure = (v: unknown) => Number(String(v ?? '').replace(/[^\\d.-]/g, '')) || 0;\n return rows.sort((a, b) => {\n const x = a.row[column.key] ?? '';\n const y = b.row[column.key] ?? '';\n const order = column.numeric ? figure(x) - figure(y) : String(x).localeCompare(String(y), locale, { numeric: true, sensitivity: 'base' });\n return order * way;\n });\n }\n\n private sortBy(key: string): void {\n const direction: SortDirection = this.sortKey === key && this.sortDirection === 'ascending' ? 'descending' : 'ascending';\n this.sortKey = key;\n this.sortDirection = direction;\n this.dispatchEvent(new CustomEvent('impakt-sort', { detail: { key, direction }, bubbles: true, composed: true }));\n }\n\n private choose(keys: string[], on: boolean): void {\n const now = new Set(this.selected ?? []);\n for (const key of keys) {\n if (on) now.add(key);\n else now.delete(key);\n }\n this.selected = [...now];\n this.dispatchEvent(new CustomEvent('impakt-selection', { detail: { selected: this.selected }, bubbles: true, composed: true }));\n }\n\n private heading(c: TableColumn): TemplateResult {\n const sorted = c.sortable && c.key === this.sortKey;\n const classes = [c.numeric ? 'numeric' : '', c.sortable ? 'sortable' : ''].filter(Boolean).join(' ');\n if (!c.sortable) return html`<th scope=\"col\" role=\"columnheader\" class=${classes}>${c.label}</th>`;\n return html`<th scope=\"col\" role=\"columnheader\" class=${classes} aria-sort=${sorted ? this.sortDirection : nothing}>\n <button class=\"sort\" type=\"button\" part=\"sort\" @click=${() => this.sortBy(c.key)}>${c.label}<span class=\"arrow\" aria-hidden=\"true\">${iconSvg('chevron-down', '16px')}</span></button>\n </th>`;\n }\n\n render(): TemplateResult {\n const columns = this.columns ?? [];\n const rows = this.ordered();\n const chosen = new Set(this.selected ?? []);\n const every = rows.length > 0 && rows.every((r) => chosen.has(r.key));\n const some = !every && rows.some((r) => chosen.has(r.key));\n return html`\n <div class=\"scroller\" part=\"scroller\" tabindex=\"0\" role=\"region\" aria-label=${this.caption || nothing}>\n <table part=\"table\" role=\"table\">\n ${this.caption ? html`<caption part=\"caption\">${this.caption}</caption>` : nothing}\n <thead role=\"rowgroup\">\n <tr role=\"row\">\n ${\n this.selectable\n ? html`<th scope=\"col\" role=\"columnheader\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectAllText} .checked=${every} .indeterminate=${some} ?disabled=${!rows.length}\n @change=${(e: Event) =>\n this.choose(\n rows.map((r) => r.key),\n (e.target as HTMLInputElement).checked,\n )} /></label></th>`\n : nothing\n }\n ${columns.map((c) => this.heading(c))}\n </tr>\n </thead>\n <tbody role=\"rowgroup\">\n ${\n rows.length\n ? rows.map(\n ({ row, key }, i) => html`\n <tr role=\"row\" class=${chosen.has(key) ? 'chosen' : ''} part=\"row\">\n ${\n this.selectable\n ? html`<td role=\"cell\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectRowText.replace('{row}', String(row[columns[0]?.key ?? ''] ?? key))} .checked=${chosen.has(key)}\n @change=${(e: Event) => this.choose([key], (e.target as HTMLInputElement).checked)} /></label></td>`\n : nothing\n }\n ${columns.map((c, j) => {\n const value = html`<span class=\"label\" aria-hidden=\"true\">${c.label}</span><span class=\"value\"><slot name=${`cell:${key}:${c.key}`}>${row[c.key] ?? ''}</slot></span>`;\n // The first cell of each row is a row header, so a screen\n // reader announces \"Delivery charge, \u00A3250\" rather than\n // reading a bare number with no idea what it belongs to.\n return j === 0\n ? html`<th scope=\"row\" role=\"rowheader\" id=${`${this.uid}-r${i}`}>${value}</th>`\n : html`<td role=\"cell\" class=${c.numeric ? 'numeric' : ''}>${value}</td>`;\n })}\n </tr>\n `,\n )\n : html`<tr role=\"row\"><td role=\"cell\" class=\"empty\" colspan=${columns.length + (this.selectable ? 1 : 0) || 1}><slot name=\"empty\">${this.emptyText}</slot></td></tr>`\n }\n </tbody>\n </table>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-table', ImpaktTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-table': ImpaktTable;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface AccordionItem {\n id: string;\n heading: string;\n body: string;\n}\n\n/**\n * Disclosure sections \u2014 frequently asked questions, \"what does this mean?\".\n *\n * **Each header is a button inside a heading.** The heading is what lets a\n * screen-reader user jump between sections without tabbing through every\n * paragraph; the button is what makes the section openable. One without the\n * other is a common half-implementation: all-headings cannot be operated,\n * all-buttons cannot be navigated.\n *\n * `headingLevel` is a property because the right level depends on what is\n * above the accordion on the page, and guessing produces exactly the skipped\n * levels that 1.3.1 is about.\n *\n * **Panels are hidden, not unmounted.** `hidden` keeps the content in the\n * accessibility tree's structure and lets in-page search find it when opened,\n * and it means `aria-controls` always points at an element that exists.\n *\n * **A panel can hold more than words.** `body` is plain text, which is what a\n * composition can author safely. Content rendered elsewhere, such as an FAQ\n * answer with links and a list, is slotted instead: a child with\n * `slot=\"panel-<item id>\"` replaces that item's body. The slot sits inside the\n * panel, so the region, its label and its `hidden` state are unchanged, and a\n * panel with nothing slotted still shows its body.\n *\n * @category content\n * @icon accordion\n */\nexport class ImpaktAccordion extends ImpaktElement {\n static properties = {\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n open: { type: Array },\n multiple: { type: Boolean },\n };\n\n declare items: AccordionItem[];\n declare headingLevel: number;\n /** Ids currently expanded. */\n declare open: string[];\n /** When false, opening one closes the others. */\n declare multiple: boolean;\n\n constructor() {\n super();\n this.items = [];\n this.headingLevel = 3;\n this.open = [];\n this.multiple = true;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n .item {\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n button {\n ${targetSize}\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n inline-size: 100%;\n padding: ${space(3)} 0;\n background: none;\n border: 0;\n font: inherit;\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.text};\n text-align: start;\n cursor: pointer;\n }\n button:hover {\n color: ${t.link};\n }\n .marker {\n flex: none;\n transition: transform 120ms ease-in-out;\n }\n button[aria-expanded='true'] .marker {\n transform: rotate(90deg);\n }\n .panel {\n padding-block-end: ${space(4)};\n font-size: ${fontSize('md')};\n }\n `,\n ];\n\n private toggle(id: string): void {\n const isOpen = this.open.includes(id);\n if (isOpen) this.open = this.open.filter((o) => o !== id);\n else this.open = this.multiple ? [...this.open, id] : [id];\n }\n\n render(): TemplateResult {\n return html`\n ${this.items.map((item) => {\n const expanded = this.open.includes(item.id);\n const panelId = this.id_(`panel-${item.id}`);\n const buttonId = this.id_(`button-${item.id}`);\n return html`\n <div class=\"item\" part=\"item\">\n <div role=\"heading\" aria-level=${this.headingLevel}>\n <button\n id=${buttonId}\n part=\"header\"\n type=\"button\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${panelId}\n @click=${() => this.toggle(item.id)}\n >\n <span>${item.heading}</span>\n <span class=\"marker\" aria-hidden=\"true\">\u203A</span>\n </button>\n </div>\n <div\n id=${panelId}\n class=\"panel\"\n part=\"panel\"\n role=\"region\"\n aria-labelledby=${buttonId}\n ?hidden=${!expanded}\n >\n <slot name=${`panel-${item.id}`}>${item.body}</slot>\n </div>\n </div>\n `;\n })}\n ${this.items.length === 0 ? nothing : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-accordion', ImpaktAccordion);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-accordion': ImpaktAccordion;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface ProgressStep {\n id: string;\n label: string;\n}\n\n/**\n * Where the customer is in a journey.\n *\n * **It is not a `progressbar`.** That role is for a task completing \u2014 a file\n * uploading, a price calculating \u2014 and it carries `aria-valuenow`. A journey\n * indicator is navigation: an ordered list of named steps with\n * `aria-current=\"step\"` on the one you are on. Using `progressbar` here\n * announces a percentage and loses the step names, which are the only useful\n * part.\n *\n * **The position is said in words.** \"Step 2 of 5\" is visually hidden and read\n * aloud, because the visual design communicates position through colour and a\n * filled bar, and neither is available to a screen-reader user \u2014 nor to anyone\n * who cannot distinguish the filled colour from the empty one, which is 1.4.1.\n\n *\n * @category content\n * @icon progress\n */\nexport class ImpaktProgress extends ImpaktElement {\n static properties = {\n steps: { type: Array },\n current: { type: String },\n label: { type: String },\n look: { type: String, reflect: true },\n hideLabels: { type: Boolean, attribute: 'hide-labels', reflect: true },\n };\n\n declare steps: ProgressStep[];\n /** The id of the step being shown. */\n declare current: string;\n declare label: string;\n /**\n * `steps` is the full indicator. `bars` is a compact one for a card: short\n * rounded bars, the done steps in the text colour and the current one in the\n * brand, with small names under them. The current step is also set in a\n * heavier weight, so it does not rest on colour alone.\n */\n declare look: 'steps' | 'bars';\n /**\n * Draw the bars or steps alone, for a card too small for the names. The\n * names and \"Step 2 of 5\" are still read aloud. Each step is also a `step`\n * part, with `step-done`, `step-current` or `step-todo`, and its name is the\n * `step-label` part, for finer styling.\n */\n declare hideLabels: boolean;\n\n constructor() {\n super();\n this.steps = [];\n this.current = '';\n this.label = 'Progress';\n this.look = 'steps';\n this.hideLabels = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(5)};\n }\n ol {\n display: flex;\n gap: ${space(2)};\n list-style: none;\n margin: 0;\n padding: 0;\n }\n li {\n flex: 1;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n padding-block-start: ${space(2)};\n border-block-start: 4px solid ${t.border};\n }\n li[data-state='done'] {\n color: ${t.text};\n border-block-start-color: ${t.brand};\n }\n li[data-state='current'] {\n color: ${t.text};\n font-weight: ${fontWeight('semibold')};\n border-block-start-color: ${t.brand};\n }\n .sr-only {\n ${visuallyHidden}\n }\n :host([look='bars']) {\n margin-block-end: 0;\n }\n :host([look='bars']) ol {\n gap: ${space(1.5)};\n }\n :host([look='bars']) li {\n position: relative;\n padding-block-start: ${space(3)};\n border: 0;\n font-size: 12px;\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n :host([look='bars']) li::before {\n content: '';\n position: absolute;\n inset-inline: 0;\n inset-block-start: 0;\n block-size: 5px;\n border-radius: 999px;\n background: ${t.border};\n }\n :host([look='bars']) li[data-state='done']::before {\n background: ${t.text};\n }\n :host([look='bars']) li[data-state='current']::before {\n background: ${t.brand};\n }\n @media (forced-colors: active) {\n :host([look='bars']) li::before { background: GrayText; }\n :host([look='bars']) li[data-state='done']::before, :host([look='bars']) li[data-state='current']::before { background: CanvasText; }\n }\n :host([hide-labels]) .name {\n ${visuallyHidden}\n }\n /* Below 30rem the labels stop fitting; the position in words is the part\n that has to survive, so the list collapses to bars and the current\n step's name. */\n @media (max-width: 30rem) {\n li:not([data-state='current']) .name {\n ${visuallyHidden}\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const index = this.steps.findIndex((s) => s.id === this.current);\n return html`\n <nav part=\"nav\" aria-label=${this.label}>\n <ol part=\"list\">\n ${this.steps.map((step, i) => {\n const state = i < index ? 'done' : i === index ? 'current' : 'todo';\n return html`\n <li part=\"step step-${state}\" data-state=${state} aria-current=${state === 'current' ? 'step' : nothing}>\n ${\n state === 'current'\n ? html`<span class=\"sr-only\">${say('Step {step} of {steps}:', { step: i + 1, steps: this.steps.length })} </span>`\n : nothing\n }\n <span class=\"name\" part=\"step-label\">${step.label}</span>\n </li>\n `;\n })}\n </ol>\n </nav>\n `;\n }\n}\n\ncustomElements.define('impakt-progress', ImpaktProgress);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-progress': ImpaktProgress;\n }\n}\n", "/**\n * Colours named by what they are in the brand, for a line, a lane, a dot or a\n * stripe. A tone is a brand token, never a hex value, so a partner's brand\n * restyles everything drawn with one.\n *\n * It is shared: `impakt-chip` here and the changelog, site and estimator blocks\n * in `@atomic-ui/blocks` all colour themselves with it.\n */\n\n/** A colour for a line or a lane, named by what it is in the brand. */\nexport type NamedTone = 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n/** A named tone, or 1 to 5 for the brand's chart colours in order. */\nexport type Tone = NamedTone | 1 | 2 | 3 | 4 | 5;\nexport const TONE: Record<NamedTone, string> = {\n brand: 'var(--impakt-color-brand-default, #1f4ed8)',\n accent: 'var(--impakt-color-accent-default, #c8a15a)',\n info: 'var(--impakt-color-status-info-default, #1f4ed8)',\n success: 'var(--impakt-color-status-success-default, #047857)',\n warning: 'var(--impakt-color-status-warning-default, #b45309)',\n danger: 'var(--impakt-color-status-danger-default, #c8102e)',\n};\n/** When an item names no tone, lanes take these in turn. */\nexport const CYCLE: NamedTone[] = ['success', 'info', 'warning', 'accent', 'danger', 'brand'];\n/**\n * A named tone, or for an item that names none, the brand's chart colour for its\n * place (color.chart.1 to 5), falling back to the status colours in turn.\n */\nexport const toneOf = (tone: Tone | undefined, i: number): string => {\n if (typeof tone === 'number') return `var(--impakt-color-chart-${tone}, ${TONE[CYCLE[(tone - 1) % CYCLE.length]!]})`;\n if (tone && tone in TONE) return TONE[tone];\n return `var(--impakt-color-chart-${(i % 5) + 1}, ${TONE[CYCLE[i % CYCLE.length]!]})`;\n};\n", "/**\n * A short label: a branch, a status with its dot, or a code such as a commit\n * hash.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { hideOn } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\nimport { toneOf, type Tone } from '../base/tone';\n\n/** Code-like labels: a branch, a hash, a commit message. */\nconst MONO = t.fontMono;\n\n/**\n * A short label: a branch name with its icon, a status with its dot, or a\n * code such as a commit hash. It says something; it does nothing.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n meta: { type: String },\n icon: { type: String, reflect: true },\n tone: { type: String },\n look: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n declare label: string;\n /** A code after the label, quieter, such as a hash. */\n declare meta: string;\n /** A coloured dot, a branch, or nothing before the label. */\n declare icon: 'none' | 'dot' | 'branch';\n /** The dot's colour: a named tone, or 1 to 5 for the brand's chart colours. */\n declare tone: Tone;\n /** `outlined` on the card colour, `filled` with a faint wash, or `plain` words in the code face. */\n declare look: 'outlined' | 'filled' | 'plain';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.label = '';\n this.meta = '';\n this.icon = 'none';\n this.tone = 'success';\n this.look = 'filled';\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n hideOn,\n css`\n :host { display: inline-flex; flex: none; }\n span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: 999px; font-family: ${MONO}; font-size: ${fontSize('xs')}; line-height: 1.2; white-space: nowrap; }\n :host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }\n :host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.border}; background: ${t.surfaceCard}; text-transform: uppercase; letter-spacing: 0.04em; }\n :host([look='plain']) span.chip { padding: 0; }\n .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }\n svg { inline-size: 12px; block-size: 12px; }\n .meta { opacity: 0.72; text-transform: none; }\n :host([look='plain']) .label { opacity: 0.72; }\n `,\n ];\n\n render(): TemplateResult {\n const icon =\n this.icon === 'dot'\n ? html`<span class=\"dot\" aria-hidden=\"true\"></span>`\n : this.icon === 'branch'\n ? html`<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>`\n : nothing;\n return html`<span class=\"chip\" part=\"chip\" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class=\"label\">${this.label}</span>${this.meta ? html` <span class=\"meta\">${this.meta}</span>` : nothing}</span>`;\n }\n}\n\ncustomElements.define('impakt-chip', ImpaktChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip': ImpaktChip;\n }\n}\n", "/**\n * A short label on something, coloured by its tone.\n */\nimport { css, html, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontWeight, space, t, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A short label on something: \"New\", \"Selling fast\", \"2 left\".\n *\n * The tone colours it, and the words carry the meaning, so it reads the same\n * without the colour (1.4.1).\n *\n * @category feedback\n * @icon badge\n * @slot - The badge's words.\n */\nexport class ImpaktBadge extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n icon: { type: String },\n };\n /**\n * Its colour. `inverse` is the text colour as a fill, for a label that has to\n * stand out on a photo or a light card. `solid` is the brand as a fill, for\n * the one label on a screen that matters most.\n */\n declare tone: 'neutral' | 'brand' | 'success' | 'warning' | 'danger' | 'info' | 'inverse' | 'solid';\n /** An icon before the words. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n\n constructor() {\n super();\n this.tone = 'neutral';\n this.icon = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-flex; }\n span { display: inline-flex; align-items: center; gap: ${space(1)}; padding: ${space(0.5)} ${space(2)}; border-radius: ${t.radius}; ${type('sm')} font-weight: ${fontWeight('medium')}; background: ${t.surfaceInset}; color: ${t.text}; box-shadow: inset 0 0 0 1px ${t.hairline}; }\n :host([tone='brand']) span { background: ${t.brandSubtle}; color: ${t.brand}; }\n :host([tone='success']) span { background: ${t.successSubtle}; color: ${t.successText}; }\n :host([tone='warning']) span { background: ${t.warningSubtle}; color: ${t.warningText}; }\n :host([tone='danger']) span { background: ${t.dangerSubtle}; color: ${t.dangerText}; }\n :host([tone='info']) span { background: ${t.infoSubtle}; color: ${t.infoText}; }\n :host([tone='inverse']) span { background: ${t.text}; color: ${t.surfaceCard}; box-shadow: none; }\n :host([tone='solid']) span { background: ${t.brand}; color: ${t.onBrand}; box-shadow: none; }\n @media (forced-colors: active) { span { border-color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`<span part=\"badge\">${iconSvg(this.icon, '1em')}<slot></slot></span>`;\n }\n}\n\ncustomElements.define('impakt-badge', ImpaktBadge);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-badge': ImpaktBadge;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text \u2014 a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n >${this.value}</textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n this.fill();\n }\n}\n\ncustomElements.define('impakt-textarea', ImpaktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-textarea': ImpaktTextarea;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface CheckboxOption {\n value: string;\n label: string;\n description?: string;\n}\n\n/**\n * A choose-several group \u2014 the multi-select question type.\n *\n * Same shape as the radio group and for the same reasons: a `<fieldset>` with\n * a `<legend>`, because the question is asked of the set and `label for` names\n * one control.\n *\n * It differs from radios in one way that matters. Checkboxes have no roving\n * tabindex \u2014 every box is its own tab stop, which is correct, because each is\n * an independent yes or no rather than one choice among several. Nothing needs\n * to be implemented for that; it is what the platform does, and it is worth\n * knowing it is deliberate rather than missing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckboxGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n values: { type: Array },\n };\n\n declare options: CheckboxOption[];\n declare values: string[];\n\n constructor() {\n super();\n this.options = [];\n this.values = [];\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .option {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n padding: ${space(3)};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n margin-block-end: ${space(2)};\n cursor: pointer;\n }\n .option:hover {\n background: ${t.surfaceSubtle};\n }\n .option input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .option-text {\n display: block;\n font-size: ${fontSize('md')};\n }\n .option-description {\n display: block;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n margin-block-start: ${space(1)};\n }\n :host([invalid]) .option {\n border-color: ${t.danger};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private onToggle(value: string, checked: boolean): void {\n this.values = checked ? [...this.values, value] : this.values.filter((v) => v !== value);\n // One form value, comma-joined \u2014 a multi-select arrives at a pricing API as\n // a list, and the order follows the options rather than the clicks.\n this.setFormValue(\n this.options\n .filter((o) => this.values.includes(o.value))\n .map((o) => o.value)\n .join(','),\n );\n }\n\n protected renderControl(): TemplateResult {\n return html`\n ${this.options.map((option, i) => {\n const id = this.id_(`opt-${i}`);\n const descId = option.description ? this.id_(`opt-${i}-desc`) : undefined;\n return html`\n <label class=\"option\" part=\"option\" for=${id}>\n <input\n type=\"checkbox\"\n id=${id}\n value=${option.value}\n .checked=${this.values.includes(option.value)}\n ?disabled=${this.disabled}\n aria-describedby=${descId ?? nothing}\n @change=${(e: Event) => this.onToggle(option.value, (e.target as HTMLInputElement).checked)}\n />\n <span>\n <span class=\"option-text\">${option.label}</span>\n ${option.description ? html`<span class=\"option-description\" id=${descId!}>${option.description}</span>` : nothing}\n </span>\n </label>\n `;\n })}\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-checkbox-group', ImpaktCheckboxGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-checkbox-group': ImpaktCheckboxGroup;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { FieldElement } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A date, as three fields.\n *\n * **Why not `<input type=\"date\">`.** The native control is excellent for\n * picking a date near today \u2014 an appointment, a start date \u2014 and poor for a\n * date of birth, which is the date this product asks for most. Its picker\n * opens on the current month and makes a user born in 1958 navigate eight\n * hundred steps back, its text entry expects a locale-specific format the\n * field does not state, and its rendering differs enough between browsers that\n * no single hint is correct everywhere.\n *\n * Three fields is the pattern government services converged on after testing\n * it on exactly this problem. Each part is typed directly, in any order, with\n * no picker to fight.\n *\n * **The accessibility shape.** A `<fieldset>` and `<legend>` ask the question\n * once; each part has its own visible label, so \"Month\" is announced rather\n * than \"second field\"; `inputmode=\"numeric\"` brings up a number pad without\n * `type=\"number\"`, which on a date part gives spinners, scroll-wheel surprises\n * and silent stripping of a leading zero. The parts carry `autocomplete`\n * tokens so autofill still works, which is 1.3.5.\n\n *\n * @category form\n * @icon calendar\n */\nexport class ImpaktDateInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n day: { type: String },\n month: { type: String },\n year: { type: String },\n autocompleteSection: { type: String, attribute: 'autocomplete-section' },\n };\n\n declare day: string;\n declare month: string;\n declare year: string;\n /** \"bday\" fills a date of birth. Empty disables autofill for this field. */\n declare autocompleteSection: string;\n\n constructor() {\n super();\n this.day = '';\n this.month = '';\n this.year = '';\n this.autocompleteSection = 'bday';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .parts {\n display: flex;\n gap: ${space(3)};\n }\n .part {\n display: flex;\n flex-direction: column;\n gap: ${space(1)};\n }\n .part label {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n input {\n min-block-size: 44px;\n padding: ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n /* Room for the digits plus the padding and border, so the box is never narrower than a finger. */\n inline-size: calc(3ch + ${space(6)} + 2px);\n }\n .year input {\n inline-size: calc(5ch + ${space(6)} + 2px);\n }\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private datePart(name: 'day' | 'month' | 'year', label: string, length: number, autocomplete: string): TemplateResult {\n const id = this.id_(name);\n return html`\n <div class=\"part ${name}\">\n <label for=${id}>${label}</label>\n <input\n id=${id}\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=${length}\n .value=${this[name]}\n autocomplete=${this.autocompleteSection ? `${this.autocompleteSection}-${autocomplete}` : nothing}\n ?disabled=${this.disabled}\n @input=${(e: Event) => {\n this[name] = (e.target as HTMLInputElement).value;\n this.emit();\n }}\n />\n </div>\n `;\n }\n\n /** ISO, or empty while incomplete. Partial dates are not half-valid. */\n private emit(): void {\n const complete = this.day && this.month && this.year.length === 4;\n const iso = complete ? `${this.year}-${this.month.padStart(2, '0')}-${this.day.padStart(2, '0')}` : '';\n this.setFormValue(iso);\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"parts\" part=\"parts\">\n ${this.datePart('day', say('Day'), 2, 'day')}\n ${this.datePart('month', say('Month'), 2, 'month')}\n ${this.datePart('year', say('Year'), 4, 'year')}\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-date-input', ImpaktDateInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-date-input': ImpaktDateInput;\n }\n}\n", "/**\n * Stop the page behind a modal dialog or drawer from scrolling.\n *\n * `showModal()` makes the page inert, but it still scrolls, so a wheel or a\n * finger on the backdrop moves the page out from under the dialog, and on a\n * phone the dialog appears to drift. Each open modal takes a hold, and the\n * page scrolls again once the last one lets go, so a dialog opened from a\n * drawer does not unlock the page when it closes. The scrollbar's width is put\n * back as padding, so the page does not shift sideways as it locks.\n */\nconst holders = new Set<object>();\nlet before: { overflow: string; paddingRight: string } | null = null;\n\nexport function lockScroll(holder: object): void {\n if (typeof document === 'undefined' || holders.has(holder)) return;\n holders.add(holder);\n if (holders.size > 1) return;\n const root = document.documentElement;\n const bar = window.innerWidth - root.clientWidth;\n before = { overflow: root.style.overflow, paddingRight: root.style.paddingRight };\n root.style.overflow = 'hidden';\n if (bar > 0) root.style.paddingRight = `${bar}px`;\n}\n\nexport function unlockScroll(holder: object): void {\n if (typeof document === 'undefined' || !holders.delete(holder) || holders.size > 0 || !before) return;\n const root = document.documentElement;\n root.style.overflow = before.overflow;\n root.style.paddingRight = before.paddingRight;\n before = null;\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A modal dialog \u2014 \"are you sure you want to leave this order?\".\n *\n * **It is a native `<dialog>` opened with `showModal()`, and that is the whole\n * design.** The platform then provides, correctly and in every browser: a\n * focus trap, Escape to close, the rest of the page made inert so a screen\n * reader cannot wander out of the dialog, rendering in the top layer so no\n * `z-index` can cover it, and focus returned to whatever opened it when it\n * closes.\n *\n * Every one of those is a thing hand-rolled modals get wrong. The focus trap\n * is the famous one, but inertness is the worse failure: a dialog that traps\n * the Tab key but leaves the background in the accessibility tree lets a\n * screen-reader user read straight past it into a page they cannot interact\n * with, and nothing on screen tells them that is what happened.\n *\n * What is left to get right is the labelling. `aria-labelledby` points at the\n * dialog's own heading, so it is announced by name on open rather than as\n * \"dialog\".\n *\n * Two things the platform leaves out are added. The page behind does not scroll\n * while the dialog is open, so a finger on the backdrop does not move the page\n * out from under it. And with `phone-full-screen` the dialog fills a phone's\n * screen, which suits a dialog holding a form; a short question is better left\n * as a box in the middle, which is the default.\n\n *\n * @category feedback\n * @icon dialog\n * @fires {CustomEvent<null>} impakt-close - When the dialog is closed.\n * @slot - The body of the dialog.\n */\nexport class ImpaktDialog extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n closeLabel: { type: String, attribute: 'close-label' },\n dismissible: { type: Boolean },\n phoneFullScreen: { type: Boolean, reflect: true, attribute: 'phone-full-screen' },\n };\n\n declare open: boolean;\n declare heading: string;\n declare closeLabel: string;\n /** When false, Escape and the backdrop do not close it \u2014 a decision must be made. */\n declare dismissible: boolean;\n /** Fill the screen on a phone, for a dialog that holds a form or a long text. */\n declare phoneFullScreen: boolean;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.closeLabel = 'Close';\n this.dismissible = true;\n this.phoneFullScreen = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog {\n padding: 0;\n border: 0;\n border-radius: ${t.radius2xl};\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: ${t.shadowXl}, 0 0 0 1px ${t.hairline};\n max-inline-size: min(32rem, calc(100vw - 2rem));\n /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside\n itself rather than clipping, at 320px and at 400% zoom alike. */\n max-block-size: calc(100vh - 2rem);\n overflow: auto;\n }\n dialog::backdrop {\n background: color-mix(in srgb, ${t.text} 30%, transparent);\n backdrop-filter: blur(2px);\n }\n .head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: ${space(3)};\n padding: ${space(5)} ${space(5)} 0;\n }\n .heading {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: ${fontSize('xl')};\n font-weight: ${fontWeight('bold')};\n color: ${t.textHeading};\n }\n .body {\n padding: ${space(4)} ${space(5)} ${space(5)};\n }\n @media (max-width: 40rem) {\n :host([phone-full-screen]) dialog {\n inline-size: 100vw;\n max-inline-size: 100vw;\n block-size: 100dvh;\n max-block-size: 100dvh;\n margin: 0;\n border-radius: 0;\n }\n }\n .close {\n ${targetSize}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n font: inherit;\n font-size: ${fontSize('lg')};\n color: ${t.text};\n cursor: pointer;\n }\n `,\n ];\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n // happy-dom and older engines do not implement showModal. Falling back to\n // the `open` attribute renders a NON-modal dialog \u2014 no focus trap, no\n // inert background \u2014 so it is used only to keep tests and ancient browsers\n // from throwing, never as an equivalent.\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${(e: Event) => {\n // `cancel` fires on Escape. Blocking it is what makes a dialog\n // non-dismissible, and it is why `dismissible` exists rather than\n // leaving a caller to re-open on close.\n if (!this.dismissible) e.preventDefault();\n else this.close();\n }}\n @close=${() => {\n if (this.open) this.close();\n }}\n >\n <div class=\"head\">\n ${this.heading ? html`<h2 class=\"heading\" id=${this.id_('heading')} part=\"heading\">${this.heading}</h2>` : nothing}\n ${\n this.dismissible\n ? html`<button class=\"close\" part=\"close\" type=\"button\" @click=${this.close}>\n <span aria-hidden=\"true\">\u00D7</span>\n <span class=\"sr-only\" style=\"position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)\">${this.closeLabel}</span>\n </button>`\n : nothing\n }\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n </dialog>\n `;\n }\n}\n\ncustomElements.define('impakt-dialog', ImpaktDialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-dialog': ImpaktDialog;\n }\n}\n", "import { css, html, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontWeight, space, spaceAround, t, type } from '../base/tokens';\n\n/**\n * A list of short points: what a phase delivers, what a plan includes, the\n * steps of an argument in an article. A bullet, a tick or a number marks each\n * one; the marks are drawn, so a screen reader hears a plain list.\n *\n * @category content\n * @icon list\n */\nexport class ImpaktList extends ImpaktElement {\n static properties = {\n items: { type: Array },\n look: { type: String, reflect: true },\n size: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n\n /** The points, in order. */\n declare items: string[];\n /** `bullet` for points, `check` for what is included, `number` when the order matters. */\n declare look: 'bullet' | 'check' | 'number';\n declare size: 'sm' | 'md' | 'lg';\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.items = [];\n this.look = 'bullet';\n this.size = 'md';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host { display: block; }\n ul, ol { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(3)}; counter-reset: point; }\n li { position: relative; padding-inline-start: ${space(7)}; ${type('md')} text-wrap: pretty; counter-increment: point; }\n :host([size='sm']) li { ${type('sm')} }\n :host([size='lg']) li { ${type('lg')} }\n li::before { content: ''; position: absolute; inset-inline-start: 4px; inset-block-start: 0.6em; inline-size: 7px; block-size: 7px; border-radius: 2px; background: ${t.brand}; }\n :host([look='check']) li::before { content: '\u2713'; inset-inline-start: 0; inset-block-start: 0; inline-size: auto; block-size: auto; background: none; color: ${t.success}; font-weight: ${fontWeight('bold')}; }\n :host([look='number']) li::before { content: counter(point, decimal-leading-zero); inset-inline-start: 0; inset-block-start: 0.2em; inline-size: auto; block-size: auto; background: none; font-family: ${t.fontMono}; font-size: 0.75em; color: ${t.textMuted}; }\n @media (forced-colors: active) { li::before { background: CanvasText; } :host([look='check']) li::before, :host([look='number']) li::before { background: none; color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const items = (this.items ?? []).map((item) => html`<li part=\"item\">${item}</li>`);\n return this.look === 'number' ? html`<ol part=\"list\">${items}</ol>` : html`<ul part=\"list\" role=\"list\">${items}</ul>`;\n }\n}\n\ncustomElements.define('impakt-list', ImpaktList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-list': ImpaktList;\n }\n}\n", "import { css, html } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { spaceAround, token } from '../base/tokens';\n\n/** Column widths as fractions, for each choice of `widths`. */\nconst WIDTHS: Record<string, string> = {\n '2:1': '2fr 1fr',\n '1:2': '1fr 2fr',\n '3:1': '3fr 1fr',\n '1:3': '1fr 3fr',\n '1:2:1': '1fr 2fr 1fr',\n '2:1:1': '2fr 1fr 1fr',\n '1:1:2': '1fr 1fr 2fr',\n};\n\n/**\n * A responsive row with named column slots. Child order stays inside each\n * column; changing a page's visual grid never reorders its reading sequence.\n *\n * Gutters come from the brand's layout, so every grid for a partner keeps the\n * same rhythm. Where the columns stack is a choice, because a three-column\n * row of cards may work on a tablet where two columns of long text do not.\n *\n * @category layout\n * @icon columns\n * @slot column-1 - First column.\n * @slot column-2 - Second column.\n * @slot column-3 - Third column.\n * @slot column-4 - Fourth column.\n */\nexport class ImpaktGrid extends ImpaktElement {\n static properties = {\n columns: { type: String, reflect: true },\n widths: { type: String, reflect: true },\n gap: { type: String, reflect: true },\n stackOn: { type: String, reflect: true, attribute: 'stack-on' },\n align: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare columns: 'one' | 'two' | 'three' | 'four' | 'sidebar-left' | 'sidebar-right';\n /** How wide each column is against the others. Applies when it has as many parts as there are columns. */\n declare widths: 'equal' | '2:1' | '1:2' | '3:1' | '1:3' | '1:2:1' | '2:1:1' | '1:1:2';\n /** The space between columns, from the brand's gutters. */\n declare gap: 'none' | 'sm' | 'md' | 'lg' | 'xl';\n /** The screens on which the columns stack, one above another, in column order. */\n declare stackOn: 'phone' | 'tablet' | 'never';\n /** How columns of different heights line up. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Space before the grid, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the grid, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n constructor() {\n super();\n this.columns = 'two';\n this.widths = 'equal';\n this.gap = 'md';\n this.stackOn = 'phone';\n this.align = 'stretch';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host { display: block; min-inline-size: 0; container-type: inline-size; }\n .columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token('layout.gutter.md', '16px')}; align-items: stretch; }\n :host([gap='none']) .columns { gap: 0; }\n :host([gap='sm']) .columns { gap: ${token('layout.gutter.sm', '8px')}; }\n :host([gap='lg']) .columns { gap: ${token('layout.gutter.lg', '32px')}; }\n :host([gap='xl']) .columns { gap: ${token('layout.gutter.xl', '48px')}; }\n :host([align='start']) .columns { align-items: start; }\n :host([align='center']) .columns { align-items: center; }\n :host([align='end']) .columns { align-items: end; }\n :host([columns='one']) .columns { grid-template-columns: minmax(0, 1fr); }\n :host([columns='three']) .columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='four']) .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n :host([columns='sidebar-left']) .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }\n :host([columns='sidebar-right']) .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }\n .column { min-inline-size: 0; overflow-wrap: anywhere; }\n ::slotted(*) { max-inline-size: 100%; }\n @container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n @container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n `,\n ];\n render() {\n const count = this.columns === 'one' ? 1 : this.columns === 'three' ? 3 : this.columns === 'four' ? 4 : 2;\n const fractions = WIDTHS[this.widths]?.split(' ');\n // A width split for a different number of columns would leave a column out, so it is ignored.\n const template = fractions && fractions.length === count ? fractions.map((f) => `minmax(0, ${f})`).join(' ') : '';\n return html`<div class=\"columns\" part=\"row\" style=${template ? `grid-template-columns: ${template}` : ''}>${Array.from({ length: count }, (_, i) => html`<div class=\"column\" part=\"column\"><slot name=${`column-${i + 1}`}></slot></div>`)}</div>`;\n }\n}\ncustomElements.define('impakt-grid', ImpaktGrid);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-grid': ImpaktGrid;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { fontWeight, t } from '../base/tokens';\n\n/**\n * What form a help mechanism takes.\n *\n * `link` goes somewhere: a help page, a contact form, a chat. The other four\n * are the \"human contact details\" that 3.2.6 Consistent Help names, shown as\n * text so a reader can see them without following anything.\n */\nexport type HelpKind = 'link' | 'phone' | 'email' | 'address' | 'hours';\n\n/**\n * A help link, or contact details shown as text.\n *\n * **Its identity is `mechanismId`, not its wording or destination.** 3.2.6\n * Consistent Help asks that help offered on several pages appears in the same\n * relative order on each. Strata checks that at publish by comparing these ids\n * across pages, so the label can be reworded and the number can change\n * without the check treating it as a different mechanism. It is literal and\n * cannot be bound, because an id that a data response could change is one the\n * check cannot compare.\n *\n * **Contact details are text, not a link to a page that has them.** The\n * criterion lists a phone number, an email address and a postal address as\n * help in their own right, and a reader who has to follow a link to find the\n * number has been given a link rather than the number. A phone number renders\n * as a `tel:` link and an email address as a `mailto:` link, each with the\n * detail itself as the visible text. The link target is derived from the\n * visible detail rather than authored separately, so the number a reader sees\n * and the number their phone dials cannot drift apart. An address or opening\n * hours render as plain text and keep the line breaks they were written with.\n *\n * **Contact links are named by their caption and their detail.** A phone\n * link's accessible name is \"Call us 0800 123 456\" rather than the bare\n * number, because a reader moving through a list of links hears each one out\n * of context (2.4.4 Link Purpose). The visible text stays inside the name, so\n * 2.5.3 Label in Name holds for a reader who speaks it.\n *\n * **Nothing unnamed or empty is ever rendered.** Runtime bindings may be\n * absent while data loads, or resolve to blank text. A link with no label, or\n * contact details with no detail, render nothing rather than a focusable link\n * with no name or a caption with nothing under it. Contact details whose\n * caption is blank still show the detail, because a phone number or an\n * address names itself. For that reason the caption is optional for contact\n * details, and publishing requires a label only on a link. Publishing does\n * require what each kind cannot do without: a link's label and address, and\n * contact details' detail, so the empty states are only reached at runtime.\n *\n * **Every link meets the minimum target size.** Links here are at least the\n * locked `target.min` token in both directions (2.5.8 Target Size), because a\n * help link usually stands on its own line, where the criterion's inline\n * exemption does not apply.\n *\n * @category action\n * @icon help\n * @role help\n */\nexport class ImpaktHelp extends ImpaktElement {\n static properties = {\n mechanismId: { type: String, attribute: 'mechanism-id' },\n kind: { type: String, reflect: true },\n href: { type: String },\n label: { type: String },\n detail: { type: String },\n };\n\n /** Stable identity across pages, independent of wording and destination. */\n declare mechanismId: string;\n // Written out as a union rather than as `HelpKind` so the manifest offers it\n // as a fixed choice: which form help takes is a design decision, not data.\n /** Whether this is a link to help, or contact details shown as text. */\n declare kind: 'link' | 'phone' | 'email' | 'address' | 'hours';\n /** Where a link goes. Phone and email links are built from the detail instead. */\n declare href: string;\n /**\n * The visible name. For a link it is the link text. For contact details it\n * is the caption shown above them, such as \"Call us\".\n */\n declare label: string;\n /**\n * The contact detail itself: a phone number, an email address, a postal\n * address or opening hours. Line breaks are kept. Unused by a link.\n */\n declare detail: string;\n\n constructor() {\n super();\n this.kind = 'link';\n this.href = '';\n // Defaulted, so the manifest does not mark it required: contact details\n // may leave the caption out. A link without one is refused at publish.\n this.label = '';\n this.detail = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n a { display: inline-flex; align-items: center; min-height: ${t.targetMin}; min-width: ${t.targetMin};\n color: ${t.link}; text-decoration: underline; overflow-wrap: anywhere; max-width: 100%; }\n a:hover { color: ${t.linkHover}; }\n .contact { margin: 0; }\n .caption { display: block; font-weight: ${fontWeight('semibold')}; }\n /* An address is written one line at a time, and opening hours are often one\n day to a line. Long unbroken values still wrap at 320px (1.4.10). */\n .detail { white-space: pre-line; overflow-wrap: anywhere; }\n `,\n ];\n\n render(): TemplateResult | typeof nothing {\n switch (this.kind) {\n case 'phone':\n case 'email':\n case 'address':\n case 'hours':\n return this.renderContact();\n default:\n // An absent or unrecognised kind keeps the original link behaviour, so\n // a page published before contact details existed renders unchanged.\n return this.renderLink();\n }\n }\n\n private renderLink(): TemplateResult | typeof nothing {\n // Runtime bindings may be absent while data loads, or resolve to blank text.\n // Do not expose an unnamed focusable link in those states.\n if (!text(this.label)) return nothing;\n return html`<a part=\"link\" href=${this.href}>${this.label}</a>`;\n }\n\n private renderContact(): TemplateResult | typeof nothing {\n const detail = text(this.detail);\n // A caption with nothing under it is not help, so neither is drawn.\n if (!detail) return nothing;\n const caption = text(this.label);\n const target = contactHref(this.kind, detail);\n const captionId = this.id_('caption');\n const detailId = this.id_('detail');\n const captionPart = caption ? html`<span class=\"caption\" part=\"label\" id=${captionId}>${caption}</span>` : nothing;\n const detailPart = target\n ? html`<a part=\"link\" href=${target} aria-labelledby=${caption ? `${captionId} ${detailId}` : nothing}\n ><span class=\"detail\" part=\"detail\" id=${detailId}>${detail}</span></a>`\n : html`<span class=\"detail\" part=\"detail\">${detail}</span>`;\n return html`<p class=\"contact\" part=\"contact\">${captionPart}${detailPart}</p>`;\n }\n}\n\n/** Trimmed text, or empty for anything that is not a string. */\nfunction text(value: unknown): string {\n return typeof value === 'string' ? value.trim() : '';\n}\n\n/**\n * The link a contact detail opens, or empty when it should stay as text.\n *\n * A phone number is reduced to its digits and one leading `+`, and the \"(0)\"\n * that UK numbers print after the country code is dropped, because the\n * separators a reader expects are not dialled. A value with no digits, or an\n * email address without an `@`, stays as plain text. The reader still sees\n * it, and nothing offers to dial or mail something that cannot work.\n */\nfunction contactHref(kind: string, detail: string): string {\n if (kind === 'phone') {\n const digits = detail\n .replace(/\\(0\\)/g, '')\n .replace(/[^\\d+]/g, '')\n .replace(/(?!^)\\+/g, '');\n return /\\d/.test(digits) ? `tel:${digits}` : '';\n }\n if (kind === 'email') return /^[^\\s@]+@[^\\s@]+$/.test(detail) ? `mailto:${detail}` : '';\n return '';\n}\n\ncustomElements.define('impakt-help', ImpaktHelp);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-help': ImpaktHelp;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impakt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impakt-page-inner: 760px; }\n :host([width='wide']) { --impakt-page-inner: 1440px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impakt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impakt-page (min-width: 40rem) { .frame { --impakt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impakt-page (min-width: 64rem) { .frame { --impakt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpaktPage extends ImpaktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n };\n /** How wide the content runs. Standard is the brand's page width. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n widths,\n margins,\n css`\n :host { display: block; container: impakt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impakt-page-inner) + 2 * var(--impakt-page-margin)); margin-inline: auto; padding-inline: var(--impakt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impakt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-header', 'inherit')}; }\n footer { --impakt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impakt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impakt-page-margin)); max-inline-size: var(--impakt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `,\n ];\n\n private hasSlot(name: string): boolean {\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impakt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impakt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impakt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPAKT-') && !/^IMPAKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpaktSection extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n pattern: { type: String, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The band's background. Text on it takes the matching colour, so it stays readable. */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent';\n /** Space inside the band, above and below its content. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** How wide the content inside runs. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /**\n * Fine lines drawn across the band: a square grid, a closer blueprint grid,\n * upright columns or ruled lines. They are decoration, drawn in the band's\n * own text colour at a tenth of its strength, and are left out in a forced\n * colours mode.\n */\n declare pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.pattern = 'none';\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n widths,\n css`\n :host { display: block; --impakt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impakt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impakt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impakt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; --impakt-color-text-link-hover: ${t.onBrand}; }\n /* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */\n :host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host([tone='accent']) { --impakt-band: ${token('color.accent.default', '#e2cc40')}; --impakt-band-on: ${token('color.accent.on', '#1a1a1a')}; --impakt-band-muted: ${token('color.accent.on', '#1a1a1a')}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }\n /* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */\n :host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }\n :host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }\n :host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }\n :host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }\n :host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }\n @media (forced-colors: active) { .band { background-image: none !important; } }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n .content { max-inline-size: var(--impakt-page-inner); margin-inline: auto; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impakt-page', ImpaktPage);\ncustomElements.define('impakt-section', ImpaktSection);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-page': ImpaktPage;\n 'impakt-section': ImpaktSection;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One link in a navigation or a trail. */\nexport interface NavLink {\n label: string;\n href: string;\n}\n\n/** Whether a link is the page the visitor is on, or a page above it. */\nfunction where(href: string): 'page' | 'section' | null {\n // A link to a place on this page, or to nowhere yet (\"#\"), is not where the reader is.\n if (typeof location === 'undefined' || !href || href.startsWith('#')) return null;\n let path: string;\n try {\n const url = new URL(href, location.href);\n // A link to another site is never where the reader is, even when its path matches, as a\n // product at app.example.com linking back to example.com/ would otherwise mark that link.\n if (url.origin !== location.origin) return null;\n path = url.pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n const here = location.pathname.replace(/\\/$/, '') || '/';\n if (path === here) return 'page';\n return path !== '/' && here.startsWith(`${path}/`) ? 'section' : null;\n}\n\n/**\n * The site's main navigation: a row of links that folds into a Menu button\n * when there is not room for all of them, whatever the screen.\n *\n * **The page you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and an\n * underline, so it does not rely on colour alone (1.4.1).\n *\n * **The menu is a disclosure, not a pop-up.** The Menu button says whether the\n * list is open (`aria-expanded`), the links follow it in the reading order, and\n * Escape closes it and returns focus to the button.\n *\n * @category action\n * @icon menu\n */\nexport class ImpaktNav extends ImpaktElement {\n static properties = {\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\n menuLook: { type: String, reflect: true, attribute: 'menu-look' },\n size: { type: String, reflect: true },\n align: { type: String, reflect: true },\n };\n /** The links, in order. */\n declare links: NavLink[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The words on the button that opens the links on a narrow screen. */\n declare menuText: string;\n /**\n * The Menu button: `button` with its words, or `icon`, a round button with\n * only the icon, the words kept as its name for screen readers.\n */\n declare menuLook: 'button' | 'icon';\n /** `sm` sets the links a step smaller and closer, as a site header's are. */\n declare size: 'md' | 'sm';\n /** Where the links sit along the row. */\n declare align: 'start' | 'center' | 'end';\n /** Whether the menu is open on a narrow screen. Not a setting: it is the visitor's. */\n private menuOpen = false;\n private get open(): boolean {\n return this.menuOpen;\n }\n private set open(next: boolean) {\n this.menuOpen = next;\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.menuLook = 'button';\n this.size = 'md';\n this.align = 'end';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n /* It grows to fill a row it sits in, because it measures itself to decide when to fold. */\n :host { display: block; flex: 1 1 8rem; min-inline-size: 0; }\n nav { display: flex; flex-direction: column; position: relative; }\n li { flex: none; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)} ${space(6)}; align-items: center; justify-content: flex-end; }\n :host([align='start']) ul { justify-content: flex-start; }\n :host([align='center']) ul { justify-content: center; }\n a { ${targetSize} display: inline-flex; align-items: center; padding: ${space(2)} ${space(1)}; color: inherit; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radiusSm}; }\n a:hover { text-decoration: underline; text-underline-offset: 0.25em; }\n a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }\n .toggle { display: none; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n /* When they do not fit, the links fold behind a Menu button and open as a panel under it. */\n :host([folded]) { flex: 0 0 auto; }\n :host([folded]) .toggle { display: inline-flex; }\n :host([menu-look='icon']) .toggle { inline-size: 44px; block-size: 44px; padding: 0; justify-content: center; border: 0; border-radius: 50%; background: ${t.brand}; color: ${t.onBrand}; }\n :host([menu-look='icon']) .toggle .words { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n :host([size='sm']) ul { column-gap: ${space(6)}; }\n :host([size='sm']) a { padding-inline: 0; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('medium')}; }\n :host([size='sm'][folded]) a { padding-inline: ${space(3)}; }\n :host([folded]) ul { display: none; position: absolute; inset-block-start: calc(100% + ${space(2)}); inset-inline-end: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 0; min-inline-size: 14rem; padding: ${space(2)}; background: ${t.surfaceCard}; color: ${t.text}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: 0 8px 24px rgb(0 0 0 / 14%); }\n :host([folded]) ul.open { display: flex; }\n :host([folded]) li { text-align: start; }\n :host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }\n `,\n ];\n\n /** The width the links need in one row. Measured once for each set of links, and again while folded it cannot be read. */\n private needs = 0;\n private resize?: ResizeObserver;\n\n private fit(): void {\n const room = this.getBoundingClientRect().width;\n if (room <= 0) return;\n if (!this.needs) {\n this.removeAttribute('folded');\n const items = Array.from(this.renderRoot.querySelectorAll('li'));\n const gap = Number.parseFloat(getComputedStyle(this.renderRoot.querySelector('ul')!).columnGap) || 0;\n this.needs = items.reduce((total, item) => total + item.getBoundingClientRect().width, 0) + gap * Math.max(0, items.length - 1);\n }\n const fold = this.needs > room;\n this.toggleAttribute('folded', fold);\n if (!fold && this.menuOpen) this.open = false;\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (changed.has('links')) {\n this.needs = 0;\n this.fit();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(() => this.fit());\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resize?.disconnect();\n }\n\n private toggle(): void {\n this.open = !this.open;\n }\n\n private onKey(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open) return;\n this.open = false;\n this.renderRoot.querySelector<HTMLButtonElement>('.toggle')?.focus();\n }\n\n render(): TemplateResult {\n const list = this.id_('links');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\" @keydown=${this.onKey}>\n <button class=\"toggle\" type=\"button\" aria-expanded=${this.open ? 'true' : 'false'} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? 'close' : this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <ul id=${list} class=${this.open ? 'open' : ''} part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n\n/**\n * Where the page sits in the site, as a trail of links back to the top: Home,\n * then Developments, then this page.\n *\n * The last item is the page itself. It is not a link, and it carries\n * `aria-current=\"page\"`. The separators are drawn, not written, so a screen\n * reader reads the trail as a list rather than a string of slashes.\n *\n * @category action\n * @icon breadcrumbs\n */\nexport class ImpaktBreadcrumbs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n };\n /** The trail, from the top of the site down to this page. */\n declare items: NavLink[];\n /** What the trail is called for a screen reader. */\n declare label: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Breadcrumb';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; font-size: ${fontSize('sm')}; }\n ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${space(1)}; }\n li { display: inline-flex; align-items: center; gap: ${space(1)}; }\n li + li::before { content: ''; inline-size: 0.45em; block-size: 0.45em; border-block-start: 1.5px solid ${t.textMuted}; border-inline-end: 1.5px solid ${t.textMuted}; transform: rotate(45deg); margin-inline: ${space(1)} ${space(2)}; }\n a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }\n a:hover { color: ${t.linkHover}; }\n [aria-current] { color: ${t.textMuted}; }\n .sr-only { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const items = this.items ?? [];\n return html`<nav aria-label=${this.label} part=\"nav\"><ol>\n ${items.map(\n (item, i) =>\n html`<li>${\n i === items.length - 1 ? html`<span aria-current=\"page\">${item.label}</span>` : html`<a href=${item.href} part=\"link\">${item.label}</a>`\n }</li>`,\n )}\n </ol></nav>`;\n }\n}\n\ncustomElements.define('impakt-nav', ImpaktNav);\ncustomElements.define('impakt-breadcrumbs', ImpaktBreadcrumbs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-nav': ImpaktNav;\n 'impakt-breadcrumbs': ImpaktBreadcrumbs;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, lineHeight, space, t } from '../base/tokens';\nimport { announceNavigate } from './shell';\n\n/**\n * A line between two parts of a page.\n *\n * It is decoration, so a screen reader passes over it. Where the change of\n * subject matters, a heading says so better.\n *\n * @category layout\n * @icon divider\n */\nexport class ImpaktDivider extends ImpaktElement {\n static properties = {\n spacing: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Space above and below the line. */\n declare spacing: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'subtle' | 'strong';\n\n constructor() {\n super();\n this.spacing = 'md';\n this.tone = 'subtle';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; }\n hr { margin: ${space(4)} 0; border: 0; border-block-start: ${t.borderThin} solid ${t.border}; opacity: 0.5; }\n :host([tone='strong']) hr { opacity: 1; border-block-start-width: ${t.borderThick}; }\n :host([spacing='sm']) hr { margin-block: ${space(2)}; }\n :host([spacing='lg']) hr { margin-block: ${space(8)}; }\n :host([spacing='xl']) hr { margin-block: ${space(12)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<hr aria-hidden=\"true\" part=\"line\" />`;\n }\n}\n\n/**\n * Empty space, from the spacing scale, for the rare place where the gaps of the\n * containers around it are not enough.\n *\n * @category layout\n * @icon spacer\n */\nexport class ImpaktSpacer extends ImpaktElement {\n static properties = { size: { type: String, reflect: true } };\n declare size: 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; block-size: ${space(4)}; }\n :host([size='sm']) { block-size: ${space(2)}; }\n :host([size='lg']) { block-size: ${space(8)}; }\n :host([size='xl']) { block-size: ${space(12)}; }\n :host([size='2xl']) { block-size: ${space(16)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html``;\n }\n}\n\n/**\n * Words a screen reader says that are not shown: \"(opens a map)\" after a link\n * whose purpose is clear on screen from where it sits.\n *\n * @category typography\n * @icon hidden\n * @slot - The words to say.\n */\nexport class ImpaktVisuallyHidden extends ImpaktElement {\n static styles = [...ImpaktElement.styles, css`:host { ${visuallyHidden} }`];\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** One tab and what it shows. */\nexport interface TabItem {\n id: string;\n label: string;\n /** The panel's words. A child with `slot` set to the tab's id is shown instead, for anything richer. */\n body?: string;\n /** A number shown on the tab, such as the open tasks behind it. */\n count?: number;\n /** The count in words for a screen reader, such as \"2 overdue tasks\". The number alone when empty. */\n countLabel?: string;\n /** Where the tab goes. When every tab has one, the tabs are links to pages, not panels. */\n href?: string;\n}\n\n/**\n * Panels of content behind a row of tabs, one shown at a time: the floor plans\n * of three house types, or a case's summary, tasks and files.\n *\n * It follows the ARIA tabs pattern. The tabs are one stop in the tab order,\n * the arrow keys, Home and End move between them, and each panel is labelled\n * by its tab. Use an accordion instead when someone may want to compare panels.\n *\n * **The tabs stay on one row** and scroll sideways when they do not fit, as the\n * design guide sets, and the chosen tab is scrolled into view, so on a phone it\n * is never hidden off the edge. With `two-rows`, a set of more than four tabs is\n * laid out in two rows on a narrow screen instead, so every tab can be seen.\n *\n * **The chosen tab is kept** when the tabs are given again, as a React or Vue app\n * does on every render, so long as a tab with that id is still there.\n *\n * A panel shows its item's `body`, or a child whose `slot` is the item's id.\n *\n * **Tabs that go to pages are links.** When every item has an `href`, such as\n * a job's Overview, Money and Notes, each of which has its own address, the\n * tabs are drawn the same but are a `nav` of links, the current one marked\n * `aria-current=\"page\"`, with no panels. A row of links is not the ARIA tabs\n * pattern, and announcing it as one would promise arrow keys and panels that\n * are not there. They send `impakt-navigate` like the side navigation, so an\n * app can route without a reload.\n *\n * `look=\"pill\"` draws the tabs as pills in a rounded bar, with the chosen one\n * filled, as a product's workspace tabs are.\n *\n * @category content\n * @icon tabs\n * @slot - A child with `slot` set to a tab's id is that tab's panel.\n * @fires {CustomEvent<{ value: string }>} impakt-change - When another tab is chosen.\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When a tab that is a link is followed. Cancel it to route in the app.\n */\nexport class ImpaktTabs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n selected: { type: String, reflect: true },\n label: { type: String },\n twoRows: { type: Boolean, reflect: true, attribute: 'two-rows' },\n look: { type: String, reflect: true },\n };\n declare items: TabItem[];\n /** The id of the tab shown first. The first tab when it is empty. */\n declare selected: string;\n /** What the set of tabs is about, for a screen reader. */\n declare label: string;\n /** On a narrow screen, lay more than four tabs out in two rows rather than scroll them. */\n declare twoRows: boolean;\n /** `line` underlines the chosen tab; `pill` fills it, in a rounded bar. */\n declare look: 'line' | 'pill';\n\n constructor() {\n super();\n this.items = [];\n this.selected = '';\n this.label = '';\n this.twoRows = false;\n this.look = 'line';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget(\"[role='tab']\"),\n css`\n /* Only the two-row layout needs a size container. Making every tab set one\n would take its width from its parent alone, so in a flex row, with no\n width given, it would shrink to nothing. In a row it may still shrink\n below its tabs, which then scroll, rather than widen the page. */\n :host { display: block; min-inline-size: 0; }\n :host([two-rows]) { container-type: inline-size; }\n [role='tablist'] { display: flex; gap: ${space(1)}; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n [role='tab'] { ${targetSize} position: relative; flex: none; padding: ${space(3)} ${space(4)}; font: inherit; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; background: transparent; border: 0; border-block-end: 3px solid transparent; margin-block-end: -1px; cursor: pointer; border-radius: ${t.radius} ${t.radius} 0 0; }\n /* Inside a box that scrolls the ring would be clipped, so it is drawn inside the tab. */\n [role='tab']:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; }\n [role='tab']:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n [role='tab'][aria-selected='true'] { color: ${t.link}; border-block-end-color: currentColor; }\n [role='tabpanel'] { padding-block: ${space(5)}; line-height: ${lineHeight('normal')}; }\n .body { white-space: pre-line; }\n @container (max-width: 40rem) {\n :host([two-rows]) [role='tablist'].many { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); overflow: visible; border-block-end: 0; gap: ${space(1)}; }\n :host([two-rows]) .many [role='tab'] { white-space: normal; padding-inline: ${space(2)}; margin: 0; border-block-end-width: 3px; border-block-end-color: ${t.rule}; border-radius: ${t.radius}; }\n :host([two-rows]) .many [role='tab'][aria-selected='true'] { border-block-end-color: currentColor; background: ${t.brandSubtle}; }\n }\n @media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }\n .count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 20px; margin-inline-start: ${space(2)}; padding: 0 ${space(1.5)}; border-radius: 999px; font-size: 12px; font-weight: ${fontWeight('semibold')}; background: ${t.brand}; color: ${t.onBrand}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n /* Links drawn as tabs. */\n nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; overflow-x: auto; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n nav a { ${targetSize} position: relative; display: inline-flex; align-items: center; flex: none; padding: ${space(3)} ${space(4)}; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; text-decoration: none; border-block-end: 3px solid transparent; margin-block-end: -1px; border-radius: ${t.radius} ${t.radius} 0 0; }\n nav a:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n nav a[aria-current='page'] { color: ${t.link}; border-block-end-color: currentColor; }\n nav a:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; outline: none; }\n /* The pill look, for either kind. */\n :host([look='pill']) :is([role='tablist'], nav ul) { padding: ${space(1)}; border: 0; border-radius: 999px; background: ${t.surfaceCard}; gap: ${space(0.5)}; }\n :host([look='pill']) :is([role='tab'], nav a) { padding: ${space(2)} ${space(4)}; margin: 0; border: 0; border-radius: 999px; font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([look='pill']) :is([role='tab'], nav a):hover { background: ${t.surfaceInset}; }\n :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { background: ${t.text}; color: ${t.surfaceCard}; }\n @media (forced-colors: active) { :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { border: 2px solid Highlight; } }\n `,\n ];\n\n private countOf(item: TabItem): TemplateResult | typeof nothing {\n if (typeof item.count !== 'number') return nothing;\n return item.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${item.count}</span><span class=\"sr-only\">, ${item.countLabel}</span>`\n : html`<span class=\"count\">${item.count}</span>`;\n }\n\n private get linked(): boolean {\n const items = this.items ?? [];\n return items.length > 0 && items.every((i) => Boolean(i.href));\n }\n\n private current(): string {\n const items = this.items ?? [];\n return items.some((i) => i.id === this.selected) ? this.selected : (items[0]?.id ?? '');\n }\n\n private choose(id: string, focus: boolean): void {\n if (id === this.current()) return;\n this.selected = id;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { value: id }, bubbles: true, composed: true }));\n if (focus) void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`#${this.id_(`tab-${id}`)}`)?.focus({ preventScroll: true }));\n }\n\n private onKey(event: KeyboardEvent): void {\n const items = this.items ?? [];\n const at = items.findIndex((i) => i.id === this.current());\n const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: items.length - 1 }[event.key];\n if (to === undefined || !items.length) return;\n event.preventDefault();\n this.choose(items[(to + items.length) % items.length]!.id, true);\n }\n\n /**\n * Bring the chosen tab into view inside the row of tabs. Only the row scrolls:\n * `scrollIntoView` would scroll the page too, and move someone who is reading\n * further down.\n */\n private reveal(): void {\n const list = this.renderRoot.querySelector<HTMLElement>(\"[role='tablist']\");\n const tab = this.renderRoot.querySelector<HTMLElement>(\"[role='tab'][aria-selected='true']\");\n if (!list || !tab || list.scrollWidth <= list.clientWidth) return;\n const start = tab.offsetLeft - list.offsetLeft;\n const end = start + tab.offsetWidth;\n if (start < list.scrollLeft) list.scrollLeft = start - 16;\n else if (end > list.scrollLeft + list.clientWidth) list.scrollLeft = end - list.clientWidth + 16;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('selected') || changed.has('items')) this.reveal();\n }\n\n render(): TemplateResult {\n const items = this.items ?? [];\n const current = this.current();\n if (this.linked) {\n return html`<nav aria-label=${this.label || nothing} part=\"tabs\"><ul>\n ${items.map((item) => html`<li><a href=${item.href!} part=\"tab\" aria-current=${item.id === current ? 'page' : nothing} @click=${(e: MouseEvent) => announceNavigate(this, e, { href: item.href!, id: item.id })}>${item.label}${this.countOf(item)}</a></li>`)}\n </ul></nav>`;\n }\n const many = items.length > 4;\n return html`<div role=\"tablist\" aria-label=${this.label || nothing} part=\"tabs\" class=${many ? 'many' : ''} style=${many ? `--columns:${Math.ceil(items.length / 2)}` : nothing} @keydown=${this.onKey}>\n ${items.map((item) => html`<button role=\"tab\" type=\"button\" id=${this.id_(`tab-${item.id}`)} aria-selected=${item.id === current ? 'true' : 'false'} aria-controls=${this.id_(`panel-${item.id}`)} tabindex=${item.id === current ? '0' : '-1'} @click=${() => this.choose(item.id, false)}>${item.label}${this.countOf(item)}</button>`)}\n </div>\n ${items.map((item) => html`<div role=\"tabpanel\" id=${this.id_(`panel-${item.id}`)} aria-labelledby=${this.id_(`tab-${item.id}`)} tabindex=\"0\" ?hidden=${item.id !== current} part=\"panel\"><slot name=${item.id}><span class=\"body\">${item.body ?? ''}</span></slot></div>`)}`;\n }\n}\n\ncustomElements.define('impakt-divider', ImpaktDivider);\ncustomElements.define('impakt-spacer', ImpaktSpacer);\ncustomElements.define('impakt-visually-hidden', ImpaktVisuallyHidden);\ncustomElements.define('impakt-tabs', ImpaktTabs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-divider': ImpaktDivider;\n 'impakt-spacer': ImpaktSpacer;\n 'impakt-visually-hidden': ImpaktVisuallyHidden;\n 'impakt-tabs': ImpaktTabs;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, lineHeight, space, t } from '../base/tokens';\n\n/**\n * Fields that belong together under one question: the lines of an address,\n * or a name in two parts.\n *\n * **The question is the group's name.** It is a `fieldset` with a `legend`, so\n * a screen reader says \"Your address, group\" on the way in, and each field\n * inside is heard as part of it (1.3.1, 3.3.2). An error for the group as a\n * whole, such as \"Enter a full address\", is tied to it the same way.\n *\n * @category form\n * @icon fieldset\n * @slot - The fields in the group.\n */\nexport class ImpaktFieldset extends ImpaktElement {\n static properties = {\n legend: { type: String },\n description: { type: String },\n error: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n /** The question the fields answer together. */\n declare legend: string;\n /** A hint for the whole group, under the question. */\n declare description: string;\n /** What is wrong with the group as a whole. */\n declare error: string;\n /** How large the question is. A page that asks only this question makes it the page's heading size. */\n declare size: 'md' | 'lg' | 'xl';\n\n constructor() {\n super();\n this.legend = '';\n this.description = '';\n this.error = '';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; margin-block-end: ${space(6)}; }\n fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }\n legend { padding: 0; margin-block-end: ${space(2)}; font-size: ${fontSize('md')}; font-weight: ${fontWeight('bold')}; line-height: ${lineHeight('tight')}; color: ${t.text}; }\n :host([size='lg']) legend { font-size: ${fontSize('xl')}; font-family: ${t.fontHeading}; color: ${t.textHeading}; }\n :host([size='xl']) legend { font-size: ${fontSize('2xl')}; font-family: ${t.fontHeading}; color: ${t.textHeading}; }\n .description { margin-block-end: ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.textMuted}; line-height: ${lineHeight('normal')}; }\n .error { margin-block-end: ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.dangerText}; font-weight: ${fontWeight('semibold')}; }\n .error:empty { display: none; }\n :host([error]:not([error=''])) .fields { padding-inline-start: ${space(4)}; border-inline-start: 4px solid ${t.danger}; }\n `,\n ];\n\n render(): TemplateResult {\n const described = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean).join(' ');\n return html`<fieldset part=\"fieldset\" aria-describedby=${described || nothing}>\n <legend part=\"legend\">${this.legend}</legend>\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')}>${this.description}</div>` : nothing}\n <div class=\"error\" id=${this.id_('error')} aria-live=\"polite\">${this.error || nothing}</div>\n <div class=\"fields\" part=\"fields\"><slot></slot></div>\n </fieldset>`;\n }\n}\n\ncustomElements.define('impakt-fieldset', ImpaktFieldset);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-fieldset': ImpaktFieldset;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { pageLocale } from '../base/locale';\nimport { FieldElement } from '../base/FieldElement';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontWeight, space, spaceAround, t, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A panel that slides in from the side: a basket, filters, a plot's details.\n *\n * It is a native `<dialog>` opened with `showModal()`, like the dialog, so the\n * focus trap, Escape, the inert page behind it and the return of focus all come\n * from the browser. The page behind it does not scroll while it is open. The\n * slide is a decoration and stops for anyone who has asked for reduced motion.\n * On a phone it fills the screen.\n *\n * With `side=\"bottom\"` it is a sheet that rises from the bottom edge, as a\n * phone's dialogs do: as wide as the screen, as tall as its content up to\n * nine tenths of the screen, with its top corners rounded.\n *\n * @category feedback\n * @icon drawer\n * @slot - The body of the panel.\n * @slot footer - Buttons pinned to the bottom of the panel.\n * @fires {CustomEvent<null>} impakt-close - When the panel is closed.\n */\nexport class ImpaktDrawer extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n side: { type: String, reflect: true },\n closeLabel: { type: String, attribute: 'close-label' },\n };\n declare open: boolean;\n declare heading: string;\n /** Which edge it comes in from. `bottom` is a sheet, for a phone. */\n declare side: 'left' | 'right' | 'bottom';\n declare closeLabel: string;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.side = 'right';\n this.closeLabel = 'Close';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog { box-sizing: border-box; display: none; flex-direction: column; inline-size: min(28rem, 100vw); max-inline-size: 100vw; block-size: 100dvh; max-block-size: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; color: ${t.text}; background: ${t.surfaceCard}; box-shadow: ${t.shadowXl}; animation: from-right 240ms cubic-bezier(0.16, 1, 0.3, 1); }\n dialog[open] { display: flex; }\n :host([side='left']) dialog { margin: 0 auto 0 0; animation-name: from-left; }\n :host([side='bottom']) dialog { inline-size: 100vw; block-size: fit-content; max-block-size: 90dvh; margin: auto 0 0 0; padding-block-end: env(safe-area-inset-bottom); border-radius: 28px 28px 0 0; animation-name: from-bottom; }\n :host([side='bottom']) .head { box-shadow: none; }\n :host([side='bottom']) .foot { box-shadow: none; }\n :host([side='bottom']) .foot ::slotted(*) { flex: 1; }\n @keyframes from-bottom { from { transform: translateY(100%); } }\n dialog::backdrop { background: color-mix(in srgb, ${t.text} 30%, transparent); backdrop-filter: blur(2px); }\n @keyframes from-right { from { transform: translateX(100%); } }\n @keyframes from-left { from { transform: translateX(-100%); } }\n .head { display: flex; align-items: center; justify-content: space-between; gap: ${space(3)}; padding: ${space(4)} ${space(5)}; box-shadow: 0 1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }\n h2 { margin: 0; font-family: ${t.fontHeading}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n .close { ${targetSize} display: inline-flex; align-items: center; justify-content: center; padding: 0; color: ${t.text}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .close:hover { background: ${t.surfaceSubtle}; }\n .body { flex: 1; overflow: auto; padding: ${space(5)}; }\n .foot { display: flex; gap: ${space(3)}; justify-content: flex-end; padding: ${space(4)} ${space(5)}; box-shadow: 0 -1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }\n .foot[hidden] { display: none; }\n `,\n ];\n\n private hasFooter = false;\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n private footerChanged(event: Event): void {\n this.hasFooter = (event.target as HTMLSlotElement).assignedNodes().length > 0;\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n return html`<dialog part=\"dialog\" aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${() => this.close()}\n @close=${() => {\n if (this.open) this.close();\n }}\n @click=${(event: Event) => {\n if (event.target === this.dialog) this.close();\n }}>\n <div class=\"head\">\n ${this.heading ? html`<h2 id=${this.id_('heading')}>${this.heading}</h2>` : html`<span></span>`}\n <button class=\"close\" type=\"button\" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg('close', '20px')}</button>\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n <div class=\"foot\" part=\"footer\" ?hidden=${!this.hasFooter}><slot name=\"footer\" @slotchange=${this.footerChanged}></slot></div>\n </dialog>`;\n }\n}\n\nconst TOAST_ICON: Record<string, string> = { neutral: 'info', success: 'check', warning: 'warning', danger: 'warning' };\n\n/**\n * A short message in the corner that goes away: \"Viewing booked\", \"Saved\".\n *\n * It says itself to a screen reader through a live region that is on the page\n * before the message is, and its timer stops while it is pointed at or focused.\n * Set `duration` to 0 to keep it up until it is closed. A message with a button,\n * such as Undo, stays until it is closed whatever the duration, because a\n * button that disappears on a timer cannot be pressed by someone who needs\n * longer (2.2.1). Escape closes it while focus is inside it. Anything a person\n * must act on belongs in an alert on the page.\n *\n * It never takes the page's clicks: only the message itself can be pressed, so\n * the page beside and behind the corner it sits in still works. On a phone it\n * spans the screen above the bottom edge, clear of the home bar and of a bottom\n * bar that sets `--impakt-bottom-bar`, and it rises without moving for anyone who\n * has asked for reduced motion.\n *\n * @category feedback\n * @icon toast\n * @fires {CustomEvent<null>} impakt-close - When the message goes away.\n * @fires {CustomEvent<null>} impakt-action - When its button is pressed.\n */\nexport class ImpaktToast extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n message: { type: String },\n tone: { type: String, reflect: true },\n duration: { type: Number },\n actionText: { type: String, attribute: 'action-text' },\n closeLabel: { type: String, attribute: 'close-label' },\n };\n declare open: boolean;\n declare message: string;\n declare tone: 'neutral' | 'success' | 'warning' | 'danger';\n /** How long it stays. 0 keeps it up until it is closed. */\n declare duration: number;\n declare actionText: string;\n declare closeLabel: string;\n\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n super();\n this.open = false;\n this.message = '';\n this.tone = 'neutral';\n this.duration = 6;\n this.actionText = '';\n this.closeLabel = 'Dismiss';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n .region { position: fixed; inset-block-end: calc(${space(4)} + env(safe-area-inset-bottom, 0px) + var(--impakt-bottom-bar, 0px)); inset-inline-end: ${space(4)}; z-index: 1000; inline-size: min(24rem, calc(100vw - ${space(8)})); pointer-events: none; }\n @media (max-width: 40rem) { .region { inset-inline: ${space(3)}; inline-size: auto; inset-block-end: calc(${space(3)} + env(safe-area-inset-bottom, 0px) + var(--impakt-bottom-bar, 0px)); } }\n .toast { pointer-events: auto; max-block-size: 40vh; overflow: auto; display: flex; align-items: flex-start; gap: ${space(3)}; padding: ${space(3)} ${space(3)} ${space(3)} ${space(4)}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowXl}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1); }\n /* It rises without fading in, so its words are at full contrast from the first frame they are read in (1.4.3). */\n @keyframes rise { from { transform: translateY(${space(3)}); } }\n .mark { display: inline-flex; flex: none; margin-block-start: ${space(0.5)}; color: ${t.info}; }\n :host([tone='success']) .mark { color: ${t.success}; }\n :host([tone='warning']) .mark { color: ${t.warning}; }\n :host([tone='danger']) .mark { color: ${t.danger}; }\n .message { flex: 1; align-self: center; margin: 0; ${type('sm')} font-weight: ${fontWeight('medium')}; }\n .action, .close { ${targetSize} padding: 0 ${space(2)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('semibold')}; color: ${t.link}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .close { display: inline-flex; align-items: center; justify-content: center; color: ${t.textMuted}; }\n .action:hover, .close:hover { background: ${t.surfaceSubtle}; }\n `,\n touchTarget('.action, .close'),\n ];\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('open') || changed.has('duration')) {\n this.stop();\n if (this.open) this.start();\n }\n }\n\n private start(): void {\n this.stop();\n if (this.duration > 0 && !this.actionText) this.timer = setTimeout(() => this.close(), this.duration * 1000);\n }\n\n private stop(): void {\n if (this.timer) clearTimeout(this.timer);\n this.timer = undefined;\n }\n\n private close(): void {\n this.stop();\n if (!this.open) return;\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n private action(): void {\n this.dispatchEvent(new CustomEvent('impakt-action', { bubbles: true, composed: true }));\n this.close();\n }\n\n render(): TemplateResult {\n return html`<div class=\"region\" role=\"status\" aria-live=\"polite\">\n ${\n this.open\n ? html`<div class=\"toast\" part=\"toast\" @mouseenter=${this.stop} @mouseleave=${this.start} @focusin=${this.stop} @focusout=${this.start}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n }\n }}>\n <span class=\"mark\">${iconSvg(TOAST_ICON[this.tone] ?? 'info', '20px')}</span>\n <p class=\"message\">${this.message}</p>\n ${this.actionText ? html`<button class=\"action\" type=\"button\" @click=${this.action}>${this.actionText}</button>` : nothing}\n <button class=\"close\" type=\"button\" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg('close', '16px')}</button>\n </div>`\n : nothing\n }\n </div>`;\n }\n}\n\nexport interface MenuItem {\n id?: string;\n text: string;\n /** Where it goes. Without one it fires impakt-select with its value. */\n href?: string;\n value?: string;\n icon?: string;\n tone?: '' | 'danger';\n}\n\n/**\n * A button that opens a short list of actions or links.\n *\n * It follows the ARIA menu button pattern: the arrow keys, Home and End move\n * through it, a letter moves to the next item that starts with it, Escape\n * closes it and puts focus back on the button, and a click anywhere else closes\n * it. A list that would run off the side of the screen opens towards the other\n * edge instead, so it never makes a phone scroll sideways.\n *\n * **The button can hold your own content.** Put an avatar and a name in the\n * `trigger` slot for an account menu; they replace the icon and label, and\n * become the button's accessible name, so include the words. Put who is signed\n * in, or any other note, in the `header` slot; it sits above the items and\n * outside the menu, so the arrow keys still move through the items alone.\n *\n * @category navigation\n * @icon menu\n * @slot trigger - What the button shows, in place of the icon and label.\n * @slot header - A note above the items, such as the name and email of who is signed in.\n * @csspart trigger - The button.\n * @csspart chevron - The arrow on the button.\n * @csspart panel - The box that opens, holding the header and the items.\n * @csspart header - The box round the header slot.\n * @csspart list - The list of items.\n * @fires {CustomEvent<{ value: string }>} impakt-select - When an item without an address is chosen. The value is in detail.value.\n */\nexport class ImpaktMenu extends ImpaktElement {\n static properties = {\n label: { type: String },\n icon: { type: String },\n items: { type: Array },\n edge: { type: String, reflect: true },\n open: { type: Boolean, reflect: true },\n };\n declare label: string;\n declare icon: string;\n declare items: MenuItem[];\n /** Which edge of the button the list lines up with. */\n declare edge: 'start' | 'end';\n declare open: boolean;\n\n constructor() {\n super();\n this.label = 'Menu';\n this.icon = '';\n this.items = [];\n this.edge = 'start';\n this.open = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.trigger, .item'),\n css`\n :host { position: relative; display: inline-block; }\n .trigger { ${targetSize} display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(2)} ${space(3.5)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('semibold')}; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: ${t.shadowXs}; cursor: pointer; }\n .trigger:hover { background: ${t.surfaceSubtle}; }\n .chev { display: inline-flex; color: ${t.textMuted}; transition: transform 120ms ease-in-out; }\n :host([open]) .chev { transform: rotate(180deg); }\n .panel { position: absolute; z-index: 100; inset-block-start: calc(100% + ${space(1.5)}); inset-inline-start: 0; box-sizing: border-box; min-inline-size: 13rem; max-inline-size: min(20rem, 90vw); padding: ${space(1.5)}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowLg}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: pop 120ms ease-out; }\n .list { margin: 0; padding: 0; list-style: none; }\n .header { padding: ${space(2)} ${space(2.5)} ${space(2.5)}; margin-block-end: ${space(1.5)}; border-block-end: ${t.borderThin} solid ${t.border}; ${type('sm')} color: ${t.textMuted}; overflow-wrap: anywhere; }\n :host([edge='end']) .panel, .panel.flip-end { inset-inline: auto 0; }\n :host([edge='end']) .panel.flip-start { inset-inline: 0 auto; }\n @keyframes pop { from { opacity: 0; transform: translateY(-${space(1)}); } }\n .item { ${targetSize} box-sizing: border-box; display: flex; align-items: center; gap: ${space(2.5)}; inline-size: 100%; padding: ${space(2)} ${space(2.5)}; font: inherit; ${type('sm')} text-align: start; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .item:hover, .item:focus { background: ${t.surfaceSubtle}; }\n .item.danger { color: ${t.dangerText}; }\n .item svg { flex: none; }\n `,\n ];\n\n private outside = (event: Event): void => {\n if (!event.composedPath().includes(this)) this.toggle(false);\n };\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('click', this.outside);\n }\n\n private get entries(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll<HTMLElement>('.item'));\n }\n\n private get trigger(): HTMLElement | null {\n return this.renderRoot.querySelector('.trigger');\n }\n\n private toggle(open: boolean, focus?: 'first' | 'last'): void {\n this.open = open;\n if (open) {\n document.addEventListener('click', this.outside);\n void this.updateComplete.then(() => {\n this.keepOnScreen();\n this.entries[focus === 'last' ? this.entries.length - 1 : 0]?.focus();\n });\n } else document.removeEventListener('click', this.outside);\n }\n\n /** Open towards the other edge when the list would run off the screen. */\n private keepOnScreen(): void {\n const list = this.renderRoot.querySelector<HTMLElement>('.panel');\n if (!list) return;\n list.classList.remove('flip-start', 'flip-end');\n const box = list.getBoundingClientRect();\n const width = document.documentElement.clientWidth;\n if (box.right > width - 8) list.classList.add('flip-end');\n else if (box.left < 8) list.classList.add('flip-start');\n }\n\n private triggerKey(event: KeyboardEvent): void {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n this.toggle(true, event.key === 'ArrowUp' ? 'last' : 'first');\n }\n }\n\n private listKey(event: KeyboardEvent): void {\n const entries = this.entries;\n const at = entries.indexOf((this.renderRoot as ShadowRoot).activeElement as HTMLElement);\n const go: Record<string, number> = {\n ArrowDown: (at + 1) % entries.length,\n ArrowUp: (at - 1 + entries.length) % entries.length,\n Home: 0,\n End: entries.length - 1,\n };\n if (event.key in go) {\n event.preventDefault();\n entries[go[event.key]!]?.focus();\n } else if (event.key.length === 1 && /\\S/.test(event.key) && !event.ctrlKey && !event.metaKey && !event.altKey) {\n const letter = event.key.toLowerCase();\n const next = [...entries.slice(at + 1), ...entries.slice(0, at + 1)].find((e) => (e.textContent ?? '').trim().toLowerCase().startsWith(letter));\n next?.focus();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this.toggle(false);\n this.trigger?.focus();\n } else if (event.key === 'Tab') this.toggle(false);\n }\n\n private choose(item: MenuItem): void {\n this.toggle(false);\n this.trigger?.focus();\n if (!item.href) this.dispatchEvent(new CustomEvent('impakt-select', { detail: { value: item.value ?? item.text }, bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const inner = (item: MenuItem): TemplateResult => html`${iconSvg(item.icon, '18px')}<span>${item.text}</span>`;\n return html`<button class=\"trigger\" part=\"trigger\" type=\"button\" aria-haspopup=\"menu\" aria-expanded=${String(this.open)} aria-controls=${this.id_('list')}\n @click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}><slot name=\"trigger\">${iconSvg(this.icon, '18px')}${this.label}</slot><span class=\"chev\" part=\"chevron\">${iconSvg('chevron-down', '16px')}</span></button>\n ${\n this.open\n ? html`<div class=\"panel\" part=\"panel\">${\n this.querySelector(':scope > [slot=\"header\"]') ? html`<div class=\"header\" part=\"header\"><slot name=\"header\"></slot></div>` : nothing\n }<ul class=\"list\" part=\"list\" id=${this.id_('list')} role=\"menu\" aria-label=${this.label} @keydown=${this.listKey}>\n ${this.items.map(\n (item) =>\n html`<li role=\"none\">${\n item.href\n ? html`<a class=\"item ${item.tone === 'danger' ? 'danger' : ''}\" role=\"menuitem\" tabindex=\"-1\" href=${item.href} @click=${() => this.choose(item)}>${inner(item)}</a>`\n : html`<button class=\"item ${item.tone === 'danger' ? 'danger' : ''}\" role=\"menuitem\" tabindex=\"-1\" type=\"button\" @click=${() => this.choose(item)}>${inner(item)}</button>`\n }</li>`,\n )}\n </ul></div>`\n : nothing\n }`;\n }\n}\n\n/** Which page numbers to show: the ends and the neighbours, with gaps between. */\nexport function pageWindow(page: number, pages: number): Array<number | 'gap'> {\n const wanted = [...new Set([1, page - 1, page, page + 1, pages])].filter((n) => n >= 1 && n <= pages).sort((a, b) => a - b);\n return wanted.flatMap((n, i): Array<number | 'gap'> => {\n const previous = wanted[i - 1];\n if (previous === undefined || n === previous + 1) return [n];\n return n === previous + 2 ? [previous + 1, n] : ['gap', n];\n });\n}\n\n/**\n * Page numbers for a long list.\n *\n * Give it `href-pattern` and every number is a real link, with `{page}` swapped\n * for the number. Without one the numbers are buttons and it fires\n * `impakt-page`. On a narrow screen the numbers fold to \"Page 2 of 9\".\n *\n * @category navigation\n * @icon pagination\n * @fires {CustomEvent<{ page: number }>} impakt-page - When a page is chosen. The number is in detail.page.\n */\nexport class ImpaktPagination extends ImpaktElement {\n static properties = {\n page: { type: Number },\n pages: { type: Number },\n hrefPattern: { type: String, attribute: 'href-pattern' },\n label: { type: String },\n previousText: { type: String, attribute: 'previous-text' },\n nextText: { type: String, attribute: 'next-text' },\n };\n declare page: number;\n declare pages: number;\n declare hrefPattern: string;\n declare label: string;\n declare previousText: string;\n declare nextText: string;\n\n constructor() {\n super();\n this.page = 1;\n this.pages = 1;\n this.hrefPattern = '';\n this.label = 'Pages';\n this.previousText = 'Previous';\n this.nextText = 'Next';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.n, .step'),\n css`\n :host { display: block; container-type: inline-size; }\n nav { display: flex; align-items: center; justify-content: space-between; gap: ${space(2)}; }\n ul { display: flex; align-items: center; gap: ${space(1)}; margin: 0; padding: 0; list-style: none; }\n .n, .step { ${targetSize} box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: ${space(1.5)}; min-inline-size: 44px; padding: 0 ${space(2.5)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('medium')}; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radiusLg}; cursor: pointer; }\n .n:hover, .step:hover { background: ${t.surfaceSubtle}; }\n .n[aria-current] { color: ${t.onBrand}; background: ${t.brand}; font-weight: ${fontWeight('semibold')}; }\n .step[aria-disabled='true'] { color: ${t.textMuted}; opacity: 0.55; background: none; cursor: not-allowed; }\n .gap { color: ${t.textMuted}; padding: 0 ${space(1)}; }\n .count { display: none; ${type('sm')} color: ${t.textMuted}; }\n @container (max-width: 34rem) { ul { display: none; } .count { display: block; } }\n `,\n ];\n\n private go(page: number, event: Event): void {\n if (this.hrefPattern) return;\n event.preventDefault();\n this.page = page;\n this.dispatchEvent(new CustomEvent('impakt-page', { detail: { page }, bubbles: true, composed: true }));\n }\n\n private link(page: number, classes: string, content: unknown, label: string, current: boolean): TemplateResult {\n return this.hrefPattern\n ? html`<a class=${classes} href=${this.hrefPattern.replace('{page}', String(page))} aria-label=${label} aria-current=${current ? 'page' : nothing}>${content}</a>`\n : html`<button class=${classes} type=\"button\" aria-label=${label} aria-current=${current ? 'page' : nothing} @click=${(e: Event) => this.go(page, e)}>${content}</button>`;\n }\n\n private step(to: number, words: string, icon: string, off: boolean): TemplateResult {\n const content = icon === 'arrow-left' ? html`${iconSvg(icon, '16px')}${words}` : html`${words}${iconSvg(icon, '16px')}`;\n return off ? html`<span class=\"step\" aria-disabled=\"true\">${content}</span>` : this.link(to, 'step', content, words, false);\n }\n\n render(): TemplateResult {\n const page = Math.min(Math.max(this.page, 1), Math.max(this.pages, 1));\n return html`<nav aria-label=${this.label} part=\"nav\">\n ${this.step(page - 1, this.previousText, 'arrow-left', page <= 1)}\n <ul>${pageWindow(page, this.pages).map((n) => html`<li>${n === 'gap' ? html`<span class=\"gap\" aria-hidden=\"true\">\u2026</span>` : this.link(n, 'n', n, say('Page {page}', { page: n }), n === page)}</li>`)}</ul>\n <span class=\"count\">${say('Page {page} of {pages}', { page, pages: this.pages })}</span>\n ${this.step(page + 1, this.nextText, 'arrow-right', page >= this.pages)}\n </nav>`;\n }\n}\n\nconst initialsOf = (name: string): string => {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n return ((words[0]?.[0] ?? '') + (words.length > 1 ? words[words.length - 1]![0]! : '')).toUpperCase();\n};\n\n/**\n * A person's photo, or their initials when there is no photo or it fails.\n *\n * @category content\n * @icon avatar\n */\nexport class ImpaktAvatar extends ImpaktElement {\n static properties = {\n fullName: { type: String, attribute: 'full-name' },\n src: { type: String },\n size: { type: String, reflect: true },\n };\n declare fullName: string;\n declare src: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n\n private failed = false;\n\n constructor() {\n super();\n this.fullName = '';\n this.src = '';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { --size: 40px; display: inline-block; inline-size: var(--size); block-size: var(--size); vertical-align: middle; }\n :host([size='sm']) { --size: 32px; }\n :host([size='lg']) { --size: 56px; }\n :host([size='xl']) { --size: 80px; }\n .face { display: flex; align-items: center; justify-content: center; inline-size: 100%; block-size: 100%; overflow: hidden; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; font-size: calc(var(--size) * 0.38); font-weight: ${fontWeight('semibold')}; }\n img { inline-size: 100%; block-size: 100%; object-fit: cover; }\n `,\n ];\n\n willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('src')) this.failed = false;\n }\n\n render(): TemplateResult {\n if (this.src && !this.failed) {\n return html`<div class=\"face\"><img src=${this.src} alt=${this.fullName} @error=${() => {\n this.failed = true;\n this.requestUpdate();\n }} /></div>`;\n }\n return html`<div class=\"face\" role=\"img\" aria-label=${this.fullName || say('Person')}>${initialsOf(this.fullName) || iconSvg('user', '55%')}</div>`;\n }\n}\n\nexport interface AvatarItem {\n id?: string;\n name: string;\n src?: string;\n}\n\n/**\n * A few people overlapped in a row, with a count for the rest: the sales team,\n * the neighbours who have already moved in.\n *\n * @category content\n * @icon avatars\n */\nexport class ImpaktAvatarGroup extends ImpaktElement {\n static properties = {\n items: { type: Array },\n max: { type: Number },\n size: { type: String, reflect: true },\n moreLabel: { type: String, attribute: 'more-label' },\n };\n declare items: AvatarItem[];\n declare max: number;\n declare size: 'sm' | 'md' | 'lg';\n /** How the people left out are described to a screen reader, after the number. */\n declare moreLabel: string;\n\n constructor() {\n super();\n this.items = [];\n this.max = 4;\n this.size = 'md';\n this.moreLabel = 'more people';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n ul { display: flex; margin: 0; padding: 0; list-style: none; }\n li { margin-inline-start: -${space(2.5)}; border-radius: 50%; box-shadow: 0 0 0 2px ${t.surfaceCard}; line-height: 0; }\n li:first-child { margin-inline-start: 0; }\n .more { display: flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; ${type('xs')} line-height: 1; font-weight: ${fontWeight('semibold')}; color: ${t.text}; background: ${t.surfaceSubtle}; border-radius: 50%; }\n :host([size='sm']) .more { inline-size: 32px; block-size: 32px; }\n :host([size='lg']) .more { inline-size: 56px; block-size: 56px; }\n .sr { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const shown = this.items.slice(0, this.max);\n const rest = this.items.length - shown.length;\n return html`<ul part=\"list\">\n ${shown.map((item) => html`<li><impakt-avatar full-name=${item.name} src=${item.src ?? ''} size=${this.size}></impakt-avatar></li>`)}\n ${rest > 0 ? html`<li><span class=\"more\"><span aria-hidden=\"true\">+${rest}</span><span class=\"sr\">${rest} ${this.moreLabel}</span></span></li>` : nothing}\n </ul>`;\n }\n}\n\n/**\n * What a list says when it has nothing in it, and what to do about that.\n *\n * @category feedback\n * @icon empty\n * @role heading\n * @slot actions - The next thing to do, usually one button.\n */\nexport class ImpaktEmptyState extends ImpaktElement {\n static properties = {\n icon: { type: String },\n heading: { type: String },\n lead: { type: String },\n framed: { type: Boolean, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare icon: string;\n declare heading: string;\n declare lead: string;\n /** Draws a dashed outline round it. */\n declare framed: boolean;\n declare headingLevel: 2 | 3 | 4;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.icon = 'search';\n this.heading = '';\n this.lead = '';\n this.framed = false;\n this.headingLevel = 2;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n .wrap { display: flex; flex-direction: column; align-items: center; gap: ${space(2)}; padding: ${space(12)} ${space(6)}; text-align: center; }\n :host([framed]) .wrap { border: ${t.borderThin} dashed ${t.border}; border-radius: ${t.radiusXl}; }\n .mark { display: inline-flex; align-items: center; justify-content: center; inline-size: 56px; block-size: 56px; margin-block-end: ${space(2)}; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; }\n .h { margin: 0; font-family: ${t.fontHeading}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n p { margin: 0; max-inline-size: 42ch; color: ${t.textMuted}; text-wrap: pretty; }\n .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: ${space(3)}; margin-block-start: ${space(3)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<div class=\"wrap\" part=\"wrap\">\n <span class=\"mark\">${iconSvg(this.icon, '26px')}</span>\n ${this.heading ? html`<div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}\n ${this.lead ? html`<p>${this.lead}</p>` : nothing}\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>`;\n }\n}\n\nexport interface SlotDay {\n id?: string;\n /** The day, as 2026-11-14. */\n date: string;\n /** The times on offer, separated by commas: 10:00, 11:30, 14:00. */\n times: string;\n}\n\nconst timesOf = (day: SlotDay | undefined): string[] =>\n String(day?.times ?? '')\n .split(',')\n .map((time) => time.trim())\n .filter(Boolean);\n\n/** A day's parts in the page's language. A date that cannot be read is shown as it was written. */\nfunction dayParts(date: string): { weekday: string; day: string; month: string } {\n const parsed = new Date(`${date}T00:00:00Z`);\n if (Number.isNaN(parsed.getTime())) return { weekday: '', day: date, month: '' };\n const locale = pageLocale();\n const part = (options: Intl.DateTimeFormatOptions): string => new Intl.DateTimeFormat(locale, { timeZone: 'UTC', ...options }).format(parsed);\n return { weekday: part({ weekday: 'short' }), day: part({ day: 'numeric' }), month: part({ month: 'short' }) };\n}\n\n/**\n * Choose a day, then a time: a viewing, a call back, a site visit.\n *\n * Both rows are native radios under the styling, so the arrow keys and screen\n * readers work as they do for any radio group. Its value is the day and time\n * together, as 2026-11-14T10:00.\n *\n * @category form\n * @icon calendar\n */\nexport class ImpaktSlotPicker extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n days: { type: Array },\n dayLabel: { type: String, attribute: 'day-label' },\n timeLabel: { type: String, attribute: 'time-label' },\n emptyText: { type: String, attribute: 'empty-text' },\n };\n declare days: SlotDay[];\n declare dayLabel: string;\n declare timeLabel: string;\n /** What is said when no times are on offer. */\n declare emptyText: string;\n\n private day = '';\n\n constructor() {\n super();\n this.days = [];\n this.dayLabel = 'Day';\n this.timeLabel = 'Time';\n this.emptyText = 'No times are available at the moment.';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }\n legend { padding: 0; }\n .row-label { ${type('sm')} color: ${t.textMuted}; margin-block: ${space(2)}; }\n .days { display: flex; gap: ${space(2)}; overflow-x: auto; padding: ${space(1)}; margin: -${space(1)}; scrollbar-width: thin; }\n .times { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: ${space(2)}; }\n label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; min-block-size: 44px; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusLg}; box-shadow: inset 0 0 0 1px ${t.border}; cursor: pointer; transition: background-color 120ms ease-in-out; }\n label:hover { background: ${t.surfaceSubtle}; }\n label:has(input:checked) { color: ${t.onBrand}; background: ${t.brand}; box-shadow: none; }\n label:has(input:focus-visible) { box-shadow: ${t.focusShadow}; }\n input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }\n .day { flex: none; inline-size: 4.5rem; padding-block: ${space(2.5)}; }\n .weekday, .month { ${type('xs')} }\n .num { ${type('xl')} font-weight: ${fontWeight('semibold')}; }\n .time { padding: ${space(2)}; ${type('sm')} font-weight: ${fontWeight('medium')}; }\n .empty { margin: 0; color: ${t.textMuted}; }\n :host([invalid]) .days label, :host([invalid]) .times label { box-shadow: inset 0 0 0 1px ${t.danger}; }\n `,\n ];\n\n private get currentDay(): SlotDay | undefined {\n const wanted = this.day || this.value.split('T')[0];\n return this.days.find((day) => day.date === wanted) ?? this.days[0];\n }\n\n private chooseDay(date: string): void {\n this.day = date;\n if (this.value && !this.value.startsWith(`${date}T`)) this.setFormValue('');\n this.requestUpdate();\n }\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}</legend>`;\n }\n\n protected renderControl(): TemplateResult {\n const current = this.currentDay;\n if (!current) return html`<p class=\"empty\">${this.emptyText}</p>`;\n return html`\n <div class=\"row-label\" id=${this.id_('days')}>${this.dayLabel}</div>\n <div class=\"days\" part=\"days\" role=\"radiogroup\" aria-labelledby=${this.id_('days')}>\n ${this.days.map((day) => {\n const parts = dayParts(day.date);\n return html`<label class=\"day\"><input type=\"radio\" name=${`${this.uid}-day`} .checked=${day.date === current.date} ?disabled=${this.disabled} @change=${() => this.chooseDay(day.date)} />\n <span class=\"weekday\">${parts.weekday}</span><span class=\"num\">${parts.day}</span><span class=\"month\">${parts.month}</span></label>`;\n })}\n </div>\n <div class=\"row-label\" id=${this.id_('times')}>${this.timeLabel}</div>\n <div class=\"times\" part=\"times\" role=\"radiogroup\" aria-labelledby=${this.id_('times')}>\n ${timesOf(current).map((time, i) => {\n const value = `${current.date}T${time}`;\n return html`<label class=\"time\"><input type=\"radio\" name=${`${this.uid}-time`} .checked=${this.value === value} ?required=${this.required && i === 0} ?disabled=${this.disabled} @change=${() => this.setFormValue(value)} />${time}</label>`;\n })}\n </div>`;\n }\n\n render(): TemplateResult {\n return html`<fieldset part=\"fieldset\" ?disabled=${this.disabled} aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-drawer', ImpaktDrawer);\ncustomElements.define('impakt-toast', ImpaktToast);\ncustomElements.define('impakt-menu', ImpaktMenu);\ncustomElements.define('impakt-pagination', ImpaktPagination);\ncustomElements.define('impakt-avatar', ImpaktAvatar);\ncustomElements.define('impakt-avatar-group', ImpaktAvatarGroup);\ncustomElements.define('impakt-empty-state', ImpaktEmptyState);\ncustomElements.define('impakt-slot-picker', ImpaktSlotPicker);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-drawer': ImpaktDrawer;\n 'impakt-toast': ImpaktToast;\n 'impakt-menu': ImpaktMenu;\n 'impakt-pagination': ImpaktPagination;\n 'impakt-avatar': ImpaktAvatar;\n 'impakt-avatar-group': ImpaktAvatarGroup;\n 'impakt-empty-state': ImpaktEmptyState;\n 'impakt-slot-picker': ImpaktSlotPicker;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, spaceAround, t, type } from '../base/tokens';\n\n/** One address a postcode search found. */\nexport interface AddressItem {\n id: string;\n /** The address on one line, as the customer will recognise it. */\n line: string;\n}\n\n/** One mistake on the page, and the field it is about. */\nexport interface ErrorItem {\n id: string;\n text: string;\n /** The field to go to, such as `#postcode`. */\n href: string;\n}\n\n/** One part of a long application. */\nexport interface TaskItem {\n id: string;\n title: string;\n /** Where the part is filled in. Left out while it cannot be started. */\n href?: string;\n status: 'done' | 'in-progress' | 'not-started' | 'cannot-start';\n /** A line under the title, such as how long it takes. */\n hint?: string;\n}\n\nconst inputStyles = css`\n input, select {\n box-sizing: border-box;\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font: inherit;\n /* 16px whatever the page around it sets, so a phone does not zoom in on focus. */\n font-size: max(${fontSize('md')}, 16px);\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n }\n input:focus-visible, select:focus-visible { border-color: ${t.brand}; box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo}; outline: none; }\n :host([invalid]) input, :host([invalid]) select { border-color: ${t.danger}; border-width: ${t.borderThick}; }\n .btn {\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(4)};\n font: inherit;\n font-weight: ${fontWeight('semibold')};\n color: ${t.onBrand};\n background: ${t.brand};\n border: 0;\n border-radius: ${t.radiusLg};\n cursor: pointer;\n }\n .btn:hover { background: ${t.brandHover}; }\n .quiet { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; padding: 0; font: inherit; color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; background: none; border: 0; cursor: pointer; }\n .visually-hidden { ${visuallyHidden} }\n`;\n\n/**\n * Find an address from a postcode, then pick it from a list.\n *\n * The addresses come from the app. With `lookup-url` set, the component asks\n * that address itself (`?postcode=\u2026`, answering `[{ id, line }]`); otherwise\n * it fires `impakt-lookup` with the postcode and the app sets `addresses`.\n * There is always a way to type the address in, because no list is complete.\n *\n * @fires {CustomEvent<{ postcode: string }>} impakt-lookup - When a postcode is searched for. The postcode is in detail.postcode.\n * @category form\n * @icon home\n */\nexport class ImpaktAddressLookup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n postcodeLabel: { type: String, attribute: 'postcode-label' },\n findText: { type: String, attribute: 'find-text' },\n chooseLabel: { type: String, attribute: 'choose-label' },\n manualText: { type: String, attribute: 'manual-text' },\n notFoundText: { type: String, attribute: 'not-found-text' },\n lookupUrl: { type: String, attribute: 'lookup-url' },\n addresses: { type: Array },\n };\n declare postcodeLabel: string;\n declare findText: string;\n declare chooseLabel: string;\n declare manualText: string;\n declare notFoundText: string;\n /** An address that returns `[{ id, line }]` for `?postcode=`. Optional. */\n declare lookupUrl: string;\n declare addresses: AddressItem[];\n declare manual: boolean;\n declare postcode: string;\n declare searched: boolean;\n declare busy: boolean;\n\n constructor() {\n super();\n this.label = 'Your address';\n this.postcodeLabel = 'Postcode';\n this.findText = 'Find address';\n this.chooseLabel = 'Choose your address';\n this.manualText = 'Enter the address yourself';\n this.notFoundText = 'No addresses found for that postcode. Check it, or enter the address yourself.';\n this.lookupUrl = '';\n this.addresses = [];\n this.manual = false;\n this.postcode = '';\n this.searched = false;\n this.busy = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n inputStyles,\n css`\n .row { display: flex; flex-wrap: wrap; gap: ${space(2)}; align-items: flex-end; }\n .row label { display: block; ${type('sm')} font-weight: ${fontWeight('semibold')}; margin-block-end: ${space(1)}; }\n .postcode input { inline-size: 12ch; text-transform: uppercase; }\n .choose { margin-block-start: ${space(4)}; }\n .choose select { inline-size: 100%; }\n .manual { display: grid; gap: ${space(3)}; margin-block-start: ${space(3)}; }\n .manual label { display: block; ${type('sm')} margin-block-end: ${space(1)}; }\n .manual input { inline-size: 100%; }\n .note { ${type('sm')} color: ${t.textMuted}; margin: ${space(2)} 0 0; }\n .switch { margin-block-start: ${space(3)}; }\n `,\n ];\n\n private async find(): Promise<void> {\n const postcode = this.postcode.trim().toUpperCase();\n if (!postcode) return;\n this.dispatchEvent(new CustomEvent('impakt-lookup', { detail: { postcode }, bubbles: true, composed: true }));\n if (!this.lookupUrl) {\n this.searched = true;\n return;\n }\n this.busy = true;\n try {\n const url = new URL(this.lookupUrl, globalThis.location?.href);\n url.searchParams.set('postcode', postcode);\n const found = await (await fetch(url)).json();\n this.addresses = Array.isArray(found) ? found : [];\n } catch {\n this.addresses = [];\n } finally {\n this.busy = false;\n this.searched = true;\n }\n }\n\n private manualLine(): string {\n const parts = ['line1', 'line2', 'town', 'mpostcode'].map((p) => (this.renderRoot.querySelector<HTMLInputElement>(`#${this.id_(p)}`)?.value ?? '').trim());\n return parts.filter(Boolean).join(', ');\n }\n\n protected renderControl(): TemplateResult {\n if (this.manual) {\n const field = (key: string, label: string, autocomplete: string) =>\n html`<div><label for=${this.id_(key)}>${label}</label><input id=${this.id_(key)} autocomplete=${autocomplete} @input=${() => this.setFormValue(this.manualLine())} /></div>`;\n return html`<div class=\"manual\" role=\"group\" aria-label=${this.label}>\n ${field('line1', say('Building and street'), 'address-line1')}\n ${field('line2', say('Second line (optional)'), 'address-line2')}\n ${field('town', say('Town or city'), 'address-level2')}\n ${field('mpostcode', say('Postcode'), 'postal-code')}\n <button class=\"quiet switch\" type=\"button\" @click=${() => {\n this.manual = false;\n }}>${say('Find the address from the postcode')}</button>\n </div>`;\n }\n return html`\n <div class=\"row\">\n <div class=\"postcode\"><label for=${this.controlId}>${this.postcodeLabel}</label>\n <input id=${this.controlId} autocomplete=\"postal-code\" .value=${this.postcode} aria-describedby=${this.describedBy}\n @input=${(e: Event) => {\n this.postcode = (e.target as HTMLInputElement).value;\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n void this.find();\n }\n }} /></div>\n <button class=\"btn\" type=\"button\" ?disabled=${this.busy} @click=${() => this.find()}>${this.busy ? 'Finding\u2026' : this.findText}</button>\n </div>\n ${\n this.addresses.length\n ? html`<div class=\"choose\"><label class=\"label\" for=${this.id_('choose')}>${this.chooseLabel}</label>\n <select id=${this.id_('choose')} @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}>\n <option value=\"\">${this.addresses.length} ${this.addresses.length === 1 ? 'address' : 'addresses'} found</option>\n ${this.addresses.map((a) => html`<option value=${a.line} ?selected=${a.line === this.value}>${a.line}</option>`)}\n </select></div>`\n : this.searched && !this.busy\n ? html`<p class=\"note\" role=\"status\">${this.notFoundText}</p>`\n : nothing\n }\n <button class=\"quiet switch\" type=\"button\" @click=${() => {\n this.manual = true;\n }}>${this.manualText}</button>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Every mistake on the page, listed at the top, each linking to its field.\n *\n * It takes focus when it appears, so someone using a screen reader hears what\n * is wrong straight away rather than finding out field by field. It draws\n * nothing while there are no mistakes. Each link moves focus to its field, which\n * may be a field inside another component, such as `#postcode` for an\n * `impakt-text-input` with that id.\n *\n * @category feedback\n * @icon alert\n */\nexport class ImpaktErrorSummary extends ImpaktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: ErrorItem[];\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.heading = 'There is a problem';\n this.items = [];\n this.spaceAbove = 'none';\n this.spaceBelow = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n spaceAround,\n touchTarget('a'),\n css`\n :host { display: block; }\n .box { padding: ${space(5)}; border: ${t.borderThick} solid ${t.danger}; border-inline-start-width: 6px; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .box:focus { outline: 3px solid ${t.danger}; outline-offset: 2px; }\n h2 { margin: 0 0 ${space(3)}; ${type('lg')} font-weight: ${fontWeight('bold')}; color: ${t.text}; }\n ul { margin: 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.dangerText}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n `,\n ];\n\n private go(event: Event, href: string): void {\n const id = href.replace(/^#/, '');\n const root = this.getRootNode() as Document | ShadowRoot;\n const target = (root.querySelector?.(`#${CSS.escape(id)}`) ?? document.getElementById(id)) as HTMLElement | null;\n if (!target) return;\n event.preventDefault();\n target.scrollIntoView({ block: 'center' });\n (target as HTMLElement & { focus: () => void }).focus();\n }\n\n updated(changed: Map<string, unknown>): void {\n const before = changed.get('items') as ErrorItem[] | undefined;\n if (changed.has('items') && this.items.length && !before?.length) this.renderRoot.querySelector<HTMLElement>('.box')?.focus();\n }\n\n render(): TemplateResult | typeof nothing {\n if (!this.items.length) return nothing;\n return html`<div class=\"box\" role=\"alert\" tabindex=\"-1\" aria-labelledby=${this.id_('h')} part=\"box\">\n <h2 id=${this.id_('h')}>${this.heading}</h2>\n <ul>${this.items.map((i) => html`<li><a href=${i.href} @click=${(e: Event) => this.go(e, i.href)}>${i.text}</a></li>`)}</ul>\n </div>`;\n }\n}\n\nconst fileSize = (bytes: number) =>\n bytes >= 1048576 ? say('{size} MB', { size: (bytes / 1048576).toFixed(1) }) : say('{size} KB', { size: Math.max(1, Math.round(bytes / 1024)) });\n\n/**\n * Add one or more files, such as proof of identity or photos for a claim.\n *\n * A file can be chosen or dropped on the box. Each one is checked for type and\n * size here and listed with a Remove button; the upload itself is the app's,\n * which gets the files on `impakt-files`. The answer is the file names.\n *\n * The file input itself takes focus, so Tab reaches it and Enter or Space opens\n * the file chooser; the visible button is its label and draws its focus ring.\n * A file that is added or removed is said to a screen reader, and a file that\n * does not fit marks the box and says why.\n *\n * @fires {CustomEvent<{ files: File[] }>} impakt-files - When the files change. The files are in detail.files.\n *\n * @category form\n * @icon upload\n */\nexport class ImpaktFileUpload extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n accept: { type: String },\n manyFiles: { type: Boolean, attribute: 'many-files' },\n maxSizeMb: { type: Number, attribute: 'max-size-mb' },\n chooseText: { type: String, attribute: 'choose-text' },\n dropText: { type: String, attribute: 'drop-text' },\n };\n /** File types allowed, such as `.pdf,.jpg,.png`. Empty allows any. */\n declare accept: string;\n /** Let more than one file be added. */\n declare manyFiles: boolean;\n declare maxSizeMb: number;\n declare chooseText: string;\n declare dropText: string;\n declare files: File[];\n declare over: boolean;\n declare protected said: string;\n\n constructor() {\n super();\n this.label = 'Upload a file';\n this.accept = '.pdf,.jpg,.jpeg,.png';\n this.manyFiles = false;\n this.maxSizeMb = 10;\n this.chooseText = 'Choose file';\n this.dropText = 'or drop it here';\n this.files = [];\n this.over = false;\n this.said = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n inputStyles,\n targetSize,\n touchTarget('label.btn, .quiet'),\n css`\n .zone { display: flex; flex-wrap: wrap; align-items: center; gap: ${space(3)}; padding: ${space(5)}; border: 2px dashed ${t.border}; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .zone.over { border-color: ${t.brand}; background: ${t.brandSubtle}; }\n :host([invalid]) .zone { border-color: ${t.danger}; border-style: solid; }\n :host([disabled]) label.btn { cursor: not-allowed; }\n .drop { color: ${t.textMuted}; }\n input[type='file'] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }\n label.btn { display: inline-flex; align-items: center; }\n input[type='file']:focus-visible + label.btn { box-shadow: ${t.focusShadow}; }\n ul { margin: ${space(3)} 0 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n li { display: flex; justify-content: space-between; gap: ${space(3)}; align-items: center; padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: ${t.surfaceInset}; }\n .size { color: ${t.textMuted}; ${type('sm')} }\n `,\n ];\n\n private fits(file: File): string | null {\n if (this.maxSizeMb && file.size > this.maxSizeMb * 1048576) return say('{file} is bigger than {size} MB', { file: file.name, size: this.maxSizeMb });\n const kinds = this.accept\n .split(',')\n .map((k) => k.trim().toLowerCase())\n .filter(Boolean);\n if (\n kinds.length &&\n !kinds.some((k) =>\n k.startsWith('.') ? file.name.toLowerCase().endsWith(k) : file.type === k || (k.endsWith('/*') && file.type.startsWith(k.slice(0, -1))),\n )\n ) {\n return say('{file} must be {kinds}', { file: file.name, kinds: kinds.map((k) => k.replace('.', '').toUpperCase()).join(', ') });\n }\n return null;\n }\n\n /** Adds files, keeping only those that pass, and says why any did not. */\n add(list: FileList | File[]): void {\n const chosen = Array.from(list);\n const problems = chosen.map((f) => this.fits(f)).filter((p): p is string => Boolean(p));\n const good = chosen.filter((f) => !this.fits(f));\n const kept = this.manyFiles ? good : good.slice(0, 1);\n this.files = this.manyFiles ? [...this.files, ...good] : kept.length ? kept : this.files;\n this.error = problems.join('. ');\n this.said = kept.map((f) => say('{file} added', { file: f.name })).join('. ');\n this.sync();\n }\n\n private removeFile(index: number): void {\n const gone = this.files[index];\n this.files = this.files.filter((_, i) => i !== index);\n this.said = gone ? say('{file} removed', { file: gone.name }) : '';\n this.sync();\n // The button that was pressed has gone, so focus goes back to the file input rather than to the top of the page.\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>('input[type=\"file\"]')?.focus());\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n\n private sync(): void {\n this.setFormValue(this.files.map((f) => f.name).join(', '));\n this.dispatchEvent(new CustomEvent('impakt-files', { detail: { files: this.files }, bubbles: true, composed: true }));\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"zone ${this.over ? 'over' : ''}\"\n @dragover=${(e: DragEvent) => {\n e.preventDefault();\n this.over = true;\n }}\n @dragleave=${() => {\n this.over = false;\n }}\n @drop=${(e: DragEvent) => {\n e.preventDefault();\n this.over = false;\n if (e.dataTransfer?.files) this.add(e.dataTransfer.files);\n }}>\n <input id=${this.controlId} type=\"file\" accept=${this.accept || nothing} ?multiple=${this.manyFiles} ?disabled=${this.disabled} ?required=${this.required} aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n const f = (e.target as HTMLInputElement).files;\n if (f) this.add(f);\n (e.target as HTMLInputElement).value = '';\n }} />\n <label class=\"btn\" for=${this.controlId}>${this.chooseText}</label>\n <span class=\"drop\">${this.dropText}</span>\n </div>\n <p class=\"visually-hidden\" role=\"status\">${this.said}</p>\n ${this.files.length ? html`<ul aria-label=${say('Files added')}>${this.files.map((f, i) => html`<li><span>${f.name} <span class=\"size\">${fileSize(f.size)}</span></span><button class=\"quiet\" type=\"button\" @click=${() => this.removeFile(i)}>${say('Remove')}<span class=\"visually-hidden\"> ${f.name}</span></button></li>`)}</ul>` : nothing}\n `;\n }\n}\n\n/** The currency's symbol, such as \u00A3 for GBP. */\nfunction symbolOf(currency: string): string {\n try {\n return (\n new Intl.NumberFormat(pageLocale(), { style: 'currency', currency, maximumFractionDigits: 0 }).formatToParts(0).find((p) => p.type === 'currency')\n ?.value ?? ''\n );\n } catch {\n return '';\n }\n}\n\n/** \"250000\" \u2192 \"250,000\". Anything not a number is left as typed. */\nexport function groupDigits(value: string): string {\n const digits = value.replace(/[^\\d.]/g, '');\n if (!digits) return '';\n const [whole, part] = digits.split('.');\n return `${Number(whole).toLocaleString('en-GB')}${part !== undefined ? `.${part.slice(0, 2)}` : ''}`;\n}\n\n/**\n * An amount of money, with the currency sign in front and commas as it is\n * read back, so \u00A3250,000 is not mistaken for \u00A325,000.\n *\n * The answer is the plain number, such as `250000`.\n *\n * @category form\n * @icon pound\n */\nexport class ImpaktMoneyInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n currency: { type: String },\n lowest: { type: Number },\n highest: { type: Number },\n pence: { type: Boolean },\n width: { type: String, reflect: true },\n };\n declare currency: string;\n declare lowest: number | undefined;\n declare highest: number | undefined;\n /** Allow pence. Off for amounts like a house price. */\n declare pence: boolean;\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n declare shown: string;\n\n constructor() {\n super();\n this.currency = 'GBP';\n this.lowest = undefined;\n this.highest = undefined;\n this.pence = false;\n this.width = 'md';\n this.shown = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n inputStyles,\n css`\n .wrap { display: flex; align-items: stretch; inline-size: min(100%, var(--impakt-field-width)); }\n .sign { display: flex; align-items: center; padding: 0 ${space(3)}; font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; border: ${t.borderThin} solid ${t.border}; border-inline-end: 0; border-radius: ${t.radiusLg} 0 0 ${t.radiusLg}; }\n .wrap input { inline-size: 100%; border-radius: 0 ${t.radiusLg} ${t.radiusLg} 0; }\n `,\n ];\n\n willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('value') && this.value !== this.shown.replace(/,/g, '')) this.shown = groupDigits(this.value);\n }\n\n private typed(raw: string): void {\n const clean = raw.replace(/[^\\d.]/g, '');\n const value = this.pence ? clean : clean.split('.')[0]!;\n this.shown = raw;\n this.setFormValue(value);\n }\n\n private check(): void {\n this.shown = groupDigits(this.value);\n const n = Number(this.value);\n if (!this.value) return;\n const money = (x: number) => `${symbolOf(this.currency)}${x.toLocaleString('en-GB')}`;\n if (this.lowest !== undefined && n < this.lowest) this.error = say('Enter an amount of {amount} or more', { amount: money(this.lowest) });\n else if (this.highest !== undefined && n > this.highest) this.error = say('Enter an amount of {amount} or less', { amount: money(this.highest) });\n else if (\n this.error === say('Enter an amount of {amount} or more', { amount: money(this.lowest ?? 0) }) ||\n this.error === say('Enter an amount of {amount} or less', { amount: money(this.highest ?? 0) })\n )\n this.error = '';\n }\n\n /** The currency sign describes the field too, so a screen reader hears that the amount is in pounds. */\n protected get describedBy(): string | typeof nothing {\n const ids = [symbolOf(this.currency) ? this.id_('sign') : '', super.describedBy === nothing ? '' : String(super.describedBy)].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n protected renderControl(): TemplateResult {\n return html`<div class=\"wrap\">\n <span class=\"sign\" id=${this.id_('sign')}>${symbolOf(this.currency)}</span>\n <input id=${this.controlId} inputmode=${this.pence ? 'decimal' : 'numeric'} .value=${this.shown} ?disabled=${this.disabled} ?readonly=${this.readonly} ?required=${this.required}\n aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.typed((e.target as HTMLInputElement).value)} @blur=${() => this.check()} />\n </div>`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Choose a number by sliding, with the value read out beside the label, such\n * as a deposit or how many years. It is a native range control, so arrow keys,\n * a finger and a screen reader all work.\n *\n * @category form\n * @icon sliders\n */\nexport class ImpaktRangeInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n lowest: { type: Number },\n highest: { type: Number },\n step: { type: Number },\n currency: { type: String },\n unit: { type: String },\n };\n declare lowest: number;\n declare highest: number;\n declare step: number;\n /** Show the value as money in this currency, such as GBP. Empty shows a plain number. */\n declare currency: string;\n /** A word after the value, such as `years`. */\n declare unit: string;\n\n constructor() {\n super();\n this.label = 'How much';\n this.lowest = 0;\n this.highest = 100;\n this.step = 1;\n this.currency = '';\n this.unit = '';\n this.value = '50';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n .top { display: flex; justify-content: space-between; gap: ${space(3)}; }\n output { font-weight: ${fontWeight('semibold')}; color: ${t.text}; }\n input { inline-size: 100%; min-block-size: 32px; margin: 0; accent-color: ${t.brand}; }\n .ends { display: flex; justify-content: space-between; ${type('sm')} color: ${t.textMuted}; }\n `,\n ];\n\n /** The value as the customer reads it, such as \u00A325,000 or 25 years. */\n shownAs(n: number): string {\n const locale = pageLocale(this);\n let s = n.toLocaleString(locale);\n if (this.currency) {\n try {\n s = new Intl.NumberFormat(locale, { style: 'currency', currency: this.currency, maximumFractionDigits: 0 }).format(n);\n } catch {\n /* keep the number */\n }\n }\n return this.unit ? `${s} ${this.unit}` : s;\n }\n\n render(): TemplateResult {\n const n = Number(this.value) || 0;\n return html`\n <div class=\"top\"><label class=\"label\" for=${this.controlId}>${this.label}${this.required ? html` <span class=\"required\">(${this.requiredText})</span>` : nothing}</label>\n <output for=${this.controlId}>${this.shownAs(n)}</output></div>\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')}>${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"ends\" aria-hidden=\"true\"><span>${this.shownAs(this.lowest)}</span><span>${this.shownAs(this.highest)}</span></div>\n <div class=\"error\" id=${this.id_('error')} aria-live=\"polite\">${this.error || nothing}</div>\n `;\n }\n\n protected renderControl(): TemplateResult {\n return html`<input id=${this.controlId} type=\"range\" min=${this.lowest} max=${this.highest} step=${this.step} .value=${this.value} ?disabled=${this.disabled}\n aria-valuetext=${this.shownAs(Number(this.value) || 0)} aria-describedby=${this.describedBy}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLInputElement).value)} />`;\n }\n}\n\nconst TASK_WORDS: Record<TaskItem['status'], string> = {\n done: 'Completed',\n 'in-progress': 'In progress',\n 'not-started': 'Not started',\n 'cannot-start': 'Cannot start yet',\n};\n\n/**\n * The parts of a long application, each with whether it is done, so someone\n * can leave and come back to where they were.\n *\n * @category content\n * @icon list\n */\nexport class ImpaktTaskList extends ImpaktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: TaskItem[];\n declare headingLevel: 2 | 3;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.heading = 'Your application';\n this.items = [];\n this.headingLevel = 2;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n spaceAround,\n touchTarget('a'),\n css`\n :host { display: block; }\n .h { margin: 0 0 ${space(2)}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n .count { margin: 0 0 ${space(4)}; color: ${t.textMuted}; }\n ul { margin: 0; padding: 0; list-style: none; border-block-start: 1px solid ${t.rule}; }\n li { display: flex; justify-content: space-between; align-items: center; gap: ${space(4)}; padding: ${space(4)} 0; border-block-end: 1px solid ${t.rule}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.link}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n .title { font-weight: ${fontWeight('semibold')}; }\n .hint { display: block; ${type('sm')} color: ${t.textMuted}; }\n .tag { flex-shrink: 0; padding: ${space(1)} ${space(2.5)}; border-radius: 999px; ${type('sm')} font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; color: ${t.text}; }\n .tag[data-status='done'] { background: ${t.successSubtle}; color: ${t.successText}; }\n .tag[data-status='in-progress'] { background: ${t.brandSubtle}; color: ${t.link}; }\n .tag[data-status='cannot-start'] { background: transparent; color: ${t.textMuted}; }\n `,\n ];\n\n render(): TemplateResult {\n const done = this.items.filter((i) => i.status === 'done').length;\n return html`\n ${this.heading ? html`<div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}\n ${this.items.length ? html`<p class=\"count\">${say(this.items.length === 1 ? 'You have completed {done} of {total} part.' : 'You have completed {done} of {total} parts.', { done, total: this.items.length })}</p>` : nothing}\n <ul>${this.items.map(\n (i) => html`<li>\n <span>${i.href && i.status !== 'cannot-start' ? html`<a href=${i.href} aria-describedby=${this.id_(`s-${i.id}`)}>${i.title}</a>` : html`<span class=\"title\">${i.title}</span>`}\n ${i.hint ? html`<span class=\"hint\">${i.hint}</span>` : nothing}</span>\n <span class=\"tag\" data-status=${i.status} id=${this.id_(`s-${i.id}`)}>${TASK_WORDS[i.status] ? say(TASK_WORDS[i.status]) : i.status}</span>\n </li>`,\n )}</ul>`;\n }\n}\n\n// Working values, not settings: kept out of `properties` so the page designer does not offer them.\nImpaktAddressLookup.createProperty('manual', { state: true });\nImpaktAddressLookup.createProperty('postcode', { state: true });\nImpaktAddressLookup.createProperty('searched', { state: true });\nImpaktAddressLookup.createProperty('busy', { state: true });\nImpaktFileUpload.createProperty('files', { state: true });\nImpaktFileUpload.createProperty('over', { state: true });\nImpaktFileUpload.createProperty('said', { state: true });\nImpaktMoneyInput.createProperty('shown', { state: true });\n\ncustomElements.define('impakt-address-lookup', ImpaktAddressLookup);\ncustomElements.define('impakt-error-summary', ImpaktErrorSummary);\ncustomElements.define('impakt-file-upload', ImpaktFileUpload);\ncustomElements.define('impakt-money-input', ImpaktMoneyInput);\ncustomElements.define('impakt-range-input', ImpaktRangeInput);\ncustomElements.define('impakt-task-list', ImpaktTaskList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-address-lookup': ImpaktAddressLookup;\n 'impakt-error-summary': ImpaktErrorSummary;\n 'impakt-file-upload': ImpaktFileUpload;\n 'impakt-money-input': ImpaktMoneyInput;\n 'impakt-range-input': ImpaktRangeInput;\n 'impakt-task-list': ImpaktTaskList;\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets: boolean =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap<TemplateStringsArray, CSSStyleSheet>();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic the native feature](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array<CSSResultOrNative>\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n }\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n/**\n * Removes the `readonly` modifier from properties in the union K.\n *\n * This is a safer way to cast a value to a type with a mutable version of a\n * readonly field, than casting to an interface with the field re-declared\n * because it preserves the type of all the fields and warns on typos.\n */\ntype Mutable<T, K extends keyof T> = Omit<T, K> & {\n -readonly [P in keyof Pick<T, K>]: P extends K ? T[P] : never;\n};\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst {\n is,\n defineProperty,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n getPrototypeOf,\n} = Object;\n\nconst NODE_MODE = false;\n\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\n\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n });\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<ReactiveUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n | ComplexAttributeConverter<Type>\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n\n /**\n * Whether this property is wrapping accessors. This is set by `@property`\n * to control the initial value change and reflection logic.\n *\n * @internal\n */\n wrapped?: boolean;\n\n /**\n * When `true`, uses the initial value of the property as the default value,\n * which changes how attributes are handled:\n * - The initial value does *not* reflect, even if the `reflect` option is `true`.\n * Subsequent changes to the property will reflect, even if they are equal to the\n * default value.\n * - When the attribute is removed, the property is set to the default value\n * - The initial value will not trigger an old value in the `changedProperties` map\n * argument to update lifecycle methods.\n *\n * When set, properties must be initialized, either with a field initializer, or an\n * assignment in the constructor. Not initializing the property may lead to\n * improper handling of subsequent property assignments.\n *\n * While this behavior is opt-in, most properties that reflect to attributes should\n * use `useDefault: true` so that their initial values do not reflect.\n */\n useDefault?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues<this>` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map<PropertyKey, unknown>`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map<PropertyKey, unknown>`, but if a developer uses\n// `PropertyValues<this>` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues<T = any> = T extends object\n ? PropertyValueMap<T>\n : Map<PropertyKey, unknown>;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {\n get<K extends keyof T>(k: K): T[K] | undefined;\n set<K extends keyof T>(key: K, value: T[K]): this;\n has<K extends keyof T>(k: K): boolean;\n delete<K extends keyof T>(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean =>\n !is(value, old);\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n useDefault: false,\n hasChanged: notEqual,\n};\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind =\n | 'change-in-update'\n | 'migration'\n | 'async-perform-update';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\n// Temporary, until google3 is on TypeScript 5.2\ndeclare global {\n interface SymbolConstructor {\n readonly metadata: unique symbol;\n }\n}\n\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\n(Symbol as {metadata: symbol}).metadata ??= Symbol('metadata');\n\ndeclare global {\n // This is public global API, do not change!\n // eslint-disable-next-line no-var\n var litPropertyMetadata: WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n >;\n}\n\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n>();\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n // In the Node build, this `extends` clause will be substituted with\n // `(globalThis.HTMLElement ?? HTMLElement)`.\n //\n // This way, we will first prefer any global `HTMLElement` polyfill that the\n // user has assigned, and then fall back to the `HTMLElement` shim which has\n // been imported (see note at the top of this file about how this import is\n // generated by Rollup). Note that the `HTMLElement` variable has been\n // shadowed by this import, so it no longer refers to the global.\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having been finalized, which includes creating properties\n * from `static properties`, but does *not* include all properties created\n * from decorators.\n * @nocollapse\n */\n protected static finalized: true | undefined;\n\n /**\n * Memoized list of all element properties, including any superclass\n * properties. Created lazily on user subclasses when finalizing the class.\n *\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array<CSSResultOrNative> = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `<style>` tags when the browser doesn't\n * support adopted StyleSheets. To use such `<style>` tags with the style-src\n * CSP directive, the style-src value must either include 'unsafe-inline' or\n * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated\n * nonce.\n *\n * To provide a nonce to use on generated `<style>` elements, set\n * `window.litNonce` to a server-generated nonce in your page's HTML, before\n * loading application code:\n *\n * ```html\n * <script>\n * // Generated and unique per request:\n * window.litNonce = 'a1b2c3d4';\n * </script>\n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // Ensure we've created all properties\n this.finalize();\n // this.__attributeToPropertyMap is only undefined after finalize() in\n // ReactiveElement itself. ReactiveElement.observedAttributes is only\n // accessed with ReactiveElement as the receiver when a subclass or mixin\n // calls super.observedAttributes\n return (\n this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]\n );\n }\n\n private __instanceProperties?: PropertyValues = undefined;\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // If this is a state property, force the attribute to false.\n if (options.state) {\n (options as Mutable<PropertyDeclaration, 'attribute'>).attribute = false;\n }\n this.__prepare();\n // Whether this property is wrapping accessors.\n // Helps control the initial value change and reflection logic.\n if (this.prototype.hasOwnProperty(name)) {\n options = Object.create(options);\n options.wrapped = true;\n }\n this.elementProperties.set(name, options);\n if (!options.noAccessor) {\n const key = DEV_MODE\n ? // Use Symbol.for in dev mode to make it easier to maintain state\n // when doing HMR.\n Symbol.for(`${String(name)} (@property() cache)`)\n : Symbol();\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n defineProperty(this.prototype, name, descriptor);\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n const {get, set} = getOwnPropertyDescriptor(this.prototype, name) ?? {\n get(this: ReactiveElement) {\n return this[key as keyof typeof this];\n },\n set(this: ReactiveElement, v: unknown) {\n (this as unknown as Record<string | symbol, unknown>)[key] = v;\n },\n };\n if (DEV_MODE && get == null) {\n if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {\n throw new Error(\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it's actually declared as a value on the prototype. ` +\n `Usually this is due to using @property or @state on a method.`\n );\n }\n issueWarning(\n 'reactive-property-without-getter',\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it does not have a getter. This will be an error in a ` +\n `future version of Lit.`\n );\n }\n return {\n get,\n set(this: ReactiveElement, value: unknown) {\n const oldValue = get?.call(this);\n set?.call(this, value);\n this.requestUpdate(name, oldValue, options);\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) ?? defaultPropertyDeclaration;\n }\n\n // Temporary, until google3 is on TypeScript 5.2\n declare static [Symbol.metadata]: object & Record<PropertyKey, unknown>;\n\n /**\n * Initializes static own properties of the class used in bookkeeping\n * for element properties, initializers, etc.\n *\n * Can be called multiple times by code that needs to ensure these\n * properties exist before using them.\n *\n * This method ensures the superclass is finalized so that inherited\n * property metadata can be copied down.\n * @nocollapse\n */\n private static __prepare() {\n if (\n this.hasOwnProperty(JSCompiler_renameProperty('elementProperties', this))\n ) {\n // Already prepared\n return;\n }\n // Finalize any superclasses\n const superCtor = getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n // Initialize elementProperties from the superclass\n this.elementProperties = new Map(superCtor.elementProperties);\n }\n\n /**\n * Finishes setting up the class so that it's ready to be registered\n * as a custom element and instantiated.\n *\n * This method is called by the ReactiveElement.observedAttributes getter.\n * If you override the observedAttributes getter, you must either call\n * super.observedAttributes to trigger finalization, or call finalize()\n * yourself.\n *\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this))) {\n return;\n }\n this.finalized = true;\n this.__prepare();\n\n // Create properties from the static properties block:\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n const propKeys = [\n ...getOwnPropertyNames(props),\n ...getOwnPropertySymbols(props),\n ] as Array<keyof typeof props>;\n for (const p of propKeys) {\n this.createProperty(p, props[p]);\n }\n }\n\n // Create properties from standard decorator metadata:\n const metadata = this[Symbol.metadata];\n if (metadata !== null) {\n const properties = litPropertyMetadata.get(metadata);\n if (properties !== undefined) {\n for (const [p, options] of properties) {\n this.elementProperties.set(p, options);\n }\n }\n }\n\n // Create the attribute-to-property map\n this.__attributeToPropertyMap = new Map();\n for (const [p, options] of this.elementProperties) {\n const attr = this.__attributeNameForProperty(p, options);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n }\n }\n\n this.elementStyles = this.finalizeStyles(this.styles);\n\n if (DEV_MODE) {\n if (this.hasOwnProperty('createProperty')) {\n issueWarning(\n 'no-override-create-property',\n 'Overriding ReactiveElement.createProperty() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n if (this.hasOwnProperty('getPropertyDescriptor')) {\n issueWarning(\n 'no-override-get-property-descriptor',\n 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n }\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array<CSSResultOrNative> {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array<unknown> works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array<unknown>).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | DocumentFragment;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise<boolean>;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Records property default values when the\n * `useDefault` option is used.\n */\n private __defaultValues?: Map<PropertyKey, unknown>;\n\n /**\n * Properties that should be reflected when updated.\n */\n private __reflectingProperties?: Set<PropertyKey>;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: Set<ReactiveController>;\n\n constructor() {\n super();\n this.__initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n */\n private __initialize() {\n this.__updatePromise = new Promise<boolean>(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n // This enqueues a microtask that must run before the first update, so it\n // must be called before requestUpdate()\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= new Set()).add(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n this.__controllers?.delete(controller);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs.\n */\n private __saveInstanceProperties() {\n const instanceProperties = new Map<PropertyKey, unknown>();\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n for (const p of elementProperties.keys() as IterableIterator<keyof this>) {\n if (this.hasOwnProperty(p)) {\n instanceProperties.set(p, this[p]);\n delete this[p];\n }\n }\n if (instanceProperties.size > 0) {\n this.__instanceProperties = instanceProperties;\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // Create renderRoot before controllers `hostConnected`\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [responding to attribute changes](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(name: PropertyKey, value: unknown) {\n const elemProperties: PropertyDeclarationMap = (\n this.constructor as typeof ReactiveElement\n ).elementProperties;\n const options = elemProperties.get(name)!;\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'migration'\n ) &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n const convertedValue = converter.fromAttribute!(value, options.type);\n this[propName as keyof this] =\n convertedValue ??\n this.__defaultValues?.get(propName) ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (convertedValue as any);\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @param useNewValue if true, the newValue argument is used instead of\n * reading the property value. This is important to use if the reactive\n * property is a standard private accessor, as opposed to a plain\n * property, since private members can't be dynamically read by name.\n * @param newValue the new value of the property. This is only used if\n * `useNewValue` is true.\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n useNewValue = false,\n newValue?: unknown\n ): void {\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n if (DEV_MODE && (name as unknown) instanceof Event) {\n issueWarning(\n ``,\n `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`\n );\n }\n const ctor = this.constructor as typeof ReactiveElement;\n if (useNewValue === false) {\n newValue = this[name as keyof this];\n }\n options ??= ctor.getPropertyOptions(name);\n const changed =\n (options.hasChanged ?? notEqual)(newValue, oldValue) ||\n // When there is no change, check a corner case that can occur when\n // 1. there's a initial value which was not reflected\n // 2. the property is subsequently set to this value.\n // For example, `prop: {useDefault: true, reflect: true}`\n // and el.prop = 'foo'. This should be considered a change if the\n // attribute is not set because we will now reflect the property to the attribute.\n (options.useDefault &&\n options.reflect &&\n newValue === this.__defaultValues?.get(name) &&\n !this.hasAttribute(ctor.__attributeNameForProperty(name, options)!));\n if (changed) {\n this._$changeProperty(name, oldValue, options);\n } else {\n // Abort the request if the property should not be considered changed.\n return;\n }\n }\n if (this.isUpdatePending === false) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n }\n\n /**\n * @internal\n */\n _$changeProperty(\n name: PropertyKey,\n oldValue: unknown,\n {useDefault, reflect, wrapped}: PropertyDeclaration,\n initializeValue?: unknown\n ) {\n // Record default value when useDefault is used. This allows us to\n // restore this value when the attribute is removed.\n if (useDefault && !(this.__defaultValues ??= new Map()).has(name)) {\n this.__defaultValues.set(\n name,\n initializeValue ?? oldValue ?? this[name as keyof this]\n );\n // if this is not wrapping an accessor, it must be an initial setting\n // and in this case we do not want to record the change or reflect.\n if (wrapped !== true || initializeValue !== undefined) {\n return;\n }\n }\n // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(\n // vs just Map.set()\n if (!this._$changedProperties.has(name)) {\n // On the initial change, the old value should be `undefined`, except\n // with `useDefault`\n if (!this.hasUpdated && !useDefault) {\n oldValue = undefined;\n }\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `__reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (reflect === true && this.__reflectingProperty !== name) {\n (this.__reflectingProperties ??= new Set<PropertyKey>()).add(name);\n }\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise<unknown> {\n const result = this.performUpdate();\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'async-perform-update'\n ) &&\n typeof (result as unknown as Promise<unknown> | undefined)?.then ===\n 'function'\n ) {\n issueWarning(\n 'async-perform-update',\n `Element ${this.localName} returned a Promise from performUpdate(). ` +\n `This behavior is deprecated and will be removed in a future ` +\n `version of ReactiveElement.`\n );\n }\n return result;\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * @category updates\n */\n protected performUpdate(): void {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n if (!this.hasUpdated) {\n // Create renderRoot before first update. This occurs in `connectedCallback`\n // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n if (DEV_MODE) {\n // Produce warning if any reactive properties on the prototype are\n // shadowed by class fields. Instance fields set before upgrade are\n // deleted by this point, so any own property is caused by class field\n // initialization in the constructor.\n const ctor = this.constructor as typeof ReactiveElement;\n const shadowedProperties = [...ctor.elementProperties.keys()].filter(\n (p) => this.hasOwnProperty(p) && p in getPrototypeOf(this)\n );\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // TODO (justinfagnani): should we use the stored value? Could a new value\n // have been set since we stored the own property value?\n for (const [p, value] of this.__instanceProperties) {\n this[p as keyof this] = value as this[keyof this];\n }\n this.__instanceProperties = undefined;\n }\n // Trigger initial value reflection and populate the initial\n // `changedProperties` map, but only for the case of properties created\n // via `createProperty` on accessors, which will not have already\n // populated the `changedProperties` map since they are not set.\n // We can't know if these accessors had initializers, so we just set\n // them anyway - a difference from experimental decorators on fields and\n // standard decorators on auto-accessors.\n // For context see:\n // https://github.com/lit/lit/pull/4183#issuecomment-1711959635\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n if (elementProperties.size > 0) {\n for (const [p, options] of elementProperties) {\n const {wrapped} = options;\n const value = this[p as keyof this];\n if (\n wrapped === true &&\n !this._$changedProperties.has(p) &&\n value !== undefined\n ) {\n this._$changeProperty(p, undefined, options, value);\n }\n }\n }\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'change-in-update'\n )\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise<boolean> {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise<boolean> {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n // The forEach() expression will only run when __reflectingProperties is\n // defined, and it returns undefined, setting __reflectingProperties to\n // undefined\n this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) =>\n this.__propertyToAttribute(p, this[p as keyof this])\n ) as undefined;\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n// Assigned here to work around a jscompiler bug with static fields\n// when compiling to ES5.\n// https://github.com/google/closure-compiler/issues/3177\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('elementProperties', ReactiveElement)\n] = new Map();\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', ReactiveElement)\n] = new Map();\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = [\n 'change-in-update',\n 'async-perform-update',\n ];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (!this.enabledWarnings!.includes(warning)) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('2.1.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\nimport type {TrustedHTML, TrustedTypesWindow} from 'trusted-types/lib/index.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<LitUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n });\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? (global.ShadyDOM!.wrap as <T extends Node>(node: T) => T)\n : <T extends Node>(node: T) => node;\n\nconst trustedTypes = (global as unknown as TrustedTypesWindow).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n */\nexport type UncompiledTemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\n/**\n * This is a template result that may be either uncompiled or compiled.\n *\n * In the future, TemplateResult will be this type. If you want to explicitly\n * note that a template result is potentially compiled, you can reference this\n * type and it will continue to behave the same through the next major version\n * of Lit. This can be useful for code that wants to prepare for the next\n * major version of Lit.\n */\nexport type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =\n | UncompiledTemplateResult<T>\n | CompiledTemplateResult;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg}.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n * In Lit 4, this type will be an alias of\n * MaybeCompiledTemplateResult, so that code will get type errors if it assumes\n * that Lit templates are not compiled. When deliberately working with only\n * one, use either {@linkcode CompiledTemplateResult} or\n * {@linkcode UncompiledTemplateResult} explicitly.\n */\nexport type TemplateResult<T extends ResultType = ResultType> =\n UncompiledTemplateResult<T>;\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport type MathMLTemplateResult = TemplateResult<typeof MATHML_RESULT>;\n\n/**\n * A TemplateResult that has been compiled by @lit-labs/compiler, skipping the\n * prepare step.\n */\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n // The type is a TemplateStringsArray to guarantee that the value came from\n // source code, preventing a JSON injection attack.\n h: TemplateStringsArray;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (\n values.some((val) => (val as {_$litStatic$: unknown})?.['_$litStatic$'])\n ) {\n issueWarning(\n '',\n `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`\n );\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\n/**\n * The root DOM node for rendering.\n */\nexport type RenderRootNode = HTMLElement | SVGElement | DocumentFragment;\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\nfunction trustFromTemplateString(\n tsa: TemplateStringsArray,\n stringFromTSA: string\n): TrustedHTML {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : (stringFromTSA as unknown as TrustedHTML);\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string> = [];\n let html =\n type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: UncompiledTemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild!;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n for (const name of (node as Element).getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = (node as Element).getAttribute(name)!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n (node as Element).removeAttribute(name);\n } else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n (node as Element).removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(\n `Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`'\n );\n }\n }\n\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\nexport type {TemplateInstance};\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n _$template: Template;\n _$parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n readonly ctor: typeof AttributePart;\n readonly strings: ReadonlyArray<string>;\n};\ntype ChildTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | ChildTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unused otherwise. The\n * intention would be clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(\n `[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`\n );\n console.warn(\n `Attempted to render the template host`,\n value,\n `inside itself. This is almost always a mistake, and in dev mode `,\n `we render some warning text. In production however, we'll `,\n `render it, which will usually result in an error, and sometimes `,\n `in the element disappearing from the DOM.`\n );\n return;\n }\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(\n node,\n this._$endNode\n );\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling as Text,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as UncompiledTemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(\n trustFromTemplateString(type.h, type.h[0]),\n this.options\n )),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue as TemplateInstance,\n parts: (this._$committedValue as TemplateInstance)._$parts,\n options: this.options,\n values,\n });\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: UncompiledTemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives\n * in those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start !== this._$endNode) {\n // The non-null assertion is safe because if _$startNode.nextSibling is\n // null, then _$endNode is also null, and we would not have entered this\n // loop.\n const n = wrap(start!).nextSibling;\n wrap(start!).remove();\n start = n;\n }\n }\n\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was previously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type:\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART = ATTRIBUTE_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n (wrap(this.element) as Element).toggleAttribute(\n this.name,\n !!value && value !== nothing\n );\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.3');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n });\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (\n value: unknown,\n container: RenderRootNode,\n options?: RenderOptions\n): RootPart => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {PropertyValues, ReactiveElement} from '@lit/reactive-element';\nimport {render, RenderOptions, noChange, RootPart} from 'lit-html';\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\n\nimport {LitUnstable} from 'lit-html';\nimport {ReactiveUnstable} from '@lit/reactive-element';\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Unstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | LitUnstable.DebugLog.Entry\n | ReactiveUnstable.DebugLog.Entry;\n }\n}\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\nconst DEV_MODE = true;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nexport class LitElement extends ReactiveElement {\n // This property needs to remain unminified.\n static ['_$litElement$'] = true;\n\n /**\n * @category rendering\n */\n readonly renderOptions: RenderOptions = {host: this};\n\n private __childPart: RootPart | undefined = undefined;\n\n /**\n * @category rendering\n */\n protected override createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot!.firstChild as ChildNode;\n return renderRoot;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n protected override update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = render(value, this.renderRoot, this.renderOptions);\n }\n\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n override connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n protected render(): unknown {\n return noChange;\n }\n}\n\n/**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\n(LitElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', LitElement)\n] = true;\n\n// Install hydration if available\nglobal.litElementHydrateSupport?.({LitElement});\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litElementPolyfillSupportDevMode\n : global.litElementPolyfillSupport;\npolyfillSupport?.({LitElement});\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LE = {\n _$attributeToProperty: (\n el: LitElement,\n name: string,\n value: string | null\n ) => {\n // eslint-disable-next-line\n (el as any)._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el: LitElement) => (el as any)._$changedProperties,\n};\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(global.litElementVersions ??= []).push('4.2.2');\nif (DEV_MODE && global.litElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n", "/**\n * Token helpers.\n *\n * Components never name a colour, a size or a radius. They name a token, and a\n * brand decides what it holds \u2014 which is what makes a rebrand a content\n * publish rather than a rebuild\n * ([ADR 0005](https://github.com/matthill8286/strata/blob/main/docs/decisions/0005-design-tokens.md)).\n *\n * Every reference carries a fallback so that a component dropped onto a page\n * with no token stylesheet still renders something legible. An unstyled\n * component is indistinguishable from a broken one, and the fallback is what\n * keeps a missing stylesheet a visible annoyance rather than a blank screen.\n *\n * These return `CSSResult` rather than strings. Lit's `css` tag refuses plain\n * interpolated strings, which is a deliberate guard against injecting\n * attacker-controlled text into a stylesheet; `unsafeCSS` is the documented\n * way past it and is safe here because every value is a literal in this file,\n * never anything authored or fetched.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\n\n/** `color.brand.default` \u2192 `var(--impakt-color-brand-default, <fallback>)`. */\nexport const token = (path: string, fallback: string): CSSResult => unsafeCSS(`var(--impakt-${path.replace(/\\./g, '-')}, ${fallback})`);\n\nexport const t = {\n brand: token('color.brand.default', '#1f4ed8'),\n brandHover: token('color.brand.hover', '#1b45be'),\n brandActive: token('color.brand.active', '#183ba4'),\n brandSubtle: token('color.brand.subtle', '#e4eafa'),\n onBrand: token('color.text.on-brand', '#ffffff'),\n\n surfaceCard: token('color.surface.card', '#ffffff'),\n surfaceInset: token('color.surface.inset', '#f4f4f4'),\n surfaceSubtle: token('color.surface.subtle', '#e4eafa'),\n\n text: token('color.text.default', '#1a1a1a'),\n textMuted: token('color.text.muted', '#717171'),\n textPlaceholder: token('color.text.placeholder', '#767676'),\n textHeading: token('color.text.heading', '#1f4ed8'),\n link: token('color.text.link', '#1f4ed8'),\n linkHover: token('color.text.link-hover', '#193ead'),\n\n border: token('color.border.default', '#929292'),\n borderStrong: token('color.border.strong', '#818181'),\n\n danger: token('color.status.danger.default', '#c8102e'),\n dangerText: token('color.status.danger.text', '#c8102e'),\n dangerSubtle: token('color.status.danger.subtle', '#f8e2e6'),\n warning: token('color.status.warning.default', '#b45309'),\n warningText: token('color.status.warning.text', '#b45309'),\n warningSubtle: token('color.status.warning.subtle', '#f6eae1'),\n success: token('color.status.success.default', '#047857'),\n successText: token('color.status.success.text', '#047857'),\n successSubtle: token('color.status.success.subtle', '#e0f0ea'),\n info: token('color.status.info.default', '#1f4ed8'),\n infoText: token('color.status.info.text', '#1f4ed8'),\n infoSubtle: token('color.status.info.subtle', '#e4eafa'),\n\n fontBody: token('font.family.body', 'system-ui, sans-serif'),\n fontHeading: token('font.family.heading', 'system-ui, sans-serif'),\n /** Code-like labels: hashes, branches, version lines. */\n fontMono: token('font.family.mono', 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'),\n /** The small line above a heading: the body face, or the code face for a brand that asks. */\n fontEyebrow: token('font.family.eyebrow', 'inherit'),\n\n focusShadow: token('focus.ring.shadow', '0 0 0 2px #ffffff, 0 0 0 4px #1a1a1a'),\n focusOffset: token('focus.ring.offset', '2px'),\n\n targetMin: token('target.min', '24px'),\n\n radiusSm: token('radius.sm', '2px'),\n radius: token('radius.md', '4px'),\n radiusLg: token('radius.lg', '8px'),\n\n borderThin: token('border.width.thin', '1px'),\n borderThick: token('border.width.thick', '2px'),\n\n radiusXs: token('radius.xs', '2px'),\n radiusXl: token('radius.xl', '12px'),\n radius2xl: token('radius.2xl', '16px'),\n\n /** Hairline borders and rings, from the text colour, so they suit any surface. */\n hairline: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 10%, transparent)'),\n rule: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 15%, transparent)'),\n /** A wash of the text colour, for hover and pressed states on quiet controls. */\n wash: unsafeCSS('color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 5%, transparent)'),\n /** The brand at a fifth, for focus halos round fields. */\n brandHalo: unsafeCSS('color-mix(in srgb, var(--impakt-color-brand-default, #1f4ed8) 22%, transparent)'),\n\n shadowXs: token('shadow.xs', '0 1px 2px 0 rgb(0 0 0 / 0.05)'),\n shadowSm: token('shadow.sm', '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)'),\n shadowMd: token('shadow.md', '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)'),\n shadowLg: token('shadow.lg', '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)'),\n shadowXl: token('shadow.xl', '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)'),\n\n trackingTight: token('font.tracking.tight', '-0.02em'),\n trackingWide: token('font.tracking.wide', '0.06em'),\n} as const;\n\n/**\n * A size on the type scale with its own line height, so text drawn at\n * `type('xl')` has the leading that size reads best at.\n */\nexport const type = (name: string): CSSResult =>\n unsafeCSS(`font-size: var(--impakt-font-size-${name}, 1rem); line-height: var(--impakt-font-leading-${name}, 1.5);`);\n\n/** `space(3)` \u2192 `space.3`, `space(0.5)` \u2192 `space.0-5`. Spacing is always a token, never a number. */\nexport const space = (step: number): CSSResult => token(`space.${String(step).replace('.', '-')}`, `${step * 4}px`);\n/** `font.size.lg` \u2192 the custom property. */\nexport const fontSize = (name: string): CSSResult => token(`font.size.${name}`, '1rem');\nexport const lineHeight = (name: string): CSSResult => token(`font.line-height.${name}`, '1.5');\nexport const fontWeight = (name: string): CSSResult => token(`font.weight.${name}`, '400');\n\n/**\n * Space above and below a section, from the spacing scale: `none`, `sm`,\n * `md`, `lg` or `xl`, set by `space-above` and `space-below`. A section names\n * a step rather than a size, so a page keeps the brand's rhythm.\n */\nexport const spaceAround: CSSResult = css`\n :host([space-above='sm']) { margin-block-start: ${space(2)}; }\n :host([space-above='md']) { margin-block-start: ${space(4)}; }\n :host([space-above='lg']) { margin-block-start: ${space(6)}; }\n :host([space-above='xl']) { margin-block-start: ${space(8)}; }\n :host([space-above='2xl']) { margin-block-start: clamp(${space(14)}, 8vw, ${space(28)}); }\n :host([space-below='sm']) { margin-block-end: ${space(2)}; }\n :host([space-below='md']) { margin-block-end: ${space(4)}; }\n :host([space-below='lg']) { margin-block-end: ${space(6)}; }\n :host([space-below='xl']) { margin-block-end: ${space(8)}; }\n :host([space-below='2xl']) { margin-block-end: clamp(${space(14)}, 8vw, ${space(28)}); }\n`;\n", "/**\n * Shared style fragments.\n *\n * Three of these carry an accessibility guarantee and are therefore not\n * negotiable per component: the focus ring, the minimum target size and the\n * reduced-motion rule. A component that wants its own focus treatment is a\n * component that will get it subtly wrong on one brand, so there is one.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\nimport { t } from './tokens';\n\n/**\n * The focus ring.\n *\n * `:focus-visible` rather than `:focus`, so a mouse click on a button does not\n * draw a ring the user did not ask for while keyboard focus still does.\n *\n * The ring is two-tone \u2014 a light inner band inside a dark outer one \u2014 drawn\n * with `box-shadow` and a transparent `outline` behind it. The outline is not\n * decoration: it is what survives Windows High Contrast Mode, where box-shadow\n * is dropped entirely and a shadow-only ring disappears for exactly the users\n * who most need it.\n *\n * The colours come from locked tokens a brand cannot reach\n * ([ADR 0010](https://github.com/matthill8286/strata/blob/main/docs/decisions/0010-what-a-brand-may-set.md)).\n */\nexport const focusRing = css`\n :host(:focus-visible),\n :host(:not([disabled])) :focus-visible {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n`;\n\n/**\n * WCAG 2.2, 2.5.8 Target Size (Minimum): 24 by 24 CSS pixels.\n *\n * Applied as a minimum rather than a fixed size so a control grows with its\n * content and never shrinks below the floor. It reads the locked token, which\n * is deliberately outside the spacing scale \u2014 otherwise a brand tightening its\n * spacing unit would shrink every tap target with it.\n */\nexport const targetSize = css`\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n`;\n\n/**\n * Visible to a screen reader, invisible on screen.\n *\n * `clip-path` with a 1px box rather than `display: none` or `visibility:\n * hidden`, both of which remove the text from the accessibility tree \u2014 which\n * is the one thing this must not do.\n */\nexport const visuallyHidden = css`\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n`;\n\n/**\n * 2.3.3 Animation from Interactions, and plain decency.\n *\n * `0.01ms` rather than `0` because a zero-duration transition does not fire a\n * `transitionend` event in every engine, and components that wait for one hang.\n */\nexport const reducedMotion = css`\n @media (prefers-reduced-motion: reduce) {\n :host,\n :host *,\n :host *::before,\n :host *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n`;\n\n/** The base every component starts from. */\nexport const base = css`\n :host {\n box-sizing: border-box;\n font-family: ${t.fontBody};\n color: ${t.text};\n }\n :host([hidden]) {\n display: none !important;\n }\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n`;\n\n/**\n * On a touch screen a control is at least 44 by 44 CSS pixels.\n *\n * The 24px floor above is WCAG 2.2's minimum, and it is right for a mouse. A finger\n * is broader, and the design guide sets 44px on a touch screen, which is also\n * 2.5.5's enhanced size. It is applied by pointer rather than by width, because a\n * small laptop window is still driven by a mouse and a large tablet by a finger.\n * Pass the selectors that are the controls, inside the component's shadow root.\n */\nexport const touchTarget = (selector: string): CSSResult =>\n // Under :host, so it outweighs the component's own rule for the same control whatever the order.\n unsafeCSS(`@media (pointer: coarse) { :host :is(${selector}) { min-block-size: 44px; min-inline-size: 44px; } }`);\n\n/**\n * `hide-on`: an element left out on a phone, or on anything wider, so a phone's\n * header is built from the same pieces as a wide one. The width is the one the\n * nav folds at. A component that offers `hideOn` reflects it as `hide-on` and\n * adds this to its styles.\n */\nexport const hideOn = css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }\n`;\n", "/**\n * The library's own words, in the page's language (ADR 0026).\n *\n * Every word a component shows that a page did not give it, such as \"Skip to\n * content\", \"Next slide\" or \"There is a problem\", goes through `say`. The\n * renderer puts the site's wording in place before it draws a page\n * (`applySiteLanguage` in `@atomic-ui/renderer-core`), translated into the page's\n * language and with any of the site's own rewording. Without it, the English\n * here is shown, which is what every site did before it had languages.\n *\n * The English is the key, with `{name}` for a value put in, so the list of\n * words to translate (`SITE_WORDING` in `@atomic-ui/content-schemas`) can be\n * checked against this library by a test.\n */\nconst WORDING = Symbol.for('strata.wording');\n\ntype Store = { words?: Record<string, string> };\n\nexport function say(english: string, values?: Record<string, string | number>): string {\n const words = (globalThis as Record<symbol, Store | undefined>)[WORDING]?.words;\n const chosen = words?.[english];\n const text = typeof chosen === 'string' && chosen.trim() ? chosen : english;\n return values ? text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in values ? String(values[name]) : whole)) : text;\n}\n", "import { LitElement, css } from 'lit';\nimport { base, reducedMotion } from './styles';\nimport { say } from './say';\n\nlet counter = 0;\n\n/**\n * The base every Impakt component extends.\n *\n * It carries the two style fragments that are not a per-component choice \u2014 the\n * reset and the reduced-motion rule \u2014 and a stable id generator for the ARIA\n * wiring. It deliberately carries nothing else: a base class that grows\n * behaviour becomes the place every component's exceptions are negotiated.\n */\nexport class ImpaktElement extends LitElement {\n static styles = [base, reducedMotion, css``];\n\n /**\n * A unique id for this instance, for `aria-describedby` and friends.\n *\n * Generated once in the constructor rather than in `render`, because an id\n * that changes between renders breaks the relationship it exists to express\n * \u2014 and it breaks it silently, since the markup still looks correct.\n */\n protected readonly uid = `impakt-${(counter += 1)}`;\n\n protected id_(part: string): string {\n return `${this.uid}-${part}`;\n }\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.sayDefaults();\n }\n\n /**\n * The words a component ships with, in the page's language (ADR 0026).\n *\n * Defaults stay plain English in the constructor, so the component manifest\n * still sees them (a prop with no default is read as required). When the\n * element joins the page, each word it holds is looked up in the site's\n * wording; anything that is not one of Strata's own words, such as a page's\n * own text or a variant name, is left exactly as it is.\n *\n * @ignore\n */\n private sayDefaults(): void {\n const props = (this.constructor as typeof LitElement).elementProperties;\n const self = this as unknown as Record<string, unknown>;\n for (const name of props.keys()) {\n const value = self[name as string];\n if (typeof value !== 'string' || !value) continue;\n const said = say(value);\n if (said !== value) self[name as string] = said;\n }\n }\n}\n", "import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n /** Two lines: a menu drawn quieter, as a round icon button. */\n 'menu-two': svg`<path d=\"M5 9.5h14M5 14.5h14\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n /** Product navigation and actions, drawn to Lucide's shapes so they sit beside its line weight. */\n grid: svg`<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>`,\n clipboard: svg`<rect x=\"8\" y=\"2\" width=\"8\" height=\"4\" rx=\"1\"/><path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01\"/>`,\n 'map-pinned': svg`<path d=\"M18 8c0 3.6-3.9 7.4-5.4 8.8a1 1 0 0 1-1.2 0C9.9 15.4 6 11.6 6 8a6 6 0 0 1 12 0\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/><path d=\"M8.7 14H5a1 1 0 0 0-.9.7l-2 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .9-1.3l-2-6a1 1 0 0 0-.9-.7h-3.7\"/>`,\n users: svg`<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8\"/>`,\n radio: svg`<path d=\"M4.9 19.1C1 15.2 1 8.8 4.9 4.9M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5M19.1 4.9C23 8.8 23 15.1 19.1 19\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/>`,\n settings: svg`<path d=\"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.5a2 2 0 0 1-1 1.8l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.8v-.5a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n 'log-out': svg`<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9\"/>`,\n 'arrow-up-right': svg`<path d=\"M7 7h10v10M7 17L17 7\"/>`,\n more: svg`<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>`,\n upload: svg`<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>`,\n image: svg`<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-3.1-3.1a2 2 0 0 0-2.8 0L6 21\"/>`,\n lock: svg`<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>`,\n eye: svg`<path d=\"M2.1 12.3a1 1 0 0 1 0-.7 10.8 10.8 0 0 1 19.8 0 1 1 0 0 1 0 .7 10.8 10.8 0 0 1-19.8 0\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n trash: svg`<path d=\"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6\"/>`,\n pencil: svg`<path d=\"M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8L2 21.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5zM15 5l4 4\"/>`,\n 'qr-code': svg`<rect x=\"3\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"16\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"M21 16h-3a2 2 0 0 0-2 2v3M21 21v.01M12 7v3a2 2 0 0 1-2 2H7M3 12h.01M12 3h.01M12 16v.01M16 12h1M21 12v.01M12 21v-1\"/>`,\n battery: svg`<rect x=\"2\" y=\"7\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M22 11v2M6 11v2M10 11v2\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpaktIcon extends ImpaktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name:\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impakt-icon', ImpaktIcon);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-icon': ImpaktIcon;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t, token, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document \u2014 at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * **A button that goes somewhere is a link.** With `href` set it renders an\n * `<a>` styled as a button, so it opens in a new tab, shows its address and is\n * announced as a link, which is what it is.\n *\n * **An icon-only button still has a name.** With `icon` set and no words, the\n * button shows the icon alone and `label` becomes its accessible name, so a\n * screen reader says \"Back\" rather than \"button\". Without a `label` an\n * icon-only button is not rendered as icon-only, because it would be nameless\n * (4.1.2).\n *\n * @category action\n * @icon button\n * @slot - The button label.\n * @fires click - When the button is pressed. Not while it is busy or disabled.\n */\nexport class ImpaktButton extends ImpaktElement {\n static formAssociated = true;\n\n static properties = {\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n fullOnPhone: { type: Boolean, attribute: 'full-on-phone', reflect: true },\n size: { type: String, reflect: true },\n iconBefore: { type: String, attribute: 'icon-before' },\n iconAfter: { type: String, attribute: 'icon-after' },\n href: { type: String },\n icon: { type: String },\n label: { type: String },\n };\n\n /** Leave it out on a phone, where a header has no room for it. */\n declare hideOn: 'never' | 'phone';\n /**\n * How much the button asks for attention. `dark` is the strong second\n * choice on a light page, `subtle` a quiet filled one, `danger` an\n * action that removes or cancels something, and `accent` the brand's\n * second colour, for the one action a page is built around.\n */\n declare variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent';\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n /** As wide as its space on a phone only, such as a form's send button. */\n declare fullOnPhone: boolean;\n declare size: 'sm' | 'md' | 'lg';\n /** An icon before the words, such as phone or calendar. */\n declare iconBefore:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** An icon after the words, such as arrow-right. */\n declare iconAfter:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** Where the button goes, when it opens a page rather than doing something here. */\n declare href: string;\n /** Draws the button as this icon alone, a round button. Needs `label`. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** The accessible name of an icon-only button, such as \"Back\" or \"More actions\". */\n declare label: string;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\n this.fullOnPhone = false;\n this.size = 'md';\n this.iconBefore = 'none';\n this.iconAfter = 'none';\n this.href = '';\n this.icon = 'none';\n this.label = '';\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button, a'),\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n :host {\n display: inline-block;\n }\n :host([full]) {\n display: block;\n }\n @media (max-width: 40rem) { :host([full-on-phone]) { display: block; } }\n button, a {\n ${targetSize}\n box-sizing: border-box;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(2)};\n inline-size: 100%;\n min-block-size: 40px;\n padding: ${space(2)} ${space(4)};\n font-family: inherit;\n ${type('sm')}\n font-weight: ${fontWeight('semibold')};\n border-radius: ${t.radiusLg};\n border: ${t.borderThin} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n :host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 48px; padding: ${space(3)} ${space(6)}; ${type('md')} }\n .icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n /* Solid: the brand, with a hairline highlight along the top edge. */\n .primary {\n background: ${t.brand};\n color: ${t.onBrand};\n box-shadow: ${t.shadowXs}, inset 0 1px 0 0 rgb(255 255 255 / 0.12);\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impakt-color-action-hover, ${t.brandHover});\n color: var(--impakt-color-action-on-hover, ${t.onBrand});\n }\n /* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */\n .after { transition: transform 160ms ease-out; }\n :is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impakt-motion-button-turn, 0deg)); }\n @media (prefers-reduced-motion: reduce) { .after { transition: none; } }\n .primary:active:not([aria-disabled='true']) {\n background: ${t.brandActive};\n }\n\n /* Outline: the card, a hairline border and the text colour, for the second choice. */\n .secondary {\n background: ${t.surfaceCard};\n color: ${t.text};\n border-color: ${t.rule};\n box-shadow: ${t.shadowXs};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n /* Dark: the text colour as a fill, the strong second choice on a light page. */\n .dark {\n background: ${t.text};\n color: ${t.surfaceCard};\n }\n .dark:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 14%);\n }\n .dark:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 24%);\n }\n\n /* Subtle: a quiet fill, for an action that sits beside the main one. */\n .subtle {\n background: ${t.surfaceInset};\n color: ${t.text};\n }\n .subtle:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 6%);\n }\n .subtle:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 12%);\n }\n\n /* Accent: the brand's second colour as a fill, for the one action a page is built around. The words on it are the colour the tokens measured against it. */\n .accent {\n background: ${token('color.accent.default', '#ffd43b')};\n color: ${token('color.accent.on', '#1a1a1a')};\n }\n .accent:hover:not([aria-disabled='true']) {\n background: ${token('color.accent.hover', '#e0bb34')};\n }\n .accent:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${token('color.accent.hover', '#e0bb34')}, ${token('color.accent.on', '#1a1a1a')} 10%);\n }\n\n /* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */\n .danger {\n background: ${t.dangerText};\n color: ${t.surfaceCard};\n }\n .danger:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 15%);\n }\n .danger:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 28%);\n }\n\n /* Icon only: a round button as tall as it is wide. */\n .icon-only {\n inline-size: 40px;\n min-inline-size: 40px;\n block-size: 40px;\n min-block-size: 40px;\n padding: 0;\n border-radius: 999px;\n }\n :host([size='sm']) .icon-only { inline-size: 32px; min-inline-size: 32px; block-size: 32px; min-block-size: 32px; padding: 0; }\n :host([size='lg']) .icon-only { inline-size: 48px; min-inline-size: 48px; block-size: 48px; min-block-size: 48px; padding: 0; }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button, a {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n const iconOnly = Boolean(this.icon && this.icon !== 'none' && this.label);\n const cls = iconOnly ? `${this.variant} icon-only` : this.variant;\n if (iconOnly) {\n const drawn = iconSvg(this.icon);\n if (this.href && !this.disabled) {\n return html`<a class=${cls} href=${this.href} part=\"button\" aria-label=${this.label}>${drawn}</a>`;\n }\n return html`\n <button\n class=${cls}\n type=\"button\"\n part=\"button\"\n aria-label=${this.label}\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${drawn}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n const words = html`${iconSvg(this.iconBefore)}<slot></slot>${this.iconAfter && this.iconAfter !== 'none' ? html`<span class=\"after\" aria-hidden=\"true\">${iconSvg(this.iconAfter)}</span>` : nothing}`;\n if (this.href && !this.disabled) {\n return html`<a class=${this.variant} href=${this.href} part=\"button\">${words}</a>`;\n }\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${words}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impakt-button', ImpaktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-button': ImpaktButton;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from './ImpaktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time \u2014 a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impakt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impakt-field-width: 100%; }\n :host([width='xs']) { --impakt-field-width: 8ch; }\n :host([width='sm']) { --impakt-field-width: 14ch; }\n :host([width='md']) { --impakt-field-width: 24ch; }\n :host([width='lg']) { --impakt-field-width: 40ch; }\n`;\n\n/**\n * The base of every form control.\n *\n * @fires {CustomEvent<{ value: string }>} impakt-change - When the answer changes. The answer is in detail.value.\n */\nexport abstract class FieldElement extends ImpaktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it \u2014 which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n line-height: ${lineHeight('normal')};\n margin-block-end: ${space(1)};\n color: ${t.text};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /*\n * Only the control is dimmed. Dimming the whole host took the question,\n * the hint and the error below 4.5:1, and a disabled field still has to\n * say what it is and why it cannot be changed. The native disabled\n * control itself is exempt from the contrast criterion.\n */\n :host([disabled]) :is(input, select, textarea, button) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /**\n * Focusing the element focuses its control, so `el.focus()` from an app, a\n * React ref or the error summary's link lands where someone can type, rather\n * than on a host that cannot take focus and so silently does nothing.\n */\n focus(options?: FocusOptions): void {\n const control =\n this.renderRoot?.querySelector<HTMLElement>(`#${this.controlId}`) ?? this.renderRoot?.querySelector<HTMLElement>('input, select, textarea, button');\n if (control) control.focus(options);\n else super.focus(options);\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls \u2014 radios, checkboxes \u2014\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: this.changeDetail(value), bubbles: true, composed: true }));\n }\n\n /** What `impakt-change` carries. A control with more to say than its value adds it here. */\n protected changeDetail(value: string): { value: string } {\n return { value };\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A single-line text field.\n *\n * `inputmode` and `autocomplete` are first-class properties rather than\n * afterthoughts. 1.3.5 Identify Input Purpose is a Level AA criterion that\n * autofill satisfies directly, and it is the single cheapest accessibility win\n * in a checkout journey \u2014 a form that fills itself is a form that someone with a\n * motor impairment can actually finish.\n\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n type: { type: String },\n placeholder: { type: String },\n autocomplete: { type: String },\n inputmode: { type: String },\n maxlength: { type: Number },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n /** `search` draws a search icon at the start and rounds the field, as a search box. */\n declare type: 'text' | 'email' | 'tel' | 'number' | 'password' | 'date' | 'search';\n /**\n * Keep the label for screen readers only, for a field whose purpose is plain\n * from where it sits, such as the search in a top bar. The label stays its\n * accessible name; a placeholder is never a substitute for it.\n */\n declare hideLabel: boolean;\n declare placeholder: string;\n /** A token from the HTML autofill list \u2014 `given-name`, `postal-code`, `tel`. */\n declare autocomplete: string;\n declare inputmode: string;\n declare maxlength: number | undefined;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.type = 'text';\n this.placeholder = '';\n this.autocomplete = '';\n this.inputmode = '';\n this.maxlength = undefined;\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n input {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n input:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n input:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n input::placeholder {\n color: ${t.textPlaceholder};\n }\n input:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n /* The border thickens as well as reddening. Colour alone would carry the\n error, which 1.4.1 forbids \u2014 and the message below says it in words. */\n :host([hide-label]) .label {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n .search {\n position: relative;\n display: block;\n inline-size: min(100%, var(--impakt-field-width));\n }\n .search input {\n inline-size: 100%;\n padding-inline-start: ${space(10)};\n border-radius: 999px;\n }\n .search .icon {\n position: absolute;\n inset-inline-start: ${space(3.5)};\n inset-block-start: 50%;\n transform: translateY(-50%);\n color: ${t.textMuted};\n pointer-events: none;\n }\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n const input = this.renderInput();\n return this.type === 'search' ? html`<span class=\"search\" part=\"search\">${iconSvg('search', '20px')}${input}</span>` : input;\n }\n\n private renderInput(): TemplateResult {\n return html`\n <input\n id=${this.controlId}\n part=\"input\"\n type=${this.type}\n name=${this.name || nothing}\n .value=${this.value}\n placeholder=${this.placeholder || nothing}\n autocomplete=${this.autocomplete || nothing}\n inputmode=${this.inputmode || nothing}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLInputElement).value)}\n />\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-text-input', ImpaktTextInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-text-input': ImpaktTextInput;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch \u2014 and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpaktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n declare options: SelectOption[];\n /**\n * Keep the label for screen readers only, for a picker whose purpose is\n * plain from where it sits, such as a filter above a table or a role in a\n * team row. The label stays its accessible name.\n */\n declare hideLabel: boolean;\n declare placeholder: string;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n :host([hide-label]) .label {\n ${visuallyHidden}\n }\n select {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n select:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n select:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n select:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n :host([invalid]) select {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}\n </select>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-select', ImpaktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-select': ImpaktSelect;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A single checkbox \u2014 a consent, an opt-in, a confirmation.\n *\n * The label sits beside the box rather than above it, so this overrides the\n * base layout. The whole `<label>` is the hit area: a 20px box is legal under\n * 2.5.8 and still unkind, and the row costs nothing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckbox extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n };\n\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n cursor: pointer;\n }\n input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([invalid]) .row {\n color: ${t.dangerText};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <input\n type=\"checkbox\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"text\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </span>\n </label>\n `;\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-checkbox', ImpaktCheckbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-checkbox': ImpaktCheckbox;\n }\n}\n", "import { html, css, nothing, unsafeCSS, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One destination in a product's navigation. */\nexport interface ShellNavItem {\n /** A stable name for the destination, sent back with `impakt-navigate`. */\n id?: string;\n label: string;\n href: string;\n /** An icon from `impakt-icon`'s set, such as `grid` or `users`. */\n icon?: string;\n}\n\n/** The phone layout starts below this width. Desktop and phone only; there is no tablet layout. */\nconst PHONE = unsafeCSS('48rem');\n\n/** Normalise a path so `/jobs/` and `/jobs` compare equal. */\nfunction pathOf(href: string): string | null {\n if (!href || href.startsWith('#')) return null;\n try {\n const base = typeof location === 'undefined' ? 'http://localhost/' : location.href;\n return new URL(href, base).pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n}\n\n/**\n * Whether an item is where the person is. `current` is the path the app's\n * router reports. Without it the browser's address is used, which is right\n * for a site and stale in a single-page app that never reloads.\n *\n * An item is current on its own path and on the paths below it, so Jobs stays\n * marked on `/jobs/123`. The root item, `/`, is current only on `/`.\n */\nexport function isCurrent(href: string, current: string): boolean {\n const path = pathOf(href);\n if (!path) return false;\n const here = pathOf(current || (typeof location === 'undefined' ? '' : location.pathname));\n if (!here) return false;\n if (path === here) return true;\n return path !== '/' && here.startsWith(`${path}/`);\n}\n\n/**\n * Tell the app a navigation link was followed, so a single-page app can route\n * without a reload. The event is cancelable: an app that calls\n * `preventDefault()` on it takes over, and the browser does not follow the\n * link. A click with a modifier key, or with any button but the main one, is\n * left to the browser, so \"open in a new tab\" keeps working.\n */\nexport function announceNavigate(host: HTMLElement, event: MouseEvent, item: { href: string; id?: string }): void {\n if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n const go = new CustomEvent('impakt-navigate', {\n detail: { href: item.href, id: item.id ?? item.href },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!host.dispatchEvent(go)) event.preventDefault();\n}\n\n/**\n * A product's main navigation down the side of the screen: an icon and a word\n * for each place, with a footer slot for an action that belongs at the bottom,\n * such as Sign out.\n *\n * **The place you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and it is\n * filled, so it does not rely on a colour change alone (1.4.1).\n *\n * **Every item has a word.** The icons are decorative and hidden from screen\n * readers, because an icon alone is a guess for anyone who has not learned the\n * product.\n *\n * **It works with an app's router.** Set `current` to the router's path, and\n * cancel `impakt-navigate` to route without a reload.\n *\n * @category action\n * @icon menu\n * @slot footer - An action pinned to the bottom of the side, such as Sign out.\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When an item is followed. Cancel it to route in the app instead of the browser.\n */\nexport class ImpaktSideNav extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n current: { type: String },\n };\n /** The places, in order. */\n declare items: ShellNavItem[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The path the person is on, from the app's router. Leave empty to use the address bar. */\n declare current: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Main';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: flex; flex-direction: column; gap: ${space(5)}; block-size: 100%; }\n .card { padding: ${space(2)}; border-radius: ${t.radiusXl}; background: ${t.surfaceCard}; }\n ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(0.5)}; }\n a {\n ${targetSize}\n display: flex;\n align-items: center;\n gap: ${space(3)};\n min-block-size: 44px;\n padding: 0 ${space(3.5)};\n border-radius: ${t.radiusLg};\n color: ${t.text};\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('medium')};\n text-decoration: none;\n transition: background-color 120ms ease-in-out, color 120ms ease-in-out;\n }\n a:hover { background: ${t.surfaceInset}; }\n a[aria-current='page'] { background: ${t.text}; color: ${t.surfaceCard}; }\n .icon { flex: none; }\n .footer { margin-block-start: auto; }\n .footer.empty { display: none; }\n @media (prefers-reduced-motion: reduce) { a { transition: none; } }\n @media (forced-colors: active) { a[aria-current='page'] { border: 2px solid Highlight; } }\n `,\n ];\n\n private footerFilled = false;\n\n private onFooter(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this.footerFilled = slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim() !== '');\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n return html`\n <nav class=\"card\" aria-label=${this.label} part=\"nav\">\n <ul part=\"list\">\n ${this.items.map(\n (item) => html`\n <li>\n <a\n href=${item.href}\n part=\"link\"\n aria-current=${isCurrent(item.href, this.current) ? 'page' : nothing}\n @click=${(e: MouseEvent) => announceNavigate(this, e, item)}\n >${iconSvg(item.icon, '20px')}<span>${item.label}</span></a>\n </li>\n `,\n )}\n </ul>\n </nav>\n <div class=\"card footer ${this.footerFilled ? '' : 'empty'}\" part=\"footer\"><slot name=\"footer\" @slotchange=${this.onFooter}></slot></div>\n `;\n }\n}\n\n/**\n * A product's main navigation along the bottom of a phone screen: four or five\n * places, each an icon above a word.\n *\n * It follows the same rules as `impakt-side-nav`: the current place carries\n * `aria-current=\"page\"` and is filled, every item has a word, and\n * `impakt-navigate` lets an app route without a reload. Each item is at least\n * 48px tall, above the 24px floor of 2.5.8, because it is pressed with a thumb.\n *\n * @category action\n * @icon menu\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When an item is followed. Cancel it to route in the app instead of the browser.\n */\nexport class ImpaktTabBar extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n current: { type: String },\n };\n /** The places, in order. Four or five fit a phone. */\n declare items: ShellNavItem[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The path the person is on, from the app's router. Leave empty to use the address bar. */\n declare current: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Main';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n nav { padding: ${space(1.5)}; border-radius: ${t.radiusXl}; background: ${t.text}; box-shadow: ${t.shadowLg}; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; }\n li { flex: 1 1 0; min-inline-size: 0; }\n a {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: ${space(1)};\n min-block-size: 50px;\n padding: ${space(1)};\n border-radius: ${t.radiusLg};\n /* The resting items are a blend of the card and text colours that keeps 4.5:1 on the bar. */\n color: color-mix(in srgb, ${t.surfaceCard} 74%, ${t.text});\n font-size: 11px;\n font-weight: ${fontWeight('medium')};\n line-height: 1.25;\n text-decoration: none;\n text-align: center;\n }\n a:hover { color: ${t.surfaceCard}; }\n a[aria-current='page'] { background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 16%); color: ${t.surfaceCard}; }\n span.word { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n @media (forced-colors: active) { a[aria-current='page'] { border: 2px solid Highlight; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <nav aria-label=${this.label} part=\"nav\">\n <ul part=\"list\">\n ${this.items.map(\n (item) => html`\n <li>\n <a\n href=${item.href}\n part=\"link\"\n aria-current=${isCurrent(item.href, this.current) ? 'page' : nothing}\n @click=${(e: MouseEvent) => announceNavigate(this, e, item)}\n >${iconSvg(item.icon, '22px')}<span class=\"word\">${item.label}</span></a>\n </li>\n `,\n )}\n </ul>\n </nav>\n `;\n }\n}\n\n/**\n * The frame a signed-in product sits in, on a desktop and on a phone.\n *\n * On a desktop it is a rounded frame on a darker canvas, with the brand and\n * the side navigation on the left, a top bar along the top and the page's\n * content below it. On a phone the side navigation and the top bar step aside:\n * the page's own header sits on a dark band, the content rises over it on a\n * light sheet, and the tab bar floats at the bottom.\n *\n * **It gives the page its landmarks.** The content is the `main` landmark, the\n * top bar is a `header`, and a Skip to content link is the first thing a\n * keyboard reaches. The navigation elements bring their own `nav` landmarks.\n *\n * **Both navigations are in the page; only one is shown.** The side\n * navigation is hidden on a phone and the tab bar on a desktop, with\n * `display: none`, so a screen reader meets the one that is on screen.\n *\n * @category layout\n * @icon layout\n * @slot - The page's content.\n * @slot brand - The product's logo, at the top of the side.\n * @slot nav - The side navigation, an `impakt-side-nav`.\n * @slot workspace - The start of the top bar, such as the workspace's name.\n * @slot search - The middle of the top bar, such as a search field.\n * @slot actions - The end of the top bar: the main action and the account.\n * @slot phone-header - The page's header on a phone, on the dark band above the content.\n * @slot tab-bar - The phone navigation, an `impakt-tab-bar`.\n */\nexport class ImpaktAppShell extends ImpaktElement {\n static properties = {\n skipText: { type: String, attribute: 'skip-text' },\n topBarLabel: { type: String, attribute: 'top-bar-label' },\n };\n /** The words of the link that skips to the content. */\n declare skipText: string;\n /** What the top bar is called for a screen reader. Leave empty when there is only one top bar, as there usually is. */\n declare topBarLabel: string;\n\n constructor() {\n super();\n this.skipText = 'Skip to content';\n this.topBarLabel = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n min-block-size: 100svh;\n background: var(--impakt-shell-canvas, ${t.surfaceInset});\n color: ${t.text};\n /* The text and card colours, kept before the phone header turns them round. */\n --impakt-shell-ink: ${t.text};\n --impakt-shell-paper: ${t.surfaceCard};\n }\n .frame {\n position: relative;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: var(--impakt-shell-side, 190px) minmax(0, 1fr);\n grid-template-rows: auto 1fr;\n grid-template-areas: 'brand top' 'side main';\n gap: ${space(5)};\n min-block-size: calc(100svh - 2 * ${space(5)});\n margin: ${space(5)};\n padding: ${space(5)};\n border-radius: var(--impakt-shell-radius, 36px);\n background: ${token('color.surface.page', '#f2f5f4')};\n }\n .brand { grid-area: brand; display: flex; align-items: center; min-block-size: 52px; }\n .side { grid-area: side; display: flex; flex-direction: column; min-block-size: 0; }\n .side ::slotted(*) { flex: 1; }\n header { grid-area: top; display: flex; align-items: center; gap: ${space(5)}; min-inline-size: 0; }\n .workspace { flex: none; }\n .search { flex: 1 1 auto; display: flex; justify-content: center; min-inline-size: 0; }\n .search ::slotted(*) { inline-size: min(100%, 420px); }\n .actions { flex: none; display: flex; align-items: center; gap: ${space(3)}; }\n main { grid-area: main; min-inline-size: 0; }\n main:focus { outline: none; }\n .phone-header, .tab-bar { display: none; }\n .skip {\n position: absolute;\n inset-inline-start: ${space(2)};\n inset-block-start: ${space(2)};\n z-index: 20;\n padding: ${space(2)} ${space(4)};\n background: ${t.surfaceCard};\n color: ${t.link};\n border-radius: ${t.radius};\n transform: translateY(-200%);\n }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n\n @media (max-width: ${PHONE}) {\n :host { background: ${t.text}; }\n .frame {\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n border-radius: 0;\n min-block-size: 100svh;\n background: transparent;\n }\n .brand, .side, header { display: none; }\n /* The page's header sits on the dark band, so the elements slotted into it\n are given the card colour as their text colour. Custom properties\n inherit through the slot, so an impakt-heading or impakt-text there\n reads light without being told. */\n .phone-header {\n display: block;\n padding: calc(${space(4)} + env(safe-area-inset-top)) ${space(5)} ${space(10)};\n color: var(--impakt-shell-paper);\n --impakt-color-text-default: var(--impakt-shell-paper);\n --impakt-color-text-heading: var(--impakt-shell-paper);\n --impakt-color-text-muted: color-mix(in srgb, var(--impakt-shell-paper) 74%, var(--impakt-shell-ink));\n --impakt-color-link: var(--impakt-shell-paper);\n }\n main {\n position: relative;\n flex: 1;\n margin-block-start: calc(-1 * ${space(6)});\n /* Room for the floating tab bar, so the last of the content can scroll clear of it. */\n padding: ${space(4)} ${space(4)} calc(96px + env(safe-area-inset-bottom));\n border-radius: 28px 28px 0 0;\n background: ${token('color.surface.page', '#f2f5f4')};\n }\n .tab-bar {\n display: block;\n position: fixed;\n z-index: 10;\n inset-inline: ${space(4)};\n inset-block-end: calc(${space(3)} + env(safe-area-inset-bottom));\n }\n }\n `,\n ];\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n <div class=\"brand\" part=\"brand\"><slot name=\"brand\"></slot></div>\n <div class=\"side\" part=\"side\"><slot name=\"nav\"></slot></div>\n <header aria-label=${this.topBarLabel || nothing} part=\"top-bar\">\n <div class=\"workspace\"><slot name=\"workspace\"></slot></div>\n <div class=\"search\"><slot name=\"search\"></slot></div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </header>\n <div class=\"phone-header\" part=\"phone-header\"><slot name=\"phone-header\"></slot></div>\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><slot></slot></main>\n <div class=\"tab-bar\" part=\"tab-bar\"><slot name=\"tab-bar\"></slot></div>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-side-nav', ImpaktSideNav);\ncustomElements.define('impakt-tab-bar', ImpaktTabBar);\ncustomElements.define('impakt-app-shell', ImpaktAppShell);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-side-nav': ImpaktSideNav;\n 'impakt-tab-bar': ImpaktTabBar;\n 'impakt-app-shell': ImpaktAppShell;\n }\n}\n", "/**\n * The locale a component formats dates, numbers and money in: the language of\n * the page around it (ADR 0026). A delivered page sets `lang` on its root, or\n * on a part of the page in another language, and every component reads the\n * nearest one. English is British English, which is what Strata's sites wrote\n * before they had languages.\n */\nexport function pageLocale(el?: Element | null): string {\n const fromElement = el?.closest?.('[lang]')?.getAttribute('lang');\n const fromHost = !fromElement && el ? ((el.getRootNode?.() as ShadowRoot | undefined)?.host?.closest?.('[lang]')?.getAttribute('lang') ?? '') : '';\n const fromPage = typeof document !== 'undefined' ? document.documentElement.lang : '';\n const lang = (fromElement || fromHost || fromPage || '').trim();\n if (!lang || lang.toLowerCase() === 'en') return 'en-GB';\n return lang;\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { pageLocale } from '../base/locale';\nimport { iconSvg } from './icon';\n\n/** The light weight large numbers are set in, 300 when the theme does not say. */\nconst LIGHT = token('font.weight.light', '300');\n\n/**\n * A count with its name: \"UK 4\", \"Active import jobs 12\". A dashboard shows a\n * row of them.\n *\n * **The name comes before the number in the reading order.** A screen reader\n * says \"UK, 4\", which makes sense heard on its own; \"4, UK\" does not. With\n * `href` the whole tile is one link, named by the label, the value and the\n * caption together.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktStatTile extends ImpaktElement {\n static properties = {\n label: { type: String },\n value: { type: String },\n caption: { type: String },\n href: { type: String },\n tone: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n /** What is counted, such as \"UK\" or \"Active import jobs\". */\n declare label: string;\n /** The count or figure, such as \"4\". */\n declare value: string;\n /** A line under the figure, such as \"3 arriving in the next two weeks\". */\n declare caption: string;\n /** Where the tile goes when it is pressed, such as the list it counts. */\n declare href: string;\n /** `plain` is a quiet tile on a card; `brand` is the one figure a screen leads with. */\n declare tone: 'plain' | 'brand';\n /** `lg` sets the figure larger, for the lead figure. */\n declare size: 'md' | 'lg';\n\n constructor() {\n super();\n this.label = '';\n this.value = '';\n this.caption = '';\n this.href = '';\n this.tone = 'plain';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n .tile {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: ${space(1)};\n block-size: 100%;\n min-block-size: 84px;\n padding: ${space(3)} ${space(4)};\n border-radius: ${t.radiusLg};\n background: ${t.surfaceInset};\n color: ${t.text};\n text-decoration: none;\n }\n a.tile:hover { background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 5%); }\n .label { font-size: 11px; font-weight: ${fontWeight('medium')}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: ${t.textMuted}; }\n .value { margin-block-start: auto; font-size: 34px; line-height: 1.1; font-weight: ${LIGHT}; font-variant-numeric: tabular-nums; }\n .caption { font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n :host([size='lg']) .tile { min-block-size: 200px; padding: ${space(6)}; border-radius: ${t.radiusXl}; }\n :host([size='lg']) .label { font-size: ${fontSize('sm')}; letter-spacing: normal; text-transform: none; }\n :host([size='lg']) .value { font-size: 64px; line-height: 1; }\n :host([tone='brand']) .tile { background: ${t.brand}; color: ${t.onBrand}; }\n :host([tone='brand']) a.tile:hover { background: ${t.brandHover}; }\n :host([tone='brand']) .label, :host([tone='brand']) .caption { color: ${t.onBrand}; }\n @media (forced-colors: active) { .tile { border: 1px solid CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const inner = html`\n <span class=\"label\" part=\"label\">${this.label}</span>\n <span class=\"value\" part=\"value\">${this.value}</span>\n ${this.caption ? html`<span class=\"caption\" part=\"caption\">${this.caption}</span>` : nothing}\n `;\n return this.href ? html`<a class=\"tile\" href=${this.href} part=\"tile\">${inner}</a>` : html`<div class=\"tile\" part=\"tile\">${inner}</div>`;\n }\n}\n\n/**\n * A date as a small block of month and day: \"DEC 2\". It sits at the start of a\n * row, beside what happens on that date.\n *\n * **The full date is what a screen reader hears.** The short month and day are\n * hidden from it, and the date is read in full in the page's language, such as\n * \"2 December 2026\", because \"DEC 2\" said aloud is ambiguous.\n *\n * @category content\n * @icon calendar\n */\nexport class ImpaktDateTile extends ImpaktElement {\n static properties = {\n date: { type: String },\n tone: { type: String, reflect: true },\n };\n /** The date, as YYYY-MM-DD. */\n declare date: string;\n /** `brand` is filled with the brand colour; `plain` is a quiet tile. */\n declare tone: 'brand' | 'plain';\n\n constructor() {\n super();\n this.date = '';\n this.tone = 'brand';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-block; flex: none; }\n time {\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: 48px;\n block-size: 52px;\n border-radius: ${t.radiusLg};\n background: ${t.brand};\n color: ${t.onBrand};\n line-height: 1;\n }\n :host([tone='plain']) time { background: ${t.surfaceInset}; color: ${t.text}; }\n .month { font-size: 10px; font-weight: ${fontWeight('medium')}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; }\n .day { margin-block-start: ${space(1)}; font-size: 20px; font-weight: ${fontWeight('medium')}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { time { border: 1px solid CanvasText; } }\n `,\n ];\n\n private parts(): { month: string; day: string; full: string } | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(this.date ?? '');\n if (!match) return null;\n // Noon UTC, so no time zone moves the date to the day before or after.\n const when = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), 12));\n if (Number.isNaN(when.getTime())) return null;\n const locale = pageLocale(this);\n const say = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).format(when);\n return { month: say({ month: 'short' }).replace('.', ''), day: say({ day: 'numeric' }), full: say({ day: 'numeric', month: 'long', year: 'numeric' }) };\n }\n\n render(): TemplateResult {\n const parts = this.parts();\n if (!parts) return html`${nothing}`;\n return html`<time datetime=${this.date} part=\"tile\">\n <span class=\"month\" aria-hidden=\"true\">${parts.month}</span>\n <span class=\"day\" aria-hidden=\"true\">${parts.day}</span>\n <span class=\"sr-only\">${parts.full}</span>\n </time>`;\n }\n}\n\n/**\n * One line in a list: a title, a line of detail under it, and room at the\n * start and the end. It is the task with its tick, the job that needs\n * attention, the delivery with its date, the setting with its arrow.\n *\n * **With `href` the whole row is one target, without nesting controls in a\n * link.** The title is the link, and it is stretched over the row, so the row\n * can be pressed anywhere. Anything in the `end` slot, such as a button, sits\n * above the stretched link and stays its own control, because a button inside\n * a link is two controls a screen reader cannot tell apart (4.1.2).\n *\n * A chevron is drawn at the end of a row that is a link, as the sign that it\n * goes somewhere. Put rows in an element with `role=\"list\"` and give each\n * `role=\"listitem\"` when they are a list, so a screen reader says how many\n * there are.\n *\n * @category content\n * @icon list\n * @slot start - Before the title: a dot, a date tile, a checkbox.\n * @slot end - After the title: a badge, a button.\n */\nexport class ImpaktRow extends ImpaktElement {\n static properties = {\n heading: { type: String },\n meta: { type: String },\n href: { type: String },\n divided: { type: Boolean, reflect: true },\n muted: { type: Boolean, reflect: true },\n };\n /** The row's title. */\n declare heading: string;\n /** The line of detail under the title, such as \"CY-2026-00421 \u00B7 Due 20 Nov 2026\". */\n declare meta: string;\n /** Where the row goes when it is pressed. */\n declare href: string;\n /** Draw a hairline above the row, for rows stacked on a card. */\n declare divided: boolean;\n /** Set the title quieter, for something finished, such as a done task. */\n declare muted: boolean;\n\n constructor() {\n super();\n this.heading = '';\n this.meta = '';\n this.href = '';\n this.divided = false;\n this.muted = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n :host([divided]) .row { border-block-start: ${t.borderThin} solid ${t.hairline}; }\n .row { position: relative; display: flex; align-items: center; gap: ${space(3)}; padding-block: ${space(3)}; }\n .text { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: ${space(0.5)}; }\n .title { font-size: ${fontSize('md')}; font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([muted]) .title { color: ${t.textMuted}; font-weight: ${fontWeight('regular')}; }\n .meta { font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n a { color: inherit; text-decoration: none; }\n /* The link is stretched over the row, so the row is one target. */\n a::after { content: ''; position: absolute; inset: 0; border-radius: ${t.radius}; }\n a:focus-visible { outline: none; }\n a:focus-visible::after { box-shadow: ${t.focusShadow}; }\n .row:has(a):hover .title { text-decoration: underline; text-underline-offset: 0.2em; }\n .start, .end { flex: none; display: flex; align-items: center; gap: ${space(2)}; }\n .start.empty, .end.empty { display: none; }\n /* Controls at the end stay pressable above the stretched link. */\n .end { position: relative; z-index: 1; }\n .chevron { flex: none; color: ${t.textMuted}; }\n `,\n ];\n\n private filled = { start: false, end: false };\n\n private onSlot(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as 'start' | 'end';\n this.filled = {\n ...this.filled,\n [name]: slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim() !== ''),\n };\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const title = this.href\n ? html`<a class=\"title\" href=${this.href} part=\"link\">${this.heading}</a>`\n : html`<span class=\"title\" part=\"title\">${this.heading}</span>`;\n return html`<div class=\"row\" part=\"row\">\n <div class=\"start ${this.filled.start ? '' : 'empty'}\"><slot name=\"start\" @slotchange=${this.onSlot}></slot></div>\n <div class=\"text\">${title}${this.meta ? html`<span class=\"meta\" part=\"meta\">${this.meta}</span>` : nothing}</div>\n <div class=\"end ${this.filled.end ? '' : 'empty'}\"><slot name=\"end\" @slotchange=${this.onSlot}></slot></div>\n ${this.href ? html`<span class=\"chevron\" aria-hidden=\"true\">${iconSvg('chevron-right', '20px')}</span>` : nothing}\n </div>`;\n }\n}\n\n/**\n * A pressable filter: \"UK 4\", \"Completed 27\". A row of them narrows a list.\n *\n * **It is a toggle button.** It carries `aria-pressed`, so a screen reader says\n * whether the filter is on, and it is filled when it is on, so that does not\n * rest on colour alone (1.4.1). When only one filter in a row can be on, the\n * app turns the others off when it hears `impakt-change`.\n *\n * The count is read with the label. Set `count-label` when the number needs its\n * noun to make sense aloud, such as \"4 jobs\".\n *\n * @category action\n * @icon badge\n * @fires {CustomEvent<{ pressed: boolean }>} impakt-change - When the filter is turned on or off.\n */\nexport class ImpaktFilterChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n count: { type: Number },\n countLabel: { type: String, attribute: 'count-label' },\n pressed: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n declare label: string;\n /** How many things the filter would show. Left out when not set. */\n declare count: number | undefined;\n /** The count in words for a screen reader, such as \"4 jobs\". The number alone when empty. */\n declare countLabel: string;\n declare pressed: boolean;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.label = '';\n this.count = undefined;\n this.countLabel = '';\n this.pressed = false;\n this.disabled = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button'),\n css`\n :host { display: inline-block; }\n /* The containing block for the words kept for screen readers, so a control scrolled out of a row cannot widen the page. */\n button {\n ${targetSize}\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: ${space(2)};\n min-block-size: 36px;\n padding: 0 ${space(3.5)};\n font: inherit;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.hairline};\n border-radius: 999px;\n cursor: pointer;\n white-space: nowrap;\n }\n button:hover:not(:disabled) { background: ${t.surfaceInset}; }\n button[aria-pressed='true'] { background: ${t.text}; color: ${t.surfaceCard}; border-color: ${t.text}; }\n button:disabled { cursor: not-allowed; opacity: 0.5; }\n .count { font-variant-numeric: tabular-nums; color: ${t.textMuted}; }\n button[aria-pressed='true'] .count { color: inherit; opacity: 0.8; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { button[aria-pressed='true'] { border: 2px solid Highlight; } }\n `,\n ];\n\n private toggle(): void {\n if (this.disabled) return;\n this.pressed = !this.pressed;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { pressed: this.pressed }, bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const hasCount = typeof this.count === 'number' && !Number.isNaN(this.count);\n return html`<button type=\"button\" part=\"button\" aria-pressed=${this.pressed ? 'true' : 'false'} ?disabled=${this.disabled} @click=${this.toggle}>\n <span>${this.label}</span>\n ${\n hasCount\n ? this.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${this.count}</span><span class=\"sr-only\">${this.countLabel}</span>`\n : html`<span class=\"count\">${this.count}</span>`\n : nothing\n }\n </button>`;\n }\n}\n\ncustomElements.define('impakt-stat-tile', ImpaktStatTile);\ncustomElements.define('impakt-date-tile', ImpaktDateTile);\ncustomElements.define('impakt-row', ImpaktRow);\ncustomElements.define('impakt-filter-chip', ImpaktFilterChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stat-tile': ImpaktStatTile;\n 'impakt-date-tile': ImpaktDateTile;\n 'impakt-row': ImpaktRow;\n 'impakt-filter-chip': ImpaktFilterChip;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * An on and off setting that takes effect at once: \"Show to customer\",\n * \"Visible to customer\".\n *\n * **It is a checkbox with the switch role.** A native\n * `<input type=\"checkbox\" role=\"switch\">` keeps Space to toggle, form\n * submission and the label's hit area, and the role makes a screen reader say\n * \"on\" and \"off\" rather than \"checked\". A switch is for a setting that applies\n * straight away. When the choice is only sent with a form, use\n * `impakt-checkbox` instead.\n *\n * **The state is not carried by colour alone.** The knob moves from one end of\n * the track to the other, so the position says on or off without the fill\n * (1.4.1).\n *\n * **Set `hide-label` in a row that already names the setting**, such as a\n * table row whose first cell says what is being switched. The label stays the\n * switch's accessible name.\n *\n * @category form\n * @icon checkbox\n * @fires {CustomEvent<{ value: string; checked: boolean }>} impakt-change - When it is switched. detail.checked says whether it is now on, and detail.value is the form value, \"on\" or empty.\n */\nexport class ImpaktSwitch extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n };\n\n declare checked: boolean;\n /** Keep the label for screen readers only, when the row around it already names the setting. */\n declare hideLabel: boolean;\n\n constructor() {\n super();\n this.checked = false;\n this.hideLabel = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n cursor: pointer;\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([hide-label]) .row {\n justify-content: flex-start;\n }\n :host([hide-label]) .text {\n ${visuallyHidden}\n }\n .control {\n position: relative;\n flex: none;\n inline-size: 46px;\n block-size: 28px;\n }\n input {\n ${targetSize}\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n .track {\n position: absolute;\n inset: 0;\n border-radius: 999px;\n background: ${t.borderStrong};\n transition: background-color 120ms ease-in-out;\n pointer-events: none;\n }\n .knob {\n position: absolute;\n inset-block-start: 3px;\n inset-inline-start: 3px;\n inline-size: 22px;\n block-size: 22px;\n border-radius: 999px;\n background: ${t.surfaceCard};\n box-shadow: ${t.shadowXs};\n transition: transform 120ms ease-in-out;\n }\n :host([checked]) .track {\n background: ${t.brand};\n }\n :host([checked]) .knob {\n transform: translateX(18px);\n }\n :host(:dir(rtl)[checked]) .knob {\n transform: translateX(-18px);\n }\n input:focus-visible + .track {\n box-shadow: ${t.focusShadow};\n }\n input:disabled {\n cursor: not-allowed;\n }\n :host([disabled]) .track {\n opacity: 0.5;\n }\n @media (prefers-reduced-motion: reduce) {\n .track, .knob { transition: none; }\n }\n @media (forced-colors: active) {\n .track { border: 1px solid CanvasText; }\n .knob { background: CanvasText; }\n :host([checked]) .track { background: Highlight; }\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <span class=\"text\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </span>\n <span class=\"control\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n aria-checked=${this.checked ? 'true' : 'false'}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"track\" part=\"track\"><span class=\"knob\" part=\"knob\"></span></span>\n </span>\n </label>\n `;\n }\n\n /** Whether it is on, so a handler need not read \"on\" or an empty string. */\n protected changeDetail(value: string): { value: string; checked: boolean } {\n return { value, checked: this.checked };\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\nexport interface SegmentOption {\n value: string;\n label: string;\n}\n\n/**\n * Two to four choices drawn as one joined control: \"Internal\" or \"Visible to\n * customer\", \"Cost\" or \"Charge\".\n *\n * **It is a radio group underneath.** Native radios sharing a name give arrow\n * keys, one tab stop and the right announcement with no script, exactly as in\n * `impakt-radio-group`. Only the drawing differs. The label is a `<legend>`, so\n * the question is asked of the set; set `hide-label` when the words around it\n * already ask it, and the legend stays for screen readers.\n *\n * @category form\n * @icon radio\n */\nexport class ImpaktSegmentedControl extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n full: { type: Boolean, reflect: true },\n };\n\n declare options: SegmentOption[];\n /** Keep the question for screen readers only, when the words around it already ask it. */\n declare hideLabel: boolean;\n /** As wide as its space, with the segments sharing it equally. */\n declare full: boolean;\n\n constructor() {\n super();\n this.options = [];\n this.hideLabel = false;\n this.full = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n :host([hide-label]) legend {\n ${visuallyHidden}\n }\n .segments {\n display: inline-flex;\n gap: ${space(1)};\n padding: ${space(1)};\n border-radius: 999px;\n background: ${t.surfaceInset};\n }\n :host([full]) .segments {\n display: flex;\n }\n :host([full]) .segment {\n flex: 1;\n }\n .segment {\n position: relative;\n display: inline-flex;\n }\n input {\n ${targetSize}\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n .face {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: 100%;\n min-block-size: 32px;\n padding: ${space(1.5)} ${space(4)};\n border-radius: 999px;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n color: ${t.textMuted};\n pointer-events: none;\n transition: background-color 120ms ease-in-out, color 120ms ease-in-out;\n }\n .segment:hover .face {\n color: ${t.text};\n }\n input:checked + .face {\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: ${t.shadowXs};\n }\n input:focus-visible + .face {\n box-shadow: ${t.focusShadow};\n }\n input:disabled {\n cursor: not-allowed;\n }\n :host([disabled]) .segments {\n opacity: 0.5;\n }\n @media (prefers-reduced-motion: reduce) {\n .face { transition: none; }\n }\n @media (forced-colors: active) {\n .segments { border: 1px solid CanvasText; }\n input:checked + .face { border: 2px solid Highlight; }\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"segments\" part=\"segments\">\n ${this.options.map((option, i) => {\n const id = this.id_(`seg-${i}`);\n return html`\n <label class=\"segment\" part=\"segment\" for=${id}>\n <input\n type=\"radio\"\n id=${id}\n name=${this.uid}\n value=${option.value}\n .checked=${this.value === option.value}\n ?disabled=${this.disabled}\n ?required=${this.required && i === 0}\n @change=${() => {\n this.value = option.value;\n this.setFormValue(option.value);\n }}\n />\n <span class=\"face\">${option.label}</span>\n </label>\n `;\n })}\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset\n part=\"fieldset\"\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n >\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-switch', ImpaktSwitch);\ncustomElements.define('impakt-segmented-control', ImpaktSegmentedControl);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-switch': ImpaktSwitch;\n 'impakt-segmented-control': ImpaktSegmentedControl;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface RadioOption {\n value: string;\n label: string;\n description?: string;\n}\n\n/**\n * A choose-one group.\n *\n * **It renders native radios, and that is the whole design.** A group of\n * `<input type=\"radio\">` sharing a name already has roving tabindex, arrow-key\n * navigation that wraps, Home and End, selection-follows-focus, and the right\n * announcement in every screen reader \u2014 all of it, correctly, with no\n * JavaScript. Hand-rolling that is the single most commonly attempted and most\n * commonly botched widget in any design system, and every version of it is a\n * worse version of what the platform ships.\n *\n * Because the radios share one shadow root, their `name` scopes to this\n * component and cannot collide with another group on the page.\n *\n * The label is a `<legend>` inside a `<fieldset>`, not a `<label for>`:\n * `for` names one control, and the question here is asked of the set.\n\n *\n * @category form\n * @icon radio\n */\nexport class ImpaktRadioGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n };\n\n declare options: RadioOption[];\n\n constructor() {\n super();\n this.options = [];\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .option {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n padding: ${space(3)};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n margin-block-end: ${space(2)};\n cursor: pointer;\n }\n .option:hover {\n background: ${t.surfaceSubtle};\n }\n /* The whole row is the target, not the 20px dot \u2014 2.5.8 is a floor and\n a comfortable target is the actual goal. */\n .option input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .option-text {\n display: block;\n font-size: ${fontSize('md')};\n }\n .option-description {\n display: block;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n margin-block-start: ${space(1)};\n }\n :host([invalid]) .option {\n border-color: ${t.danger};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n protected renderControl(): TemplateResult {\n return html`\n ${this.options.map((option, i) => {\n const id = this.id_(`opt-${i}`);\n const descId = option.description ? this.id_(`opt-${i}-desc`) : undefined;\n return html`\n <label class=\"option\" part=\"option\" for=${id}>\n <input\n type=\"radio\"\n id=${id}\n name=${this.uid}\n value=${option.value}\n .checked=${this.value === option.value}\n ?disabled=${this.disabled}\n ?required=${this.required && i === 0}\n aria-describedby=${descId ?? nothing}\n @change=${() => this.setFormValue(option.value)}\n />\n <span>\n <span class=\"option-text\">${option.label}</span>\n ${option.description ? html`<span class=\"option-description\" id=${descId!}>${option.description}</span>` : nothing}\n </span>\n </label>\n `;\n })}\n `;\n }\n\n /**\n * The fieldset wraps everything, so the whole field is rebuilt here rather\n * than relying on the base class's flat order.\n */\n render(): TemplateResult {\n return html`\n <fieldset\n part=\"fieldset\"\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n >\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">\n ${this.error || nothing}\n </div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-radio-group', ImpaktRadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-radio-group': ImpaktRadioGroup;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out \u2014 at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpaktAlert extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || say(ImpaktAlert.TONE_WORDS[this.tone]);\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${\n this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing\n }\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-alert', ImpaktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-alert': ImpaktAlert;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { visuallyHidden as hiddenStyle } from '../base/styles';\nimport { fontSize, fontWeight, lineHeight, space, spaceAround, t, type } from '../base/tokens';\n\n/**\n * Layout and typography primitives.\n *\n * These are the components a composition is mostly made of, and they are\n * deliberately dull. Their one job is that spacing, type and colour come from\n * tokens, so that a page built in the CMS cannot contain a hard-coded 13px.\n */\n\n/** Vertical rhythm. Every gap is a spacing token, never a number.\n *\n * @category layout\n * @icon stack\n * @slot - The things being stacked.\n */\nexport class ImpaktStack extends ImpaktElement {\n static properties = {\n gap: { type: String, reflect: true },\n align: { type: String, reflect: true },\n direction: { type: String, reflect: true },\n justify: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare gap: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** How the items line up across the stack. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Down the page, or along a row that wraps when it runs out of room, such as a row of buttons. */\n declare direction: 'vertical' | 'horizontal';\n /** Where the items sit along a row. */\n declare justify: 'start' | 'center' | 'end' | 'between';\n /** Space before the stack, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the stack, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.gap = 'md';\n this.align = 'stretch';\n this.direction = 'vertical';\n this.justify = 'start';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n :host([gap='none']) { gap: 0; }\n :host([gap='xs']) { gap: ${space(1)}; }\n :host([align='start']) { align-items: flex-start; }\n :host([align='center']) { align-items: center; text-align: center; }\n :host([align='end']) { align-items: flex-end; }\n :host([direction='horizontal']) { flex-direction: row; flex-wrap: wrap; align-items: center; }\n :host([direction='horizontal'][align='start']) { align-items: flex-start; }\n :host([direction='horizontal'][align='end']) { align-items: flex-end; }\n :host([direction='horizontal'][align='center']) { text-align: start; }\n :host([justify='center']) { justify-content: center; }\n :host([justify='end']) { justify-content: flex-end; }\n :host([justify='between']) { justify-content: space-between; }\n :host([gap='sm']) { gap: ${space(2)}; }\n :host([gap='md']) { gap: ${space(4)}; }\n :host([gap='lg']) { gap: ${space(6)}; }\n :host([gap='xl']) { gap: ${space(8)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** A surface. What text is read against, and what contrast is measured from.\n *\n * @category layout\n * @icon card\n * @slot - What sits on the card.\n */\nexport class ImpaktCard extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n imageSrc: { type: String, attribute: 'image-src' },\n imageAlt: { type: String, attribute: 'image-alt' },\n ratio: { type: String, reflect: true },\n badge: { type: String },\n raised: { type: Boolean, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The card's surface. Text on a brand card takes the brand's text colour. */\n declare tone: 'default' | 'subtle' | 'brand' | 'outline' | 'plain';\n /** Space inside the card. */\n declare padding: 'none' | 'sm' | 'md' | 'lg';\n /** A picture across the top of the card. */\n declare imageSrc: string;\n /** What the picture shows. Leave empty only when it is decoration. */\n declare imageAlt: string;\n /** A short label on the picture, such as \"3 left\". */\n declare badge: string;\n /** The picture's shape. */\n declare ratio: '16:9' | '4:3' | '3:2' | '1:1';\n /** Lifted off the page with a soft shadow and no edge, as a form that floats beside its words is. */\n declare raised: boolean;\n /** Space before the card, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the card, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'default';\n this.padding = 'lg';\n this.imageSrc = '';\n this.imageAlt = '';\n this.ratio = '16:9';\n this.badge = '';\n this.raised = false;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.hairline};\n border-radius: ${t.radiusXl};\n box-shadow: ${t.shadowSm};\n overflow: hidden;\n --ratio: 16 / 9;\n }\n :host([tone='subtle']) { background: ${t.surfaceSubtle}; border-color: transparent; box-shadow: none; }\n :host([tone='brand']) { background: ${t.brand}; border-color: transparent; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; }\n :host([tone='outline']) { background: transparent; box-shadow: none; border-color: ${t.rule}; }\n :host([raised]) { border-color: transparent; box-shadow: 0 24px 60px rgb(16 19 23 / 12%), 0 2px 6px rgb(16 19 23 / 6%); border-radius: ${t.radius2xl}; }\n :host([tone='plain']) { background: transparent; border-color: transparent; border-radius: 0; box-shadow: none; }\n :host([ratio='4:3']) { --ratio: 4 / 3; }\n :host([ratio='3:2']) { --ratio: 3 / 2; }\n :host([ratio='1:1']) { --ratio: 1 / 1; }\n .body { padding: ${space(6)}; flex: 1; display: flex; flex-direction: column; }\n :host([padding='none']) .body { padding: 0; }\n :host([padding='sm']) .body { padding: ${space(3)}; }\n :host([padding='md']) .body { padding: ${space(4)}; }\n :host([tone='plain']) .body { padding-inline: 0; }\n img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }\n .picture { position: relative; }\n .tag { position: absolute; inset-block-start: ${space(4)}; inset-inline-start: ${space(4)}; padding: ${space(1.5)} ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: 999px; }\n @media (forced-colors: active) { :host { border-color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`${this.imageSrc ? html`<div class=\"picture\"><img src=${this.imageSrc} alt=${this.imageAlt} part=\"image\" />${this.badge ? html`<span class=\"tag\">${this.badge}</span>` : nothing}</div>` : nothing}<div class=\"body\" part=\"body\"><slot></slot></div>`;\n }\n}\n\n/**\n * A heading.\n *\n * `level` is required and renders the matching `<h1>`\u2013`<h6>`, because heading\n * level is document structure rather than appearance: a screen-reader user\n * navigates by it, and a page whose levels skip is a page they cannot skim.\n * Size is a separate property, so a visually small `<h2>` needs no lie about\n * its level \u2014 which is the usual reason levels end up wrong.\n\n *\n * @category typography\n * @icon heading\n * @role heading\n * @slot - The heading text.\n */\nexport class ImpaktHeading extends ImpaktElement {\n static properties = {\n level: { type: Number, reflect: true },\n size: { type: String, reflect: true },\n eyebrow: { type: String, reflect: true },\n align: { type: String, reflect: true },\n screenReaderOnly: { type: Boolean, reflect: true, attribute: 'screen-reader-only' },\n };\n\n declare level: 1 | 2 | 3 | 4 | 5 | 6;\n declare size: '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm';\n /** A short label above the heading, such as \"Why Larkfield\". Part of the heading, read before it. */\n declare eyebrow: string;\n declare align: 'start' | 'center';\n /**\n * Read by screen readers and search engines, but not drawn: for a heading\n * whose words are already in a picture, such as a hero drawn as artwork.\n * The page still has its heading; nobody sees it twice. An eyebrow still shows.\n */\n declare screenReaderOnly: boolean;\n\n constructor() {\n super();\n this.level = 2;\n this.size = 'xl';\n this.eyebrow = '';\n this.align = 'start';\n this.screenReaderOnly = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n color: ${t.textHeading};\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n line-height: ${lineHeight('tight')};\n }\n :host([size='5xl']) { ${type('5xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='4xl']) { ${type('4xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='3xl']) { ${type('3xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='2xl']) { ${type('2xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='xl']) { ${type('xl')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='md']) { ${type('md')} }\n :host([size='sm']) { ${type('sm')} }\n .h { text-wrap: balance; }\n .h {\n margin: 0;\n font: inherit;\n color: inherit;\n }\n :host([align='center']) { text-align: center; }\n /* Only the words go: an eyebrow over a heading drawn as a picture still shows. */\n :host([screen-reader-only]) .words { ${hiddenStyle} }\n :host([screen-reader-only]:not([eyebrow])) { ${hiddenStyle} }\n .eyebrow {\n display: block;\n margin-block-end: ${space(2)};\n color: var(--impakt-eyebrow, var(--impakt-color-text-eyebrow, ${t.brand}));\n font-family: var(--impakt-font-family-eyebrow, ${t.fontBody});\n font-size: var(--impakt-font-size-eyebrow, ${fontSize('sm')});\n font-weight: var(--impakt-font-weight-eyebrow, ${fontWeight('semibold')});\n letter-spacing: 0.06em;\n text-transform: uppercase;\n }\n `,\n ];\n\n render(): TemplateResult {\n // A `role=\"heading\"` with `aria-level` rather than six branches of\n // template. The native element would be marginally better; this is the one\n // place where Lit's lack of a dynamic tag makes the explicit role the\n // honest trade, and the role is fully supported.\n return html`<div class=\"h\" role=\"heading\" aria-level=${this.level} part=\"heading\">\n ${this.eyebrow ? html`<span class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}<span style=\"position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)\">: </span></span>` : nothing}<span class=\"words\"><slot></slot></span>\n </div>`;\n }\n}\n\n/** A paragraph.\n *\n * @category typography\n * @icon text\n * @slot - The paragraph text.\n */\nexport class ImpaktText extends ImpaktElement {\n static properties = {\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n align: { type: String, reflect: true },\n look: { type: String, reflect: true },\n };\n\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'default' | 'muted';\n declare align: 'start' | 'center';\n /** `code` sets the words in the brand's monospace face on a faint panel, for a line like \"base: main \u2190 compare: you/idea\". */\n declare look: 'prose' | 'code';\n\n constructor() {\n super();\n this.size = 'md';\n this.tone = 'default';\n this.align = 'start';\n this.look = 'prose';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n /* 1.4.8 asks for 1.5 within a paragraph, and it is the default here\n rather than an option, because body text is what it is about. */\n line-height: ${lineHeight('normal')};\n /* 1.4.12 Text Spacing: a user stylesheet must be able to widen this\n without clipping, which a max-width in ch units survives and a\n fixed pixel height does not. */\n max-inline-size: 70ch;\n }\n :host([size='sm']) { ${type('sm')} }\n :host([size='md']) { ${type('md')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='xl']) { ${type('xl')} }\n p { text-wrap: pretty; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n :host([align='center']) { text-align: center; margin-inline: auto; }\n :host([look='code']) { font-family: ${t.fontMono}; ${type('sm')} padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 6%, transparent); max-inline-size: none; }\n p {\n margin: 0;\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`<p part=\"text\"><slot></slot></p>`;\n }\n}\n\ncustomElements.define('impakt-stack', ImpaktStack);\ncustomElements.define('impakt-card', ImpaktCard);\ncustomElements.define('impakt-heading', ImpaktHeading);\ncustomElements.define('impakt-text', ImpaktText);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stack': ImpaktStack;\n 'impakt-card': ImpaktCard;\n 'impakt-heading': ImpaktHeading;\n 'impakt-text': ImpaktText;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A link.\n *\n * **A new tab is always announced.** When `external` is set, the accessible\n * name gains \"opens in a new tab\" \u2014 not as a tooltip, which no screen reader\n * reads, and not as an icon alone, which carries no text. An unannounced new\n * tab breaks the back button for someone who cannot see that the window\n * changed, and that is what 3.2.5 is about.\n *\n * **It is underlined.** 1.4.1 Use of Colour: a link distinguished from body\n * text only by being a different colour is not distinguished at all for a\n * reader who cannot tell the two colours apart.\n\n *\n * @category action\n * @icon link\n * @slot - The link text.\n */\nexport class ImpaktLink extends ImpaktElement {\n static properties = {\n href: { type: String },\n external: { type: Boolean, reflect: true },\n externalText: { type: String, attribute: 'external-text' },\n variant: { type: String, reflect: true },\n icon: { type: String },\n };\n\n declare href: string;\n declare external: boolean;\n declare externalText: string;\n /** In a sentence, or on its own line as a call to action, bolder and with an arrow. */\n declare variant: 'inline' | 'standalone';\n /** An icon after the words. A standalone link has an arrow unless it says otherwise. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n\n constructor() {\n super();\n this.href = '';\n this.external = false;\n this.externalText = 'opens in a new tab';\n this.variant = 'inline';\n this.icon = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: inline;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n border-radius: ${t.radiusSm};\n }\n a:hover {\n color: ${t.linkHover};\n }\n :host([variant='standalone']) { display: inline-block; }\n :host([variant='standalone']) a { display: inline-flex; align-items: center; gap: ${space(1)}; font-weight: ${fontWeight('semibold')}; text-decoration-thickness: 1px; }\n :host([variant='standalone']) a:hover .icon { transform: translateX(2px); }\n .icon { flex: none; transition: transform 120ms ease-in-out; }\n .sr-only {\n ${visuallyHidden}\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <a\n part=\"link\"\n href=${this.href || nothing}\n target=${this.external ? '_blank' : nothing}\n rel=${this.external ? 'noopener noreferrer' : nothing}\n >\n <slot></slot>${iconSvg(this.icon !== 'none' ? this.icon : this.variant === 'standalone' ? (this.external ? 'external' : 'arrow-right') : undefined, '1em')}${this.external ? html`<span class=\"sr-only\"> (${this.externalText})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impakt-link', ImpaktLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-link': ImpaktLink;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * An image.\n *\n * `alt` is required and may be the empty string, which is a decision rather\n * than laxity: an empty alt is the correct and only way to mark an image as\n * decorative, and a missing alt is a different thing entirely \u2014 it leaves a\n * screen reader to read the file name. Making the property required forces the\n * author to say which they meant.\n *\n * `width` and `height` are the intrinsic pixel size. Without them the browser\n * cannot reserve space and the page jumps as each image loads, which is a\n * usability problem for everyone and a serious one for anyone using a screen\n * magnifier, who loses their place entirely.\n\n *\n * @category media\n * @icon image\n * @role image\n */\nexport class ImpaktImage extends ImpaktElement {\n static properties = {\n src: { type: String },\n alt: { type: String },\n decorative: { type: Boolean, reflect: true },\n width: { type: Number },\n height: { type: Number },\n focalX: { type: Number, attribute: 'focal-x' },\n focalY: { type: Number, attribute: 'focal-y' },\n loading: { type: String },\n ratio: { type: String, reflect: true },\n rounded: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n\n /**\n * Leave it out on a phone, or on anything wider, for a picture drawn twice:\n * once for a wide screen and once for a narrow one. Never both.\n */\n declare hideOn: 'never' | 'phone' | 'wide';\n declare src: string;\n declare alt: string;\n /**\n * This image says nothing a reader needs.\n *\n * An empty `alt` is the correct way to mark a decorative image AND what a\n * missing one looks like, so the two are indistinguishable to anything\n * downstream \u2014 which is why the commonest accessibility failure on the web\n * survives every automated check. Only the author knows which they meant,\n * so this is where they say it, and the publish gate holds them to it.\n */\n declare decorative: boolean;\n declare width: number | undefined;\n declare height: number | undefined;\n /** The fraction of the image that must survive a crop. */\n declare focalX: number;\n declare focalY: number;\n declare loading: 'lazy' | 'eager';\n /** The picture's shape. It is cropped to fit, keeping the focal point in view. */\n declare ratio: 'natural' | '16:9' | '4:3' | '3:2' | '1:1';\n /** How round the corners are. */\n declare rounded: 'none' | 'sm' | 'lg' | 'full';\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.ratio = 'natural';\n this.rounded = 'none';\n this.src = '';\n this.alt = '';\n this.decorative = false;\n this.width = undefined;\n this.height = undefined;\n this.focalX = 0.5;\n this.focalY = 0.5;\n this.loading = 'lazy';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }\n :host {\n display: block;\n }\n img {\n display: block;\n max-inline-size: 100%;\n block-size: auto;\n object-fit: cover;\n }\n :host(:not([ratio='natural'])) img { inline-size: 100%; }\n :host([ratio='16:9']) img { aspect-ratio: 16 / 9; }\n :host([ratio='4:3']) img { aspect-ratio: 4 / 3; }\n :host([ratio='3:2']) img { aspect-ratio: 3 / 2; }\n :host([ratio='1:1']) img { aspect-ratio: 1 / 1; }\n :host([rounded='sm']) img { border-radius: ${t.radius}; }\n :host([rounded='lg']) img { border-radius: ${t.radiusLg}; }\n :host([rounded='full']) img { border-radius: 50%; }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <img\n part=\"image\"\n src=${this.src}\n alt=${this.decorative ? '' : this.alt}\n role=${this.decorative ? 'presentation' : nothing}\n width=${this.width ?? nothing}\n height=${this.height ?? nothing}\n loading=${this.loading}\n style=\"object-position: ${this.focalX * 100}% ${this.focalY * 100}%\"\n />\n `;\n }\n}\n\n/**\n * The partner's logo.\n *\n * Separate from `impakt-image` for one reason: it is the most prominent image on\n * every page and its alt text is the brand name, so it should not be possible\n * to ship it with an empty alt by copying a decorative image. `src` and `alt`\n * come from the brand's assets.\n *\n * `on-dark` picks the dark-surface variant where the brand supplies one. A\n * logo that disappears into a dark footer is not a styling problem, it is a\n * missing piece of information.\n\n *\n * @category media\n * @icon logo\n */\nexport class ImpaktLogo extends ImpaktElement {\n static properties = {\n src: { type: String },\n srcDark: { type: String, attribute: 'src-dark' },\n alt: { type: String },\n onDark: { type: Boolean, attribute: 'on-dark', reflect: true },\n height: { type: Number },\n };\n\n declare src: string;\n declare srcDark: string;\n declare alt: string;\n declare onDark: boolean;\n declare height: number;\n\n constructor() {\n super();\n this.src = '';\n this.srcDark = '';\n this.alt = '';\n this.onDark = false;\n this.height = 32;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-block;\n }\n img {\n display: block;\n inline-size: auto;\n }\n `,\n ];\n\n render(): TemplateResult {\n const src = this.onDark && this.srcDark ? this.srcDark : this.src;\n return html`<img part=\"logo\" src=${src} alt=${this.alt} style=\"height: ${this.height}px\" />`;\n }\n}\n\n/**\n * A downloadable document \u2014 terms of service, a product sheet, a price list.\n *\n * The file type and size are part of the accessible name, not decoration\n * beside it. A list of links all named \"Download\" fails 2.4.4 Link Purpose,\n * and a reader tabbing between them cannot tell which document they are on.\n\n *\n * @category media\n * @icon document\n */\nexport class ImpaktDocumentLink extends ImpaktElement {\n static properties = {\n href: { type: String },\n label: { type: String },\n fileType: { type: String, attribute: 'file-type' },\n byteSize: { type: Number, attribute: 'byte-size' },\n };\n\n declare href: string;\n declare label: string;\n declare fileType: string;\n declare byteSize: number | undefined;\n\n constructor() {\n super();\n this.href = '';\n this.label = '';\n this.fileType = '';\n this.byteSize = undefined;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n gap: 0.5ch;\n align-items: baseline;\n min-block-size: ${t.targetMin};\n }\n .meta {\n color: ${t.textMuted};\n }\n `,\n ];\n\n /** \"240 KB\". Rounded, because the exact byte count helps nobody. */\n private get size(): string {\n if (!this.byteSize) return '';\n const kb = this.byteSize / 1024;\n return kb >= 1024 ? `${(kb / 1024).toFixed(1)} MB` : `${Math.round(kb)} KB`;\n }\n\n render(): TemplateResult {\n const meta = [this.fileType, this.size].filter(Boolean).join(', ');\n return html`\n <a part=\"link\" href=${this.href || nothing} download>\n <span>${this.label}</span>${meta ? html`<span class=\"meta\">(${meta})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impakt-image', ImpaktImage);\ncustomElements.define('impakt-logo', ImpaktLogo);\ncustomElements.define('impakt-document-link', ImpaktDocumentLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-image': ImpaktImage;\n 'impakt-logo': ImpaktLogo;\n 'impakt-document-link': ImpaktDocumentLink;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A money amount.\n *\n * This component exists because of a decision taken in the content model: a\n * binding names a source and cannot compute\n * ([ADR 0003](https://github.com/matthill8286/strata/blob/main/docs/decisions/0003-binding-expressions.md)). The\n * consequence is that formatting lives here, where the locale and the currency\n * are known, rather than in authored content \u2014 so there is one place that\n * decides what \"\u00A324.99\" looks like, and nobody writes a format string into a\n * CMS field.\n *\n * **The amount is one text node.** Splitting the pounds and the pence into\n * separate elements for typographic effect makes some screen readers read them\n * as two numbers, and \"twenty-four ninety-nine\" becomes \"twenty four, ninety\n * nine\". The visual emphasis is done with CSS over one node instead.\n *\n * **Minor units in, major units out.** `amount` is in pence, because a price\n * that arrives from a pricing API as a float has already lost money to binary\n * rounding before it reaches the screen.\n\n *\n * @category content\n * @icon price\n */\nexport class ImpaktPrice extends ImpaktElement {\n static properties = {\n amount: { type: Number },\n currency: { type: String },\n locale: { type: String },\n prefix: { type: String },\n period: { type: String },\n size: { type: String, reflect: true },\n pending: { type: String },\n };\n\n /** In minor units \u2014 pence, cents. */\n declare amount: number | undefined;\n declare currency: string;\n declare locale: string;\n /** \"From\", \"Guide\". Read before the amount. */\n declare prefix: string;\n /** \"a month\", \"a year\". Read after the amount. */\n declare period: string;\n declare size: 'md' | 'lg' | 'xl';\n /** Shown while there is no amount yet. A price takes seconds to arrive. */\n declare pending: string;\n\n constructor() {\n super();\n this.amount = undefined;\n this.currency = 'GBP';\n this.locale = '';\n this.prefix = '';\n this.period = '';\n this.size = 'xl';\n this.pending = '\u2014';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-flex;\n align-items: baseline;\n gap: ${space(1)};\n color: ${t.text};\n }\n .amount {\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n /* Tabular figures so a price does not reflow as the digits change,\n which otherwise makes a recalculating price jitter. */\n font-variant-numeric: tabular-nums;\n }\n :host([size='md']) .amount { font-size: ${fontSize('lg')}; }\n :host([size='lg']) .amount { font-size: ${fontSize('2xl')}; }\n :host([size='xl']) .amount { font-size: ${fontSize('3xl')}; }\n .period {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n `,\n ];\n\n private get formatted(): string {\n if (this.amount === undefined || Number.isNaN(this.amount)) return this.pending;\n try {\n return new Intl.NumberFormat(this.locale || pageLocale(this), {\n style: 'currency',\n currency: this.currency,\n // A house price reads as \u00A3385,000. Pence only mean something on small amounts.\n ...(this.amount >= 100000 && this.amount % 100 === 0 ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : {}),\n }).format(this.amount / 100);\n } catch {\n // An unknown currency or locale must not take the page down. The number\n // is still the most useful thing on the screen.\n return (this.amount / 100).toFixed(2);\n }\n }\n\n render(): TemplateResult {\n return html`\n ${this.prefix ? html`<span class=\"period\" part=\"prefix\">${this.prefix}</span>` : nothing}\n <span class=\"amount\" part=\"amount\">${this.formatted}</span>\n ${this.period ? html`<span class=\"period\" part=\"period\">${this.period}</span>` : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-price', ImpaktPrice);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-price': ImpaktPrice;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, touchTarget } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface SummaryRow {\n key: string;\n value: string;\n /** Where \"Change\" goes. Omitted rows show no action. */\n changeHref?: string;\n}\n\n/**\n * Key and value pairs \u2014 an order summary, a confirmation, a check-your-answers\n * screen.\n *\n * **It is a description list.** `<dl>` with `<dt>` and `<dd>` says these are\n * pairs; a stack of divs says nothing, and a table claims a grid that a\n * two-column list does not have.\n *\n * **Every \"Change\" names what it changes.** The visible text stays short, and\n * the accessible name is completed with visually hidden words, so a reader\n * tabbing through hears \"Change date of birth\" rather than six links all called\n * \"Change\". This is 2.4.4 Link Purpose, and it is the single most common\n * failure on a check-your-answers page.\n\n *\n * @category content\n * @icon list\n */\nexport class ImpaktSummaryList extends ImpaktElement {\n static properties = {\n rows: { type: Array },\n changeText: { type: String, attribute: 'change-text' },\n };\n\n declare rows: SummaryRow[];\n declare changeText: string;\n\n constructor() {\n super();\n this.rows = [];\n this.changeText = 'Change';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('dd a'),\n css`\n :host {\n display: block;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: minmax(8rem, 1fr) 2fr;\n }\n /* A <dl> group may hold only dt and dd \u2014 not a third sibling \u2014 so the\n action lives inside the value it changes, which is also where it\n belongs semantically. The row uses display:contents so both cells stay\n in the parent grid. */\n .row {\n display: contents;\n }\n dt,\n dd {\n padding: ${space(3)} 0;\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n dt {\n font-weight: ${fontWeight('semibold')};\n font-size: ${fontSize('sm')};\n }\n dd {\n margin: 0;\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: ${space(3)};\n }\n dd a {\n flex: none;\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n align-items: center;\n min-block-size: ${t.targetMin};\n }\n .sr-only {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n /* One column on a narrow screen. 1.4.10 Reflow: two columns at 320px\n forces horizontal scrolling, and a summary is read, not scanned\n across. */\n @media (max-width: 30rem) {\n dl {\n grid-template-columns: 1fr;\n }\n dt {\n border-block-end: 0;\n padding-block-end: 0;\n }\n dd {\n padding-block-start: 0;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <dl part=\"list\">\n ${this.rows.map(\n (row) => html`\n <div class=\"row\" part=\"row\">\n <dt part=\"key\">${row.key}</dt>\n <dd part=\"value\">\n <span>${row.value}</span>\n ${\n row.changeHref\n ? html`<a href=${row.changeHref} part=\"action\"\n >${this.changeText}<span class=\"sr-only\"> ${row.key}</span></a\n >`\n : nothing\n }\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impakt-summary-list', ImpaktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-summary-list': ImpaktSummaryList;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { pageLocale } from '../base/locale';\nimport { focusRing, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\nexport interface TableColumn {\n key: string;\n label: string;\n numeric?: boolean;\n /** Let the rows be sorted by this column. Its heading becomes a button. */\n sortable?: boolean;\n}\n\n/** Which way a sorted column runs, in the words `aria-sort` uses. */\nexport type SortDirection = 'ascending' | 'descending';\n\n/**\n * A data table \u2014 a plan comparison, a payment schedule, a list of cases.\n *\n * **The caption is required.** It is the table's name, and a page with three\n * unnamed tables is a page a screen-reader user has to read in full to tell\n * apart. Visually it can be the heading they would have written anyway.\n *\n * **It scrolls, and the scroller is focusable.** A wide table cannot reflow to\n * 320px without becoming unreadable, so it scrolls horizontally \u2014 and a region\n * that scrolls must be reachable by keyboard, or a keyboard user simply cannot\n * see the right-hand columns. `tabindex=\"0\"` with a role and a name is the\n * established fix, and the name is why the role is there: a bare focusable div\n * announces nothing.\n *\n * **Or it stacks.** With `stack`, a narrow table turns each row into a card,\n * with each value under the name of its column, so a phone reads a list of\n * cases rather than scrolling a grid. The table keeps its roles written out,\n * because some browsers drop a table's meaning once it is no longer drawn as one.\n *\n * **Sorting is announced.** A sortable column's heading is a button, and the\n * column the rows are sorted by carries `aria-sort`, so a screen reader says\n * \"Opened, sorted descending\" rather than leaving the order to be guessed. The\n * table sorts its own rows unless `manual-sort` says the app does it, as an app\n * that pages its rows on the server must.\n *\n * **Rows can be chosen.** With `selectable`, each row has a checkbox named by\n * the row's first cell, and the heading has one for every row. A row is known by\n * its `id`, or by the key `row-key` names.\n *\n * A cell can hold more than words: give the table a child with\n * `slot=\"cell:{row id}:{column key}\"`, such as a badge, and it is drawn in that\n * cell. With no rows the table says `empty-text`, or shows a child with\n * `slot=\"empty\"`.\n *\n * @category content\n * @icon table\n * @slot empty - What to show when there are no rows, in place of the empty text.\n * @fires {CustomEvent<{ key: string; direction: SortDirection }>} impakt-sort - When a column heading is pressed to sort the rows.\n * @fires {CustomEvent<{ selected: string[] }>} impakt-selection - When rows are chosen or let go. The ids are in detail.selected.\n */\nexport class ImpaktTable extends ImpaktElement {\n static properties = {\n caption: { type: String },\n columns: { type: Array },\n rows: { type: Array },\n sortKey: { type: String, attribute: 'sort-key', reflect: true },\n sortDirection: { type: String, attribute: 'sort-direction', reflect: true },\n manualSort: { type: Boolean, attribute: 'manual-sort' },\n selectable: { type: Boolean, reflect: true },\n selected: { type: Array },\n rowKey: { type: String, attribute: 'row-key' },\n stack: { type: Boolean, reflect: true },\n emptyText: { type: String, attribute: 'empty-text' },\n selectAllText: { type: String, attribute: 'select-all-text' },\n selectRowText: { type: String, attribute: 'select-row-text' },\n };\n\n declare caption: string;\n declare columns: TableColumn[];\n declare rows: Array<Record<string, string>>;\n /** The key of the column the rows are sorted by. Empty leaves them in the order given. */\n declare sortKey: string;\n declare sortDirection: SortDirection;\n /** The app sorts the rows itself, on `impakt-sort`. The table only shows which column and which way. */\n declare manualSort: boolean;\n /** Each row has a checkbox, and the heading one for every row. */\n declare selectable: boolean;\n /** The ids of the chosen rows. */\n declare selected: string[];\n /** The key in each row that tells rows apart. */\n declare rowKey: string;\n /** On a narrow screen, draw each row as a card rather than scroll the table sideways. */\n declare stack: boolean;\n /** What the table says when it has no rows. */\n declare emptyText: string;\n /** The name of the checkbox that chooses every row. */\n declare selectAllText: string;\n /** The name of each row's checkbox, with `{row}` for the row's first cell. */\n declare selectRowText: string;\n\n constructor() {\n super();\n this.caption = '';\n this.columns = [];\n this.rows = [];\n this.sortKey = '';\n this.sortDirection = 'ascending';\n this.manualSort = false;\n this.selectable = false;\n this.selected = [];\n this.rowKey = 'id';\n this.stack = false;\n this.emptyText = 'Nothing to show';\n this.selectAllText = 'Select all rows';\n this.selectRowText = 'Select {row}';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.sort, .pick label'),\n css`\n :host {\n display: block;\n }\n :host([stack]) {\n container-type: inline-size;\n }\n .scroller {\n overflow-x: auto;\n }\n table {\n inline-size: 100%;\n border-collapse: collapse;\n font-size: ${fontSize('md')};\n }\n caption {\n text-align: start;\n font-weight: ${fontWeight('semibold')};\n padding-block-end: ${space(2)};\n }\n th,\n td {\n text-align: start;\n padding: ${space(3)};\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n thead th {\n font-weight: ${fontWeight('semibold')};\n background: ${t.surfaceInset};\n }\n tbody th {\n font-weight: ${fontWeight('semibold')};\n }\n .numeric {\n /* A figure read across a line break is a different figure. */\n white-space: nowrap;\n text-align: end;\n font-variant-numeric: tabular-nums;\n }\n th.sortable {\n padding: ${space(1)};\n }\n .sort {\n display: inline-flex;\n align-items: center;\n gap: ${space(1)};\n min-block-size: ${t.targetMin};\n padding: ${space(2)};\n font: inherit;\n color: inherit;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n cursor: pointer;\n }\n .sort:hover {\n background: ${t.wash};\n }\n .numeric .sort {\n flex-direction: row-reverse;\n }\n .arrow {\n display: inline-flex;\n color: ${t.textMuted};\n transition: transform 140ms ease-in-out;\n }\n [aria-sort] .arrow {\n color: inherit;\n }\n [aria-sort='ascending'] .arrow {\n transform: rotate(180deg);\n }\n :not([aria-sort]) > .sort .arrow {\n opacity: 0.45;\n }\n .pick {\n inline-size: 1%;\n padding-block: 0;\n padding-inline-end: 0;\n }\n .pick label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n cursor: pointer;\n }\n .pick input {\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n accent-color: ${t.brand};\n cursor: pointer;\n }\n tr.chosen > * {\n background: ${t.brandSubtle};\n }\n .empty {\n padding-block: ${space(6)};\n text-align: center;\n color: ${t.textMuted};\n }\n .label {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /* Stacked: each row a card, each value under its column's name. */\n @container (max-width: 36rem) {\n table, tbody, tr, tbody th, tbody td {\n display: block;\n }\n thead tr {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: ${space(1)};\n margin-block-end: ${space(3)};\n }\n thead th {\n display: none;\n padding: 0;\n border: 0;\n background: none;\n }\n thead th.sortable, thead th.pick {\n display: block;\n inline-size: auto;\n }\n thead .sort {\n border: ${t.borderThin} solid ${t.rule};\n border-radius: 999px;\n padding-inline: ${space(3)};\n background: ${t.surfaceCard};\n }\n tbody tr {\n position: relative;\n margin-block-end: ${space(3)};\n padding: ${space(3)} ${space(4)};\n border: ${t.borderThin} solid ${t.rule};\n border-radius: ${t.radiusXl};\n background: ${t.surfaceCard};\n }\n tbody tr.chosen {\n background: ${t.brandSubtle};\n }\n tr.chosen > * {\n background: none;\n }\n tbody th, tbody td {\n display: grid;\n grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr);\n gap: ${space(3)};\n padding: ${space(1.5)} 0;\n border: 0;\n text-align: start;\n white-space: normal;\n }\n tbody td.numeric {\n text-align: start;\n }\n tbody .pick {\n display: block;\n position: absolute;\n inset-block-start: ${space(1)};\n inset-inline-end: ${space(1)};\n inline-size: auto;\n padding: 0;\n }\n tbody tr:has(.pick) > th {\n padding-inline-end: ${space(10)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.textMuted};\n }\n .empty {\n display: block;\n border: 0;\n }\n }\n `,\n ];\n\n private keyOf(row: Record<string, string>, index: number): string {\n const key = row?.[this.rowKey];\n return key === undefined || key === null || key === '' ? String(index) : String(key);\n }\n\n /** The rows in the order they are drawn: as given, or sorted by the chosen column. */\n private ordered(): Array<{ row: Record<string, string>; key: string }> {\n const rows = (this.rows ?? []).map((row, i) => ({ row, key: this.keyOf(row, i) }));\n const column = (this.columns ?? []).find((c) => c.key === this.sortKey && c.sortable);\n if (!column || this.manualSort) return rows;\n const way = this.sortDirection === 'descending' ? -1 : 1;\n const locale = pageLocale(this);\n const figure = (v: unknown) => Number(String(v ?? '').replace(/[^\\d.-]/g, '')) || 0;\n return rows.sort((a, b) => {\n const x = a.row[column.key] ?? '';\n const y = b.row[column.key] ?? '';\n const order = column.numeric ? figure(x) - figure(y) : String(x).localeCompare(String(y), locale, { numeric: true, sensitivity: 'base' });\n return order * way;\n });\n }\n\n private sortBy(key: string): void {\n const direction: SortDirection = this.sortKey === key && this.sortDirection === 'ascending' ? 'descending' : 'ascending';\n this.sortKey = key;\n this.sortDirection = direction;\n this.dispatchEvent(new CustomEvent('impakt-sort', { detail: { key, direction }, bubbles: true, composed: true }));\n }\n\n private choose(keys: string[], on: boolean): void {\n const now = new Set(this.selected ?? []);\n for (const key of keys) {\n if (on) now.add(key);\n else now.delete(key);\n }\n this.selected = [...now];\n this.dispatchEvent(new CustomEvent('impakt-selection', { detail: { selected: this.selected }, bubbles: true, composed: true }));\n }\n\n private heading(c: TableColumn): TemplateResult {\n const sorted = c.sortable && c.key === this.sortKey;\n const classes = [c.numeric ? 'numeric' : '', c.sortable ? 'sortable' : ''].filter(Boolean).join(' ');\n if (!c.sortable) return html`<th scope=\"col\" role=\"columnheader\" class=${classes}>${c.label}</th>`;\n return html`<th scope=\"col\" role=\"columnheader\" class=${classes} aria-sort=${sorted ? this.sortDirection : nothing}>\n <button class=\"sort\" type=\"button\" part=\"sort\" @click=${() => this.sortBy(c.key)}>${c.label}<span class=\"arrow\" aria-hidden=\"true\">${iconSvg('chevron-down', '16px')}</span></button>\n </th>`;\n }\n\n render(): TemplateResult {\n const columns = this.columns ?? [];\n const rows = this.ordered();\n const chosen = new Set(this.selected ?? []);\n const every = rows.length > 0 && rows.every((r) => chosen.has(r.key));\n const some = !every && rows.some((r) => chosen.has(r.key));\n return html`\n <div class=\"scroller\" part=\"scroller\" tabindex=\"0\" role=\"region\" aria-label=${this.caption || nothing}>\n <table part=\"table\" role=\"table\">\n ${this.caption ? html`<caption part=\"caption\">${this.caption}</caption>` : nothing}\n <thead role=\"rowgroup\">\n <tr role=\"row\">\n ${\n this.selectable\n ? html`<th scope=\"col\" role=\"columnheader\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectAllText} .checked=${every} .indeterminate=${some} ?disabled=${!rows.length}\n @change=${(e: Event) =>\n this.choose(\n rows.map((r) => r.key),\n (e.target as HTMLInputElement).checked,\n )} /></label></th>`\n : nothing\n }\n ${columns.map((c) => this.heading(c))}\n </tr>\n </thead>\n <tbody role=\"rowgroup\">\n ${\n rows.length\n ? rows.map(\n ({ row, key }, i) => html`\n <tr role=\"row\" class=${chosen.has(key) ? 'chosen' : ''} part=\"row\">\n ${\n this.selectable\n ? html`<td role=\"cell\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectRowText.replace('{row}', String(row[columns[0]?.key ?? ''] ?? key))} .checked=${chosen.has(key)}\n @change=${(e: Event) => this.choose([key], (e.target as HTMLInputElement).checked)} /></label></td>`\n : nothing\n }\n ${columns.map((c, j) => {\n const value = html`<span class=\"label\" aria-hidden=\"true\">${c.label}</span><span class=\"value\"><slot name=${`cell:${key}:${c.key}`}>${row[c.key] ?? ''}</slot></span>`;\n // The first cell of each row is a row header, so a screen\n // reader announces \"Delivery charge, \u00A3250\" rather than\n // reading a bare number with no idea what it belongs to.\n return j === 0\n ? html`<th scope=\"row\" role=\"rowheader\" id=${`${this.uid}-r${i}`}>${value}</th>`\n : html`<td role=\"cell\" class=${c.numeric ? 'numeric' : ''}>${value}</td>`;\n })}\n </tr>\n `,\n )\n : html`<tr role=\"row\"><td role=\"cell\" class=\"empty\" colspan=${columns.length + (this.selectable ? 1 : 0) || 1}><slot name=\"empty\">${this.emptyText}</slot></td></tr>`\n }\n </tbody>\n </table>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-table', ImpaktTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-table': ImpaktTable;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface AccordionItem {\n id: string;\n heading: string;\n body: string;\n}\n\n/**\n * Disclosure sections \u2014 frequently asked questions, \"what does this mean?\".\n *\n * **Each header is a button inside a heading.** The heading is what lets a\n * screen-reader user jump between sections without tabbing through every\n * paragraph; the button is what makes the section openable. One without the\n * other is a common half-implementation: all-headings cannot be operated,\n * all-buttons cannot be navigated.\n *\n * `headingLevel` is a property because the right level depends on what is\n * above the accordion on the page, and guessing produces exactly the skipped\n * levels that 1.3.1 is about.\n *\n * **Panels are hidden, not unmounted.** `hidden` keeps the content in the\n * accessibility tree's structure and lets in-page search find it when opened,\n * and it means `aria-controls` always points at an element that exists.\n *\n * **A panel can hold more than words.** `body` is plain text, which is what a\n * composition can author safely. Content rendered elsewhere, such as an FAQ\n * answer with links and a list, is slotted instead: a child with\n * `slot=\"panel-<item id>\"` replaces that item's body. The slot sits inside the\n * panel, so the region, its label and its `hidden` state are unchanged, and a\n * panel with nothing slotted still shows its body.\n *\n * @category content\n * @icon accordion\n */\nexport class ImpaktAccordion extends ImpaktElement {\n static properties = {\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n open: { type: Array },\n multiple: { type: Boolean },\n };\n\n declare items: AccordionItem[];\n declare headingLevel: number;\n /** Ids currently expanded. */\n declare open: string[];\n /** When false, opening one closes the others. */\n declare multiple: boolean;\n\n constructor() {\n super();\n this.items = [];\n this.headingLevel = 3;\n this.open = [];\n this.multiple = true;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n .item {\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n button {\n ${targetSize}\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n inline-size: 100%;\n padding: ${space(3)} 0;\n background: none;\n border: 0;\n font: inherit;\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.text};\n text-align: start;\n cursor: pointer;\n }\n button:hover {\n color: ${t.link};\n }\n .marker {\n flex: none;\n transition: transform 120ms ease-in-out;\n }\n button[aria-expanded='true'] .marker {\n transform: rotate(90deg);\n }\n .panel {\n padding-block-end: ${space(4)};\n font-size: ${fontSize('md')};\n }\n `,\n ];\n\n private toggle(id: string): void {\n const isOpen = this.open.includes(id);\n if (isOpen) this.open = this.open.filter((o) => o !== id);\n else this.open = this.multiple ? [...this.open, id] : [id];\n }\n\n render(): TemplateResult {\n return html`\n ${this.items.map((item) => {\n const expanded = this.open.includes(item.id);\n const panelId = this.id_(`panel-${item.id}`);\n const buttonId = this.id_(`button-${item.id}`);\n return html`\n <div class=\"item\" part=\"item\">\n <div role=\"heading\" aria-level=${this.headingLevel}>\n <button\n id=${buttonId}\n part=\"header\"\n type=\"button\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${panelId}\n @click=${() => this.toggle(item.id)}\n >\n <span>${item.heading}</span>\n <span class=\"marker\" aria-hidden=\"true\">\u203A</span>\n </button>\n </div>\n <div\n id=${panelId}\n class=\"panel\"\n part=\"panel\"\n role=\"region\"\n aria-labelledby=${buttonId}\n ?hidden=${!expanded}\n >\n <slot name=${`panel-${item.id}`}>${item.body}</slot>\n </div>\n </div>\n `;\n })}\n ${this.items.length === 0 ? nothing : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-accordion', ImpaktAccordion);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-accordion': ImpaktAccordion;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface ProgressStep {\n id: string;\n label: string;\n}\n\n/**\n * Where the customer is in a journey.\n *\n * **It is not a `progressbar`.** That role is for a task completing \u2014 a file\n * uploading, a price calculating \u2014 and it carries `aria-valuenow`. A journey\n * indicator is navigation: an ordered list of named steps with\n * `aria-current=\"step\"` on the one you are on. Using `progressbar` here\n * announces a percentage and loses the step names, which are the only useful\n * part.\n *\n * **The position is said in words.** \"Step 2 of 5\" is visually hidden and read\n * aloud, because the visual design communicates position through colour and a\n * filled bar, and neither is available to a screen-reader user \u2014 nor to anyone\n * who cannot distinguish the filled colour from the empty one, which is 1.4.1.\n\n *\n * @category content\n * @icon progress\n */\nexport class ImpaktProgress extends ImpaktElement {\n static properties = {\n steps: { type: Array },\n current: { type: String },\n label: { type: String },\n look: { type: String, reflect: true },\n hideLabels: { type: Boolean, attribute: 'hide-labels', reflect: true },\n };\n\n declare steps: ProgressStep[];\n /** The id of the step being shown. */\n declare current: string;\n declare label: string;\n /**\n * `steps` is the full indicator. `bars` is a compact one for a card: short\n * rounded bars, the done steps in the text colour and the current one in the\n * brand, with small names under them. The current step is also set in a\n * heavier weight, so it does not rest on colour alone.\n */\n declare look: 'steps' | 'bars';\n /**\n * Draw the bars or steps alone, for a card too small for the names. The\n * names and \"Step 2 of 5\" are still read aloud. Each step is also a `step`\n * part, with `step-done`, `step-current` or `step-todo`, and its name is the\n * `step-label` part, for finer styling.\n */\n declare hideLabels: boolean;\n\n constructor() {\n super();\n this.steps = [];\n this.current = '';\n this.label = 'Progress';\n this.look = 'steps';\n this.hideLabels = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(5)};\n }\n ol {\n display: flex;\n gap: ${space(2)};\n list-style: none;\n margin: 0;\n padding: 0;\n }\n li {\n flex: 1;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n padding-block-start: ${space(2)};\n border-block-start: 4px solid ${t.border};\n }\n li[data-state='done'] {\n color: ${t.text};\n border-block-start-color: ${t.brand};\n }\n li[data-state='current'] {\n color: ${t.text};\n font-weight: ${fontWeight('semibold')};\n border-block-start-color: ${t.brand};\n }\n .sr-only {\n ${visuallyHidden}\n }\n :host([look='bars']) {\n margin-block-end: 0;\n }\n :host([look='bars']) ol {\n gap: ${space(1.5)};\n }\n :host([look='bars']) li {\n position: relative;\n padding-block-start: ${space(3)};\n border: 0;\n font-size: 12px;\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n :host([look='bars']) li::before {\n content: '';\n position: absolute;\n inset-inline: 0;\n inset-block-start: 0;\n block-size: 5px;\n border-radius: 999px;\n background: ${t.border};\n }\n :host([look='bars']) li[data-state='done']::before {\n background: ${t.text};\n }\n :host([look='bars']) li[data-state='current']::before {\n background: ${t.brand};\n }\n @media (forced-colors: active) {\n :host([look='bars']) li::before { background: GrayText; }\n :host([look='bars']) li[data-state='done']::before, :host([look='bars']) li[data-state='current']::before { background: CanvasText; }\n }\n :host([hide-labels]) .name {\n ${visuallyHidden}\n }\n /* Below 30rem the labels stop fitting; the position in words is the part\n that has to survive, so the list collapses to bars and the current\n step's name. */\n @media (max-width: 30rem) {\n li:not([data-state='current']) .name {\n ${visuallyHidden}\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const index = this.steps.findIndex((s) => s.id === this.current);\n return html`\n <nav part=\"nav\" aria-label=${this.label}>\n <ol part=\"list\">\n ${this.steps.map((step, i) => {\n const state = i < index ? 'done' : i === index ? 'current' : 'todo';\n return html`\n <li part=\"step step-${state}\" data-state=${state} aria-current=${state === 'current' ? 'step' : nothing}>\n ${\n state === 'current'\n ? html`<span class=\"sr-only\">${say('Step {step} of {steps}:', { step: i + 1, steps: this.steps.length })} </span>`\n : nothing\n }\n <span class=\"name\" part=\"step-label\">${step.label}</span>\n </li>\n `;\n })}\n </ol>\n </nav>\n `;\n }\n}\n\ncustomElements.define('impakt-progress', ImpaktProgress);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-progress': ImpaktProgress;\n }\n}\n", "/**\n * Colours named by what they are in the brand, for a line, a lane, a dot or a\n * stripe. A tone is a brand token, never a hex value, so a partner's brand\n * restyles everything drawn with one.\n *\n * It is shared: `impakt-chip` here and the changelog, site and estimator blocks\n * in `@atomic-ui/blocks` all colour themselves with it.\n */\n\n/** A colour for a line or a lane, named by what it is in the brand. */\nexport type NamedTone = 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n/** A named tone, or 1 to 5 for the brand's chart colours in order. */\nexport type Tone = NamedTone | 1 | 2 | 3 | 4 | 5;\nexport const TONE: Record<NamedTone, string> = {\n brand: 'var(--impakt-color-brand-default, #1f4ed8)',\n accent: 'var(--impakt-color-accent-default, #c8a15a)',\n info: 'var(--impakt-color-status-info-default, #1f4ed8)',\n success: 'var(--impakt-color-status-success-default, #047857)',\n warning: 'var(--impakt-color-status-warning-default, #b45309)',\n danger: 'var(--impakt-color-status-danger-default, #c8102e)',\n};\n/** When an item names no tone, lanes take these in turn. */\nexport const CYCLE: NamedTone[] = ['success', 'info', 'warning', 'accent', 'danger', 'brand'];\n/**\n * A named tone, or for an item that names none, the brand's chart colour for its\n * place (color.chart.1 to 5), falling back to the status colours in turn.\n */\nexport const toneOf = (tone: Tone | undefined, i: number): string => {\n if (typeof tone === 'number') return `var(--impakt-color-chart-${tone}, ${TONE[CYCLE[(tone - 1) % CYCLE.length]!]})`;\n if (tone && tone in TONE) return TONE[tone];\n return `var(--impakt-color-chart-${(i % 5) + 1}, ${TONE[CYCLE[i % CYCLE.length]!]})`;\n};\n", "/**\n * A short label: a branch, a status with its dot, or a code such as a commit\n * hash.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { hideOn } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\nimport { toneOf, type Tone } from '../base/tone';\n\n/** Code-like labels: a branch, a hash, a commit message. */\nconst MONO = t.fontMono;\n\n/**\n * A short label: a branch name with its icon, a status with its dot, or a\n * code such as a commit hash. It says something; it does nothing.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n meta: { type: String },\n icon: { type: String, reflect: true },\n tone: { type: String },\n look: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n declare label: string;\n /** A code after the label, quieter, such as a hash. */\n declare meta: string;\n /** A coloured dot, a branch, or nothing before the label. */\n declare icon: 'none' | 'dot' | 'branch';\n /** The dot's colour: a named tone, or 1 to 5 for the brand's chart colours. */\n declare tone: Tone;\n /** `outlined` on the card colour, `filled` with a faint wash, or `plain` words in the code face. */\n declare look: 'outlined' | 'filled' | 'plain';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.label = '';\n this.meta = '';\n this.icon = 'none';\n this.tone = 'success';\n this.look = 'filled';\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n hideOn,\n css`\n :host { display: inline-flex; flex: none; }\n span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: 999px; font-family: ${MONO}; font-size: ${fontSize('xs')}; line-height: 1.2; white-space: nowrap; }\n :host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }\n :host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.border}; background: ${t.surfaceCard}; text-transform: uppercase; letter-spacing: 0.04em; }\n :host([look='plain']) span.chip { padding: 0; }\n .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }\n svg { inline-size: 12px; block-size: 12px; }\n .meta { opacity: 0.72; text-transform: none; }\n :host([look='plain']) .label { opacity: 0.72; }\n `,\n ];\n\n render(): TemplateResult {\n const icon =\n this.icon === 'dot'\n ? html`<span class=\"dot\" aria-hidden=\"true\"></span>`\n : this.icon === 'branch'\n ? html`<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>`\n : nothing;\n return html`<span class=\"chip\" part=\"chip\" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class=\"label\">${this.label}</span>${this.meta ? html` <span class=\"meta\">${this.meta}</span>` : nothing}</span>`;\n }\n}\n\ncustomElements.define('impakt-chip', ImpaktChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip': ImpaktChip;\n }\n}\n", "/**\n * A short label on something, coloured by its tone.\n */\nimport { css, html, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontWeight, space, t, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A short label on something: \"New\", \"Selling fast\", \"2 left\".\n *\n * The tone colours it, and the words carry the meaning, so it reads the same\n * without the colour (1.4.1).\n *\n * @category feedback\n * @icon badge\n * @slot - The badge's words.\n */\nexport class ImpaktBadge extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n icon: { type: String },\n };\n /**\n * Its colour. `inverse` is the text colour as a fill, for a label that has to\n * stand out on a photo or a light card. `solid` is the brand as a fill, for\n * the one label on a screen that matters most.\n */\n declare tone: 'neutral' | 'brand' | 'success' | 'warning' | 'danger' | 'info' | 'inverse' | 'solid';\n /** An icon before the words. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n\n constructor() {\n super();\n this.tone = 'neutral';\n this.icon = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-flex; }\n span { display: inline-flex; align-items: center; gap: ${space(1)}; padding: ${space(0.5)} ${space(2)}; border-radius: ${t.radius}; ${type('sm')} font-weight: ${fontWeight('medium')}; background: ${t.surfaceInset}; color: ${t.text}; box-shadow: inset 0 0 0 1px ${t.hairline}; }\n :host([tone='brand']) span { background: ${t.brandSubtle}; color: ${t.brand}; }\n :host([tone='success']) span { background: ${t.successSubtle}; color: ${t.successText}; }\n :host([tone='warning']) span { background: ${t.warningSubtle}; color: ${t.warningText}; }\n :host([tone='danger']) span { background: ${t.dangerSubtle}; color: ${t.dangerText}; }\n :host([tone='info']) span { background: ${t.infoSubtle}; color: ${t.infoText}; }\n :host([tone='inverse']) span { background: ${t.text}; color: ${t.surfaceCard}; box-shadow: none; }\n :host([tone='solid']) span { background: ${t.brand}; color: ${t.onBrand}; box-shadow: none; }\n @media (forced-colors: active) { span { border-color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`<span part=\"badge\">${iconSvg(this.icon, '1em')}<slot></slot></span>`;\n }\n}\n\ncustomElements.define('impakt-badge', ImpaktBadge);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-badge': ImpaktBadge;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text \u2014 a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n >${this.value}</textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n this.fill();\n }\n}\n\ncustomElements.define('impakt-textarea', ImpaktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-textarea': ImpaktTextarea;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface CheckboxOption {\n value: string;\n label: string;\n description?: string;\n}\n\n/**\n * A choose-several group \u2014 the multi-select question type.\n *\n * Same shape as the radio group and for the same reasons: a `<fieldset>` with\n * a `<legend>`, because the question is asked of the set and `label for` names\n * one control.\n *\n * It differs from radios in one way that matters. Checkboxes have no roving\n * tabindex \u2014 every box is its own tab stop, which is correct, because each is\n * an independent yes or no rather than one choice among several. Nothing needs\n * to be implemented for that; it is what the platform does, and it is worth\n * knowing it is deliberate rather than missing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckboxGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n values: { type: Array },\n };\n\n declare options: CheckboxOption[];\n declare values: string[];\n\n constructor() {\n super();\n this.options = [];\n this.values = [];\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .option {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n padding: ${space(3)};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n margin-block-end: ${space(2)};\n cursor: pointer;\n }\n .option:hover {\n background: ${t.surfaceSubtle};\n }\n .option input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .option-text {\n display: block;\n font-size: ${fontSize('md')};\n }\n .option-description {\n display: block;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n margin-block-start: ${space(1)};\n }\n :host([invalid]) .option {\n border-color: ${t.danger};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private onToggle(value: string, checked: boolean): void {\n this.values = checked ? [...this.values, value] : this.values.filter((v) => v !== value);\n // One form value, comma-joined \u2014 a multi-select arrives at a pricing API as\n // a list, and the order follows the options rather than the clicks.\n this.setFormValue(\n this.options\n .filter((o) => this.values.includes(o.value))\n .map((o) => o.value)\n .join(','),\n );\n }\n\n protected renderControl(): TemplateResult {\n return html`\n ${this.options.map((option, i) => {\n const id = this.id_(`opt-${i}`);\n const descId = option.description ? this.id_(`opt-${i}-desc`) : undefined;\n return html`\n <label class=\"option\" part=\"option\" for=${id}>\n <input\n type=\"checkbox\"\n id=${id}\n value=${option.value}\n .checked=${this.values.includes(option.value)}\n ?disabled=${this.disabled}\n aria-describedby=${descId ?? nothing}\n @change=${(e: Event) => this.onToggle(option.value, (e.target as HTMLInputElement).checked)}\n />\n <span>\n <span class=\"option-text\">${option.label}</span>\n ${option.description ? html`<span class=\"option-description\" id=${descId!}>${option.description}</span>` : nothing}\n </span>\n </label>\n `;\n })}\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-checkbox-group', ImpaktCheckboxGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-checkbox-group': ImpaktCheckboxGroup;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { FieldElement } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A date, as three fields.\n *\n * **Why not `<input type=\"date\">`.** The native control is excellent for\n * picking a date near today \u2014 an appointment, a start date \u2014 and poor for a\n * date of birth, which is the date this product asks for most. Its picker\n * opens on the current month and makes a user born in 1958 navigate eight\n * hundred steps back, its text entry expects a locale-specific format the\n * field does not state, and its rendering differs enough between browsers that\n * no single hint is correct everywhere.\n *\n * Three fields is the pattern government services converged on after testing\n * it on exactly this problem. Each part is typed directly, in any order, with\n * no picker to fight.\n *\n * **The accessibility shape.** A `<fieldset>` and `<legend>` ask the question\n * once; each part has its own visible label, so \"Month\" is announced rather\n * than \"second field\"; `inputmode=\"numeric\"` brings up a number pad without\n * `type=\"number\"`, which on a date part gives spinners, scroll-wheel surprises\n * and silent stripping of a leading zero. The parts carry `autocomplete`\n * tokens so autofill still works, which is 1.3.5.\n\n *\n * @category form\n * @icon calendar\n */\nexport class ImpaktDateInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n day: { type: String },\n month: { type: String },\n year: { type: String },\n autocompleteSection: { type: String, attribute: 'autocomplete-section' },\n };\n\n declare day: string;\n declare month: string;\n declare year: string;\n /** \"bday\" fills a date of birth. Empty disables autofill for this field. */\n declare autocompleteSection: string;\n\n constructor() {\n super();\n this.day = '';\n this.month = '';\n this.year = '';\n this.autocompleteSection = 'bday';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .parts {\n display: flex;\n gap: ${space(3)};\n }\n .part {\n display: flex;\n flex-direction: column;\n gap: ${space(1)};\n }\n .part label {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n input {\n min-block-size: 44px;\n padding: ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n /* Room for the digits plus the padding and border, so the box is never narrower than a finger. */\n inline-size: calc(3ch + ${space(6)} + 2px);\n }\n .year input {\n inline-size: calc(5ch + ${space(6)} + 2px);\n }\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private datePart(name: 'day' | 'month' | 'year', label: string, length: number, autocomplete: string): TemplateResult {\n const id = this.id_(name);\n return html`\n <div class=\"part ${name}\">\n <label for=${id}>${label}</label>\n <input\n id=${id}\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=${length}\n .value=${this[name]}\n autocomplete=${this.autocompleteSection ? `${this.autocompleteSection}-${autocomplete}` : nothing}\n ?disabled=${this.disabled}\n @input=${(e: Event) => {\n this[name] = (e.target as HTMLInputElement).value;\n this.emit();\n }}\n />\n </div>\n `;\n }\n\n /** ISO, or empty while incomplete. Partial dates are not half-valid. */\n private emit(): void {\n const complete = this.day && this.month && this.year.length === 4;\n const iso = complete ? `${this.year}-${this.month.padStart(2, '0')}-${this.day.padStart(2, '0')}` : '';\n this.setFormValue(iso);\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"parts\" part=\"parts\">\n ${this.datePart('day', say('Day'), 2, 'day')}\n ${this.datePart('month', say('Month'), 2, 'month')}\n ${this.datePart('year', say('Year'), 4, 'year')}\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-date-input', ImpaktDateInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-date-input': ImpaktDateInput;\n }\n}\n", "/**\n * Stop the page behind a modal dialog or drawer from scrolling.\n *\n * `showModal()` makes the page inert, but it still scrolls, so a wheel or a\n * finger on the backdrop moves the page out from under the dialog, and on a\n * phone the dialog appears to drift. Each open modal takes a hold, and the\n * page scrolls again once the last one lets go, so a dialog opened from a\n * drawer does not unlock the page when it closes. The scrollbar's width is put\n * back as padding, so the page does not shift sideways as it locks.\n */\nconst holders = new Set<object>();\nlet before: { overflow: string; paddingRight: string } | null = null;\n\nexport function lockScroll(holder: object): void {\n if (typeof document === 'undefined' || holders.has(holder)) return;\n holders.add(holder);\n if (holders.size > 1) return;\n const root = document.documentElement;\n const bar = window.innerWidth - root.clientWidth;\n before = { overflow: root.style.overflow, paddingRight: root.style.paddingRight };\n root.style.overflow = 'hidden';\n if (bar > 0) root.style.paddingRight = `${bar}px`;\n}\n\nexport function unlockScroll(holder: object): void {\n if (typeof document === 'undefined' || !holders.delete(holder) || holders.size > 0 || !before) return;\n const root = document.documentElement;\n root.style.overflow = before.overflow;\n root.style.paddingRight = before.paddingRight;\n before = null;\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A modal dialog \u2014 \"are you sure you want to leave this order?\".\n *\n * **It is a native `<dialog>` opened with `showModal()`, and that is the whole\n * design.** The platform then provides, correctly and in every browser: a\n * focus trap, Escape to close, the rest of the page made inert so a screen\n * reader cannot wander out of the dialog, rendering in the top layer so no\n * `z-index` can cover it, and focus returned to whatever opened it when it\n * closes.\n *\n * Every one of those is a thing hand-rolled modals get wrong. The focus trap\n * is the famous one, but inertness is the worse failure: a dialog that traps\n * the Tab key but leaves the background in the accessibility tree lets a\n * screen-reader user read straight past it into a page they cannot interact\n * with, and nothing on screen tells them that is what happened.\n *\n * What is left to get right is the labelling. `aria-labelledby` points at the\n * dialog's own heading, so it is announced by name on open rather than as\n * \"dialog\".\n *\n * Two things the platform leaves out are added. The page behind does not scroll\n * while the dialog is open, so a finger on the backdrop does not move the page\n * out from under it. And with `phone-full-screen` the dialog fills a phone's\n * screen, which suits a dialog holding a form; a short question is better left\n * as a box in the middle, which is the default.\n\n *\n * @category feedback\n * @icon dialog\n * @fires {CustomEvent<null>} impakt-close - When the dialog is closed.\n * @slot - The body of the dialog.\n */\nexport class ImpaktDialog extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n closeLabel: { type: String, attribute: 'close-label' },\n dismissible: { type: Boolean },\n phoneFullScreen: { type: Boolean, reflect: true, attribute: 'phone-full-screen' },\n };\n\n declare open: boolean;\n declare heading: string;\n declare closeLabel: string;\n /** When false, Escape and the backdrop do not close it \u2014 a decision must be made. */\n declare dismissible: boolean;\n /** Fill the screen on a phone, for a dialog that holds a form or a long text. */\n declare phoneFullScreen: boolean;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.closeLabel = 'Close';\n this.dismissible = true;\n this.phoneFullScreen = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog {\n padding: 0;\n border: 0;\n border-radius: ${t.radius2xl};\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: ${t.shadowXl}, 0 0 0 1px ${t.hairline};\n max-inline-size: min(32rem, calc(100vw - 2rem));\n /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside\n itself rather than clipping, at 320px and at 400% zoom alike. */\n max-block-size: calc(100vh - 2rem);\n overflow: auto;\n }\n dialog::backdrop {\n background: color-mix(in srgb, ${t.text} 30%, transparent);\n backdrop-filter: blur(2px);\n }\n .head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: ${space(3)};\n padding: ${space(5)} ${space(5)} 0;\n }\n .heading {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: ${fontSize('xl')};\n font-weight: ${fontWeight('bold')};\n color: ${t.textHeading};\n }\n .body {\n padding: ${space(4)} ${space(5)} ${space(5)};\n }\n @media (max-width: 40rem) {\n :host([phone-full-screen]) dialog {\n inline-size: 100vw;\n max-inline-size: 100vw;\n block-size: 100dvh;\n max-block-size: 100dvh;\n margin: 0;\n border-radius: 0;\n }\n }\n .close {\n ${targetSize}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n font: inherit;\n font-size: ${fontSize('lg')};\n color: ${t.text};\n cursor: pointer;\n }\n `,\n ];\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n // happy-dom and older engines do not implement showModal. Falling back to\n // the `open` attribute renders a NON-modal dialog \u2014 no focus trap, no\n // inert background \u2014 so it is used only to keep tests and ancient browsers\n // from throwing, never as an equivalent.\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${(e: Event) => {\n // `cancel` fires on Escape. Blocking it is what makes a dialog\n // non-dismissible, and it is why `dismissible` exists rather than\n // leaving a caller to re-open on close.\n if (!this.dismissible) e.preventDefault();\n else this.close();\n }}\n @close=${() => {\n if (this.open) this.close();\n }}\n >\n <div class=\"head\">\n ${this.heading ? html`<h2 class=\"heading\" id=${this.id_('heading')} part=\"heading\">${this.heading}</h2>` : nothing}\n ${\n this.dismissible\n ? html`<button class=\"close\" part=\"close\" type=\"button\" @click=${this.close}>\n <span aria-hidden=\"true\">\u00D7</span>\n <span class=\"sr-only\" style=\"position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)\">${this.closeLabel}</span>\n </button>`\n : nothing\n }\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n </dialog>\n `;\n }\n}\n\ncustomElements.define('impakt-dialog', ImpaktDialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-dialog': ImpaktDialog;\n }\n}\n", "import { css, html, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontWeight, space, spaceAround, t, type } from '../base/tokens';\n\n/**\n * A list of short points: what a phase delivers, what a plan includes, the\n * steps of an argument in an article. A bullet, a tick or a number marks each\n * one; the marks are drawn, so a screen reader hears a plain list.\n *\n * @category content\n * @icon list\n */\nexport class ImpaktList extends ImpaktElement {\n static properties = {\n items: { type: Array },\n look: { type: String, reflect: true },\n size: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n\n /** The points, in order. */\n declare items: string[];\n /** `bullet` for points, `check` for what is included, `number` when the order matters. */\n declare look: 'bullet' | 'check' | 'number';\n declare size: 'sm' | 'md' | 'lg';\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.items = [];\n this.look = 'bullet';\n this.size = 'md';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host { display: block; }\n ul, ol { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(3)}; counter-reset: point; }\n li { position: relative; padding-inline-start: ${space(7)}; ${type('md')} text-wrap: pretty; counter-increment: point; }\n :host([size='sm']) li { ${type('sm')} }\n :host([size='lg']) li { ${type('lg')} }\n li::before { content: ''; position: absolute; inset-inline-start: 4px; inset-block-start: 0.6em; inline-size: 7px; block-size: 7px; border-radius: 2px; background: ${t.brand}; }\n :host([look='check']) li::before { content: '\u2713'; inset-inline-start: 0; inset-block-start: 0; inline-size: auto; block-size: auto; background: none; color: ${t.success}; font-weight: ${fontWeight('bold')}; }\n :host([look='number']) li::before { content: counter(point, decimal-leading-zero); inset-inline-start: 0; inset-block-start: 0.2em; inline-size: auto; block-size: auto; background: none; font-family: ${t.fontMono}; font-size: 0.75em; color: ${t.textMuted}; }\n @media (forced-colors: active) { li::before { background: CanvasText; } :host([look='check']) li::before, :host([look='number']) li::before { background: none; color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const items = (this.items ?? []).map((item) => html`<li part=\"item\">${item}</li>`);\n return this.look === 'number' ? html`<ol part=\"list\">${items}</ol>` : html`<ul part=\"list\" role=\"list\">${items}</ul>`;\n }\n}\n\ncustomElements.define('impakt-list', ImpaktList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-list': ImpaktList;\n }\n}\n", "import { css, html } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { spaceAround, token } from '../base/tokens';\n\n/** Column widths as fractions, for each choice of `widths`. */\nconst WIDTHS: Record<string, string> = {\n '2:1': '2fr 1fr',\n '1:2': '1fr 2fr',\n '3:1': '3fr 1fr',\n '1:3': '1fr 3fr',\n '1:2:1': '1fr 2fr 1fr',\n '2:1:1': '2fr 1fr 1fr',\n '1:1:2': '1fr 1fr 2fr',\n};\n\n/**\n * A responsive row with named column slots. Child order stays inside each\n * column; changing a page's visual grid never reorders its reading sequence.\n *\n * Gutters come from the brand's layout, so every grid for a partner keeps the\n * same rhythm. Where the columns stack is a choice, because a three-column\n * row of cards may work on a tablet where two columns of long text do not.\n *\n * @category layout\n * @icon columns\n * @slot column-1 - First column.\n * @slot column-2 - Second column.\n * @slot column-3 - Third column.\n * @slot column-4 - Fourth column.\n */\nexport class ImpaktGrid extends ImpaktElement {\n static properties = {\n columns: { type: String, reflect: true },\n widths: { type: String, reflect: true },\n gap: { type: String, reflect: true },\n stackOn: { type: String, reflect: true, attribute: 'stack-on' },\n align: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare columns: 'one' | 'two' | 'three' | 'four' | 'sidebar-left' | 'sidebar-right';\n /** How wide each column is against the others. Applies when it has as many parts as there are columns. */\n declare widths: 'equal' | '2:1' | '1:2' | '3:1' | '1:3' | '1:2:1' | '2:1:1' | '1:1:2';\n /** The space between columns, from the brand's gutters. */\n declare gap: 'none' | 'sm' | 'md' | 'lg' | 'xl';\n /** The screens on which the columns stack, one above another, in column order. */\n declare stackOn: 'phone' | 'tablet' | 'never';\n /** How columns of different heights line up. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Space before the grid, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the grid, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n constructor() {\n super();\n this.columns = 'two';\n this.widths = 'equal';\n this.gap = 'md';\n this.stackOn = 'phone';\n this.align = 'stretch';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host { display: block; min-inline-size: 0; container-type: inline-size; }\n .columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token('layout.gutter.md', '16px')}; align-items: stretch; }\n :host([gap='none']) .columns { gap: 0; }\n :host([gap='sm']) .columns { gap: ${token('layout.gutter.sm', '8px')}; }\n :host([gap='lg']) .columns { gap: ${token('layout.gutter.lg', '32px')}; }\n :host([gap='xl']) .columns { gap: ${token('layout.gutter.xl', '48px')}; }\n :host([align='start']) .columns { align-items: start; }\n :host([align='center']) .columns { align-items: center; }\n :host([align='end']) .columns { align-items: end; }\n :host([columns='one']) .columns { grid-template-columns: minmax(0, 1fr); }\n :host([columns='three']) .columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='four']) .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n :host([columns='sidebar-left']) .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }\n :host([columns='sidebar-right']) .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }\n .column { min-inline-size: 0; overflow-wrap: anywhere; }\n ::slotted(*) { max-inline-size: 100%; }\n @container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n @container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n `,\n ];\n render() {\n const count = this.columns === 'one' ? 1 : this.columns === 'three' ? 3 : this.columns === 'four' ? 4 : 2;\n const fractions = WIDTHS[this.widths]?.split(' ');\n // A width split for a different number of columns would leave a column out, so it is ignored.\n const template = fractions && fractions.length === count ? fractions.map((f) => `minmax(0, ${f})`).join(' ') : '';\n return html`<div class=\"columns\" part=\"row\" style=${template ? `grid-template-columns: ${template}` : ''}>${Array.from({ length: count }, (_, i) => html`<div class=\"column\" part=\"column\"><slot name=${`column-${i + 1}`}></slot></div>`)}</div>`;\n }\n}\ncustomElements.define('impakt-grid', ImpaktGrid);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-grid': ImpaktGrid;\n }\n}\n", "import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { fontWeight, t } from '../base/tokens';\n\n/**\n * What form a help mechanism takes.\n *\n * `link` goes somewhere: a help page, a contact form, a chat. The other four\n * are the \"human contact details\" that 3.2.6 Consistent Help names, shown as\n * text so a reader can see them without following anything.\n */\nexport type HelpKind = 'link' | 'phone' | 'email' | 'address' | 'hours';\n\n/**\n * A help link, or contact details shown as text.\n *\n * **Its identity is `mechanismId`, not its wording or destination.** 3.2.6\n * Consistent Help asks that help offered on several pages appears in the same\n * relative order on each. Strata checks that at publish by comparing these ids\n * across pages, so the label can be reworded and the number can change\n * without the check treating it as a different mechanism. It is literal and\n * cannot be bound, because an id that a data response could change is one the\n * check cannot compare.\n *\n * **Contact details are text, not a link to a page that has them.** The\n * criterion lists a phone number, an email address and a postal address as\n * help in their own right, and a reader who has to follow a link to find the\n * number has been given a link rather than the number. A phone number renders\n * as a `tel:` link and an email address as a `mailto:` link, each with the\n * detail itself as the visible text. The link target is derived from the\n * visible detail rather than authored separately, so the number a reader sees\n * and the number their phone dials cannot drift apart. An address or opening\n * hours render as plain text and keep the line breaks they were written with.\n *\n * **Contact links are named by their caption and their detail.** A phone\n * link's accessible name is \"Call us 0800 123 456\" rather than the bare\n * number, because a reader moving through a list of links hears each one out\n * of context (2.4.4 Link Purpose). The visible text stays inside the name, so\n * 2.5.3 Label in Name holds for a reader who speaks it.\n *\n * **Nothing unnamed or empty is ever rendered.** Runtime bindings may be\n * absent while data loads, or resolve to blank text. A link with no label, or\n * contact details with no detail, render nothing rather than a focusable link\n * with no name or a caption with nothing under it. Contact details whose\n * caption is blank still show the detail, because a phone number or an\n * address names itself. For that reason the caption is optional for contact\n * details, and publishing requires a label only on a link. Publishing does\n * require what each kind cannot do without: a link's label and address, and\n * contact details' detail, so the empty states are only reached at runtime.\n *\n * **Every link meets the minimum target size.** Links here are at least the\n * locked `target.min` token in both directions (2.5.8 Target Size), because a\n * help link usually stands on its own line, where the criterion's inline\n * exemption does not apply.\n *\n * @category action\n * @icon help\n * @role help\n */\nexport class ImpaktHelp extends ImpaktElement {\n static properties = {\n mechanismId: { type: String, attribute: 'mechanism-id' },\n kind: { type: String, reflect: true },\n href: { type: String },\n label: { type: String },\n detail: { type: String },\n };\n\n /** Stable identity across pages, independent of wording and destination. */\n declare mechanismId: string;\n // Written out as a union rather than as `HelpKind` so the manifest offers it\n // as a fixed choice: which form help takes is a design decision, not data.\n /** Whether this is a link to help, or contact details shown as text. */\n declare kind: 'link' | 'phone' | 'email' | 'address' | 'hours';\n /** Where a link goes. Phone and email links are built from the detail instead. */\n declare href: string;\n /**\n * The visible name. For a link it is the link text. For contact details it\n * is the caption shown above them, such as \"Call us\".\n */\n declare label: string;\n /**\n * The contact detail itself: a phone number, an email address, a postal\n * address or opening hours. Line breaks are kept. Unused by a link.\n */\n declare detail: string;\n\n constructor() {\n super();\n this.kind = 'link';\n this.href = '';\n // Defaulted, so the manifest does not mark it required: contact details\n // may leave the caption out. A link without one is refused at publish.\n this.label = '';\n this.detail = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n a { display: inline-flex; align-items: center; min-height: ${t.targetMin}; min-width: ${t.targetMin};\n color: ${t.link}; text-decoration: underline; overflow-wrap: anywhere; max-width: 100%; }\n a:hover { color: ${t.linkHover}; }\n .contact { margin: 0; }\n .caption { display: block; font-weight: ${fontWeight('semibold')}; }\n /* An address is written one line at a time, and opening hours are often one\n day to a line. Long unbroken values still wrap at 320px (1.4.10). */\n .detail { white-space: pre-line; overflow-wrap: anywhere; }\n `,\n ];\n\n render(): TemplateResult | typeof nothing {\n switch (this.kind) {\n case 'phone':\n case 'email':\n case 'address':\n case 'hours':\n return this.renderContact();\n default:\n // An absent or unrecognised kind keeps the original link behaviour, so\n // a page published before contact details existed renders unchanged.\n return this.renderLink();\n }\n }\n\n private renderLink(): TemplateResult | typeof nothing {\n // Runtime bindings may be absent while data loads, or resolve to blank text.\n // Do not expose an unnamed focusable link in those states.\n if (!text(this.label)) return nothing;\n return html`<a part=\"link\" href=${this.href}>${this.label}</a>`;\n }\n\n private renderContact(): TemplateResult | typeof nothing {\n const detail = text(this.detail);\n // A caption with nothing under it is not help, so neither is drawn.\n if (!detail) return nothing;\n const caption = text(this.label);\n const target = contactHref(this.kind, detail);\n const captionId = this.id_('caption');\n const detailId = this.id_('detail');\n const captionPart = caption ? html`<span class=\"caption\" part=\"label\" id=${captionId}>${caption}</span>` : nothing;\n const detailPart = target\n ? html`<a part=\"link\" href=${target} aria-labelledby=${caption ? `${captionId} ${detailId}` : nothing}\n ><span class=\"detail\" part=\"detail\" id=${detailId}>${detail}</span></a>`\n : html`<span class=\"detail\" part=\"detail\">${detail}</span>`;\n return html`<p class=\"contact\" part=\"contact\">${captionPart}${detailPart}</p>`;\n }\n}\n\n/** Trimmed text, or empty for anything that is not a string. */\nfunction text(value: unknown): string {\n return typeof value === 'string' ? value.trim() : '';\n}\n\n/**\n * The link a contact detail opens, or empty when it should stay as text.\n *\n * A phone number is reduced to its digits and one leading `+`, and the \"(0)\"\n * that UK numbers print after the country code is dropped, because the\n * separators a reader expects are not dialled. A value with no digits, or an\n * email address without an `@`, stays as plain text. The reader still sees\n * it, and nothing offers to dial or mail something that cannot work.\n */\nfunction contactHref(kind: string, detail: string): string {\n if (kind === 'phone') {\n const digits = detail\n .replace(/\\(0\\)/g, '')\n .replace(/[^\\d+]/g, '')\n .replace(/(?!^)\\+/g, '');\n return /\\d/.test(digits) ? `tel:${digits}` : '';\n }\n if (kind === 'email') return /^[^\\s@]+@[^\\s@]+$/.test(detail) ? `mailto:${detail}` : '';\n return '';\n}\n\ncustomElements.define('impakt-help', ImpaktHelp);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-help': ImpaktHelp;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impakt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impakt-page-inner: 760px; }\n :host([width='wide']) { --impakt-page-inner: 1440px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impakt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impakt-page (min-width: 40rem) { .frame { --impakt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impakt-page (min-width: 64rem) { .frame { --impakt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpaktPage extends ImpaktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n };\n /** How wide the content runs. Standard is the brand's page width. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n widths,\n margins,\n css`\n :host { display: block; container: impakt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impakt-page-inner) + 2 * var(--impakt-page-margin)); margin-inline: auto; padding-inline: var(--impakt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impakt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-header', 'inherit')}; }\n footer { --impakt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impakt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impakt-page-margin)); max-inline-size: var(--impakt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `,\n ];\n\n private hasSlot(name: string): boolean {\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impakt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impakt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impakt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPAKT-') && !/^IMPAKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpaktSection extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n pattern: { type: String, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The band's background. Text on it takes the matching colour, so it stays readable. */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent';\n /** Space inside the band, above and below its content. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** How wide the content inside runs. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /**\n * Fine lines drawn across the band: a square grid, a closer blueprint grid,\n * upright columns or ruled lines. They are decoration, drawn in the band's\n * own text colour at a tenth of its strength, and are left out in a forced\n * colours mode.\n */\n declare pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.pattern = 'none';\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n widths,\n css`\n :host { display: block; --impakt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impakt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impakt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impakt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; --impakt-color-text-link-hover: ${t.onBrand}; }\n /* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */\n :host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host([tone='accent']) { --impakt-band: ${token('color.accent.default', '#ffd43b')}; --impakt-band-on: ${token('color.accent.on', '#1a1a1a')}; --impakt-band-muted: ${token('color.accent.on', '#1a1a1a')}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }\n /* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */\n :host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }\n :host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }\n :host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }\n :host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }\n :host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }\n @media (forced-colors: active) { .band { background-image: none !important; } }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n .content { max-inline-size: var(--impakt-page-inner); margin-inline: auto; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impakt-page', ImpaktPage);\ncustomElements.define('impakt-section', ImpaktSection);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-page': ImpaktPage;\n 'impakt-section': ImpaktSection;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One link in a navigation or a trail. */\nexport interface NavLink {\n label: string;\n href: string;\n}\n\n/** Whether a link is the page the visitor is on, or a page above it. */\nfunction where(href: string): 'page' | 'section' | null {\n // A link to a place on this page, or to nowhere yet (\"#\"), is not where the reader is.\n if (typeof location === 'undefined' || !href || href.startsWith('#')) return null;\n let path: string;\n try {\n const url = new URL(href, location.href);\n // A link to another site is never where the reader is, even when its path matches, as a\n // product at app.example.com linking back to example.com/ would otherwise mark that link.\n if (url.origin !== location.origin) return null;\n path = url.pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n const here = location.pathname.replace(/\\/$/, '') || '/';\n if (path === here) return 'page';\n return path !== '/' && here.startsWith(`${path}/`) ? 'section' : null;\n}\n\n/**\n * The site's main navigation: a row of links that folds into a Menu button\n * when there is not room for all of them, whatever the screen.\n *\n * **The page you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and an\n * underline, so it does not rely on colour alone (1.4.1).\n *\n * **The menu is a disclosure, not a pop-up.** The Menu button says whether the\n * list is open (`aria-expanded`), the links follow it in the reading order, and\n * Escape closes it and returns focus to the button.\n *\n * @category action\n * @icon menu\n */\nexport class ImpaktNav extends ImpaktElement {\n static properties = {\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\n menuLook: { type: String, reflect: true, attribute: 'menu-look' },\n size: { type: String, reflect: true },\n align: { type: String, reflect: true },\n };\n /** The links, in order. */\n declare links: NavLink[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The words on the button that opens the links on a narrow screen. */\n declare menuText: string;\n /**\n * The Menu button: `button` with its words, or `icon`, a round button with\n * only the icon, the words kept as its name for screen readers.\n */\n declare menuLook: 'button' | 'icon';\n /** `sm` sets the links a step smaller and closer, as a site header's are. */\n declare size: 'md' | 'sm';\n /** Where the links sit along the row. */\n declare align: 'start' | 'center' | 'end';\n /** Whether the menu is open on a narrow screen. Not a setting: it is the visitor's. */\n private menuOpen = false;\n private get open(): boolean {\n return this.menuOpen;\n }\n private set open(next: boolean) {\n this.menuOpen = next;\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.menuLook = 'button';\n this.size = 'md';\n this.align = 'end';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n /* It grows to fill a row it sits in, because it measures itself to decide when to fold. */\n :host { display: block; flex: 1 1 8rem; min-inline-size: 0; }\n nav { display: flex; flex-direction: column; position: relative; }\n li { flex: none; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)} ${space(6)}; align-items: center; justify-content: flex-end; }\n :host([align='start']) ul { justify-content: flex-start; }\n :host([align='center']) ul { justify-content: center; }\n a { ${targetSize} display: inline-flex; align-items: center; padding: ${space(2)} ${space(1)}; color: inherit; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radiusSm}; }\n a:hover { text-decoration: underline; text-underline-offset: 0.25em; }\n a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }\n .toggle { display: none; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n /* When they do not fit, the links fold behind a Menu button and open as a panel under it. */\n :host([folded]) { flex: 0 0 auto; }\n :host([folded]) .toggle { display: inline-flex; }\n :host([menu-look='icon']) .toggle { inline-size: 44px; block-size: 44px; padding: 0; justify-content: center; border: 0; border-radius: 50%; background: ${t.brand}; color: ${t.onBrand}; }\n :host([menu-look='icon']) .toggle .words { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n :host([size='sm']) ul { column-gap: ${space(6)}; }\n :host([size='sm']) a { padding-inline: 0; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('medium')}; }\n :host([size='sm'][folded]) a { padding-inline: ${space(3)}; }\n :host([folded]) ul { display: none; position: absolute; inset-block-start: calc(100% + ${space(2)}); inset-inline-end: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 0; min-inline-size: 14rem; padding: ${space(2)}; background: ${t.surfaceCard}; color: ${t.text}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: 0 8px 24px rgb(0 0 0 / 14%); }\n :host([folded]) ul.open { display: flex; }\n :host([folded]) li { text-align: start; }\n :host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }\n `,\n ];\n\n /** The width the links need in one row. Measured once for each set of links, and again while folded it cannot be read. */\n private needs = 0;\n private resize?: ResizeObserver;\n\n private fit(): void {\n const room = this.getBoundingClientRect().width;\n if (room <= 0) return;\n if (!this.needs) {\n this.removeAttribute('folded');\n const items = Array.from(this.renderRoot.querySelectorAll('li'));\n const gap = Number.parseFloat(getComputedStyle(this.renderRoot.querySelector('ul')!).columnGap) || 0;\n this.needs = items.reduce((total, item) => total + item.getBoundingClientRect().width, 0) + gap * Math.max(0, items.length - 1);\n }\n const fold = this.needs > room;\n this.toggleAttribute('folded', fold);\n if (!fold && this.menuOpen) this.open = false;\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (changed.has('links')) {\n this.needs = 0;\n this.fit();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(() => this.fit());\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resize?.disconnect();\n }\n\n private toggle(): void {\n this.open = !this.open;\n }\n\n private onKey(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open) return;\n this.open = false;\n this.renderRoot.querySelector<HTMLButtonElement>('.toggle')?.focus();\n }\n\n render(): TemplateResult {\n const list = this.id_('links');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\" @keydown=${this.onKey}>\n <button class=\"toggle\" type=\"button\" aria-expanded=${this.open ? 'true' : 'false'} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? 'close' : this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <ul id=${list} class=${this.open ? 'open' : ''} part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n\n/**\n * Where the page sits in the site, as a trail of links back to the top: Home,\n * then Developments, then this page.\n *\n * The last item is the page itself. It is not a link, and it carries\n * `aria-current=\"page\"`. The separators are drawn, not written, so a screen\n * reader reads the trail as a list rather than a string of slashes.\n *\n * @category action\n * @icon breadcrumbs\n */\nexport class ImpaktBreadcrumbs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n };\n /** The trail, from the top of the site down to this page. */\n declare items: NavLink[];\n /** What the trail is called for a screen reader. */\n declare label: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Breadcrumb';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; font-size: ${fontSize('sm')}; }\n ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${space(1)}; }\n li { display: inline-flex; align-items: center; gap: ${space(1)}; }\n li + li::before { content: ''; inline-size: 0.45em; block-size: 0.45em; border-block-start: 1.5px solid ${t.textMuted}; border-inline-end: 1.5px solid ${t.textMuted}; transform: rotate(45deg); margin-inline: ${space(1)} ${space(2)}; }\n a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }\n a:hover { color: ${t.linkHover}; }\n [aria-current] { color: ${t.textMuted}; }\n .sr-only { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const items = this.items ?? [];\n return html`<nav aria-label=${this.label} part=\"nav\"><ol>\n ${items.map(\n (item, i) =>\n html`<li>${\n i === items.length - 1 ? html`<span aria-current=\"page\">${item.label}</span>` : html`<a href=${item.href} part=\"link\">${item.label}</a>`\n }</li>`,\n )}\n </ol></nav>`;\n }\n}\n\ncustomElements.define('impakt-nav', ImpaktNav);\ncustomElements.define('impakt-breadcrumbs', ImpaktBreadcrumbs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-nav': ImpaktNav;\n 'impakt-breadcrumbs': ImpaktBreadcrumbs;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, lineHeight, space, t } from '../base/tokens';\nimport { announceNavigate } from './shell';\n\n/**\n * A line between two parts of a page.\n *\n * It is decoration, so a screen reader passes over it. Where the change of\n * subject matters, a heading says so better.\n *\n * @category layout\n * @icon divider\n */\nexport class ImpaktDivider extends ImpaktElement {\n static properties = {\n spacing: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Space above and below the line. */\n declare spacing: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'subtle' | 'strong';\n\n constructor() {\n super();\n this.spacing = 'md';\n this.tone = 'subtle';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; }\n hr { margin: ${space(4)} 0; border: 0; border-block-start: ${t.borderThin} solid ${t.border}; opacity: 0.5; }\n :host([tone='strong']) hr { opacity: 1; border-block-start-width: ${t.borderThick}; }\n :host([spacing='sm']) hr { margin-block: ${space(2)}; }\n :host([spacing='lg']) hr { margin-block: ${space(8)}; }\n :host([spacing='xl']) hr { margin-block: ${space(12)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<hr aria-hidden=\"true\" part=\"line\" />`;\n }\n}\n\n/**\n * Empty space, from the spacing scale, for the rare place where the gaps of the\n * containers around it are not enough.\n *\n * @category layout\n * @icon spacer\n */\nexport class ImpaktSpacer extends ImpaktElement {\n static properties = { size: { type: String, reflect: true } };\n declare size: 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; block-size: ${space(4)}; }\n :host([size='sm']) { block-size: ${space(2)}; }\n :host([size='lg']) { block-size: ${space(8)}; }\n :host([size='xl']) { block-size: ${space(12)}; }\n :host([size='2xl']) { block-size: ${space(16)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html``;\n }\n}\n\n/**\n * Words a screen reader says that are not shown: \"(opens a map)\" after a link\n * whose purpose is clear on screen from where it sits.\n *\n * @category typography\n * @icon hidden\n * @slot - The words to say.\n */\nexport class ImpaktVisuallyHidden extends ImpaktElement {\n static styles = [...ImpaktElement.styles, css`:host { ${visuallyHidden} }`];\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** One tab and what it shows. */\nexport interface TabItem {\n id: string;\n label: string;\n /** The panel's words. A child with `slot` set to the tab's id is shown instead, for anything richer. */\n body?: string;\n /** A number shown on the tab, such as the open tasks behind it. */\n count?: number;\n /** The count in words for a screen reader, such as \"2 overdue tasks\". The number alone when empty. */\n countLabel?: string;\n /** Where the tab goes. When every tab has one, the tabs are links to pages, not panels. */\n href?: string;\n}\n\n/**\n * Panels of content behind a row of tabs, one shown at a time: the floor plans\n * of three house types, or a case's summary, tasks and files.\n *\n * It follows the ARIA tabs pattern. The tabs are one stop in the tab order,\n * the arrow keys, Home and End move between them, and each panel is labelled\n * by its tab. Use an accordion instead when someone may want to compare panels.\n *\n * **The tabs stay on one row** and scroll sideways when they do not fit, as the\n * design guide sets, and the chosen tab is scrolled into view, so on a phone it\n * is never hidden off the edge. With `two-rows`, a set of more than four tabs is\n * laid out in two rows on a narrow screen instead, so every tab can be seen.\n *\n * **The chosen tab is kept** when the tabs are given again, as a React or Vue app\n * does on every render, so long as a tab with that id is still there.\n *\n * A panel shows its item's `body`, or a child whose `slot` is the item's id.\n *\n * **Tabs that go to pages are links.** When every item has an `href`, such as\n * a job's Overview, Money and Notes, each of which has its own address, the\n * tabs are drawn the same but are a `nav` of links, the current one marked\n * `aria-current=\"page\"`, with no panels. A row of links is not the ARIA tabs\n * pattern, and announcing it as one would promise arrow keys and panels that\n * are not there. They send `impakt-navigate` like the side navigation, so an\n * app can route without a reload.\n *\n * `look=\"pill\"` draws the tabs as pills in a rounded bar, with the chosen one\n * filled, as a product's workspace tabs are.\n *\n * @category content\n * @icon tabs\n * @slot - A child with `slot` set to a tab's id is that tab's panel.\n * @fires {CustomEvent<{ value: string }>} impakt-change - When another tab is chosen.\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When a tab that is a link is followed. Cancel it to route in the app.\n */\nexport class ImpaktTabs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n selected: { type: String, reflect: true },\n label: { type: String },\n twoRows: { type: Boolean, reflect: true, attribute: 'two-rows' },\n look: { type: String, reflect: true },\n };\n declare items: TabItem[];\n /** The id of the tab shown first. The first tab when it is empty. */\n declare selected: string;\n /** What the set of tabs is about, for a screen reader. */\n declare label: string;\n /** On a narrow screen, lay more than four tabs out in two rows rather than scroll them. */\n declare twoRows: boolean;\n /** `line` underlines the chosen tab; `pill` fills it, in a rounded bar. */\n declare look: 'line' | 'pill';\n\n constructor() {\n super();\n this.items = [];\n this.selected = '';\n this.label = '';\n this.twoRows = false;\n this.look = 'line';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget(\"[role='tab']\"),\n css`\n /* Only the two-row layout needs a size container. Making every tab set one\n would take its width from its parent alone, so in a flex row, with no\n width given, it would shrink to nothing. In a row it may still shrink\n below its tabs, which then scroll, rather than widen the page. */\n :host { display: block; min-inline-size: 0; }\n :host([two-rows]) { container-type: inline-size; }\n [role='tablist'] { display: flex; gap: ${space(1)}; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n [role='tab'] { ${targetSize} position: relative; flex: none; padding: ${space(3)} ${space(4)}; font: inherit; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; background: transparent; border: 0; border-block-end: 3px solid transparent; margin-block-end: -1px; cursor: pointer; border-radius: ${t.radius} ${t.radius} 0 0; }\n /* Inside a box that scrolls the ring would be clipped, so it is drawn inside the tab. */\n [role='tab']:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; }\n [role='tab']:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n [role='tab'][aria-selected='true'] { color: ${t.link}; border-block-end-color: currentColor; }\n [role='tabpanel'] { padding-block: ${space(5)}; line-height: ${lineHeight('normal')}; }\n .body { white-space: pre-line; }\n @container (max-width: 40rem) {\n :host([two-rows]) [role='tablist'].many { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); overflow: visible; border-block-end: 0; gap: ${space(1)}; }\n :host([two-rows]) .many [role='tab'] { white-space: normal; padding-inline: ${space(2)}; margin: 0; border-block-end-width: 3px; border-block-end-color: ${t.rule}; border-radius: ${t.radius}; }\n :host([two-rows]) .many [role='tab'][aria-selected='true'] { border-block-end-color: currentColor; background: ${t.brandSubtle}; }\n }\n @media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }\n .count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 20px; margin-inline-start: ${space(2)}; padding: 0 ${space(1.5)}; border-radius: 999px; font-size: 12px; font-weight: ${fontWeight('semibold')}; background: ${t.brand}; color: ${t.onBrand}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n /* Links drawn as tabs. */\n nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; overflow-x: auto; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n nav a { ${targetSize} position: relative; display: inline-flex; align-items: center; flex: none; padding: ${space(3)} ${space(4)}; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; text-decoration: none; border-block-end: 3px solid transparent; margin-block-end: -1px; border-radius: ${t.radius} ${t.radius} 0 0; }\n nav a:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n nav a[aria-current='page'] { color: ${t.link}; border-block-end-color: currentColor; }\n nav a:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; outline: none; }\n /* The pill look, for either kind. */\n :host([look='pill']) :is([role='tablist'], nav ul) { padding: ${space(1)}; border: 0; border-radius: 999px; background: ${t.surfaceCard}; gap: ${space(0.5)}; }\n :host([look='pill']) :is([role='tab'], nav a) { padding: ${space(2)} ${space(4)}; margin: 0; border: 0; border-radius: 999px; font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([look='pill']) :is([role='tab'], nav a):hover { background: ${t.surfaceInset}; }\n :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { background: ${t.text}; color: ${t.surfaceCard}; }\n @media (forced-colors: active) { :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { border: 2px solid Highlight; } }\n `,\n ];\n\n private countOf(item: TabItem): TemplateResult | typeof nothing {\n if (typeof item.count !== 'number') return nothing;\n return item.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${item.count}</span><span class=\"sr-only\">, ${item.countLabel}</span>`\n : html`<span class=\"count\">${item.count}</span>`;\n }\n\n private get linked(): boolean {\n const items = this.items ?? [];\n return items.length > 0 && items.every((i) => Boolean(i.href));\n }\n\n private current(): string {\n const items = this.items ?? [];\n return items.some((i) => i.id === this.selected) ? this.selected : (items[0]?.id ?? '');\n }\n\n private choose(id: string, focus: boolean): void {\n if (id === this.current()) return;\n this.selected = id;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { value: id }, bubbles: true, composed: true }));\n if (focus) void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`#${this.id_(`tab-${id}`)}`)?.focus({ preventScroll: true }));\n }\n\n private onKey(event: KeyboardEvent): void {\n const items = this.items ?? [];\n const at = items.findIndex((i) => i.id === this.current());\n const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: items.length - 1 }[event.key];\n if (to === undefined || !items.length) return;\n event.preventDefault();\n this.choose(items[(to + items.length) % items.length]!.id, true);\n }\n\n /**\n * Bring the chosen tab into view inside the row of tabs. Only the row scrolls:\n * `scrollIntoView` would scroll the page too, and move someone who is reading\n * further down.\n */\n private reveal(): void {\n const list = this.renderRoot.querySelector<HTMLElement>(\"[role='tablist']\");\n const tab = this.renderRoot.querySelector<HTMLElement>(\"[role='tab'][aria-selected='true']\");\n if (!list || !tab || list.scrollWidth <= list.clientWidth) return;\n const start = tab.offsetLeft - list.offsetLeft;\n const end = start + tab.offsetWidth;\n if (start < list.scrollLeft) list.scrollLeft = start - 16;\n else if (end > list.scrollLeft + list.clientWidth) list.scrollLeft = end - list.clientWidth + 16;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('selected') || changed.has('items')) this.reveal();\n }\n\n render(): TemplateResult {\n const items = this.items ?? [];\n const current = this.current();\n if (this.linked) {\n return html`<nav aria-label=${this.label || nothing} part=\"tabs\"><ul>\n ${items.map((item) => html`<li><a href=${item.href!} part=\"tab\" aria-current=${item.id === current ? 'page' : nothing} @click=${(e: MouseEvent) => announceNavigate(this, e, { href: item.href!, id: item.id })}>${item.label}${this.countOf(item)}</a></li>`)}\n </ul></nav>`;\n }\n const many = items.length > 4;\n return html`<div role=\"tablist\" aria-label=${this.label || nothing} part=\"tabs\" class=${many ? 'many' : ''} style=${many ? `--columns:${Math.ceil(items.length / 2)}` : nothing} @keydown=${this.onKey}>\n ${items.map((item) => html`<button role=\"tab\" type=\"button\" id=${this.id_(`tab-${item.id}`)} aria-selected=${item.id === current ? 'true' : 'false'} aria-controls=${this.id_(`panel-${item.id}`)} tabindex=${item.id === current ? '0' : '-1'} @click=${() => this.choose(item.id, false)}>${item.label}${this.countOf(item)}</button>`)}\n </div>\n ${items.map((item) => html`<div role=\"tabpanel\" id=${this.id_(`panel-${item.id}`)} aria-labelledby=${this.id_(`tab-${item.id}`)} tabindex=\"0\" ?hidden=${item.id !== current} part=\"panel\"><slot name=${item.id}><span class=\"body\">${item.body ?? ''}</span></slot></div>`)}`;\n }\n}\n\ncustomElements.define('impakt-divider', ImpaktDivider);\ncustomElements.define('impakt-spacer', ImpaktSpacer);\ncustomElements.define('impakt-visually-hidden', ImpaktVisuallyHidden);\ncustomElements.define('impakt-tabs', ImpaktTabs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-divider': ImpaktDivider;\n 'impakt-spacer': ImpaktSpacer;\n 'impakt-visually-hidden': ImpaktVisuallyHidden;\n 'impakt-tabs': ImpaktTabs;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, lineHeight, space, t } from '../base/tokens';\n\n/**\n * Fields that belong together under one question: the lines of an address,\n * or a name in two parts.\n *\n * **The question is the group's name.** It is a `fieldset` with a `legend`, so\n * a screen reader says \"Your address, group\" on the way in, and each field\n * inside is heard as part of it (1.3.1, 3.3.2). An error for the group as a\n * whole, such as \"Enter a full address\", is tied to it the same way.\n *\n * @category form\n * @icon fieldset\n * @slot - The fields in the group.\n */\nexport class ImpaktFieldset extends ImpaktElement {\n static properties = {\n legend: { type: String },\n description: { type: String },\n error: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n /** The question the fields answer together. */\n declare legend: string;\n /** A hint for the whole group, under the question. */\n declare description: string;\n /** What is wrong with the group as a whole. */\n declare error: string;\n /** How large the question is. A page that asks only this question makes it the page's heading size. */\n declare size: 'md' | 'lg' | 'xl';\n\n constructor() {\n super();\n this.legend = '';\n this.description = '';\n this.error = '';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; margin-block-end: ${space(6)}; }\n fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }\n legend { padding: 0; margin-block-end: ${space(2)}; font-size: ${fontSize('md')}; font-weight: ${fontWeight('bold')}; line-height: ${lineHeight('tight')}; color: ${t.text}; }\n :host([size='lg']) legend { font-size: ${fontSize('xl')}; font-family: ${t.fontHeading}; color: ${t.textHeading}; }\n :host([size='xl']) legend { font-size: ${fontSize('2xl')}; font-family: ${t.fontHeading}; color: ${t.textHeading}; }\n .description { margin-block-end: ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.textMuted}; line-height: ${lineHeight('normal')}; }\n .error { margin-block-end: ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.dangerText}; font-weight: ${fontWeight('semibold')}; }\n .error:empty { display: none; }\n :host([error]:not([error=''])) .fields { padding-inline-start: ${space(4)}; border-inline-start: 4px solid ${t.danger}; }\n `,\n ];\n\n render(): TemplateResult {\n const described = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean).join(' ');\n return html`<fieldset part=\"fieldset\" aria-describedby=${described || nothing}>\n <legend part=\"legend\">${this.legend}</legend>\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')}>${this.description}</div>` : nothing}\n <div class=\"error\" id=${this.id_('error')} aria-live=\"polite\">${this.error || nothing}</div>\n <div class=\"fields\" part=\"fields\"><slot></slot></div>\n </fieldset>`;\n }\n}\n\ncustomElements.define('impakt-fieldset', ImpaktFieldset);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-fieldset': ImpaktFieldset;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { pageLocale } from '../base/locale';\nimport { FieldElement } from '../base/FieldElement';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontWeight, space, spaceAround, t, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A panel that slides in from the side: a basket, filters, a plot's details.\n *\n * It is a native `<dialog>` opened with `showModal()`, like the dialog, so the\n * focus trap, Escape, the inert page behind it and the return of focus all come\n * from the browser. The page behind it does not scroll while it is open. The\n * slide is a decoration and stops for anyone who has asked for reduced motion.\n * On a phone it fills the screen.\n *\n * With `side=\"bottom\"` it is a sheet that rises from the bottom edge, as a\n * phone's dialogs do: as wide as the screen, as tall as its content up to\n * nine tenths of the screen, with its top corners rounded.\n *\n * @category feedback\n * @icon drawer\n * @slot - The body of the panel.\n * @slot footer - Buttons pinned to the bottom of the panel.\n * @fires {CustomEvent<null>} impakt-close - When the panel is closed.\n */\nexport class ImpaktDrawer extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n side: { type: String, reflect: true },\n closeLabel: { type: String, attribute: 'close-label' },\n };\n declare open: boolean;\n declare heading: string;\n /** Which edge it comes in from. `bottom` is a sheet, for a phone. */\n declare side: 'left' | 'right' | 'bottom';\n declare closeLabel: string;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.side = 'right';\n this.closeLabel = 'Close';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog { box-sizing: border-box; display: none; flex-direction: column; inline-size: min(28rem, 100vw); max-inline-size: 100vw; block-size: 100dvh; max-block-size: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; color: ${t.text}; background: ${t.surfaceCard}; box-shadow: ${t.shadowXl}; animation: from-right 240ms cubic-bezier(0.16, 1, 0.3, 1); }\n dialog[open] { display: flex; }\n :host([side='left']) dialog { margin: 0 auto 0 0; animation-name: from-left; }\n :host([side='bottom']) dialog { inline-size: 100vw; block-size: fit-content; max-block-size: 90dvh; margin: auto 0 0 0; padding-block-end: env(safe-area-inset-bottom); border-radius: 28px 28px 0 0; animation-name: from-bottom; }\n :host([side='bottom']) .head { box-shadow: none; }\n :host([side='bottom']) .foot { box-shadow: none; }\n :host([side='bottom']) .foot ::slotted(*) { flex: 1; }\n @keyframes from-bottom { from { transform: translateY(100%); } }\n dialog::backdrop { background: color-mix(in srgb, ${t.text} 30%, transparent); backdrop-filter: blur(2px); }\n @keyframes from-right { from { transform: translateX(100%); } }\n @keyframes from-left { from { transform: translateX(-100%); } }\n .head { display: flex; align-items: center; justify-content: space-between; gap: ${space(3)}; padding: ${space(4)} ${space(5)}; box-shadow: 0 1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }\n h2 { margin: 0; font-family: ${t.fontHeading}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n .close { ${targetSize} display: inline-flex; align-items: center; justify-content: center; padding: 0; color: ${t.text}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .close:hover { background: ${t.surfaceSubtle}; }\n .body { flex: 1; overflow: auto; padding: ${space(5)}; }\n .foot { display: flex; gap: ${space(3)}; justify-content: flex-end; padding: ${space(4)} ${space(5)}; box-shadow: 0 -1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }\n .foot[hidden] { display: none; }\n `,\n ];\n\n private hasFooter = false;\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n private footerChanged(event: Event): void {\n this.hasFooter = (event.target as HTMLSlotElement).assignedNodes().length > 0;\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n return html`<dialog part=\"dialog\" aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${() => this.close()}\n @close=${() => {\n if (this.open) this.close();\n }}\n @click=${(event: Event) => {\n if (event.target === this.dialog) this.close();\n }}>\n <div class=\"head\">\n ${this.heading ? html`<h2 id=${this.id_('heading')}>${this.heading}</h2>` : html`<span></span>`}\n <button class=\"close\" type=\"button\" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg('close', '20px')}</button>\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n <div class=\"foot\" part=\"footer\" ?hidden=${!this.hasFooter}><slot name=\"footer\" @slotchange=${this.footerChanged}></slot></div>\n </dialog>`;\n }\n}\n\nconst TOAST_ICON: Record<string, string> = { neutral: 'info', success: 'check', warning: 'warning', danger: 'warning' };\n\n/**\n * A short message in the corner that goes away: \"Viewing booked\", \"Saved\".\n *\n * It says itself to a screen reader through a live region that is on the page\n * before the message is, and its timer stops while it is pointed at or focused.\n * Set `duration` to 0 to keep it up until it is closed. A message with a button,\n * such as Undo, stays until it is closed whatever the duration, because a\n * button that disappears on a timer cannot be pressed by someone who needs\n * longer (2.2.1). Escape closes it while focus is inside it. Anything a person\n * must act on belongs in an alert on the page.\n *\n * It never takes the page's clicks: only the message itself can be pressed, so\n * the page beside and behind the corner it sits in still works. On a phone it\n * spans the screen above the bottom edge, clear of the home bar and of a bottom\n * bar that sets `--impakt-bottom-bar`, and it rises without moving for anyone who\n * has asked for reduced motion.\n *\n * @category feedback\n * @icon toast\n * @fires {CustomEvent<null>} impakt-close - When the message goes away.\n * @fires {CustomEvent<null>} impakt-action - When its button is pressed.\n */\nexport class ImpaktToast extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n message: { type: String },\n tone: { type: String, reflect: true },\n duration: { type: Number },\n actionText: { type: String, attribute: 'action-text' },\n closeLabel: { type: String, attribute: 'close-label' },\n };\n declare open: boolean;\n declare message: string;\n declare tone: 'neutral' | 'success' | 'warning' | 'danger';\n /** How long it stays. 0 keeps it up until it is closed. */\n declare duration: number;\n declare actionText: string;\n declare closeLabel: string;\n\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n super();\n this.open = false;\n this.message = '';\n this.tone = 'neutral';\n this.duration = 6;\n this.actionText = '';\n this.closeLabel = 'Dismiss';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n .region { position: fixed; inset-block-end: calc(${space(4)} + env(safe-area-inset-bottom, 0px) + var(--impakt-bottom-bar, 0px)); inset-inline-end: ${space(4)}; z-index: 1000; inline-size: min(24rem, calc(100vw - ${space(8)})); pointer-events: none; }\n @media (max-width: 40rem) { .region { inset-inline: ${space(3)}; inline-size: auto; inset-block-end: calc(${space(3)} + env(safe-area-inset-bottom, 0px) + var(--impakt-bottom-bar, 0px)); } }\n .toast { pointer-events: auto; max-block-size: 40vh; overflow: auto; display: flex; align-items: flex-start; gap: ${space(3)}; padding: ${space(3)} ${space(3)} ${space(3)} ${space(4)}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowXl}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1); }\n /* It rises without fading in, so its words are at full contrast from the first frame they are read in (1.4.3). */\n @keyframes rise { from { transform: translateY(${space(3)}); } }\n .mark { display: inline-flex; flex: none; margin-block-start: ${space(0.5)}; color: ${t.info}; }\n :host([tone='success']) .mark { color: ${t.success}; }\n :host([tone='warning']) .mark { color: ${t.warning}; }\n :host([tone='danger']) .mark { color: ${t.danger}; }\n .message { flex: 1; align-self: center; margin: 0; ${type('sm')} font-weight: ${fontWeight('medium')}; }\n .action, .close { ${targetSize} padding: 0 ${space(2)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('semibold')}; color: ${t.link}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .close { display: inline-flex; align-items: center; justify-content: center; color: ${t.textMuted}; }\n .action:hover, .close:hover { background: ${t.surfaceSubtle}; }\n `,\n touchTarget('.action, .close'),\n ];\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('open') || changed.has('duration')) {\n this.stop();\n if (this.open) this.start();\n }\n }\n\n private start(): void {\n this.stop();\n if (this.duration > 0 && !this.actionText) this.timer = setTimeout(() => this.close(), this.duration * 1000);\n }\n\n private stop(): void {\n if (this.timer) clearTimeout(this.timer);\n this.timer = undefined;\n }\n\n private close(): void {\n this.stop();\n if (!this.open) return;\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n private action(): void {\n this.dispatchEvent(new CustomEvent('impakt-action', { bubbles: true, composed: true }));\n this.close();\n }\n\n render(): TemplateResult {\n return html`<div class=\"region\" role=\"status\" aria-live=\"polite\">\n ${\n this.open\n ? html`<div class=\"toast\" part=\"toast\" @mouseenter=${this.stop} @mouseleave=${this.start} @focusin=${this.stop} @focusout=${this.start}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n }\n }}>\n <span class=\"mark\">${iconSvg(TOAST_ICON[this.tone] ?? 'info', '20px')}</span>\n <p class=\"message\">${this.message}</p>\n ${this.actionText ? html`<button class=\"action\" type=\"button\" @click=${this.action}>${this.actionText}</button>` : nothing}\n <button class=\"close\" type=\"button\" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg('close', '16px')}</button>\n </div>`\n : nothing\n }\n </div>`;\n }\n}\n\nexport interface MenuItem {\n id?: string;\n text: string;\n /** Where it goes. Without one it fires impakt-select with its value. */\n href?: string;\n value?: string;\n icon?: string;\n tone?: '' | 'danger';\n}\n\n/**\n * A button that opens a short list of actions or links.\n *\n * It follows the ARIA menu button pattern: the arrow keys, Home and End move\n * through it, a letter moves to the next item that starts with it, Escape\n * closes it and puts focus back on the button, and a click anywhere else closes\n * it. A list that would run off the side of the screen opens towards the other\n * edge instead, so it never makes a phone scroll sideways.\n *\n * **The button can hold your own content.** Put an avatar and a name in the\n * `trigger` slot for an account menu; they replace the icon and label, and\n * become the button's accessible name, so include the words. Put who is signed\n * in, or any other note, in the `header` slot; it sits above the items and\n * outside the menu, so the arrow keys still move through the items alone.\n *\n * @category navigation\n * @icon menu\n * @slot trigger - What the button shows, in place of the icon and label.\n * @slot header - A note above the items, such as the name and email of who is signed in.\n * @csspart trigger - The button.\n * @csspart chevron - The arrow on the button.\n * @csspart panel - The box that opens, holding the header and the items.\n * @csspart header - The box round the header slot.\n * @csspart list - The list of items.\n * @fires {CustomEvent<{ value: string }>} impakt-select - When an item without an address is chosen. The value is in detail.value.\n */\nexport class ImpaktMenu extends ImpaktElement {\n static properties = {\n label: { type: String },\n icon: { type: String },\n items: { type: Array },\n edge: { type: String, reflect: true },\n open: { type: Boolean, reflect: true },\n };\n declare label: string;\n declare icon: string;\n declare items: MenuItem[];\n /** Which edge of the button the list lines up with. */\n declare edge: 'start' | 'end';\n declare open: boolean;\n\n constructor() {\n super();\n this.label = 'Menu';\n this.icon = '';\n this.items = [];\n this.edge = 'start';\n this.open = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.trigger, .item'),\n css`\n :host { position: relative; display: inline-block; }\n .trigger { ${targetSize} display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(2)} ${space(3.5)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('semibold')}; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: ${t.shadowXs}; cursor: pointer; }\n .trigger:hover { background: ${t.surfaceSubtle}; }\n .chev { display: inline-flex; color: ${t.textMuted}; transition: transform 120ms ease-in-out; }\n :host([open]) .chev { transform: rotate(180deg); }\n .panel { position: absolute; z-index: 100; inset-block-start: calc(100% + ${space(1.5)}); inset-inline-start: 0; box-sizing: border-box; min-inline-size: 13rem; max-inline-size: min(20rem, 90vw); padding: ${space(1.5)}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowLg}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: pop 120ms ease-out; }\n .list { margin: 0; padding: 0; list-style: none; }\n .header { padding: ${space(2)} ${space(2.5)} ${space(2.5)}; margin-block-end: ${space(1.5)}; border-block-end: ${t.borderThin} solid ${t.border}; ${type('sm')} color: ${t.textMuted}; overflow-wrap: anywhere; }\n :host([edge='end']) .panel, .panel.flip-end { inset-inline: auto 0; }\n :host([edge='end']) .panel.flip-start { inset-inline: 0 auto; }\n @keyframes pop { from { opacity: 0; transform: translateY(-${space(1)}); } }\n .item { ${targetSize} box-sizing: border-box; display: flex; align-items: center; gap: ${space(2.5)}; inline-size: 100%; padding: ${space(2)} ${space(2.5)}; font: inherit; ${type('sm')} text-align: start; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }\n .item:hover, .item:focus { background: ${t.surfaceSubtle}; }\n .item.danger { color: ${t.dangerText}; }\n .item svg { flex: none; }\n `,\n ];\n\n private outside = (event: Event): void => {\n if (!event.composedPath().includes(this)) this.toggle(false);\n };\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('click', this.outside);\n }\n\n private get entries(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll<HTMLElement>('.item'));\n }\n\n private get trigger(): HTMLElement | null {\n return this.renderRoot.querySelector('.trigger');\n }\n\n private toggle(open: boolean, focus?: 'first' | 'last'): void {\n this.open = open;\n if (open) {\n document.addEventListener('click', this.outside);\n void this.updateComplete.then(() => {\n this.keepOnScreen();\n this.entries[focus === 'last' ? this.entries.length - 1 : 0]?.focus();\n });\n } else document.removeEventListener('click', this.outside);\n }\n\n /** Open towards the other edge when the list would run off the screen. */\n private keepOnScreen(): void {\n const list = this.renderRoot.querySelector<HTMLElement>('.panel');\n if (!list) return;\n list.classList.remove('flip-start', 'flip-end');\n const box = list.getBoundingClientRect();\n const width = document.documentElement.clientWidth;\n if (box.right > width - 8) list.classList.add('flip-end');\n else if (box.left < 8) list.classList.add('flip-start');\n }\n\n private triggerKey(event: KeyboardEvent): void {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n this.toggle(true, event.key === 'ArrowUp' ? 'last' : 'first');\n }\n }\n\n private listKey(event: KeyboardEvent): void {\n const entries = this.entries;\n const at = entries.indexOf((this.renderRoot as ShadowRoot).activeElement as HTMLElement);\n const go: Record<string, number> = {\n ArrowDown: (at + 1) % entries.length,\n ArrowUp: (at - 1 + entries.length) % entries.length,\n Home: 0,\n End: entries.length - 1,\n };\n if (event.key in go) {\n event.preventDefault();\n entries[go[event.key]!]?.focus();\n } else if (event.key.length === 1 && /\\S/.test(event.key) && !event.ctrlKey && !event.metaKey && !event.altKey) {\n const letter = event.key.toLowerCase();\n const next = [...entries.slice(at + 1), ...entries.slice(0, at + 1)].find((e) => (e.textContent ?? '').trim().toLowerCase().startsWith(letter));\n next?.focus();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this.toggle(false);\n this.trigger?.focus();\n } else if (event.key === 'Tab') this.toggle(false);\n }\n\n private choose(item: MenuItem): void {\n this.toggle(false);\n this.trigger?.focus();\n if (!item.href) this.dispatchEvent(new CustomEvent('impakt-select', { detail: { value: item.value ?? item.text }, bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const inner = (item: MenuItem): TemplateResult => html`${iconSvg(item.icon, '18px')}<span>${item.text}</span>`;\n return html`<button class=\"trigger\" part=\"trigger\" type=\"button\" aria-haspopup=\"menu\" aria-expanded=${String(this.open)} aria-controls=${this.id_('list')}\n @click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}><slot name=\"trigger\">${iconSvg(this.icon, '18px')}${this.label}</slot><span class=\"chev\" part=\"chevron\">${iconSvg('chevron-down', '16px')}</span></button>\n ${\n this.open\n ? html`<div class=\"panel\" part=\"panel\">${\n this.querySelector(':scope > [slot=\"header\"]') ? html`<div class=\"header\" part=\"header\"><slot name=\"header\"></slot></div>` : nothing\n }<ul class=\"list\" part=\"list\" id=${this.id_('list')} role=\"menu\" aria-label=${this.label} @keydown=${this.listKey}>\n ${this.items.map(\n (item) =>\n html`<li role=\"none\">${\n item.href\n ? html`<a class=\"item ${item.tone === 'danger' ? 'danger' : ''}\" role=\"menuitem\" tabindex=\"-1\" href=${item.href} @click=${() => this.choose(item)}>${inner(item)}</a>`\n : html`<button class=\"item ${item.tone === 'danger' ? 'danger' : ''}\" role=\"menuitem\" tabindex=\"-1\" type=\"button\" @click=${() => this.choose(item)}>${inner(item)}</button>`\n }</li>`,\n )}\n </ul></div>`\n : nothing\n }`;\n }\n}\n\n/** Which page numbers to show: the ends and the neighbours, with gaps between. */\nexport function pageWindow(page: number, pages: number): Array<number | 'gap'> {\n const wanted = [...new Set([1, page - 1, page, page + 1, pages])].filter((n) => n >= 1 && n <= pages).sort((a, b) => a - b);\n return wanted.flatMap((n, i): Array<number | 'gap'> => {\n const previous = wanted[i - 1];\n if (previous === undefined || n === previous + 1) return [n];\n return n === previous + 2 ? [previous + 1, n] : ['gap', n];\n });\n}\n\n/**\n * Page numbers for a long list.\n *\n * Give it `href-pattern` and every number is a real link, with `{page}` swapped\n * for the number. Without one the numbers are buttons and it fires\n * `impakt-page`. On a narrow screen the numbers fold to \"Page 2 of 9\".\n *\n * @category navigation\n * @icon pagination\n * @fires {CustomEvent<{ page: number }>} impakt-page - When a page is chosen. The number is in detail.page.\n */\nexport class ImpaktPagination extends ImpaktElement {\n static properties = {\n page: { type: Number },\n pages: { type: Number },\n hrefPattern: { type: String, attribute: 'href-pattern' },\n label: { type: String },\n previousText: { type: String, attribute: 'previous-text' },\n nextText: { type: String, attribute: 'next-text' },\n };\n declare page: number;\n declare pages: number;\n declare hrefPattern: string;\n declare label: string;\n declare previousText: string;\n declare nextText: string;\n\n constructor() {\n super();\n this.page = 1;\n this.pages = 1;\n this.hrefPattern = '';\n this.label = 'Pages';\n this.previousText = 'Previous';\n this.nextText = 'Next';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.n, .step'),\n css`\n :host { display: block; container-type: inline-size; }\n nav { display: flex; align-items: center; justify-content: space-between; gap: ${space(2)}; }\n ul { display: flex; align-items: center; gap: ${space(1)}; margin: 0; padding: 0; list-style: none; }\n .n, .step { ${targetSize} box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: ${space(1.5)}; min-inline-size: 44px; padding: 0 ${space(2.5)}; font: inherit; ${type('sm')} font-weight: ${fontWeight('medium')}; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radiusLg}; cursor: pointer; }\n .n:hover, .step:hover { background: ${t.surfaceSubtle}; }\n .n[aria-current] { color: ${t.onBrand}; background: ${t.brand}; font-weight: ${fontWeight('semibold')}; }\n .step[aria-disabled='true'] { color: ${t.textMuted}; opacity: 0.55; background: none; cursor: not-allowed; }\n .gap { color: ${t.textMuted}; padding: 0 ${space(1)}; }\n .count { display: none; ${type('sm')} color: ${t.textMuted}; }\n @container (max-width: 34rem) { ul { display: none; } .count { display: block; } }\n `,\n ];\n\n private go(page: number, event: Event): void {\n if (this.hrefPattern) return;\n event.preventDefault();\n this.page = page;\n this.dispatchEvent(new CustomEvent('impakt-page', { detail: { page }, bubbles: true, composed: true }));\n }\n\n private link(page: number, classes: string, content: unknown, label: string, current: boolean): TemplateResult {\n return this.hrefPattern\n ? html`<a class=${classes} href=${this.hrefPattern.replace('{page}', String(page))} aria-label=${label} aria-current=${current ? 'page' : nothing}>${content}</a>`\n : html`<button class=${classes} type=\"button\" aria-label=${label} aria-current=${current ? 'page' : nothing} @click=${(e: Event) => this.go(page, e)}>${content}</button>`;\n }\n\n private step(to: number, words: string, icon: string, off: boolean): TemplateResult {\n const content = icon === 'arrow-left' ? html`${iconSvg(icon, '16px')}${words}` : html`${words}${iconSvg(icon, '16px')}`;\n return off ? html`<span class=\"step\" aria-disabled=\"true\">${content}</span>` : this.link(to, 'step', content, words, false);\n }\n\n render(): TemplateResult {\n const page = Math.min(Math.max(this.page, 1), Math.max(this.pages, 1));\n return html`<nav aria-label=${this.label} part=\"nav\">\n ${this.step(page - 1, this.previousText, 'arrow-left', page <= 1)}\n <ul>${pageWindow(page, this.pages).map((n) => html`<li>${n === 'gap' ? html`<span class=\"gap\" aria-hidden=\"true\">\u2026</span>` : this.link(n, 'n', n, say('Page {page}', { page: n }), n === page)}</li>`)}</ul>\n <span class=\"count\">${say('Page {page} of {pages}', { page, pages: this.pages })}</span>\n ${this.step(page + 1, this.nextText, 'arrow-right', page >= this.pages)}\n </nav>`;\n }\n}\n\nconst initialsOf = (name: string): string => {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n return ((words[0]?.[0] ?? '') + (words.length > 1 ? words[words.length - 1]![0]! : '')).toUpperCase();\n};\n\n/**\n * A person's photo, or their initials when there is no photo or it fails.\n *\n * @category content\n * @icon avatar\n */\nexport class ImpaktAvatar extends ImpaktElement {\n static properties = {\n fullName: { type: String, attribute: 'full-name' },\n src: { type: String },\n size: { type: String, reflect: true },\n };\n declare fullName: string;\n declare src: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n\n private failed = false;\n\n constructor() {\n super();\n this.fullName = '';\n this.src = '';\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { --size: 40px; display: inline-block; inline-size: var(--size); block-size: var(--size); vertical-align: middle; }\n :host([size='sm']) { --size: 32px; }\n :host([size='lg']) { --size: 56px; }\n :host([size='xl']) { --size: 80px; }\n .face { display: flex; align-items: center; justify-content: center; inline-size: 100%; block-size: 100%; overflow: hidden; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; font-size: calc(var(--size) * 0.38); font-weight: ${fontWeight('semibold')}; }\n img { inline-size: 100%; block-size: 100%; object-fit: cover; }\n `,\n ];\n\n willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('src')) this.failed = false;\n }\n\n render(): TemplateResult {\n if (this.src && !this.failed) {\n return html`<div class=\"face\"><img src=${this.src} alt=${this.fullName} @error=${() => {\n this.failed = true;\n this.requestUpdate();\n }} /></div>`;\n }\n return html`<div class=\"face\" role=\"img\" aria-label=${this.fullName || say('Person')}>${initialsOf(this.fullName) || iconSvg('user', '55%')}</div>`;\n }\n}\n\nexport interface AvatarItem {\n id?: string;\n name: string;\n src?: string;\n}\n\n/**\n * A few people overlapped in a row, with a count for the rest: the sales team,\n * the neighbours who have already moved in.\n *\n * @category content\n * @icon avatars\n */\nexport class ImpaktAvatarGroup extends ImpaktElement {\n static properties = {\n items: { type: Array },\n max: { type: Number },\n size: { type: String, reflect: true },\n moreLabel: { type: String, attribute: 'more-label' },\n };\n declare items: AvatarItem[];\n declare max: number;\n declare size: 'sm' | 'md' | 'lg';\n /** How the people left out are described to a screen reader, after the number. */\n declare moreLabel: string;\n\n constructor() {\n super();\n this.items = [];\n this.max = 4;\n this.size = 'md';\n this.moreLabel = 'more people';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n ul { display: flex; margin: 0; padding: 0; list-style: none; }\n li { margin-inline-start: -${space(2.5)}; border-radius: 50%; box-shadow: 0 0 0 2px ${t.surfaceCard}; line-height: 0; }\n li:first-child { margin-inline-start: 0; }\n .more { display: flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; ${type('xs')} line-height: 1; font-weight: ${fontWeight('semibold')}; color: ${t.text}; background: ${t.surfaceSubtle}; border-radius: 50%; }\n :host([size='sm']) .more { inline-size: 32px; block-size: 32px; }\n :host([size='lg']) .more { inline-size: 56px; block-size: 56px; }\n .sr { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const shown = this.items.slice(0, this.max);\n const rest = this.items.length - shown.length;\n return html`<ul part=\"list\">\n ${shown.map((item) => html`<li><impakt-avatar full-name=${item.name} src=${item.src ?? ''} size=${this.size}></impakt-avatar></li>`)}\n ${rest > 0 ? html`<li><span class=\"more\"><span aria-hidden=\"true\">+${rest}</span><span class=\"sr\">${rest} ${this.moreLabel}</span></span></li>` : nothing}\n </ul>`;\n }\n}\n\n/**\n * What a list says when it has nothing in it, and what to do about that.\n *\n * @category feedback\n * @icon empty\n * @role heading\n * @slot actions - The next thing to do, usually one button.\n */\nexport class ImpaktEmptyState extends ImpaktElement {\n static properties = {\n icon: { type: String },\n heading: { type: String },\n lead: { type: String },\n framed: { type: Boolean, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare icon: string;\n declare heading: string;\n declare lead: string;\n /** Draws a dashed outline round it. */\n declare framed: boolean;\n declare headingLevel: 2 | 3 | 4;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.icon = 'search';\n this.heading = '';\n this.lead = '';\n this.framed = false;\n this.headingLevel = 2;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n .wrap { display: flex; flex-direction: column; align-items: center; gap: ${space(2)}; padding: ${space(12)} ${space(6)}; text-align: center; }\n :host([framed]) .wrap { border: ${t.borderThin} dashed ${t.border}; border-radius: ${t.radiusXl}; }\n .mark { display: inline-flex; align-items: center; justify-content: center; inline-size: 56px; block-size: 56px; margin-block-end: ${space(2)}; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; }\n .h { margin: 0; font-family: ${t.fontHeading}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n p { margin: 0; max-inline-size: 42ch; color: ${t.textMuted}; text-wrap: pretty; }\n .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: ${space(3)}; margin-block-start: ${space(3)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<div class=\"wrap\" part=\"wrap\">\n <span class=\"mark\">${iconSvg(this.icon, '26px')}</span>\n ${this.heading ? html`<div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}\n ${this.lead ? html`<p>${this.lead}</p>` : nothing}\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>`;\n }\n}\n\nexport interface SlotDay {\n id?: string;\n /** The day, as 2026-11-14. */\n date: string;\n /** The times on offer, separated by commas: 10:00, 11:30, 14:00. */\n times: string;\n}\n\nconst timesOf = (day: SlotDay | undefined): string[] =>\n String(day?.times ?? '')\n .split(',')\n .map((time) => time.trim())\n .filter(Boolean);\n\n/** A day's parts in the page's language. A date that cannot be read is shown as it was written. */\nfunction dayParts(date: string): { weekday: string; day: string; month: string } {\n const parsed = new Date(`${date}T00:00:00Z`);\n if (Number.isNaN(parsed.getTime())) return { weekday: '', day: date, month: '' };\n const locale = pageLocale();\n const part = (options: Intl.DateTimeFormatOptions): string => new Intl.DateTimeFormat(locale, { timeZone: 'UTC', ...options }).format(parsed);\n return { weekday: part({ weekday: 'short' }), day: part({ day: 'numeric' }), month: part({ month: 'short' }) };\n}\n\n/**\n * Choose a day, then a time: a viewing, a call back, a site visit.\n *\n * Both rows are native radios under the styling, so the arrow keys and screen\n * readers work as they do for any radio group. Its value is the day and time\n * together, as 2026-11-14T10:00.\n *\n * @category form\n * @icon calendar\n */\nexport class ImpaktSlotPicker extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n days: { type: Array },\n dayLabel: { type: String, attribute: 'day-label' },\n timeLabel: { type: String, attribute: 'time-label' },\n emptyText: { type: String, attribute: 'empty-text' },\n };\n declare days: SlotDay[];\n declare dayLabel: string;\n declare timeLabel: string;\n /** What is said when no times are on offer. */\n declare emptyText: string;\n\n private day = '';\n\n constructor() {\n super();\n this.days = [];\n this.dayLabel = 'Day';\n this.timeLabel = 'Time';\n this.emptyText = 'No times are available at the moment.';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }\n legend { padding: 0; }\n .row-label { ${type('sm')} color: ${t.textMuted}; margin-block: ${space(2)}; }\n .days { display: flex; gap: ${space(2)}; overflow-x: auto; padding: ${space(1)}; margin: -${space(1)}; scrollbar-width: thin; }\n .times { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: ${space(2)}; }\n label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; min-block-size: 44px; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusLg}; box-shadow: inset 0 0 0 1px ${t.border}; cursor: pointer; transition: background-color 120ms ease-in-out; }\n label:hover { background: ${t.surfaceSubtle}; }\n label:has(input:checked) { color: ${t.onBrand}; background: ${t.brand}; box-shadow: none; }\n label:has(input:focus-visible) { box-shadow: ${t.focusShadow}; }\n input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }\n .day { flex: none; inline-size: 4.5rem; padding-block: ${space(2.5)}; }\n .weekday, .month { ${type('xs')} }\n .num { ${type('xl')} font-weight: ${fontWeight('semibold')}; }\n .time { padding: ${space(2)}; ${type('sm')} font-weight: ${fontWeight('medium')}; }\n .empty { margin: 0; color: ${t.textMuted}; }\n :host([invalid]) .days label, :host([invalid]) .times label { box-shadow: inset 0 0 0 1px ${t.danger}; }\n `,\n ];\n\n private get currentDay(): SlotDay | undefined {\n const wanted = this.day || this.value.split('T')[0];\n return this.days.find((day) => day.date === wanted) ?? this.days[0];\n }\n\n private chooseDay(date: string): void {\n this.day = date;\n if (this.value && !this.value.startsWith(`${date}T`)) this.setFormValue('');\n this.requestUpdate();\n }\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}</legend>`;\n }\n\n protected renderControl(): TemplateResult {\n const current = this.currentDay;\n if (!current) return html`<p class=\"empty\">${this.emptyText}</p>`;\n return html`\n <div class=\"row-label\" id=${this.id_('days')}>${this.dayLabel}</div>\n <div class=\"days\" part=\"days\" role=\"radiogroup\" aria-labelledby=${this.id_('days')}>\n ${this.days.map((day) => {\n const parts = dayParts(day.date);\n return html`<label class=\"day\"><input type=\"radio\" name=${`${this.uid}-day`} .checked=${day.date === current.date} ?disabled=${this.disabled} @change=${() => this.chooseDay(day.date)} />\n <span class=\"weekday\">${parts.weekday}</span><span class=\"num\">${parts.day}</span><span class=\"month\">${parts.month}</span></label>`;\n })}\n </div>\n <div class=\"row-label\" id=${this.id_('times')}>${this.timeLabel}</div>\n <div class=\"times\" part=\"times\" role=\"radiogroup\" aria-labelledby=${this.id_('times')}>\n ${timesOf(current).map((time, i) => {\n const value = `${current.date}T${time}`;\n return html`<label class=\"time\"><input type=\"radio\" name=${`${this.uid}-time`} .checked=${this.value === value} ?required=${this.required && i === 0} ?disabled=${this.disabled} @change=${() => this.setFormValue(value)} />${time}</label>`;\n })}\n </div>`;\n }\n\n render(): TemplateResult {\n return html`<fieldset part=\"fieldset\" ?disabled=${this.disabled} aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-drawer', ImpaktDrawer);\ncustomElements.define('impakt-toast', ImpaktToast);\ncustomElements.define('impakt-menu', ImpaktMenu);\ncustomElements.define('impakt-pagination', ImpaktPagination);\ncustomElements.define('impakt-avatar', ImpaktAvatar);\ncustomElements.define('impakt-avatar-group', ImpaktAvatarGroup);\ncustomElements.define('impakt-empty-state', ImpaktEmptyState);\ncustomElements.define('impakt-slot-picker', ImpaktSlotPicker);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-drawer': ImpaktDrawer;\n 'impakt-toast': ImpaktToast;\n 'impakt-menu': ImpaktMenu;\n 'impakt-pagination': ImpaktPagination;\n 'impakt-avatar': ImpaktAvatar;\n 'impakt-avatar-group': ImpaktAvatarGroup;\n 'impakt-empty-state': ImpaktEmptyState;\n 'impakt-slot-picker': ImpaktSlotPicker;\n }\n}\n", "import { css, html, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, spaceAround, t, type } from '../base/tokens';\n\n/** One address a postcode search found. */\nexport interface AddressItem {\n id: string;\n /** The address on one line, as the customer will recognise it. */\n line: string;\n}\n\n/** One mistake on the page, and the field it is about. */\nexport interface ErrorItem {\n id: string;\n text: string;\n /** The field to go to, such as `#postcode`. */\n href: string;\n}\n\n/** One part of a long application. */\nexport interface TaskItem {\n id: string;\n title: string;\n /** Where the part is filled in. Left out while it cannot be started. */\n href?: string;\n status: 'done' | 'in-progress' | 'not-started' | 'cannot-start';\n /** A line under the title, such as how long it takes. */\n hint?: string;\n}\n\nconst inputStyles = css`\n input, select {\n box-sizing: border-box;\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font: inherit;\n /* 16px whatever the page around it sets, so a phone does not zoom in on focus. */\n font-size: max(${fontSize('md')}, 16px);\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n }\n input:focus-visible, select:focus-visible { border-color: ${t.brand}; box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo}; outline: none; }\n :host([invalid]) input, :host([invalid]) select { border-color: ${t.danger}; border-width: ${t.borderThick}; }\n .btn {\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(4)};\n font: inherit;\n font-weight: ${fontWeight('semibold')};\n color: ${t.onBrand};\n background: ${t.brand};\n border: 0;\n border-radius: ${t.radiusLg};\n cursor: pointer;\n }\n .btn:hover { background: ${t.brandHover}; }\n .quiet { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; padding: 0; font: inherit; color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; background: none; border: 0; cursor: pointer; }\n .visually-hidden { ${visuallyHidden} }\n`;\n\n/**\n * Find an address from a postcode, then pick it from a list.\n *\n * The addresses come from the app. With `lookup-url` set, the component asks\n * that address itself (`?postcode=\u2026`, answering `[{ id, line }]`); otherwise\n * it fires `impakt-lookup` with the postcode and the app sets `addresses`.\n * There is always a way to type the address in, because no list is complete.\n *\n * @fires {CustomEvent<{ postcode: string }>} impakt-lookup - When a postcode is searched for. The postcode is in detail.postcode.\n * @category form\n * @icon home\n */\nexport class ImpaktAddressLookup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n postcodeLabel: { type: String, attribute: 'postcode-label' },\n findText: { type: String, attribute: 'find-text' },\n chooseLabel: { type: String, attribute: 'choose-label' },\n manualText: { type: String, attribute: 'manual-text' },\n notFoundText: { type: String, attribute: 'not-found-text' },\n lookupUrl: { type: String, attribute: 'lookup-url' },\n addresses: { type: Array },\n };\n declare postcodeLabel: string;\n declare findText: string;\n declare chooseLabel: string;\n declare manualText: string;\n declare notFoundText: string;\n /** An address that returns `[{ id, line }]` for `?postcode=`. Optional. */\n declare lookupUrl: string;\n declare addresses: AddressItem[];\n declare manual: boolean;\n declare postcode: string;\n declare searched: boolean;\n declare busy: boolean;\n\n constructor() {\n super();\n this.label = 'Your address';\n this.postcodeLabel = 'Postcode';\n this.findText = 'Find address';\n this.chooseLabel = 'Choose your address';\n this.manualText = 'Enter the address yourself';\n this.notFoundText = 'No addresses found for that postcode. Check it, or enter the address yourself.';\n this.lookupUrl = '';\n this.addresses = [];\n this.manual = false;\n this.postcode = '';\n this.searched = false;\n this.busy = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n inputStyles,\n css`\n .row { display: flex; flex-wrap: wrap; gap: ${space(2)}; align-items: flex-end; }\n .row label { display: block; ${type('sm')} font-weight: ${fontWeight('semibold')}; margin-block-end: ${space(1)}; }\n .postcode input { inline-size: 12ch; text-transform: uppercase; }\n .choose { margin-block-start: ${space(4)}; }\n .choose select { inline-size: 100%; }\n .manual { display: grid; gap: ${space(3)}; margin-block-start: ${space(3)}; }\n .manual label { display: block; ${type('sm')} margin-block-end: ${space(1)}; }\n .manual input { inline-size: 100%; }\n .note { ${type('sm')} color: ${t.textMuted}; margin: ${space(2)} 0 0; }\n .switch { margin-block-start: ${space(3)}; }\n `,\n ];\n\n private async find(): Promise<void> {\n const postcode = this.postcode.trim().toUpperCase();\n if (!postcode) return;\n this.dispatchEvent(new CustomEvent('impakt-lookup', { detail: { postcode }, bubbles: true, composed: true }));\n if (!this.lookupUrl) {\n this.searched = true;\n return;\n }\n this.busy = true;\n try {\n const url = new URL(this.lookupUrl, globalThis.location?.href);\n url.searchParams.set('postcode', postcode);\n const found = await (await fetch(url)).json();\n this.addresses = Array.isArray(found) ? found : [];\n } catch {\n this.addresses = [];\n } finally {\n this.busy = false;\n this.searched = true;\n }\n }\n\n private manualLine(): string {\n const parts = ['line1', 'line2', 'town', 'mpostcode'].map((p) => (this.renderRoot.querySelector<HTMLInputElement>(`#${this.id_(p)}`)?.value ?? '').trim());\n return parts.filter(Boolean).join(', ');\n }\n\n protected renderControl(): TemplateResult {\n if (this.manual) {\n const field = (key: string, label: string, autocomplete: string) =>\n html`<div><label for=${this.id_(key)}>${label}</label><input id=${this.id_(key)} autocomplete=${autocomplete} @input=${() => this.setFormValue(this.manualLine())} /></div>`;\n return html`<div class=\"manual\" role=\"group\" aria-label=${this.label}>\n ${field('line1', say('Building and street'), 'address-line1')}\n ${field('line2', say('Second line (optional)'), 'address-line2')}\n ${field('town', say('Town or city'), 'address-level2')}\n ${field('mpostcode', say('Postcode'), 'postal-code')}\n <button class=\"quiet switch\" type=\"button\" @click=${() => {\n this.manual = false;\n }}>${say('Find the address from the postcode')}</button>\n </div>`;\n }\n return html`\n <div class=\"row\">\n <div class=\"postcode\"><label for=${this.controlId}>${this.postcodeLabel}</label>\n <input id=${this.controlId} autocomplete=\"postal-code\" .value=${this.postcode} aria-describedby=${this.describedBy}\n @input=${(e: Event) => {\n this.postcode = (e.target as HTMLInputElement).value;\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n void this.find();\n }\n }} /></div>\n <button class=\"btn\" type=\"button\" ?disabled=${this.busy} @click=${() => this.find()}>${this.busy ? 'Finding\u2026' : this.findText}</button>\n </div>\n ${\n this.addresses.length\n ? html`<div class=\"choose\"><label class=\"label\" for=${this.id_('choose')}>${this.chooseLabel}</label>\n <select id=${this.id_('choose')} @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}>\n <option value=\"\">${this.addresses.length} ${this.addresses.length === 1 ? 'address' : 'addresses'} found</option>\n ${this.addresses.map((a) => html`<option value=${a.line} ?selected=${a.line === this.value}>${a.line}</option>`)}\n </select></div>`\n : this.searched && !this.busy\n ? html`<p class=\"note\" role=\"status\">${this.notFoundText}</p>`\n : nothing\n }\n <button class=\"quiet switch\" type=\"button\" @click=${() => {\n this.manual = true;\n }}>${this.manualText}</button>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Every mistake on the page, listed at the top, each linking to its field.\n *\n * It takes focus when it appears, so someone using a screen reader hears what\n * is wrong straight away rather than finding out field by field. It draws\n * nothing while there are no mistakes. Each link moves focus to its field, which\n * may be a field inside another component, such as `#postcode` for an\n * `impakt-text-input` with that id.\n *\n * @category feedback\n * @icon alert\n */\nexport class ImpaktErrorSummary extends ImpaktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: ErrorItem[];\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.heading = 'There is a problem';\n this.items = [];\n this.spaceAbove = 'none';\n this.spaceBelow = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n spaceAround,\n touchTarget('a'),\n css`\n :host { display: block; }\n .box { padding: ${space(5)}; border: ${t.borderThick} solid ${t.danger}; border-inline-start-width: 6px; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .box:focus { outline: 3px solid ${t.danger}; outline-offset: 2px; }\n h2 { margin: 0 0 ${space(3)}; ${type('lg')} font-weight: ${fontWeight('bold')}; color: ${t.text}; }\n ul { margin: 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.dangerText}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n `,\n ];\n\n private go(event: Event, href: string): void {\n const id = href.replace(/^#/, '');\n const root = this.getRootNode() as Document | ShadowRoot;\n const target = (root.querySelector?.(`#${CSS.escape(id)}`) ?? document.getElementById(id)) as HTMLElement | null;\n if (!target) return;\n event.preventDefault();\n target.scrollIntoView({ block: 'center' });\n (target as HTMLElement & { focus: () => void }).focus();\n }\n\n updated(changed: Map<string, unknown>): void {\n const before = changed.get('items') as ErrorItem[] | undefined;\n if (changed.has('items') && this.items.length && !before?.length) this.renderRoot.querySelector<HTMLElement>('.box')?.focus();\n }\n\n render(): TemplateResult | typeof nothing {\n if (!this.items.length) return nothing;\n return html`<div class=\"box\" role=\"alert\" tabindex=\"-1\" aria-labelledby=${this.id_('h')} part=\"box\">\n <h2 id=${this.id_('h')}>${this.heading}</h2>\n <ul>${this.items.map((i) => html`<li><a href=${i.href} @click=${(e: Event) => this.go(e, i.href)}>${i.text}</a></li>`)}</ul>\n </div>`;\n }\n}\n\nconst fileSize = (bytes: number) =>\n bytes >= 1048576 ? say('{size} MB', { size: (bytes / 1048576).toFixed(1) }) : say('{size} KB', { size: Math.max(1, Math.round(bytes / 1024)) });\n\n/**\n * Add one or more files, such as proof of identity or photos for a claim.\n *\n * A file can be chosen or dropped on the box. Each one is checked for type and\n * size here and listed with a Remove button; the upload itself is the app's,\n * which gets the files on `impakt-files`. The answer is the file names.\n *\n * The file input itself takes focus, so Tab reaches it and Enter or Space opens\n * the file chooser; the visible button is its label and draws its focus ring.\n * A file that is added or removed is said to a screen reader, and a file that\n * does not fit marks the box and says why.\n *\n * @fires {CustomEvent<{ files: File[] }>} impakt-files - When the files change. The files are in detail.files.\n *\n * @category form\n * @icon upload\n */\nexport class ImpaktFileUpload extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n accept: { type: String },\n manyFiles: { type: Boolean, attribute: 'many-files' },\n maxSizeMb: { type: Number, attribute: 'max-size-mb' },\n chooseText: { type: String, attribute: 'choose-text' },\n dropText: { type: String, attribute: 'drop-text' },\n };\n /** File types allowed, such as `.pdf,.jpg,.png`. Empty allows any. */\n declare accept: string;\n /** Let more than one file be added. */\n declare manyFiles: boolean;\n declare maxSizeMb: number;\n declare chooseText: string;\n declare dropText: string;\n declare files: File[];\n declare over: boolean;\n declare protected said: string;\n\n constructor() {\n super();\n this.label = 'Upload a file';\n this.accept = '.pdf,.jpg,.jpeg,.png';\n this.manyFiles = false;\n this.maxSizeMb = 10;\n this.chooseText = 'Choose file';\n this.dropText = 'or drop it here';\n this.files = [];\n this.over = false;\n this.said = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n inputStyles,\n targetSize,\n touchTarget('label.btn, .quiet'),\n css`\n .zone { display: flex; flex-wrap: wrap; align-items: center; gap: ${space(3)}; padding: ${space(5)}; border: 2px dashed ${t.border}; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .zone.over { border-color: ${t.brand}; background: ${t.brandSubtle}; }\n :host([invalid]) .zone { border-color: ${t.danger}; border-style: solid; }\n :host([disabled]) label.btn { cursor: not-allowed; }\n .drop { color: ${t.textMuted}; }\n input[type='file'] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }\n label.btn { display: inline-flex; align-items: center; }\n input[type='file']:focus-visible + label.btn { box-shadow: ${t.focusShadow}; }\n ul { margin: ${space(3)} 0 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n li { display: flex; justify-content: space-between; gap: ${space(3)}; align-items: center; padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: ${t.surfaceInset}; }\n .size { color: ${t.textMuted}; ${type('sm')} }\n `,\n ];\n\n private fits(file: File): string | null {\n if (this.maxSizeMb && file.size > this.maxSizeMb * 1048576) return say('{file} is bigger than {size} MB', { file: file.name, size: this.maxSizeMb });\n const kinds = this.accept\n .split(',')\n .map((k) => k.trim().toLowerCase())\n .filter(Boolean);\n if (\n kinds.length &&\n !kinds.some((k) =>\n k.startsWith('.') ? file.name.toLowerCase().endsWith(k) : file.type === k || (k.endsWith('/*') && file.type.startsWith(k.slice(0, -1))),\n )\n ) {\n return say('{file} must be {kinds}', { file: file.name, kinds: kinds.map((k) => k.replace('.', '').toUpperCase()).join(', ') });\n }\n return null;\n }\n\n /** Adds files, keeping only those that pass, and says why any did not. */\n add(list: FileList | File[]): void {\n const chosen = Array.from(list);\n const problems = chosen.map((f) => this.fits(f)).filter((p): p is string => Boolean(p));\n const good = chosen.filter((f) => !this.fits(f));\n const kept = this.manyFiles ? good : good.slice(0, 1);\n this.files = this.manyFiles ? [...this.files, ...good] : kept.length ? kept : this.files;\n this.error = problems.join('. ');\n this.said = kept.map((f) => say('{file} added', { file: f.name })).join('. ');\n this.sync();\n }\n\n private removeFile(index: number): void {\n const gone = this.files[index];\n this.files = this.files.filter((_, i) => i !== index);\n this.said = gone ? say('{file} removed', { file: gone.name }) : '';\n this.sync();\n // The button that was pressed has gone, so focus goes back to the file input rather than to the top of the page.\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>('input[type=\"file\"]')?.focus());\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n\n private sync(): void {\n this.setFormValue(this.files.map((f) => f.name).join(', '));\n this.dispatchEvent(new CustomEvent('impakt-files', { detail: { files: this.files }, bubbles: true, composed: true }));\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"zone ${this.over ? 'over' : ''}\"\n @dragover=${(e: DragEvent) => {\n e.preventDefault();\n this.over = true;\n }}\n @dragleave=${() => {\n this.over = false;\n }}\n @drop=${(e: DragEvent) => {\n e.preventDefault();\n this.over = false;\n if (e.dataTransfer?.files) this.add(e.dataTransfer.files);\n }}>\n <input id=${this.controlId} type=\"file\" accept=${this.accept || nothing} ?multiple=${this.manyFiles} ?disabled=${this.disabled} ?required=${this.required} aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n const f = (e.target as HTMLInputElement).files;\n if (f) this.add(f);\n (e.target as HTMLInputElement).value = '';\n }} />\n <label class=\"btn\" for=${this.controlId}>${this.chooseText}</label>\n <span class=\"drop\">${this.dropText}</span>\n </div>\n <p class=\"visually-hidden\" role=\"status\">${this.said}</p>\n ${this.files.length ? html`<ul aria-label=${say('Files added')}>${this.files.map((f, i) => html`<li><span>${f.name} <span class=\"size\">${fileSize(f.size)}</span></span><button class=\"quiet\" type=\"button\" @click=${() => this.removeFile(i)}>${say('Remove')}<span class=\"visually-hidden\"> ${f.name}</span></button></li>`)}</ul>` : nothing}\n `;\n }\n}\n\n/** The currency's symbol, such as \u00A3 for GBP. */\nfunction symbolOf(currency: string): string {\n try {\n return (\n new Intl.NumberFormat(pageLocale(), { style: 'currency', currency, maximumFractionDigits: 0 }).formatToParts(0).find((p) => p.type === 'currency')\n ?.value ?? ''\n );\n } catch {\n return '';\n }\n}\n\n/** \"250000\" \u2192 \"250,000\". Anything not a number is left as typed. */\nexport function groupDigits(value: string): string {\n const digits = value.replace(/[^\\d.]/g, '');\n if (!digits) return '';\n const [whole, part] = digits.split('.');\n return `${Number(whole).toLocaleString('en-GB')}${part !== undefined ? `.${part.slice(0, 2)}` : ''}`;\n}\n\n/**\n * An amount of money, with the currency sign in front and commas as it is\n * read back, so \u00A3250,000 is not mistaken for \u00A325,000.\n *\n * The answer is the plain number, such as `250000`.\n *\n * @category form\n * @icon pound\n */\nexport class ImpaktMoneyInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n currency: { type: String },\n lowest: { type: Number },\n highest: { type: Number },\n pence: { type: Boolean },\n width: { type: String, reflect: true },\n };\n declare currency: string;\n declare lowest: number | undefined;\n declare highest: number | undefined;\n /** Allow pence. Off for amounts like a house price. */\n declare pence: boolean;\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n declare shown: string;\n\n constructor() {\n super();\n this.currency = 'GBP';\n this.lowest = undefined;\n this.highest = undefined;\n this.pence = false;\n this.width = 'md';\n this.shown = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n inputStyles,\n css`\n .wrap { display: flex; align-items: stretch; inline-size: min(100%, var(--impakt-field-width)); }\n .sign { display: flex; align-items: center; padding: 0 ${space(3)}; font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; border: ${t.borderThin} solid ${t.border}; border-inline-end: 0; border-radius: ${t.radiusLg} 0 0 ${t.radiusLg}; }\n .wrap input { inline-size: 100%; border-radius: 0 ${t.radiusLg} ${t.radiusLg} 0; }\n `,\n ];\n\n willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('value') && this.value !== this.shown.replace(/,/g, '')) this.shown = groupDigits(this.value);\n }\n\n private typed(raw: string): void {\n const clean = raw.replace(/[^\\d.]/g, '');\n const value = this.pence ? clean : clean.split('.')[0]!;\n this.shown = raw;\n this.setFormValue(value);\n }\n\n private check(): void {\n this.shown = groupDigits(this.value);\n const n = Number(this.value);\n if (!this.value) return;\n const money = (x: number) => `${symbolOf(this.currency)}${x.toLocaleString('en-GB')}`;\n if (this.lowest !== undefined && n < this.lowest) this.error = say('Enter an amount of {amount} or more', { amount: money(this.lowest) });\n else if (this.highest !== undefined && n > this.highest) this.error = say('Enter an amount of {amount} or less', { amount: money(this.highest) });\n else if (\n this.error === say('Enter an amount of {amount} or more', { amount: money(this.lowest ?? 0) }) ||\n this.error === say('Enter an amount of {amount} or less', { amount: money(this.highest ?? 0) })\n )\n this.error = '';\n }\n\n /** The currency sign describes the field too, so a screen reader hears that the amount is in pounds. */\n protected get describedBy(): string | typeof nothing {\n const ids = [symbolOf(this.currency) ? this.id_('sign') : '', super.describedBy === nothing ? '' : String(super.describedBy)].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n protected renderControl(): TemplateResult {\n return html`<div class=\"wrap\">\n <span class=\"sign\" id=${this.id_('sign')}>${symbolOf(this.currency)}</span>\n <input id=${this.controlId} inputmode=${this.pence ? 'decimal' : 'numeric'} .value=${this.shown} ?disabled=${this.disabled} ?readonly=${this.readonly} ?required=${this.required}\n aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.typed((e.target as HTMLInputElement).value)} @blur=${() => this.check()} />\n </div>`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Choose a number by sliding, with the value read out beside the label, such\n * as a deposit or how many years. It is a native range control, so arrow keys,\n * a finger and a screen reader all work.\n *\n * @category form\n * @icon sliders\n */\nexport class ImpaktRangeInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n lowest: { type: Number },\n highest: { type: Number },\n step: { type: Number },\n currency: { type: String },\n unit: { type: String },\n };\n declare lowest: number;\n declare highest: number;\n declare step: number;\n /** Show the value as money in this currency, such as GBP. Empty shows a plain number. */\n declare currency: string;\n /** A word after the value, such as `years`. */\n declare unit: string;\n\n constructor() {\n super();\n this.label = 'How much';\n this.lowest = 0;\n this.highest = 100;\n this.step = 1;\n this.currency = '';\n this.unit = '';\n this.value = '50';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n .top { display: flex; justify-content: space-between; gap: ${space(3)}; }\n output { font-weight: ${fontWeight('semibold')}; color: ${t.text}; }\n input { inline-size: 100%; min-block-size: 32px; margin: 0; accent-color: ${t.brand}; }\n .ends { display: flex; justify-content: space-between; ${type('sm')} color: ${t.textMuted}; }\n `,\n ];\n\n /** The value as the customer reads it, such as \u00A325,000 or 25 years. */\n shownAs(n: number): string {\n const locale = pageLocale(this);\n let s = n.toLocaleString(locale);\n if (this.currency) {\n try {\n s = new Intl.NumberFormat(locale, { style: 'currency', currency: this.currency, maximumFractionDigits: 0 }).format(n);\n } catch {\n /* keep the number */\n }\n }\n return this.unit ? `${s} ${this.unit}` : s;\n }\n\n render(): TemplateResult {\n const n = Number(this.value) || 0;\n return html`\n <div class=\"top\"><label class=\"label\" for=${this.controlId}>${this.label}${this.required ? html` <span class=\"required\">(${this.requiredText})</span>` : nothing}</label>\n <output for=${this.controlId}>${this.shownAs(n)}</output></div>\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')}>${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"ends\" aria-hidden=\"true\"><span>${this.shownAs(this.lowest)}</span><span>${this.shownAs(this.highest)}</span></div>\n <div class=\"error\" id=${this.id_('error')} aria-live=\"polite\">${this.error || nothing}</div>\n `;\n }\n\n protected renderControl(): TemplateResult {\n return html`<input id=${this.controlId} type=\"range\" min=${this.lowest} max=${this.highest} step=${this.step} .value=${this.value} ?disabled=${this.disabled}\n aria-valuetext=${this.shownAs(Number(this.value) || 0)} aria-describedby=${this.describedBy}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLInputElement).value)} />`;\n }\n}\n\nconst TASK_WORDS: Record<TaskItem['status'], string> = {\n done: 'Completed',\n 'in-progress': 'In progress',\n 'not-started': 'Not started',\n 'cannot-start': 'Cannot start yet',\n};\n\n/**\n * The parts of a long application, each with whether it is done, so someone\n * can leave and come back to where they were.\n *\n * @category content\n * @icon list\n */\nexport class ImpaktTaskList extends ImpaktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: TaskItem[];\n declare headingLevel: 2 | 3;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.heading = 'Your application';\n this.items = [];\n this.headingLevel = 2;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n spaceAround,\n touchTarget('a'),\n css`\n :host { display: block; }\n .h { margin: 0 0 ${space(2)}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n .count { margin: 0 0 ${space(4)}; color: ${t.textMuted}; }\n ul { margin: 0; padding: 0; list-style: none; border-block-start: 1px solid ${t.rule}; }\n li { display: flex; justify-content: space-between; align-items: center; gap: ${space(4)}; padding: ${space(4)} 0; border-block-end: 1px solid ${t.rule}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.link}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n .title { font-weight: ${fontWeight('semibold')}; }\n .hint { display: block; ${type('sm')} color: ${t.textMuted}; }\n .tag { flex-shrink: 0; padding: ${space(1)} ${space(2.5)}; border-radius: 999px; ${type('sm')} font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; color: ${t.text}; }\n .tag[data-status='done'] { background: ${t.successSubtle}; color: ${t.successText}; }\n .tag[data-status='in-progress'] { background: ${t.brandSubtle}; color: ${t.link}; }\n .tag[data-status='cannot-start'] { background: transparent; color: ${t.textMuted}; }\n `,\n ];\n\n render(): TemplateResult {\n const done = this.items.filter((i) => i.status === 'done').length;\n return html`\n ${this.heading ? html`<div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}\n ${this.items.length ? html`<p class=\"count\">${say(this.items.length === 1 ? 'You have completed {done} of {total} part.' : 'You have completed {done} of {total} parts.', { done, total: this.items.length })}</p>` : nothing}\n <ul>${this.items.map(\n (i) => html`<li>\n <span>${i.href && i.status !== 'cannot-start' ? html`<a href=${i.href} aria-describedby=${this.id_(`s-${i.id}`)}>${i.title}</a>` : html`<span class=\"title\">${i.title}</span>`}\n ${i.hint ? html`<span class=\"hint\">${i.hint}</span>` : nothing}</span>\n <span class=\"tag\" data-status=${i.status} id=${this.id_(`s-${i.id}`)}>${TASK_WORDS[i.status] ? say(TASK_WORDS[i.status]) : i.status}</span>\n </li>`,\n )}</ul>`;\n }\n}\n\n// Working values, not settings: kept out of `properties` so the page designer does not offer them.\nImpaktAddressLookup.createProperty('manual', { state: true });\nImpaktAddressLookup.createProperty('postcode', { state: true });\nImpaktAddressLookup.createProperty('searched', { state: true });\nImpaktAddressLookup.createProperty('busy', { state: true });\nImpaktFileUpload.createProperty('files', { state: true });\nImpaktFileUpload.createProperty('over', { state: true });\nImpaktFileUpload.createProperty('said', { state: true });\nImpaktMoneyInput.createProperty('shown', { state: true });\n\ncustomElements.define('impakt-address-lookup', ImpaktAddressLookup);\ncustomElements.define('impakt-error-summary', ImpaktErrorSummary);\ncustomElements.define('impakt-file-upload', ImpaktFileUpload);\ncustomElements.define('impakt-money-input', ImpaktMoneyInput);\ncustomElements.define('impakt-range-input', ImpaktRangeInput);\ncustomElements.define('impakt-task-list', ImpaktTaskList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-address-lookup': ImpaktAddressLookup;\n 'impakt-error-summary': ImpaktErrorSummary;\n 'impakt-file-upload': ImpaktFileUpload;\n 'impakt-money-input': ImpaktMoneyInput;\n 'impakt-range-input': ImpaktRangeInput;\n 'impakt-task-list': ImpaktTaskList;\n }\n}\n"],
|
|
5
5
|
"mappings": ";AAMA,IAGMA,GAASC,WAKFC,GACXF,GAAOG,aACNH,GAAOI,WADDD,QAC2BH,GAAOI,SAASC,eAClD,uBAAwBC,SAASC,WACjC,YAAaC,cAAcD,UAkBvBE,GAAoBC,OAAAA,EAEpBC,GAAc,IAAIC,QASXC,EATWD,KASXC,CAOX,YACEC,EACAC,EACAC,EAAAA,CAEA,GAVFC,KAAe,aAAA,GAUTD,IAAcP,GAChB,MAAUS,MACR,mEAAA,EAGJD,KAAKH,QAAUA,EACfG,KAAKE,EAAWJ,CAClB,CAIA,IAAA,YAAIK,CAGF,IAAIA,EAAaH,KA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AAMH;AAAA,gBACC,EAAE,MAAQ,EAAE,SAAW,eAAiBA,YAAe,EAAE,IAAI,qBAAqB,KAAK,IAAI,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,OAASA,wBAA2B,EAAE,KAAK,SAAS;AAAA,YAC1K,EAAE,KAAOA,uBAA0B,EAAE,IAAI,UAAYG,CAAO;AAAA,wCAChC,EAAE,MAAM,OAAO,KAAK,IAAI,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI+C,GAAW,EAAE,MAAM,EAAIjD,EAAIiD,GAAW,EAAE,MAAM,CAAC,EAAI,EAAE,MAAM;AAAA,YAErI,CAAC,OACL,CACF,EAGA9D,EAAoB,eAAe,SAAU,CAAE,MAAO,EAAK,CAAC,EAC5DA,EAAoB,eAAe,WAAY,CAAE,MAAO,EAAK,CAAC,EAC9DA,EAAoB,eAAe,WAAY,CAAE,MAAO,EAAK,CAAC,EAC9DA,EAAoB,eAAe,OAAQ,CAAE,MAAO,EAAK,CAAC,EAC1D8B,EAAiB,eAAe,QAAS,CAAE,MAAO,EAAK,CAAC,EACxDA,EAAiB,eAAe,OAAQ,CAAE,MAAO,EAAK,CAAC,EACvDA,EAAiB,eAAe,OAAQ,CAAE,MAAO,EAAK,CAAC,EACvDsB,GAAiB,eAAe,QAAS,CAAE,MAAO,EAAK,CAAC,EAExD,eAAe,OAAO,wBAAyBpD,CAAmB,EAClE,eAAe,OAAO,uBAAwBiB,EAAkB,EAChE,eAAe,OAAO,qBAAsBa,CAAgB,EAC5D,eAAe,OAAO,qBAAsBsB,EAAgB,EAC5D,eAAe,OAAO,qBAAsBO,EAAgB,EAC5D,eAAe,OAAO,mBAAoBI,EAAc",
|
|
6
6
|
"names": ["global", "globalThis", "supportsAdoptingStyleSheets", "ShadowRoot", "ShadyCSS", "nativeShadow", "Document", "prototype", "CSSStyleSheet", "constructionToken", "Symbol", "cssTagCache", "WeakMap", "CSSResult", "cssText", "strings", "safeToken", "this", "Error", "_strings", "styleSheet", "_styleSheet", "cacheable", "length", "get", "replaceSync", "set", "toString", "unsafeCSS", "value", "String", "css", "values", "reduce", "acc", "v", "idx", "adoptStyles", "renderRoot", "styles", "adoptedStyleSheets", "map", "s", "style", "document", "createElement", "nonce", "setAttribute", "textContent", "appendChild", "getCompatibleStyle", "sheet", "rule", "cssRules", "is", "defineProperty", "getOwnPropertyDescriptor", "getOwnPropertyNames", "getOwnPropertySymbols", "getPrototypeOf", "Object", "global", "globalThis", "trustedTypes", "emptyStringForBooleanAttribute", "emptyScript", "polyfillSupport", "reactiveElementPolyfillSupport", "JSCompiler_renameProperty", "prop", "_obj", "defaultConverter", "value", "type", "Boolean", "Array", "JSON", "stringify", "fromValue", "Number", "parse", "e", "notEqual", "old", "defaultPropertyDeclaration", "attribute", "String", "converter", "reflect", "useDefault", "hasChanged", "Symbol", "metadata", "litPropertyMetadata", "WeakMap", "ReactiveElement", "HTMLElement", "initializer", "this", "__prepare", "_initializers", "push", "observedAttributes", "finalize", "__attributeToPropertyMap", "keys", "name", "options", "state", "prototype", "hasOwnProperty", "create", "wrapped", "elementProperties", "set", "noAccessor", "key", "descriptor", "getPropertyDescriptor", "get", "v", "oldValue", "call", "requestUpdate", "configurable", "enumerable", "superCtor", "Map", "finalized", "props", "properties", "propKeys", "p", "createProperty", "attr", "__attributeNameForProperty", "elementStyles", "finalizeStyles", "styles", "isArray", "Set", "flat", "Infinity", "reverse", "s", "unshift", "getCompatibleStyle", "toLowerCase", "constructor", "super", "__instanceProperties", "isUpdatePending", "hasUpdated", "__reflectingProperty", "__initialize", "__updatePromise", "Promise", "res", "enableUpdating", "_$changedProperties", "__saveInstanceProperties", "forEach", "i", "controller", "__controllers", "add", "renderRoot", "isConnected", "hostConnected", "delete", "instanceProperties", "size", "createRenderRoot", "shadowRoot", "attachShadow", "shadowRootOptions", "adoptStyles", "connectedCallback", "c", "_requestedUpdate", "disconnectedCallback", "hostDisconnected", "_old", "_$attributeToProperty", "attrValue", "toAttribute", "removeAttribute", "setAttribute", "ctor", "propName", "getPropertyOptions", "fromAttribute", "convertedValue", "__defaultValues", "useNewValue", "newValue", "hasAttribute", "_$changeProperty", "__enqueueUpdate", "initializeValue", "has", "__reflectingProperties", "reject", "result", "scheduleUpdate", "performUpdate", "shouldUpdate", "changedProperties", "willUpdate", "hostUpdate", "update", "__markUpdated", "_$didUpdate", "_changedProperties", "hostUpdated", "firstUpdated", "updated", "updateComplete", "getUpdateComplete", "__propertyToAttribute", "mode", "reactiveElementVersions", "global", "globalThis", "wrap", "node", "trustedTypes", "policy", "createPolicy", "createHTML", "s", "boundAttributeSuffix", "marker", "Math", "random", "toFixed", "slice", "markerMatch", "nodeMarker", "d", "document", "createMarker", "createComment", "isPrimitive", "value", "isArray", "Array", "isIterable", "Symbol", "iterator", "SPACE_CHAR", "textEndRegex", "commentEndRegex", "comment2EndRegex", "tagEndRegex", "RegExp", "singleQuoteAttrEndRegex", "doubleQuoteAttrEndRegex", "rawTextElement", "tag", "type", "strings", "values", "_$litType$", "html", "svg", "mathml", "noChange", "for", "nothing", "templateCache", "WeakMap", "walker", "createTreeWalker", "trustFromTemplateString", "tsa", "stringFromTSA", "hasOwnProperty", "Error", "getTemplateHtml", "l", "length", "attrNames", "rawTextEndRegex", "regex", "i", "attrName", "match", "attrNameEndIndex", "lastIndex", "exec", "test", "end", "startsWith", "push", "Template", "constructor", "options", "this", "parts", "nodeIndex", "attrNameIndex", "partCount", "el", "createElement", "currentNode", "content", "wrapper", "firstChild", "replaceWith", "childNodes", "nextNode", "nodeType", "hasAttributes", "name", "getAttributeNames", "endsWith", "realName", "statics", "getAttribute", "split", "m", "index", "ctor", "PropertyPart", "BooleanAttributePart", "EventPart", "AttributePart", "removeAttribute", "tagName", "textContent", "emptyScript", "append", "data", "indexOf", "_options", "innerHTML", "resolveDirective", "part", "parent", "attributeIndex", "currentDirective", "__directives", "__directive", "nextDirectiveConstructor", "_$initialize", "_$resolve", "TemplateInstance", "template", "_$parts", "_$disconnectableChildren", "_$template", "_$parent", "parentNode", "_$isConnected", "fragment", "creationScope", "importNode", "partIndex", "templatePart", "ChildPart", "nextSibling", "ElementPart", "_$setValue", "__isConnected", "startNode", "endNode", "_$committedValue", "_$startNode", "_$endNode", "isConnected", "directiveParent", "_$clear", "_commitText", "_commitTemplateResult", "_commitNode", "_commitIterable", "insertBefore", "_insert", "createTextNode", "result", "_$getTemplate", "h", "_update", "instance", "_clone", "get", "set", "itemParts", "itemPart", "item", "start", "from", "_$notifyConnectionChanged", "n", "remove", "element", "fill", "String", "valueIndex", "noCommit", "change", "v", "_commitValue", "setAttribute", "toggleAttribute", "super", "newListener", "oldListener", "shouldRemoveListener", "capture", "once", "passive", "shouldAddListener", "removeEventListener", "addEventListener", "event", "call", "host", "handleEvent", "polyfillSupport", "global", "litHtmlPolyfillSupport", "Template", "ChildPart", "litHtmlVersions", "push", "render", "value", "container", "options", "partOwnerNode", "renderBefore", "part", "endNode", "insertBefore", "createMarker", "_$setValue", "global", "globalThis", "LitElement", "ReactiveElement", "constructor", "this", "renderOptions", "host", "__childPart", "createRenderRoot", "renderRoot", "super", "renderBefore", "firstChild", "changedProperties", "value", "render", "hasUpdated", "isConnected", "update", "connectedCallback", "setConnected", "disconnectedCallback", "noChange", "litElementHydrateSupport", "polyfillSupport", "litElementPolyfillSupport", "global", "litElementVersions", "push", "token", "path", "fallback", "r", "type", "name", "space", "step", "fontSize", "lineHeight", "fontWeight", "spaceAround", "i", "focusRing", "i", "targetSize", "visuallyHidden", "reducedMotion", "base", "touchTarget", "selector", "r", "hideOn", "WORDING", "say", "english", "values", "chosen", "text", "whole", "name", "counter", "ImpaktElement", "i", "base", "reducedMotion", "part", "props", "self", "name", "value", "said", "say", "ICONS", "w", "ICON_NAMES", "iconSvg", "name", "size", "shape", "b", "A", "ImpaktIcon", "ImpaktElement", "i", "drawn", "ImpaktButton", "ImpaktElement", "focusRing", "touchTarget", "i", "targetSize", "space", "type", "fontWeight", "token", "visuallyHidden", "event", "iconOnly", "cls", "drawn", "iconSvg", "b", "A", "words", "fieldWidths", "i", "FieldElement", "ImpaktElement", "focusRing", "space", "fontSize", "fontWeight", "lineHeight", "visuallyHidden", "ids", "A", "options", "control", "b", "value", "ImpaktTextInput", "FieldElement", "fieldWidths", "i", "space", "fontSize", "input", "b", "iconSvg", "A", "changed", "ImpaktSelect", "FieldElement", "fieldWidths", "i", "visuallyHidden", "space", "fontSize", "b", "A", "o", "changed", "ImpaktCheckbox", "FieldElement", "touchTarget", "i", "space", "targetSize", "fontSize", "b", "A", "changed", "PHONE", "r", "pathOf", "href", "base", "isCurrent", "current", "path", "here", "announceNavigate", "host", "event", "item", "go", "ImpaktSideNav", "ImpaktElement", "focusRing", "i", "space", "targetSize", "fontSize", "fontWeight", "slot", "n", "b", "A", "e", "iconSvg", "ImpaktTabBar", "ImpaktAppShell", "token", "main", "pageLocale", "el", "fromElement", "fromHost", "fromPage", "lang", "LIGHT", "token", "ImpaktStatTile", "ImpaktElement", "focusRing", "i", "space", "fontWeight", "fontSize", "inner", "b", "A", "ImpaktDateTile", "visuallyHidden", "match", "when", "locale", "pageLocale", "say", "options", "parts", "ImpaktRow", "event", "slot", "name", "n", "title", "iconSvg", "ImpaktFilterChip", "touchTarget", "targetSize", "hasCount", "ImpaktSwitch", "FieldElement", "touchTarget", "i", "space", "fontSize", "visuallyHidden", "targetSize", "b", "A", "value", "changed", "ImpaktSegmentedControl", "fontWeight", "option", "id", "ImpaktRadioGroup", "FieldElement", "i", "space", "targetSize", "fontSize", "b", "A", "option", "id", "descId", "changed", "ImpaktAlert", "_ImpaktAlert", "ImpaktElement", "i", "space", "fontSize", "fontWeight", "word", "say", "b", "A", "ImpaktStack", "ImpaktElement", "spaceAround", "i", "space", "b", "ImpaktCard", "fontSize", "A", "ImpaktHeading", "fontWeight", "lineHeight", "type", "visuallyHidden", "ImpaktText", "ImpaktLink", "ImpaktElement", "focusRing", "i", "space", "fontWeight", "visuallyHidden", "b", "A", "iconSvg", "ImpaktImage", "ImpaktElement", "i", "b", "A", "ImpaktLogo", "src", "ImpaktDocumentLink", "kb", "meta", "ImpaktPrice", "ImpaktElement", "i", "space", "fontWeight", "fontSize", "pageLocale", "b", "A", "ImpaktSummaryList", "ImpaktElement", "focusRing", "touchTarget", "i", "space", "fontWeight", "fontSize", "b", "row", "A", "ImpaktTable", "ImpaktElement", "focusRing", "touchTarget", "i", "fontSize", "fontWeight", "space", "visuallyHidden", "row", "index", "key", "rows", "column", "c", "way", "locale", "pageLocale", "figure", "v", "a", "b", "x", "y", "direction", "keys", "on", "now", "sorted", "classes", "A", "iconSvg", "columns", "chosen", "every", "r", "some", "e", "j", "value", "ImpaktAccordion", "ImpaktElement", "focusRing", "i", "targetSize", "space", "fontSize", "fontWeight", "id", "o", "b", "item", "expanded", "panelId", "buttonId", "A", "ImpaktProgress", "ImpaktElement", "i", "space", "fontSize", "fontWeight", "visuallyHidden", "index", "s", "b", "step", "state", "A", "say", "TONE", "CYCLE", "toneOf", "tone", "i", "MONO", "ImpaktChip", "ImpaktElement", "hideOn", "i", "space", "fontSize", "icon", "b", "A", "toneOf", "ImpaktBadge", "ImpaktElement", "i", "space", "type", "fontWeight", "b", "iconSvg", "ImpaktTextarea", "FieldElement", "fieldWidths", "i", "space", "fontSize", "changed", "saved", "b", "A", "e", "ImpaktCheckboxGroup", "FieldElement", "i", "space", "targetSize", "fontSize", "b", "A", "value", "checked", "v", "o", "option", "id", "descId", "e", "changed", "ImpaktDateInput", "FieldElement", "i", "space", "fontSize", "b", "A", "name", "label", "length", "autocomplete", "id", "e", "iso", "say", "changed", "holders", "before", "lockScroll", "holder", "root", "bar", "unlockScroll", "ImpaktDialog", "ImpaktElement", "focusRing", "touchTarget", "i", "space", "fontSize", "fontWeight", "targetSize", "changed", "dialog", "lockScroll", "unlockScroll", "b", "A", "ImpaktList", "ImpaktElement", "spaceAround", "i", "space", "type", "fontWeight", "items", "item", "b", "WIDTHS", "ImpaktGrid", "ImpaktElement", "spaceAround", "i", "token", "count", "fractions", "template", "f", "b", "_", "ImpaktHelp", "ImpaktElement", "focusRing", "i", "fontWeight", "text", "b", "A", "detail", "caption", "target", "contactHref", "captionId", "detailId", "captionPart", "detailPart", "value", "kind", "digits", "widths", "i", "token", "margins", "ImpaktPage", "ImpaktElement", "hero", "editing", "floats", "frame", "focusRing", "space", "name", "c", "event", "main", "header", "footer", "b", "A", "element", "ImpaktSection", "spaceAround", "where", "href", "path", "url", "here", "ImpaktNav", "ImpaktElement", "next", "focusRing", "i", "space", "targetSize", "fontWeight", "fontSize", "room", "items", "gap", "total", "item", "fold", "changed", "event", "list", "b", "A", "iconSvg", "link", "current", "ImpaktBreadcrumbs", "visuallyHidden", "ImpaktDivider", "ImpaktElement", "i", "space", "b", "ImpaktSpacer", "ImpaktVisuallyHidden", "visuallyHidden", "ImpaktTabs", "focusRing", "touchTarget", "targetSize", "fontWeight", "lineHeight", "item", "A", "items", "id", "focus", "event", "at", "to", "list", "tab", "start", "end", "changed", "current", "e", "announceNavigate", "many", "ImpaktFieldset", "ImpaktElement", "i", "space", "fontSize", "fontWeight", "lineHeight", "described", "b", "A", "ImpaktDrawer", "ImpaktElement", "focusRing", "touchTarget", "i", "space", "type", "fontWeight", "targetSize", "changed", "dialog", "lockScroll", "unlockScroll", "event", "b", "A", "iconSvg", "TOAST_ICON", "ImpaktToast", "ImpaktMenu", "open", "focus", "list", "box", "width", "entries", "at", "go", "letter", "e", "item", "inner", "pageWindow", "page", "pages", "wanted", "n", "a", "previous", "ImpaktPagination", "classes", "content", "label", "current", "to", "words", "icon", "off", "say", "initialsOf", "name", "ImpaktAvatar", "ImpaktAvatarGroup", "visuallyHidden", "shown", "rest", "ImpaktEmptyState", "spaceAround", "timesOf", "day", "time", "dayParts", "date", "parsed", "locale", "pageLocale", "part", "options", "ImpaktSlotPicker", "FieldElement", "parts", "value", "inputStyles", "i", "space", "fontSize", "fontWeight", "visuallyHidden", "ImpaktAddressLookup", "FieldElement", "fieldWidths", "type", "postcode", "url", "found", "p", "field", "key", "label", "autocomplete", "b", "say", "a", "A", "changed", "ImpaktErrorSummary", "ImpaktElement", "focusRing", "spaceAround", "touchTarget", "event", "href", "id", "target", "before", "e", "fileSize", "bytes", "ImpaktFileUpload", "targetSize", "file", "kinds", "k", "list", "chosen", "problems", "f", "good", "kept", "index", "gone", "_", "symbolOf", "currency", "pageLocale", "groupDigits", "value", "digits", "whole", "part", "ImpaktMoneyInput", "raw", "clean", "n", "money", "x", "ids", "ImpaktRangeInput", "locale", "s", "TASK_WORDS", "ImpaktTaskList", "done"]
|
|
7
7
|
}
|