@syntrologie/runtime-sdk 2.8.0-canary.136 → 2.8.0-canary.138
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/adaptives/adaptive-nav/index.js +5 -5
- package/dist/adaptives/adaptive-nav/index.js.map +3 -3
- package/dist/api-lit.d.ts +16 -0
- package/dist/bootstrap-types.d.ts +12 -0
- package/dist/{chunk-VAGUKLGQ.js → chunk-G3TY4AIC.js} +13 -4
- package/dist/{chunk-VAGUKLGQ.js.map → chunk-G3TY4AIC.js.map} +2 -2
- package/dist/index.js +47 -10
- package/dist/index.js.map +2 -2
- package/dist/react.js +1 -1
- package/dist/runtime.d.ts +15 -0
- package/dist/smart-canvas.esm.js +108 -108
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +58 -13
- package/dist/smart-canvas.js.map +2 -2
- package/dist/smart-canvas.min.js +108 -108
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../shared-editor-ui/dist/cn.js", "syntro-react:react/jsx-runtime", "syntro-react:react", "syntro-react:react-dom", "../../../../../node_modules/css-selector-generator/src/types.ts", "../../../../../node_modules/css-selector-generator/src/utilities-messages.ts", "../../../../../node_modules/css-selector-generator/src/utilities-options.ts", "../../../../../node_modules/css-selector-generator/src/utilities-data.ts", "../../../../../node_modules/css-selector-generator/src/constants.ts", "../../../../../node_modules/css-selector-generator/src/selector-attribute.ts", "../../../../../node_modules/css-selector-generator/src/utilities-selectors.ts", "../../../../../node_modules/shared/src/utils/mergeClasses.ts", "../../../../../node_modules/shared/src/utils/toKebabCase.ts", "../../../../../node_modules/shared/src/utils/toCamelCase.ts", "../../../../../node_modules/shared/src/utils/toPascalCase.ts", "../../../../../node_modules/lucide-react/src/defaultAttributes.ts", "../../../../../node_modules/shared/src/utils/hasA11yProp.ts", "../../../../../node_modules/lucide-react/src/Icon.ts", "../../../../../node_modules/lucide-react/src/createLucideIcon.ts", "../../../../../node_modules/lucide-react/src/icons/check.ts", "../../../../shared-editor-ui/dist/components/DetectionBadge.js", "../../../../shared-editor-ui/dist/components/DismissedSection.js", "../../../../shared-editor-ui/dist/components/EditorBody.js", "../../../../shared-editor-ui/dist/components/EditorCard.js", "../../../../shared-editor-ui/dist/components/EditorHeader.js", "../../../../shared-editor-ui/dist/components/EditorInput.js", "../../../../shared-editor-ui/dist/components/EditorLayout.js", "../../../../design-system/dist/tokens/colors.js", "../../../../design-system/dist/tokens/effects.js", "../../../../design-system/dist/tailwind-preset.js", "../../../../design-system/dist/tokens/panel-shell.js", "../../../../shared-editor-ui/dist/components/EditorPanelShell.js", "../../../../shared-editor-ui/dist/components/EmptyState.js", "../../../../shared-editor-ui/dist/components/GroupHeader.js", "../../../../shared-editor-ui/dist/components/TriggerJourney.js", "../../../../shared-editor-ui/dist/controllers/PanelShellController.js", "../../../../shared-editor-ui/dist/formatConditionLabel.js", "../../../../shared-editor-ui/dist/hooks/useTriggerWhenStatus.js", "../../../../../tests/fixtures/action-step-field-mapping.json", "../../../../shared-editor-ui/dist/utils/elementChainRecommender.js", "../../../../adaptives/adaptive-nav/src/summarize.ts", "../../../../adaptives/adaptive-nav/src/types.ts", "../../../../adaptives/adaptive-nav/src/editor.tsx", "syntro-react:react-dom/client", "../../../../adaptives/adaptive-nav/src/NavWidget.tsx", "../../../../../node_modules/@lit/reactive-element/src/css-tag.ts", "../../../../../node_modules/@lit/reactive-element/src/reactive-element.ts", "../../../../../node_modules/lit-html/src/lit-html.ts", "../../../../../node_modules/lit-element/src/lit-element.ts", "../../../../../node_modules/lit-html/src/directive.ts", "../../../../../node_modules/lit-html/src/directives/style-map.ts", "../../../../../node_modules/lit-html/src/directives/unsafe-html.ts", "../../../../adaptives/adaptive-nav/src/NavWidgetLit.ts", "../../../../adaptives/adaptive-nav/src/runtime.ts", "../../../../adaptives/adaptive-nav/src/cdn.ts"],
|
|
4
|
-
"sourcesContent": ["export function cn(...classes) {\n return classes.filter(Boolean).join(' ');\n}\n", "\n function _R() {\n return (typeof SynOS !== 'undefined' && SynOS.React) || {};\n }\n function _jsx(type, props, key) {\n var R = _R();\n var p = props || {};\n var c = p.children;\n delete p.children;\n if (key !== undefined) p.key = key;\n return Array.isArray(c)\n ? R.createElement.apply(null, [type, p].concat(c))\n : c !== undefined\n ? R.createElement(type, p, c)\n : R.createElement(type, p);\n }\n export var jsx = _jsx;\n export var jsxs = _jsx;\n export var Fragment = _R().Fragment;\n ", "\n function _R() {\n return (typeof SynOS !== 'undefined' && SynOS.React) || {};\n }\n\n // Default export \u2014 lazy proxy for React.* access\n export default new Proxy({}, { get: function(_, k) { return _R()[k]; } });\n\n // Hooks \u2014 lazy function wrappers (resolve at call time)\n export function useState() { return _R().useState.apply(null, arguments); }\n export function useEffect() { return _R().useEffect.apply(null, arguments); }\n export function useMemo() { return _R().useMemo.apply(null, arguments); }\n export function useCallback() { return _R().useCallback.apply(null, arguments); }\n export function useRef() { return _R().useRef.apply(null, arguments); }\n export function useContext() { return _R().useContext.apply(null, arguments); }\n export function useReducer() { return _R().useReducer.apply(null, arguments); }\n export function useLayoutEffect() { return _R().useLayoutEffect.apply(null, arguments); }\n export function useId() { return _R().useId.apply(null, arguments); }\n export function useSyncExternalStore() { return _R().useSyncExternalStore.apply(null, arguments); }\n export function useDebugValue() { return _R().useDebugValue.apply(null, arguments); }\n export function useInsertionEffect() { return _R().useInsertionEffect.apply(null, arguments); }\n\n // Creation APIs \u2014 lazy function wrappers\n export function createElement() { return _R().createElement.apply(null, arguments); }\n export function createContext() { return _R().createContext.apply(null, arguments); }\n export function forwardRef() { return _R().forwardRef.apply(null, arguments); }\n export function memo() { return _R().memo.apply(null, arguments); }\n export function lazy() { return _R().lazy.apply(null, arguments); }\n export function isValidElement() { return _R().isValidElement.apply(null, arguments); }\n export function cloneElement() { return _R().cloneElement.apply(null, arguments); }\n\n // Component types \u2014 resolved at module eval (runtime loads first)\n var _r = _R();\n export var Fragment = _r.Fragment;\n export var Suspense = _r.Suspense;\n export var Children = _r.Children;\n export var Component = _r.Component;\n export var PureComponent = _r.PureComponent;\n ", "\n function _RD() {\n return (typeof SynOS !== 'undefined' && SynOS.ReactDOM) || {};\n }\n export default new Proxy({}, { get: function(_, k) { return _RD()[k]; } });\n export function createRoot() { return _RD().createRoot.apply(null, arguments); }\n export function hydrateRoot() { return _RD().hydrateRoot.apply(null, arguments); }\n export function createPortal() { return _RD().createPortal.apply(null, arguments); }\n export function flushSync() { return _RD().flushSync.apply(null, arguments); }\n ", "declare const opaqueId: unique symbol;\n\ndeclare interface Tagged<Token> {\n readonly [opaqueId]: Token;\n}\n\nexport type Opaque<Type, Token = unknown> = Type & Tagged<Token>;\n\nexport type ObjectValues<T> = T[keyof T];\n\n// TODO rename to \"CssSelector\"\nexport type CssSelectorGenerated = Opaque<string, \"CssSelector\">;\n\nexport const OPERATOR = {\n NONE: \"\",\n DESCENDANT: \" \",\n CHILD: \" > \",\n} as const;\n\nexport type OperatorValue = ObjectValues<typeof OPERATOR>;\n\nexport interface ElementSelectorData {\n value: CssSelectorGenerated;\n include: boolean;\n}\n\nexport interface ElementData {\n element: Element;\n operator: OperatorValue;\n selectors: Partial<Record<CssSelectorType, ElementSelectorData[]>>;\n}\n\nexport type CssSelector = string;\nexport type CssSelectors = CssSelector[];\n\ntype CssSelectorMatchFn = (input: string) => boolean;\nexport type CssSelectorMatch = RegExp | string | CssSelectorMatchFn;\n\nexport const CSS_SELECTOR_TYPE = {\n id: \"id\",\n class: \"class\",\n tag: \"tag\",\n attribute: \"attribute\",\n nthchild: \"nthchild\",\n nthoftype: \"nthoftype\",\n} as const;\n\nexport type CssSelectorType = ObjectValues<typeof CSS_SELECTOR_TYPE>;\nexport type CssSelectorTypes = CssSelectorType[];\n\nexport type CssSelectorsByType = Partial<Record<CssSelectorType, CssSelectors>>;\n\nexport type CssSelectorData = Partial<\n Record<CssSelectorType, string[] | string[][]>\n>;\n\nexport type CssSelectorGeneratorOptionsInput = Partial<{\n // List of selector types to use. They will be prioritised by their order.\n selectors: CssSelectorTypes;\n // List of selectors that should be prioritised.\n whitelist: CssSelectorMatch[];\n // List of selectors that should be ignored.\n blacklist: CssSelectorMatch[];\n // Root element inside which the selector will be generated. If not set, the document root will be used.\n root: ParentNode | null;\n // If set to `true`, the generator will test combinations of selectors of single type (e.g. multiple class selectors).\n combineWithinSelector: boolean;\n // If set to `true`, the generator will try to test combinations of selectors of different types (e.g. tag + class name).\n combineBetweenSelectors: boolean;\n // If set to `true`, all generated selectors will include the TAG part. Even if tag selector type is not included in `selectors` option.\n includeTag: boolean;\n // Maximum number of combinations of a selector type. This is handy for performance reasons, e.g. when elements have too many classnames.\n maxCombinations: number;\n // Maximum number of selector candidates to be tested for each element. This is handy for performance reasons, e.g. when elements can produce large number of combinations of various types of selectors.\n maxCandidates: number;\n // Experimental. If set to `true` and the \"root\" option is set, the fallback selectors will use \":scope\" pseudo-class to make the selectors shorter and simpler.\n useScope: boolean;\n // Limits the number of results (selectors) to be generated.\n maxResults: number;\n}>;\n\nexport type CssSelectorGeneratorOptions = Required<\n Omit<CssSelectorGeneratorOptionsInput, \"selectors\"> & {\n selectors: CssSelectorTypes;\n }\n>;\n\nexport interface IdentifiableParent {\n foundElements: Element[];\n selector: CssSelector;\n}\n\nexport type PatternMatcher = (input: string) => boolean;\n", "const libraryName = \"CssSelectorGenerator\";\n\n/**\n * Convenient wrapper for `console.warn` using consistent formatting.\n */\nexport function showWarning(id = \"unknown problem\", ...args: unknown[]): void {\n // eslint-disable-next-line no-console\n console.warn(`${libraryName}: ${id}`, ...args);\n}\n", "import {\n CSS_SELECTOR_TYPE,\n CssSelectorGeneratorOptions,\n CssSelectorMatch,\n CssSelectorTypes,\n} from \"./types.js\";\nimport { getRootNode } from \"./utilities-dom.js\";\nimport { isEnumValue } from \"./utilities-typescript.js\";\nimport { showWarning } from \"./utilities-messages.js\";\n\nexport const DEFAULT_OPTIONS = {\n selectors: [\n CSS_SELECTOR_TYPE.id,\n CSS_SELECTOR_TYPE.class,\n CSS_SELECTOR_TYPE.tag,\n CSS_SELECTOR_TYPE.attribute,\n ] as CssSelectorTypes,\n // if set to true, always include tag name\n includeTag: false,\n whitelist: [] as CssSelectorMatch[],\n blacklist: [] as CssSelectorMatch[],\n combineWithinSelector: true,\n combineBetweenSelectors: true,\n root: null,\n maxCombinations: Number.POSITIVE_INFINITY,\n maxCandidates: Number.POSITIVE_INFINITY,\n useScope: false,\n} as CssSelectorGeneratorOptions;\n\n/**\n * Makes sure returned value is a list containing only valid selector types.\n * @param input\n */\nexport function sanitizeSelectorTypes(input: unknown): CssSelectorTypes {\n if (!Array.isArray(input)) {\n return [];\n }\n return input.filter((item) => isEnumValue(CSS_SELECTOR_TYPE, item));\n}\n\n/**\n * Checks whether provided value is of type RegExp.\n */\nexport function isRegExp(input: unknown): input is RegExp {\n return input instanceof RegExp;\n}\n\n/**\n * Checks whether provided value is usable in whitelist or blacklist.\n * @param input\n */\nexport function isCssSelectorMatch(input: unknown): input is CssSelectorMatch {\n return [\"string\", \"function\"].includes(typeof input) || isRegExp(input);\n}\n\n/**\n * Converts input to a list of valid values for whitelist or blacklist.\n */\nexport function sanitizeCssSelectorMatchList(\n input: unknown,\n): CssSelectorMatch[] {\n if (!Array.isArray(input)) {\n return [];\n }\n return input.filter(isCssSelectorMatch);\n}\n\n/**\n * Checks whether provided value is valid Node.\n */\nexport function isNode(input: unknown): input is Node {\n return input instanceof Node;\n}\n\n/**\n * Checks whether provided value is valid ParentNode.\n */\nexport function isParentNode(input: unknown): input is ParentNode {\n const validParentNodeTypes: number[] = [\n Node.DOCUMENT_NODE,\n Node.DOCUMENT_FRAGMENT_NODE, // this includes Shadow DOM root\n Node.ELEMENT_NODE,\n ];\n\n return isNode(input) && validParentNodeTypes.includes(input.nodeType);\n}\n\n/**\n * Makes sure that the root node in options is valid.\n */\nexport function sanitizeRoot(input: unknown, element: Element): ParentNode {\n if (isParentNode(input)) {\n if (!input.contains(element)) {\n showWarning(\n \"element root mismatch\",\n \"Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended.\",\n );\n }\n return input;\n }\n\n const rootNode = element.getRootNode({ composed: false });\n if (isParentNode(rootNode)) {\n if (rootNode !== document) {\n showWarning(\n \"shadow root inferred\",\n \"You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended.\",\n );\n }\n return rootNode;\n }\n\n return getRootNode(element);\n}\n\n/**\n * Makes sure that the output is a number, usable as `maxResults` option in\n * powerset generator.\n */\nexport function sanitizeMaxNumber(input?: unknown): number {\n return typeof input === \"number\" ? input : Number.POSITIVE_INFINITY;\n}\n\n/**\n * Makes sure the options object contains all required keys.\n */\nexport function sanitizeOptions(\n element: Element,\n custom_options = {},\n): CssSelectorGeneratorOptions {\n const options = {\n ...DEFAULT_OPTIONS,\n ...custom_options,\n };\n\n return {\n selectors: sanitizeSelectorTypes(options.selectors),\n whitelist: sanitizeCssSelectorMatchList(options.whitelist),\n blacklist: sanitizeCssSelectorMatchList(options.blacklist),\n root: sanitizeRoot(options.root, element),\n combineWithinSelector: !!options.combineWithinSelector,\n combineBetweenSelectors: !!options.combineBetweenSelectors,\n includeTag: !!options.includeTag,\n maxCombinations: sanitizeMaxNumber(options.maxCombinations),\n maxCandidates: sanitizeMaxNumber(options.maxCandidates),\n useScope: !!options.useScope,\n maxResults: sanitizeMaxNumber(options.maxResults),\n };\n}\n", "import { CssSelectorMatch, PatternMatcher } from \"./types.js\";\nimport { isRegExp } from \"./utilities-options.js\";\nimport { showWarning } from \"./utilities-messages.js\";\n\n/**\n * Creates array containing only items included in all input arrays.\n */\nexport function getIntersection<T>(items: T[][] = []): T[] {\n const [firstItem = [], ...otherItems] = items;\n if (otherItems.length === 0) {\n return firstItem;\n }\n return otherItems.reduce((accumulator, currentValue) => {\n return accumulator.filter((item) => currentValue.includes(item));\n }, firstItem);\n}\n\n/**\n * Converts array of arrays into a flat array.\n */\nexport function flattenArray<T>(input: T[][]): T[] {\n return ([] as T[]).concat(...input);\n}\n\n/**\n * Convert string that can contain wildcards (asterisks) to RegExp source.\n */\nexport function wildcardToRegExp(input: string): string {\n return (\n input\n // convert all special characters used by RegExp, except an asterisk\n .replace(/[|\\\\{}()[\\]^$+?.]/g, \"\\\\$&\")\n // convert asterisk to pattern that matches anything\n .replace(/\\*/g, \".+\")\n );\n}\n\n/**\n * Creates function that will test list of provided matchers against input.\n * Used for white/blacklist functionality.\n */\nexport function createPatternMatcher(list: CssSelectorMatch[]): PatternMatcher {\n const matchFunctions = list.map((item) => {\n if (isRegExp(item)) {\n return (input: string) => item.test(input);\n }\n\n if (typeof item === \"function\") {\n return (input: string) => {\n const result = item(input);\n if (typeof result !== \"boolean\") {\n showWarning(\n \"pattern matcher function invalid\",\n \"Provided pattern matching function does not return boolean. It's result will be ignored.\",\n item,\n );\n return false;\n }\n return result;\n };\n }\n\n if (typeof item === \"string\") {\n const re = new RegExp(\"^\" + wildcardToRegExp(item) + \"$\");\n return (input: string) => re.test(input);\n }\n\n showWarning(\n \"pattern matcher invalid\",\n \"Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.\",\n item,\n );\n return () => false;\n });\n\n return (input: string) =>\n matchFunctions.some((matchFunction) => matchFunction(input));\n}\n", "import { CSS_SELECTOR_TYPE } from \"./types.js\";\n\nexport const SELECTOR_SEPARATOR = \", \";\n\n// RegExp that will match invalid patterns that can be used in ID attribute.\nexport const INVALID_ID_RE = new RegExp(\n [\n \"^$\", // empty or not set\n \"\\\\s\", // contains whitespace\n ].join(\"|\"),\n);\n\n// RegExp that will match invalid patterns that can be used in class attribute.\nexport const INVALID_CLASS_RE = new RegExp(\n [\n \"^$\", // empty or not set\n ].join(\"|\"),\n);\n\n// Order in which a combined selector is constructed.\nexport const SELECTOR_PATTERN = [\n CSS_SELECTOR_TYPE.nthoftype,\n CSS_SELECTOR_TYPE.tag,\n CSS_SELECTOR_TYPE.id,\n CSS_SELECTOR_TYPE.class,\n CSS_SELECTOR_TYPE.attribute,\n CSS_SELECTOR_TYPE.nthchild,\n];\n", "import { sanitizeSelectorItem } from \"./utilities-selectors.js\";\nimport { createPatternMatcher, getIntersection } from \"./utilities-data.js\";\nimport { CssSelectorGenerated } from \"./types.js\";\n\ninterface AttributeData {\n name: string;\n value: string;\n}\n\n// List of attributes to be ignored. These are handled by different selector types.\nexport const attributeBlacklistMatch = createPatternMatcher([\n \"class\",\n \"id\",\n // Angular attributes\n \"ng-*\",\n]);\n\n/**\n * Get simplified attribute selector for an element.\n */\nexport function attributeNodeToSimplifiedSelector({\n name,\n}: AttributeData): CssSelectorGenerated {\n return `[${name}]` as CssSelectorGenerated;\n}\n\n/**\n * Get attribute selector for an element.\n */\nexport function attributeNodeToSelector({\n name,\n value,\n}: AttributeData): CssSelectorGenerated {\n return `[${name}='${value}']` as CssSelectorGenerated;\n}\n\n/**\n * Checks whether an attribute should be used as a selector.\n */\nexport function isValidAttributeNode(\n { nodeName, nodeValue }: Node,\n element: Element,\n): boolean {\n // form input value should not be used as a selector\n const tagName = element.tagName.toLowerCase();\n if ([\"input\", \"option\"].includes(tagName) && nodeName === \"value\") {\n return false;\n }\n\n // ignore Base64-encoded strings as 'src' attribute values (e.g. in tags like img, audio, video, iframe, object, embed).\n if (nodeName === \"src\" && nodeValue?.startsWith(\"data:\")) {\n return false;\n }\n\n return !attributeBlacklistMatch(nodeName);\n}\n\n/**\n * Sanitize all attribute data. We want to do it once, before we start to generate simplified/full selectors from the same data.\n */\nfunction sanitizeAttributeData({ nodeName, nodeValue }: Node): AttributeData {\n return {\n name: sanitizeSelectorItem(nodeName),\n value: sanitizeSelectorItem(nodeValue ?? undefined),\n };\n}\n\n/**\n * Get attribute selectors for an element.\n */\nexport function getElementAttributeSelectors(\n element: Element,\n): CssSelectorGenerated[] {\n const validAttributes = Array.from(element.attributes)\n .filter((attributeNode) => isValidAttributeNode(attributeNode, element))\n .map(sanitizeAttributeData);\n return [\n ...validAttributes.map(attributeNodeToSimplifiedSelector),\n ...validAttributes.map(attributeNodeToSelector),\n ];\n}\n\n/**\n * Get attribute selectors matching all elements.\n */\nexport function getAttributeSelectors(\n elements: Element[],\n): CssSelectorGenerated[] {\n const elementSelectors = elements.map(getElementAttributeSelectors);\n return getIntersection(elementSelectors);\n}\n", "import { SELECTOR_PATTERN } from \"./constants.js\";\nimport {\n getAttributeSelectors,\n getElementAttributeSelectors,\n} from \"./selector-attribute.js\";\nimport {\n getClassSelectors,\n getElementClassSelectors,\n} from \"./selector-class.js\";\nimport { getElementIdSelectors, getIdSelector } from \"./selector-id.js\";\nimport {\n getElementNthChildSelector,\n getNthChildSelector,\n} from \"./selector-nth-child.js\";\nimport {\n getElementNthOfTypeSelector,\n getNthOfTypeSelector,\n} from \"./selector-nth-of-type.js\";\nimport { getElementTagSelectors, getTagSelector } from \"./selector-tag.js\";\nimport { createPatternMatcher } from \"./utilities-data.js\";\nimport { getParents, testSelector } from \"./utilities-dom.js\";\nimport {\n CSS_SELECTOR_TYPE,\n CssSelector,\n CssSelectorData,\n CssSelectorGenerated,\n CssSelectorGeneratorOptions,\n CssSelectorType,\n CssSelectorTypes,\n IdentifiableParent,\n OPERATOR,\n PatternMatcher,\n} from \"./types.js\";\nimport { isElement } from \"./utilities-iselement.js\";\nimport { getPowerSet, powerSetGenerator } from \"./utilities-powerset.js\";\nimport { cartesianProductGenerator } from \"./utilities-cartesian.js\";\n\nexport const ESCAPED_COLON = \":\".charCodeAt(0).toString(16).toUpperCase();\n\n// Square brackets need to be escaped, but eslint has a problem with that.\n/* eslint-disable-next-line no-useless-escape */\nexport const SPECIAL_CHARACTERS_RE = /[ !\"#$%&'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;\n\n/**\n * Escapes special characters used by CSS selector items.\n */\nexport function sanitizeSelectorItem(input = \"\"): string {\n // This should not be necessary, but just to be sure, let's keep the legacy sanitizer in place, for backwards compatibility.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return CSS ? CSS.escape(input) : legacySanitizeSelectorItem(input);\n}\n\n/**\n * Legacy version of escaping utility, originally used for IE11-. Should\n * probably be replaced by a polyfill:\n * https://github.com/mathiasbynens/CSS.escape\n */\nexport function legacySanitizeSelectorItem(input = \"\"): string {\n return input\n .split(\"\")\n .map((character) => {\n if (character === \":\") {\n return `\\\\${ESCAPED_COLON} `;\n }\n if (SPECIAL_CHARACTERS_RE.test(character)) {\n return `\\\\${character}`;\n }\n\n // needed for backwards compatibility\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return escape(character).replace(/%/g, \"\\\\\");\n })\n .join(\"\");\n}\n\nexport const SELECTOR_TYPE_GETTERS: Record<\n CssSelectorType,\n (elements: Element[]) => CssSelector[]\n> = {\n tag: getTagSelector,\n id: getIdSelector,\n class: getClassSelectors,\n attribute: getAttributeSelectors,\n nthchild: getNthChildSelector,\n nthoftype: getNthOfTypeSelector,\n} as const;\n\nexport const ELEMENT_SELECTOR_TYPE_GETTERS: Record<\n CssSelectorType,\n (element: Element) => CssSelectorGenerated[]\n> = {\n tag: getElementTagSelectors,\n id: getElementIdSelectors,\n class: getElementClassSelectors,\n attribute: getElementAttributeSelectors,\n nthchild: getElementNthChildSelector,\n nthoftype: getElementNthOfTypeSelector,\n} as const;\n\n/**\n * Creates selector of given type for single element.\n */\nexport function getElementSelectorsByType(\n element: Element,\n selectorType: CssSelectorType,\n): CssSelectorGenerated[] {\n return ELEMENT_SELECTOR_TYPE_GETTERS[selectorType](element);\n}\n\n/**\n * Returns list of selectors of given type for the element.\n */\nexport function getSelectorsByType(\n elements: Element[],\n selector_type: CssSelectorType,\n): CssSelector[] {\n const getter = SELECTOR_TYPE_GETTERS[selector_type];\n return getter(elements);\n}\n\n/**\n * Remove blacklisted selectors from list.\n */\nexport function filterSelectors(\n list: CssSelector[] = [],\n matchBlacklist: PatternMatcher,\n matchWhitelist: PatternMatcher,\n): CssSelector[] {\n return list.filter((item) => matchWhitelist(item) || !matchBlacklist(item));\n}\n\n/**\n * Prioritise whitelisted selectors in list.\n */\nexport function orderSelectors(\n list: CssSelector[] = [],\n matchWhitelist: PatternMatcher,\n): CssSelector[] {\n return list.sort((a, b) => {\n const a_is_whitelisted = matchWhitelist(a);\n const b_is_whitelisted = matchWhitelist(b);\n if (a_is_whitelisted && !b_is_whitelisted) {\n return -1;\n }\n if (!a_is_whitelisted && b_is_whitelisted) {\n return 1;\n }\n return 0;\n });\n}\n\n/**\n * Yields list of unique selectors applicable to given element.\n */\nexport function* allSelectorsGenerator(\n elements: Element[],\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector> {\n const yieldedSelectors = new Set<string>();\n const selectors_list = getSelectorsList(elements, options);\n for (const selector of selectorTypeCombinationsGenerator(\n selectors_list,\n options,\n )) {\n if (!yieldedSelectors.has(selector)) {\n yieldedSelectors.add(selector);\n yield selector;\n }\n }\n}\n\n/**\n * Creates object containing all selector types and their potential values.\n */\nexport function getSelectorsList(\n elements: Element[],\n options: CssSelectorGeneratorOptions,\n): CssSelectorData {\n const { blacklist, whitelist, combineWithinSelector, maxCombinations } =\n options;\n\n const matchBlacklist = createPatternMatcher(blacklist);\n const matchWhitelist = createPatternMatcher(whitelist);\n\n const reducer = (data: CssSelectorData, selector_type: CssSelectorType) => {\n const selectors_by_type = getSelectorsByType(elements, selector_type);\n const filtered_selectors = filterSelectors(\n selectors_by_type,\n matchBlacklist,\n matchWhitelist,\n );\n const found_selectors = orderSelectors(filtered_selectors, matchWhitelist);\n\n // Use Array.from with a length limit to avoid materializing huge power sets\n // This provides lazy evaluation while respecting maxCombinations\n data[selector_type] = combineWithinSelector\n ? Array.from(\n powerSetGenerator(found_selectors, { maxResults: maxCombinations }),\n )\n : found_selectors.map((item) => [item]);\n\n return data;\n };\n\n return getSelectorsToGet(options).reduce(reducer, {});\n}\n\n/**\n * Creates list of selector types that we will need to generate the selector.\n */\nexport function getSelectorsToGet(\n options: CssSelectorGeneratorOptions,\n): CssSelectorTypes {\n const { selectors, includeTag } = options;\n\n const selectors_to_get = [...selectors];\n if (includeTag && !selectors_to_get.includes(\"tag\")) {\n selectors_to_get.push(\"tag\");\n }\n return selectors_to_get;\n}\n\n/**\n * Adds \"tag\" to a list, if it does not contain it. Used to modify selectors\n * list when includeTag option is enabled to make sure all results contain the\n * TAG part.\n */\nfunction addTagTypeIfNeeded(list: CssSelectorTypes): CssSelectorTypes {\n return list.includes(CSS_SELECTOR_TYPE.tag) ||\n list.includes(CSS_SELECTOR_TYPE.nthoftype)\n ? [...list]\n : [...list, CSS_SELECTOR_TYPE.tag];\n}\n\n/**\n * Generates list of possible selector type combinations.\n */\nexport function combineSelectorTypes(\n options: CssSelectorGeneratorOptions,\n): CssSelectorTypes[] {\n const { selectors, combineBetweenSelectors, includeTag, maxCandidates } =\n options;\n\n const combinations = combineBetweenSelectors\n ? getPowerSet(selectors, { maxResults: maxCandidates })\n : selectors.map((item) => [item]);\n\n return includeTag ? combinations.map(addTagTypeIfNeeded) : combinations;\n}\n\n/**\n * Generates list of combined CSS selectors.\n */\nexport function* selectorTypeCombinationsGenerator(\n selectors_list: CssSelectorData,\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector> {\n for (const item of combineSelectorTypes(options)) {\n yield* constructedSelectorsGenerator(item, selectors_list);\n }\n}\n\n/**\n * Generates all variations of possible selectors from provided data.\n */\nexport function* constructedSelectorsGenerator(\n selector_types: CssSelectorTypes,\n selectors_by_type: CssSelectorData,\n): IterableIterator<CssSelector> {\n const data: CssSelectorData = {};\n\n for (const selector_type of selector_types) {\n const selector_variants = selectors_by_type[selector_type];\n if (selector_variants && selector_variants.length > 0) {\n data[selector_type] = selector_variants;\n }\n }\n\n for (const combination of cartesianProductGenerator<string | string[]>(\n data,\n )) {\n yield constructSelector(combination);\n }\n}\n\n/**\n * Creates selector for given selector type. Combines several parts if needed.\n */\nexport function constructSelectorType(\n selector_type: CssSelectorType,\n selectors_data: CssSelectorData,\n): CssSelector {\n return selectors_data[selector_type]\n ? selectors_data[selector_type].join(\"\")\n : \"\";\n}\n\n/**\n * Converts selector data object to a selector.\n */\nexport function constructSelector(\n selectorData: CssSelectorData = {},\n): CssSelector {\n const pattern = [...SELECTOR_PATTERN];\n // selector \"nthoftype\" already contains \"tag\"\n if (\n selectorData[CSS_SELECTOR_TYPE.tag] &&\n selectorData[CSS_SELECTOR_TYPE.nthoftype]\n ) {\n pattern.splice(pattern.indexOf(CSS_SELECTOR_TYPE.tag), 1);\n }\n\n return pattern\n .map((type) => constructSelectorType(type, selectorData))\n .join(\"\");\n}\n\n/**\n * Generates combinations of child and descendant selectors within root\n * selector.\n */\nfunction generateCandidateCombinations(\n selectors: CssSelector[],\n rootSelector: CssSelector,\n): CssSelector[] {\n return [\n ...selectors.map(\n (selector) => rootSelector + OPERATOR.DESCENDANT + selector,\n ),\n ...selectors.map((selector) => rootSelector + OPERATOR.CHILD + selector),\n ];\n}\n\n/**\n * Generates a list of selector candidates that can potentially match target\n * element.\n */\nfunction* candidatesGenerator(\n selectors: IterableIterator<CssSelector>,\n rootSelector: CssSelector,\n): IterableIterator<CssSelector> {\n if (rootSelector === \"\") {\n yield* selectors;\n } else {\n for (const selector of selectors) {\n yield* generateCandidateCombinations([selector], rootSelector);\n }\n }\n}\n\n/**\n * Tries to find unique CSS selectors for element within given parent.\n */\nexport function* selectorWithinRootGenerator(\n elements: Element[],\n root: ParentNode,\n rootSelector: CssSelector = \"\",\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector, undefined> {\n const elementSelectorsIterator = allSelectorsGenerator(elements, options);\n for (const candidateSelector of candidatesGenerator(\n elementSelectorsIterator,\n rootSelector,\n )) {\n if (testSelector(elements, candidateSelector, root)) {\n yield candidateSelector;\n }\n }\n // TODO remove the `undefined` return value when the main function is rewritten to use the generator directly\n return;\n}\n/**\n * Climbs through parents of the element and finds the ones that are identifiable by unique CSS selector.\n */\nexport function* closestIdentifiableParentGenerator(\n elements: Element[],\n root: ParentNode,\n rootSelector: CssSelector = \"\",\n options: CssSelectorGeneratorOptions,\n): IterableIterator<IdentifiableParent> {\n if (elements.length === 0) {\n return null;\n }\n\n const candidatesList = [\n elements.length > 1 ? elements : [],\n ...getParents(elements, root).map((element) => [element]),\n ];\n\n for (const currentElements of candidatesList) {\n for (const selectorWithinRoot of selectorWithinRootGenerator(\n currentElements,\n root,\n rootSelector,\n options,\n )) {\n yield {\n foundElements: currentElements,\n selector: selectorWithinRoot,\n };\n }\n }\n}\n\ninterface SelectorGeneratorProps {\n elements: Element[];\n root: ParentNode;\n rootSelector: CssSelector;\n options: CssSelectorGeneratorOptions;\n}\n\n/**\n * Recursively travels through parents, finds the ones that are identifiable and then tries to find a unique selector within that context.\n */\nexport function* selectorGenerator({\n elements,\n root,\n rootSelector = \"\",\n options,\n}: SelectorGeneratorProps): IterableIterator<CssSelector> {\n let currentRoot = root;\n let partialSelector = rootSelector;\n let shouldContinue = true;\n\n while (shouldContinue) {\n let foundAny = false;\n\n for (const item of closestIdentifiableParentGenerator(\n elements,\n currentRoot,\n partialSelector,\n options,\n )) {\n const { foundElements, selector } = item;\n foundAny = true;\n\n if (testSelector(elements, selector, root)) {\n yield selector;\n } else {\n // First non-matching selector - use its parent for next iteration\n currentRoot = foundElements[0];\n partialSelector = selector;\n break; // Try from this parent in next iteration\n }\n }\n\n if (!foundAny) {\n shouldContinue = false;\n }\n }\n}\n\n/**\n * Converts input into list of elements, removing duplicates and non-elements.\n */\nexport function sanitizeSelectorNeedle(needle: unknown): Element[] {\n if (needle instanceof NodeList || needle instanceof HTMLCollection) {\n needle = Array.from(needle);\n }\n const elements = (Array.isArray(needle) ? needle : [needle]).filter(\n isElement,\n );\n return [...new Set(elements)];\n}\n", "/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return (\n Boolean(className) &&\n (className as string).trim() !== '' &&\n array.indexOf(className) === index\n );\n })\n .join(' ')\n .trim();\n", "/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n", "/**\n * Converts string to camel case\n *\n * @param {string} string\n * @returns {string} A camelized string\n */\nexport const toCamelCase = <T extends string>(string: T) =>\n string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n", "import { CamelToPascal } from '../utility-types';\nimport { toCamelCase } from './toCamelCase';\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = toCamelCase(string);\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n", "export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n", "/**\n * Check if a component has an accessibility prop\n *\n * @param {object} props\n * @returns {boolean} Whether the component has an accessibility prop\n */\nexport const hasA11yProp = (props: Record<string, any>) => {\n for (const prop in props) {\n if (prop.startsWith('aria-') || prop === 'role' || prop === 'title') {\n return true;\n }\n }\n\n return false;\n};\n", "import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses, hasA11yProp } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...(!children && !hasA11yProp(rest) && { 'aria-hidden': 'true' }),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n);\n\nexport default Icon;\n", "import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase, toPascalCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(\n `lucide-${toKebabCase(toPascalCase(iconName))}`,\n `lucide-${iconName}`,\n className,\n ),\n ...props,\n }),\n );\n\n Component.displayName = toPascalCase(iconName);\n\n return Component;\n};\n\nexport default createLucideIcon;\n", "import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [['path', { d: 'M20 6 9 17l-5-5', key: '1gmf2c' }]];\n\n/**\n * @component @name Check\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview  - https://lucide.dev/icons/check\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Check = createLucideIcon('check', __iconNode);\n\nexport default Check;\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function DetectionBadge({ found, onClick }) {\n const title = onClick\n ? found\n ? 'Click to scroll to element'\n : 'Click to navigate to page'\n : found\n ? 'Found on this page'\n : 'Not found on this page';\n const textColor = found ? 'se-text-green-4' : 'se-text-text-tertiary';\n const dotColor = found ? 'se-bg-green-4' : 'se-bg-text-tertiary';\n const classes = cn('se-inline-flex se-items-center se-gap-1 se-text-xs se-font-medium se-shrink-0', textColor, onClick && 'se-cursor-pointer hover:se-opacity-80');\n const dot = (_jsx(\"span\", { \"data-indicator\": \"\", className: cn('se-w-1.5 se-h-1.5 se-rounded-full', dotColor) }));\n if (onClick) {\n return (_jsxs(\"button\", { type: \"button\", className: cn(classes, 'se-border-none se-bg-transparent se-p-0'), title: title, onClick: (e) => {\n e.stopPropagation();\n onClick(e);\n }, children: [dot, \"GoTo\"] }));\n }\n return (_jsxs(\"span\", { className: classes, title: title, children: [dot, \"GoTo\"] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nexport function DismissedSection({ count, children }) {\n const [isOpen, setIsOpen] = useState(false);\n return (_jsxs(\"div\", { className: \"se-mt-4 se-cursor-pointer se-select-none\", children: [_jsxs(\"div\", { role: \"button\", tabIndex: 0, className: \"se-text-xs se-font-semibold se-text-text-secondary se-flex se-items-center se-gap-1.5 se-cursor-pointer\", onClick: () => setIsOpen(!isOpen), onKeyDown: (e) => {\n if (e.key === 'Enter' || e.key === ' ')\n setIsOpen(!isOpen);\n }, children: [_jsx(\"span\", { children: isOpen ? '\\u25be' : '\\u25b8' }), _jsxs(\"span\", { children: [\"Dismissed (\", count, \")\"] })] }), isOpen && _jsx(\"div\", { className: \"se-mt-1.5\", children: children })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EditorBody({ children }) {\n return _jsx(\"div\", { className: \"se-flex-1 se-overflow-auto se-p-6\", children: children });\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function EditorCard({ children, itemKey, onClick, onMouseEnter, onMouseLeave, className, validated, }) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: onMouseEnter/onMouseLeave are for presentational hover highlighting, not user interaction\n _jsx(\"div\", { \"data-item-key\": itemKey, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, onClick: onClick, onKeyDown: onClick\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick();\n }\n }\n : undefined, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, className: cn('se-py-2 se-px-2.5 se-rounded-lg se-border se-bg-card-bg se-shadow-sm se-mb-1 se-text-sm se-text-text-primary', validated ? 'se-border-green-4/50 se-shadow-glow-green' : 'se-border-border-primary', onClick &&\n 'se-cursor-pointer hover:se-border-border-primary/80 hover:se-bg-sidebar-hover se-transition-colors', className), children: children }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function EditorHeader({ title, subtitle }) {\n return (_jsxs(\"div\", { className: \"se-px-4 se-pt-3 se-pb-2\", children: [_jsx(\"h2\", { className: \"se-m-0 se-text-base se-font-semibold se-text-text-primary\", children: title }), subtitle && (_jsx(\"p\", { className: \"se-mt-0.5 se-mb-0 se-text-xs se-text-text-secondary\", children: subtitle }))] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useId } from 'react';\nimport { cn } from '../cn';\nexport function EditorInput({ label, className, id, ...props }) {\n const generatedId = useId();\n const inputId = id || generatedId;\n return (_jsxs(\"div\", { children: [label && (_jsx(\"label\", { htmlFor: inputId, className: \"se-text-sm se-font-medium se-text-input-field-text-label se-mb-1 se-block\", children: label })), _jsx(\"input\", { id: inputId, ...props, className: cn('se-w-full se-py-2 se-px-3 se-rounded-lg se-border se-border-input-field-border se-bg-slate-grey-3 se-text-text-primary se-text-sm se-font-[inherit] se-mb-2 se-box-border', 'placeholder:se-text-input-field-text-placeholder', 'focus:se-border-input-field-border-selected focus:se-outline-none focus:se-shadow-focus-primary', 'disabled:se-bg-input-field-bg-disabled disabled:se-cursor-not-allowed disabled:se-opacity-50', className) })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EditorLayout({ children }) {\n return _jsx(\"div\", { className: \"se-flex se-flex-col se-h-full se-font-sans\", children: children });\n}\n", "/**\n * Syntro Design System - Color Tokens\n *\n * This file contains all color tokens from the Figma design system.\n * Colors are organized by scale and semantic meaning.\n *\n * @see https://www.figma.com/design/U0Ol5vM7FQvgPfIgCAgxgb/Design-System\n */\n// ============================================================================\n// BASE COLORS\n// ============================================================================\nexport const base = {\n white: '#ffffff',\n black: '#000000',\n};\n// ============================================================================\n// BRAND COLORS\n// ============================================================================\nexport const brand = {\n 0: '#2c0b0a',\n 1: '#5b1715',\n 2: '#89221f',\n 3: '#b72e2a',\n 4: '#d44844',\n 5: '#dd6d69',\n 6: '#e5918f',\n 7: '#eeb6b4',\n 8: '#f6dada',\n 9: '#faebea',\n};\n// ============================================================================\n// NEUTRAL COLORS\n// ============================================================================\nexport const slateGrey = {\n 0: '#07080a',\n 1: '#0f1318',\n 2: '#0e1114',\n 3: '#1c222a',\n 4: '#2b333f',\n 5: '#394454',\n 6: '#475569',\n 7: '#677384',\n 8: '#87919f',\n 9: '#a8afba',\n 10: '#cbd0d7',\n 11: '#e8eaee',\n 12: '#f6f7f9',\n};\n// ============================================================================\n// SEMANTIC COLOR SCALES\n// ============================================================================\nexport const green = {\n 0: '#07230a',\n 1: '#0e4514',\n 2: '#16681e',\n 3: '#1d8a28',\n 4: '#24ad32',\n 5: '#4fbd5a',\n 6: '#7acd82',\n 7: '#a5deab',\n 8: '#d0eed3',\n 9: '#e5f6e7',\n};\nexport const yellow = {\n 0: '#301f09',\n 1: '#5f3e12',\n 2: '#8f5e1b',\n 3: '#be7d24',\n 4: '#ee9c2d',\n 5: '#f1b057',\n 6: '#f5c481',\n 7: '#f8d7ab',\n 8: '#fcebd5',\n 9: '#fdf5ea',\n};\nexport const red = {\n 0: '#330707',\n 1: '#660f0e',\n 2: '#991616',\n 3: '#cc1e1d',\n 4: '#ff2524',\n 5: '#ff5150',\n 6: '#ff7c7c',\n 7: '#ffa8a7',\n 8: '#ffd3d3',\n 9: '#ffe9e9',\n};\nexport const blue = {\n 0: '#051533',\n 1: '#0a2a66',\n 2: '#0f3f98',\n 3: '#1454cb',\n 4: '#1969fe',\n 5: '#4787fe',\n 6: '#75a5fe',\n 7: '#a3c3ff',\n 8: '#d1e1ff',\n 9: '#e8f0ff',\n};\nexport const orange = {\n 0: '#662500',\n 1: '#993d00',\n 2: '#cc5800',\n 3: '#ff7700',\n 4: '#fea85d',\n 5: '#fec58f',\n 6: '#ffd6ae',\n 7: '#fee6cd',\n 8: '#fff1e1',\n 9: '#fff8f0',\n};\nexport const purple = {\n 0: '#151229',\n 1: '#2a2452',\n 2: '#40357c',\n 3: '#5547a5',\n 4: '#6a59ce',\n 5: '#887ad8',\n 6: '#a69be2',\n 7: '#c3bdeb',\n 8: '#e1def5',\n 9: '#f0eefa',\n};\nexport const pink = {\n 0: '#37091f',\n 1: '#69123c',\n 2: '#9b1c58',\n 3: '#cd2575',\n 4: '#ff2e92',\n 5: '#ff58a8',\n 6: '#ff82be',\n 7: '#ffabd3',\n 8: '#ffd5e9',\n 9: '#ffeaf4',\n};\n// ============================================================================\n// LEGACY COLORS (Being phased out)\n// ============================================================================\nexport const legacy = {\n aqua: {\n 0: '#0c5f8d',\n 1: '#146b99',\n 2: '#1d78a6',\n 3: '#2e89b6',\n 4: '#4a9fc4',\n 5: '#6bb4d1',\n 6: '#93cce0',\n 7: '#bddff0',\n 8: '#dceef8',\n 9: '#f2f8fc',\n },\n violet: {\n 0: '#6927da',\n 1: '#7839ee',\n 2: '#875bf7',\n 3: '#a48afb',\n 4: '#c3b4fd',\n 5: '#ddd6fe',\n 6: '#ece9fe',\n 7: '#f5f3ff',\n 8: '#fbfaff',\n },\n fuchsia: {\n 0: '#9f1ab1',\n 1: '#ba24d5',\n 2: '#d444f1',\n 3: '#e478fa',\n 4: '#eeaafd',\n 5: '#f6d0fe',\n 6: '#fbe8ff',\n 7: '#fdf4ff',\n 8: '#fefaff',\n },\n pink: {\n 0: '#a10f5f',\n 1: '#dd2590',\n 2: '#ee46bc',\n 3: '#f670c7',\n 4: '#faa7e0',\n 5: '#fcceee',\n 6: '#fce7f6',\n 7: '#fdf2fa',\n 8: '#fef6fb',\n },\n};\n// ============================================================================\n// TEXT TOKENS\n// ============================================================================\nexport const text = {\n primary: slateGrey[10],\n secondary: slateGrey[9],\n tertiary: slateGrey[8],\n};\n// ============================================================================\n// BACKGROUND TOKENS\n// ============================================================================\nexport const background = {\n primary: slateGrey[2],\n secondary: slateGrey[0],\n};\n// ============================================================================\n// BORDER TOKENS\n// ============================================================================\nexport const border = {\n primary: slateGrey[4],\n secondary: slateGrey[3],\n};\n// ============================================================================\n// BUTTON TOKENS\n// ============================================================================\nexport const button = {\n primary: {\n text: base.white,\n icon: base.white,\n border: brand[3],\n backgroundDefault: brand[3],\n backgroundHover: brand[2],\n },\n neutral: {\n text: slateGrey[10],\n textHover: base.white,\n icon: slateGrey[10],\n iconHover: base.white,\n border: slateGrey[4],\n background: slateGrey[2],\n },\n link: {\n text: base.white,\n icon: base.white,\n hover: brand[5],\n },\n error: {\n text: red[5],\n hover: red[6],\n },\n success: {\n text: green[5],\n hover: green[6],\n },\n};\n// ============================================================================\n// BADGE TOKENS\n// ============================================================================\nexport const badge = {\n slateGrey: {\n content: slateGrey[10],\n pillOutline: slateGrey[10],\n borderPrimary: slateGrey[5],\n borderSecondary: slateGrey[5],\n background: slateGrey[3],\n },\n brand: {\n content: brand[9],\n pillOutline: brand[9],\n borderPrimary: brand[6],\n borderSecondary: brand[6],\n background: brand[0],\n },\n red: {\n content: red[8],\n pillOutline: red[4],\n borderPrimary: red[2],\n borderSecondary: red[2],\n background: red[0],\n },\n yellow: {\n content: yellow[8],\n pillOutline: yellow[4],\n borderPrimary: yellow[2],\n borderSecondary: yellow[2],\n background: yellow[0],\n },\n green: {\n content: green[8],\n pillOutline: green[4],\n borderPrimary: green[2],\n borderSecondary: green[2],\n background: green[0],\n },\n purple: {\n content: purple[8],\n pillOutline: purple[4],\n borderPrimary: purple[2],\n borderSecondary: purple[2],\n background: purple[0],\n },\n blue: {\n content: blue[8],\n pillOutline: blue[4],\n borderPrimary: blue[2],\n borderSecondary: blue[2],\n background: blue[0],\n },\n orange: {\n content: orange[8],\n pillOutline: orange[4],\n borderPrimary: orange[2],\n borderSecondary: orange[2],\n background: orange[0],\n },\n pink: {\n content: pink[8],\n pillOutline: pink[4],\n borderPrimary: pink[2],\n borderSecondary: pink[2],\n background: pink[0],\n },\n};\n// ============================================================================\n// BADGE BANNER TOKENS\n// ============================================================================\nexport const badgeBanner = {\n green: {\n content: green[8],\n border: green[2],\n background: green[0],\n },\n yellow: {\n content: yellow[8],\n border: yellow[2],\n background: yellow[0],\n },\n red: {\n content: red[8],\n border: red[2],\n background: red[0],\n },\n};\n// ============================================================================\n// ALERT TOKENS\n// ============================================================================\nexport const alert = {\n green: {\n content: green[1],\n background: green[9],\n },\n yellow: {\n content: yellow[1],\n background: yellow[9],\n },\n red: {\n content: red[1],\n background: red[9],\n },\n};\n// ============================================================================\n// TAG TOKENS\n// ============================================================================\nexport const tag = {\n content: slateGrey[10],\n border: slateGrey[4],\n background: slateGrey[3],\n};\n// ============================================================================\n// MENU TOKENS\n// ============================================================================\nexport const menu = {\n backgroundDefault: slateGrey[2],\n backgroundHover: slateGrey[1],\n selected: slateGrey[3],\n};\n// ============================================================================\n// INPUT/DROPDOWN TOKENS\n// ============================================================================\nexport const inputDropdown = {\n background: slateGrey[2],\n icon: slateGrey[10],\n borderDefault: slateGrey[4],\n borderSelected: brand[3],\n textLabel: slateGrey[9],\n textPlaceholder: slateGrey[8],\n textHint: slateGrey[8],\n};\nexport const inputField = {\n backgroundDefault: slateGrey[2],\n backgroundDisabled: slateGrey[0],\n textLabel: slateGrey[9],\n textPlaceholder: slateGrey[8],\n textHint: slateGrey[8],\n textError: red[5],\n iconDefault: slateGrey[9],\n iconPlaceholder: slateGrey[10],\n iconError: red[5],\n borderDefault: slateGrey[4],\n borderSelected: brand[3],\n borderError: red[5],\n};\n// ============================================================================\n// TOGGLE TOKENS\n// ============================================================================\nexport const toggle = {\n handleDefault: base.white,\n handleDisabled: slateGrey[10],\n off: {\n backgroundDefault: slateGrey[4],\n backgroundHover: slateGrey[5],\n backgroundDisabled: slateGrey[4],\n },\n on: {\n backgroundDefault: green[3],\n backgroundHover: green[2],\n backgroundDisabled: slateGrey[4],\n },\n};\n// ============================================================================\n// CHECKBOX TOKENS\n// ============================================================================\nexport const checkbox = {\n off: {\n backgroundDefault: '#00000000',\n backgroundHover: slateGrey[5],\n backgroundDisabled: slateGrey[2],\n border: slateGrey[6],\n },\n on: {\n backgroundDefault: green[0],\n backgroundHover: green[1],\n backgroundDisabled: slateGrey[2],\n border: green[3],\n },\n};\n// ============================================================================\n// AVATAR TOKENS\n// ============================================================================\nexport const avatar = {\n content: slateGrey[10],\n background: slateGrey[4],\n};\n// ============================================================================\n// PROGRESS BAR & SLIDER TOKENS\n// ============================================================================\nexport const progressBarSlider = {\n background: slateGrey[4],\n active: green[3],\n};\n// ============================================================================\n// CARD TOKENS\n// ============================================================================\nexport const card = {\n background: slateGrey[1],\n content: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// SIDEBAR TOKENS\n// ============================================================================\nexport const sidebar = {\n backgroundDefault: slateGrey[1],\n backgroundHover: slateGrey[3],\n backgroundActive: slateGrey[4],\n border: slateGrey[4],\n contentPrimary: slateGrey[10],\n contentSecondary: slateGrey[9],\n contentTertiary: slateGrey[8],\n};\n// ============================================================================\n// MODAL TOKENS\n// ============================================================================\nexport const modal = {\n background: slateGrey[1],\n content: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// TAB TOKENS\n// ============================================================================\nexport const tab = {\n activeBackground: slateGrey[3],\n activeContent: brand[5],\n inactiveContent: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// TABLE TOKENS\n// ============================================================================\nexport const table = {\n header: {\n textDefault: slateGrey[9],\n textHover: slateGrey[8],\n backgroundDefault: slateGrey[1],\n },\n border: slateGrey[4],\n cell: {\n textPrimary: slateGrey[10],\n textSecondary: slateGrey[9],\n backgroundDefault: slateGrey[2],\n backgroundHover: slateGrey[1],\n },\n};\n// ============================================================================\n// BREADCRUMBS TOKENS\n// ============================================================================\nexport const breadcrumbs = {\n textPrimaryDefault: slateGrey[10],\n textPrimaryHover: slateGrey[10],\n textSecondaryDefault: slateGrey[8],\n textSecondaryHover: slateGrey[9],\n iconPrimary: slateGrey[10],\n iconSecondary: slateGrey[8],\n};\n// ============================================================================\n// LOADING INDICATOR TOKENS\n// ============================================================================\nexport const loadingIndicator = {\n background: green[1],\n active: green[5],\n};\n// ============================================================================\n// DATE PICKER TOKENS\n// ============================================================================\nexport const datePicker = {\n textDefault: slateGrey[10],\n textSelected: base.white,\n textDisabled: slateGrey[7],\n backgroundDefault: slateGrey[2],\n backgroundMiddle: slateGrey[3],\n backgroundSelected: brand[3],\n border: slateGrey[4],\n};\n// ============================================================================\n// MISC TOKENS\n// ============================================================================\nexport const scroll = slateGrey[9];\n// ============================================================================\n// EXPORTS\n// ============================================================================\nexport const colors = {\n base,\n brand,\n slateGrey,\n green,\n yellow,\n red,\n blue,\n orange,\n purple,\n pink,\n legacy,\n text,\n background,\n border,\n button,\n badge,\n badgeBanner,\n alert,\n tag,\n menu,\n inputDropdown,\n inputField,\n toggle,\n checkbox,\n avatar,\n progressBarSlider,\n card,\n sidebar,\n modal,\n tab,\n table,\n breadcrumbs,\n loadingIndicator,\n datePicker,\n scroll,\n};\nexport default colors;\n", "/**\n * Syntro Design System - Effect Tokens\n *\n * Non-color effect tokens from the Figma design system:\n * shadows, focus rings, backdrop blurs, and overlays.\n *\n * @see https://www.figma.com/design/U0Ol5vM7FQvgPfIgCAgxgb/Design-System\n */\n// ============================================================================\n// SHADOW SCALE\n// ============================================================================\n/**\n * Figma shadow scale using rgba(16,24,40,...) base.\n * Each step increases vertical offset and blur radius.\n */\nexport const shadows = {\n xs: '0 1px 2px 0 rgba(16,24,40,0.05)',\n sm: '0 1px 3px 0 rgba(16,24,40,0.10), 0 1px 2px -1px rgba(16,24,40,0.10)',\n md: '0 4px 6px -1px rgba(16,24,40,0.10), 0 2px 4px -2px rgba(16,24,40,0.10)',\n lg: '0 10px 15px -3px rgba(16,24,40,0.10), 0 4px 6px -4px rgba(16,24,40,0.10)',\n xl: '0 20px 25px -5px rgba(16,24,40,0.10), 0 8px 10px -6px rgba(16,24,40,0.10)',\n '2xl': '0 25px 50px -12px rgba(16,24,40,0.25)',\n '3xl': '0 35px 60px -15px rgba(16,24,40,0.35)',\n inner: 'inset 0 2px 4px 0 rgba(16,24,40,0.05)',\n none: 'none',\n};\n// ============================================================================\n// FOCUS RINGS\n// ============================================================================\n/**\n * Focus ring shadows \u2014 4px spread + xs shadow for depth.\n * Used via `shadow-focus-primary`, `shadow-focus-neutral`, `shadow-focus-error`.\n *\n * Colors reference design system color tokens:\n * primary \u2192 brand-5 (#dd6d69)\n * neutral \u2192 slateGrey-8 (#87919f)\n * error \u2192 red-5 (#ff5150)\n */\nexport const focusRings = {\n primary: '0 0 0 4px rgba(221,109,105,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n neutral: '0 0 0 4px rgba(135,145,159,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n error: '0 0 0 4px rgba(255,81,80,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n};\n// ============================================================================\n// BACKDROP BLUR\n// ============================================================================\n/**\n * Figma backdrop blur scale.\n */\nexport const backdropBlur = {\n sm: '8px',\n md: '16px',\n lg: '24px',\n xl: '40px',\n};\n// ============================================================================\n// OVERLAY\n// ============================================================================\n/**\n * Modal/dialog overlay backgrounds.\n * solid \u2192 full-screen scrim (opaque)\n * blur \u2192 lighter scrim intended to pair with backdrop-blur\n */\nexport const overlay = {\n solid: 'rgba(0,0,0,0.70)',\n blur: 'rgba(0,0,0,0.25)',\n};\n// ============================================================================\n// PRODUCT GLOW SHADOWS\n// ============================================================================\n/**\n * Product-specific glow shadows not in the Figma shadow scale.\n * Used for validated states, brand highlights, and UI depth cues.\n */\nexport const glowShadows = {\n 'glow-green': '0 0 20px -8px rgba(34,197,94,0.3)',\n 'glow-brand': '0 0 25px rgba(212,72,68,0.25)',\n 'glow-brand-sm': '0 0 0 1px rgba(212,72,68,0.15)',\n 'glow-brand-md': '0 0 0 2px rgba(212,72,68,0.3)',\n 'glow-brand-active': '0 0.375rem 0.875rem -0.625rem rgba(212,72,68,0.8)',\n 'glow-brand-tab': '0 0.5rem 1.25rem -0.75rem rgba(212,72,68,0.7)',\n 'glow-brand-nav': '0 0.625rem 1.875rem -1.125rem rgba(212,72,68,0.9)',\n};\n// ============================================================================\n// ELEVATION SHADOWS\n// ============================================================================\n/**\n * Dark-on-dark elevation shadows for card depth.\n */\nexport const elevationShadows = {\n 'elevation-sm': '0 8px 24px -16px rgba(0,0,0,0.6)',\n 'elevation-md': '0 12px 32px -18px rgba(0,0,0,0.6)',\n 'elevation-lg': '0 18px 48px -24px rgba(0,0,0,0.65)',\n 'elevation-card': '0 0.75rem 2rem -1.25rem rgba(0,0,0,0.7)',\n 'elevation-card-soft': '0 0.75rem 2.375rem -0.75rem rgba(0,0,0,0.4)',\n 'elevation-card-tight': '0 0.625rem 1.625rem -1.125rem rgba(0,0,0,0.6)',\n};\n// ============================================================================\n// ANIMATION TIMING CONSTANTS\n// ============================================================================\n/**\n * Shared animation duration constants for consistent motion across the UI.\n */\nexport const animationDuration = {\n DURATION_SHORT: '150ms',\n DURATION_MEDIUM: '200ms',\n DURATION_LONG: '300ms',\n};\n// ============================================================================\n// DEFAULT EXPORT\n// ============================================================================\nexport const effects = {\n shadows,\n focusRings,\n backdropBlur,\n overlay,\n glowShadows,\n elevationShadows,\n animationDuration,\n};\nexport default effects;\n", "/**\n * Syntro Design System - Tailwind Preset\n *\n * Import and extend this preset in your Tailwind config to use the design system.\n *\n * @example\n * ```typescript\n * import { syntroPreset } from '@syntro/design-system/tailwind-preset';\n *\n * export default {\n * presets: [syntroPreset],\n * content: ['./src/**\\/*.{ts,tsx}'],\n * };\n * ```\n */\nimport { colors } from './tokens/colors';\nimport { backdropBlur, elevationShadows, focusRings, glowShadows, overlay, shadows, } from './tokens/effects';\nexport const syntroPreset = {\n darkMode: ['class'],\n theme: {\n extend: {\n colors: {\n // Base colors\n white: colors.base.white,\n black: colors.base.black,\n // Brand scale\n brand: {\n 0: colors.brand[0],\n 1: colors.brand[1],\n 2: colors.brand[2],\n 3: colors.brand[3],\n 4: colors.brand[4],\n 5: colors.brand[5],\n 6: colors.brand[6],\n 7: colors.brand[7],\n 8: colors.brand[8],\n 9: colors.brand[9],\n DEFAULT: colors.brand[3],\n },\n // Neutral scale (Slate Grey)\n 'slate-grey': {\n 0: colors.slateGrey[0],\n 1: colors.slateGrey[1],\n 2: colors.slateGrey[2],\n 3: colors.slateGrey[3],\n 4: colors.slateGrey[4],\n 5: colors.slateGrey[5],\n 6: colors.slateGrey[6],\n 7: colors.slateGrey[7],\n 8: colors.slateGrey[8],\n 9: colors.slateGrey[9],\n 10: colors.slateGrey[10],\n 11: colors.slateGrey[11],\n 12: colors.slateGrey[12],\n DEFAULT: colors.slateGrey[6],\n },\n // Semantic color scales\n green: {\n 0: colors.green[0],\n 1: colors.green[1],\n 2: colors.green[2],\n 3: colors.green[3],\n 4: colors.green[4],\n 5: colors.green[5],\n 6: colors.green[6],\n 7: colors.green[7],\n 8: colors.green[8],\n 9: colors.green[9],\n DEFAULT: colors.green[4],\n },\n yellow: {\n 0: colors.yellow[0],\n 1: colors.yellow[1],\n 2: colors.yellow[2],\n 3: colors.yellow[3],\n 4: colors.yellow[4],\n 5: colors.yellow[5],\n 6: colors.yellow[6],\n 7: colors.yellow[7],\n 8: colors.yellow[8],\n 9: colors.yellow[9],\n DEFAULT: colors.yellow[4],\n },\n red: {\n 0: colors.red[0],\n 1: colors.red[1],\n 2: colors.red[2],\n 3: colors.red[3],\n 4: colors.red[4],\n 5: colors.red[5],\n 6: colors.red[6],\n 7: colors.red[7],\n 8: colors.red[8],\n 9: colors.red[9],\n DEFAULT: colors.red[4],\n },\n blue: {\n 0: colors.blue[0],\n 1: colors.blue[1],\n 2: colors.blue[2],\n 3: colors.blue[3],\n 4: colors.blue[4],\n 5: colors.blue[5],\n 6: colors.blue[6],\n 7: colors.blue[7],\n 8: colors.blue[8],\n 9: colors.blue[9],\n DEFAULT: colors.blue[4],\n },\n orange: {\n 0: colors.orange[0],\n 1: colors.orange[1],\n 2: colors.orange[2],\n 3: colors.orange[3],\n 4: colors.orange[4],\n 5: colors.orange[5],\n 6: colors.orange[6],\n 7: colors.orange[7],\n 8: colors.orange[8],\n 9: colors.orange[9],\n DEFAULT: colors.orange[3],\n },\n purple: {\n 0: colors.purple[0],\n 1: colors.purple[1],\n 2: colors.purple[2],\n 3: colors.purple[3],\n 4: colors.purple[4],\n 5: colors.purple[5],\n 6: colors.purple[6],\n 7: colors.purple[7],\n 8: colors.purple[8],\n 9: colors.purple[9],\n DEFAULT: colors.purple[4],\n },\n pink: {\n 0: colors.pink[0],\n 1: colors.pink[1],\n 2: colors.pink[2],\n 3: colors.pink[3],\n 4: colors.pink[4],\n 5: colors.pink[5],\n 6: colors.pink[6],\n 7: colors.pink[7],\n 8: colors.pink[8],\n 9: colors.pink[9],\n DEFAULT: colors.pink[4],\n },\n // Semantic tokens\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n text: {\n primary: colors.text.primary,\n secondary: colors.text.secondary,\n tertiary: colors.text.tertiary,\n DEFAULT: colors.text.primary,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n background: {\n primary: colors.background.primary,\n secondary: colors.background.secondary,\n DEFAULT: colors.background.primary,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n border: {\n primary: colors.border.primary,\n secondary: colors.border.secondary,\n DEFAULT: colors.border.primary,\n },\n // Component tokens - Button\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'btn-primary': {\n DEFAULT: colors.button.primary.backgroundDefault,\n hover: colors.button.primary.backgroundHover,\n text: colors.button.primary.text,\n border: colors.button.primary.border,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'btn-neutral': {\n DEFAULT: colors.button.neutral.background,\n text: colors.button.neutral.text,\n 'text-hover': colors.button.neutral.textHover,\n border: colors.button.neutral.border,\n },\n 'btn-link': {\n text: colors.button.link.text,\n hover: colors.button.link.hover,\n },\n 'btn-error': {\n text: colors.button.error.text,\n hover: colors.button.error.hover,\n },\n 'btn-success': {\n text: colors.button.success.text,\n hover: colors.button.success.hover,\n },\n // Component tokens - Card\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n card: {\n bg: colors.card.background,\n content: colors.card.content,\n border: colors.card.border,\n },\n // Component tokens - Modal\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n modal: {\n bg: colors.modal.background,\n content: colors.modal.content,\n border: colors.modal.border,\n },\n // Component tokens - Sidebar\n sidebar: {\n DEFAULT: colors.sidebar.backgroundDefault,\n hover: colors.sidebar.backgroundHover,\n active: colors.sidebar.backgroundActive,\n border: colors.sidebar.border,\n 'content-primary': colors.sidebar.contentPrimary,\n 'content-secondary': colors.sidebar.contentSecondary,\n 'content-tertiary': colors.sidebar.contentTertiary,\n },\n // Component tokens - Tab\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n tab: {\n 'active-bg': colors.tab.activeBackground,\n 'active-content': colors.tab.activeContent,\n 'inactive-content': colors.tab.inactiveContent,\n border: colors.tab.border,\n },\n // Component tokens - Table\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'table-header': {\n text: colors.table.header.textDefault,\n 'text-hover': colors.table.header.textHover,\n bg: colors.table.header.backgroundDefault,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'table-cell': {\n // biome-ignore lint: Tailwind preset defines semantic token names, not usage of shadcn color classes\n 'text-primary': colors.table.cell.textPrimary,\n // biome-ignore lint: Tailwind preset defines semantic token names, not usage of shadcn color classes\n 'text-secondary': colors.table.cell.textSecondary,\n bg: colors.table.cell.backgroundDefault,\n 'bg-hover': colors.table.cell.backgroundHover,\n },\n 'table-border': colors.table.border,\n // Component tokens - Input\n 'input-field': {\n bg: colors.inputField.backgroundDefault,\n 'bg-disabled': colors.inputField.backgroundDisabled,\n 'text-label': colors.inputField.textLabel,\n 'text-placeholder': colors.inputField.textPlaceholder,\n 'text-hint': colors.inputField.textHint,\n 'text-error': colors.inputField.textError,\n border: colors.inputField.borderDefault,\n 'border-selected': colors.inputField.borderSelected,\n 'border-error': colors.inputField.borderError,\n },\n // Component tokens - Badge (9 variants)\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-slate': {\n content: colors.badge.slateGrey.content,\n outline: colors.badge.slateGrey.pillOutline,\n border: colors.badge.slateGrey.borderPrimary,\n bg: colors.badge.slateGrey.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-brand': {\n content: colors.badge.brand.content,\n outline: colors.badge.brand.pillOutline,\n border: colors.badge.brand.borderPrimary,\n bg: colors.badge.brand.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-green': {\n content: colors.badge.green.content,\n outline: colors.badge.green.pillOutline,\n border: colors.badge.green.borderPrimary,\n bg: colors.badge.green.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-yellow': {\n content: colors.badge.yellow.content,\n outline: colors.badge.yellow.pillOutline,\n border: colors.badge.yellow.borderPrimary,\n bg: colors.badge.yellow.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-red': {\n content: colors.badge.red.content,\n outline: colors.badge.red.pillOutline,\n border: colors.badge.red.borderPrimary,\n bg: colors.badge.red.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-blue': {\n content: colors.badge.blue.content,\n outline: colors.badge.blue.pillOutline,\n border: colors.badge.blue.borderPrimary,\n bg: colors.badge.blue.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-purple': {\n content: colors.badge.purple.content,\n outline: colors.badge.purple.pillOutline,\n border: colors.badge.purple.borderPrimary,\n bg: colors.badge.purple.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-orange': {\n content: colors.badge.orange.content,\n outline: colors.badge.orange.pillOutline,\n border: colors.badge.orange.borderPrimary,\n bg: colors.badge.orange.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-pink': {\n content: colors.badge.pink.content,\n outline: colors.badge.pink.pillOutline,\n border: colors.badge.pink.borderPrimary,\n bg: colors.badge.pink.background,\n },\n // Component tokens - Toggle\n toggle: {\n handle: colors.toggle.handleDefault,\n 'handle-disabled': colors.toggle.handleDisabled,\n 'off-bg': colors.toggle.off.backgroundDefault,\n 'off-bg-hover': colors.toggle.off.backgroundHover,\n 'on-bg': colors.toggle.on.backgroundDefault,\n 'on-bg-hover': colors.toggle.on.backgroundHover,\n },\n // Component tokens - Menu\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n menu: {\n DEFAULT: colors.menu.backgroundDefault,\n hover: colors.menu.backgroundHover,\n selected: colors.menu.selected,\n },\n // Component tokens - Alert\n 'alert-green': {\n content: colors.alert.green.content,\n bg: colors.alert.green.background,\n },\n 'alert-yellow': {\n content: colors.alert.yellow.content,\n bg: colors.alert.yellow.background,\n },\n 'alert-red': {\n content: colors.alert.red.content,\n bg: colors.alert.red.background,\n },\n },\n // Typography\n fontSize: {\n xs: ['0.75rem', { lineHeight: '1rem' }],\n sm: ['0.875rem', { lineHeight: '1.25rem' }],\n base: ['1rem', { lineHeight: '1.5rem' }],\n lg: ['1.125rem', { lineHeight: '1.75rem' }],\n xl: ['1.25rem', { lineHeight: '1.75rem' }],\n '2xl': ['1.5rem', { lineHeight: '2rem' }],\n '3xl': ['1.875rem', { lineHeight: '2.25rem' }],\n '4xl': ['2.25rem', { lineHeight: '2.5rem' }],\n '5xl': ['3rem', { lineHeight: '1' }],\n '6xl': ['3.75rem', { lineHeight: '1' }],\n },\n // Spacing\n spacing: {\n 0: '0',\n 1: '0.25rem',\n 2: '0.5rem',\n 3: '0.75rem',\n 4: '1rem',\n 5: '1.25rem',\n 6: '1.5rem',\n 8: '2rem',\n 10: '2.5rem',\n 12: '3rem',\n 16: '4rem',\n 20: '5rem',\n 24: '6rem',\n 32: '8rem',\n },\n // Border radius\n borderRadius: {\n none: '0',\n sm: '0.125rem',\n DEFAULT: '0.25rem',\n md: '0.375rem',\n lg: '0.5rem',\n xl: '0.75rem',\n '2xl': '1rem',\n '3xl': '1.5rem',\n full: '9999px',\n },\n // Box shadow \u2014 Figma shadow scale + product glows + elevation\n boxShadow: {\n ...shadows,\n ...glowShadows,\n ...elevationShadows,\n DEFAULT: shadows.sm,\n // Focus rings (4px spread + xs shadow)\n 'focus-primary': focusRings.primary,\n 'focus-neutral': focusRings.neutral,\n 'focus-error': focusRings.error,\n },\n // Backdrop blur \u2014 Figma scale\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n backdropBlur: {\n sm: backdropBlur.sm,\n md: backdropBlur.md,\n lg: backdropBlur.lg,\n xl: backdropBlur.xl,\n },\n // Overlay background colors\n backgroundColor: {\n 'overlay-solid': overlay.solid,\n 'overlay-blur': overlay.blur,\n },\n // Animation\n keyframes: {\n 'fade-in': {\n '0%': { opacity: '0' },\n '100%': { opacity: '1' },\n },\n 'fade-out': {\n '0%': { opacity: '1' },\n '100%': { opacity: '0' },\n },\n 'slide-in-from-top': {\n '0%': { transform: 'translateY(-100%)' },\n '100%': { transform: 'translateY(0)' },\n },\n 'slide-in-from-bottom': {\n '0%': { transform: 'translateY(100%)' },\n '100%': { transform: 'translateY(0)' },\n },\n 'slide-in-from-left': {\n '0%': { transform: 'translateX(-100%)' },\n '100%': { transform: 'translateX(0)' },\n },\n 'slide-in-from-right': {\n '0%': { transform: 'translateX(100%)' },\n '100%': { transform: 'translateX(0)' },\n },\n },\n animation: {\n 'fade-in': 'fade-in 0.2s ease-out',\n 'fade-out': 'fade-out 0.2s ease-out',\n 'slide-in-from-top': 'slide-in-from-top 0.3s ease-out',\n 'slide-in-from-bottom': 'slide-in-from-bottom 0.3s ease-out',\n 'slide-in-from-left': 'slide-in-from-left 0.3s ease-out',\n 'slide-in-from-right': 'slide-in-from-right 0.3s ease-out',\n },\n },\n },\n};\nexport default syntroPreset;\n", "/**\n * Syntro Design System \u2014 Editor Panel Shell Tokens\n *\n * Single source of truth for the floating editor panel's visuals and behavior.\n * Consumed by:\n * - packages/shared-editor-ui/src/components/EditorPanelShell.tsx (React)\n * - packages/shared-editor-ui/src/controllers/PanelShellController.ts (Lit)\n *\n * Any change here updates both React and Lit panels in one step \u2014 no drift.\n */\nimport { base, brand } from './colors';\n// ============================================================================\n// Panel background & shadows\n// ============================================================================\n/** Dark gradient rendered behind the panel contents (backdrop-blur layered on). */\nexport const panelBackground = 'linear-gradient(160deg, rgba(7,8,10,0.84) 0%, rgba(14,17,20,0.88) 45%, rgba(15,19,24,0.84) 100%)';\n/** Outer shadows for the panel, indexed by dock state. */\nexport const panelShadows = {\n /** Free-floating panel \u2014 shadow all sides. */\n floating: '0 8px 60px rgba(0,0,0,0.5)',\n /** Docked to left \u2014 shadow cast rightward into page. */\n dockedLeft: '20px 0 60px rgba(0,0,0,0.5)',\n /** Docked to right \u2014 shadow cast leftward into page. */\n dockedRight: '-20px 0 60px rgba(0,0,0,0.5)',\n};\n/** Backdrop-filter blur radius applied to the panel surface. */\nexport const panelBackdropBlur = '12px';\n// ============================================================================\n// FAB (floating action button) visuals\n// ============================================================================\nexport const fab = {\n /** Diameter in pixels. */\n size: 56,\n /** Inset from the panel's top-left corner in pixels. */\n inset: 12,\n /** Background color (always the brand black). */\n background: base.black,\n /** Icon / logo color. */\n color: base.white,\n /** Border \u2014 2px brand red ring. */\n border: `2px solid ${brand[3]}`,\n /** Shadow when the panel is open (inner ring for \"active\" state). */\n shadowOpen: '0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)',\n /** Shadow when the panel is closed. */\n shadowClosed: '0 4px 24px rgba(0,0,0,0.6)',\n};\n// ============================================================================\n// Behavior: resize, drag, snap\n// ============================================================================\nexport const panelBehavior = {\n /** Minimum panel width when resizing or undocked. */\n minWidth: 480,\n /** Minimum panel height when resizing or undocked. */\n minHeight: 400,\n /** Edge thickness of resize handles in pixels. */\n handleSize: 8,\n /** Pixels the FAB must move before a press becomes a drag (vs a click). */\n dragThreshold: 5,\n /** Distance from a viewport edge that triggers edge-dock snapping. */\n snapThreshold: 20,\n};\n// ============================================================================\n// Aggregate export\n// ============================================================================\nexport const panelShell = {\n background: panelBackground,\n shadows: panelShadows,\n backdropBlur: panelBackdropBlur,\n fab,\n behavior: panelBehavior,\n};\nexport default panelShell;\n", "import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\n/**\n * EditorPanelShell \u2014 moveable, resizable wrapper for editor sidebars.\n *\n * Renders:\n * 1. A fixed FAB button (Syntrologie logo) at the panel's bottom-left corner.\n * Click toggles open/minimized. Drag moves the entire panel.\n * 2. A resizable panel container with semi-transparent background and backdrop blur.\n * Supports docked (left/right edge, full height) and free-floating modes.\n * Position, size, and dock state persist in localStorage.\n */\nimport { panelShell } from '@syntro/design-system';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { cn } from '../cn';\n// =============================================================================\n// Constants\n// =============================================================================\nconst STORAGE_KEY = 'syntro:editor-panel';\nconst MIN_WIDTH = panelShell.behavior.minWidth;\nconst MIN_HEIGHT = panelShell.behavior.minHeight;\nconst FAB_SIZE = panelShell.fab.size;\nconst FAB_INSET = panelShell.fab.inset;\nconst SNAP_THRESHOLD = panelShell.behavior.snapThreshold;\nconst DRAG_THRESHOLD = panelShell.behavior.dragThreshold;\nconst HANDLE_SIZE = panelShell.behavior.handleSize;\n// =============================================================================\n// Logo\n// =============================================================================\n/** Syntrologie logo mark \u2014 inline SVG to avoid CSP issues. */\nfunction SyntroLogo() {\n return (_jsxs(\"svg\", { \"aria-hidden\": \"true\", width: \"28\", height: \"18\", viewBox: \"0 0 101 63\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", children: [_jsx(\"g\", { clipPath: \"url(#syntro-fab-clip)\", children: _jsx(\"path\", { d: \"M51.989 0.284C52.386 0.29 52.808 0.341 53.192 0.443C53.769 0.596 54.362 0.983 54.745 1.442C55.895 2.822 56.767 4.782 57.669 6.357C59.947 10.334 62.152 14.372 64.498 18.307C64.671 18.597 65.127 19.343 65.475 19.411C66.654 19.641 79.278 11.523 81.123 10.317C80.704 8.6 80.624 7.21 81.334 5.525C82.014 3.916 83.317 2.651 84.946 2.019C86.593 1.366 88.286 1.42 89.902 2.123C91.486 2.795 92.733 4.076 93.363 5.677C95.111 10.218 91.347 15.013 86.561 14.442C85.392 14.302 84.649 13.927 83.6 13.441C76.542 18.247 69.094 22.597 61.207 25.907C60.153 26.349 59.42 26.6 58.519 27.328C60.583 27.43 87.034 24.236 87.878 23.781C87.926 23.755 88.048 23.697 88.08 23.652C88.244 23.421 88.277 23.007 88.376 22.735C88.819 21.511 89.563 20.379 90.604 19.586C91.887 18.608 93.6 18.093 95.208 18.324C96.992 18.581 98.67 19.55 99.74 21.005C100.733 22.364 101.141 24.064 100.875 25.726C100.607 27.394 99.692 28.888 98.329 29.887C96.02 31.573 92.641 31.613 90.392 29.789C89.579 29.13 89.177 28.535 88.566 27.692C86.692 28.103 83.447 28.463 81.472 28.73C76.577 29.399 71.671 29.99 66.756 30.504C65.752 30.608 59.279 31.013 58.779 31.24L58.781 31.387C59.106 31.577 66.974 33.025 68.328 33.358C72.475 34.405 76.572 35.64 80.606 37.06C82.709 37.818 84.721 38.686 86.814 39.457C88.505 38.051 89.243 36.875 91.925 36.841C93.665 36.833 95.339 37.506 96.589 38.717C97.986 40.087 98.415 41.541 98.429 43.422C98.417 44.842 98.099 45.978 97.229 47.137C96.168 48.531 94.597 49.447 92.86 49.682C91.161 49.922 89.437 49.472 88.073 48.431C86.201 47.02 85.795 45.462 85.488 43.323C85.255 43.193 85.018 43.071 84.776 42.958C83.907 42.553 78.511 40.359 77.911 40.577C77.837 41.147 78.926 42.592 79.243 43.155L84.336 52.073C85.165 53.529 86.027 54.991 86.789 56.483C87.253 57.391 87.414 58.355 87.056 59.343C86.557 60.722 85.014 61.408 83.626 61.438C81.429 61.427 79.228 61.427 77.029 61.427L62.967 61.427L35.549 61.435C33.337 61.436 20.693 61.626 19.579 61.199C18.758 60.889 18.093 60.265 17.732 59.465C17.455 58.844 17.335 57.994 17.577 57.361C18.242 55.623 19.5 53.659 20.438 52.043L28.119 39.028C28.9 37.701 31.213 33.891 31.7 32.634C25.671 32.936 18.736 32.547 12.6 32.721C11.75 34.138 10.992 35.281 9.368 35.935C7.744 36.588 5.704 36.604 4.097 35.922C2.546 35.272 1.319 34.028 0.69 32.468C0.053 30.839 0.086 29.025 0.781 27.42C2.812 22.739 9.259 22.202 12.05 26.464C12.555 27.235 12.774 27.84 13.104 28.703L26.462 28.711C28.926 28.713 31.729 28.779 34.17 28.668C35.279 26.892 36.442 24.733 37.515 22.901L45.376 9.375C46.797 6.902 48.214 4.368 49.685 1.924C50.222 1.032 50.962 0.493 51.989 0.284ZM22.119 57.31C23.512 57.503 26.045 57.431 27.526 57.429L36.661 57.42L68.412 57.422C73.113 57.421 77.994 57.351 82.68 57.438L75.664 45.098C74.562 43.171 73.093 40.773 72.104 38.827C71.245 38.351 70.291 38.109 69.335 37.848C59.189 35.076 48.669 33.421 38.172 32.796C37.642 32.764 36.994 32.766 36.469 32.794L25.855 50.865C24.634 52.935 23.364 55.302 22.119 57.31ZM52.216 5.513C49.384 10.611 46.473 15.665 43.484 20.673C42.193 22.878 40.862 25.071 39.63 27.31C39.46 27.618 39.36 27.782 39.453 28.133C40.522 28.342 45.866 26.973 47.112 26.644C49.169 26.137 60.135 22.684 61.174 21.436C61.248 21.163 61.287 21.069 61.125 20.762C60.279 19.163 59.326 17.527 58.435 15.958L53.592 7.329C53.355 6.915 52.677 5.599 52.216 5.513ZM96.18 26.494C96.963 25.713 97.12 24.502 96.563 23.547C96.005 22.592 94.872 22.133 93.807 22.432C92.972 22.666 92.324 23.327 92.108 24.167C91.892 25.007 92.14 25.899 92.758 26.507C93.396 27.134 94.327 27.361 95.182 27.096C95.558 26.98 95.901 26.773 96.18 26.494ZM87.871 10.399C89.147 10.087 89.941 8.813 89.659 7.529C89.377 6.246 88.122 5.422 86.832 5.673C85.97 5.841 85.266 6.463 84.994 7.298C84.722 8.133 84.923 9.05 85.52 9.694C86.118 10.339 87.017 10.608 87.871 10.399ZM91.505 40.879C90.185 41.122 89.31 42.388 89.55 43.709C89.791 45.03 91.055 45.907 92.377 45.669C93.22 45.517 93.921 44.933 94.223 44.131C94.525 43.329 94.383 42.428 93.85 41.758C93.29 41.055 92.389 40.717 91.505 40.879ZM9.138 29.557C9.005 28.88 8.592 28.292 8.001 27.937C7.409 27.583 6.696 27.495 6.036 27.697C5.665 27.81 5.326 28.011 5.048 28.282C4.24 29.07 4.079 30.31 4.66 31.278C5.241 32.247 6.411 32.688 7.487 32.346C8.666 31.97 9.376 30.771 9.138 29.557Z\", fill: \"currentColor\" }) }), _jsx(\"defs\", { children: _jsx(\"clipPath\", { id: \"syntro-fab-clip\", children: _jsx(\"rect\", { width: \"101\", height: \"63\", fill: \"white\" }) }) })] }));\n}\n// =============================================================================\n// Geometry Helpers\n// =============================================================================\nfunction getDefaultGeometry() {\n return {\n x: 0,\n y: 0,\n width: MIN_WIDTH,\n height: typeof window !== 'undefined' ? window.innerHeight : 800,\n docked: 'left',\n };\n}\nfunction loadGeometry(storageKey) {\n if (typeof window === 'undefined')\n return getDefaultGeometry();\n try {\n const raw = localStorage.getItem(storageKey);\n if (raw) {\n const parsed = JSON.parse(raw);\n return {\n x: typeof parsed.x === 'number' ? parsed.x : 0,\n y: typeof parsed.y === 'number' ? parsed.y : 0,\n width: Math.max(MIN_WIDTH, typeof parsed.width === 'number' ? parsed.width : MIN_WIDTH),\n height: Math.max(MIN_HEIGHT, typeof parsed.height === 'number' ? parsed.height : window.innerHeight),\n docked: parsed.docked === 'left' || parsed.docked === 'right' ? parsed.docked : null,\n };\n }\n }\n catch {\n /* ignore corrupt localStorage */\n }\n return getDefaultGeometry();\n}\nfunction saveGeometry(storageKey, geo) {\n try {\n localStorage.setItem(storageKey, JSON.stringify(geo));\n }\n catch {\n /* ignore full localStorage */\n }\n}\n/** Compute the panel's actual pixel rect (resolving docked positions). */\nfunction getPanelRect(geo) {\n if (geo.docked === 'left') {\n return { top: 0, left: 0, width: geo.width, height: window.innerHeight };\n }\n if (geo.docked === 'right') {\n return {\n top: 0,\n left: window.innerWidth - geo.width,\n width: geo.width,\n height: window.innerHeight,\n };\n }\n const { x: left, y: top, width, height } = geo;\n return { top, left, width, height };\n}\n/** Compute FAB position from panel geometry (top-left of panel). */\nfunction getFabPosition(geo) {\n const rect = getPanelRect(geo);\n return {\n left: rect.left + FAB_INSET,\n top: rect.top + FAB_INSET,\n };\n}\n/** Clamp geometry so the FAB (top-left) remains visible. */\nfunction clampToViewport(geo) {\n if (geo.docked)\n return geo;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n return {\n ...geo,\n x: Math.max(-(geo.width - FAB_SIZE), Math.min(geo.x, vw - FAB_SIZE)),\n y: Math.max(-FAB_INSET, Math.min(geo.y, vh - FAB_SIZE - FAB_INSET)),\n };\n}\n/** Convert docked geometry to undocked pixel coordinates. */\nfunction undockGeometry(geo) {\n const rect = getPanelRect(geo);\n return {\n x: rect.left,\n y: rect.top,\n width: geo.width,\n height: rect.height,\n docked: null,\n };\n}\n// =============================================================================\n// Resize Handle Definitions\n// =============================================================================\nconst RESIZE_HANDLES = [\n {\n dir: 'n',\n style: { top: 0, left: HANDLE_SIZE, right: HANDLE_SIZE, height: HANDLE_SIZE },\n cursor: 'ns-resize',\n },\n {\n dir: 's',\n style: { bottom: 0, left: HANDLE_SIZE, right: HANDLE_SIZE, height: HANDLE_SIZE },\n cursor: 'ns-resize',\n },\n {\n dir: 'e',\n style: { right: 0, top: HANDLE_SIZE, bottom: HANDLE_SIZE, width: HANDLE_SIZE },\n cursor: 'ew-resize',\n },\n {\n dir: 'w',\n style: { left: 0, top: HANDLE_SIZE, bottom: HANDLE_SIZE, width: HANDLE_SIZE },\n cursor: 'ew-resize',\n },\n {\n dir: 'ne',\n style: { top: 0, right: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nesw-resize',\n },\n {\n dir: 'nw',\n style: { top: 0, left: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nwse-resize',\n },\n {\n dir: 'se',\n style: { bottom: 0, right: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nwse-resize',\n },\n {\n dir: 'sw',\n style: { bottom: 0, left: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nesw-resize',\n },\n];\n// =============================================================================\n// Component\n// =============================================================================\nexport function EditorPanelShell({ isOpen, onToggle, panelId, zIndex = 2147483647, children, }) {\n const storageKey = panelId ? `syntro:editor-panel:${panelId}` : STORAGE_KEY;\n const [geometry, setGeometry] = useState(() => loadGeometry(storageKey));\n const geoRef = useRef(geometry);\n geoRef.current = geometry;\n const panelRef = useRef(null);\n const fabRef = useRef(null);\n // Drag state (refs for performance \u2014 no re-renders during drag)\n const isDragging = useRef(false);\n const hasMoved = useRef(false);\n const dragOffset = useRef({ x: 0, y: 0 });\n const startPanelPos = useRef({ x: 0, y: 0 });\n const pendingGeo = useRef(null);\n // Resize state\n const activeResize = useRef(null);\n const resizeStartMouse = useRef({ x: 0, y: 0 });\n const resizeStartGeo = useRef(getDefaultGeometry());\n // Persist geometry on change\n useEffect(() => {\n saveGeometry(storageKey, geometry);\n }, [storageKey, geometry]);\n // Viewport clamping on window resize\n useEffect(() => {\n const handler = () => setGeometry((prev) => clampToViewport(prev));\n window.addEventListener('resize', handler);\n return () => window.removeEventListener('resize', handler);\n }, []);\n // ---- FAB DRAG HANDLERS ----\n const handleFabPointerDown = useCallback((e) => {\n isDragging.current = true;\n hasMoved.current = false;\n const rect = getPanelRect(geoRef.current);\n startPanelPos.current = { x: rect.left, y: rect.top };\n dragOffset.current = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top,\n };\n e.target.setPointerCapture(e.pointerId);\n e.preventDefault();\n }, []);\n const handleFabPointerMove = useCallback((e) => {\n if (!isDragging.current)\n return;\n const newX = e.clientX - dragOffset.current.x;\n const newY = e.clientY - dragOffset.current.y;\n if (!hasMoved.current) {\n const dx = Math.abs(newX - startPanelPos.current.x);\n const dy = Math.abs(newY - startPanelPos.current.y);\n if (dx < DRAG_THRESHOLD && dy < DRAG_THRESHOLD)\n return;\n hasMoved.current = true;\n }\n const geo = geoRef.current;\n const height = geo.docked ? window.innerHeight : geo.height;\n // Update panel DOM directly for performance (bypass React re-render)\n if (panelRef.current) {\n panelRef.current.style.left = `${newX}px`;\n panelRef.current.style.top = `${newY}px`;\n panelRef.current.style.right = 'auto';\n panelRef.current.style.height = `${height}px`;\n }\n if (fabRef.current) {\n fabRef.current.style.left = `${newX + FAB_INSET}px`;\n fabRef.current.style.top = `${newY + FAB_INSET}px`;\n }\n pendingGeo.current = { x: newX, y: newY, width: geo.width, height, docked: null };\n }, []);\n const handleFabPointerUp = useCallback((e) => {\n e.target.releasePointerCapture(e.pointerId);\n const wasDragging = hasMoved.current;\n isDragging.current = false;\n hasMoved.current = false;\n if (!wasDragging) {\n onToggle();\n return;\n }\n if (pendingGeo.current) {\n const geo = pendingGeo.current;\n // Edge snapping\n if (geo.x <= SNAP_THRESHOLD) {\n setGeometry({ ...geo, docked: 'left', x: 0, y: 0 });\n }\n else if (geo.x + geo.width >= window.innerWidth - SNAP_THRESHOLD) {\n setGeometry({ ...geo, docked: 'right', x: 0, y: 0 });\n }\n else {\n setGeometry(geo);\n }\n pendingGeo.current = null;\n }\n }, [onToggle]);\n // ---- RESIZE HANDLERS ----\n const handleResizePointerDown = useCallback((e) => {\n const dir = e.currentTarget.dataset.resizeDir;\n if (!dir)\n return;\n let geo = geoRef.current;\n // Undock if currently docked\n if (geo.docked) {\n geo = undockGeometry(geo);\n geoRef.current = geo;\n setGeometry(geo);\n }\n activeResize.current = dir;\n resizeStartMouse.current = { x: e.clientX, y: e.clientY };\n resizeStartGeo.current = { ...geo };\n e.target.setPointerCapture(e.pointerId);\n e.preventDefault();\n }, []);\n const handleResizePointerMove = useCallback((e) => {\n if (!activeResize.current)\n return;\n const dx = e.clientX - resizeStartMouse.current.x;\n const dy = e.clientY - resizeStartMouse.current.y;\n const dir = activeResize.current;\n const start = resizeStartGeo.current;\n let { x, y, width, height } = start;\n if (dir.includes('e'))\n width = Math.max(MIN_WIDTH, start.width + dx);\n if (dir.includes('w')) {\n const newW = Math.max(MIN_WIDTH, start.width - dx);\n x = start.x + start.width - newW;\n width = newW;\n }\n if (dir.includes('s'))\n height = Math.max(MIN_HEIGHT, start.height + dy);\n if (dir.includes('n')) {\n const newH = Math.max(MIN_HEIGHT, start.height - dy);\n y = start.y + start.height - newH;\n height = newH;\n }\n // Update DOM directly for performance\n if (panelRef.current) {\n panelRef.current.style.left = `${x}px`;\n panelRef.current.style.top = `${y}px`;\n panelRef.current.style.width = `${width}px`;\n panelRef.current.style.height = `${height}px`;\n }\n if (fabRef.current) {\n fabRef.current.style.left = `${x + FAB_INSET}px`;\n fabRef.current.style.top = `${y + FAB_INSET}px`;\n }\n pendingGeo.current = { x, y, width, height, docked: null };\n }, []);\n const handleResizePointerUp = useCallback((e) => {\n e.target.releasePointerCapture(e.pointerId);\n activeResize.current = null;\n if (pendingGeo.current) {\n setGeometry(pendingGeo.current);\n pendingGeo.current = null;\n }\n }, []);\n // ---- COMPUTED STYLES ----\n const isDocked = geometry.docked !== null;\n const fabPos = getFabPosition(geometry);\n const panelStyle = {\n position: 'fixed',\n zIndex,\n background: panelShell.background,\n backdropFilter: `blur(${panelShell.backdropBlur})`,\n WebkitBackdropFilter: `blur(${panelShell.backdropBlur})`,\n boxShadow: isDocked\n ? geometry.docked === 'right'\n ? panelShell.shadows.dockedRight\n : panelShell.shadows.dockedLeft\n : panelShell.shadows.floating,\n // Prevent wheel scroll from chaining to the page behind the panel.\n // overflow-y: auto makes this a scroll container so overscroll-behavior applies.\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n };\n if (geometry.docked === 'left') {\n panelStyle.top = 0;\n panelStyle.left = 0;\n panelStyle.width = geometry.width;\n panelStyle.height = '100vh';\n }\n else if (geometry.docked === 'right') {\n panelStyle.top = 0;\n panelStyle.right = 0;\n panelStyle.width = geometry.width;\n panelStyle.height = '100vh';\n }\n else {\n panelStyle.top = geometry.y;\n panelStyle.left = geometry.x;\n panelStyle.width = geometry.width;\n panelStyle.height = geometry.height;\n }\n const fabStyle = {\n position: 'fixed',\n left: fabPos.left,\n top: fabPos.top,\n zIndex,\n width: FAB_SIZE,\n height: FAB_SIZE,\n borderRadius: '50%',\n border: panelShell.fab.border,\n cursor: 'grab',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: panelShell.fab.background,\n color: panelShell.fab.color,\n boxShadow: isOpen ? panelShell.fab.shadowOpen : panelShell.fab.shadowClosed,\n transition: 'box-shadow 150ms ease',\n touchAction: 'none',\n userSelect: 'none',\n WebkitUserSelect: 'none',\n };\n return (_jsxs(_Fragment, { children: [isOpen && (_jsxs(\"div\", { ref: panelRef, ...(panelId ? { id: panelId } : {}), \"data-syntro-editor-panel\": true, \"data-syntro-editor-ui\": \"panel\", className: cn('syntro-editor-scope se-fixed se-flex se-flex-col se-text-text-primary se-backdrop-blur-xl se-font-sans se-antialiased se-overflow-hidden', isDocked\n ? geometry.docked === 'right'\n ? 'se-border-l se-border-border-primary'\n : 'se-border-r se-border-border-primary'\n : 'se-rounded-lg se-border se-border-border-primary'), style: panelStyle, children: [RESIZE_HANDLES.map(({ dir, style, cursor }) => (_jsx(\"div\", { \"data-syntro-editor-ui\": `resize-${dir}`, \"data-resize-dir\": dir, onPointerDown: handleResizePointerDown, onPointerMove: handleResizePointerMove, onPointerUp: handleResizePointerUp, style: {\n position: 'absolute',\n ...style,\n cursor,\n zIndex: 1,\n touchAction: 'none',\n } }, dir))), children] })), _jsx(\"div\", { className: \"syntro-editor-scope\", \"data-syntro-editor-ui\": \"fab-wrapper\", style: { display: 'contents' }, children: _jsx(\"button\", { ref: fabRef, type: \"button\", \"data-syntro-fab\": true, \"data-syntro-editor-ui\": \"fab\", onPointerDown: handleFabPointerDown, onPointerMove: handleFabPointerMove, onPointerUp: handleFabPointerUp, style: fabStyle, title: isOpen ? 'Minimize panel' : 'Open panel', children: _jsx(SyntroLogo, {}) }) })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EmptyState({ message }) {\n return (_jsx(\"div\", { className: \"se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm\", children: message }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function GroupHeader({ label, count, className }) {\n return (_jsxs(\"div\", { className: cn('se-text-xs se-font-bold se-text-text-primary se-uppercase se-tracking-wide se-py-1 se-pb-2 se-flex se-items-center se-justify-between', className), children: [_jsx(\"span\", { children: label }), _jsx(\"span\", { className: \"se-text-xs se-text-text-secondary se-bg-badge-slate-bg se-px-1.5 se-py-0.5 se-rounded-lg\", children: count })] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * TriggerJourney \u2014 compact horizontal node graph for triggerWhen conditions.\n *\n * Displays each condition as a small circle node connected by lines.\n * Nodes light up green as conditions are met.\n */\nimport { Check } from 'lucide-react';\nimport { cn } from '../cn';\n/* ------------------------------------------------------------------ */\n/* Internal: small progress bar for event_count nodes */\n/* ------------------------------------------------------------------ */\nfunction ProgressBar({ current, target }) {\n const pct = Math.min(100, Math.round((current / Math.max(target, 1)) * 100));\n return (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-0.5\", children: [_jsx(\"span\", { className: \"se-inline-block se-w-8 se-h-1 se-rounded-full se-bg-white/20\", title: `${current}/${target} (${pct}%)`, children: _jsx(\"span\", { className: cn('se-block se-h-full se-rounded-full se-transition-all', pct >= 100 ? 'se-bg-green-4' : 'se-bg-blue-4'), style: { width: `${pct}%` } }) }), _jsxs(\"span\", { className: \"se-text-[11px] se-font-medium se-text-text-secondary\", children: [current, \"/\", target] })] }));\n}\n/* ------------------------------------------------------------------ */\n/* Internal: single journey node with label + optional connection */\n/* ------------------------------------------------------------------ */\nfunction JourneyNode({ cs, isLast }) {\n const hasProgress = !!cs.formatted.progress;\n const inProgress = !cs.passed && hasProgress && cs.formatted.progress.current > 0;\n return (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-0\", children: [_jsxs(\"div\", { className: \"se-flex se-flex-col se-items-center se-min-w-0\", children: [_jsx(\"div\", { \"data-journey-node\": true, \"data-passed\": cs.passed ? 'true' : 'false', className: cn('se-w-4 se-h-4 se-rounded-full se-border-2 se-flex se-items-center se-justify-center se-shrink-0', cs.passed\n ? 'se-bg-green-4 se-border-green-4'\n : inProgress\n ? 'se-bg-blue-4 se-border-blue-4'\n : 'se-bg-transparent se-border-white/30'), children: cs.passed && _jsx(Check, { className: \"se-w-2.5 se-h-2.5 se-text-white\" }) }), _jsx(\"span\", { className: \"se-text-[11px] se-font-medium se-text-text-secondary se-truncate se-max-w-[60px] se-text-center se-mt-0.5\", title: cs.formatted.instruction, children: cs.formatted.shortLabel }), hasProgress && (_jsx(ProgressBar, { current: cs.formatted.progress.current, target: cs.formatted.progress.target }))] }), !isLast && (_jsx(\"div\", { \"data-journey-line\": true, className: cn('se-h-0.5 se-w-4 se-self-start se-mt-2 se-shrink-0', cs.passed ? 'se-bg-green-4' : 'se-bg-white/20') }))] }));\n}\n/* ------------------------------------------------------------------ */\n/* Main component */\n/* ------------------------------------------------------------------ */\nexport function TriggerJourney({ status }) {\n if (!status || status.conditions.length === 0) {\n return (_jsx(\"div\", { className: \"se-mt-1 se-text-[12px] se-font-medium se-text-text-secondary se-italic\", children: \"Always Present\" }));\n }\n const { conditions } = status;\n const allPassed = conditions.every((c) => c.passed);\n const isMulti = conditions.length > 1;\n return (_jsxs(\"div\", { className: \"se-mt-1\", children: [_jsx(\"div\", { className: \"se-flex se-items-start\", children: conditions.map((cs, i) => (_jsx(JourneyNode, { cs: cs, isLast: i === conditions.length - 1 }, i))) }), allPassed && isMulti && (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-1 se-mt-1 se-text-[12px] se-text-green-4\", children: [_jsx(Check, { className: \"se-w-3 se-h-3\" }), _jsx(\"span\", { children: \"All conditions met\" })] }))] }));\n}\n", "/**\n * PanelShellController \u2014 Lit ReactiveController for draggable/resizable panels.\n *\n * Owns geometry state (position, size, dock), pointer-event handlers for the\n * drag FAB and 8 resize handles, localStorage persistence, and viewport\n * clamping. A consuming LitElement calls `attachFab(el)` / `attachHandle(el, dir)`\n * on its rendered DOM to hook up pointer events, and reads `panelStyles` /\n * `fabStyles` to position the panel + FAB.\n *\n * Why a controller, not a wrapper element: `<slot>`-based wrapper elements\n * don't compose well in light DOM (Lit wipes children on render), and shadow\n * DOM breaks Playwright child selectors used by E2E tests. A ReactiveController\n * is the Lit-idiomatic way to share stateful logic across elements.\n *\n * Emits one callback: `onToggle` when the FAB is pressed without dragging.\n */\nimport { panelShell } from '@syntro/design-system';\n// =============================================================================\n// Constants\n// =============================================================================\nconst DEFAULTS = {\n minWidth: panelShell.behavior.minWidth,\n minHeight: panelShell.behavior.minHeight,\n dragThreshold: panelShell.behavior.dragThreshold,\n snapThreshold: panelShell.behavior.snapThreshold,\n fabSize: panelShell.fab.size,\n fabInset: panelShell.fab.inset,\n storageKey: 'syntro:editor-panel',\n};\nconst HANDLE_SIZE = panelShell.behavior.handleSize;\n// =============================================================================\n// Helpers\n// =============================================================================\nexport function makeResizeHandles() {\n return [\n {\n dir: 'n',\n style: {\n top: '0',\n left: `${HANDLE_SIZE}px`,\n right: `${HANDLE_SIZE}px`,\n height: `${HANDLE_SIZE}px`,\n },\n cursor: 'ns-resize',\n },\n {\n dir: 's',\n style: {\n bottom: '0',\n left: `${HANDLE_SIZE}px`,\n right: `${HANDLE_SIZE}px`,\n height: `${HANDLE_SIZE}px`,\n },\n cursor: 'ns-resize',\n },\n {\n dir: 'e',\n style: {\n right: '0',\n top: `${HANDLE_SIZE}px`,\n bottom: `${HANDLE_SIZE}px`,\n width: `${HANDLE_SIZE}px`,\n },\n cursor: 'ew-resize',\n },\n {\n dir: 'w',\n style: {\n left: '0',\n top: `${HANDLE_SIZE}px`,\n bottom: `${HANDLE_SIZE}px`,\n width: `${HANDLE_SIZE}px`,\n },\n cursor: 'ew-resize',\n },\n {\n dir: 'ne',\n style: {\n top: '0',\n right: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nesw-resize',\n },\n {\n dir: 'nw',\n style: {\n top: '0',\n left: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nwse-resize',\n },\n {\n dir: 'se',\n style: {\n bottom: '0',\n right: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nwse-resize',\n },\n {\n dir: 'sw',\n style: {\n bottom: '0',\n left: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nesw-resize',\n },\n ];\n}\n// =============================================================================\n// Controller\n// =============================================================================\nexport class PanelShellController {\n constructor(host, options = {}) {\n this._panelEl = null;\n this._fabEl = null;\n // Drag state\n this._isDragging = false;\n this._hasMoved = false;\n this._dragOffset = { x: 0, y: 0 };\n this._startPanelPos = { x: 0, y: 0 };\n this._pendingGeo = null;\n // Resize state\n this._activeResize = null;\n this._resizeStartMouse = { x: 0, y: 0 };\n // ---- FAB pointer handlers ----\n this.handleFabPointerDown = (e) => {\n this._isDragging = true;\n this._hasMoved = false;\n const rect = this.rect;\n this._startPanelPos = { x: rect.left, y: rect.top };\n this._dragOffset = { x: e.clientX - rect.left, y: e.clientY - rect.top };\n try {\n e.target.setPointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n e.preventDefault();\n };\n this.handleFabPointerMove = (e) => {\n if (!this._isDragging)\n return;\n const newX = e.clientX - this._dragOffset.x;\n const newY = e.clientY - this._dragOffset.y;\n if (!this._hasMoved) {\n const dx = Math.abs(newX - this._startPanelPos.x);\n const dy = Math.abs(newY - this._startPanelPos.y);\n if (dx < this.opts.dragThreshold && dy < this.opts.dragThreshold)\n return;\n this._hasMoved = true;\n }\n const geo = this._geometry;\n const height = geo.docked ? window.innerHeight : geo.height;\n this._writeStylesDuringGesture({ x: newX, y: newY, width: geo.width, height });\n this._pendingGeo = { x: newX, y: newY, width: geo.width, height, docked: null };\n };\n this.handleFabPointerUp = (e) => {\n try {\n e.target.releasePointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n const wasDragging = this._hasMoved;\n this._isDragging = false;\n this._hasMoved = false;\n if (!wasDragging) {\n this.opts.onToggle?.();\n return;\n }\n if (this._pendingGeo) {\n const geo = this._pendingGeo;\n if (geo.x <= this.opts.snapThreshold) {\n this._commit({ ...geo, docked: 'left', x: 0, y: 0 });\n }\n else if (geo.x + geo.width >= window.innerWidth - this.opts.snapThreshold) {\n this._commit({ ...geo, docked: 'right', x: 0, y: 0 });\n }\n else {\n this._commit(geo);\n }\n this._pendingGeo = null;\n }\n };\n // ---- Resize pointer handlers ----\n this.handleResizePointerDown = (dir, e) => {\n let geo = this._geometry;\n if (geo.docked) {\n geo = this._undockGeometry(geo);\n this._commit(geo);\n }\n this._activeResize = dir;\n this._resizeStartMouse = { x: e.clientX, y: e.clientY };\n this._resizeStartGeo = { ...geo };\n try {\n e.target.setPointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n e.preventDefault();\n };\n this.handleResizePointerMove = (e) => {\n if (!this._activeResize)\n return;\n const dx = e.clientX - this._resizeStartMouse.x;\n const dy = e.clientY - this._resizeStartMouse.y;\n const dir = this._activeResize;\n const start = this._resizeStartGeo;\n let { x, y, width, height } = start;\n if (dir.includes('e'))\n width = Math.max(this.opts.minWidth, start.width + dx);\n if (dir.includes('w')) {\n const newW = Math.max(this.opts.minWidth, start.width - dx);\n x = start.x + start.width - newW;\n width = newW;\n }\n if (dir.includes('s'))\n height = Math.max(this.opts.minHeight, start.height + dy);\n if (dir.includes('n')) {\n const newH = Math.max(this.opts.minHeight, start.height - dy);\n y = start.y + start.height - newH;\n height = newH;\n }\n this._writeStylesDuringGesture({ x, y, width, height });\n this._pendingGeo = { x, y, width, height, docked: null };\n };\n this.handleResizePointerUp = (e) => {\n try {\n e.target.releasePointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n this._activeResize = null;\n if (this._pendingGeo) {\n this._commit(this._pendingGeo);\n this._pendingGeo = null;\n }\n };\n this._onWindowResize = () => {\n this._commit(this._clampToViewport(this._geometry));\n };\n this.host = host;\n this.opts = {\n storageKey: options.storageKey ?? DEFAULTS.storageKey,\n minWidth: options.minWidth ?? DEFAULTS.minWidth,\n minHeight: options.minHeight ?? DEFAULTS.minHeight,\n dragThreshold: options.dragThreshold ?? DEFAULTS.dragThreshold,\n snapThreshold: options.snapThreshold ?? DEFAULTS.snapThreshold,\n fabSize: options.fabSize ?? DEFAULTS.fabSize,\n fabInset: options.fabInset ?? DEFAULTS.fabInset,\n onToggle: options.onToggle,\n defaultGeometry: this._resolveDefaultGeometry(options.defaultGeometry),\n };\n this._geometry = this.opts.defaultGeometry;\n this._resizeStartGeo = this._geometry;\n host.addController(this);\n }\n // ---- Public API ----\n /** Current geometry (read-only snapshot). */\n get geometry() {\n return this._geometry;\n }\n /** Pixel rect of the panel, resolving docked positions. */\n get rect() {\n return this._panelRect(this._geometry);\n }\n /** Pixel right edge of the panel (useful for positioning adjacent UI). */\n get rightEdge() {\n const r = this.rect;\n return r.left + r.width;\n }\n /** Set geometry directly \u2014 useful for testing or external state sync. */\n setGeometry(geo) {\n this._geometry = geo;\n this._saveGeometry(geo);\n this.host.requestUpdate();\n }\n /** Reset geometry to default (and clear persisted state). */\n reset() {\n this._geometry = this.opts.defaultGeometry;\n try {\n localStorage.removeItem(this.opts.storageKey);\n }\n catch {\n // ignore\n }\n this.host.requestUpdate();\n }\n /** Styles to apply to the panel element. */\n panelStyles() {\n const geo = this._geometry;\n const blur = `blur(${panelShell.backdropBlur})`;\n const shadow = geo.docked === 'right'\n ? panelShell.shadows.dockedRight\n : geo.docked === 'left'\n ? panelShell.shadows.dockedLeft\n : panelShell.shadows.floating;\n const styles = {\n position: 'fixed',\n pointerEvents: 'auto',\n background: panelShell.background,\n backdropFilter: blur,\n webkitBackdropFilter: blur,\n boxShadow: shadow,\n overflow: 'hidden',\n };\n if (geo.docked === 'left') {\n styles.top = '0';\n styles.left = '0';\n styles.width = `${geo.width}px`;\n styles.height = '100vh';\n }\n else if (geo.docked === 'right') {\n styles.top = '0';\n styles.right = '0';\n styles.width = `${geo.width}px`;\n styles.height = '100vh';\n }\n else {\n styles.top = `${geo.y}px`;\n styles.left = `${geo.x}px`;\n styles.width = `${geo.width}px`;\n styles.height = `${geo.height}px`;\n }\n return styles;\n }\n /** Styles to apply to the FAB button. `isOpen` adjusts the shadow. */\n fabStyles(isOpen) {\n const rect = this.rect;\n return {\n position: 'fixed',\n left: `${rect.left + this.opts.fabInset}px`,\n top: `${rect.top + rect.height - this.opts.fabSize - this.opts.fabInset}px`,\n pointerEvents: 'auto',\n width: `${this.opts.fabSize}px`,\n height: `${this.opts.fabSize}px`,\n borderRadius: '50%',\n border: panelShell.fab.border,\n cursor: 'grab',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: panelShell.fab.background,\n color: panelShell.fab.color,\n boxShadow: isOpen ? panelShell.fab.shadowOpen : panelShell.fab.shadowClosed,\n transition: 'box-shadow 150ms ease',\n touchAction: 'none',\n userSelect: 'none',\n webkitUserSelect: 'none',\n };\n }\n /** Direction descriptors for the 8 resize handles. */\n get handles() {\n return makeResizeHandles();\n }\n /** Bind the current panel element so the controller can direct-write styles during drag/resize. */\n attachPanel(el) {\n this._panelEl = el;\n }\n /** Bind the current FAB element. */\n attachFab(el) {\n this._fabEl = el;\n }\n // ---- ReactiveController lifecycle ----\n hostConnected() {\n this._geometry = this._loadGeometry();\n this.host.requestUpdate();\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', this._onWindowResize);\n }\n }\n hostDisconnected() {\n if (typeof window !== 'undefined') {\n window.removeEventListener('resize', this._onWindowResize);\n }\n }\n // ---- Internals ----\n _commit(geo) {\n this._geometry = geo;\n this._saveGeometry(geo);\n this.host.requestUpdate();\n }\n _writeStylesDuringGesture({ x, y, width, height, }) {\n if (this._panelEl) {\n this._panelEl.style.left = `${x}px`;\n this._panelEl.style.top = `${y}px`;\n this._panelEl.style.right = 'auto';\n this._panelEl.style.width = `${width}px`;\n this._panelEl.style.height = `${height}px`;\n }\n if (this._fabEl) {\n this._fabEl.style.left = `${x + this.opts.fabInset}px`;\n this._fabEl.style.top = `${y + height - this.opts.fabSize - this.opts.fabInset}px`;\n }\n }\n _clampToViewport(geo) {\n if (geo.docked)\n return geo;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n // FAB sits at panel's bottom-left: fabTop = geo.y + geo.height - fabSize - fabInset.\n // Keep fabTop in [0, vh - fabSize] so the FAB stays on-screen even if the panel\n // extends above the viewport top or below the viewport bottom.\n const minY = this.opts.fabSize + this.opts.fabInset - geo.height;\n const maxY = vh - geo.height + this.opts.fabInset;\n return {\n ...geo,\n x: Math.max(-(geo.width - this.opts.fabSize), Math.min(geo.x, vw - this.opts.fabSize)),\n y: Math.max(minY, Math.min(geo.y, maxY)),\n };\n }\n _undockGeometry(geo) {\n const r = this._panelRect(geo);\n return { x: r.left, y: r.top, width: geo.width, height: r.height, docked: null };\n }\n _panelRect(geo) {\n if (geo.docked === 'left') {\n return { top: 0, left: 0, width: geo.width, height: window.innerHeight };\n }\n if (geo.docked === 'right') {\n return {\n top: 0,\n left: window.innerWidth - geo.width,\n width: geo.width,\n height: window.innerHeight,\n };\n }\n const { x: left, y: top, width, height } = geo;\n return { top, left, width, height };\n }\n _loadGeometry() {\n if (typeof window === 'undefined')\n return this.opts.defaultGeometry;\n try {\n const raw = localStorage.getItem(this.opts.storageKey);\n if (!raw)\n return this.opts.defaultGeometry;\n const p = JSON.parse(raw);\n return {\n x: typeof p.x === 'number' ? p.x : 0,\n y: typeof p.y === 'number' ? p.y : 0,\n width: Math.max(this.opts.minWidth, typeof p.width === 'number' ? p.width : this.opts.minWidth),\n height: Math.max(this.opts.minHeight, typeof p.height === 'number' ? p.height : window.innerHeight),\n docked: p.docked === 'left' || p.docked === 'right' ? p.docked : null,\n };\n }\n catch {\n return this.opts.defaultGeometry;\n }\n }\n _saveGeometry(geo) {\n try {\n localStorage.setItem(this.opts.storageKey, JSON.stringify(geo));\n }\n catch {\n // ignore\n }\n }\n _resolveDefaultGeometry(partial) {\n const w = typeof window !== 'undefined' ? window : null;\n const base = {\n x: 0,\n y: 0,\n width: DEFAULTS.minWidth,\n height: w ? w.innerHeight : 800,\n docked: 'right',\n };\n return { ...base, ...(partial ?? {}) };\n }\n}\n", "/**\n * Format a triggerWhen condition into a human-readable label.\n * Pure function \u2014 no runtime dependency.\n */\n/**\n * Format match criteria as a parenthetical string.\n * { tagName: 'a' } \u2192 '(tagName: a)'\n */\nfunction _formatMatch(match) {\n if (!match || Object.keys(match).length === 0)\n return '';\n const parts = Object.entries(match).map(([k, v]) => `${k}: ${v}`);\n return ` (${parts.join(', ')})`;\n}\n/**\n * Format an operator for display.\n */\nfunction formatOperator(op) {\n switch (op) {\n case 'gte':\n return '\\u2265'; // \u2265\n case 'lte':\n return '\\u2264'; // \u2264\n case 'gt':\n return '>';\n case 'lt':\n return '<';\n case 'eq':\n return '=';\n default:\n return op;\n }\n}\n/**\n * Convert a hyphenated or underscored key into human-readable lowercase text.\n * e.g. \"fine-arts-page-views\" \u2192 \"fine arts page views\"\n */\nfunction humanizeKey(key) {\n return key.replace(/[-_]/g, ' ').toLowerCase();\n}\n/**\n * Strip trailing wildcard segments from a URL path.\n * e.g. \"/fine-arts/**\" \u2192 \"/fine-arts/\"\n */\nfunction cleanUrl(url) {\n return url.replace(/\\/?\\*+$/, '/').replace(/\\/\\/$/, '/');\n}\n// Pre-compiled regexes for event_count classification\nconst PAGE_VIEW_RE = /page.?view/i;\nconst CLICK_RE = /click/i;\n/**\n * Convert a Condition object into a human-readable label.\n * For event_count conditions, also returns progress data.\n */\nexport function formatConditionLabel(condition, accumulatorCount) {\n switch (condition.type) {\n case 'event_count': {\n const key = condition.key;\n const op = condition.operator;\n const target = condition.count;\n const current = accumulatorCount ?? 0;\n const humanized = humanizeKey(key);\n let instruction;\n let shortLabel;\n if (PAGE_VIEW_RE.test(humanized)) {\n // Extract the topic by removing \"page view(s)\" from the humanized key\n const topic = humanized.replace(/\\s*page\\s*views?\\s*/i, '').trim();\n instruction = topic\n ? `View ${topic} pages ${target}+ times`\n : `View pages ${target}+ times`;\n shortLabel = `View ${target}+ times`;\n }\n else if (CLICK_RE.test(humanized)) {\n const topic = humanized.replace(/\\s*clicks?\\s*/i, '').trim();\n instruction = topic ? `Click ${topic} ${target}+ times` : `Click ${target}+ times`;\n shortLabel = `${target}+ clicks`;\n }\n else {\n // Generic event\n const lastWord = humanized\n .trim()\n .split(' ')\n .filter((w) => w)\n .pop() || 'events';\n instruction = `Reach ${target}+ ${humanized} events`;\n shortLabel = `${target}+ ${lastWord}s`;\n }\n return {\n label: `${key} ${formatOperator(op)} ${target}`,\n instruction,\n shortLabel,\n progress: { current, target, operator: op },\n };\n }\n case 'page_url': {\n const url = condition.url;\n const cleaned = cleanUrl(url);\n const hasWildcard = url !== cleaned;\n const instruction = hasWildcard ? `Visit a ${cleaned} page` : `Visit ${cleaned}`;\n return {\n label: `${url}`,\n instruction,\n shortLabel: cleaned,\n };\n }\n case 'anchor_visible': {\n const rawAnchor = condition.anchorId;\n const anchorId = typeof rawAnchor === 'string'\n ? rawAnchor\n : (rawAnchor?.selector ?? '');\n const state = condition.state;\n return {\n label: `${anchorId} (${state})`,\n instruction: `Scroll until ${anchorId} is ${state}`,\n shortLabel: `${anchorId}`,\n };\n }\n case 'event_occurred': {\n const eventName = condition.eventName;\n return {\n label: `${eventName}`,\n instruction: `Trigger a ${eventName} event`,\n shortLabel: `${eventName}`,\n };\n }\n case 'state_equals': {\n const key = condition.key;\n const val = condition.value === undefined ? 'undefined' : JSON.stringify(condition.value);\n return {\n label: `${key} = ${val}`,\n instruction: `${key} equals ${val}`,\n shortLabel: `${key}`,\n };\n }\n case 'viewport': {\n const parts = [];\n if (condition.minWidth !== undefined)\n parts.push(`w ${formatOperator('gte')} ${condition.minWidth}px`);\n if (condition.maxWidth !== undefined)\n parts.push(`w ${formatOperator('lte')} ${condition.maxWidth}px`);\n if (condition.minHeight !== undefined)\n parts.push(`h ${formatOperator('gte')} ${condition.minHeight}px`);\n if (condition.maxHeight !== undefined)\n parts.push(`h ${formatOperator('lte')} ${condition.maxHeight}px`);\n const label = parts.join(', ') || 'any viewport';\n const instruction = parts.length > 0 ? `Use a viewport ${parts.join(' and ')}` : 'Use a viewport of any size';\n const shortLabel = parts.length > 0 ? parts[0] : 'Any size';\n return { label, instruction, shortLabel };\n }\n case 'session_metric': {\n const key = condition.key;\n const op = condition.operator;\n const threshold = condition.threshold;\n return {\n label: `${key} ${formatOperator(op)} ${threshold}`,\n instruction: `${key} reaches ${threshold}+`,\n shortLabel: `${key} ${threshold}+`,\n };\n }\n case 'dismissed': {\n const inverted = condition.inverted;\n const key = condition.key;\n const target = key || 'this';\n return {\n label: inverted ? 'not dismissed' : 'dismissed',\n instruction: inverted ? `Do not dismiss ${target}` : `Dismiss ${target}`,\n shortLabel: inverted ? 'Not dismissed' : 'Dismissed',\n };\n }\n case 'cooldown_active': {\n const inverted = condition.inverted;\n return {\n label: inverted ? 'cooldown inactive' : 'cooldown active',\n instruction: inverted ? 'Wait for cooldown to expire' : 'Cooldown is active',\n shortLabel: inverted ? 'Cooldown done' : 'Cooldown active',\n };\n }\n case 'frequency_limit': {\n const inverted = condition.inverted;\n const limit = condition.limit;\n return {\n label: `shown ${formatOperator(inverted ? 'lt' : 'gte')} ${limit} times`,\n instruction: inverted ? `Shown fewer than ${limit} times` : `Shown ${limit}+ times`,\n shortLabel: inverted ? `< ${limit} views` : `${limit}+ views`,\n };\n }\n case 'route': {\n const routeId = condition.routeId;\n return {\n label: `${routeId}`,\n instruction: `Navigate to ${routeId} route`,\n shortLabel: `${routeId}`,\n };\n }\n default:\n return {\n label: `${condition.type}`,\n instruction: `${condition.type}`,\n shortLabel: `${condition.type}`,\n };\n }\n}\n", "/**\n * useTriggerWhenStatus \u2014 live triggerWhen evaluation for editor diagnostics.\n *\n * Delegates condition evaluation to the runtime's evaluateSync() method,\n * eliminating duplicated logic. Subscribes to the EventAccumulator for\n * reactive updates.\n *\n * NOTE: This hook accesses `window.SynOS.handle.runtime` directly\n * because EditorPanelProps doesn't expose runtime. This is safe \u2014\n * the editor only runs after runtime bootstrap.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { formatConditionLabel } from '../formatConditionLabel';\n/**\n * Build a RuntimeLike from the real SynOS.handle.runtime.\n */\nfunction getRuntime() {\n const rt = window.SynOS?.handle?.runtime;\n if (!rt?.evaluateSync)\n return null;\n return {\n evaluateSync: rt.evaluateSync.bind(rt),\n accumulator: rt.accumulator,\n };\n}\n/**\n * Evaluate all conditions in a triggerWhen RuleStrategy via the runtime engine.\n */\nfunction evaluateTriggerWhen(triggerWhen, runtime) {\n if (triggerWhen.type !== 'rules' || !triggerWhen.rules?.length) {\n return { visible: !!triggerWhen.default, isFallback: true, conditions: [] };\n }\n const result = runtime.evaluateSync(triggerWhen);\n const conditions = (result.matchInfo?.evaluatedConditions ?? []).map(({ condition, result: passed }) => {\n // Get live accumulator count for event_count progress display\n const accCount = condition.type === 'event_count' && runtime.accumulator\n ? runtime.accumulator.getCount(condition.key, condition.withinMs)\n : undefined;\n const formatted = formatConditionLabel(condition, accCount);\n return { type: condition.type, passed, formatted };\n });\n return { visible: result.value, isFallback: result.isFallback, conditions };\n}\n/**\n * Hook: live triggerWhen evaluation for a list of action items.\n *\n * @param items Array of items with id + optional triggerWhen\n * @returns Map from item id \u2192 TriggerWhenStatus (null for items without triggerWhen)\n */\nexport function useTriggerWhenStatus(items) {\n const [statuses, setStatuses] = useState(new Map());\n const itemsRef = useRef(items);\n itemsRef.current = items;\n const evaluate = useCallback(() => {\n const runtime = getRuntime();\n if (!runtime)\n return;\n const map = new Map();\n for (const item of itemsRef.current) {\n if (!item.triggerWhen) {\n map.set(item.id, null);\n }\n else {\n map.set(item.id, evaluateTriggerWhen(item.triggerWhen, runtime));\n }\n }\n setStatuses(map);\n }, []);\n useEffect(() => {\n // Initial evaluation\n evaluate();\n // Subscribe to accumulator changes for reactive event_count updates\n const runtime = getRuntime();\n const unsubs = [];\n if (runtime?.accumulator) {\n unsubs.push(runtime.accumulator.subscribe(evaluate));\n }\n // Poll every 2s for non-accumulator conditions (page_url, viewport, etc.)\n const interval = setInterval(evaluate, 2000);\n return () => {\n unsubs.forEach((u) => u());\n clearInterval(interval);\n };\n }, [evaluate]);\n return statuses;\n}\n", "{\n \"field_mapping\": {\n \"event\": {\n \"action_step_key\": \"event\",\n \"hogql\": \"event\",\n \"athena\": \"event_category\",\n \"athena_transform\": \"category_map\",\n \"runtime_event_field\": \"name\",\n \"runtime_transform\": \"event_name_map\"\n },\n \"text\": {\n \"action_step_key\": \"text\",\n \"hogql\": \"properties.$el_text\",\n \"athena\": \"el_text\",\n \"runtime_element_field\": \"$el_text\"\n },\n \"tag_name\": {\n \"action_step_key\": \"tag_name\",\n \"hogql\": \"properties.$el_tag_name\",\n \"athena\": \"tag_name\",\n \"runtime_element_field\": \"tag_name\"\n },\n \"url\": {\n \"action_step_key\": \"url\",\n \"hogql\": \"properties.$current_url\",\n \"hogql_match\": \"like\",\n \"athena\": \"pathname\",\n \"athena_match\": \"like\",\n \"athena_transform\": \"url_to_path\",\n \"runtime_prop\": \"url\"\n },\n \"selector\": {\n \"action_step_key\": \"selector\",\n \"hogql\": \"properties.$el_selector\",\n \"athena\": null,\n \"runtime_element_field\": null\n }\n },\n \"event_category_map\": {\n \"$autocapture\": \"click\",\n \"$pageview\": \"pageview\",\n \"$pageleave\": \"pageleave\",\n \"$feature_flag_called\": \"feature_flag\"\n },\n \"event_name_map\": {\n \"$autocapture\": \"ui.click\",\n \"$pageview\": \"nav.page_view\",\n \"$pageleave\": \"nav.page_leave\"\n },\n \"interactive_tags\": [\"a\", \"button\", \"input\", \"select\", \"textarea\", \"form\", \"summary\"],\n \"interactive_roles\": [\n \"button\",\n \"link\",\n \"menuitem\",\n \"tab\",\n \"switch\",\n \"checkbox\",\n \"radio\",\n \"option\"\n ],\n \"test_cases\": [\n {\n \"name\": \"CTA button click \u2014 span inside anchor\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Start Free Filing\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Start Free Filing\",\n \"$elements\": [\n { \"tag_name\": \"span\", \"$el_text\": \"Start Free Filing\" },\n {\n \"tag_name\": \"a\",\n \"$el_text\": \"Start Free Filing \u2192\",\n \"attr__href\": \"/dashboard\",\n \"attr__data-cta\": \"hero-primary\"\n },\n { \"tag_name\": \"div\", \"$el_text\": \"\" },\n { \"tag_name\": \"section\", \"$el_text\": \"\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 1,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Start Free Filing \u2192\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"Pageview from link href\",\n \"action_step\": {\n \"event\": \"$pageview\",\n \"url\": \"/pricing\"\n },\n \"posthog_event\": {\n \"event\": \"$pageview\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/pricing\",\n \"$elements\": [\n { \"tag_name\": \"a\", \"$el_text\": \"See Plans & Pricing\", \"attr__href\": \"/pricing\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$pageview\",\n \"tag_name\": \"a\",\n \"text\": \"See Plans & Pricing\",\n \"url\": \"https://taxinator.com/pricing\"\n }\n },\n {\n \"name\": \"Non-matching \u2014 wrong tag and text\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"button\",\n \"text\": \"Submit\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Cancel\",\n \"$elements\": [\n { \"tag_name\": \"span\", \"$el_text\": \"Cancel\" },\n { \"tag_name\": \"a\", \"$el_text\": \"Cancel\", \"attr__href\": \"/home\" }\n ]\n }\n },\n \"should_match_hogql\": false,\n \"should_match_athena\": false,\n \"recommended_index\": 1,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Cancel\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"Selector only \u2014 matches HogQL but not Athena\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"selector\": \"#signup-btn\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_selector\": \"#signup-btn\",\n \"$elements\": [{ \"tag_name\": \"button\", \"$el_text\": \"Sign Up\" }]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": false,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"button\",\n \"text\": \"Sign Up\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"No interactive ancestor \u2014 falls back to elements[0]\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"div\",\n \"text\": \"Hero Banner\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Hero Banner\",\n \"$elements\": [\n { \"tag_name\": \"div\", \"$el_text\": \"Hero Banner\" },\n { \"tag_name\": \"section\", \"$el_text\": \"\" },\n { \"tag_name\": \"main\", \"$el_text\": \"\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"div\",\n \"text\": \"Hero Banner\",\n \"url\": \"https://taxinator.com/\"\n }\n }\n ]\n}\n", "/**\n * Element Chain Recommender\n *\n * Given PostHog's $elements array, recommends which element the user\n * most likely intended to track for a KPI, and builds a PostHog action\n * step from that element.\n *\n * The interactive_tags and interactive_roles are loaded from the shared\n * field mapping fixture so the recommendation heuristic stays in sync\n * with the warehouse and runtime predicate matching.\n */\n// Loaded from the shared fixture at build time.\n// The fixture is the single source of truth \u2014 do NOT hardcode these lists.\nimport fieldMapping from '../../../../tests/fixtures/action-step-field-mapping.json';\nconst INTERACTIVE_TAGS = new Set(fieldMapping.interactive_tags);\nconst INTERACTIVE_ROLES = new Set(fieldMapping.interactive_roles);\n/**\n * Find the index of the recommended element in the $elements chain.\n * Returns the first interactive element, or 0 if none found.\n */\nexport function findRecommendedIndex(elements) {\n if (elements.length === 0)\n return 0;\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n if (INTERACTIVE_TAGS.has(el.tag_name))\n return i;\n const role = (el.attr__role ?? el.role);\n if (role && INTERACTIVE_ROLES.has(role))\n return i;\n }\n return 0;\n}\n/**\n * Build a PostHog action step from a selected element in the chain.\n * Does NOT include `selector` \u2014 it's not supported in Athena.\n *\n * The `url` field stores the PATHNAME of the page where the user clicked,\n * not the full URL. This matches how the backend generates SQL:\n * step.url \u2192 `pathname LIKE '%<url>%'`\n * Storing the full URL (including the editor token / query string) makes\n * the stored KPI data ugly, leaks editor tokens into saved configs, and\n * forces the backend to re-parse on every query. Strip at the boundary.\n */\nfunction pageUrlToPathname(pageUrl) {\n try {\n const u = new URL(pageUrl);\n return u.pathname || pageUrl;\n }\n catch {\n return pageUrl;\n }\n}\nexport function buildActionStepFromElement(element, pageUrl, options = {}) {\n const { inferPageview = false } = options;\n const href = element.attr__href;\n const isInternalLink = element.tag_name === 'a' && href && !href.startsWith('http') && !href.startsWith('//');\n const step = {\n event: inferPageview && isInternalLink ? '$pageview' : '$autocapture',\n tag_name: element.tag_name,\n url: pageUrlToPathname(pageUrl),\n };\n const text = (element.$el_text || '').trim();\n if (text) {\n step.text = text.slice(0, 100); // Truncate long text\n }\n return step;\n}\n", "/**\n * Human-readable summary generation for Nav items.\n * Pure functions \u2014 no DOM access, just string formatting.\n */\n\nimport type { DecisionStrategy, NavTipAction, RuleStrategy } from './types';\n\nconst MAX_TITLE_LEN = 30;\n\nfunction truncate(text: string, max: number): string {\n if (text.length <= max) return text;\n return `${text.slice(0, max).trimEnd()}...`;\n}\n\nfunction isRuleStrategy(s: unknown): s is RuleStrategy<boolean> {\n return (\n typeof s === 'object' &&\n s !== null &&\n (s as Record<string, unknown>).type === 'rules' &&\n Array.isArray((s as Record<string, unknown>).rules)\n );\n}\n\n/**\n * Parse a triggerWhen strategy into a human-readable trigger description.\n */\nexport function describeTrigger(triggerWhen?: DecisionStrategy<boolean> | null): string {\n if (!triggerWhen) return 'All pages';\n if (!isRuleStrategy(triggerWhen)) return 'All pages';\n\n const pages: string[] = [];\n const anchors: string[] = [];\n\n for (const rule of triggerWhen.rules) {\n for (const condition of rule.conditions) {\n if (condition.type === 'page_url' && typeof (condition as any).url === 'string') {\n pages.push((condition as any).url);\n }\n if (condition.type === 'anchor_visible' && typeof (condition as any).anchorId === 'string') {\n anchors.push((condition as any).anchorId);\n }\n }\n }\n\n const parts: string[] = [];\n if (pages.length > 0) parts.push(pages[0]);\n if (anchors.length > 0) parts.push(anchors[0]);\n\n return parts.length > 0 ? parts.join(' \\u00b7 ') : 'All pages';\n}\n\n/**\n * Generate a one-liner summary for a Nav tip.\n */\nexport function summarizeNavItem(item: NavTipAction): string {\n const icon = item.config.icon || '\\u{1F9ED}';\n const title = truncate(item.config.title, MAX_TITLE_LEN);\n return `${icon} ${title}`;\n}\n", "/**\n * Adaptive Nav - Types\n *\n * Type definitions for the navigation tips accordion adaptive.\n * Demonstrates compositional action pattern with per-item triggerWhen.\n */\n\n// ============================================================================\n// Decision Strategy Types (from runtime-sdk)\n// ============================================================================\n\n/**\n * Simplified DecisionStrategy type for this package.\n * Full definition is in @syntrologie/runtime-sdk.\n */\nexport type DecisionStrategy<T = unknown> =\n | RuleStrategy<T>\n | ScoreStrategy<T>\n | ModelStrategy<T>\n | ExternalStrategy<T>;\n\nexport interface RuleStrategy<T = unknown> {\n type: 'rules';\n rules: Array<{\n conditions: Array<Record<string, unknown>>;\n value: T;\n }>;\n default: T;\n}\n\nexport interface ScoreStrategy<T = unknown> {\n type: 'score';\n field: string;\n threshold: number;\n above: T;\n below: T;\n}\n\nexport interface ModelStrategy<T = unknown> {\n type: 'model';\n modelId: string;\n inputs: string[];\n outputMapping: Record<string, T>;\n default: T;\n}\n\nexport interface ExternalStrategy<T = unknown> {\n type: 'external';\n endpoint: string;\n method?: 'GET' | 'POST';\n default: T;\n timeoutMs?: number;\n}\n\n// ============================================================================\n// Event Scope Types (from sdk-contracts)\n// ============================================================================\n\n// ============================================================================\n// Nav Tip Action Types\n// ============================================================================\n\n/**\n * Single navigation tip configuration.\n * This is a \"compositional action\" \u2014 rendered as an accordion item by the parent.\n */\nexport interface NavTipAction {\n /** Action kind identifier */\n kind: 'nav:tip';\n /** Tip configuration */\n config: {\n /** Unique identifier for this tip */\n id: string;\n /** Accordion header text */\n title: string;\n /** Expanded body text */\n description: string;\n /**\n * Target anchor: route = where to go, selector = what to highlight/focus.\n * - Same page + valid selector \u2192 scroll + pulse + focus\n * - Same page + no selector/\"*\" \u2192 no-op (already there)\n * - Different page \u2192 navigate via pushState + popstate\n */\n anchor?: AnchorId;\n /** @deprecated Use anchor instead. Falls back to { route: href, selector: \"*\" } */\n href?: string;\n /** Optional icon (emoji or icon key) */\n icon?: string;\n /** Whether the link opens in a new tab */\n external?: boolean;\n /** Category for grouping */\n category?: string;\n };\n /** Optional per-item activation strategy */\n triggerWhen?: DecisionStrategy<boolean> | null;\n /** Toast config when triggerWhen transitions false \u2192 true. Required when triggerWhen is set (use null to opt out). */\n notify?: { title?: string; body?: string; icon?: string } | null;\n /** AI-generated reasoning for why this tip was recommended */\n rationale?: {\n why: string;\n confidence?: number;\n };\n}\n\n/** @deprecated Use NavTipAction instead */\nexport type NavLinkAction = NavTipAction;\n\n// ============================================================================\n// Nav Widget Configuration\n// ============================================================================\n\n/**\n * Expand behavior for the accordion.\n */\nexport type NavExpandBehavior = 'single' | 'multiple';\n\n/**\n * Theme for the navigation widget.\n */\nexport type NavTheme = 'light' | 'dark' | 'auto';\n\n/**\n * Full configuration for the adaptive-nav widget.\n */\nexport interface NavConfig {\n /** Expand behavior */\n expandBehavior: NavExpandBehavior;\n /** Color theme */\n theme: NavTheme;\n /** Navigation tips (compositional actions) */\n actions: NavTipAction[];\n}\n\n// ============================================================================\n// Widget Props Types\n// ============================================================================\n\n/**\n * Runtime services passed to the widget.\n */\nexport interface NavWidgetRuntime {\n /** Synchronously evaluate a decision strategy */\n evaluateSync: <T>(strategy: DecisionStrategy<T>) => { value: T; isFallback: boolean };\n /** Context manager for subscribing to changes */\n context: {\n subscribe: (callback: () => void) => () => void;\n };\n /** Event bus for publishing interactions */\n events: {\n publish: (name: string, props?: Record<string, unknown>) => void;\n };\n /** Event accumulator for event_count-based triggerWhen */\n accumulator?: {\n subscribe: (callback: () => void) => () => void;\n register: (key: string, predicate: (event: any) => boolean) => void;\n };\n}\n\n/**\n * Props passed to the NavWidget component.\n */\nexport interface NavWidgetProps {\n /** Widget configuration */\n config: NavConfig;\n /** Runtime services */\n runtime: NavWidgetRuntime;\n /** Instance ID for telemetry */\n instanceId: string;\n}\n\n// ============================================================================\n// Navigation Action Types (merged from adaptive-navigation)\n// ============================================================================\n\nimport type { AnchorId } from '@syntrologie/sdk-contracts';\n\ninterface BaseAction {\n label?: string;\n}\n\nexport interface ScrollToAction extends BaseAction {\n kind: 'navigation:scrollTo';\n anchorId: AnchorId;\n behavior?: ScrollBehavior;\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\nexport interface NavigateAction extends BaseAction {\n kind: 'navigation:navigate';\n url: string;\n target?: '_self' | '_blank';\n /** When true, always use full page navigation (window.location.href) even for same-origin URLs. */\n forceFullNavigation?: boolean;\n}\n\n// ============================================================================\n// Action Namespace\n// ============================================================================\n\nexport const ACTION_NAMESPACES = ['nav', 'navigation'] as const;\n\n/**\n * Returns true if the action belongs to this adaptive package.\n * Uses prefix matching so new kinds (e.g. nav:dropdown) are automatically included.\n * Covers both `nav:*` (compositional) and `navigation:*` (executor) prefixes.\n */\nexport function isOwnAction(action: { kind: string }): boolean {\n return ACTION_NAMESPACES.some((ns) => action.kind.startsWith(`${ns}:`));\n}\n\n// ============================================================================\n// Executor Types (from shared contracts)\n// ============================================================================\n\nexport type {\n ActionExecutor,\n ExecutorCleanup,\n ExecutorContext,\n ExecutorResult,\n ExecutorUpdate,\n} from '@syntrologie/sdk-contracts';\n\n// ============================================================================\n// Editor Types (from sdk-contracts)\n// ============================================================================\n\nexport type { EditorPanelProps } from '@syntrologie/sdk-contracts';\n", "/**\n * Adaptive Nav - Editor Component\n *\n * Review & tweak editor for AI-generated navigation tip decisions.\n * Displays a scannable list of tip cards with trigger, rationale,\n * and inline editing. Includes detection badges and hover-to-highlight.\n */\n\nimport {\n DetectionBadge,\n DismissedSection,\n EditorBody,\n EditorCard,\n EditorHeader,\n EditorInput,\n EditorLayout,\n EmptyState,\n GroupHeader,\n TriggerJourney,\n useTriggerWhenStatus,\n} from '@syntrologie/shared-editor-ui';\nimport type React from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { describeTrigger, summarizeNavItem } from './summarize';\nimport {\n type EditorPanelProps,\n isOwnAction,\n type NavConfig,\n type NavTipAction,\n type RuleStrategy,\n} from './types';\n\n// ============================================================================\n// Targeting Extraction (inlined -- CDN builds can't import from editor-sdk)\n// ============================================================================\n\ninterface TargetingInfo {\n pagePatterns: string[];\n anchorSelectors: string[];\n hasTargeting: boolean;\n}\n\nfunction isRuleStrategy(s: unknown): s is RuleStrategy<boolean> {\n return (\n typeof s === 'object' &&\n s !== null &&\n (s as Record<string, unknown>).type === 'rules' &&\n Array.isArray((s as Record<string, unknown>).rules)\n );\n}\n\nfunction extractTargetingInfo(triggerWhen?: unknown | null): TargetingInfo {\n if (!triggerWhen || !isRuleStrategy(triggerWhen)) {\n return { pagePatterns: [], anchorSelectors: [], hasTargeting: false };\n }\n\n const pagePatterns = new Set<string>();\n const anchorSelectors = new Set<string>();\n\n for (const rule of triggerWhen.rules) {\n for (const cond of rule.conditions) {\n const c = cond as Record<string, unknown>;\n if (c.type === 'page_url' && typeof c.url === 'string') {\n pagePatterns.add(c.url);\n } else if (c.type === 'anchor_visible' && typeof c.anchorId === 'string') {\n anchorSelectors.add(c.anchorId);\n }\n }\n }\n\n const hasTargeting = pagePatterns.size > 0 || anchorSelectors.size > 0;\n return {\n pagePatterns: [...pagePatterns],\n anchorSelectors: [...anchorSelectors],\n hasTargeting,\n };\n}\n\nfunction extractFirstPage(triggerWhen?: unknown | null): string | null {\n const info = extractTargetingInfo(triggerWhen);\n return info.pagePatterns[0] || null;\n}\n\nfunction extractFirstAnchor(triggerWhen?: unknown | null): string | null {\n const info = extractTargetingInfo(triggerWhen);\n return info.anchorSelectors[0] || null;\n}\n\n/** Save a pending highlight selector to sessionStorage (inlined to avoid cross-package import). */\nfunction savePendingHighlight(selector: string) {\n try {\n sessionStorage.setItem('syntro:editor:pending-highlight', selector);\n } catch {\n // Silently ignore\n }\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\ninterface FlatItem {\n key: string;\n index: number;\n summary: string;\n trigger: string;\n rationale?: { why: string; confidence?: number };\n firstAnchor: string | null;\n tip: NavTipAction;\n}\n\nfunction flattenItems(config: NavConfig): FlatItem[] {\n const actions = (config.actions || []).filter(isOwnAction);\n return actions.map((tip, i) => ({\n key: String(i),\n index: i,\n summary: summarizeNavItem(tip),\n trigger: describeTrigger(tip.triggerWhen),\n rationale: tip.rationale,\n firstAnchor: extractFirstAnchor(tip.triggerWhen),\n tip,\n }));\n}\n\nfunction filterConfig(config: NavConfig, dismissedKeys: Set<string>): NavConfig {\n const ownActions = (config.actions || []).filter(isOwnAction);\n return {\n ...config,\n actions: ownActions.filter((_, i) => !dismissedKeys.has(String(i))),\n };\n}\n\n// ============================================================================\n// Detection Hook\n// ============================================================================\n\ninterface DetectionEntry {\n found: boolean;\n element: HTMLElement | null;\n}\n\nfunction useDetection(\n items: FlatItem[],\n getCurrentRoute: () => string\n): Map<string, DetectionEntry> {\n const [detectionMap, setDetectionMap] = useState<Map<string, DetectionEntry>>(new Map());\n const itemsRef = useRef(items);\n itemsRef.current = items;\n\n useEffect(() => {\n const runDetection = () => {\n const map = new Map<string, DetectionEntry>();\n const currentPath = getCurrentRoute();\n\n for (const item of itemsRef.current) {\n const targeting = extractTargetingInfo(item.tip.triggerWhen);\n\n // Check page match\n let pageMatch = true;\n if (targeting.pagePatterns.length > 0) {\n pageMatch = targeting.pagePatterns.some((pattern) => {\n const regex = new RegExp(\n `^${pattern.replace(/\\*\\*/g, '.*').replace(/(?<!\\.)(\\*)/g, '[^/]*')}$`\n );\n return regex.test(currentPath);\n });\n }\n\n // Check anchor presence\n let anchorFound = false;\n let element: HTMLElement | null = null;\n if (item.firstAnchor) {\n try {\n element = document.querySelector(item.firstAnchor) as HTMLElement | null;\n anchorFound = element !== null;\n } catch {\n // Invalid selector\n }\n } else {\n anchorFound = pageMatch;\n }\n\n map.set(item.key, {\n found: pageMatch && anchorFound,\n element,\n });\n }\n\n setDetectionMap(map);\n };\n\n runDetection();\n\n const interval = setInterval(runDetection, 2000);\n window.addEventListener('popstate', runDetection);\n\n return () => {\n clearInterval(interval);\n window.removeEventListener('popstate', runDetection);\n };\n }, [getCurrentRoute]);\n\n return detectionMap;\n}\n\n// ============================================================================\n// NavEditor Component\n// ============================================================================\n\nexport function NavEditor({ config, onChange, editor }: EditorPanelProps) {\n const typedConfig = config as unknown as NavConfig;\n const [dismissedKeys, setDismissedKeys] = useState<Set<string>>(\n () => editor.getDismissedKeys?.() ?? new Set()\n );\n const [editingKey, setEditingKey] = useState<string | null>(null);\n const [_previewMode, setPreviewMode] = useState<'before' | 'after'>('after');\n const [_hoveredKey, setHoveredKey] = useState<string | null>(null);\n\n // Sync dismissed keys back to navigation context on every change\n useEffect(() => {\n editor.setDismissedKeys?.(dismissedKeys);\n }, [dismissedKeys, editor]);\n\n // React to global before/after toggle from the panel\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitted \u2014 adding config/typedConfig/previewConfig would cause infinite re-renders since previewConfig triggers state updates\n useEffect(() => {\n const mode = editor.previewMode;\n if (!mode) return;\n\n if (mode === 'before') {\n // Remove all nav tips \u2014 push a config with every item filtered out\n const allKeys = new Set(flattenItems(typedConfig).map((item) => item.key));\n const empty = filterConfig(typedConfig, allKeys);\n editor.previewConfig(empty as unknown as Record<string, unknown>);\n } else {\n // Restore the full config\n editor.previewConfig(config);\n }\n }, [editor.previewMode]);\n\n // If navigated here with an editKey, jump directly to that item's edit view\n const initialConsumed = useRef(false);\n useEffect(() => {\n if (!initialConsumed.current) {\n initialConsumed.current = true;\n if (editor.initialEditKey != null) {\n setEditingKey(String(editor.initialEditKey));\n }\n editor.clearInitialState?.();\n }\n }, [editor]);\n\n const allItems = flattenItems(typedConfig);\n const activeItems = allItems.filter((item) => !dismissedKeys.has(item.key));\n const dismissedItems = allItems.filter((item) => dismissedKeys.has(item.key));\n const totalLinks = activeItems.length;\n\n // Live triggerWhen status for condition diagnostics\n const triggerWhenItems = useMemo(\n () =>\n allItems.map((item) => ({\n id: item.key,\n triggerWhen: item.tip.triggerWhen,\n })),\n [allItems]\n );\n const triggerWhenStatuses = useTriggerWhenStatus(triggerWhenItems);\n\n const detectionMap = useDetection(allItems, editor.getCurrentRoute);\n const foundCount = activeItems.filter((item) => detectionMap.get(item.key)?.found).length;\n\n const handleDismiss = useCallback(\n (key: string) => {\n setDismissedKeys((prev) => {\n const next = new Set(prev);\n next.add(key);\n return next;\n });\n if (editingKey === key) setEditingKey(null);\n },\n [editingKey]\n );\n\n const handleRestore = useCallback((key: string) => {\n setDismissedKeys((prev) => {\n const next = new Set(prev);\n next.delete(key);\n return next;\n });\n }, []);\n\n const handleCardBodyClick = useCallback((item: FlatItem) => {\n setEditingKey(item.key);\n }, []);\n\n const handleTriggerClick = useCallback(\n async (item: FlatItem) => {\n const pageUrl = extractFirstPage(item.tip.triggerWhen);\n if (pageUrl) {\n if (item.firstAnchor) savePendingHighlight(item.firstAnchor);\n await editor.navigateTo(pageUrl);\n }\n if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n },\n [editor]\n );\n\n const handleBackToList = useCallback(() => {\n setEditingKey(null);\n setPreviewMode('after');\n editor.previewConfig(config);\n editor.clearHighlight();\n }, [editor, config]);\n\n // Register back handler in panel header when editing\n useEffect(() => {\n editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);\n return () => editor.setBackHandler?.(null);\n }, [editingKey, handleBackToList, editor]);\n\n const _handleBeforeAfter = useCallback(\n (mode: 'before' | 'after') => {\n setPreviewMode(mode);\n if (mode === 'before') {\n const filtered = filterConfig(typedConfig, new Set([editingKey!]));\n editor.previewConfig(filtered as unknown as Record<string, unknown>);\n } else {\n editor.previewConfig(config);\n }\n },\n [typedConfig, editingKey, editor, config]\n );\n\n const handleFieldChange = useCallback(\n (index: number, field: string, value: unknown) => {\n const ownActions = (typedConfig.actions || []).filter(isOwnAction).slice();\n const link = { ...ownActions[index], config: { ...ownActions[index].config } };\n (link.config as Record<string, unknown>)[field] = value;\n ownActions[index] = link;\n const otherActions = (typedConfig.actions || []).filter((a) => !isOwnAction(a));\n const updated = { ...typedConfig, actions: [...otherActions, ...ownActions] };\n onChange(updated as unknown as Record<string, unknown>);\n editor.setDirty(true);\n },\n [typedConfig, onChange, editor]\n );\n\n const _handlePublish = useCallback(() => {\n if (dismissedKeys.size > 0) {\n const filtered = filterConfig(typedConfig, dismissedKeys);\n onChange(filtered as unknown as Record<string, unknown>);\n }\n editor.publish();\n }, [dismissedKeys, typedConfig, onChange, editor]);\n\n const handleBadgeClick = useCallback(\n async (item: FlatItem) => {\n const detection = detectionMap.get(item.key);\n if (detection?.found && item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n } else {\n const pageUrl = extractFirstPage(item.tip.triggerWhen);\n if (pageUrl) {\n if (item.firstAnchor) savePendingHighlight(item.firstAnchor);\n await editor.navigateTo(pageUrl);\n if (item.firstAnchor) editor.highlightElement(item.firstAnchor);\n } else if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n }\n },\n [editor, detectionMap]\n );\n\n const handleCardHover = useCallback(\n (item: FlatItem) => {\n setHoveredKey(item.key);\n if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n },\n [editor]\n );\n\n const handleCardLeave = useCallback(() => {\n setHoveredKey(null);\n editor.clearHighlight();\n }, [editor]);\n\n // ---- Edit form renderer ----\n\n const renderEditFields = (index: number) => {\n const actions = (typedConfig.actions || []).filter(isOwnAction);\n const tip = actions[index];\n if (!tip) return null;\n\n const item = allItems.find((it) => it.key === String(index));\n\n return (\n <div className=\"se-py-1\">\n {/* Trigger line in edit mode */}\n {item && item.trigger !== 'All pages' && (\n <button\n type=\"button\"\n data-trigger\n className=\"se-flex se-items-center se-gap-1 se-text-[11px] se-text-slate-grey-8 se-cursor-pointer se-mb-1 se-border-none se-bg-transparent se-p-0 se-text-left\"\n onClick={() => handleTriggerClick(item)}\n >\n <span>{'\\u{1f4cd}'}</span>\n <span>{item.trigger}</span>\n </button>\n )}\n\n <EditorInput\n label=\"Title\"\n value={tip.config.title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'title', e.target.value)\n }\n />\n\n <EditorInput\n label=\"Description\"\n value={tip.config.description}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'description', e.target.value)\n }\n />\n\n <EditorInput\n label=\"Link URL\"\n value={tip.config.href || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'href', e.target.value)\n }\n placeholder=\"Optional\"\n />\n\n <EditorInput\n label=\"Icon\"\n value={tip.config.icon || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'icon', e.target.value)\n }\n placeholder=\"e.g., \\u{1f9ed}\"\n />\n\n <EditorInput\n label=\"Category\"\n value={tip.config.category || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'category', e.target.value)\n }\n placeholder=\"Optional\"\n />\n\n <label className=\"se-flex se-items-center se-gap-2 se-text-xs se-text-slate-grey-8 se-mb-2\">\n <input\n type=\"checkbox\"\n checked={tip.config.external || false}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'external', e.target.checked)\n }\n />\n Open in new tab\n </label>\n\n <span className=\"se-text-[11px] se-font-semibold se-text-slate-grey-7 se-mb-1 se-block\">\n AI Rationale\n </span>\n <div className=\"se-p-2 se-rounded se-border se-border-dashed se-border-white/15 se-bg-white/[0.02] se-text-slate-grey-8 se-text-xs se-mb-2\">\n {tip.rationale ? tip.rationale.why : 'N/A'}\n </div>\n </div>\n );\n };\n\n const subtitle = `${totalLinks} tip${totalLinks !== 1 ? 's' : ''}${totalLinks > 0 ? ` (${foundCount} found on this page)` : ''}`;\n\n return (\n <EditorLayout>\n <EditorHeader\n title=\"Navigation Tips\"\n subtitle={subtitle}\n onBack={() => editor.navigateHome()}\n />\n\n <EditorBody>\n {editingKey !== null ? (\n /* ---- Edit mode ---- */\n (() => {\n const editIndex = Number(editingKey);\n const editItem = allItems.find((it) => it.key === editingKey);\n return (\n <>\n <div className=\"se-flex se-items-center se-gap-2 se-mb-3 se-text-[13px] se-font-semibold se-text-slate-grey-10\">\n <span>{'\\u{1F9ED}'}</span>\n <span>{editItem?.summary}</span>\n </div>\n {renderEditFields(editIndex)}\n </>\n );\n })()\n ) : (\n /* ---- List mode ---- */\n <>\n {allItems.length === 0 && <EmptyState message=\"No tips configured.\" />}\n\n {activeItems.length > 0 && (\n <>\n <GroupHeader label=\"TIPS\" count={activeItems.length} />\n {activeItems.map((item) => {\n const detection = detectionMap.get(item.key);\n return (\n <EditorCard\n key={item.key}\n itemKey={item.key}\n onClick={() => handleCardBodyClick(item)}\n onMouseEnter={() => handleCardHover(item)}\n onMouseLeave={handleCardLeave}\n >\n {/* Trigger line */}\n {item.trigger !== 'All pages' && (\n <button\n type=\"button\"\n data-trigger\n className=\"se-flex se-items-center se-gap-1 se-text-[11px] se-text-slate-grey-8 se-cursor-pointer se-mb-1 se-border-none se-bg-transparent se-p-0 se-text-left\"\n onClick={(e) => {\n e.stopPropagation();\n handleTriggerClick(item);\n }}\n >\n <span>{'\\u{1f4cd}'}</span>\n <span>{item.trigger}</span>\n </button>\n )}\n {/* Card body: badge + summary + dismiss */}\n {/* biome-ignore lint/a11y/useSemanticElements: cannot use <button> here as it would nest a dismiss <button> inside, which is invalid HTML */}\n <div\n data-card-body\n role=\"button\"\n tabIndex={0}\n className=\"se-flex se-items-center se-gap-2 se-cursor-pointer\"\n onClick={() => handleCardBodyClick(item)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleCardBodyClick(item);\n }}\n >\n <DetectionBadge\n found={detection?.found ?? false}\n onClick={() => handleBadgeClick(item)}\n />\n <span className=\"se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap\">\n {item.summary}\n </span>\n <button\n type=\"button\"\n className=\"se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-slate-grey-7 se-text-sm se-cursor-pointer se-shrink-0 se-leading-none\"\n onClick={(e) => {\n e.stopPropagation();\n handleDismiss(item.key);\n }}\n title=\"Dismiss this tip\"\n >\n ×\n </button>\n </div>\n {/* Rationale line */}\n <div className=\"se-text-[10px] se-text-slate-grey-7 se-mt-1\">\n WHY: {item.rationale ? item.rationale.why : 'N/A'}\n </div>\n {/* Condition status line */}\n <TriggerJourney status={triggerWhenStatuses.get(item.key) ?? null} />\n </EditorCard>\n );\n })}\n </>\n )}\n\n {/* Dismissed section */}\n {dismissedItems.length > 0 && (\n <DismissedSection count={dismissedItems.length}>\n {dismissedItems.map((item) => (\n <div\n key={item.key}\n className=\"se-flex se-items-center se-gap-2 se-py-1.5 se-px-2.5 se-rounded-md se-border se-border-white/[0.03] se-bg-transparent se-mb-0.5 se-cursor-pointer se-text-xs se-text-slate-grey-6 se-opacity-60\"\n >\n <span className=\"se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap se-line-through\">\n {item.summary}\n </span>\n <button\n type=\"button\"\n className=\"se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-blue-5 se-text-[11px] se-cursor-pointer se-shrink-0 se-leading-none\"\n onClick={(e) => {\n e.stopPropagation();\n handleRestore(item.key);\n }}\n >\n Restore\n </button>\n </div>\n ))}\n </DismissedSection>\n )}\n </>\n )}\n </EditorBody>\n </EditorLayout>\n );\n}\n\n/**\n * Editor panel configuration for the app registry.\n */\nexport const editorPanel = {\n title: 'Navigation Tips',\n icon: '\\u{1F9ED}',\n description: 'Navigation tips accordion with per-item visibility',\n};\n\nexport const editor = {\n panel: editorPanel,\n component: NavEditor,\n};\n\nexport default NavEditor;\n", "\n function _RD() {\n return (typeof SynOS !== 'undefined' && SynOS.ReactDOM) || {};\n }\n export default new Proxy({}, { get: function(_, k) { return _RD()[k]; } });\n export function createRoot() { return _RD().createRoot.apply(null, arguments); }\n export function hydrateRoot() { return _RD().hydrateRoot.apply(null, arguments); }\n export function createPortal() { return _RD().createPortal.apply(null, arguments); }\n export function flushSync() { return _RD().flushSync.apply(null, arguments); }\n ", "/**\n * Adaptive Nav - NavWidget Component\n *\n * React component that renders a collapsible navigation tips accordion\n * with per-item conditional visibility based on triggerWhen decision strategies.\n *\n * Demonstrates the compositional action pattern where child actions\n * (nav:tip) serve as configuration data for the parent widget.\n */\n\nimport { purple, slateGrey } from '@syntro/design-system/tokens';\nimport type { AnchorId } from '@syntrologie/sdk-contracts';\nimport React, { useCallback, useEffect, useMemo, useReducer, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { navigateWithFrameworkRouter } from './runtime';\nimport type { NavConfig, NavTipAction, NavWidgetProps, NavWidgetRuntime } from './types';\n\n// ============================================================================\n// Emoji \u2192 Lucide SVG inline mapping (no lucide-react dependency)\n// ============================================================================\n\nconst EMOJI_SVG_MAP: Record<string, string> = {\n '\uD83D\uDCB5': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83C\uDFDB\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" x2=\"21\" y1=\"22\" y2=\"22\"/><line x1=\"6\" x2=\"6\" y1=\"18\" y2=\"11\"/><line x1=\"10\" x2=\"10\" y1=\"18\" y2=\"11\"/><line x1=\"14\" x2=\"14\" y1=\"18\" y2=\"11\"/><line x1=\"18\" x2=\"18\" y1=\"18\" y2=\"11\"/><polygon points=\"12 2 20 7 4 7\"/></svg>',\n '\u23ED\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 4 15 12 5 20 5 4\"/><line x1=\"19\" x2=\"19\" y1=\"5\" y2=\"19\"/></svg>',\n '\u27A1\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/></svg>',\n '\uD83D\uDCA1': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/></svg>',\n '\uD83D\uDCB0': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83D\uDCCB': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"8\" height=\"4\" x=\"8\" y=\"2\" rx=\"1\" ry=\"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-2h2\"/><path d=\"M12 11h4\"/><path d=\"M12 16h4\"/><path d=\"M8 11h.01\"/><path d=\"M8 16h.01\"/></svg>',\n '\u2705': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><path d=\"m9 11 3 3L22 4\"/></svg>',\n '\u26A0\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></svg>',\n};\n\nfunction renderIcon(emoji: string): string {\n return EMOJI_SVG_MAP[emoji] ?? escapeHtml(emoji);\n}\n\n// ============================================================================\n// Sanitization\n// ============================================================================\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n// ============================================================================\n// Styles\n// ============================================================================\n\nconst baseStyles = {\n container: {\n fontFamily: 'var(--sc-font-family, system-ui, -apple-system, sans-serif)',\n maxWidth: '100%',\n overflow: 'hidden',\n },\n accordion: {\n display: 'flex',\n flexDirection: 'column' as const,\n gap: 'var(--sc-content-item-gap, 6px)',\n },\n item: {\n borderRadius: 'var(--sc-content-border-radius, 8px)',\n overflow: 'hidden',\n transition: 'box-shadow 0.2s ease',\n },\n header: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n width: '100%',\n padding: 'var(--sc-content-item-padding, 12px 16px)',\n border: 'none',\n cursor: 'pointer',\n fontSize: 'var(--sc-content-item-font-size, 15px)',\n fontWeight: 500,\n fontFamily: 'inherit',\n textAlign: 'left' as const,\n transition: 'background-color 0.15s ease',\n },\n chevron: {\n fontSize: '20px',\n transition: 'transform 0.2s ease',\n marginLeft: 'auto',\n flexShrink: 0,\n color: 'var(--sc-content-chevron-color, currentColor)',\n },\n icon: {\n fontSize: '16px',\n flexShrink: 0,\n },\n body: {\n overflow: 'hidden',\n transition: 'max-height 0.25s ease, padding-bottom 0.25s ease',\n padding: 'var(--sc-content-body-padding, 0 16px 12px 16px)',\n },\n description: {\n fontSize: 'var(--sc-content-body-font-size, 14px)',\n lineHeight: '1.5',\n margin: 0,\n },\n linkButton: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n marginTop: '10px',\n padding: '6px 12px',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '13px',\n fontWeight: 500,\n cursor: 'pointer',\n border: 'none',\n transition: 'background-color 0.15s ease',\n },\n categoryHeader: {\n fontSize: 'var(--sc-content-category-font-size, 12px)',\n fontWeight: 600,\n textTransform: 'uppercase' as const,\n letterSpacing: '0.05em',\n padding: 'var(--sc-content-category-padding, 8px 4px 4px 4px)',\n },\n emptyState: {\n fontSize: '13px',\n padding: '16px',\n textAlign: 'center' as const,\n },\n} as const;\n\nconst themeStyles = {\n light: {\n container: {\n backgroundColor: 'transparent',\n color: 'inherit',\n },\n item: {\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n },\n itemExpanded: {\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08)',\n },\n header: {\n backgroundColor: 'transparent',\n color: 'var(--sc-content-text-color)',\n },\n headerHover: {\n backgroundColor: 'var(--sc-content-background-hover)',\n },\n body: {\n color: 'var(--sc-content-text-secondary-color)',\n },\n linkButton: {\n // purple[4] = #6a59ce \u2014 design system primary purple, used as fallback when --sc-color-primary is not set\n backgroundColor: `var(--sc-color-primary, ${purple[4]})`,\n color: '#ffffff',\n },\n categoryHeader: {\n color: slateGrey[7],\n },\n emptyState: {\n color: slateGrey[8],\n },\n },\n dark: {\n container: {\n backgroundColor: 'transparent',\n color: 'inherit',\n },\n item: {\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n },\n itemExpanded: {\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n },\n header: {\n backgroundColor: 'transparent',\n color: 'var(--sc-content-text-color)',\n },\n headerHover: {\n backgroundColor: 'var(--sc-content-background-hover)',\n },\n body: {\n color: 'var(--sc-content-text-secondary-color)',\n },\n linkButton: {\n // purple[4] = #6a59ce \u2014 design system primary purple, used as fallback when --sc-color-primary is not set\n backgroundColor: `var(--sc-color-primary, ${purple[4]})`,\n color: '#ffffff',\n },\n categoryHeader: {\n color: slateGrey[8],\n },\n emptyState: {\n color: slateGrey[7],\n },\n },\n};\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Check if any of the given routes match the current page pathname */\nfunction routeMatchesCurrent(routes: string[]): boolean {\n if (typeof window === 'undefined') return false;\n const current = window.location.pathname;\n return routes.some((route) => {\n // Strip query/hash from route if present\n const routePath = route.split('?')[0].split('#')[0];\n // Exact match or glob pattern (** suffix)\n if (routePath.endsWith('/**')) {\n return current.startsWith(routePath.slice(0, -3));\n }\n return current === routePath;\n });\n}\n\n/** Apply a brief pulse animation to an element, then remove it */\nfunction pulseElement(el: HTMLElement): void {\n const keyframes: Keyframe[] = [\n { boxShadow: '0 0 0 0 rgba(13, 148, 136, 0.5)' },\n { boxShadow: '0 0 0 8px rgba(13, 148, 136, 0)' },\n ];\n el.animate(keyframes, { duration: 600, iterations: 3, easing: 'ease-out' });\n}\n\n// ============================================================================\n// NavTipItem Component\n// ============================================================================\n\ninterface NavTipItemProps {\n item: NavTipAction;\n isExpanded: boolean;\n isLast: boolean;\n onToggle: () => void;\n onNavigate: (href: string, external: boolean) => void;\n onFocusAnchor: (anchor: AnchorId) => void;\n theme: 'light' | 'dark';\n}\n\nfunction NavTipItem({\n item,\n isExpanded,\n isLast,\n onToggle,\n onNavigate,\n onFocusAnchor,\n theme,\n}: NavTipItemProps) {\n const [isHovered, setIsHovered] = useState(false);\n const colors = themeStyles[theme];\n const { title, description, href, icon, external, anchor } = item.config;\n\n const itemStyle: React.CSSProperties = {\n ...baseStyles.item,\n ...colors.item,\n ...(isExpanded ? colors.itemExpanded : {}),\n ...(!isLast ? { borderBottom: 'var(--sc-content-item-divider, none)' } : {}),\n };\n\n const headerStyle: React.CSSProperties = {\n ...baseStyles.header,\n ...colors.header,\n ...(isHovered ? colors.headerHover : {}),\n };\n\n const chevronStyle: React.CSSProperties = {\n ...baseStyles.chevron,\n transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',\n };\n\n const bodyStyle: React.CSSProperties = {\n ...baseStyles.body,\n ...colors.body,\n maxHeight: isExpanded ? '500px' : '0',\n paddingBottom: isExpanded ? '16px' : '0',\n };\n\n // Determine the effective navigation target from anchor or legacy href\n const effectiveHref = anchor\n ? Array.isArray(anchor.route)\n ? anchor.route[0]\n : anchor.route\n : href;\n\n // Same-page check: anchor exists, selector is meaningful, and route matches current page\n const isSamePage = anchor\n ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route])\n : effectiveHref\n ? routeMatchesCurrent([effectiveHref])\n : false;\n const hasSelector = anchor?.selector && anchor.selector !== '*';\n const isFocusAction = isSamePage && hasSelector;\n const hasAction = !!effectiveHref || isFocusAction;\n\n const handleLinkClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (isFocusAction && anchor) {\n onFocusAnchor(anchor);\n } else if (effectiveHref) {\n onNavigate(effectiveHref, external ?? false);\n }\n };\n\n // CTA label\n const ctaLabel = isFocusAction ? `Focus \\u2192` : external ? `Go \\u2197` : `Go \\u2192`;\n\n return (\n <div style={itemStyle} data-nav-tip-id={item.config.id}>\n <button\n type=\"button\"\n style={headerStyle}\n onClick={onToggle}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n aria-expanded={isExpanded}\n >\n {icon && (\n // biome-ignore lint/security/noDangerouslySetInnerHtml: renderIcon returns sanitized SVG from EMOJI_SVG_MAP or escapeHtml\n <span style={baseStyles.icon} dangerouslySetInnerHTML={{ __html: renderIcon(icon) }} />\n )}\n <span>{title}</span>\n <span style={chevronStyle}>{'\\u203A'}</span>\n </button>\n <div style={bodyStyle} aria-hidden={!isExpanded}>\n <p style={baseStyles.description}>{description}</p>\n {hasAction && (\n <a\n href={effectiveHref || '#'}\n onClick={handleLinkClick}\n style={{ ...baseStyles.linkButton, ...colors.linkButton }}\n target={external ? '_blank' : undefined}\n rel={external ? 'noopener noreferrer' : undefined}\n >\n {ctaLabel}\n </a>\n )}\n </div>\n </div>\n );\n}\n\n// ============================================================================\n// NavWidget Component\n// ============================================================================\n\n/**\n * NavWidget - Renders a collapsible navigation tips accordion.\n *\n * This component demonstrates the compositional action pattern:\n * - Parent (NavWidget) receives `config.actions` array\n * - Each action has optional `triggerWhen` for per-item visibility\n * - Parent evaluates triggerWhen and filters visible tips\n * - Parent manages expand state and re-rendering on context changes\n */\nexport function NavWidget({ config, runtime, instanceId }: NavWidgetProps) {\n // Force re-render when context/accumulator changes.\n const [renderTick, forceUpdate] = useReducer((x: number) => x + 1, 0);\n\n // Track expanded tip IDs\n const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());\n\n // Subscribe to context changes for reactive updates\n useEffect(() => {\n const unsubscribe = runtime.context.subscribe(() => {\n forceUpdate();\n });\n return unsubscribe;\n }, [runtime.context]);\n\n // Subscribe to accumulator changes for event_count-based triggerWhen\n useEffect(() => {\n if (!runtime.accumulator?.subscribe) return;\n return runtime.accumulator.subscribe(() => {\n forceUpdate();\n });\n }, [runtime.accumulator]);\n\n // Filter visible tips based on per-item triggerWhen\n // biome-ignore lint/correctness/useExhaustiveDependencies: renderTick is intentionally included to force re-evaluation when the runtime's mutable context changes (subscribed above via forceUpdate)\n const visibleTips = useMemo(\n () =>\n config.actions.filter((tip) => {\n if (!tip.triggerWhen) return true;\n try {\n const result = runtime.evaluateSync<boolean>(tip.triggerWhen);\n return result.value;\n } catch {\n // If strategy evaluation fails, hide the tip (fail-closed)\n return false;\n }\n }),\n [config.actions, runtime, renderTick]\n );\n\n // Group by category\n const categoryGroups = useMemo(() => {\n const groups = new Map<string | undefined, NavTipAction[]>();\n for (const tip of visibleTips) {\n const cat = tip.config.category;\n if (!groups.has(cat)) {\n groups.set(cat, []);\n }\n groups.get(cat)!.push(tip);\n }\n return groups;\n }, [visibleTips]);\n\n // Check if any items have categories\n const hasCategories = useMemo(() => visibleTips.some((t) => t.config.category), [visibleTips]);\n\n // Resolve theme (auto \u2192 detect system preference)\n const resolvedTheme = useMemo(() => {\n if (config.theme && config.theme !== 'auto') return config.theme;\n if (typeof window !== 'undefined') {\n return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n }, [config.theme]);\n\n // Handle tip toggle\n const handleToggle = useCallback(\n (id: string) => {\n setExpandedIds((prev) => {\n const wasExpanded = prev.has(id);\n\n let next: Set<string>;\n if (config.expandBehavior === 'single') {\n // In single mode, emit collapse events for any previously-expanded tips\n for (const prevId of prev) {\n if (prevId !== id) {\n runtime.events.publish('nav:toggled', {\n instanceId,\n tipId: prevId,\n expanded: false,\n timestamp: Date.now(),\n });\n }\n }\n next = wasExpanded ? new Set() : new Set([id]);\n } else {\n next = new Set(prev);\n if (wasExpanded) {\n next.delete(id);\n } else {\n next.add(id);\n }\n }\n\n // Emit event for the clicked tip using fresh state from the updater\n runtime.events.publish('nav:toggled', {\n instanceId,\n tipId: id,\n expanded: !wasExpanded,\n timestamp: Date.now(),\n });\n\n return next;\n });\n },\n [config.expandBehavior, runtime.events, instanceId]\n );\n\n // Handle navigation with event publishing\n const handleNavigate = useCallback(\n (href: string, external: boolean) => {\n // Reject dangerous URIs to prevent XSS\n const normalizedHref = href.trim().toLowerCase();\n if (normalizedHref.startsWith('javascript:') || normalizedHref.startsWith('data:')) {\n return;\n }\n\n runtime.events.publish('nav:tip_clicked', {\n instanceId,\n href,\n external,\n timestamp: Date.now(),\n });\n\n if (external) {\n window.open(href, '_blank', 'noopener,noreferrer');\n } else {\n // Try the host framework's native router first (Next.js, Nuxt, etc.)\n // Falls back to pushState for vanilla SPAs.\n const url = new URL(href, window.location.origin);\n url.search = window.location.search;\n if (!navigateWithFrameworkRouter(url.toString())) {\n window.history.pushState(null, '', url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n }\n },\n [runtime.events, instanceId]\n );\n\n // Handle same-page anchor focus: scroll + pulse + focus\n const handleFocusAnchor = useCallback(\n (anchor: AnchorId) => {\n const el = document.querySelector(anchor.selector);\n if (!(el instanceof HTMLElement)) return;\n\n runtime.events.publish('nav:tip_focused', {\n instanceId,\n selector: anchor.selector,\n route: anchor.route,\n timestamp: Date.now(),\n });\n\n el.scrollIntoView({ behavior: 'smooth', block: 'center' });\n pulseElement(el);\n // Focus after scroll completes\n setTimeout(() => el.focus(), 400);\n },\n [runtime.events, instanceId]\n );\n\n // Compute container styles\n const containerStyle: React.CSSProperties = {\n ...baseStyles.container,\n ...themeStyles[resolvedTheme].container,\n };\n\n const categoryHeaderStyle: React.CSSProperties = {\n ...baseStyles.categoryHeader,\n ...themeStyles[resolvedTheme].categoryHeader,\n };\n\n const emptyStateStyle: React.CSSProperties = {\n ...baseStyles.emptyState,\n ...themeStyles[resolvedTheme].emptyState,\n };\n\n // Render a list of nav tip items\n const renderItems = (items: NavTipAction[]) =>\n items.map((tip, index) => (\n <NavTipItem\n key={tip.config.id}\n item={tip}\n isExpanded={expandedIds.has(tip.config.id)}\n isLast={index === items.length - 1}\n onToggle={() => handleToggle(tip.config.id)}\n onNavigate={handleNavigate}\n onFocusAnchor={handleFocusAnchor}\n theme={resolvedTheme}\n />\n ));\n\n // Empty state\n if (visibleTips.length === 0) {\n return (\n <div style={containerStyle} data-adaptive-id={instanceId} data-adaptive-type=\"adaptive-nav\">\n <div style={emptyStateStyle}>\n You're all set for now! We'll share helpful tips here when they're relevant to what you're\n doing.\n </div>\n </div>\n );\n }\n\n return (\n <div style={containerStyle} data-adaptive-id={instanceId} data-adaptive-type=\"adaptive-nav\">\n <div style={baseStyles.accordion}>\n {hasCategories\n ? Array.from(categoryGroups.entries()).map(([category, items]) => (\n <React.Fragment key={category ?? '__ungrouped'}>\n {category && (\n <div style={categoryHeaderStyle} data-category-header={category}>\n {category}\n </div>\n )}\n {renderItems(items)}\n </React.Fragment>\n ))\n : renderItems(visibleTips)}\n </div>\n </div>\n );\n}\n\n// ============================================================================\n// Mountable Widget Interface\n// ============================================================================\n\n/**\n * Mountable widget interface for the runtime's WidgetRegistry.\n */\nexport const NavMountableWidget = {\n mount(\n container: HTMLElement,\n config?: NavConfig & { runtime?: NavWidgetRuntime; instanceId?: string }\n ) {\n const {\n runtime,\n instanceId = 'nav-widget',\n ...navConfig\n } = config || {\n expandBehavior: 'single' as const,\n theme: 'auto' as const,\n actions: [],\n };\n\n // React rendering when runtime + ReactDOM are available\n if (runtime && typeof createRoot === 'function') {\n const root = createRoot(container);\n root.render(\n React.createElement(NavWidget, {\n config: navConfig as NavConfig,\n runtime: runtime as NavWidgetRuntime,\n instanceId,\n })\n );\n return () => {\n root.unmount();\n };\n }\n },\n};\n\nexport default NavWidget;\n", "/**\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.2');\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 * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal\n */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of CSS properties and values.\n *\n * The key should be either a valid CSS property name string, like\n * `'background-color'`, or a valid JavaScript camel case property name\n * for CSSStyleDeclaration like `backgroundColor`.\n */\nexport interface StyleInfo {\n [name: string]: string | number | undefined | null;\n}\n\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\n\nclass StyleMapDirective extends Directive {\n private _previousStyleProperties?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n 'The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(styleInfo: Readonly<StyleInfo>) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n\n override update(part: AttributePart, [styleInfo]: DirectiveParameters<this>) {\n const {style} = part.element as HTMLElement;\n\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties!.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = null;\n }\n }\n }\n\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant =\n typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(\n name,\n isImportant\n ? (value as string).slice(0, flagTrim)\n : (value as string),\n isImportant ? important : ''\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {StyleMapDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n", "/**\n * Adaptive Nav - NavWidgetLit Web Component\n *\n * Lit web component equivalent of NavWidget.tsx. Renders a collapsible\n * navigation tips accordion with per-item conditional visibility, framework-aware\n * navigation, and CSS variable theming.\n *\n * Decorator-free: uses `static override properties` (tsconfig has no\n * experimentalDecorators).\n *\n * Uses light DOM (createRenderRoot returns this) so host-page CSS variables\n * (--sc-*) are inherited without crossing a shadow boundary.\n */\n\nimport { html, LitElement, nothing } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nimport { navigateWithFrameworkRouter } from './runtime';\nimport type { NavConfig, NavTipAction, NavWidgetRuntime } from './types';\n\n// ============================================================================\n// Design system token fallbacks (inlined to avoid bundling @syntro/design-system\n// as a hard dep for this file; values match packages/design-system/src/tokens/colors.ts)\n// ============================================================================\n\nconst TOKEN_PURPLE_4 = '#6a59ce';\nconst TOKEN_SLATE_GREY_7 = '#677384';\nconst TOKEN_SLATE_GREY_8 = '#87919f';\n\n// ============================================================================\n// Emoji \u2192 Lucide SVG inline mapping (matches NavWidget.tsx EMOJI_SVG_MAP)\n// ============================================================================\n\nconst EMOJI_SVG_MAP: Record<string, string> = {\n '\uD83D\uDCB5': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83C\uDFDB\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" x2=\"21\" y1=\"22\" y2=\"22\"/><line x1=\"6\" x2=\"6\" y1=\"18\" y2=\"11\"/><line x1=\"10\" x2=\"10\" y1=\"18\" y2=\"11\"/><line x1=\"14\" x2=\"14\" y1=\"18\" y2=\"11\"/><line x1=\"18\" x2=\"18\" y1=\"18\" y2=\"11\"/><polygon points=\"12 2 20 7 4 7\"/></svg>',\n '\u23ED\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 4 15 12 5 20 5 4\"/><line x1=\"19\" x2=\"19\" y1=\"5\" y2=\"19\"/></svg>',\n '\u27A1\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/></svg>',\n '\uD83D\uDCA1': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/></svg>',\n '\uD83D\uDCB0': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83D\uDCCB': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"8\" height=\"4\" x=\"8\" y=\"2\" rx=\"1\" ry=\"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-2h2\"/><path d=\"M12 11h4\"/><path d=\"M12 16h4\"/><path d=\"M8 11h.01\"/><path d=\"M8 16h.01\"/></svg>',\n '\u2705': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><path d=\"m9 11 3 3L22 4\"/></svg>',\n '\u26A0\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></svg>',\n};\n\n// ============================================================================\n// Sanitization helpers\n// ============================================================================\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\nfunction renderIcon(emoji: string): string {\n return EMOJI_SVG_MAP[emoji] ?? escapeHtml(emoji);\n}\n\n// ============================================================================\n// Route matching helper\n// ============================================================================\n\nfunction routeMatchesCurrent(routes: string[]): boolean {\n if (typeof window === 'undefined') return false;\n const current = window.location.pathname;\n return routes.some((route) => {\n const routePath = route.split('?')[0].split('#')[0];\n if (routePath.endsWith('/**')) {\n return current.startsWith(routePath.slice(0, -3));\n }\n return current === routePath;\n });\n}\n\n// ============================================================================\n// Pulse animation helper\n// ============================================================================\n\nfunction pulseElement(el: HTMLElement): void {\n const keyframes: Keyframe[] = [\n { boxShadow: '0 0 0 0 rgba(13, 148, 136, 0.5)' },\n { boxShadow: '0 0 0 8px rgba(13, 148, 136, 0)' },\n ];\n el.animate(keyframes, { duration: 600, iterations: 3, easing: 'ease-out' });\n}\n\n// ============================================================================\n// Theme helpers\n// ============================================================================\n\ntype ResolvedTheme = 'light' | 'dark';\n\nfunction resolveTheme(theme: string | undefined): ResolvedTheme {\n if (theme === 'dark') return 'dark';\n if (theme === 'light') return 'light';\n // auto or undefined: detect system preference\n if (typeof window !== 'undefined') {\n return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n}\n\n// ============================================================================\n// AnchorId type (matches sdk-contracts shape used in NavWidget.tsx)\n// ============================================================================\n\ninterface AnchorId {\n route: string | string[];\n selector: string;\n}\n\n// ============================================================================\n// NavWidgetLit \u2014 LitElement\n// ============================================================================\n\nexport class NavWidgetLit extends LitElement {\n // ---------- No shadow DOM \u2014 inherit host CSS variables --------------------\n\n override createRenderRoot() {\n return this;\n }\n\n // ---------- Reactive properties (no decorators) --------------------------\n\n static override properties = {\n // Public inputs\n config: { attribute: false },\n runtime: { attribute: false },\n instanceId: { type: String },\n\n // Internal reactive state\n _expandedIds: { state: true },\n _renderTick: { state: true },\n _hoveredId: { state: true },\n };\n\n // ---------- Public properties --------------------------------------------\n\n config: NavConfig = { expandBehavior: 'single', theme: 'auto', actions: [] };\n runtime: NavWidgetRuntime | undefined = undefined;\n instanceId: string = 'nav-widget';\n\n // ---------- Internal state -----------------------------------------------\n\n /** @internal */ _expandedIds: Set<string> = new Set();\n /** @internal */ _renderTick = 0;\n /** @internal */ _hoveredId: string | null = null;\n\n // ---------- Private subscriptions ----------------------------------------\n\n #contextUnsub: (() => void) | null = null;\n #accumulatorUnsub: (() => void) | null = null;\n\n // ---------- Lifecycle: connectedCallback ---------------------------------\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#subscribeRuntime();\n }\n\n // ---------- Lifecycle: disconnectedCallback ------------------------------\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#unsubscribeRuntime();\n }\n\n // ---------- Lifecycle: updated -------------------------------------------\n\n override updated(changed: Map<string, unknown>): void {\n if (changed.has('runtime')) {\n this.#unsubscribeRuntime();\n this.#subscribeRuntime();\n }\n }\n\n // ---------- Runtime subscriptions ----------------------------------------\n\n #subscribeRuntime(): void {\n if (!this.runtime) return;\n\n this.#contextUnsub = this.runtime.context.subscribe(() => {\n this._renderTick += 1;\n });\n\n if (this.runtime.accumulator?.subscribe) {\n this.#accumulatorUnsub = this.runtime.accumulator.subscribe(() => {\n this._renderTick += 1;\n });\n }\n }\n\n #unsubscribeRuntime(): void {\n this.#contextUnsub?.();\n this.#contextUnsub = null;\n this.#accumulatorUnsub?.();\n this.#accumulatorUnsub = null;\n }\n\n // ---------- Computed helpers (called on each render) ---------------------\n\n #getVisibleTips(): NavTipAction[] {\n // _renderTick is read here to ensure this re-runs when context/accumulator\n // notify (same pattern as useMemo with renderTick dep in React version).\n void this._renderTick;\n\n if (!this.runtime) return this.config.actions;\n\n return this.config.actions.filter((tip) => {\n if (!tip.triggerWhen) return true;\n try {\n const result = this.runtime!.evaluateSync<boolean>(tip.triggerWhen);\n return result.value;\n } catch {\n // Fail-closed: hide tip when strategy evaluation throws\n return false;\n }\n });\n }\n\n #getResolvedTheme(): ResolvedTheme {\n return resolveTheme(this.config.theme);\n }\n\n // ---------- Event handlers -----------------------------------------------\n\n #handleToggle(id: string): void {\n const wasExpanded = this._expandedIds.has(id);\n\n let next: Set<string>;\n if (this.config.expandBehavior === 'single') {\n // Emit collapse events for previously-expanded tips (single mode)\n for (const prevId of this._expandedIds) {\n if (prevId !== id) {\n this.#publishEvent('nav:toggled', {\n tipId: prevId,\n expanded: false,\n });\n }\n }\n next = wasExpanded ? new Set() : new Set([id]);\n } else {\n next = new Set(this._expandedIds);\n if (wasExpanded) {\n next.delete(id);\n } else {\n next.add(id);\n }\n }\n\n this.#publishEvent('nav:toggled', {\n tipId: id,\n expanded: !wasExpanded,\n });\n\n this._expandedIds = next;\n }\n\n #handleNavigate(href: string, external: boolean): void {\n // Reject dangerous URIs\n const normalized = href.trim().toLowerCase();\n if (normalized.startsWith('javascript:') || normalized.startsWith('data:')) return;\n\n this.#publishEvent('nav:tip_clicked', { href, external });\n\n // Also fire a standard custom event for host-page listeners\n this.dispatchEvent(\n new CustomEvent('nav-tip-clicked', {\n bubbles: true,\n detail: { href, external, instanceId: this.instanceId },\n })\n );\n\n if (external) {\n window.open(href, '_blank', 'noopener,noreferrer');\n } else {\n const url = new URL(href, window.location.origin);\n url.search = window.location.search;\n if (!navigateWithFrameworkRouter(url.toString())) {\n window.history.pushState(null, '', url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n }\n }\n\n #handleFocusAnchor(anchor: AnchorId): void {\n const el = document.querySelector(anchor.selector);\n if (!(el instanceof HTMLElement)) return;\n\n this.#publishEvent('nav:tip_focused', {\n selector: anchor.selector,\n route: anchor.route,\n });\n\n this.dispatchEvent(\n new CustomEvent('nav-tip-focused', {\n bubbles: true,\n detail: { selector: anchor.selector, instanceId: this.instanceId },\n })\n );\n\n el.scrollIntoView({ behavior: 'smooth', block: 'center' });\n pulseElement(el);\n setTimeout(() => el.focus(), 400);\n }\n\n #publishEvent(name: string, props: Record<string, unknown>): void {\n this.runtime?.events.publish(name, {\n instanceId: this.instanceId,\n timestamp: Date.now(),\n ...props,\n });\n }\n\n // ---------- Tip item rendering -------------------------------------------\n\n #renderTipItem(tip: NavTipAction, index: number, total: number) {\n const { id, title, description, href, icon, external, anchor, category: _cat } = tip.config;\n const isExpanded = this._expandedIds.has(id);\n const isLast = index === total - 1;\n const isHovered = this._hoveredId === id;\n const theme = this.#getResolvedTheme();\n\n // Determine the effective href from anchor or legacy href\n const effectiveHref = anchor\n ? Array.isArray(anchor.route)\n ? anchor.route[0]\n : anchor.route\n : href;\n\n // Same-page check\n const isSamePage = anchor\n ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route])\n : effectiveHref\n ? routeMatchesCurrent([effectiveHref])\n : false;\n const hasSelector = anchor?.selector && anchor.selector !== '*';\n const isFocusAction = isSamePage && hasSelector;\n const hasAction = !!effectiveHref || isFocusAction;\n\n const ctaLabel = isFocusAction ? 'Focus \\u2192' : external ? 'Go \\u2197' : 'Go \\u2192';\n\n // Item container styles\n const itemStyle = styleMap({\n borderRadius: 'var(--sc-content-border-radius, 8px)',\n overflow: 'hidden',\n transition: 'box-shadow 0.2s ease',\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n ...(isExpanded\n ? {\n boxShadow:\n theme === 'dark'\n ? '0 4px 12px rgba(0, 0, 0, 0.15)'\n : '0 4px 12px rgba(0, 0, 0, 0.08)',\n }\n : {}),\n ...(!isLast ? { borderBottom: 'var(--sc-content-item-divider, none)' } : {}),\n });\n\n // Header styles\n const headerStyle = styleMap({\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n width: '100%',\n padding: 'var(--sc-content-item-padding, 12px 16px)',\n border: 'none',\n cursor: 'pointer',\n fontSize: 'var(--sc-content-item-font-size, 15px)',\n fontWeight: '500',\n fontFamily: 'inherit',\n textAlign: 'left',\n transition: 'background-color 0.15s ease',\n backgroundColor: isHovered ? 'var(--sc-content-background-hover)' : 'transparent',\n color: 'var(--sc-content-text-color)',\n });\n\n // Chevron styles\n const chevronStyle = styleMap({\n fontSize: '20px',\n transition: 'transform 0.2s ease',\n marginLeft: 'auto',\n flexShrink: '0',\n color: 'var(--sc-content-chevron-color, currentColor)',\n transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',\n });\n\n // Body styles\n const bodyStyle = styleMap({\n overflow: 'hidden',\n transition: 'max-height 0.25s ease, padding-bottom 0.25s ease',\n padding: 'var(--sc-content-body-padding, 0 16px 12px 16px)',\n color: 'var(--sc-content-text-secondary-color)',\n maxHeight: isExpanded ? '500px' : '0',\n paddingBottom: isExpanded ? '16px' : '0',\n });\n\n // Description styles\n const descriptionStyle = styleMap({\n fontSize: 'var(--sc-content-body-font-size, 14px)',\n lineHeight: '1.5',\n margin: '0',\n });\n\n // CTA / link button styles\n const linkButtonStyle = styleMap({\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n marginTop: '10px',\n padding: '6px 12px',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '13px',\n fontWeight: '500',\n cursor: 'pointer',\n border: 'none',\n transition: 'background-color 0.15s ease',\n backgroundColor: `var(--sc-color-primary, ${TOKEN_PURPLE_4})`,\n color: '#ffffff',\n });\n\n // Icon styles\n const iconStyle = styleMap({\n fontSize: '16px',\n flexShrink: '0',\n });\n\n // Anchor click handler\n const onLinkClick = (e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n if (isFocusAction && anchor) {\n this.#handleFocusAnchor(anchor);\n } else if (effectiveHref) {\n this.#handleNavigate(effectiveHref, external ?? false);\n }\n };\n\n return html`\n <div\n style=${itemStyle}\n data-nav-tip-id=${id}\n >\n <button\n type=\"button\"\n style=${headerStyle}\n aria-expanded=${isExpanded}\n @click=${() => this.#handleToggle(id)}\n @mouseenter=${() => {\n this._hoveredId = id;\n }}\n @mouseleave=${() => {\n this._hoveredId = null;\n }}\n >\n ${icon ? html`<span style=${iconStyle}>${unsafeHTML(renderIcon(icon))}</span>` : nothing}\n <span>${title}</span>\n <span style=${chevronStyle}>${'\\u203A'}</span>\n </button>\n <div style=${bodyStyle} aria-hidden=${!isExpanded}>\n <p style=${descriptionStyle}>${description}</p>\n ${\n hasAction\n ? html`\n <a\n href=${effectiveHref || '#'}\n style=${linkButtonStyle}\n target=${external ? '_blank' : nothing}\n rel=${external ? 'noopener noreferrer' : nothing}\n @click=${onLinkClick}\n >${ctaLabel}</a>\n `\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n // ---------- Render --------------------------------------------------------\n\n override render() {\n const visibleTips = this.#getVisibleTips();\n const theme = this.#getResolvedTheme();\n\n const containerStyle = styleMap({\n fontFamily: 'var(--sc-font-family, system-ui, -apple-system, sans-serif)',\n maxWidth: '100%',\n overflow: 'hidden',\n backgroundColor: 'transparent',\n color: 'inherit',\n });\n\n const accordionStyle = styleMap({\n display: 'flex',\n flexDirection: 'column',\n gap: 'var(--sc-content-item-gap, 6px)',\n });\n\n const categoryHeaderStyle = styleMap({\n fontSize: 'var(--sc-content-category-font-size, 12px)',\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n padding: 'var(--sc-content-category-padding, 8px 4px 4px 4px)',\n color: theme === 'dark' ? TOKEN_SLATE_GREY_8 : TOKEN_SLATE_GREY_7,\n });\n\n const emptyStateStyle = styleMap({\n fontSize: '13px',\n padding: '16px',\n textAlign: 'center',\n color: theme === 'dark' ? TOKEN_SLATE_GREY_7 : TOKEN_SLATE_GREY_8,\n });\n\n // Empty state\n if (visibleTips.length === 0) {\n return html`\n <div\n style=${containerStyle}\n data-adaptive-id=${this.instanceId}\n data-adaptive-type=\"adaptive-nav\"\n >\n <div style=${emptyStateStyle}>\n You're all set for now! We'll share helpful tips here when they're relevant to what\n you're doing.\n </div>\n </div>\n `;\n }\n\n // Group by category\n const categoryGroups = new Map<string | undefined, NavTipAction[]>();\n for (const tip of visibleTips) {\n const cat = tip.config.category;\n if (!categoryGroups.has(cat)) {\n categoryGroups.set(cat, []);\n }\n categoryGroups.get(cat)!.push(tip);\n }\n\n const hasCategories = visibleTips.some((t) => t.config.category);\n\n return html`\n <div\n style=${containerStyle}\n data-adaptive-id=${this.instanceId}\n data-adaptive-type=\"adaptive-nav\"\n >\n <div style=${accordionStyle}>\n ${\n hasCategories\n ? Array.from(categoryGroups.entries()).map(\n ([category, items]) => html`\n ${\n category\n ? html`<div style=${categoryHeaderStyle} data-category-header=${category}>${category}</div>`\n : nothing\n }\n ${items.map((tip, idx) => this.#renderTipItem(tip, idx, items.length))}\n `\n )\n : visibleTips.map((tip, idx) => this.#renderTipItem(tip, idx, visibleTips.length))\n }\n </div>\n </div>\n `;\n }\n}\n\n// ============================================================================\n// Custom element registration\n// ============================================================================\n\nconst TAG_NAME = 'syntro-nav-tips';\n\nexport function registerNavWidgetLit(): void {\n if (typeof window === 'undefined') return;\n if (!customElements.get(TAG_NAME)) {\n customElements.define(TAG_NAME, NavWidgetLit);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'syntro-nav-tips': NavWidgetLit;\n }\n}\n", "/**\n * Adaptive Nav - Runtime Module\n *\n * Runtime manifest for the navigation tips accordion adaptive.\n * Includes widget-based nav tips and navigation action executors\n * (scrollTo, navigate) previously in adaptive-navigation.\n */\n\nimport { NavMountableWidget } from './NavWidget';\nimport { registerNavWidgetLit } from './NavWidgetLit';\nimport type {\n ActionExecutor,\n ExecutorResult,\n NavConfig,\n NavigateAction,\n NavTipAction,\n NavWidgetRuntime,\n ScrollToAction,\n} from './types';\n\n// ============================================================================\n// Navigation Action Executors (merged from adaptive-navigation)\n// ============================================================================\n\n/**\n * Execute a scrollTo action\n */\nexport const executeScrollTo: ActionExecutor<ScrollToAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n const anchorEl = context.resolveAnchor(action.anchorId);\n if (!anchorEl) {\n console.error(\n `[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`\n );\n return { cleanup: () => {} };\n }\n\n // Scroll to element\n anchorEl.scrollIntoView({\n behavior: action.behavior ?? 'smooth',\n block: action.block ?? 'center',\n inline: action.inline ?? 'nearest',\n });\n\n context.publishEvent('action.applied', {\n id: context.generateId(),\n kind: 'navigation:scrollTo',\n anchorId: action.anchorId,\n behavior: action.behavior ?? 'smooth',\n });\n\n return {\n cleanup: () => {\n // Optionally restore scroll position on revert\n },\n };\n};\n\n/**\n * Try to navigate using the host framework's native router.\n * Returns true if a framework router handled the navigation,\n * false if no framework was detected (caller should use pushState or location.href).\n *\n * Using the native router preserves SPA behavior (no full reload),\n * layout state, scroll position, and framework-specific features\n * (RSC streaming, view transitions, etc.).\n */\nexport function navigateWithFrameworkRouter(url: string): boolean {\n if (typeof window === 'undefined') return false;\n const w = window as any;\n\n // Next.js \uFFFD\uFFFD window.next.router.push() triggers App Router navigation\n // with RSC fetch, layout preservation, and loading states\n try {\n const nextRouter = w.next?.router;\n if (nextRouter?.push) {\n nextRouter.push(url);\n return true;\n }\n } catch {\n /* fall through */\n }\n\n // Nuxt 3 \u2014 useRouter() isn't accessible from outside Vue, but\n // $nuxt.$router (Nuxt 2) or window.__NUXT__?.hooks (Nuxt 3) + navigateTo\n // aren't reliably exposed. Nuxt 2 exposes $nuxt.$router.push().\n try {\n if (w.$nuxt?.$router?.push) {\n w.$nuxt.$router.push(url);\n return true;\n }\n } catch {\n /* fall through */\n }\n\n // Angular \u2014 Angular Router isn't exposed on window by default.\n // The most reliable approach is to detect Angular and use location.href.\n if (w.ng || w.getAllAngularRootElements || document.querySelector('[ng-version]')) {\n window.location.href = url;\n return true;\n }\n\n // SvelteKit \u2014 goto() isn't on window, but __SVELTEKIT_DATA__ confirms the framework.\n if (w.__SVELTEKIT_DATA__ || document.body?.hasAttribute('data-sveltekit')) {\n window.location.href = url;\n return true;\n }\n\n // Astro (View Transitions) \u2014 no client-side router API exposed\n if (document.querySelector('[data-astro-transition-fallback]')) {\n window.location.href = url;\n return true;\n }\n\n return false;\n}\n\n/**\n * Check if a URL is same-origin as the current page.\n * Relative URLs (e.g. \"/dashboard\") are always same-origin.\n */\nfunction isSameOrigin(url: string): boolean {\n try {\n const parsed = new URL(url, window.location.origin);\n return parsed.origin === window.location.origin;\n } catch {\n // If URL parsing fails, fall back to full navigation\n return false;\n }\n}\n\n/**\n * Execute a navigate action\n */\nexport const executeNavigate: ActionExecutor<NavigateAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n // Validate URL to prevent javascript: URLs\n const url = action.url.trim();\n if (url.toLowerCase().startsWith('javascript:')) {\n throw new Error('javascript: URLs are not allowed');\n }\n\n const target = action.target ?? '_self';\n\n context.publishEvent('action.applied', {\n id: context.generateId(),\n kind: 'navigation:navigate',\n url: action.url,\n target,\n });\n\n if (target === '_blank') {\n // Open in new tab\n window.open(url, '_blank', 'noopener,noreferrer');\n } else if (!action.forceFullNavigation && isSameOrigin(url)) {\n // Try the host framework's native router first (Next.js, Nuxt, Angular, etc.)\n // Falls back to pushState for vanilla SPAs, or location.href as last resort.\n if (!navigateWithFrameworkRouter(url)) {\n window.history.pushState(null, '', url);\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n } else {\n // Full navigation for cross-origin URLs or when explicitly requested\n window.location.href = url;\n }\n\n return {\n cleanup: () => {\n // Navigation cannot be reverted\n },\n };\n};\n\n// ============================================================================\n// Lit Mountable Widget\n// ============================================================================\n\n/**\n * NavWidgetLitMountable \u2014 Mounts the `<syntro-nav-tips>` Lit web component.\n *\n * Drop-in companion to NavMountableWidget that avoids React/ReactDOM entirely.\n * Self-registers the custom element on first use.\n */\nexport const NavWidgetLitMountable = {\n mount(\n container: HTMLElement,\n config?: NavConfig & { runtime?: NavWidgetRuntime; instanceId?: string }\n ) {\n registerNavWidgetLit();\n\n const el = document.createElement('syntro-nav-tips');\n\n const {\n runtime,\n instanceId = 'nav-widget',\n ...navConfig\n } = config ?? {\n expandBehavior: 'single' as const,\n theme: 'auto' as const,\n actions: [],\n };\n\n // Assign structured props as JS properties (not HTML attributes)\n Object.assign(el, {\n config: navConfig,\n runtime,\n instanceId,\n });\n\n container.appendChild(el);\n\n return () => el.remove();\n },\n};\n\n// ============================================================================\n// Executor Definitions for Registration\n// ============================================================================\n\n/**\n * All executors provided by this app.\n * These are registered with the runtime's ExecutorRegistry.\n */\nexport const executors = [\n { kind: 'navigation:scrollTo', executor: executeScrollTo },\n { kind: 'navigation:navigate', executor: executeNavigate },\n] as const;\n\n// ============================================================================\n// App Runtime Manifest\n// ============================================================================\n\n/**\n * Runtime manifest for adaptive-nav.\n *\n * Provides:\n * - Navigation action executors (scrollTo, navigate)\n * - Widget-based nav tips accordion (compositional nav:tip actions)\n */\nexport const runtime = {\n id: 'adaptive-nav',\n version: '2.0.0',\n name: 'Navigation Tips',\n description: 'Navigation actions and accordion-based tips with per-item conditional visibility',\n\n /**\n * Navigation action executors (scrollTo, navigate).\n */\n executors,\n\n /**\n * Widget definitions for the runtime's WidgetRegistry.\n */\n widgets: [\n {\n id: 'adaptive-nav:tips',\n component: NavMountableWidget,\n metadata: {\n name: 'Navigation Tips',\n description: 'Accordion of contextual navigation tips with per-item visibility',\n icon: '\\u{1F9ED}',\n },\n },\n ],\n\n /**\n * Extract notify watcher entries from tile config props.\n * The runtime evaluates these continuously (even with drawer closed)\n * and publishes nav:tip_revealed when triggerWhen transitions false \u2192 true.\n */\n notifyWatchers(props: Record<string, unknown>) {\n const actions = (props.actions ?? []) as NavTipAction[];\n return actions\n .filter((a) => a.notify && a.triggerWhen)\n .map((a) => ({\n id: `nav:${a.config.id}`,\n strategy: a.triggerWhen!,\n eventName: 'nav:tip_revealed',\n eventProps: {\n tipId: a.config.id,\n title: a.notify!.title,\n body: a.notify!.body,\n icon: a.notify!.icon,\n },\n }));\n },\n};\n\nexport default runtime;\n", "/**\n * CDN Entry Point for Adaptive Nav\n *\n * This module is bundled for CDN delivery and self-registers with the global\n * SynOS app registry when loaded dynamically via the AppLoader.\n */\n\nimport NavEditor, { editorPanel } from './editor';\nimport { executors, runtime } from './runtime';\n\n/**\n * App manifest for registry registration.\n * Follows the AppManifest interface expected by AppLoader/AppRegistry.\n */\nexport const manifest = {\n id: 'adaptive-nav',\n version: runtime.version,\n name: runtime.name,\n description: runtime.description,\n runtime: {\n actions: executors.map(({ kind, executor }) => ({\n kind,\n executor,\n })),\n widgets: runtime.widgets,\n notifyWatchers: runtime.notifyWatchers,\n },\n editor: {\n component: NavEditor,\n panel: editorPanel,\n getActionLabel(action: Record<string, unknown>) {\n const config = (action.config as Record<string, unknown>) || {};\n return (config.title as string) || (action.kind as string) || 'nav:tip';\n },\n },\n metadata: {\n isBuiltIn: false,\n },\n};\n\n/**\n * Self-register with global registry if available.\n * This happens when loaded via script tag (UMD).\n */\nif (typeof window !== 'undefined') {\n const registry = (window as any).SynOS?.appRegistry;\n if (registry && typeof registry.register === 'function') {\n registry.register(manifest);\n }\n}\n\nexport default manifest;\n"],
|
|
5
|
-
"mappings": "sZAAO,SAASA,KAAMC,EAAS,CAC3B,OAAOA,EAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,CAC3C,CCDY,SAASC,IAAK,CACZ,OAAQ,OAAO,MAAU,KAAe,MAAM,OAAU,CAAC,CAC3D,CACA,SAASC,GAAKC,EAAMC,EAAOC,EAAK,CAC9B,IAAIC,EAAIL,GAAG,EACPM,EAAIH,GAAS,CAAC,EACdI,EAAID,EAAE,SACV,cAAOA,EAAE,SACLF,IAAQ,SAAWE,EAAE,IAAMF,GACxB,MAAM,QAAQG,CAAC,EAClBF,EAAE,cAAc,MAAM,KAAM,CAACH,EAAMI,CAAC,EAAE,OAAOC,CAAC,CAAC,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,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EAIaC,EAAY,CACrB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,GAAI,UACJ,GAAI,UACJ,GAAI,SACR,EAIaC,EAAQ,CACjB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,EAAS,CAClB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,EAAM,CACf,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAO,CAChB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAS,CAClB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,EAAS,CAClB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAO,CAChB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EAIaC,GAAS,CAClB,KAAM,CACF,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,S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EAAS,UAAa,YAC3CA,EAAS,SAASR,EAAQ,CAE9B,CAEA,IAAOS,GAAQT",
|
|
6
|
-
"names": ["cn", "classes", "_R", "_jsx", "type", "props", "key", "R", "p", "c", "jsx", "jsxs", "Fragment", "_R", "react_default", "_", "k", "useState", "useEffect", "useMemo", "useCallback", "useRef", "useReducer", "_R", "useId", "_R", "createElement", "_R", "forwardRef", "_R", "_r", "_R", "Fragment", "Suspense", "Children", "Component", "PureComponent", "_RD", "react_dom_default", "_", "k", "CSS_SELECTOR_TYPE", "libraryName", "showWarning", "id", "args", "DEFAULT_OPTIONS", "CSS_SELECTOR_TYPE", "isRegExp", "input", "wildcardToRegExp", "input", "createPatternMatcher", "list", "matchFunctions", "item", "isRegExp", "result", "showWarning", "re", "matchFunction", "INVALID_ID_RE", "INVALID_CLASS_RE", "SELECTOR_PATTERN", "CSS_SELECTOR_TYPE", "attributeBlacklistMatch", "createPatternMatcher", "ESCAPED_COLON", "mergeClasses", "classes", "className", "index", "array", "toKebabCase", "string", "toCamelCase", "string", "match", "p1", "p2", "toPascalCase", "string", "camelCase", "toCamelCase", "defaultAttributes", "hasA11yProp", "props", "prop", "Icon", "forwardRef", "color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children", "iconNode", "rest", "ref", "createElement", "defaultAttributes", "mergeClasses", "hasA11yProp", "tag", "attrs", "createLucideIcon", "iconName", "iconNode", "Component", "forwardRef", "className", "props", "ref", "createElement", "Icon", "mergeClasses", "toKebabCase", "toPascalCase", "__iconNode", "Check", "createLucideIcon", "DetectionBadge", "found", "onClick", "title", "textColor", "dotColor", "classes", "cn", "dot", "jsx", "jsxs", "e", "DismissedSection", "count", "children", "isOpen", "setIsOpen", "useState", "jsxs", "e", "jsx", "EditorBody", "children", "jsx", "EditorCard", "children", "itemKey", "onClick", "onMouseEnter", "onMouseLeave", "className", "validated", "jsx", "e", "cn", "EditorHeader", "title", "subtitle", "jsxs", "jsx", "EditorInput", "label", "className", "id", "props", "generatedId", "useId", "inputId", "jsxs", "jsx", "cn", "EditorLayout", "children", "jsx", "base", "brand", "slateGrey", "green", "yellow", "red", "blue", "orange", "purple", "pink", "legacy", "text", "background", "border", "button", "badge", "badgeBanner", "alert", "tag", "menu", "inputDropdown", "inputField", "toggle", "checkbox", "avatar", "progressBarSlider", "card", "sidebar", "modal", "tab", "table", "breadcrumbs", "loadingIndicator", "datePicker", "scroll", "colors", "shadows", "focusRings", "backdropBlur", "overlay", "glowShadows", "elevationShadows", "syntroPreset", "colors", "shadows", "glowShadows", "elevationShadows", "focusRings", "backdropBlur", "overlay", "panelBackground", "panelShadows", "panelBackdropBlur", "fab", "base", "brand", "panelBehavior", "panelShell", "panel_shell_default", "MIN_WIDTH", "panel_shell_default", "MIN_HEIGHT", "FAB_SIZE", "FAB_INSET", "SNAP_THRESHOLD", "DRAG_THRESHOLD", "HANDLE_SIZE", "RESIZE_HANDLES", "HANDLE_SIZE", "EmptyState", "message", "jsx", "GroupHeader", "label", "count", "className", "jsxs", "cn", "jsx", "ProgressBar", "current", "target", "pct", "jsxs", "jsx", "cn", "JourneyNode", "cs", "isLast", "hasProgress", "inProgress", "Check", "TriggerJourney", "status", "conditions", "allPassed", "c", "isMulti", "i", "DEFAULTS", "panel_shell_default", "HANDLE_SIZE", "formatOperator", "op", "humanizeKey", "key", "cleanUrl", "url", "PAGE_VIEW_RE", "CLICK_RE", "formatConditionLabel", "condition", "accumulatorCount", "target", "current", "humanized", "instruction", "shortLabel", "topic", "lastWord", "w", "cleaned", "rawAnchor", "anchorId", "state", "eventName", "val", "parts", "label", "threshold", "inverted", "limit", "routeId", "getRuntime", "rt", "evaluateTriggerWhen", "triggerWhen", "runtime", "result", "conditions", "condition", "passed", "accCount", "formatted", "formatConditionLabel", "useTriggerWhenStatus", "items", "statuses", "setStatuses", "useState", "itemsRef", "useRef", "evaluate", "useCallback", "map", "item", "useEffect", "unsubs", "interval", "u", "action_step_field_mapping_default", "INTERACTIVE_TAGS", "action_step_field_mapping_default", "INTERACTIVE_ROLES", "truncate", "text", "max", "isRuleStrategy", "s", "describeTrigger", "triggerWhen", "pages", "anchors", "rule", "condition", "parts", "summarizeNavItem", "item", "icon", "title", "ACTION_NAMESPACES", "isOwnAction", "action", "ns", "isRuleStrategy", "s", "extractTargetingInfo", "triggerWhen", "pagePatterns", "anchorSelectors", "rule", "cond", "c", "hasTargeting", "extractFirstPage", "extractFirstAnchor", "savePendingHighlight", "selector", "flattenItems", "config", "isOwnAction", "tip", "i", "summarizeNavItem", "describeTrigger", "filterConfig", "dismissedKeys", "ownActions", "_", "useDetection", "items", "getCurrentRoute", "detectionMap", "setDetectionMap", "useState", "itemsRef", "useRef", "useEffect", "runDetection", "map", "currentPath", "item", "targeting", "pageMatch", "pattern", "anchorFound", "element", "interval", "NavEditor", "onChange", "editor", "typedConfig", "setDismissedKeys", "editingKey", "setEditingKey", "_previewMode", "setPreviewMode", "_hoveredKey", "setHoveredKey", "mode", "allKeys", "empty", "initialConsumed", "allItems", "activeItems", "dismissedItems", "totalLinks", "triggerWhenItems", "useMemo", "triggerWhenStatuses", "useTriggerWhenStatus", "foundCount", "handleDismiss", "useCallback", "key", "prev", "next", "handleRestore", "handleCardBodyClick", "handleTriggerClick", "pageUrl", "handleBackToList", "_handleBeforeAfter", "filtered", "handleFieldChange", "index", "field", "value", "link", "otherActions", "a", "updated", "_handlePublish", "handleBadgeClick", "handleCardHover", "handleCardLeave", "renderEditFields", "it", "jsxs", "jsx", "EditorInput", "e", "subtitle", "EditorLayout", "EditorHeader", "EditorBody", "editIndex", "editItem", "Fragment", "EmptyState", "GroupHeader", "detection", "EditorCard", "DetectionBadge", "TriggerJourney", "DismissedSection", "editorPanel", "editor_default", "NavEditor", "_RD", "client_default", "_", "k", "createRoot", "EMOJI_SVG_MAP", "renderIcon", "emoji", "escapeHtml", "str", "baseStyles", "themeStyles", "purple", "slateGrey", "routeMatchesCurrent", "routes", "current", "route", "routePath", "pulseElement", "el", "keyframes", "NavTipItem", "item", "isExpanded", "isLast", "onToggle", "onNavigate", "onFocusAnchor", "theme", "isHovered", "setIsHovered", "useState", "colors", "title", "description", "href", "icon", "external", "anchor", "itemStyle", "headerStyle", "chevronStyle", "bodyStyle", "effectiveHref", "isSamePage", "hasSelector", "isFocusAction", "hasAction", "handleLinkClick", "e", "ctaLabel", "jsxs", "jsx", "NavWidget", "config", "runtime", "instanceId", "renderTick", "forceUpdate", "useReducer", "x", "expandedIds", "setExpandedIds", "useEffect", "visibleTips", "useMemo", "tip", "categoryGroups", "groups", "cat", "hasCategories", "t", "resolvedTheme", "handleToggle", "useCallback", "id", "prev", "wasExpanded", "next", "prevId", "handleNavigate", "normalizedHref", "url", "navigateWithFrameworkRouter", "handleFocusAnchor", "containerStyle", "categoryHeaderStyle", "emptyStateStyle", "renderItems", "items", "index", "category", "react_default", "NavMountableWidget", "container", "navConfig", "createRoot", "root", "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", "adoptStyles", "renderRoot", "styles", "supportsAdoptingStyleSheets", "adoptedStyleSheets", "map", "s", "CSSStyleSheet", "styleSheet", "style", "document", "createElement", "nonce", "global", "setAttribute", "textContent", "cssText", "appendChild", "getCompatibleStyle", "sheet", "rule", "cssRules", "unsafeCSS", "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", "PartType", "ATTRIBUTE", "CHILD", "PROPERTY", "BOOLEAN_ATTRIBUTE", "EVENT", "ELEMENT", "directive", "c", "values", "_$litDirective$", "Directive", "_partInfo", "_$isConnected", "this", "_$parent", "part", "parent", "attributeIndex", "__part", "__attributeIndex", "props", "update", "_part", "render", "important", "importantFlag", "styleMap", "directive", "Directive", "partInfo", "super", "type", "PartType", "ATTRIBUTE", "name", "strings", "length", "Error", "styleInfo", "Object", "keys", "reduce", "style", "prop", "value", "includes", "replace", "toLowerCase", "part", "element", "this", "_previousStyleProperties", "Set", "render", "delete", "removeProperty", "add", "isImportant", "endsWith", "setProperty", "slice", "noChange", "UnsafeHTMLDirective", "Directive", "partInfo", "super", "this", "_value", "nothing", "type", "PartType", "CHILD", "Error", "constructor", "directiveName", "value", "_templateResult", "noChange", "strings", "raw", "_$litType$", "resultType", "values", "unsafeHTML", "directive", "TOKEN_PURPLE_4", "TOKEN_SLATE_GREY_7", "TOKEN_SLATE_GREY_8", "EMOJI_SVG_MAP", "escapeHtml", "str", "renderIcon", "emoji", "routeMatchesCurrent", "routes", "current", "route", "routePath", "pulseElement", "el", "keyframes", "resolveTheme", "theme", "_contextUnsub", "_accumulatorUnsub", "_NavWidgetLit_instances", "subscribeRuntime_fn", "unsubscribeRuntime_fn", "getVisibleTips_fn", "getResolvedTheme_fn", "handleToggle_fn", "handleNavigate_fn", "handleFocusAnchor_fn", "publishEvent_fn", "renderTipItem_fn", "NavWidgetLit", "i", "__privateAdd", "__privateMethod", "changed", "visibleTips", "containerStyle", "o", "accordionStyle", "categoryHeaderStyle", "emptyStateStyle", "b", "categoryGroups", "tip", "cat", "hasCategories", "t", "category", "items", "A", "idx", "__privateSet", "_a", "_b", "__privateGet", "id", "wasExpanded", "next", "prevId", "href", "external", "normalized", "url", "navigateWithFrameworkRouter", "anchor", "name", "props", "index", "total", "title", "description", "icon", "_cat", "isExpanded", "isLast", "isHovered", "effectiveHref", "isSamePage", "hasSelector", "isFocusAction", "hasAction", "ctaLabel", "itemStyle", "headerStyle", "chevronStyle", "bodyStyle", "descriptionStyle", "linkButtonStyle", "iconStyle", "onLinkClick", "e", "executeScrollTo", "action", "context", "anchorEl", "navigateWithFrameworkRouter", "url", "w", "nextRouter", "isSameOrigin", "executeNavigate", "target", "executors", "executeScrollTo", "executeNavigate", "runtime", "NavMountableWidget", "props", "manifest", "runtime", "executors", "kind", "executor", "editor_default", "editorPanel", "action", "registry", "cdn_default"]
|
|
4
|
+
"sourcesContent": ["export function cn(...classes) {\n return classes.filter(Boolean).join(' ');\n}\n", "\n function _R() {\n return (typeof SynOS !== 'undefined' && SynOS.React) || {};\n }\n function _jsx(type, props, key) {\n var R = _R();\n var p = props || {};\n var c = p.children;\n delete p.children;\n if (key !== undefined) p.key = key;\n return Array.isArray(c)\n ? R.createElement.apply(null, [type, p].concat(c))\n : c !== undefined\n ? R.createElement(type, p, c)\n : R.createElement(type, p);\n }\n export var jsx = _jsx;\n export var jsxs = _jsx;\n export var Fragment = _R().Fragment;\n ", "\n function _R() {\n return (typeof SynOS !== 'undefined' && SynOS.React) || {};\n }\n\n // Default export \u2014 lazy proxy for React.* access\n export default new Proxy({}, { get: function(_, k) { return _R()[k]; } });\n\n // Hooks \u2014 lazy function wrappers (resolve at call time)\n export function useState() { return _R().useState.apply(null, arguments); }\n export function useEffect() { return _R().useEffect.apply(null, arguments); }\n export function useMemo() { return _R().useMemo.apply(null, arguments); }\n export function useCallback() { return _R().useCallback.apply(null, arguments); }\n export function useRef() { return _R().useRef.apply(null, arguments); }\n export function useContext() { return _R().useContext.apply(null, arguments); }\n export function useReducer() { return _R().useReducer.apply(null, arguments); }\n export function useLayoutEffect() { return _R().useLayoutEffect.apply(null, arguments); }\n export function useId() { return _R().useId.apply(null, arguments); }\n export function useSyncExternalStore() { return _R().useSyncExternalStore.apply(null, arguments); }\n export function useDebugValue() { return _R().useDebugValue.apply(null, arguments); }\n export function useInsertionEffect() { return _R().useInsertionEffect.apply(null, arguments); }\n\n // Creation APIs \u2014 lazy function wrappers\n export function createElement() { return _R().createElement.apply(null, arguments); }\n export function createContext() { return _R().createContext.apply(null, arguments); }\n export function forwardRef() { return _R().forwardRef.apply(null, arguments); }\n export function memo() { return _R().memo.apply(null, arguments); }\n export function lazy() { return _R().lazy.apply(null, arguments); }\n export function isValidElement() { return _R().isValidElement.apply(null, arguments); }\n export function cloneElement() { return _R().cloneElement.apply(null, arguments); }\n\n // Component types \u2014 resolved at module eval (runtime loads first)\n var _r = _R();\n export var Fragment = _r.Fragment;\n export var Suspense = _r.Suspense;\n export var Children = _r.Children;\n export var Component = _r.Component;\n export var PureComponent = _r.PureComponent;\n ", "\n function _RD() {\n return (typeof SynOS !== 'undefined' && SynOS.ReactDOM) || {};\n }\n export default new Proxy({}, { get: function(_, k) { return _RD()[k]; } });\n export function createRoot() { return _RD().createRoot.apply(null, arguments); }\n export function hydrateRoot() { return _RD().hydrateRoot.apply(null, arguments); }\n export function createPortal() { return _RD().createPortal.apply(null, arguments); }\n export function flushSync() { return _RD().flushSync.apply(null, arguments); }\n ", "declare const opaqueId: unique symbol;\n\ndeclare interface Tagged<Token> {\n readonly [opaqueId]: Token;\n}\n\nexport type Opaque<Type, Token = unknown> = Type & Tagged<Token>;\n\nexport type ObjectValues<T> = T[keyof T];\n\n// TODO rename to \"CssSelector\"\nexport type CssSelectorGenerated = Opaque<string, \"CssSelector\">;\n\nexport const OPERATOR = {\n NONE: \"\",\n DESCENDANT: \" \",\n CHILD: \" > \",\n} as const;\n\nexport type OperatorValue = ObjectValues<typeof OPERATOR>;\n\nexport interface ElementSelectorData {\n value: CssSelectorGenerated;\n include: boolean;\n}\n\nexport interface ElementData {\n element: Element;\n operator: OperatorValue;\n selectors: Partial<Record<CssSelectorType, ElementSelectorData[]>>;\n}\n\nexport type CssSelector = string;\nexport type CssSelectors = CssSelector[];\n\ntype CssSelectorMatchFn = (input: string) => boolean;\nexport type CssSelectorMatch = RegExp | string | CssSelectorMatchFn;\n\nexport const CSS_SELECTOR_TYPE = {\n id: \"id\",\n class: \"class\",\n tag: \"tag\",\n attribute: \"attribute\",\n nthchild: \"nthchild\",\n nthoftype: \"nthoftype\",\n} as const;\n\nexport type CssSelectorType = ObjectValues<typeof CSS_SELECTOR_TYPE>;\nexport type CssSelectorTypes = CssSelectorType[];\n\nexport type CssSelectorsByType = Partial<Record<CssSelectorType, CssSelectors>>;\n\nexport type CssSelectorData = Partial<\n Record<CssSelectorType, string[] | string[][]>\n>;\n\nexport type CssSelectorGeneratorOptionsInput = Partial<{\n // List of selector types to use. They will be prioritised by their order.\n selectors: CssSelectorTypes;\n // List of selectors that should be prioritised.\n whitelist: CssSelectorMatch[];\n // List of selectors that should be ignored.\n blacklist: CssSelectorMatch[];\n // Root element inside which the selector will be generated. If not set, the document root will be used.\n root: ParentNode | null;\n // If set to `true`, the generator will test combinations of selectors of single type (e.g. multiple class selectors).\n combineWithinSelector: boolean;\n // If set to `true`, the generator will try to test combinations of selectors of different types (e.g. tag + class name).\n combineBetweenSelectors: boolean;\n // If set to `true`, all generated selectors will include the TAG part. Even if tag selector type is not included in `selectors` option.\n includeTag: boolean;\n // Maximum number of combinations of a selector type. This is handy for performance reasons, e.g. when elements have too many classnames.\n maxCombinations: number;\n // Maximum number of selector candidates to be tested for each element. This is handy for performance reasons, e.g. when elements can produce large number of combinations of various types of selectors.\n maxCandidates: number;\n // Experimental. If set to `true` and the \"root\" option is set, the fallback selectors will use \":scope\" pseudo-class to make the selectors shorter and simpler.\n useScope: boolean;\n // Limits the number of results (selectors) to be generated.\n maxResults: number;\n}>;\n\nexport type CssSelectorGeneratorOptions = Required<\n Omit<CssSelectorGeneratorOptionsInput, \"selectors\"> & {\n selectors: CssSelectorTypes;\n }\n>;\n\nexport interface IdentifiableParent {\n foundElements: Element[];\n selector: CssSelector;\n}\n\nexport type PatternMatcher = (input: string) => boolean;\n", "const libraryName = \"CssSelectorGenerator\";\n\n/**\n * Convenient wrapper for `console.warn` using consistent formatting.\n */\nexport function showWarning(id = \"unknown problem\", ...args: unknown[]): void {\n // eslint-disable-next-line no-console\n console.warn(`${libraryName}: ${id}`, ...args);\n}\n", "import {\n CSS_SELECTOR_TYPE,\n CssSelectorGeneratorOptions,\n CssSelectorMatch,\n CssSelectorTypes,\n} from \"./types.js\";\nimport { getRootNode } from \"./utilities-dom.js\";\nimport { isEnumValue } from \"./utilities-typescript.js\";\nimport { showWarning } from \"./utilities-messages.js\";\n\nexport const DEFAULT_OPTIONS = {\n selectors: [\n CSS_SELECTOR_TYPE.id,\n CSS_SELECTOR_TYPE.class,\n CSS_SELECTOR_TYPE.tag,\n CSS_SELECTOR_TYPE.attribute,\n ] as CssSelectorTypes,\n // if set to true, always include tag name\n includeTag: false,\n whitelist: [] as CssSelectorMatch[],\n blacklist: [] as CssSelectorMatch[],\n combineWithinSelector: true,\n combineBetweenSelectors: true,\n root: null,\n maxCombinations: Number.POSITIVE_INFINITY,\n maxCandidates: Number.POSITIVE_INFINITY,\n useScope: false,\n} as CssSelectorGeneratorOptions;\n\n/**\n * Makes sure returned value is a list containing only valid selector types.\n * @param input\n */\nexport function sanitizeSelectorTypes(input: unknown): CssSelectorTypes {\n if (!Array.isArray(input)) {\n return [];\n }\n return input.filter((item) => isEnumValue(CSS_SELECTOR_TYPE, item));\n}\n\n/**\n * Checks whether provided value is of type RegExp.\n */\nexport function isRegExp(input: unknown): input is RegExp {\n return input instanceof RegExp;\n}\n\n/**\n * Checks whether provided value is usable in whitelist or blacklist.\n * @param input\n */\nexport function isCssSelectorMatch(input: unknown): input is CssSelectorMatch {\n return [\"string\", \"function\"].includes(typeof input) || isRegExp(input);\n}\n\n/**\n * Converts input to a list of valid values for whitelist or blacklist.\n */\nexport function sanitizeCssSelectorMatchList(\n input: unknown,\n): CssSelectorMatch[] {\n if (!Array.isArray(input)) {\n return [];\n }\n return input.filter(isCssSelectorMatch);\n}\n\n/**\n * Checks whether provided value is valid Node.\n */\nexport function isNode(input: unknown): input is Node {\n return input instanceof Node;\n}\n\n/**\n * Checks whether provided value is valid ParentNode.\n */\nexport function isParentNode(input: unknown): input is ParentNode {\n const validParentNodeTypes: number[] = [\n Node.DOCUMENT_NODE,\n Node.DOCUMENT_FRAGMENT_NODE, // this includes Shadow DOM root\n Node.ELEMENT_NODE,\n ];\n\n return isNode(input) && validParentNodeTypes.includes(input.nodeType);\n}\n\n/**\n * Makes sure that the root node in options is valid.\n */\nexport function sanitizeRoot(input: unknown, element: Element): ParentNode {\n if (isParentNode(input)) {\n if (!input.contains(element)) {\n showWarning(\n \"element root mismatch\",\n \"Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended.\",\n );\n }\n return input;\n }\n\n const rootNode = element.getRootNode({ composed: false });\n if (isParentNode(rootNode)) {\n if (rootNode !== document) {\n showWarning(\n \"shadow root inferred\",\n \"You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended.\",\n );\n }\n return rootNode;\n }\n\n return getRootNode(element);\n}\n\n/**\n * Makes sure that the output is a number, usable as `maxResults` option in\n * powerset generator.\n */\nexport function sanitizeMaxNumber(input?: unknown): number {\n return typeof input === \"number\" ? input : Number.POSITIVE_INFINITY;\n}\n\n/**\n * Makes sure the options object contains all required keys.\n */\nexport function sanitizeOptions(\n element: Element,\n custom_options = {},\n): CssSelectorGeneratorOptions {\n const options = {\n ...DEFAULT_OPTIONS,\n ...custom_options,\n };\n\n return {\n selectors: sanitizeSelectorTypes(options.selectors),\n whitelist: sanitizeCssSelectorMatchList(options.whitelist),\n blacklist: sanitizeCssSelectorMatchList(options.blacklist),\n root: sanitizeRoot(options.root, element),\n combineWithinSelector: !!options.combineWithinSelector,\n combineBetweenSelectors: !!options.combineBetweenSelectors,\n includeTag: !!options.includeTag,\n maxCombinations: sanitizeMaxNumber(options.maxCombinations),\n maxCandidates: sanitizeMaxNumber(options.maxCandidates),\n useScope: !!options.useScope,\n maxResults: sanitizeMaxNumber(options.maxResults),\n };\n}\n", "import { CssSelectorMatch, PatternMatcher } from \"./types.js\";\nimport { isRegExp } from \"./utilities-options.js\";\nimport { showWarning } from \"./utilities-messages.js\";\n\n/**\n * Creates array containing only items included in all input arrays.\n */\nexport function getIntersection<T>(items: T[][] = []): T[] {\n const [firstItem = [], ...otherItems] = items;\n if (otherItems.length === 0) {\n return firstItem;\n }\n return otherItems.reduce((accumulator, currentValue) => {\n return accumulator.filter((item) => currentValue.includes(item));\n }, firstItem);\n}\n\n/**\n * Converts array of arrays into a flat array.\n */\nexport function flattenArray<T>(input: T[][]): T[] {\n return ([] as T[]).concat(...input);\n}\n\n/**\n * Convert string that can contain wildcards (asterisks) to RegExp source.\n */\nexport function wildcardToRegExp(input: string): string {\n return (\n input\n // convert all special characters used by RegExp, except an asterisk\n .replace(/[|\\\\{}()[\\]^$+?.]/g, \"\\\\$&\")\n // convert asterisk to pattern that matches anything\n .replace(/\\*/g, \".+\")\n );\n}\n\n/**\n * Creates function that will test list of provided matchers against input.\n * Used for white/blacklist functionality.\n */\nexport function createPatternMatcher(list: CssSelectorMatch[]): PatternMatcher {\n const matchFunctions = list.map((item) => {\n if (isRegExp(item)) {\n return (input: string) => item.test(input);\n }\n\n if (typeof item === \"function\") {\n return (input: string) => {\n const result = item(input);\n if (typeof result !== \"boolean\") {\n showWarning(\n \"pattern matcher function invalid\",\n \"Provided pattern matching function does not return boolean. It's result will be ignored.\",\n item,\n );\n return false;\n }\n return result;\n };\n }\n\n if (typeof item === \"string\") {\n const re = new RegExp(\"^\" + wildcardToRegExp(item) + \"$\");\n return (input: string) => re.test(input);\n }\n\n showWarning(\n \"pattern matcher invalid\",\n \"Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.\",\n item,\n );\n return () => false;\n });\n\n return (input: string) =>\n matchFunctions.some((matchFunction) => matchFunction(input));\n}\n", "import { CSS_SELECTOR_TYPE } from \"./types.js\";\n\nexport const SELECTOR_SEPARATOR = \", \";\n\n// RegExp that will match invalid patterns that can be used in ID attribute.\nexport const INVALID_ID_RE = new RegExp(\n [\n \"^$\", // empty or not set\n \"\\\\s\", // contains whitespace\n ].join(\"|\"),\n);\n\n// RegExp that will match invalid patterns that can be used in class attribute.\nexport const INVALID_CLASS_RE = new RegExp(\n [\n \"^$\", // empty or not set\n ].join(\"|\"),\n);\n\n// Order in which a combined selector is constructed.\nexport const SELECTOR_PATTERN = [\n CSS_SELECTOR_TYPE.nthoftype,\n CSS_SELECTOR_TYPE.tag,\n CSS_SELECTOR_TYPE.id,\n CSS_SELECTOR_TYPE.class,\n CSS_SELECTOR_TYPE.attribute,\n CSS_SELECTOR_TYPE.nthchild,\n];\n", "import { sanitizeSelectorItem } from \"./utilities-selectors.js\";\nimport { createPatternMatcher, getIntersection } from \"./utilities-data.js\";\nimport { CssSelectorGenerated } from \"./types.js\";\n\ninterface AttributeData {\n name: string;\n value: string;\n}\n\n// List of attributes to be ignored. These are handled by different selector types.\nexport const attributeBlacklistMatch = createPatternMatcher([\n \"class\",\n \"id\",\n // Angular attributes\n \"ng-*\",\n]);\n\n/**\n * Get simplified attribute selector for an element.\n */\nexport function attributeNodeToSimplifiedSelector({\n name,\n}: AttributeData): CssSelectorGenerated {\n return `[${name}]` as CssSelectorGenerated;\n}\n\n/**\n * Get attribute selector for an element.\n */\nexport function attributeNodeToSelector({\n name,\n value,\n}: AttributeData): CssSelectorGenerated {\n return `[${name}='${value}']` as CssSelectorGenerated;\n}\n\n/**\n * Checks whether an attribute should be used as a selector.\n */\nexport function isValidAttributeNode(\n { nodeName, nodeValue }: Node,\n element: Element,\n): boolean {\n // form input value should not be used as a selector\n const tagName = element.tagName.toLowerCase();\n if ([\"input\", \"option\"].includes(tagName) && nodeName === \"value\") {\n return false;\n }\n\n // ignore Base64-encoded strings as 'src' attribute values (e.g. in tags like img, audio, video, iframe, object, embed).\n if (nodeName === \"src\" && nodeValue?.startsWith(\"data:\")) {\n return false;\n }\n\n return !attributeBlacklistMatch(nodeName);\n}\n\n/**\n * Sanitize all attribute data. We want to do it once, before we start to generate simplified/full selectors from the same data.\n */\nfunction sanitizeAttributeData({ nodeName, nodeValue }: Node): AttributeData {\n return {\n name: sanitizeSelectorItem(nodeName),\n value: sanitizeSelectorItem(nodeValue ?? undefined),\n };\n}\n\n/**\n * Get attribute selectors for an element.\n */\nexport function getElementAttributeSelectors(\n element: Element,\n): CssSelectorGenerated[] {\n const validAttributes = Array.from(element.attributes)\n .filter((attributeNode) => isValidAttributeNode(attributeNode, element))\n .map(sanitizeAttributeData);\n return [\n ...validAttributes.map(attributeNodeToSimplifiedSelector),\n ...validAttributes.map(attributeNodeToSelector),\n ];\n}\n\n/**\n * Get attribute selectors matching all elements.\n */\nexport function getAttributeSelectors(\n elements: Element[],\n): CssSelectorGenerated[] {\n const elementSelectors = elements.map(getElementAttributeSelectors);\n return getIntersection(elementSelectors);\n}\n", "import { SELECTOR_PATTERN } from \"./constants.js\";\nimport {\n getAttributeSelectors,\n getElementAttributeSelectors,\n} from \"./selector-attribute.js\";\nimport {\n getClassSelectors,\n getElementClassSelectors,\n} from \"./selector-class.js\";\nimport { getElementIdSelectors, getIdSelector } from \"./selector-id.js\";\nimport {\n getElementNthChildSelector,\n getNthChildSelector,\n} from \"./selector-nth-child.js\";\nimport {\n getElementNthOfTypeSelector,\n getNthOfTypeSelector,\n} from \"./selector-nth-of-type.js\";\nimport { getElementTagSelectors, getTagSelector } from \"./selector-tag.js\";\nimport { createPatternMatcher } from \"./utilities-data.js\";\nimport { getParents, testSelector } from \"./utilities-dom.js\";\nimport {\n CSS_SELECTOR_TYPE,\n CssSelector,\n CssSelectorData,\n CssSelectorGenerated,\n CssSelectorGeneratorOptions,\n CssSelectorType,\n CssSelectorTypes,\n IdentifiableParent,\n OPERATOR,\n PatternMatcher,\n} from \"./types.js\";\nimport { isElement } from \"./utilities-iselement.js\";\nimport { getPowerSet, powerSetGenerator } from \"./utilities-powerset.js\";\nimport { cartesianProductGenerator } from \"./utilities-cartesian.js\";\n\nexport const ESCAPED_COLON = \":\".charCodeAt(0).toString(16).toUpperCase();\n\n// Square brackets need to be escaped, but eslint has a problem with that.\n/* eslint-disable-next-line no-useless-escape */\nexport const SPECIAL_CHARACTERS_RE = /[ !\"#$%&'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;\n\n/**\n * Escapes special characters used by CSS selector items.\n */\nexport function sanitizeSelectorItem(input = \"\"): string {\n // This should not be necessary, but just to be sure, let's keep the legacy sanitizer in place, for backwards compatibility.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return CSS ? CSS.escape(input) : legacySanitizeSelectorItem(input);\n}\n\n/**\n * Legacy version of escaping utility, originally used for IE11-. Should\n * probably be replaced by a polyfill:\n * https://github.com/mathiasbynens/CSS.escape\n */\nexport function legacySanitizeSelectorItem(input = \"\"): string {\n return input\n .split(\"\")\n .map((character) => {\n if (character === \":\") {\n return `\\\\${ESCAPED_COLON} `;\n }\n if (SPECIAL_CHARACTERS_RE.test(character)) {\n return `\\\\${character}`;\n }\n\n // needed for backwards compatibility\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return escape(character).replace(/%/g, \"\\\\\");\n })\n .join(\"\");\n}\n\nexport const SELECTOR_TYPE_GETTERS: Record<\n CssSelectorType,\n (elements: Element[]) => CssSelector[]\n> = {\n tag: getTagSelector,\n id: getIdSelector,\n class: getClassSelectors,\n attribute: getAttributeSelectors,\n nthchild: getNthChildSelector,\n nthoftype: getNthOfTypeSelector,\n} as const;\n\nexport const ELEMENT_SELECTOR_TYPE_GETTERS: Record<\n CssSelectorType,\n (element: Element) => CssSelectorGenerated[]\n> = {\n tag: getElementTagSelectors,\n id: getElementIdSelectors,\n class: getElementClassSelectors,\n attribute: getElementAttributeSelectors,\n nthchild: getElementNthChildSelector,\n nthoftype: getElementNthOfTypeSelector,\n} as const;\n\n/**\n * Creates selector of given type for single element.\n */\nexport function getElementSelectorsByType(\n element: Element,\n selectorType: CssSelectorType,\n): CssSelectorGenerated[] {\n return ELEMENT_SELECTOR_TYPE_GETTERS[selectorType](element);\n}\n\n/**\n * Returns list of selectors of given type for the element.\n */\nexport function getSelectorsByType(\n elements: Element[],\n selector_type: CssSelectorType,\n): CssSelector[] {\n const getter = SELECTOR_TYPE_GETTERS[selector_type];\n return getter(elements);\n}\n\n/**\n * Remove blacklisted selectors from list.\n */\nexport function filterSelectors(\n list: CssSelector[] = [],\n matchBlacklist: PatternMatcher,\n matchWhitelist: PatternMatcher,\n): CssSelector[] {\n return list.filter((item) => matchWhitelist(item) || !matchBlacklist(item));\n}\n\n/**\n * Prioritise whitelisted selectors in list.\n */\nexport function orderSelectors(\n list: CssSelector[] = [],\n matchWhitelist: PatternMatcher,\n): CssSelector[] {\n return list.sort((a, b) => {\n const a_is_whitelisted = matchWhitelist(a);\n const b_is_whitelisted = matchWhitelist(b);\n if (a_is_whitelisted && !b_is_whitelisted) {\n return -1;\n }\n if (!a_is_whitelisted && b_is_whitelisted) {\n return 1;\n }\n return 0;\n });\n}\n\n/**\n * Yields list of unique selectors applicable to given element.\n */\nexport function* allSelectorsGenerator(\n elements: Element[],\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector> {\n const yieldedSelectors = new Set<string>();\n const selectors_list = getSelectorsList(elements, options);\n for (const selector of selectorTypeCombinationsGenerator(\n selectors_list,\n options,\n )) {\n if (!yieldedSelectors.has(selector)) {\n yieldedSelectors.add(selector);\n yield selector;\n }\n }\n}\n\n/**\n * Creates object containing all selector types and their potential values.\n */\nexport function getSelectorsList(\n elements: Element[],\n options: CssSelectorGeneratorOptions,\n): CssSelectorData {\n const { blacklist, whitelist, combineWithinSelector, maxCombinations } =\n options;\n\n const matchBlacklist = createPatternMatcher(blacklist);\n const matchWhitelist = createPatternMatcher(whitelist);\n\n const reducer = (data: CssSelectorData, selector_type: CssSelectorType) => {\n const selectors_by_type = getSelectorsByType(elements, selector_type);\n const filtered_selectors = filterSelectors(\n selectors_by_type,\n matchBlacklist,\n matchWhitelist,\n );\n const found_selectors = orderSelectors(filtered_selectors, matchWhitelist);\n\n // Use Array.from with a length limit to avoid materializing huge power sets\n // This provides lazy evaluation while respecting maxCombinations\n data[selector_type] = combineWithinSelector\n ? Array.from(\n powerSetGenerator(found_selectors, { maxResults: maxCombinations }),\n )\n : found_selectors.map((item) => [item]);\n\n return data;\n };\n\n return getSelectorsToGet(options).reduce(reducer, {});\n}\n\n/**\n * Creates list of selector types that we will need to generate the selector.\n */\nexport function getSelectorsToGet(\n options: CssSelectorGeneratorOptions,\n): CssSelectorTypes {\n const { selectors, includeTag } = options;\n\n const selectors_to_get = [...selectors];\n if (includeTag && !selectors_to_get.includes(\"tag\")) {\n selectors_to_get.push(\"tag\");\n }\n return selectors_to_get;\n}\n\n/**\n * Adds \"tag\" to a list, if it does not contain it. Used to modify selectors\n * list when includeTag option is enabled to make sure all results contain the\n * TAG part.\n */\nfunction addTagTypeIfNeeded(list: CssSelectorTypes): CssSelectorTypes {\n return list.includes(CSS_SELECTOR_TYPE.tag) ||\n list.includes(CSS_SELECTOR_TYPE.nthoftype)\n ? [...list]\n : [...list, CSS_SELECTOR_TYPE.tag];\n}\n\n/**\n * Generates list of possible selector type combinations.\n */\nexport function combineSelectorTypes(\n options: CssSelectorGeneratorOptions,\n): CssSelectorTypes[] {\n const { selectors, combineBetweenSelectors, includeTag, maxCandidates } =\n options;\n\n const combinations = combineBetweenSelectors\n ? getPowerSet(selectors, { maxResults: maxCandidates })\n : selectors.map((item) => [item]);\n\n return includeTag ? combinations.map(addTagTypeIfNeeded) : combinations;\n}\n\n/**\n * Generates list of combined CSS selectors.\n */\nexport function* selectorTypeCombinationsGenerator(\n selectors_list: CssSelectorData,\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector> {\n for (const item of combineSelectorTypes(options)) {\n yield* constructedSelectorsGenerator(item, selectors_list);\n }\n}\n\n/**\n * Generates all variations of possible selectors from provided data.\n */\nexport function* constructedSelectorsGenerator(\n selector_types: CssSelectorTypes,\n selectors_by_type: CssSelectorData,\n): IterableIterator<CssSelector> {\n const data: CssSelectorData = {};\n\n for (const selector_type of selector_types) {\n const selector_variants = selectors_by_type[selector_type];\n if (selector_variants && selector_variants.length > 0) {\n data[selector_type] = selector_variants;\n }\n }\n\n for (const combination of cartesianProductGenerator<string | string[]>(\n data,\n )) {\n yield constructSelector(combination);\n }\n}\n\n/**\n * Creates selector for given selector type. Combines several parts if needed.\n */\nexport function constructSelectorType(\n selector_type: CssSelectorType,\n selectors_data: CssSelectorData,\n): CssSelector {\n return selectors_data[selector_type]\n ? selectors_data[selector_type].join(\"\")\n : \"\";\n}\n\n/**\n * Converts selector data object to a selector.\n */\nexport function constructSelector(\n selectorData: CssSelectorData = {},\n): CssSelector {\n const pattern = [...SELECTOR_PATTERN];\n // selector \"nthoftype\" already contains \"tag\"\n if (\n selectorData[CSS_SELECTOR_TYPE.tag] &&\n selectorData[CSS_SELECTOR_TYPE.nthoftype]\n ) {\n pattern.splice(pattern.indexOf(CSS_SELECTOR_TYPE.tag), 1);\n }\n\n return pattern\n .map((type) => constructSelectorType(type, selectorData))\n .join(\"\");\n}\n\n/**\n * Generates combinations of child and descendant selectors within root\n * selector.\n */\nfunction generateCandidateCombinations(\n selectors: CssSelector[],\n rootSelector: CssSelector,\n): CssSelector[] {\n return [\n ...selectors.map(\n (selector) => rootSelector + OPERATOR.DESCENDANT + selector,\n ),\n ...selectors.map((selector) => rootSelector + OPERATOR.CHILD + selector),\n ];\n}\n\n/**\n * Generates a list of selector candidates that can potentially match target\n * element.\n */\nfunction* candidatesGenerator(\n selectors: IterableIterator<CssSelector>,\n rootSelector: CssSelector,\n): IterableIterator<CssSelector> {\n if (rootSelector === \"\") {\n yield* selectors;\n } else {\n for (const selector of selectors) {\n yield* generateCandidateCombinations([selector], rootSelector);\n }\n }\n}\n\n/**\n * Tries to find unique CSS selectors for element within given parent.\n */\nexport function* selectorWithinRootGenerator(\n elements: Element[],\n root: ParentNode,\n rootSelector: CssSelector = \"\",\n options: CssSelectorGeneratorOptions,\n): IterableIterator<CssSelector, undefined> {\n const elementSelectorsIterator = allSelectorsGenerator(elements, options);\n for (const candidateSelector of candidatesGenerator(\n elementSelectorsIterator,\n rootSelector,\n )) {\n if (testSelector(elements, candidateSelector, root)) {\n yield candidateSelector;\n }\n }\n // TODO remove the `undefined` return value when the main function is rewritten to use the generator directly\n return;\n}\n/**\n * Climbs through parents of the element and finds the ones that are identifiable by unique CSS selector.\n */\nexport function* closestIdentifiableParentGenerator(\n elements: Element[],\n root: ParentNode,\n rootSelector: CssSelector = \"\",\n options: CssSelectorGeneratorOptions,\n): IterableIterator<IdentifiableParent> {\n if (elements.length === 0) {\n return null;\n }\n\n const candidatesList = [\n elements.length > 1 ? elements : [],\n ...getParents(elements, root).map((element) => [element]),\n ];\n\n for (const currentElements of candidatesList) {\n for (const selectorWithinRoot of selectorWithinRootGenerator(\n currentElements,\n root,\n rootSelector,\n options,\n )) {\n yield {\n foundElements: currentElements,\n selector: selectorWithinRoot,\n };\n }\n }\n}\n\ninterface SelectorGeneratorProps {\n elements: Element[];\n root: ParentNode;\n rootSelector: CssSelector;\n options: CssSelectorGeneratorOptions;\n}\n\n/**\n * Recursively travels through parents, finds the ones that are identifiable and then tries to find a unique selector within that context.\n */\nexport function* selectorGenerator({\n elements,\n root,\n rootSelector = \"\",\n options,\n}: SelectorGeneratorProps): IterableIterator<CssSelector> {\n let currentRoot = root;\n let partialSelector = rootSelector;\n let shouldContinue = true;\n\n while (shouldContinue) {\n let foundAny = false;\n\n for (const item of closestIdentifiableParentGenerator(\n elements,\n currentRoot,\n partialSelector,\n options,\n )) {\n const { foundElements, selector } = item;\n foundAny = true;\n\n if (testSelector(elements, selector, root)) {\n yield selector;\n } else {\n // First non-matching selector - use its parent for next iteration\n currentRoot = foundElements[0];\n partialSelector = selector;\n break; // Try from this parent in next iteration\n }\n }\n\n if (!foundAny) {\n shouldContinue = false;\n }\n }\n}\n\n/**\n * Converts input into list of elements, removing duplicates and non-elements.\n */\nexport function sanitizeSelectorNeedle(needle: unknown): Element[] {\n if (needle instanceof NodeList || needle instanceof HTMLCollection) {\n needle = Array.from(needle);\n }\n const elements = (Array.isArray(needle) ? needle : [needle]).filter(\n isElement,\n );\n return [...new Set(elements)];\n}\n", "/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return (\n Boolean(className) &&\n (className as string).trim() !== '' &&\n array.indexOf(className) === index\n );\n })\n .join(' ')\n .trim();\n", "/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n", "/**\n * Converts string to camel case\n *\n * @param {string} string\n * @returns {string} A camelized string\n */\nexport const toCamelCase = <T extends string>(string: T) =>\n string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n", "import { CamelToPascal } from '../utility-types';\nimport { toCamelCase } from './toCamelCase';\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = toCamelCase(string);\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n", "export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n", "/**\n * Check if a component has an accessibility prop\n *\n * @param {object} props\n * @returns {boolean} Whether the component has an accessibility prop\n */\nexport const hasA11yProp = (props: Record<string, any>) => {\n for (const prop in props) {\n if (prop.startsWith('aria-') || prop === 'role' || prop === 'title') {\n return true;\n }\n }\n\n return false;\n};\n", "import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses, hasA11yProp } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...(!children && !hasA11yProp(rest) && { 'aria-hidden': 'true' }),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n);\n\nexport default Icon;\n", "import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase, toPascalCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(\n `lucide-${toKebabCase(toPascalCase(iconName))}`,\n `lucide-${iconName}`,\n className,\n ),\n ...props,\n }),\n );\n\n Component.displayName = toPascalCase(iconName);\n\n return Component;\n};\n\nexport default createLucideIcon;\n", "import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [['path', { d: 'M20 6 9 17l-5-5', key: '1gmf2c' }]];\n\n/**\n * @component @name Check\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview  - https://lucide.dev/icons/check\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Check = createLucideIcon('check', __iconNode);\n\nexport default Check;\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function DetectionBadge({ found, onClick }) {\n const title = onClick\n ? found\n ? 'Click to scroll to element'\n : 'Click to navigate to page'\n : found\n ? 'Found on this page'\n : 'Not found on this page';\n const textColor = found ? 'se-text-green-4' : 'se-text-text-tertiary';\n const dotColor = found ? 'se-bg-green-4' : 'se-bg-text-tertiary';\n const classes = cn('se-inline-flex se-items-center se-gap-1 se-text-xs se-font-medium se-shrink-0', textColor, onClick && 'se-cursor-pointer hover:se-opacity-80');\n const dot = (_jsx(\"span\", { \"data-indicator\": \"\", className: cn('se-w-1.5 se-h-1.5 se-rounded-full', dotColor) }));\n if (onClick) {\n return (_jsxs(\"button\", { type: \"button\", className: cn(classes, 'se-border-none se-bg-transparent se-p-0'), title: title, onClick: (e) => {\n e.stopPropagation();\n onClick(e);\n }, children: [dot, \"GoTo\"] }));\n }\n return (_jsxs(\"span\", { className: classes, title: title, children: [dot, \"GoTo\"] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nexport function DismissedSection({ count, children }) {\n const [isOpen, setIsOpen] = useState(false);\n return (_jsxs(\"div\", { className: \"se-mt-4 se-cursor-pointer se-select-none\", children: [_jsxs(\"div\", { role: \"button\", tabIndex: 0, className: \"se-text-xs se-font-semibold se-text-text-secondary se-flex se-items-center se-gap-1.5 se-cursor-pointer\", onClick: () => setIsOpen(!isOpen), onKeyDown: (e) => {\n if (e.key === 'Enter' || e.key === ' ')\n setIsOpen(!isOpen);\n }, children: [_jsx(\"span\", { children: isOpen ? '\\u25be' : '\\u25b8' }), _jsxs(\"span\", { children: [\"Dismissed (\", count, \")\"] })] }), isOpen && _jsx(\"div\", { className: \"se-mt-1.5\", children: children })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EditorBody({ children }) {\n return _jsx(\"div\", { className: \"se-flex-1 se-overflow-auto se-p-6\", children: children });\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function EditorCard({ children, itemKey, onClick, onMouseEnter, onMouseLeave, className, validated, }) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: onMouseEnter/onMouseLeave are for presentational hover highlighting, not user interaction\n _jsx(\"div\", { \"data-item-key\": itemKey, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, onClick: onClick, onKeyDown: onClick\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick();\n }\n }\n : undefined, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, className: cn('se-py-2 se-px-2.5 se-rounded-lg se-border se-bg-card-bg se-shadow-sm se-mb-1 se-text-sm se-text-text-primary', validated ? 'se-border-green-4/50 se-shadow-glow-green' : 'se-border-border-primary', onClick &&\n 'se-cursor-pointer hover:se-border-border-primary/80 hover:se-bg-sidebar-hover se-transition-colors', className), children: children }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function EditorHeader({ title, subtitle }) {\n return (_jsxs(\"div\", { className: \"se-px-4 se-pt-3 se-pb-2\", children: [_jsx(\"h2\", { className: \"se-m-0 se-text-base se-font-semibold se-text-text-primary\", children: title }), subtitle && (_jsx(\"p\", { className: \"se-mt-0.5 se-mb-0 se-text-xs se-text-text-secondary\", children: subtitle }))] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useId } from 'react';\nimport { cn } from '../cn';\nexport function EditorInput({ label, className, id, ...props }) {\n const generatedId = useId();\n const inputId = id || generatedId;\n return (_jsxs(\"div\", { children: [label && (_jsx(\"label\", { htmlFor: inputId, className: \"se-text-sm se-font-medium se-text-input-field-text-label se-mb-1 se-block\", children: label })), _jsx(\"input\", { id: inputId, ...props, className: cn('se-w-full se-py-2 se-px-3 se-rounded-lg se-border se-border-input-field-border se-bg-slate-grey-3 se-text-text-primary se-text-sm se-font-[inherit] se-mb-2 se-box-border', 'placeholder:se-text-input-field-text-placeholder', 'focus:se-border-input-field-border-selected focus:se-outline-none focus:se-shadow-focus-primary', 'disabled:se-bg-input-field-bg-disabled disabled:se-cursor-not-allowed disabled:se-opacity-50', className) })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EditorLayout({ children }) {\n return _jsx(\"div\", { className: \"se-flex se-flex-col se-h-full se-font-sans\", children: children });\n}\n", "/**\n * Syntro Design System - Color Tokens\n *\n * This file contains all color tokens from the Figma design system.\n * Colors are organized by scale and semantic meaning.\n *\n * @see https://www.figma.com/design/U0Ol5vM7FQvgPfIgCAgxgb/Design-System\n */\n// ============================================================================\n// BASE COLORS\n// ============================================================================\nexport const base = {\n white: '#ffffff',\n black: '#000000',\n};\n// ============================================================================\n// BRAND COLORS\n// ============================================================================\nexport const brand = {\n 0: '#2c0b0a',\n 1: '#5b1715',\n 2: '#89221f',\n 3: '#b72e2a',\n 4: '#d44844',\n 5: '#dd6d69',\n 6: '#e5918f',\n 7: '#eeb6b4',\n 8: '#f6dada',\n 9: '#faebea',\n};\n// ============================================================================\n// NEUTRAL COLORS\n// ============================================================================\nexport const slateGrey = {\n 0: '#07080a',\n 1: '#0f1318',\n 2: '#0e1114',\n 3: '#1c222a',\n 4: '#2b333f',\n 5: '#394454',\n 6: '#475569',\n 7: '#677384',\n 8: '#87919f',\n 9: '#a8afba',\n 10: '#cbd0d7',\n 11: '#e8eaee',\n 12: '#f6f7f9',\n};\n// ============================================================================\n// SEMANTIC COLOR SCALES\n// ============================================================================\nexport const green = {\n 0: '#07230a',\n 1: '#0e4514',\n 2: '#16681e',\n 3: '#1d8a28',\n 4: '#24ad32',\n 5: '#4fbd5a',\n 6: '#7acd82',\n 7: '#a5deab',\n 8: '#d0eed3',\n 9: '#e5f6e7',\n};\nexport const yellow = {\n 0: '#301f09',\n 1: '#5f3e12',\n 2: '#8f5e1b',\n 3: '#be7d24',\n 4: '#ee9c2d',\n 5: '#f1b057',\n 6: '#f5c481',\n 7: '#f8d7ab',\n 8: '#fcebd5',\n 9: '#fdf5ea',\n};\nexport const red = {\n 0: '#330707',\n 1: '#660f0e',\n 2: '#991616',\n 3: '#cc1e1d',\n 4: '#ff2524',\n 5: '#ff5150',\n 6: '#ff7c7c',\n 7: '#ffa8a7',\n 8: '#ffd3d3',\n 9: '#ffe9e9',\n};\nexport const blue = {\n 0: '#051533',\n 1: '#0a2a66',\n 2: '#0f3f98',\n 3: '#1454cb',\n 4: '#1969fe',\n 5: '#4787fe',\n 6: '#75a5fe',\n 7: '#a3c3ff',\n 8: '#d1e1ff',\n 9: '#e8f0ff',\n};\nexport const orange = {\n 0: '#662500',\n 1: '#993d00',\n 2: '#cc5800',\n 3: '#ff7700',\n 4: '#fea85d',\n 5: '#fec58f',\n 6: '#ffd6ae',\n 7: '#fee6cd',\n 8: '#fff1e1',\n 9: '#fff8f0',\n};\nexport const purple = {\n 0: '#151229',\n 1: '#2a2452',\n 2: '#40357c',\n 3: '#5547a5',\n 4: '#6a59ce',\n 5: '#887ad8',\n 6: '#a69be2',\n 7: '#c3bdeb',\n 8: '#e1def5',\n 9: '#f0eefa',\n};\nexport const pink = {\n 0: '#37091f',\n 1: '#69123c',\n 2: '#9b1c58',\n 3: '#cd2575',\n 4: '#ff2e92',\n 5: '#ff58a8',\n 6: '#ff82be',\n 7: '#ffabd3',\n 8: '#ffd5e9',\n 9: '#ffeaf4',\n};\n// ============================================================================\n// LEGACY COLORS (Being phased out)\n// ============================================================================\nexport const legacy = {\n aqua: {\n 0: '#0c5f8d',\n 1: '#146b99',\n 2: '#1d78a6',\n 3: '#2e89b6',\n 4: '#4a9fc4',\n 5: '#6bb4d1',\n 6: '#93cce0',\n 7: '#bddff0',\n 8: '#dceef8',\n 9: '#f2f8fc',\n },\n violet: {\n 0: '#6927da',\n 1: '#7839ee',\n 2: '#875bf7',\n 3: '#a48afb',\n 4: '#c3b4fd',\n 5: '#ddd6fe',\n 6: '#ece9fe',\n 7: '#f5f3ff',\n 8: '#fbfaff',\n },\n fuchsia: {\n 0: '#9f1ab1',\n 1: '#ba24d5',\n 2: '#d444f1',\n 3: '#e478fa',\n 4: '#eeaafd',\n 5: '#f6d0fe',\n 6: '#fbe8ff',\n 7: '#fdf4ff',\n 8: '#fefaff',\n },\n pink: {\n 0: '#a10f5f',\n 1: '#dd2590',\n 2: '#ee46bc',\n 3: '#f670c7',\n 4: '#faa7e0',\n 5: '#fcceee',\n 6: '#fce7f6',\n 7: '#fdf2fa',\n 8: '#fef6fb',\n },\n};\n// ============================================================================\n// TEXT TOKENS\n// ============================================================================\nexport const text = {\n primary: slateGrey[10],\n secondary: slateGrey[9],\n tertiary: slateGrey[8],\n};\n// ============================================================================\n// BACKGROUND TOKENS\n// ============================================================================\nexport const background = {\n primary: slateGrey[2],\n secondary: slateGrey[0],\n};\n// ============================================================================\n// BORDER TOKENS\n// ============================================================================\nexport const border = {\n primary: slateGrey[4],\n secondary: slateGrey[3],\n};\n// ============================================================================\n// BUTTON TOKENS\n// ============================================================================\nexport const button = {\n primary: {\n text: base.white,\n icon: base.white,\n border: brand[3],\n backgroundDefault: brand[3],\n backgroundHover: brand[2],\n },\n neutral: {\n text: slateGrey[10],\n textHover: base.white,\n icon: slateGrey[10],\n iconHover: base.white,\n border: slateGrey[4],\n background: slateGrey[2],\n },\n link: {\n text: base.white,\n icon: base.white,\n hover: brand[5],\n },\n error: {\n text: red[5],\n hover: red[6],\n },\n success: {\n text: green[5],\n hover: green[6],\n },\n};\n// ============================================================================\n// BADGE TOKENS\n// ============================================================================\nexport const badge = {\n slateGrey: {\n content: slateGrey[10],\n pillOutline: slateGrey[10],\n borderPrimary: slateGrey[5],\n borderSecondary: slateGrey[5],\n background: slateGrey[3],\n },\n brand: {\n content: brand[9],\n pillOutline: brand[9],\n borderPrimary: brand[6],\n borderSecondary: brand[6],\n background: brand[0],\n },\n red: {\n content: red[8],\n pillOutline: red[4],\n borderPrimary: red[2],\n borderSecondary: red[2],\n background: red[0],\n },\n yellow: {\n content: yellow[8],\n pillOutline: yellow[4],\n borderPrimary: yellow[2],\n borderSecondary: yellow[2],\n background: yellow[0],\n },\n green: {\n content: green[8],\n pillOutline: green[4],\n borderPrimary: green[2],\n borderSecondary: green[2],\n background: green[0],\n },\n purple: {\n content: purple[8],\n pillOutline: purple[4],\n borderPrimary: purple[2],\n borderSecondary: purple[2],\n background: purple[0],\n },\n blue: {\n content: blue[8],\n pillOutline: blue[4],\n borderPrimary: blue[2],\n borderSecondary: blue[2],\n background: blue[0],\n },\n orange: {\n content: orange[8],\n pillOutline: orange[4],\n borderPrimary: orange[2],\n borderSecondary: orange[2],\n background: orange[0],\n },\n pink: {\n content: pink[8],\n pillOutline: pink[4],\n borderPrimary: pink[2],\n borderSecondary: pink[2],\n background: pink[0],\n },\n};\n// ============================================================================\n// BADGE BANNER TOKENS\n// ============================================================================\nexport const badgeBanner = {\n green: {\n content: green[8],\n border: green[2],\n background: green[0],\n },\n yellow: {\n content: yellow[8],\n border: yellow[2],\n background: yellow[0],\n },\n red: {\n content: red[8],\n border: red[2],\n background: red[0],\n },\n};\n// ============================================================================\n// ALERT TOKENS\n// ============================================================================\nexport const alert = {\n green: {\n content: green[1],\n background: green[9],\n },\n yellow: {\n content: yellow[1],\n background: yellow[9],\n },\n red: {\n content: red[1],\n background: red[9],\n },\n};\n// ============================================================================\n// TAG TOKENS\n// ============================================================================\nexport const tag = {\n content: slateGrey[10],\n border: slateGrey[4],\n background: slateGrey[3],\n};\n// ============================================================================\n// MENU TOKENS\n// ============================================================================\nexport const menu = {\n backgroundDefault: slateGrey[2],\n backgroundHover: slateGrey[1],\n selected: slateGrey[3],\n};\n// ============================================================================\n// INPUT/DROPDOWN TOKENS\n// ============================================================================\nexport const inputDropdown = {\n background: slateGrey[2],\n icon: slateGrey[10],\n borderDefault: slateGrey[4],\n borderSelected: brand[3],\n textLabel: slateGrey[9],\n textPlaceholder: slateGrey[8],\n textHint: slateGrey[8],\n};\nexport const inputField = {\n backgroundDefault: slateGrey[2],\n backgroundDisabled: slateGrey[0],\n textLabel: slateGrey[9],\n textPlaceholder: slateGrey[8],\n textHint: slateGrey[8],\n textError: red[5],\n iconDefault: slateGrey[9],\n iconPlaceholder: slateGrey[10],\n iconError: red[5],\n borderDefault: slateGrey[4],\n borderSelected: brand[3],\n borderError: red[5],\n};\n// ============================================================================\n// TOGGLE TOKENS\n// ============================================================================\nexport const toggle = {\n handleDefault: base.white,\n handleDisabled: slateGrey[10],\n off: {\n backgroundDefault: slateGrey[4],\n backgroundHover: slateGrey[5],\n backgroundDisabled: slateGrey[4],\n },\n on: {\n backgroundDefault: green[3],\n backgroundHover: green[2],\n backgroundDisabled: slateGrey[4],\n },\n};\n// ============================================================================\n// CHECKBOX TOKENS\n// ============================================================================\nexport const checkbox = {\n off: {\n backgroundDefault: '#00000000',\n backgroundHover: slateGrey[5],\n backgroundDisabled: slateGrey[2],\n border: slateGrey[6],\n },\n on: {\n backgroundDefault: green[0],\n backgroundHover: green[1],\n backgroundDisabled: slateGrey[2],\n border: green[3],\n },\n};\n// ============================================================================\n// AVATAR TOKENS\n// ============================================================================\nexport const avatar = {\n content: slateGrey[10],\n background: slateGrey[4],\n};\n// ============================================================================\n// PROGRESS BAR & SLIDER TOKENS\n// ============================================================================\nexport const progressBarSlider = {\n background: slateGrey[4],\n active: green[3],\n};\n// ============================================================================\n// CARD TOKENS\n// ============================================================================\nexport const card = {\n background: slateGrey[1],\n content: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// SIDEBAR TOKENS\n// ============================================================================\nexport const sidebar = {\n backgroundDefault: slateGrey[1],\n backgroundHover: slateGrey[3],\n backgroundActive: slateGrey[4],\n border: slateGrey[4],\n contentPrimary: slateGrey[10],\n contentSecondary: slateGrey[9],\n contentTertiary: slateGrey[8],\n};\n// ============================================================================\n// MODAL TOKENS\n// ============================================================================\nexport const modal = {\n background: slateGrey[1],\n content: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// TAB TOKENS\n// ============================================================================\nexport const tab = {\n activeBackground: slateGrey[3],\n activeContent: brand[5],\n inactiveContent: slateGrey[9],\n border: slateGrey[4],\n};\n// ============================================================================\n// TABLE TOKENS\n// ============================================================================\nexport const table = {\n header: {\n textDefault: slateGrey[9],\n textHover: slateGrey[8],\n backgroundDefault: slateGrey[1],\n },\n border: slateGrey[4],\n cell: {\n textPrimary: slateGrey[10],\n textSecondary: slateGrey[9],\n backgroundDefault: slateGrey[2],\n backgroundHover: slateGrey[1],\n },\n};\n// ============================================================================\n// BREADCRUMBS TOKENS\n// ============================================================================\nexport const breadcrumbs = {\n textPrimaryDefault: slateGrey[10],\n textPrimaryHover: slateGrey[10],\n textSecondaryDefault: slateGrey[8],\n textSecondaryHover: slateGrey[9],\n iconPrimary: slateGrey[10],\n iconSecondary: slateGrey[8],\n};\n// ============================================================================\n// LOADING INDICATOR TOKENS\n// ============================================================================\nexport const loadingIndicator = {\n background: green[1],\n active: green[5],\n};\n// ============================================================================\n// DATE PICKER TOKENS\n// ============================================================================\nexport const datePicker = {\n textDefault: slateGrey[10],\n textSelected: base.white,\n textDisabled: slateGrey[7],\n backgroundDefault: slateGrey[2],\n backgroundMiddle: slateGrey[3],\n backgroundSelected: brand[3],\n border: slateGrey[4],\n};\n// ============================================================================\n// MISC TOKENS\n// ============================================================================\nexport const scroll = slateGrey[9];\n// ============================================================================\n// EXPORTS\n// ============================================================================\nexport const colors = {\n base,\n brand,\n slateGrey,\n green,\n yellow,\n red,\n blue,\n orange,\n purple,\n pink,\n legacy,\n text,\n background,\n border,\n button,\n badge,\n badgeBanner,\n alert,\n tag,\n menu,\n inputDropdown,\n inputField,\n toggle,\n checkbox,\n avatar,\n progressBarSlider,\n card,\n sidebar,\n modal,\n tab,\n table,\n breadcrumbs,\n loadingIndicator,\n datePicker,\n scroll,\n};\nexport default colors;\n", "/**\n * Syntro Design System - Effect Tokens\n *\n * Non-color effect tokens from the Figma design system:\n * shadows, focus rings, backdrop blurs, and overlays.\n *\n * @see https://www.figma.com/design/U0Ol5vM7FQvgPfIgCAgxgb/Design-System\n */\n// ============================================================================\n// SHADOW SCALE\n// ============================================================================\n/**\n * Figma shadow scale using rgba(16,24,40,...) base.\n * Each step increases vertical offset and blur radius.\n */\nexport const shadows = {\n xs: '0 1px 2px 0 rgba(16,24,40,0.05)',\n sm: '0 1px 3px 0 rgba(16,24,40,0.10), 0 1px 2px -1px rgba(16,24,40,0.10)',\n md: '0 4px 6px -1px rgba(16,24,40,0.10), 0 2px 4px -2px rgba(16,24,40,0.10)',\n lg: '0 10px 15px -3px rgba(16,24,40,0.10), 0 4px 6px -4px rgba(16,24,40,0.10)',\n xl: '0 20px 25px -5px rgba(16,24,40,0.10), 0 8px 10px -6px rgba(16,24,40,0.10)',\n '2xl': '0 25px 50px -12px rgba(16,24,40,0.25)',\n '3xl': '0 35px 60px -15px rgba(16,24,40,0.35)',\n inner: 'inset 0 2px 4px 0 rgba(16,24,40,0.05)',\n none: 'none',\n};\n// ============================================================================\n// FOCUS RINGS\n// ============================================================================\n/**\n * Focus ring shadows \u2014 4px spread + xs shadow for depth.\n * Used via `shadow-focus-primary`, `shadow-focus-neutral`, `shadow-focus-error`.\n *\n * Colors reference design system color tokens:\n * primary \u2192 brand-5 (#dd6d69)\n * neutral \u2192 slateGrey-8 (#87919f)\n * error \u2192 red-5 (#ff5150)\n */\nexport const focusRings = {\n primary: '0 0 0 4px rgba(221,109,105,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n neutral: '0 0 0 4px rgba(135,145,159,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n error: '0 0 0 4px rgba(255,81,80,0.25), 0 1px 2px 0 rgba(16,24,40,0.05)',\n};\n// ============================================================================\n// BACKDROP BLUR\n// ============================================================================\n/**\n * Figma backdrop blur scale.\n */\nexport const backdropBlur = {\n sm: '8px',\n md: '16px',\n lg: '24px',\n xl: '40px',\n};\n// ============================================================================\n// OVERLAY\n// ============================================================================\n/**\n * Modal/dialog overlay backgrounds.\n * solid \u2192 full-screen scrim (opaque)\n * blur \u2192 lighter scrim intended to pair with backdrop-blur\n */\nexport const overlay = {\n solid: 'rgba(0,0,0,0.70)',\n blur: 'rgba(0,0,0,0.25)',\n};\n// ============================================================================\n// PRODUCT GLOW SHADOWS\n// ============================================================================\n/**\n * Product-specific glow shadows not in the Figma shadow scale.\n * Used for validated states, brand highlights, and UI depth cues.\n */\nexport const glowShadows = {\n 'glow-green': '0 0 20px -8px rgba(34,197,94,0.3)',\n 'glow-brand': '0 0 25px rgba(212,72,68,0.25)',\n 'glow-brand-sm': '0 0 0 1px rgba(212,72,68,0.15)',\n 'glow-brand-md': '0 0 0 2px rgba(212,72,68,0.3)',\n 'glow-brand-active': '0 0.375rem 0.875rem -0.625rem rgba(212,72,68,0.8)',\n 'glow-brand-tab': '0 0.5rem 1.25rem -0.75rem rgba(212,72,68,0.7)',\n 'glow-brand-nav': '0 0.625rem 1.875rem -1.125rem rgba(212,72,68,0.9)',\n};\n// ============================================================================\n// ELEVATION SHADOWS\n// ============================================================================\n/**\n * Dark-on-dark elevation shadows for card depth.\n */\nexport const elevationShadows = {\n 'elevation-sm': '0 8px 24px -16px rgba(0,0,0,0.6)',\n 'elevation-md': '0 12px 32px -18px rgba(0,0,0,0.6)',\n 'elevation-lg': '0 18px 48px -24px rgba(0,0,0,0.65)',\n 'elevation-card': '0 0.75rem 2rem -1.25rem rgba(0,0,0,0.7)',\n 'elevation-card-soft': '0 0.75rem 2.375rem -0.75rem rgba(0,0,0,0.4)',\n 'elevation-card-tight': '0 0.625rem 1.625rem -1.125rem rgba(0,0,0,0.6)',\n};\n// ============================================================================\n// ANIMATION TIMING CONSTANTS\n// ============================================================================\n/**\n * Shared animation duration constants for consistent motion across the UI.\n */\nexport const animationDuration = {\n DURATION_SHORT: '150ms',\n DURATION_MEDIUM: '200ms',\n DURATION_LONG: '300ms',\n};\n// ============================================================================\n// DEFAULT EXPORT\n// ============================================================================\nexport const effects = {\n shadows,\n focusRings,\n backdropBlur,\n overlay,\n glowShadows,\n elevationShadows,\n animationDuration,\n};\nexport default effects;\n", "/**\n * Syntro Design System - Tailwind Preset\n *\n * Import and extend this preset in your Tailwind config to use the design system.\n *\n * @example\n * ```typescript\n * import { syntroPreset } from '@syntro/design-system/tailwind-preset';\n *\n * export default {\n * presets: [syntroPreset],\n * content: ['./src/**\\/*.{ts,tsx}'],\n * };\n * ```\n */\nimport { colors } from './tokens/colors';\nimport { backdropBlur, elevationShadows, focusRings, glowShadows, overlay, shadows, } from './tokens/effects';\nexport const syntroPreset = {\n darkMode: ['class'],\n theme: {\n extend: {\n colors: {\n // Base colors\n white: colors.base.white,\n black: colors.base.black,\n // Brand scale\n brand: {\n 0: colors.brand[0],\n 1: colors.brand[1],\n 2: colors.brand[2],\n 3: colors.brand[3],\n 4: colors.brand[4],\n 5: colors.brand[5],\n 6: colors.brand[6],\n 7: colors.brand[7],\n 8: colors.brand[8],\n 9: colors.brand[9],\n DEFAULT: colors.brand[3],\n },\n // Neutral scale (Slate Grey)\n 'slate-grey': {\n 0: colors.slateGrey[0],\n 1: colors.slateGrey[1],\n 2: colors.slateGrey[2],\n 3: colors.slateGrey[3],\n 4: colors.slateGrey[4],\n 5: colors.slateGrey[5],\n 6: colors.slateGrey[6],\n 7: colors.slateGrey[7],\n 8: colors.slateGrey[8],\n 9: colors.slateGrey[9],\n 10: colors.slateGrey[10],\n 11: colors.slateGrey[11],\n 12: colors.slateGrey[12],\n DEFAULT: colors.slateGrey[6],\n },\n // Semantic color scales\n green: {\n 0: colors.green[0],\n 1: colors.green[1],\n 2: colors.green[2],\n 3: colors.green[3],\n 4: colors.green[4],\n 5: colors.green[5],\n 6: colors.green[6],\n 7: colors.green[7],\n 8: colors.green[8],\n 9: colors.green[9],\n DEFAULT: colors.green[4],\n },\n yellow: {\n 0: colors.yellow[0],\n 1: colors.yellow[1],\n 2: colors.yellow[2],\n 3: colors.yellow[3],\n 4: colors.yellow[4],\n 5: colors.yellow[5],\n 6: colors.yellow[6],\n 7: colors.yellow[7],\n 8: colors.yellow[8],\n 9: colors.yellow[9],\n DEFAULT: colors.yellow[4],\n },\n red: {\n 0: colors.red[0],\n 1: colors.red[1],\n 2: colors.red[2],\n 3: colors.red[3],\n 4: colors.red[4],\n 5: colors.red[5],\n 6: colors.red[6],\n 7: colors.red[7],\n 8: colors.red[8],\n 9: colors.red[9],\n DEFAULT: colors.red[4],\n },\n blue: {\n 0: colors.blue[0],\n 1: colors.blue[1],\n 2: colors.blue[2],\n 3: colors.blue[3],\n 4: colors.blue[4],\n 5: colors.blue[5],\n 6: colors.blue[6],\n 7: colors.blue[7],\n 8: colors.blue[8],\n 9: colors.blue[9],\n DEFAULT: colors.blue[4],\n },\n orange: {\n 0: colors.orange[0],\n 1: colors.orange[1],\n 2: colors.orange[2],\n 3: colors.orange[3],\n 4: colors.orange[4],\n 5: colors.orange[5],\n 6: colors.orange[6],\n 7: colors.orange[7],\n 8: colors.orange[8],\n 9: colors.orange[9],\n DEFAULT: colors.orange[3],\n },\n purple: {\n 0: colors.purple[0],\n 1: colors.purple[1],\n 2: colors.purple[2],\n 3: colors.purple[3],\n 4: colors.purple[4],\n 5: colors.purple[5],\n 6: colors.purple[6],\n 7: colors.purple[7],\n 8: colors.purple[8],\n 9: colors.purple[9],\n DEFAULT: colors.purple[4],\n },\n pink: {\n 0: colors.pink[0],\n 1: colors.pink[1],\n 2: colors.pink[2],\n 3: colors.pink[3],\n 4: colors.pink[4],\n 5: colors.pink[5],\n 6: colors.pink[6],\n 7: colors.pink[7],\n 8: colors.pink[8],\n 9: colors.pink[9],\n DEFAULT: colors.pink[4],\n },\n // Semantic tokens\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n text: {\n primary: colors.text.primary,\n secondary: colors.text.secondary,\n tertiary: colors.text.tertiary,\n DEFAULT: colors.text.primary,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n background: {\n primary: colors.background.primary,\n secondary: colors.background.secondary,\n DEFAULT: colors.background.primary,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n border: {\n primary: colors.border.primary,\n secondary: colors.border.secondary,\n DEFAULT: colors.border.primary,\n },\n // Component tokens - Button\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'btn-primary': {\n DEFAULT: colors.button.primary.backgroundDefault,\n hover: colors.button.primary.backgroundHover,\n text: colors.button.primary.text,\n border: colors.button.primary.border,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'btn-neutral': {\n DEFAULT: colors.button.neutral.background,\n text: colors.button.neutral.text,\n 'text-hover': colors.button.neutral.textHover,\n border: colors.button.neutral.border,\n },\n 'btn-link': {\n text: colors.button.link.text,\n hover: colors.button.link.hover,\n },\n 'btn-error': {\n text: colors.button.error.text,\n hover: colors.button.error.hover,\n },\n 'btn-success': {\n text: colors.button.success.text,\n hover: colors.button.success.hover,\n },\n // Component tokens - Card\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n card: {\n bg: colors.card.background,\n content: colors.card.content,\n border: colors.card.border,\n },\n // Component tokens - Modal\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n modal: {\n bg: colors.modal.background,\n content: colors.modal.content,\n border: colors.modal.border,\n },\n // Component tokens - Sidebar\n sidebar: {\n DEFAULT: colors.sidebar.backgroundDefault,\n hover: colors.sidebar.backgroundHover,\n active: colors.sidebar.backgroundActive,\n border: colors.sidebar.border,\n 'content-primary': colors.sidebar.contentPrimary,\n 'content-secondary': colors.sidebar.contentSecondary,\n 'content-tertiary': colors.sidebar.contentTertiary,\n },\n // Component tokens - Tab\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n tab: {\n 'active-bg': colors.tab.activeBackground,\n 'active-content': colors.tab.activeContent,\n 'inactive-content': colors.tab.inactiveContent,\n border: colors.tab.border,\n },\n // Component tokens - Table\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'table-header': {\n text: colors.table.header.textDefault,\n 'text-hover': colors.table.header.textHover,\n bg: colors.table.header.backgroundDefault,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'table-cell': {\n // biome-ignore lint: Tailwind preset defines semantic token names, not usage of shadcn color classes\n 'text-primary': colors.table.cell.textPrimary,\n // biome-ignore lint: Tailwind preset defines semantic token names, not usage of shadcn color classes\n 'text-secondary': colors.table.cell.textSecondary,\n bg: colors.table.cell.backgroundDefault,\n 'bg-hover': colors.table.cell.backgroundHover,\n },\n 'table-border': colors.table.border,\n // Component tokens - Input\n 'input-field': {\n bg: colors.inputField.backgroundDefault,\n 'bg-disabled': colors.inputField.backgroundDisabled,\n 'text-label': colors.inputField.textLabel,\n 'text-placeholder': colors.inputField.textPlaceholder,\n 'text-hint': colors.inputField.textHint,\n 'text-error': colors.inputField.textError,\n border: colors.inputField.borderDefault,\n 'border-selected': colors.inputField.borderSelected,\n 'border-error': colors.inputField.borderError,\n },\n // Component tokens - Badge (9 variants)\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-slate': {\n content: colors.badge.slateGrey.content,\n outline: colors.badge.slateGrey.pillOutline,\n border: colors.badge.slateGrey.borderPrimary,\n bg: colors.badge.slateGrey.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-brand': {\n content: colors.badge.brand.content,\n outline: colors.badge.brand.pillOutline,\n border: colors.badge.brand.borderPrimary,\n bg: colors.badge.brand.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-green': {\n content: colors.badge.green.content,\n outline: colors.badge.green.pillOutline,\n border: colors.badge.green.borderPrimary,\n bg: colors.badge.green.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-yellow': {\n content: colors.badge.yellow.content,\n outline: colors.badge.yellow.pillOutline,\n border: colors.badge.yellow.borderPrimary,\n bg: colors.badge.yellow.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-red': {\n content: colors.badge.red.content,\n outline: colors.badge.red.pillOutline,\n border: colors.badge.red.borderPrimary,\n bg: colors.badge.red.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-blue': {\n content: colors.badge.blue.content,\n outline: colors.badge.blue.pillOutline,\n border: colors.badge.blue.borderPrimary,\n bg: colors.badge.blue.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-purple': {\n content: colors.badge.purple.content,\n outline: colors.badge.purple.pillOutline,\n border: colors.badge.purple.borderPrimary,\n bg: colors.badge.purple.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-orange': {\n content: colors.badge.orange.content,\n outline: colors.badge.orange.pillOutline,\n border: colors.badge.orange.borderPrimary,\n bg: colors.badge.orange.background,\n },\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n 'badge-pink': {\n content: colors.badge.pink.content,\n outline: colors.badge.pink.pillOutline,\n border: colors.badge.pink.borderPrimary,\n bg: colors.badge.pink.background,\n },\n // Component tokens - Toggle\n toggle: {\n handle: colors.toggle.handleDefault,\n 'handle-disabled': colors.toggle.handleDisabled,\n 'off-bg': colors.toggle.off.backgroundDefault,\n 'off-bg-hover': colors.toggle.off.backgroundHover,\n 'on-bg': colors.toggle.on.backgroundDefault,\n 'on-bg-hover': colors.toggle.on.backgroundHover,\n },\n // Component tokens - Menu\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n menu: {\n DEFAULT: colors.menu.backgroundDefault,\n hover: colors.menu.backgroundHover,\n selected: colors.menu.selected,\n },\n // Component tokens - Alert\n 'alert-green': {\n content: colors.alert.green.content,\n bg: colors.alert.green.background,\n },\n 'alert-yellow': {\n content: colors.alert.yellow.content,\n bg: colors.alert.yellow.background,\n },\n 'alert-red': {\n content: colors.alert.red.content,\n bg: colors.alert.red.background,\n },\n },\n // Typography\n fontSize: {\n xs: ['0.75rem', { lineHeight: '1rem' }],\n sm: ['0.875rem', { lineHeight: '1.25rem' }],\n base: ['1rem', { lineHeight: '1.5rem' }],\n lg: ['1.125rem', { lineHeight: '1.75rem' }],\n xl: ['1.25rem', { lineHeight: '1.75rem' }],\n '2xl': ['1.5rem', { lineHeight: '2rem' }],\n '3xl': ['1.875rem', { lineHeight: '2.25rem' }],\n '4xl': ['2.25rem', { lineHeight: '2.5rem' }],\n '5xl': ['3rem', { lineHeight: '1' }],\n '6xl': ['3.75rem', { lineHeight: '1' }],\n },\n // Spacing\n spacing: {\n 0: '0',\n 1: '0.25rem',\n 2: '0.5rem',\n 3: '0.75rem',\n 4: '1rem',\n 5: '1.25rem',\n 6: '1.5rem',\n 8: '2rem',\n 10: '2.5rem',\n 12: '3rem',\n 16: '4rem',\n 20: '5rem',\n 24: '6rem',\n 32: '8rem',\n },\n // Border radius\n borderRadius: {\n none: '0',\n sm: '0.125rem',\n DEFAULT: '0.25rem',\n md: '0.375rem',\n lg: '0.5rem',\n xl: '0.75rem',\n '2xl': '1rem',\n '3xl': '1.5rem',\n full: '9999px',\n },\n // Box shadow \u2014 Figma shadow scale + product glows + elevation\n boxShadow: {\n ...shadows,\n ...glowShadows,\n ...elevationShadows,\n DEFAULT: shadows.sm,\n // Focus rings (4px spread + xs shadow)\n 'focus-primary': focusRings.primary,\n 'focus-neutral': focusRings.neutral,\n 'focus-error': focusRings.error,\n },\n // Backdrop blur \u2014 Figma scale\n // biome-ignore lint: Tailwind preset intentionally maps design tokens from source\n backdropBlur: {\n sm: backdropBlur.sm,\n md: backdropBlur.md,\n lg: backdropBlur.lg,\n xl: backdropBlur.xl,\n },\n // Overlay background colors\n backgroundColor: {\n 'overlay-solid': overlay.solid,\n 'overlay-blur': overlay.blur,\n },\n // Animation\n keyframes: {\n 'fade-in': {\n '0%': { opacity: '0' },\n '100%': { opacity: '1' },\n },\n 'fade-out': {\n '0%': { opacity: '1' },\n '100%': { opacity: '0' },\n },\n 'slide-in-from-top': {\n '0%': { transform: 'translateY(-100%)' },\n '100%': { transform: 'translateY(0)' },\n },\n 'slide-in-from-bottom': {\n '0%': { transform: 'translateY(100%)' },\n '100%': { transform: 'translateY(0)' },\n },\n 'slide-in-from-left': {\n '0%': { transform: 'translateX(-100%)' },\n '100%': { transform: 'translateX(0)' },\n },\n 'slide-in-from-right': {\n '0%': { transform: 'translateX(100%)' },\n '100%': { transform: 'translateX(0)' },\n },\n },\n animation: {\n 'fade-in': 'fade-in 0.2s ease-out',\n 'fade-out': 'fade-out 0.2s ease-out',\n 'slide-in-from-top': 'slide-in-from-top 0.3s ease-out',\n 'slide-in-from-bottom': 'slide-in-from-bottom 0.3s ease-out',\n 'slide-in-from-left': 'slide-in-from-left 0.3s ease-out',\n 'slide-in-from-right': 'slide-in-from-right 0.3s ease-out',\n },\n },\n },\n};\nexport default syntroPreset;\n", "/**\n * Syntro Design System \u2014 Editor Panel Shell Tokens\n *\n * Single source of truth for the floating editor panel's visuals and behavior.\n * Consumed by:\n * - packages/shared-editor-ui/src/components/EditorPanelShell.tsx (React)\n * - packages/shared-editor-ui/src/controllers/PanelShellController.ts (Lit)\n *\n * Any change here updates both React and Lit panels in one step \u2014 no drift.\n */\nimport { base, brand } from './colors';\n// ============================================================================\n// Panel background & shadows\n// ============================================================================\n/** Dark gradient rendered behind the panel contents (backdrop-blur layered on). */\nexport const panelBackground = 'linear-gradient(160deg, rgba(7,8,10,0.84) 0%, rgba(14,17,20,0.88) 45%, rgba(15,19,24,0.84) 100%)';\n/** Outer shadows for the panel, indexed by dock state. */\nexport const panelShadows = {\n /** Free-floating panel \u2014 shadow all sides. */\n floating: '0 8px 60px rgba(0,0,0,0.5)',\n /** Docked to left \u2014 shadow cast rightward into page. */\n dockedLeft: '20px 0 60px rgba(0,0,0,0.5)',\n /** Docked to right \u2014 shadow cast leftward into page. */\n dockedRight: '-20px 0 60px rgba(0,0,0,0.5)',\n};\n/** Backdrop-filter blur radius applied to the panel surface. */\nexport const panelBackdropBlur = '12px';\n// ============================================================================\n// FAB (floating action button) visuals\n// ============================================================================\nexport const fab = {\n /** Diameter in pixels. */\n size: 56,\n /** Inset from the panel's top-left corner in pixels. */\n inset: 12,\n /** Background color (always the brand black). */\n background: base.black,\n /** Icon / logo color. */\n color: base.white,\n /** Border \u2014 2px brand red ring. */\n border: `2px solid ${brand[3]}`,\n /** Shadow when the panel is open (inner ring for \"active\" state). */\n shadowOpen: '0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)',\n /** Shadow when the panel is closed. */\n shadowClosed: '0 4px 24px rgba(0,0,0,0.6)',\n};\n// ============================================================================\n// Behavior: resize, drag, snap\n// ============================================================================\nexport const panelBehavior = {\n /** Minimum panel width when resizing or undocked. */\n minWidth: 480,\n /** Minimum panel height when resizing or undocked. */\n minHeight: 400,\n /** Edge thickness of resize handles in pixels. */\n handleSize: 8,\n /** Pixels the FAB must move before a press becomes a drag (vs a click). */\n dragThreshold: 5,\n /** Distance from a viewport edge that triggers edge-dock snapping. */\n snapThreshold: 20,\n};\n// ============================================================================\n// Aggregate export\n// ============================================================================\nexport const panelShell = {\n background: panelBackground,\n shadows: panelShadows,\n backdropBlur: panelBackdropBlur,\n fab,\n behavior: panelBehavior,\n};\nexport default panelShell;\n", "import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\n/**\n * EditorPanelShell \u2014 moveable, resizable wrapper for editor sidebars.\n *\n * Renders:\n * 1. A fixed FAB button (Syntrologie logo) at the panel's bottom-left corner.\n * Click toggles open/minimized. Drag moves the entire panel.\n * 2. A resizable panel container with semi-transparent background and backdrop blur.\n * Supports docked (left/right edge, full height) and free-floating modes.\n * Position, size, and dock state persist in localStorage.\n */\nimport { panelShell } from '@syntro/design-system';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { cn } from '../cn';\n// =============================================================================\n// Constants\n// =============================================================================\nconst STORAGE_KEY = 'syntro:editor-panel';\nconst MIN_WIDTH = panelShell.behavior.minWidth;\nconst MIN_HEIGHT = panelShell.behavior.minHeight;\nconst FAB_SIZE = panelShell.fab.size;\nconst FAB_INSET = panelShell.fab.inset;\nconst SNAP_THRESHOLD = panelShell.behavior.snapThreshold;\nconst DRAG_THRESHOLD = panelShell.behavior.dragThreshold;\nconst HANDLE_SIZE = panelShell.behavior.handleSize;\n// =============================================================================\n// Logo\n// =============================================================================\n/** Syntrologie logo mark \u2014 inline SVG to avoid CSP issues. */\nfunction SyntroLogo() {\n return (_jsxs(\"svg\", { \"aria-hidden\": \"true\", width: \"28\", height: \"18\", viewBox: \"0 0 101 63\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", children: [_jsx(\"g\", { clipPath: \"url(#syntro-fab-clip)\", children: _jsx(\"path\", { d: \"M51.989 0.284C52.386 0.29 52.808 0.341 53.192 0.443C53.769 0.596 54.362 0.983 54.745 1.442C55.895 2.822 56.767 4.782 57.669 6.357C59.947 10.334 62.152 14.372 64.498 18.307C64.671 18.597 65.127 19.343 65.475 19.411C66.654 19.641 79.278 11.523 81.123 10.317C80.704 8.6 80.624 7.21 81.334 5.525C82.014 3.916 83.317 2.651 84.946 2.019C86.593 1.366 88.286 1.42 89.902 2.123C91.486 2.795 92.733 4.076 93.363 5.677C95.111 10.218 91.347 15.013 86.561 14.442C85.392 14.302 84.649 13.927 83.6 13.441C76.542 18.247 69.094 22.597 61.207 25.907C60.153 26.349 59.42 26.6 58.519 27.328C60.583 27.43 87.034 24.236 87.878 23.781C87.926 23.755 88.048 23.697 88.08 23.652C88.244 23.421 88.277 23.007 88.376 22.735C88.819 21.511 89.563 20.379 90.604 19.586C91.887 18.608 93.6 18.093 95.208 18.324C96.992 18.581 98.67 19.55 99.74 21.005C100.733 22.364 101.141 24.064 100.875 25.726C100.607 27.394 99.692 28.888 98.329 29.887C96.02 31.573 92.641 31.613 90.392 29.789C89.579 29.13 89.177 28.535 88.566 27.692C86.692 28.103 83.447 28.463 81.472 28.73C76.577 29.399 71.671 29.99 66.756 30.504C65.752 30.608 59.279 31.013 58.779 31.24L58.781 31.387C59.106 31.577 66.974 33.025 68.328 33.358C72.475 34.405 76.572 35.64 80.606 37.06C82.709 37.818 84.721 38.686 86.814 39.457C88.505 38.051 89.243 36.875 91.925 36.841C93.665 36.833 95.339 37.506 96.589 38.717C97.986 40.087 98.415 41.541 98.429 43.422C98.417 44.842 98.099 45.978 97.229 47.137C96.168 48.531 94.597 49.447 92.86 49.682C91.161 49.922 89.437 49.472 88.073 48.431C86.201 47.02 85.795 45.462 85.488 43.323C85.255 43.193 85.018 43.071 84.776 42.958C83.907 42.553 78.511 40.359 77.911 40.577C77.837 41.147 78.926 42.592 79.243 43.155L84.336 52.073C85.165 53.529 86.027 54.991 86.789 56.483C87.253 57.391 87.414 58.355 87.056 59.343C86.557 60.722 85.014 61.408 83.626 61.438C81.429 61.427 79.228 61.427 77.029 61.427L62.967 61.427L35.549 61.435C33.337 61.436 20.693 61.626 19.579 61.199C18.758 60.889 18.093 60.265 17.732 59.465C17.455 58.844 17.335 57.994 17.577 57.361C18.242 55.623 19.5 53.659 20.438 52.043L28.119 39.028C28.9 37.701 31.213 33.891 31.7 32.634C25.671 32.936 18.736 32.547 12.6 32.721C11.75 34.138 10.992 35.281 9.368 35.935C7.744 36.588 5.704 36.604 4.097 35.922C2.546 35.272 1.319 34.028 0.69 32.468C0.053 30.839 0.086 29.025 0.781 27.42C2.812 22.739 9.259 22.202 12.05 26.464C12.555 27.235 12.774 27.84 13.104 28.703L26.462 28.711C28.926 28.713 31.729 28.779 34.17 28.668C35.279 26.892 36.442 24.733 37.515 22.901L45.376 9.375C46.797 6.902 48.214 4.368 49.685 1.924C50.222 1.032 50.962 0.493 51.989 0.284ZM22.119 57.31C23.512 57.503 26.045 57.431 27.526 57.429L36.661 57.42L68.412 57.422C73.113 57.421 77.994 57.351 82.68 57.438L75.664 45.098C74.562 43.171 73.093 40.773 72.104 38.827C71.245 38.351 70.291 38.109 69.335 37.848C59.189 35.076 48.669 33.421 38.172 32.796C37.642 32.764 36.994 32.766 36.469 32.794L25.855 50.865C24.634 52.935 23.364 55.302 22.119 57.31ZM52.216 5.513C49.384 10.611 46.473 15.665 43.484 20.673C42.193 22.878 40.862 25.071 39.63 27.31C39.46 27.618 39.36 27.782 39.453 28.133C40.522 28.342 45.866 26.973 47.112 26.644C49.169 26.137 60.135 22.684 61.174 21.436C61.248 21.163 61.287 21.069 61.125 20.762C60.279 19.163 59.326 17.527 58.435 15.958L53.592 7.329C53.355 6.915 52.677 5.599 52.216 5.513ZM96.18 26.494C96.963 25.713 97.12 24.502 96.563 23.547C96.005 22.592 94.872 22.133 93.807 22.432C92.972 22.666 92.324 23.327 92.108 24.167C91.892 25.007 92.14 25.899 92.758 26.507C93.396 27.134 94.327 27.361 95.182 27.096C95.558 26.98 95.901 26.773 96.18 26.494ZM87.871 10.399C89.147 10.087 89.941 8.813 89.659 7.529C89.377 6.246 88.122 5.422 86.832 5.673C85.97 5.841 85.266 6.463 84.994 7.298C84.722 8.133 84.923 9.05 85.52 9.694C86.118 10.339 87.017 10.608 87.871 10.399ZM91.505 40.879C90.185 41.122 89.31 42.388 89.55 43.709C89.791 45.03 91.055 45.907 92.377 45.669C93.22 45.517 93.921 44.933 94.223 44.131C94.525 43.329 94.383 42.428 93.85 41.758C93.29 41.055 92.389 40.717 91.505 40.879ZM9.138 29.557C9.005 28.88 8.592 28.292 8.001 27.937C7.409 27.583 6.696 27.495 6.036 27.697C5.665 27.81 5.326 28.011 5.048 28.282C4.24 29.07 4.079 30.31 4.66 31.278C5.241 32.247 6.411 32.688 7.487 32.346C8.666 31.97 9.376 30.771 9.138 29.557Z\", fill: \"currentColor\" }) }), _jsx(\"defs\", { children: _jsx(\"clipPath\", { id: \"syntro-fab-clip\", children: _jsx(\"rect\", { width: \"101\", height: \"63\", fill: \"white\" }) }) })] }));\n}\n// =============================================================================\n// Geometry Helpers\n// =============================================================================\nfunction getDefaultGeometry() {\n return {\n x: 0,\n y: 0,\n width: MIN_WIDTH,\n height: typeof window !== 'undefined' ? window.innerHeight : 800,\n docked: 'left',\n };\n}\nfunction loadGeometry(storageKey) {\n if (typeof window === 'undefined')\n return getDefaultGeometry();\n try {\n const raw = localStorage.getItem(storageKey);\n if (raw) {\n const parsed = JSON.parse(raw);\n return {\n x: typeof parsed.x === 'number' ? parsed.x : 0,\n y: typeof parsed.y === 'number' ? parsed.y : 0,\n width: Math.max(MIN_WIDTH, typeof parsed.width === 'number' ? parsed.width : MIN_WIDTH),\n height: Math.max(MIN_HEIGHT, typeof parsed.height === 'number' ? parsed.height : window.innerHeight),\n docked: parsed.docked === 'left' || parsed.docked === 'right' ? parsed.docked : null,\n };\n }\n }\n catch {\n /* ignore corrupt localStorage */\n }\n return getDefaultGeometry();\n}\nfunction saveGeometry(storageKey, geo) {\n try {\n localStorage.setItem(storageKey, JSON.stringify(geo));\n }\n catch {\n /* ignore full localStorage */\n }\n}\n/** Compute the panel's actual pixel rect (resolving docked positions). */\nfunction getPanelRect(geo) {\n if (geo.docked === 'left') {\n return { top: 0, left: 0, width: geo.width, height: window.innerHeight };\n }\n if (geo.docked === 'right') {\n return {\n top: 0,\n left: window.innerWidth - geo.width,\n width: geo.width,\n height: window.innerHeight,\n };\n }\n const { x: left, y: top, width, height } = geo;\n return { top, left, width, height };\n}\n/** Compute FAB position from panel geometry (top-left of panel). */\nfunction getFabPosition(geo) {\n const rect = getPanelRect(geo);\n return {\n left: rect.left + FAB_INSET,\n top: rect.top + FAB_INSET,\n };\n}\n/** Clamp geometry so the FAB (top-left) remains visible. */\nfunction clampToViewport(geo) {\n if (geo.docked)\n return geo;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n return {\n ...geo,\n x: Math.max(-(geo.width - FAB_SIZE), Math.min(geo.x, vw - FAB_SIZE)),\n y: Math.max(-FAB_INSET, Math.min(geo.y, vh - FAB_SIZE - FAB_INSET)),\n };\n}\n/** Convert docked geometry to undocked pixel coordinates. */\nfunction undockGeometry(geo) {\n const rect = getPanelRect(geo);\n return {\n x: rect.left,\n y: rect.top,\n width: geo.width,\n height: rect.height,\n docked: null,\n };\n}\n// =============================================================================\n// Resize Handle Definitions\n// =============================================================================\nconst RESIZE_HANDLES = [\n {\n dir: 'n',\n style: { top: 0, left: HANDLE_SIZE, right: HANDLE_SIZE, height: HANDLE_SIZE },\n cursor: 'ns-resize',\n },\n {\n dir: 's',\n style: { bottom: 0, left: HANDLE_SIZE, right: HANDLE_SIZE, height: HANDLE_SIZE },\n cursor: 'ns-resize',\n },\n {\n dir: 'e',\n style: { right: 0, top: HANDLE_SIZE, bottom: HANDLE_SIZE, width: HANDLE_SIZE },\n cursor: 'ew-resize',\n },\n {\n dir: 'w',\n style: { left: 0, top: HANDLE_SIZE, bottom: HANDLE_SIZE, width: HANDLE_SIZE },\n cursor: 'ew-resize',\n },\n {\n dir: 'ne',\n style: { top: 0, right: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nesw-resize',\n },\n {\n dir: 'nw',\n style: { top: 0, left: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nwse-resize',\n },\n {\n dir: 'se',\n style: { bottom: 0, right: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nwse-resize',\n },\n {\n dir: 'sw',\n style: { bottom: 0, left: 0, width: HANDLE_SIZE * 2, height: HANDLE_SIZE * 2 },\n cursor: 'nesw-resize',\n },\n];\n// =============================================================================\n// Component\n// =============================================================================\nexport function EditorPanelShell({ isOpen, onToggle, panelId, zIndex = 2147483647, children, }) {\n const storageKey = panelId ? `syntro:editor-panel:${panelId}` : STORAGE_KEY;\n const [geometry, setGeometry] = useState(() => loadGeometry(storageKey));\n const geoRef = useRef(geometry);\n geoRef.current = geometry;\n const panelRef = useRef(null);\n const fabRef = useRef(null);\n // Drag state (refs for performance \u2014 no re-renders during drag)\n const isDragging = useRef(false);\n const hasMoved = useRef(false);\n const dragOffset = useRef({ x: 0, y: 0 });\n const startPanelPos = useRef({ x: 0, y: 0 });\n const pendingGeo = useRef(null);\n // Resize state\n const activeResize = useRef(null);\n const resizeStartMouse = useRef({ x: 0, y: 0 });\n const resizeStartGeo = useRef(getDefaultGeometry());\n // Persist geometry on change\n useEffect(() => {\n saveGeometry(storageKey, geometry);\n }, [storageKey, geometry]);\n // Viewport clamping on window resize\n useEffect(() => {\n const handler = () => setGeometry((prev) => clampToViewport(prev));\n window.addEventListener('resize', handler);\n return () => window.removeEventListener('resize', handler);\n }, []);\n // ---- FAB DRAG HANDLERS ----\n const handleFabPointerDown = useCallback((e) => {\n isDragging.current = true;\n hasMoved.current = false;\n const rect = getPanelRect(geoRef.current);\n startPanelPos.current = { x: rect.left, y: rect.top };\n dragOffset.current = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top,\n };\n e.target.setPointerCapture(e.pointerId);\n e.preventDefault();\n }, []);\n const handleFabPointerMove = useCallback((e) => {\n if (!isDragging.current)\n return;\n const newX = e.clientX - dragOffset.current.x;\n const newY = e.clientY - dragOffset.current.y;\n if (!hasMoved.current) {\n const dx = Math.abs(newX - startPanelPos.current.x);\n const dy = Math.abs(newY - startPanelPos.current.y);\n if (dx < DRAG_THRESHOLD && dy < DRAG_THRESHOLD)\n return;\n hasMoved.current = true;\n }\n const geo = geoRef.current;\n const height = geo.docked ? window.innerHeight : geo.height;\n // Update panel DOM directly for performance (bypass React re-render)\n if (panelRef.current) {\n panelRef.current.style.left = `${newX}px`;\n panelRef.current.style.top = `${newY}px`;\n panelRef.current.style.right = 'auto';\n panelRef.current.style.height = `${height}px`;\n }\n if (fabRef.current) {\n fabRef.current.style.left = `${newX + FAB_INSET}px`;\n fabRef.current.style.top = `${newY + FAB_INSET}px`;\n }\n pendingGeo.current = { x: newX, y: newY, width: geo.width, height, docked: null };\n }, []);\n const handleFabPointerUp = useCallback((e) => {\n e.target.releasePointerCapture(e.pointerId);\n const wasDragging = hasMoved.current;\n isDragging.current = false;\n hasMoved.current = false;\n if (!wasDragging) {\n onToggle();\n return;\n }\n if (pendingGeo.current) {\n const geo = pendingGeo.current;\n // Edge snapping\n if (geo.x <= SNAP_THRESHOLD) {\n setGeometry({ ...geo, docked: 'left', x: 0, y: 0 });\n }\n else if (geo.x + geo.width >= window.innerWidth - SNAP_THRESHOLD) {\n setGeometry({ ...geo, docked: 'right', x: 0, y: 0 });\n }\n else {\n setGeometry(geo);\n }\n pendingGeo.current = null;\n }\n }, [onToggle]);\n // ---- RESIZE HANDLERS ----\n const handleResizePointerDown = useCallback((e) => {\n const dir = e.currentTarget.dataset.resizeDir;\n if (!dir)\n return;\n let geo = geoRef.current;\n // Undock if currently docked\n if (geo.docked) {\n geo = undockGeometry(geo);\n geoRef.current = geo;\n setGeometry(geo);\n }\n activeResize.current = dir;\n resizeStartMouse.current = { x: e.clientX, y: e.clientY };\n resizeStartGeo.current = { ...geo };\n e.target.setPointerCapture(e.pointerId);\n e.preventDefault();\n }, []);\n const handleResizePointerMove = useCallback((e) => {\n if (!activeResize.current)\n return;\n const dx = e.clientX - resizeStartMouse.current.x;\n const dy = e.clientY - resizeStartMouse.current.y;\n const dir = activeResize.current;\n const start = resizeStartGeo.current;\n let { x, y, width, height } = start;\n if (dir.includes('e'))\n width = Math.max(MIN_WIDTH, start.width + dx);\n if (dir.includes('w')) {\n const newW = Math.max(MIN_WIDTH, start.width - dx);\n x = start.x + start.width - newW;\n width = newW;\n }\n if (dir.includes('s'))\n height = Math.max(MIN_HEIGHT, start.height + dy);\n if (dir.includes('n')) {\n const newH = Math.max(MIN_HEIGHT, start.height - dy);\n y = start.y + start.height - newH;\n height = newH;\n }\n // Update DOM directly for performance\n if (panelRef.current) {\n panelRef.current.style.left = `${x}px`;\n panelRef.current.style.top = `${y}px`;\n panelRef.current.style.width = `${width}px`;\n panelRef.current.style.height = `${height}px`;\n }\n if (fabRef.current) {\n fabRef.current.style.left = `${x + FAB_INSET}px`;\n fabRef.current.style.top = `${y + FAB_INSET}px`;\n }\n pendingGeo.current = { x, y, width, height, docked: null };\n }, []);\n const handleResizePointerUp = useCallback((e) => {\n e.target.releasePointerCapture(e.pointerId);\n activeResize.current = null;\n if (pendingGeo.current) {\n setGeometry(pendingGeo.current);\n pendingGeo.current = null;\n }\n }, []);\n // ---- COMPUTED STYLES ----\n const isDocked = geometry.docked !== null;\n const fabPos = getFabPosition(geometry);\n const panelStyle = {\n position: 'fixed',\n zIndex,\n background: panelShell.background,\n backdropFilter: `blur(${panelShell.backdropBlur})`,\n WebkitBackdropFilter: `blur(${panelShell.backdropBlur})`,\n boxShadow: isDocked\n ? geometry.docked === 'right'\n ? panelShell.shadows.dockedRight\n : panelShell.shadows.dockedLeft\n : panelShell.shadows.floating,\n // Prevent wheel scroll from chaining to the page behind the panel.\n // overflow-y: auto makes this a scroll container so overscroll-behavior applies.\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n };\n if (geometry.docked === 'left') {\n panelStyle.top = 0;\n panelStyle.left = 0;\n panelStyle.width = geometry.width;\n panelStyle.height = '100vh';\n }\n else if (geometry.docked === 'right') {\n panelStyle.top = 0;\n panelStyle.right = 0;\n panelStyle.width = geometry.width;\n panelStyle.height = '100vh';\n }\n else {\n panelStyle.top = geometry.y;\n panelStyle.left = geometry.x;\n panelStyle.width = geometry.width;\n panelStyle.height = geometry.height;\n }\n const fabStyle = {\n position: 'fixed',\n left: fabPos.left,\n top: fabPos.top,\n zIndex,\n width: FAB_SIZE,\n height: FAB_SIZE,\n borderRadius: '50%',\n border: panelShell.fab.border,\n cursor: 'grab',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: panelShell.fab.background,\n color: panelShell.fab.color,\n boxShadow: isOpen ? panelShell.fab.shadowOpen : panelShell.fab.shadowClosed,\n transition: 'box-shadow 150ms ease',\n touchAction: 'none',\n userSelect: 'none',\n WebkitUserSelect: 'none',\n };\n return (_jsxs(_Fragment, { children: [isOpen && (_jsxs(\"div\", { ref: panelRef, ...(panelId ? { id: panelId } : {}), \"data-syntro-editor-panel\": true, \"data-syntro-editor-ui\": \"panel\", className: cn('syntro-editor-scope se-fixed se-flex se-flex-col se-text-text-primary se-backdrop-blur-xl se-font-sans se-antialiased se-overflow-hidden', isDocked\n ? geometry.docked === 'right'\n ? 'se-border-l se-border-border-primary'\n : 'se-border-r se-border-border-primary'\n : 'se-rounded-lg se-border se-border-border-primary'), style: panelStyle, children: [RESIZE_HANDLES.map(({ dir, style, cursor }) => (_jsx(\"div\", { \"data-syntro-editor-ui\": `resize-${dir}`, \"data-resize-dir\": dir, onPointerDown: handleResizePointerDown, onPointerMove: handleResizePointerMove, onPointerUp: handleResizePointerUp, style: {\n position: 'absolute',\n ...style,\n cursor,\n zIndex: 1,\n touchAction: 'none',\n } }, dir))), children] })), _jsx(\"div\", { className: \"syntro-editor-scope\", \"data-syntro-editor-ui\": \"fab-wrapper\", style: { display: 'contents' }, children: _jsx(\"button\", { ref: fabRef, type: \"button\", \"data-syntro-fab\": true, \"data-syntro-editor-ui\": \"fab\", onPointerDown: handleFabPointerDown, onPointerMove: handleFabPointerMove, onPointerUp: handleFabPointerUp, style: fabStyle, title: isOpen ? 'Minimize panel' : 'Open panel', children: _jsx(SyntroLogo, {}) }) })] }));\n}\n", "import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function EmptyState({ message }) {\n return (_jsx(\"div\", { className: \"se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm\", children: message }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { cn } from '../cn';\nexport function GroupHeader({ label, count, className }) {\n return (_jsxs(\"div\", { className: cn('se-text-xs se-font-bold se-text-text-primary se-uppercase se-tracking-wide se-py-1 se-pb-2 se-flex se-items-center se-justify-between', className), children: [_jsx(\"span\", { children: label }), _jsx(\"span\", { className: \"se-text-xs se-text-text-secondary se-bg-badge-slate-bg se-px-1.5 se-py-0.5 se-rounded-lg\", children: count })] }));\n}\n", "import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * TriggerJourney \u2014 compact horizontal node graph for triggerWhen conditions.\n *\n * Displays each condition as a small circle node connected by lines.\n * Nodes light up green as conditions are met.\n */\nimport { Check } from 'lucide-react';\nimport { cn } from '../cn';\n/* ------------------------------------------------------------------ */\n/* Internal: small progress bar for event_count nodes */\n/* ------------------------------------------------------------------ */\nfunction ProgressBar({ current, target }) {\n const pct = Math.min(100, Math.round((current / Math.max(target, 1)) * 100));\n return (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-0.5\", children: [_jsx(\"span\", { className: \"se-inline-block se-w-8 se-h-1 se-rounded-full se-bg-white/20\", title: `${current}/${target} (${pct}%)`, children: _jsx(\"span\", { className: cn('se-block se-h-full se-rounded-full se-transition-all', pct >= 100 ? 'se-bg-green-4' : 'se-bg-blue-4'), style: { width: `${pct}%` } }) }), _jsxs(\"span\", { className: \"se-text-[11px] se-font-medium se-text-text-secondary\", children: [current, \"/\", target] })] }));\n}\n/* ------------------------------------------------------------------ */\n/* Internal: single journey node with label + optional connection */\n/* ------------------------------------------------------------------ */\nfunction JourneyNode({ cs, isLast }) {\n const hasProgress = !!cs.formatted.progress;\n const inProgress = !cs.passed && hasProgress && cs.formatted.progress.current > 0;\n return (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-0\", children: [_jsxs(\"div\", { className: \"se-flex se-flex-col se-items-center se-min-w-0\", children: [_jsx(\"div\", { \"data-journey-node\": true, \"data-passed\": cs.passed ? 'true' : 'false', className: cn('se-w-4 se-h-4 se-rounded-full se-border-2 se-flex se-items-center se-justify-center se-shrink-0', cs.passed\n ? 'se-bg-green-4 se-border-green-4'\n : inProgress\n ? 'se-bg-blue-4 se-border-blue-4'\n : 'se-bg-transparent se-border-white/30'), children: cs.passed && _jsx(Check, { className: \"se-w-2.5 se-h-2.5 se-text-white\" }) }), _jsx(\"span\", { className: \"se-text-[11px] se-font-medium se-text-text-secondary se-truncate se-max-w-[60px] se-text-center se-mt-0.5\", title: cs.formatted.instruction, children: cs.formatted.shortLabel }), hasProgress && (_jsx(ProgressBar, { current: cs.formatted.progress.current, target: cs.formatted.progress.target }))] }), !isLast && (_jsx(\"div\", { \"data-journey-line\": true, className: cn('se-h-0.5 se-w-4 se-self-start se-mt-2 se-shrink-0', cs.passed ? 'se-bg-green-4' : 'se-bg-white/20') }))] }));\n}\n/* ------------------------------------------------------------------ */\n/* Main component */\n/* ------------------------------------------------------------------ */\nexport function TriggerJourney({ status }) {\n if (!status || status.conditions.length === 0) {\n return (_jsx(\"div\", { className: \"se-mt-1 se-text-[12px] se-font-medium se-text-text-secondary se-italic\", children: \"Always Present\" }));\n }\n const { conditions } = status;\n const allPassed = conditions.every((c) => c.passed);\n const isMulti = conditions.length > 1;\n return (_jsxs(\"div\", { className: \"se-mt-1\", children: [_jsx(\"div\", { className: \"se-flex se-items-start\", children: conditions.map((cs, i) => (_jsx(JourneyNode, { cs: cs, isLast: i === conditions.length - 1 }, i))) }), allPassed && isMulti && (_jsxs(\"div\", { className: \"se-flex se-items-center se-gap-1 se-mt-1 se-text-[12px] se-text-green-4\", children: [_jsx(Check, { className: \"se-w-3 se-h-3\" }), _jsx(\"span\", { children: \"All conditions met\" })] }))] }));\n}\n", "/**\n * PanelShellController \u2014 Lit ReactiveController for draggable/resizable panels.\n *\n * Owns geometry state (position, size, dock), pointer-event handlers for the\n * drag FAB and 8 resize handles, localStorage persistence, and viewport\n * clamping. A consuming LitElement calls `attachFab(el)` / `attachHandle(el, dir)`\n * on its rendered DOM to hook up pointer events, and reads `panelStyles` /\n * `fabStyles` to position the panel + FAB.\n *\n * Why a controller, not a wrapper element: `<slot>`-based wrapper elements\n * don't compose well in light DOM (Lit wipes children on render), and shadow\n * DOM breaks Playwright child selectors used by E2E tests. A ReactiveController\n * is the Lit-idiomatic way to share stateful logic across elements.\n *\n * Emits one callback: `onToggle` when the FAB is pressed without dragging.\n */\nimport { panelShell } from '@syntro/design-system';\n// =============================================================================\n// Constants\n// =============================================================================\nconst DEFAULTS = {\n minWidth: panelShell.behavior.minWidth,\n minHeight: panelShell.behavior.minHeight,\n dragThreshold: panelShell.behavior.dragThreshold,\n snapThreshold: panelShell.behavior.snapThreshold,\n fabSize: panelShell.fab.size,\n fabInset: panelShell.fab.inset,\n storageKey: 'syntro:editor-panel',\n};\nconst HANDLE_SIZE = panelShell.behavior.handleSize;\n// =============================================================================\n// Helpers\n// =============================================================================\nexport function makeResizeHandles() {\n return [\n {\n dir: 'n',\n style: {\n top: '0',\n left: `${HANDLE_SIZE}px`,\n right: `${HANDLE_SIZE}px`,\n height: `${HANDLE_SIZE}px`,\n },\n cursor: 'ns-resize',\n },\n {\n dir: 's',\n style: {\n bottom: '0',\n left: `${HANDLE_SIZE}px`,\n right: `${HANDLE_SIZE}px`,\n height: `${HANDLE_SIZE}px`,\n },\n cursor: 'ns-resize',\n },\n {\n dir: 'e',\n style: {\n right: '0',\n top: `${HANDLE_SIZE}px`,\n bottom: `${HANDLE_SIZE}px`,\n width: `${HANDLE_SIZE}px`,\n },\n cursor: 'ew-resize',\n },\n {\n dir: 'w',\n style: {\n left: '0',\n top: `${HANDLE_SIZE}px`,\n bottom: `${HANDLE_SIZE}px`,\n width: `${HANDLE_SIZE}px`,\n },\n cursor: 'ew-resize',\n },\n {\n dir: 'ne',\n style: {\n top: '0',\n right: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nesw-resize',\n },\n {\n dir: 'nw',\n style: {\n top: '0',\n left: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nwse-resize',\n },\n {\n dir: 'se',\n style: {\n bottom: '0',\n right: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nwse-resize',\n },\n {\n dir: 'sw',\n style: {\n bottom: '0',\n left: '0',\n width: `${HANDLE_SIZE * 2}px`,\n height: `${HANDLE_SIZE * 2}px`,\n },\n cursor: 'nesw-resize',\n },\n ];\n}\n// =============================================================================\n// Controller\n// =============================================================================\nexport class PanelShellController {\n constructor(host, options = {}) {\n this._panelEl = null;\n this._fabEl = null;\n // Drag state\n this._isDragging = false;\n this._hasMoved = false;\n this._dragOffset = { x: 0, y: 0 };\n this._startPanelPos = { x: 0, y: 0 };\n this._pendingGeo = null;\n // Resize state\n this._activeResize = null;\n this._resizeStartMouse = { x: 0, y: 0 };\n // ---- FAB pointer handlers ----\n this.handleFabPointerDown = (e) => {\n this._isDragging = true;\n this._hasMoved = false;\n const rect = this.rect;\n this._startPanelPos = { x: rect.left, y: rect.top };\n this._dragOffset = { x: e.clientX - rect.left, y: e.clientY - rect.top };\n try {\n e.target.setPointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n e.preventDefault();\n };\n this.handleFabPointerMove = (e) => {\n if (!this._isDragging)\n return;\n const newX = e.clientX - this._dragOffset.x;\n const newY = e.clientY - this._dragOffset.y;\n if (!this._hasMoved) {\n const dx = Math.abs(newX - this._startPanelPos.x);\n const dy = Math.abs(newY - this._startPanelPos.y);\n if (dx < this.opts.dragThreshold && dy < this.opts.dragThreshold)\n return;\n this._hasMoved = true;\n }\n const geo = this._geometry;\n const height = geo.docked ? window.innerHeight : geo.height;\n this._writeStylesDuringGesture({ x: newX, y: newY, width: geo.width, height });\n this._pendingGeo = { x: newX, y: newY, width: geo.width, height, docked: null };\n };\n this.handleFabPointerUp = (e) => {\n try {\n e.target.releasePointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n const wasDragging = this._hasMoved;\n this._isDragging = false;\n this._hasMoved = false;\n if (!wasDragging) {\n this.opts.onToggle?.();\n return;\n }\n if (this._pendingGeo) {\n const geo = this._pendingGeo;\n if (geo.x <= this.opts.snapThreshold) {\n this._commit({ ...geo, docked: 'left', x: 0, y: 0 });\n }\n else if (geo.x + geo.width >= window.innerWidth - this.opts.snapThreshold) {\n this._commit({ ...geo, docked: 'right', x: 0, y: 0 });\n }\n else {\n this._commit(geo);\n }\n this._pendingGeo = null;\n }\n };\n // ---- Resize pointer handlers ----\n this.handleResizePointerDown = (dir, e) => {\n let geo = this._geometry;\n if (geo.docked) {\n geo = this._undockGeometry(geo);\n this._commit(geo);\n }\n this._activeResize = dir;\n this._resizeStartMouse = { x: e.clientX, y: e.clientY };\n this._resizeStartGeo = { ...geo };\n try {\n e.target.setPointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n e.preventDefault();\n };\n this.handleResizePointerMove = (e) => {\n if (!this._activeResize)\n return;\n const dx = e.clientX - this._resizeStartMouse.x;\n const dy = e.clientY - this._resizeStartMouse.y;\n const dir = this._activeResize;\n const start = this._resizeStartGeo;\n let { x, y, width, height } = start;\n if (dir.includes('e'))\n width = Math.max(this.opts.minWidth, start.width + dx);\n if (dir.includes('w')) {\n const newW = Math.max(this.opts.minWidth, start.width - dx);\n x = start.x + start.width - newW;\n width = newW;\n }\n if (dir.includes('s'))\n height = Math.max(this.opts.minHeight, start.height + dy);\n if (dir.includes('n')) {\n const newH = Math.max(this.opts.minHeight, start.height - dy);\n y = start.y + start.height - newH;\n height = newH;\n }\n this._writeStylesDuringGesture({ x, y, width, height });\n this._pendingGeo = { x, y, width, height, docked: null };\n };\n this.handleResizePointerUp = (e) => {\n try {\n e.target.releasePointerCapture(e.pointerId);\n }\n catch {\n // best-effort\n }\n this._activeResize = null;\n if (this._pendingGeo) {\n this._commit(this._pendingGeo);\n this._pendingGeo = null;\n }\n };\n this._onWindowResize = () => {\n this._commit(this._clampToViewport(this._geometry));\n };\n this.host = host;\n this.opts = {\n storageKey: options.storageKey ?? DEFAULTS.storageKey,\n minWidth: options.minWidth ?? DEFAULTS.minWidth,\n minHeight: options.minHeight ?? DEFAULTS.minHeight,\n dragThreshold: options.dragThreshold ?? DEFAULTS.dragThreshold,\n snapThreshold: options.snapThreshold ?? DEFAULTS.snapThreshold,\n fabSize: options.fabSize ?? DEFAULTS.fabSize,\n fabInset: options.fabInset ?? DEFAULTS.fabInset,\n onToggle: options.onToggle,\n defaultGeometry: this._resolveDefaultGeometry(options.defaultGeometry),\n };\n this._geometry = this.opts.defaultGeometry;\n this._resizeStartGeo = this._geometry;\n host.addController(this);\n }\n // ---- Public API ----\n /** Current geometry (read-only snapshot). */\n get geometry() {\n return this._geometry;\n }\n /** Pixel rect of the panel, resolving docked positions. */\n get rect() {\n return this._panelRect(this._geometry);\n }\n /** Pixel right edge of the panel (useful for positioning adjacent UI). */\n get rightEdge() {\n const r = this.rect;\n return r.left + r.width;\n }\n /** Set geometry directly \u2014 useful for testing or external state sync. */\n setGeometry(geo) {\n this._geometry = geo;\n this._saveGeometry(geo);\n this.host.requestUpdate();\n }\n /** Reset geometry to default (and clear persisted state). */\n reset() {\n this._geometry = this.opts.defaultGeometry;\n try {\n localStorage.removeItem(this.opts.storageKey);\n }\n catch {\n // ignore\n }\n this.host.requestUpdate();\n }\n /** Styles to apply to the panel element. */\n panelStyles() {\n const geo = this._geometry;\n const blur = `blur(${panelShell.backdropBlur})`;\n const shadow = geo.docked === 'right'\n ? panelShell.shadows.dockedRight\n : geo.docked === 'left'\n ? panelShell.shadows.dockedLeft\n : panelShell.shadows.floating;\n const styles = {\n position: 'fixed',\n pointerEvents: 'auto',\n background: panelShell.background,\n backdropFilter: blur,\n webkitBackdropFilter: blur,\n boxShadow: shadow,\n overflow: 'hidden',\n };\n if (geo.docked === 'left') {\n styles.top = '0';\n styles.left = '0';\n styles.width = `${geo.width}px`;\n styles.height = '100vh';\n }\n else if (geo.docked === 'right') {\n styles.top = '0';\n styles.right = '0';\n styles.width = `${geo.width}px`;\n styles.height = '100vh';\n }\n else {\n styles.top = `${geo.y}px`;\n styles.left = `${geo.x}px`;\n styles.width = `${geo.width}px`;\n styles.height = `${geo.height}px`;\n }\n return styles;\n }\n /** Styles to apply to the FAB button. `isOpen` adjusts the shadow. */\n fabStyles(isOpen) {\n const rect = this.rect;\n return {\n position: 'fixed',\n left: `${rect.left + this.opts.fabInset}px`,\n top: `${rect.top + rect.height - this.opts.fabSize - this.opts.fabInset}px`,\n pointerEvents: 'auto',\n width: `${this.opts.fabSize}px`,\n height: `${this.opts.fabSize}px`,\n borderRadius: '50%',\n border: panelShell.fab.border,\n cursor: 'grab',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: panelShell.fab.background,\n color: panelShell.fab.color,\n boxShadow: isOpen ? panelShell.fab.shadowOpen : panelShell.fab.shadowClosed,\n transition: 'box-shadow 150ms ease',\n touchAction: 'none',\n userSelect: 'none',\n webkitUserSelect: 'none',\n };\n }\n /** Direction descriptors for the 8 resize handles. */\n get handles() {\n return makeResizeHandles();\n }\n /** Bind the current panel element so the controller can direct-write styles during drag/resize. */\n attachPanel(el) {\n this._panelEl = el;\n }\n /** Bind the current FAB element. */\n attachFab(el) {\n this._fabEl = el;\n }\n // ---- ReactiveController lifecycle ----\n hostConnected() {\n this._geometry = this._loadGeometry();\n this.host.requestUpdate();\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', this._onWindowResize);\n }\n }\n hostDisconnected() {\n if (typeof window !== 'undefined') {\n window.removeEventListener('resize', this._onWindowResize);\n }\n }\n // ---- Internals ----\n _commit(geo) {\n this._geometry = geo;\n this._saveGeometry(geo);\n this.host.requestUpdate();\n }\n _writeStylesDuringGesture({ x, y, width, height, }) {\n if (this._panelEl) {\n this._panelEl.style.left = `${x}px`;\n this._panelEl.style.top = `${y}px`;\n this._panelEl.style.right = 'auto';\n this._panelEl.style.width = `${width}px`;\n this._panelEl.style.height = `${height}px`;\n }\n if (this._fabEl) {\n this._fabEl.style.left = `${x + this.opts.fabInset}px`;\n this._fabEl.style.top = `${y + height - this.opts.fabSize - this.opts.fabInset}px`;\n }\n }\n _clampToViewport(geo) {\n if (geo.docked)\n return geo;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n // FAB sits at panel's bottom-left: fabTop = geo.y + geo.height - fabSize - fabInset.\n // Keep fabTop in [0, vh - fabSize] so the FAB stays on-screen even if the panel\n // extends above the viewport top or below the viewport bottom.\n const minY = this.opts.fabSize + this.opts.fabInset - geo.height;\n const maxY = vh - geo.height + this.opts.fabInset;\n return {\n ...geo,\n x: Math.max(-(geo.width - this.opts.fabSize), Math.min(geo.x, vw - this.opts.fabSize)),\n y: Math.max(minY, Math.min(geo.y, maxY)),\n };\n }\n _undockGeometry(geo) {\n const r = this._panelRect(geo);\n return { x: r.left, y: r.top, width: geo.width, height: r.height, docked: null };\n }\n _panelRect(geo) {\n if (geo.docked === 'left') {\n return { top: 0, left: 0, width: geo.width, height: window.innerHeight };\n }\n if (geo.docked === 'right') {\n return {\n top: 0,\n left: window.innerWidth - geo.width,\n width: geo.width,\n height: window.innerHeight,\n };\n }\n const { x: left, y: top, width, height } = geo;\n return { top, left, width, height };\n }\n _loadGeometry() {\n if (typeof window === 'undefined')\n return this.opts.defaultGeometry;\n try {\n const raw = localStorage.getItem(this.opts.storageKey);\n if (!raw)\n return this.opts.defaultGeometry;\n const p = JSON.parse(raw);\n return {\n x: typeof p.x === 'number' ? p.x : 0,\n y: typeof p.y === 'number' ? p.y : 0,\n width: Math.max(this.opts.minWidth, typeof p.width === 'number' ? p.width : this.opts.minWidth),\n height: Math.max(this.opts.minHeight, typeof p.height === 'number' ? p.height : window.innerHeight),\n docked: p.docked === 'left' || p.docked === 'right' ? p.docked : null,\n };\n }\n catch {\n return this.opts.defaultGeometry;\n }\n }\n _saveGeometry(geo) {\n try {\n localStorage.setItem(this.opts.storageKey, JSON.stringify(geo));\n }\n catch {\n // ignore\n }\n }\n _resolveDefaultGeometry(partial) {\n const w = typeof window !== 'undefined' ? window : null;\n const base = {\n x: 0,\n y: 0,\n width: DEFAULTS.minWidth,\n height: w ? w.innerHeight : 800,\n docked: 'right',\n };\n return { ...base, ...(partial ?? {}) };\n }\n}\n", "/**\n * Format a triggerWhen condition into a human-readable label.\n * Pure function \u2014 no runtime dependency.\n */\n/**\n * Format match criteria as a parenthetical string.\n * { tagName: 'a' } \u2192 '(tagName: a)'\n */\nfunction _formatMatch(match) {\n if (!match || Object.keys(match).length === 0)\n return '';\n const parts = Object.entries(match).map(([k, v]) => `${k}: ${v}`);\n return ` (${parts.join(', ')})`;\n}\n/**\n * Format an operator for display.\n */\nfunction formatOperator(op) {\n switch (op) {\n case 'gte':\n return '\\u2265'; // \u2265\n case 'lte':\n return '\\u2264'; // \u2264\n case 'gt':\n return '>';\n case 'lt':\n return '<';\n case 'eq':\n return '=';\n default:\n return op;\n }\n}\n/**\n * Convert a hyphenated or underscored key into human-readable lowercase text.\n * e.g. \"fine-arts-page-views\" \u2192 \"fine arts page views\"\n */\nfunction humanizeKey(key) {\n return key.replace(/[-_]/g, ' ').toLowerCase();\n}\n/**\n * Strip trailing wildcard segments from a URL path.\n * e.g. \"/fine-arts/**\" \u2192 \"/fine-arts/\"\n */\nfunction cleanUrl(url) {\n return url.replace(/\\/?\\*+$/, '/').replace(/\\/\\/$/, '/');\n}\n// Pre-compiled regexes for event_count classification\nconst PAGE_VIEW_RE = /page.?view/i;\nconst CLICK_RE = /click/i;\n/**\n * Convert a Condition object into a human-readable label.\n * For event_count conditions, also returns progress data.\n */\nexport function formatConditionLabel(condition, accumulatorCount) {\n switch (condition.type) {\n case 'event_count': {\n const key = condition.key;\n const op = condition.operator;\n const target = condition.count;\n const current = accumulatorCount ?? 0;\n const humanized = humanizeKey(key);\n let instruction;\n let shortLabel;\n if (PAGE_VIEW_RE.test(humanized)) {\n // Extract the topic by removing \"page view(s)\" from the humanized key\n const topic = humanized.replace(/\\s*page\\s*views?\\s*/i, '').trim();\n instruction = topic\n ? `View ${topic} pages ${target}+ times`\n : `View pages ${target}+ times`;\n shortLabel = `View ${target}+ times`;\n }\n else if (CLICK_RE.test(humanized)) {\n const topic = humanized.replace(/\\s*clicks?\\s*/i, '').trim();\n instruction = topic ? `Click ${topic} ${target}+ times` : `Click ${target}+ times`;\n shortLabel = `${target}+ clicks`;\n }\n else {\n // Generic event\n const lastWord = humanized\n .trim()\n .split(' ')\n .filter((w) => w)\n .pop() || 'events';\n instruction = `Reach ${target}+ ${humanized} events`;\n shortLabel = `${target}+ ${lastWord}s`;\n }\n return {\n label: `${key} ${formatOperator(op)} ${target}`,\n instruction,\n shortLabel,\n progress: { current, target, operator: op },\n };\n }\n case 'page_url': {\n const url = condition.url;\n const cleaned = cleanUrl(url);\n const hasWildcard = url !== cleaned;\n const instruction = hasWildcard ? `Visit a ${cleaned} page` : `Visit ${cleaned}`;\n return {\n label: `${url}`,\n instruction,\n shortLabel: cleaned,\n };\n }\n case 'anchor_visible': {\n const rawAnchor = condition.anchorId;\n const anchorId = typeof rawAnchor === 'string'\n ? rawAnchor\n : (rawAnchor?.selector ?? '');\n const state = condition.state;\n return {\n label: `${anchorId} (${state})`,\n instruction: `Scroll until ${anchorId} is ${state}`,\n shortLabel: `${anchorId}`,\n };\n }\n case 'event_occurred': {\n const eventName = condition.eventName;\n return {\n label: `${eventName}`,\n instruction: `Trigger a ${eventName} event`,\n shortLabel: `${eventName}`,\n };\n }\n case 'state_equals': {\n const key = condition.key;\n const val = condition.value === undefined ? 'undefined' : JSON.stringify(condition.value);\n return {\n label: `${key} = ${val}`,\n instruction: `${key} equals ${val}`,\n shortLabel: `${key}`,\n };\n }\n case 'viewport': {\n const parts = [];\n if (condition.minWidth !== undefined)\n parts.push(`w ${formatOperator('gte')} ${condition.minWidth}px`);\n if (condition.maxWidth !== undefined)\n parts.push(`w ${formatOperator('lte')} ${condition.maxWidth}px`);\n if (condition.minHeight !== undefined)\n parts.push(`h ${formatOperator('gte')} ${condition.minHeight}px`);\n if (condition.maxHeight !== undefined)\n parts.push(`h ${formatOperator('lte')} ${condition.maxHeight}px`);\n const label = parts.join(', ') || 'any viewport';\n const instruction = parts.length > 0 ? `Use a viewport ${parts.join(' and ')}` : 'Use a viewport of any size';\n const shortLabel = parts.length > 0 ? parts[0] : 'Any size';\n return { label, instruction, shortLabel };\n }\n case 'session_metric': {\n const key = condition.key;\n const op = condition.operator;\n const threshold = condition.threshold;\n return {\n label: `${key} ${formatOperator(op)} ${threshold}`,\n instruction: `${key} reaches ${threshold}+`,\n shortLabel: `${key} ${threshold}+`,\n };\n }\n case 'dismissed': {\n const inverted = condition.inverted;\n const key = condition.key;\n const target = key || 'this';\n return {\n label: inverted ? 'not dismissed' : 'dismissed',\n instruction: inverted ? `Do not dismiss ${target}` : `Dismiss ${target}`,\n shortLabel: inverted ? 'Not dismissed' : 'Dismissed',\n };\n }\n case 'cooldown_active': {\n const inverted = condition.inverted;\n return {\n label: inverted ? 'cooldown inactive' : 'cooldown active',\n instruction: inverted ? 'Wait for cooldown to expire' : 'Cooldown is active',\n shortLabel: inverted ? 'Cooldown done' : 'Cooldown active',\n };\n }\n case 'frequency_limit': {\n const inverted = condition.inverted;\n const limit = condition.limit;\n return {\n label: `shown ${formatOperator(inverted ? 'lt' : 'gte')} ${limit} times`,\n instruction: inverted ? `Shown fewer than ${limit} times` : `Shown ${limit}+ times`,\n shortLabel: inverted ? `< ${limit} views` : `${limit}+ views`,\n };\n }\n case 'route': {\n const routeId = condition.routeId;\n return {\n label: `${routeId}`,\n instruction: `Navigate to ${routeId} route`,\n shortLabel: `${routeId}`,\n };\n }\n default:\n return {\n label: `${condition.type}`,\n instruction: `${condition.type}`,\n shortLabel: `${condition.type}`,\n };\n }\n}\n", "/**\n * useTriggerWhenStatus \u2014 live triggerWhen evaluation for editor diagnostics.\n *\n * Delegates condition evaluation to the runtime's evaluateSync() method,\n * eliminating duplicated logic. Subscribes to the EventAccumulator for\n * reactive updates.\n *\n * NOTE: This hook accesses `window.SynOS.handle.runtime` directly\n * because EditorPanelProps doesn't expose runtime. This is safe \u2014\n * the editor only runs after runtime bootstrap.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { formatConditionLabel } from '../formatConditionLabel';\n/**\n * Build a RuntimeLike from the real SynOS.handle.runtime.\n */\nfunction getRuntime() {\n const rt = window.SynOS?.handle?.runtime;\n if (!rt?.evaluateSync)\n return null;\n return {\n evaluateSync: rt.evaluateSync.bind(rt),\n accumulator: rt.accumulator,\n };\n}\n/**\n * Evaluate all conditions in a triggerWhen RuleStrategy via the runtime engine.\n */\nfunction evaluateTriggerWhen(triggerWhen, runtime) {\n if (triggerWhen.type !== 'rules' || !triggerWhen.rules?.length) {\n return { visible: !!triggerWhen.default, isFallback: true, conditions: [] };\n }\n const result = runtime.evaluateSync(triggerWhen);\n const conditions = (result.matchInfo?.evaluatedConditions ?? []).map(({ condition, result: passed }) => {\n // Get live accumulator count for event_count progress display\n const accCount = condition.type === 'event_count' && runtime.accumulator\n ? runtime.accumulator.getCount(condition.key, condition.withinMs)\n : undefined;\n const formatted = formatConditionLabel(condition, accCount);\n return { type: condition.type, passed, formatted };\n });\n return { visible: result.value, isFallback: result.isFallback, conditions };\n}\n/**\n * Hook: live triggerWhen evaluation for a list of action items.\n *\n * @param items Array of items with id + optional triggerWhen\n * @returns Map from item id \u2192 TriggerWhenStatus (null for items without triggerWhen)\n */\nexport function useTriggerWhenStatus(items) {\n const [statuses, setStatuses] = useState(new Map());\n const itemsRef = useRef(items);\n itemsRef.current = items;\n const evaluate = useCallback(() => {\n const runtime = getRuntime();\n if (!runtime)\n return;\n const map = new Map();\n for (const item of itemsRef.current) {\n if (!item.triggerWhen) {\n map.set(item.id, null);\n }\n else {\n map.set(item.id, evaluateTriggerWhen(item.triggerWhen, runtime));\n }\n }\n setStatuses(map);\n }, []);\n useEffect(() => {\n // Initial evaluation\n evaluate();\n // Subscribe to accumulator changes for reactive event_count updates\n const runtime = getRuntime();\n const unsubs = [];\n if (runtime?.accumulator) {\n unsubs.push(runtime.accumulator.subscribe(evaluate));\n }\n // Poll every 2s for non-accumulator conditions (page_url, viewport, etc.)\n const interval = setInterval(evaluate, 2000);\n return () => {\n unsubs.forEach((u) => u());\n clearInterval(interval);\n };\n }, [evaluate]);\n return statuses;\n}\n", "{\n \"field_mapping\": {\n \"event\": {\n \"action_step_key\": \"event\",\n \"hogql\": \"event\",\n \"athena\": \"event_category\",\n \"athena_transform\": \"category_map\",\n \"runtime_event_field\": \"name\",\n \"runtime_transform\": \"event_name_map\"\n },\n \"text\": {\n \"action_step_key\": \"text\",\n \"hogql\": \"properties.$el_text\",\n \"athena\": \"el_text\",\n \"runtime_element_field\": \"$el_text\"\n },\n \"tag_name\": {\n \"action_step_key\": \"tag_name\",\n \"hogql\": \"properties.$el_tag_name\",\n \"athena\": \"tag_name\",\n \"runtime_element_field\": \"tag_name\"\n },\n \"url\": {\n \"action_step_key\": \"url\",\n \"hogql\": \"properties.$current_url\",\n \"hogql_match\": \"like\",\n \"athena\": \"pathname\",\n \"athena_match\": \"like\",\n \"athena_transform\": \"url_to_path\",\n \"runtime_prop\": \"url\"\n },\n \"selector\": {\n \"action_step_key\": \"selector\",\n \"hogql\": \"properties.$el_selector\",\n \"athena\": null,\n \"runtime_element_field\": null\n }\n },\n \"event_category_map\": {\n \"$autocapture\": \"click\",\n \"$pageview\": \"pageview\",\n \"$pageleave\": \"pageleave\",\n \"$feature_flag_called\": \"feature_flag\"\n },\n \"event_name_map\": {\n \"$autocapture\": \"ui.click\",\n \"$pageview\": \"nav.page_view\",\n \"$pageleave\": \"nav.page_leave\"\n },\n \"interactive_tags\": [\"a\", \"button\", \"input\", \"select\", \"textarea\", \"form\", \"summary\"],\n \"interactive_roles\": [\n \"button\",\n \"link\",\n \"menuitem\",\n \"tab\",\n \"switch\",\n \"checkbox\",\n \"radio\",\n \"option\"\n ],\n \"test_cases\": [\n {\n \"name\": \"CTA button click \u2014 span inside anchor\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Start Free Filing\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Start Free Filing\",\n \"$elements\": [\n { \"tag_name\": \"span\", \"$el_text\": \"Start Free Filing\" },\n {\n \"tag_name\": \"a\",\n \"$el_text\": \"Start Free Filing \u2192\",\n \"attr__href\": \"/dashboard\",\n \"attr__data-cta\": \"hero-primary\"\n },\n { \"tag_name\": \"div\", \"$el_text\": \"\" },\n { \"tag_name\": \"section\", \"$el_text\": \"\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 1,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Start Free Filing \u2192\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"Pageview from link href\",\n \"action_step\": {\n \"event\": \"$pageview\",\n \"url\": \"/pricing\"\n },\n \"posthog_event\": {\n \"event\": \"$pageview\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/pricing\",\n \"$elements\": [\n { \"tag_name\": \"a\", \"$el_text\": \"See Plans & Pricing\", \"attr__href\": \"/pricing\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$pageview\",\n \"tag_name\": \"a\",\n \"text\": \"See Plans & Pricing\",\n \"url\": \"https://taxinator.com/pricing\"\n }\n },\n {\n \"name\": \"Non-matching \u2014 wrong tag and text\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"button\",\n \"text\": \"Submit\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Cancel\",\n \"$elements\": [\n { \"tag_name\": \"span\", \"$el_text\": \"Cancel\" },\n { \"tag_name\": \"a\", \"$el_text\": \"Cancel\", \"attr__href\": \"/home\" }\n ]\n }\n },\n \"should_match_hogql\": false,\n \"should_match_athena\": false,\n \"recommended_index\": 1,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"a\",\n \"text\": \"Cancel\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"Selector only \u2014 matches HogQL but not Athena\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"selector\": \"#signup-btn\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_selector\": \"#signup-btn\",\n \"$elements\": [{ \"tag_name\": \"button\", \"$el_text\": \"Sign Up\" }]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": false,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"button\",\n \"text\": \"Sign Up\",\n \"url\": \"https://taxinator.com/\"\n }\n },\n {\n \"name\": \"No interactive ancestor \u2014 falls back to elements[0]\",\n \"action_step\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"div\",\n \"text\": \"Hero Banner\"\n },\n \"posthog_event\": {\n \"event\": \"$autocapture\",\n \"properties\": {\n \"$current_url\": \"https://taxinator.com/\",\n \"$el_text\": \"Hero Banner\",\n \"$elements\": [\n { \"tag_name\": \"div\", \"$el_text\": \"Hero Banner\" },\n { \"tag_name\": \"section\", \"$el_text\": \"\" },\n { \"tag_name\": \"main\", \"$el_text\": \"\" }\n ]\n }\n },\n \"should_match_hogql\": true,\n \"should_match_athena\": true,\n \"recommended_index\": 0,\n \"expected_action_step_from_recommended\": {\n \"event\": \"$autocapture\",\n \"tag_name\": \"div\",\n \"text\": \"Hero Banner\",\n \"url\": \"https://taxinator.com/\"\n }\n }\n ]\n}\n", "/**\n * Element Chain Recommender\n *\n * Given PostHog's $elements array, recommends which element the user\n * most likely intended to track for a KPI, and builds a PostHog action\n * step from that element.\n *\n * The interactive_tags and interactive_roles are loaded from the shared\n * field mapping fixture so the recommendation heuristic stays in sync\n * with the warehouse and runtime predicate matching.\n */\n// Loaded from the shared fixture at build time.\n// The fixture is the single source of truth \u2014 do NOT hardcode these lists.\nimport fieldMapping from '../../../../tests/fixtures/action-step-field-mapping.json';\nconst INTERACTIVE_TAGS = new Set(fieldMapping.interactive_tags);\nconst INTERACTIVE_ROLES = new Set(fieldMapping.interactive_roles);\n/**\n * Find the index of the recommended element in the $elements chain.\n * Returns the first interactive element, or 0 if none found.\n */\nexport function findRecommendedIndex(elements) {\n if (elements.length === 0)\n return 0;\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n if (INTERACTIVE_TAGS.has(el.tag_name))\n return i;\n const role = (el.attr__role ?? el.role);\n if (role && INTERACTIVE_ROLES.has(role))\n return i;\n }\n return 0;\n}\n/**\n * Build a PostHog action step from a selected element in the chain.\n * Does NOT include `selector` \u2014 it's not supported in Athena.\n *\n * The `url` field stores the PATHNAME of the page where the user clicked,\n * not the full URL. This matches how the backend generates SQL:\n * step.url \u2192 `pathname LIKE '%<url>%'`\n * Storing the full URL (including the editor token / query string) makes\n * the stored KPI data ugly, leaks editor tokens into saved configs, and\n * forces the backend to re-parse on every query. Strip at the boundary.\n */\nfunction pageUrlToPathname(pageUrl) {\n try {\n const u = new URL(pageUrl);\n return u.pathname || pageUrl;\n }\n catch {\n return pageUrl;\n }\n}\nexport function buildActionStepFromElement(element, pageUrl, options = {}) {\n const { inferPageview = false } = options;\n const href = element.attr__href;\n const isInternalLink = element.tag_name === 'a' && href && !href.startsWith('http') && !href.startsWith('//');\n const step = {\n event: inferPageview && isInternalLink ? '$pageview' : '$autocapture',\n tag_name: element.tag_name,\n url: pageUrlToPathname(pageUrl),\n };\n const text = (element.$el_text || '').trim();\n if (text) {\n step.text = text.slice(0, 100); // Truncate long text\n }\n return step;\n}\n", "/**\n * Human-readable summary generation for Nav items.\n * Pure functions \u2014 no DOM access, just string formatting.\n */\n\nimport type { DecisionStrategy, NavTipAction, RuleStrategy } from './types';\n\nconst MAX_TITLE_LEN = 30;\n\nfunction truncate(text: string, max: number): string {\n if (text.length <= max) return text;\n return `${text.slice(0, max).trimEnd()}...`;\n}\n\nfunction isRuleStrategy(s: unknown): s is RuleStrategy<boolean> {\n return (\n typeof s === 'object' &&\n s !== null &&\n (s as Record<string, unknown>).type === 'rules' &&\n Array.isArray((s as Record<string, unknown>).rules)\n );\n}\n\n/**\n * Parse a triggerWhen strategy into a human-readable trigger description.\n */\nexport function describeTrigger(triggerWhen?: DecisionStrategy<boolean> | null): string {\n if (!triggerWhen) return 'All pages';\n if (!isRuleStrategy(triggerWhen)) return 'All pages';\n\n const pages: string[] = [];\n const anchors: string[] = [];\n\n for (const rule of triggerWhen.rules) {\n for (const condition of rule.conditions) {\n if (condition.type === 'page_url' && typeof (condition as any).url === 'string') {\n pages.push((condition as any).url);\n }\n if (condition.type === 'anchor_visible' && typeof (condition as any).anchorId === 'string') {\n anchors.push((condition as any).anchorId);\n }\n }\n }\n\n const parts: string[] = [];\n if (pages.length > 0) parts.push(pages[0]);\n if (anchors.length > 0) parts.push(anchors[0]);\n\n return parts.length > 0 ? parts.join(' \\u00b7 ') : 'All pages';\n}\n\n/**\n * Generate a one-liner summary for a Nav tip.\n */\nexport function summarizeNavItem(item: NavTipAction): string {\n const icon = item.config.icon || '\\u{1F9ED}';\n const title = truncate(item.config.title, MAX_TITLE_LEN);\n return `${icon} ${title}`;\n}\n", "/**\n * Adaptive Nav - Types\n *\n * Type definitions for the navigation tips accordion adaptive.\n * Demonstrates compositional action pattern with per-item triggerWhen.\n */\n\n// ============================================================================\n// Decision Strategy Types (from runtime-sdk)\n// ============================================================================\n\n/**\n * Simplified DecisionStrategy type for this package.\n * Full definition is in @syntrologie/runtime-sdk.\n */\nexport type DecisionStrategy<T = unknown> =\n | RuleStrategy<T>\n | ScoreStrategy<T>\n | ModelStrategy<T>\n | ExternalStrategy<T>;\n\nexport interface RuleStrategy<T = unknown> {\n type: 'rules';\n rules: Array<{\n conditions: Array<Record<string, unknown>>;\n value: T;\n }>;\n default: T;\n}\n\nexport interface ScoreStrategy<T = unknown> {\n type: 'score';\n field: string;\n threshold: number;\n above: T;\n below: T;\n}\n\nexport interface ModelStrategy<T = unknown> {\n type: 'model';\n modelId: string;\n inputs: string[];\n outputMapping: Record<string, T>;\n default: T;\n}\n\nexport interface ExternalStrategy<T = unknown> {\n type: 'external';\n endpoint: string;\n method?: 'GET' | 'POST';\n default: T;\n timeoutMs?: number;\n}\n\n// ============================================================================\n// Event Scope Types (from sdk-contracts)\n// ============================================================================\n\n// ============================================================================\n// Nav Tip Action Types\n// ============================================================================\n\n/**\n * Single navigation tip configuration.\n * This is a \"compositional action\" \u2014 rendered as an accordion item by the parent.\n */\nexport interface NavTipAction {\n /** Action kind identifier */\n kind: 'nav:tip';\n /** Tip configuration */\n config: {\n /** Unique identifier for this tip */\n id: string;\n /** Accordion header text */\n title: string;\n /** Expanded body text */\n description: string;\n /**\n * Target anchor: route = where to go, selector = what to highlight/focus.\n * - Same page + valid selector \u2192 scroll + pulse + focus\n * - Same page + no selector/\"*\" \u2192 no-op (already there)\n * - Different page \u2192 navigate via pushState + popstate\n */\n anchor?: AnchorId;\n /** @deprecated Use anchor instead. Falls back to { route: href, selector: \"*\" } */\n href?: string;\n /** Optional icon (emoji or icon key) */\n icon?: string;\n /** Whether the link opens in a new tab */\n external?: boolean;\n /** Category for grouping */\n category?: string;\n };\n /** Optional per-item activation strategy */\n triggerWhen?: DecisionStrategy<boolean> | null;\n /** Toast config when triggerWhen transitions false \u2192 true. Required when triggerWhen is set (use null to opt out). */\n notify?: { title?: string; body?: string; icon?: string } | null;\n /** AI-generated reasoning for why this tip was recommended */\n rationale?: {\n why: string;\n confidence?: number;\n };\n}\n\n/** @deprecated Use NavTipAction instead */\nexport type NavLinkAction = NavTipAction;\n\n// ============================================================================\n// Nav Widget Configuration\n// ============================================================================\n\n/**\n * Expand behavior for the accordion.\n */\nexport type NavExpandBehavior = 'single' | 'multiple';\n\n/**\n * Theme for the navigation widget.\n */\nexport type NavTheme = 'light' | 'dark' | 'auto';\n\n/**\n * Full configuration for the adaptive-nav widget.\n */\nexport interface NavConfig {\n /** Expand behavior */\n expandBehavior: NavExpandBehavior;\n /** Color theme */\n theme: NavTheme;\n /** Navigation tips (compositional actions) */\n actions: NavTipAction[];\n}\n\n// ============================================================================\n// Widget Props Types\n// ============================================================================\n\n/**\n * Runtime services passed to the widget.\n */\nexport interface NavWidgetRuntime {\n /** Synchronously evaluate a decision strategy */\n evaluateSync: <T>(strategy: DecisionStrategy<T>) => { value: T; isFallback: boolean };\n /** Context manager for subscribing to changes */\n context: {\n subscribe: (callback: () => void) => () => void;\n };\n /** Event bus for publishing interactions */\n events: {\n publish: (name: string, props?: Record<string, unknown>) => void;\n };\n /** Event accumulator for event_count-based triggerWhen */\n accumulator?: {\n subscribe: (callback: () => void) => () => void;\n register: (key: string, predicate: (event: any) => boolean) => void;\n };\n /**\n * Customer site origin (e.g. \"https://healthmaxxer.elegantdiffusion.com\").\n * Used to resolve relative URLs in opaque-origin contexts (about:srcdoc\n * iframes). Optional \u2014 undefined when SDK is mounted directly on the\n * customer site (window.location.origin is the right base).\n */\n customerHost?: string;\n}\n\n/**\n * Props passed to the NavWidget component.\n */\nexport interface NavWidgetProps {\n /** Widget configuration */\n config: NavConfig;\n /** Runtime services */\n runtime: NavWidgetRuntime;\n /** Instance ID for telemetry */\n instanceId: string;\n}\n\n// ============================================================================\n// Navigation Action Types (merged from adaptive-navigation)\n// ============================================================================\n\nimport type { AnchorId } from '@syntrologie/sdk-contracts';\n\ninterface BaseAction {\n label?: string;\n}\n\nexport interface ScrollToAction extends BaseAction {\n kind: 'navigation:scrollTo';\n anchorId: AnchorId;\n behavior?: ScrollBehavior;\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\nexport interface NavigateAction extends BaseAction {\n kind: 'navigation:navigate';\n url: string;\n target?: '_self' | '_blank';\n /** When true, always use full page navigation (window.location.href) even for same-origin URLs. */\n forceFullNavigation?: boolean;\n}\n\n// ============================================================================\n// Action Namespace\n// ============================================================================\n\nexport const ACTION_NAMESPACES = ['nav', 'navigation'] as const;\n\n/**\n * Returns true if the action belongs to this adaptive package.\n * Uses prefix matching so new kinds (e.g. nav:dropdown) are automatically included.\n * Covers both `nav:*` (compositional) and `navigation:*` (executor) prefixes.\n */\nexport function isOwnAction(action: { kind: string }): boolean {\n return ACTION_NAMESPACES.some((ns) => action.kind.startsWith(`${ns}:`));\n}\n\n// ============================================================================\n// Executor Types (from shared contracts)\n// ============================================================================\n\nexport type {\n ActionExecutor,\n ExecutorCleanup,\n ExecutorContext,\n ExecutorResult,\n ExecutorUpdate,\n} from '@syntrologie/sdk-contracts';\n\n// ============================================================================\n// Editor Types (from sdk-contracts)\n// ============================================================================\n\nexport type { EditorPanelProps } from '@syntrologie/sdk-contracts';\n", "/**\n * Adaptive Nav - Editor Component\n *\n * Review & tweak editor for AI-generated navigation tip decisions.\n * Displays a scannable list of tip cards with trigger, rationale,\n * and inline editing. Includes detection badges and hover-to-highlight.\n */\n\nimport {\n DetectionBadge,\n DismissedSection,\n EditorBody,\n EditorCard,\n EditorHeader,\n EditorInput,\n EditorLayout,\n EmptyState,\n GroupHeader,\n TriggerJourney,\n useTriggerWhenStatus,\n} from '@syntrologie/shared-editor-ui';\nimport type React from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { describeTrigger, summarizeNavItem } from './summarize';\nimport {\n type EditorPanelProps,\n isOwnAction,\n type NavConfig,\n type NavTipAction,\n type RuleStrategy,\n} from './types';\n\n// ============================================================================\n// Targeting Extraction (inlined -- CDN builds can't import from editor-sdk)\n// ============================================================================\n\ninterface TargetingInfo {\n pagePatterns: string[];\n anchorSelectors: string[];\n hasTargeting: boolean;\n}\n\nfunction isRuleStrategy(s: unknown): s is RuleStrategy<boolean> {\n return (\n typeof s === 'object' &&\n s !== null &&\n (s as Record<string, unknown>).type === 'rules' &&\n Array.isArray((s as Record<string, unknown>).rules)\n );\n}\n\nfunction extractTargetingInfo(triggerWhen?: unknown | null): TargetingInfo {\n if (!triggerWhen || !isRuleStrategy(triggerWhen)) {\n return { pagePatterns: [], anchorSelectors: [], hasTargeting: false };\n }\n\n const pagePatterns = new Set<string>();\n const anchorSelectors = new Set<string>();\n\n for (const rule of triggerWhen.rules) {\n for (const cond of rule.conditions) {\n const c = cond as Record<string, unknown>;\n if (c.type === 'page_url' && typeof c.url === 'string') {\n pagePatterns.add(c.url);\n } else if (c.type === 'anchor_visible' && typeof c.anchorId === 'string') {\n anchorSelectors.add(c.anchorId);\n }\n }\n }\n\n const hasTargeting = pagePatterns.size > 0 || anchorSelectors.size > 0;\n return {\n pagePatterns: [...pagePatterns],\n anchorSelectors: [...anchorSelectors],\n hasTargeting,\n };\n}\n\nfunction extractFirstPage(triggerWhen?: unknown | null): string | null {\n const info = extractTargetingInfo(triggerWhen);\n return info.pagePatterns[0] || null;\n}\n\nfunction extractFirstAnchor(triggerWhen?: unknown | null): string | null {\n const info = extractTargetingInfo(triggerWhen);\n return info.anchorSelectors[0] || null;\n}\n\n/** Save a pending highlight selector to sessionStorage (inlined to avoid cross-package import). */\nfunction savePendingHighlight(selector: string) {\n try {\n sessionStorage.setItem('syntro:editor:pending-highlight', selector);\n } catch {\n // Silently ignore\n }\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\ninterface FlatItem {\n key: string;\n index: number;\n summary: string;\n trigger: string;\n rationale?: { why: string; confidence?: number };\n firstAnchor: string | null;\n tip: NavTipAction;\n}\n\nfunction flattenItems(config: NavConfig): FlatItem[] {\n const actions = (config.actions || []).filter(isOwnAction);\n return actions.map((tip, i) => ({\n key: String(i),\n index: i,\n summary: summarizeNavItem(tip),\n trigger: describeTrigger(tip.triggerWhen),\n rationale: tip.rationale,\n firstAnchor: extractFirstAnchor(tip.triggerWhen),\n tip,\n }));\n}\n\nfunction filterConfig(config: NavConfig, dismissedKeys: Set<string>): NavConfig {\n const ownActions = (config.actions || []).filter(isOwnAction);\n return {\n ...config,\n actions: ownActions.filter((_, i) => !dismissedKeys.has(String(i))),\n };\n}\n\n// ============================================================================\n// Detection Hook\n// ============================================================================\n\ninterface DetectionEntry {\n found: boolean;\n element: HTMLElement | null;\n}\n\nfunction useDetection(\n items: FlatItem[],\n getCurrentRoute: () => string\n): Map<string, DetectionEntry> {\n const [detectionMap, setDetectionMap] = useState<Map<string, DetectionEntry>>(new Map());\n const itemsRef = useRef(items);\n itemsRef.current = items;\n\n useEffect(() => {\n const runDetection = () => {\n const map = new Map<string, DetectionEntry>();\n const currentPath = getCurrentRoute();\n\n for (const item of itemsRef.current) {\n const targeting = extractTargetingInfo(item.tip.triggerWhen);\n\n // Check page match\n let pageMatch = true;\n if (targeting.pagePatterns.length > 0) {\n pageMatch = targeting.pagePatterns.some((pattern) => {\n const regex = new RegExp(\n `^${pattern.replace(/\\*\\*/g, '.*').replace(/(?<!\\.)(\\*)/g, '[^/]*')}$`\n );\n return regex.test(currentPath);\n });\n }\n\n // Check anchor presence\n let anchorFound = false;\n let element: HTMLElement | null = null;\n if (item.firstAnchor) {\n try {\n element = document.querySelector(item.firstAnchor) as HTMLElement | null;\n anchorFound = element !== null;\n } catch {\n // Invalid selector\n }\n } else {\n anchorFound = pageMatch;\n }\n\n map.set(item.key, {\n found: pageMatch && anchorFound,\n element,\n });\n }\n\n setDetectionMap(map);\n };\n\n runDetection();\n\n const interval = setInterval(runDetection, 2000);\n window.addEventListener('popstate', runDetection);\n\n return () => {\n clearInterval(interval);\n window.removeEventListener('popstate', runDetection);\n };\n }, [getCurrentRoute]);\n\n return detectionMap;\n}\n\n// ============================================================================\n// NavEditor Component\n// ============================================================================\n\nexport function NavEditor({ config, onChange, editor }: EditorPanelProps) {\n const typedConfig = config as unknown as NavConfig;\n const [dismissedKeys, setDismissedKeys] = useState<Set<string>>(\n () => editor.getDismissedKeys?.() ?? new Set()\n );\n const [editingKey, setEditingKey] = useState<string | null>(null);\n const [_previewMode, setPreviewMode] = useState<'before' | 'after'>('after');\n const [_hoveredKey, setHoveredKey] = useState<string | null>(null);\n\n // Sync dismissed keys back to navigation context on every change\n useEffect(() => {\n editor.setDismissedKeys?.(dismissedKeys);\n }, [dismissedKeys, editor]);\n\n // React to global before/after toggle from the panel\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitted \u2014 adding config/typedConfig/previewConfig would cause infinite re-renders since previewConfig triggers state updates\n useEffect(() => {\n const mode = editor.previewMode;\n if (!mode) return;\n\n if (mode === 'before') {\n // Remove all nav tips \u2014 push a config with every item filtered out\n const allKeys = new Set(flattenItems(typedConfig).map((item) => item.key));\n const empty = filterConfig(typedConfig, allKeys);\n editor.previewConfig(empty as unknown as Record<string, unknown>);\n } else {\n // Restore the full config\n editor.previewConfig(config);\n }\n }, [editor.previewMode]);\n\n // If navigated here with an editKey, jump directly to that item's edit view\n const initialConsumed = useRef(false);\n useEffect(() => {\n if (!initialConsumed.current) {\n initialConsumed.current = true;\n if (editor.initialEditKey != null) {\n setEditingKey(String(editor.initialEditKey));\n }\n editor.clearInitialState?.();\n }\n }, [editor]);\n\n const allItems = flattenItems(typedConfig);\n const activeItems = allItems.filter((item) => !dismissedKeys.has(item.key));\n const dismissedItems = allItems.filter((item) => dismissedKeys.has(item.key));\n const totalLinks = activeItems.length;\n\n // Live triggerWhen status for condition diagnostics\n const triggerWhenItems = useMemo(\n () =>\n allItems.map((item) => ({\n id: item.key,\n triggerWhen: item.tip.triggerWhen,\n })),\n [allItems]\n );\n const triggerWhenStatuses = useTriggerWhenStatus(triggerWhenItems);\n\n const detectionMap = useDetection(allItems, editor.getCurrentRoute);\n const foundCount = activeItems.filter((item) => detectionMap.get(item.key)?.found).length;\n\n const handleDismiss = useCallback(\n (key: string) => {\n setDismissedKeys((prev) => {\n const next = new Set(prev);\n next.add(key);\n return next;\n });\n if (editingKey === key) setEditingKey(null);\n },\n [editingKey]\n );\n\n const handleRestore = useCallback((key: string) => {\n setDismissedKeys((prev) => {\n const next = new Set(prev);\n next.delete(key);\n return next;\n });\n }, []);\n\n const handleCardBodyClick = useCallback((item: FlatItem) => {\n setEditingKey(item.key);\n }, []);\n\n const handleTriggerClick = useCallback(\n async (item: FlatItem) => {\n const pageUrl = extractFirstPage(item.tip.triggerWhen);\n if (pageUrl) {\n if (item.firstAnchor) savePendingHighlight(item.firstAnchor);\n await editor.navigateTo(pageUrl);\n }\n if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n },\n [editor]\n );\n\n const handleBackToList = useCallback(() => {\n setEditingKey(null);\n setPreviewMode('after');\n editor.previewConfig(config);\n editor.clearHighlight();\n }, [editor, config]);\n\n // Register back handler in panel header when editing\n useEffect(() => {\n editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);\n return () => editor.setBackHandler?.(null);\n }, [editingKey, handleBackToList, editor]);\n\n const _handleBeforeAfter = useCallback(\n (mode: 'before' | 'after') => {\n setPreviewMode(mode);\n if (mode === 'before') {\n const filtered = filterConfig(typedConfig, new Set([editingKey!]));\n editor.previewConfig(filtered as unknown as Record<string, unknown>);\n } else {\n editor.previewConfig(config);\n }\n },\n [typedConfig, editingKey, editor, config]\n );\n\n const handleFieldChange = useCallback(\n (index: number, field: string, value: unknown) => {\n const ownActions = (typedConfig.actions || []).filter(isOwnAction).slice();\n const link = { ...ownActions[index], config: { ...ownActions[index].config } };\n (link.config as Record<string, unknown>)[field] = value;\n ownActions[index] = link;\n const otherActions = (typedConfig.actions || []).filter((a) => !isOwnAction(a));\n const updated = { ...typedConfig, actions: [...otherActions, ...ownActions] };\n onChange(updated as unknown as Record<string, unknown>);\n editor.setDirty(true);\n },\n [typedConfig, onChange, editor]\n );\n\n const _handlePublish = useCallback(() => {\n if (dismissedKeys.size > 0) {\n const filtered = filterConfig(typedConfig, dismissedKeys);\n onChange(filtered as unknown as Record<string, unknown>);\n }\n editor.publish();\n }, [dismissedKeys, typedConfig, onChange, editor]);\n\n const handleBadgeClick = useCallback(\n async (item: FlatItem) => {\n const detection = detectionMap.get(item.key);\n if (detection?.found && item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n } else {\n const pageUrl = extractFirstPage(item.tip.triggerWhen);\n if (pageUrl) {\n if (item.firstAnchor) savePendingHighlight(item.firstAnchor);\n await editor.navigateTo(pageUrl);\n if (item.firstAnchor) editor.highlightElement(item.firstAnchor);\n } else if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n }\n },\n [editor, detectionMap]\n );\n\n const handleCardHover = useCallback(\n (item: FlatItem) => {\n setHoveredKey(item.key);\n if (item.firstAnchor) {\n editor.highlightElement(item.firstAnchor);\n }\n },\n [editor]\n );\n\n const handleCardLeave = useCallback(() => {\n setHoveredKey(null);\n editor.clearHighlight();\n }, [editor]);\n\n // ---- Edit form renderer ----\n\n const renderEditFields = (index: number) => {\n const actions = (typedConfig.actions || []).filter(isOwnAction);\n const tip = actions[index];\n if (!tip) return null;\n\n const item = allItems.find((it) => it.key === String(index));\n\n return (\n <div className=\"se-py-1\">\n {/* Trigger line in edit mode */}\n {item && item.trigger !== 'All pages' && (\n <button\n type=\"button\"\n data-trigger\n className=\"se-flex se-items-center se-gap-1 se-text-[11px] se-text-slate-grey-8 se-cursor-pointer se-mb-1 se-border-none se-bg-transparent se-p-0 se-text-left\"\n onClick={() => handleTriggerClick(item)}\n >\n <span>{'\\u{1f4cd}'}</span>\n <span>{item.trigger}</span>\n </button>\n )}\n\n <EditorInput\n label=\"Title\"\n value={tip.config.title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'title', e.target.value)\n }\n />\n\n <EditorInput\n label=\"Description\"\n value={tip.config.description}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'description', e.target.value)\n }\n />\n\n <EditorInput\n label=\"Link URL\"\n value={tip.config.href || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'href', e.target.value)\n }\n placeholder=\"Optional\"\n />\n\n <EditorInput\n label=\"Icon\"\n value={tip.config.icon || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'icon', e.target.value)\n }\n placeholder=\"e.g., \\u{1f9ed}\"\n />\n\n <EditorInput\n label=\"Category\"\n value={tip.config.category || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'category', e.target.value)\n }\n placeholder=\"Optional\"\n />\n\n <label className=\"se-flex se-items-center se-gap-2 se-text-xs se-text-slate-grey-8 se-mb-2\">\n <input\n type=\"checkbox\"\n checked={tip.config.external || false}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleFieldChange(index, 'external', e.target.checked)\n }\n />\n Open in new tab\n </label>\n\n <span className=\"se-text-[11px] se-font-semibold se-text-slate-grey-7 se-mb-1 se-block\">\n AI Rationale\n </span>\n <div className=\"se-p-2 se-rounded se-border se-border-dashed se-border-white/15 se-bg-white/[0.02] se-text-slate-grey-8 se-text-xs se-mb-2\">\n {tip.rationale ? tip.rationale.why : 'N/A'}\n </div>\n </div>\n );\n };\n\n const subtitle = `${totalLinks} tip${totalLinks !== 1 ? 's' : ''}${totalLinks > 0 ? ` (${foundCount} found on this page)` : ''}`;\n\n return (\n <EditorLayout>\n <EditorHeader\n title=\"Navigation Tips\"\n subtitle={subtitle}\n onBack={() => editor.navigateHome()}\n />\n\n <EditorBody>\n {editingKey !== null ? (\n /* ---- Edit mode ---- */\n (() => {\n const editIndex = Number(editingKey);\n const editItem = allItems.find((it) => it.key === editingKey);\n return (\n <>\n <div className=\"se-flex se-items-center se-gap-2 se-mb-3 se-text-[13px] se-font-semibold se-text-slate-grey-10\">\n <span>{'\\u{1F9ED}'}</span>\n <span>{editItem?.summary}</span>\n </div>\n {renderEditFields(editIndex)}\n </>\n );\n })()\n ) : (\n /* ---- List mode ---- */\n <>\n {allItems.length === 0 && <EmptyState message=\"No tips configured.\" />}\n\n {activeItems.length > 0 && (\n <>\n <GroupHeader label=\"TIPS\" count={activeItems.length} />\n {activeItems.map((item) => {\n const detection = detectionMap.get(item.key);\n return (\n <EditorCard\n key={item.key}\n itemKey={item.key}\n onClick={() => handleCardBodyClick(item)}\n onMouseEnter={() => handleCardHover(item)}\n onMouseLeave={handleCardLeave}\n >\n {/* Trigger line */}\n {item.trigger !== 'All pages' && (\n <button\n type=\"button\"\n data-trigger\n className=\"se-flex se-items-center se-gap-1 se-text-[11px] se-text-slate-grey-8 se-cursor-pointer se-mb-1 se-border-none se-bg-transparent se-p-0 se-text-left\"\n onClick={(e) => {\n e.stopPropagation();\n handleTriggerClick(item);\n }}\n >\n <span>{'\\u{1f4cd}'}</span>\n <span>{item.trigger}</span>\n </button>\n )}\n {/* Card body: badge + summary + dismiss */}\n {/* biome-ignore lint/a11y/useSemanticElements: cannot use <button> here as it would nest a dismiss <button> inside, which is invalid HTML */}\n <div\n data-card-body\n role=\"button\"\n tabIndex={0}\n className=\"se-flex se-items-center se-gap-2 se-cursor-pointer\"\n onClick={() => handleCardBodyClick(item)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleCardBodyClick(item);\n }}\n >\n <DetectionBadge\n found={detection?.found ?? false}\n onClick={() => handleBadgeClick(item)}\n />\n <span className=\"se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap\">\n {item.summary}\n </span>\n <button\n type=\"button\"\n className=\"se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-slate-grey-7 se-text-sm se-cursor-pointer se-shrink-0 se-leading-none\"\n onClick={(e) => {\n e.stopPropagation();\n handleDismiss(item.key);\n }}\n title=\"Dismiss this tip\"\n >\n ×\n </button>\n </div>\n {/* Rationale line */}\n <div className=\"se-text-[10px] se-text-slate-grey-7 se-mt-1\">\n WHY: {item.rationale ? item.rationale.why : 'N/A'}\n </div>\n {/* Condition status line */}\n <TriggerJourney status={triggerWhenStatuses.get(item.key) ?? null} />\n </EditorCard>\n );\n })}\n </>\n )}\n\n {/* Dismissed section */}\n {dismissedItems.length > 0 && (\n <DismissedSection count={dismissedItems.length}>\n {dismissedItems.map((item) => (\n <div\n key={item.key}\n className=\"se-flex se-items-center se-gap-2 se-py-1.5 se-px-2.5 se-rounded-md se-border se-border-white/[0.03] se-bg-transparent se-mb-0.5 se-cursor-pointer se-text-xs se-text-slate-grey-6 se-opacity-60\"\n >\n <span className=\"se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap se-line-through\">\n {item.summary}\n </span>\n <button\n type=\"button\"\n className=\"se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-blue-5 se-text-[11px] se-cursor-pointer se-shrink-0 se-leading-none\"\n onClick={(e) => {\n e.stopPropagation();\n handleRestore(item.key);\n }}\n >\n Restore\n </button>\n </div>\n ))}\n </DismissedSection>\n )}\n </>\n )}\n </EditorBody>\n </EditorLayout>\n );\n}\n\n/**\n * Editor panel configuration for the app registry.\n */\nexport const editorPanel = {\n title: 'Navigation Tips',\n icon: '\\u{1F9ED}',\n description: 'Navigation tips accordion with per-item visibility',\n};\n\nexport const editor = {\n panel: editorPanel,\n component: NavEditor,\n};\n\nexport default NavEditor;\n", "\n function _RD() {\n return (typeof SynOS !== 'undefined' && SynOS.ReactDOM) || {};\n }\n export default new Proxy({}, { get: function(_, k) { return _RD()[k]; } });\n export function createRoot() { return _RD().createRoot.apply(null, arguments); }\n export function hydrateRoot() { return _RD().hydrateRoot.apply(null, arguments); }\n export function createPortal() { return _RD().createPortal.apply(null, arguments); }\n export function flushSync() { return _RD().flushSync.apply(null, arguments); }\n ", "/**\n * Adaptive Nav - NavWidget Component\n *\n * React component that renders a collapsible navigation tips accordion\n * with per-item conditional visibility based on triggerWhen decision strategies.\n *\n * Demonstrates the compositional action pattern where child actions\n * (nav:tip) serve as configuration data for the parent widget.\n */\n\nimport { purple, slateGrey } from '@syntro/design-system/tokens';\nimport type { AnchorId } from '@syntrologie/sdk-contracts';\nimport React, { useCallback, useEffect, useMemo, useReducer, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { navigateWithFrameworkRouter } from './runtime';\nimport type { NavConfig, NavTipAction, NavWidgetProps, NavWidgetRuntime } from './types';\n\n// ============================================================================\n// Emoji \u2192 Lucide SVG inline mapping (no lucide-react dependency)\n// ============================================================================\n\nconst EMOJI_SVG_MAP: Record<string, string> = {\n '\uD83D\uDCB5': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83C\uDFDB\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" x2=\"21\" y1=\"22\" y2=\"22\"/><line x1=\"6\" x2=\"6\" y1=\"18\" y2=\"11\"/><line x1=\"10\" x2=\"10\" y1=\"18\" y2=\"11\"/><line x1=\"14\" x2=\"14\" y1=\"18\" y2=\"11\"/><line x1=\"18\" x2=\"18\" y1=\"18\" y2=\"11\"/><polygon points=\"12 2 20 7 4 7\"/></svg>',\n '\u23ED\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 4 15 12 5 20 5 4\"/><line x1=\"19\" x2=\"19\" y1=\"5\" y2=\"19\"/></svg>',\n '\u27A1\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/></svg>',\n '\uD83D\uDCA1': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/></svg>',\n '\uD83D\uDCB0': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83D\uDCCB': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"8\" height=\"4\" x=\"8\" y=\"2\" rx=\"1\" ry=\"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-2h2\"/><path d=\"M12 11h4\"/><path d=\"M12 16h4\"/><path d=\"M8 11h.01\"/><path d=\"M8 16h.01\"/></svg>',\n '\u2705': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><path d=\"m9 11 3 3L22 4\"/></svg>',\n '\u26A0\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></svg>',\n};\n\nfunction renderIcon(emoji: string): string {\n return EMOJI_SVG_MAP[emoji] ?? escapeHtml(emoji);\n}\n\n// ============================================================================\n// Sanitization\n// ============================================================================\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n// ============================================================================\n// Styles\n// ============================================================================\n\nconst baseStyles = {\n container: {\n fontFamily: 'var(--sc-font-family, system-ui, -apple-system, sans-serif)',\n maxWidth: '100%',\n overflow: 'hidden',\n },\n accordion: {\n display: 'flex',\n flexDirection: 'column' as const,\n gap: 'var(--sc-content-item-gap, 6px)',\n },\n item: {\n borderRadius: 'var(--sc-content-border-radius, 8px)',\n overflow: 'hidden',\n transition: 'box-shadow 0.2s ease',\n },\n header: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n width: '100%',\n padding: 'var(--sc-content-item-padding, 12px 16px)',\n border: 'none',\n cursor: 'pointer',\n fontSize: 'var(--sc-content-item-font-size, 15px)',\n fontWeight: 500,\n fontFamily: 'inherit',\n textAlign: 'left' as const,\n transition: 'background-color 0.15s ease',\n },\n chevron: {\n fontSize: '20px',\n transition: 'transform 0.2s ease',\n marginLeft: 'auto',\n flexShrink: 0,\n color: 'var(--sc-content-chevron-color, currentColor)',\n },\n icon: {\n fontSize: '16px',\n flexShrink: 0,\n },\n body: {\n overflow: 'hidden',\n transition: 'max-height 0.25s ease, padding-bottom 0.25s ease',\n padding: 'var(--sc-content-body-padding, 0 16px 12px 16px)',\n },\n description: {\n fontSize: 'var(--sc-content-body-font-size, 14px)',\n lineHeight: '1.5',\n margin: 0,\n },\n linkButton: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n marginTop: '10px',\n padding: '6px 12px',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '13px',\n fontWeight: 500,\n cursor: 'pointer',\n border: 'none',\n transition: 'background-color 0.15s ease',\n },\n categoryHeader: {\n fontSize: 'var(--sc-content-category-font-size, 12px)',\n fontWeight: 600,\n textTransform: 'uppercase' as const,\n letterSpacing: '0.05em',\n padding: 'var(--sc-content-category-padding, 8px 4px 4px 4px)',\n },\n emptyState: {\n fontSize: '13px',\n padding: '16px',\n textAlign: 'center' as const,\n },\n} as const;\n\nconst themeStyles = {\n light: {\n container: {\n backgroundColor: 'transparent',\n color: 'inherit',\n },\n item: {\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n },\n itemExpanded: {\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08)',\n },\n header: {\n backgroundColor: 'transparent',\n color: 'var(--sc-content-text-color)',\n },\n headerHover: {\n backgroundColor: 'var(--sc-content-background-hover)',\n },\n body: {\n color: 'var(--sc-content-text-secondary-color)',\n },\n linkButton: {\n // purple[4] = #6a59ce \u2014 design system primary purple, used as fallback when --sc-color-primary is not set\n backgroundColor: `var(--sc-color-primary, ${purple[4]})`,\n color: '#ffffff',\n },\n categoryHeader: {\n color: slateGrey[7],\n },\n emptyState: {\n color: slateGrey[8],\n },\n },\n dark: {\n container: {\n backgroundColor: 'transparent',\n color: 'inherit',\n },\n item: {\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n },\n itemExpanded: {\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n },\n header: {\n backgroundColor: 'transparent',\n color: 'var(--sc-content-text-color)',\n },\n headerHover: {\n backgroundColor: 'var(--sc-content-background-hover)',\n },\n body: {\n color: 'var(--sc-content-text-secondary-color)',\n },\n linkButton: {\n // purple[4] = #6a59ce \u2014 design system primary purple, used as fallback when --sc-color-primary is not set\n backgroundColor: `var(--sc-color-primary, ${purple[4]})`,\n color: '#ffffff',\n },\n categoryHeader: {\n color: slateGrey[8],\n },\n emptyState: {\n color: slateGrey[7],\n },\n },\n};\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Check if any of the given routes match the current page pathname */\nfunction routeMatchesCurrent(routes: string[]): boolean {\n if (typeof window === 'undefined') return false;\n const current = window.location.pathname;\n return routes.some((route) => {\n // Strip query/hash from route if present\n const routePath = route.split('?')[0].split('#')[0];\n // Exact match or glob pattern (** suffix)\n if (routePath.endsWith('/**')) {\n return current.startsWith(routePath.slice(0, -3));\n }\n return current === routePath;\n });\n}\n\n/** Apply a brief pulse animation to an element, then remove it */\nfunction pulseElement(el: HTMLElement): void {\n const keyframes: Keyframe[] = [\n { boxShadow: '0 0 0 0 rgba(13, 148, 136, 0.5)' },\n { boxShadow: '0 0 0 8px rgba(13, 148, 136, 0)' },\n ];\n el.animate(keyframes, { duration: 600, iterations: 3, easing: 'ease-out' });\n}\n\n// ============================================================================\n// NavTipItem Component\n// ============================================================================\n\ninterface NavTipItemProps {\n item: NavTipAction;\n isExpanded: boolean;\n isLast: boolean;\n onToggle: () => void;\n onNavigate: (href: string, external: boolean) => void;\n onFocusAnchor: (anchor: AnchorId) => void;\n theme: 'light' | 'dark';\n}\n\nfunction NavTipItem({\n item,\n isExpanded,\n isLast,\n onToggle,\n onNavigate,\n onFocusAnchor,\n theme,\n}: NavTipItemProps) {\n const [isHovered, setIsHovered] = useState(false);\n const colors = themeStyles[theme];\n const { title, description, href, icon, external, anchor } = item.config;\n\n const itemStyle: React.CSSProperties = {\n ...baseStyles.item,\n ...colors.item,\n ...(isExpanded ? colors.itemExpanded : {}),\n ...(!isLast ? { borderBottom: 'var(--sc-content-item-divider, none)' } : {}),\n };\n\n const headerStyle: React.CSSProperties = {\n ...baseStyles.header,\n ...colors.header,\n ...(isHovered ? colors.headerHover : {}),\n };\n\n const chevronStyle: React.CSSProperties = {\n ...baseStyles.chevron,\n transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',\n };\n\n const bodyStyle: React.CSSProperties = {\n ...baseStyles.body,\n ...colors.body,\n maxHeight: isExpanded ? '500px' : '0',\n paddingBottom: isExpanded ? '16px' : '0',\n };\n\n // Determine the effective navigation target from anchor or legacy href\n const effectiveHref = anchor\n ? Array.isArray(anchor.route)\n ? anchor.route[0]\n : anchor.route\n : href;\n\n // Same-page check: anchor exists, selector is meaningful, and route matches current page\n const isSamePage = anchor\n ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route])\n : effectiveHref\n ? routeMatchesCurrent([effectiveHref])\n : false;\n const hasSelector = anchor?.selector && anchor.selector !== '*';\n const isFocusAction = isSamePage && hasSelector;\n const hasAction = !!effectiveHref || isFocusAction;\n\n const handleLinkClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (isFocusAction && anchor) {\n onFocusAnchor(anchor);\n } else if (effectiveHref) {\n onNavigate(effectiveHref, external ?? false);\n }\n };\n\n // CTA label\n const ctaLabel = isFocusAction ? `Focus \\u2192` : external ? `Go \\u2197` : `Go \\u2192`;\n\n return (\n <div style={itemStyle} data-nav-tip-id={item.config.id}>\n <button\n type=\"button\"\n style={headerStyle}\n onClick={onToggle}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n aria-expanded={isExpanded}\n >\n {icon && (\n // biome-ignore lint/security/noDangerouslySetInnerHtml: renderIcon returns sanitized SVG from EMOJI_SVG_MAP or escapeHtml\n <span style={baseStyles.icon} dangerouslySetInnerHTML={{ __html: renderIcon(icon) }} />\n )}\n <span>{title}</span>\n <span style={chevronStyle}>{'\\u203A'}</span>\n </button>\n <div style={bodyStyle} aria-hidden={!isExpanded}>\n <p style={baseStyles.description}>{description}</p>\n {hasAction && (\n <a\n href={effectiveHref || '#'}\n onClick={handleLinkClick}\n style={{ ...baseStyles.linkButton, ...colors.linkButton }}\n target={external ? '_blank' : undefined}\n rel={external ? 'noopener noreferrer' : undefined}\n >\n {ctaLabel}\n </a>\n )}\n </div>\n </div>\n );\n}\n\n// ============================================================================\n// NavWidget Component\n// ============================================================================\n\n/**\n * NavWidget - Renders a collapsible navigation tips accordion.\n *\n * This component demonstrates the compositional action pattern:\n * - Parent (NavWidget) receives `config.actions` array\n * - Each action has optional `triggerWhen` for per-item visibility\n * - Parent evaluates triggerWhen and filters visible tips\n * - Parent manages expand state and re-rendering on context changes\n */\nexport function NavWidget({ config, runtime, instanceId }: NavWidgetProps) {\n // Force re-render when context/accumulator changes.\n const [renderTick, forceUpdate] = useReducer((x: number) => x + 1, 0);\n\n // Track expanded tip IDs\n const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());\n\n // Subscribe to context changes for reactive updates\n useEffect(() => {\n const unsubscribe = runtime.context.subscribe(() => {\n forceUpdate();\n });\n return unsubscribe;\n }, [runtime.context]);\n\n // Subscribe to accumulator changes for event_count-based triggerWhen\n useEffect(() => {\n if (!runtime.accumulator?.subscribe) return;\n return runtime.accumulator.subscribe(() => {\n forceUpdate();\n });\n }, [runtime.accumulator]);\n\n // Filter visible tips based on per-item triggerWhen\n // biome-ignore lint/correctness/useExhaustiveDependencies: renderTick is intentionally included to force re-evaluation when the runtime's mutable context changes (subscribed above via forceUpdate)\n const visibleTips = useMemo(\n () =>\n config.actions.filter((tip) => {\n if (!tip.triggerWhen) return true;\n try {\n const result = runtime.evaluateSync<boolean>(tip.triggerWhen);\n return result.value;\n } catch {\n // If strategy evaluation fails, hide the tip (fail-closed)\n return false;\n }\n }),\n [config.actions, runtime, renderTick]\n );\n\n // Group by category\n const categoryGroups = useMemo(() => {\n const groups = new Map<string | undefined, NavTipAction[]>();\n for (const tip of visibleTips) {\n const cat = tip.config.category;\n if (!groups.has(cat)) {\n groups.set(cat, []);\n }\n groups.get(cat)!.push(tip);\n }\n return groups;\n }, [visibleTips]);\n\n // Check if any items have categories\n const hasCategories = useMemo(() => visibleTips.some((t) => t.config.category), [visibleTips]);\n\n // Resolve theme (auto \u2192 detect system preference)\n const resolvedTheme = useMemo(() => {\n if (config.theme && config.theme !== 'auto') return config.theme;\n if (typeof window !== 'undefined') {\n return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n }, [config.theme]);\n\n // Handle tip toggle\n const handleToggle = useCallback(\n (id: string) => {\n setExpandedIds((prev) => {\n const wasExpanded = prev.has(id);\n\n let next: Set<string>;\n if (config.expandBehavior === 'single') {\n // In single mode, emit collapse events for any previously-expanded tips\n for (const prevId of prev) {\n if (prevId !== id) {\n runtime.events.publish('nav:toggled', {\n instanceId,\n tipId: prevId,\n expanded: false,\n timestamp: Date.now(),\n });\n }\n }\n next = wasExpanded ? new Set() : new Set([id]);\n } else {\n next = new Set(prev);\n if (wasExpanded) {\n next.delete(id);\n } else {\n next.add(id);\n }\n }\n\n // Emit event for the clicked tip using fresh state from the updater\n runtime.events.publish('nav:toggled', {\n instanceId,\n tipId: id,\n expanded: !wasExpanded,\n timestamp: Date.now(),\n });\n\n return next;\n });\n },\n [config.expandBehavior, runtime.events, instanceId]\n );\n\n // Handle navigation with event publishing\n const handleNavigate = useCallback(\n (href: string, external: boolean) => {\n // Reject dangerous URIs to prevent XSS\n const normalizedHref = href.trim().toLowerCase();\n if (normalizedHref.startsWith('javascript:') || normalizedHref.startsWith('data:')) {\n return;\n }\n\n runtime.events.publish('nav:tip_clicked', {\n instanceId,\n href,\n external,\n timestamp: Date.now(),\n });\n\n if (external) {\n window.open(href, '_blank', 'noopener,noreferrer');\n } else {\n // Try the host framework's native router first (Next.js, Nuxt, etc.)\n // Falls back to pushState for vanilla SPAs.\n const url = new URL(href, window.location.origin);\n url.search = window.location.search;\n if (!navigateWithFrameworkRouter(url.toString())) {\n window.history.pushState(null, '', url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n }\n },\n [runtime.events, instanceId]\n );\n\n // Handle same-page anchor focus: scroll + pulse + focus\n const handleFocusAnchor = useCallback(\n (anchor: AnchorId) => {\n const el = document.querySelector(anchor.selector);\n if (!(el instanceof HTMLElement)) return;\n\n runtime.events.publish('nav:tip_focused', {\n instanceId,\n selector: anchor.selector,\n route: anchor.route,\n timestamp: Date.now(),\n });\n\n el.scrollIntoView({ behavior: 'smooth', block: 'center' });\n pulseElement(el);\n // Focus after scroll completes\n setTimeout(() => el.focus(), 400);\n },\n [runtime.events, instanceId]\n );\n\n // Compute container styles\n const containerStyle: React.CSSProperties = {\n ...baseStyles.container,\n ...themeStyles[resolvedTheme].container,\n };\n\n const categoryHeaderStyle: React.CSSProperties = {\n ...baseStyles.categoryHeader,\n ...themeStyles[resolvedTheme].categoryHeader,\n };\n\n const emptyStateStyle: React.CSSProperties = {\n ...baseStyles.emptyState,\n ...themeStyles[resolvedTheme].emptyState,\n };\n\n // Render a list of nav tip items\n const renderItems = (items: NavTipAction[]) =>\n items.map((tip, index) => (\n <NavTipItem\n key={tip.config.id}\n item={tip}\n isExpanded={expandedIds.has(tip.config.id)}\n isLast={index === items.length - 1}\n onToggle={() => handleToggle(tip.config.id)}\n onNavigate={handleNavigate}\n onFocusAnchor={handleFocusAnchor}\n theme={resolvedTheme}\n />\n ));\n\n // Empty state\n if (visibleTips.length === 0) {\n return (\n <div style={containerStyle} data-adaptive-id={instanceId} data-adaptive-type=\"adaptive-nav\">\n <div style={emptyStateStyle}>\n You're all set for now! We'll share helpful tips here when they're relevant to what you're\n doing.\n </div>\n </div>\n );\n }\n\n return (\n <div style={containerStyle} data-adaptive-id={instanceId} data-adaptive-type=\"adaptive-nav\">\n <div style={baseStyles.accordion}>\n {hasCategories\n ? Array.from(categoryGroups.entries()).map(([category, items]) => (\n <React.Fragment key={category ?? '__ungrouped'}>\n {category && (\n <div style={categoryHeaderStyle} data-category-header={category}>\n {category}\n </div>\n )}\n {renderItems(items)}\n </React.Fragment>\n ))\n : renderItems(visibleTips)}\n </div>\n </div>\n );\n}\n\n// ============================================================================\n// Mountable Widget Interface\n// ============================================================================\n\n/**\n * Mountable widget interface for the runtime's WidgetRegistry.\n */\nexport const NavMountableWidget = {\n mount(\n container: HTMLElement,\n config?: NavConfig & { runtime?: NavWidgetRuntime; instanceId?: string }\n ) {\n const {\n runtime,\n instanceId = 'nav-widget',\n ...navConfig\n } = config || {\n expandBehavior: 'single' as const,\n theme: 'auto' as const,\n actions: [],\n };\n\n // React rendering when runtime + ReactDOM are available\n if (runtime && typeof createRoot === 'function') {\n const root = createRoot(container);\n root.render(\n React.createElement(NavWidget, {\n config: navConfig as NavConfig,\n runtime: runtime as NavWidgetRuntime,\n instanceId,\n })\n );\n return () => {\n root.unmount();\n };\n }\n },\n};\n\nexport default NavWidget;\n", "/**\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.2');\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 * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal\n */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of CSS properties and values.\n *\n * The key should be either a valid CSS property name string, like\n * `'background-color'`, or a valid JavaScript camel case property name\n * for CSSStyleDeclaration like `backgroundColor`.\n */\nexport interface StyleInfo {\n [name: string]: string | number | undefined | null;\n}\n\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\n\nclass StyleMapDirective extends Directive {\n private _previousStyleProperties?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n 'The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(styleInfo: Readonly<StyleInfo>) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n\n override update(part: AttributePart, [styleInfo]: DirectiveParameters<this>) {\n const {style} = part.element as HTMLElement;\n\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties!.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = null;\n }\n }\n }\n\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant =\n typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(\n name,\n isImportant\n ? (value as string).slice(0, flagTrim)\n : (value as string),\n isImportant ? important : ''\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {StyleMapDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n", "/**\n * Adaptive Nav - NavWidgetLit Web Component\n *\n * Lit web component equivalent of NavWidget.tsx. Renders a collapsible\n * navigation tips accordion with per-item conditional visibility, framework-aware\n * navigation, and CSS variable theming.\n *\n * Decorator-free: uses `static override properties` (tsconfig has no\n * experimentalDecorators).\n *\n * Uses light DOM (createRenderRoot returns this) so host-page CSS variables\n * (--sc-*) are inherited without crossing a shadow boundary.\n */\n\nimport { html, LitElement, nothing } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nimport { navigateWithFrameworkRouter } from './runtime';\nimport type { NavConfig, NavTipAction, NavWidgetRuntime } from './types';\n\n// ============================================================================\n// Design system token fallbacks (inlined to avoid bundling @syntro/design-system\n// as a hard dep for this file; values match packages/design-system/src/tokens/colors.ts)\n// ============================================================================\n\nconst TOKEN_PURPLE_4 = '#6a59ce';\nconst TOKEN_SLATE_GREY_7 = '#677384';\nconst TOKEN_SLATE_GREY_8 = '#87919f';\n\n// ============================================================================\n// Emoji \u2192 Lucide SVG inline mapping (matches NavWidget.tsx EMOJI_SVG_MAP)\n// ============================================================================\n\nconst EMOJI_SVG_MAP: Record<string, string> = {\n '\uD83D\uDCB5': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83C\uDFDB\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" x2=\"21\" y1=\"22\" y2=\"22\"/><line x1=\"6\" x2=\"6\" y1=\"18\" y2=\"11\"/><line x1=\"10\" x2=\"10\" y1=\"18\" y2=\"11\"/><line x1=\"14\" x2=\"14\" y1=\"18\" y2=\"11\"/><line x1=\"18\" x2=\"18\" y1=\"18\" y2=\"11\"/><polygon points=\"12 2 20 7 4 7\"/></svg>',\n '\u23ED\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 4 15 12 5 20 5 4\"/><line x1=\"19\" x2=\"19\" y1=\"5\" y2=\"19\"/></svg>',\n '\u27A1\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/></svg>',\n '\uD83D\uDCA1': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/></svg>',\n '\uD83D\uDCB0': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><path d=\"M6 12h.01M18 12h.01\"/></svg>',\n '\uD83D\uDCCB': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"8\" height=\"4\" x=\"8\" y=\"2\" rx=\"1\" ry=\"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-2h2\"/><path d=\"M12 11h4\"/><path d=\"M12 16h4\"/><path d=\"M8 11h.01\"/><path d=\"M8 16h.01\"/></svg>',\n '\u2705': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><path d=\"m9 11 3 3L22 4\"/></svg>',\n '\u26A0\uFE0F': '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></svg>',\n};\n\n// ============================================================================\n// Sanitization helpers\n// ============================================================================\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\nfunction renderIcon(emoji: string): string {\n return EMOJI_SVG_MAP[emoji] ?? escapeHtml(emoji);\n}\n\n// ============================================================================\n// Navigation routing decision\n// ============================================================================\n\n/**\n * Pure decision function: given an href, an `external` flag, the current\n * window's origin, and an optional customerHost, return the navigation action\n * that should be taken.\n *\n * Extracted from #handleNavigate so the routing logic can be tested without\n * mutating window.location (jsdom doesn't allow redefining origin/href).\n */\nexport type NavTarget =\n | { kind: 'open'; url: string }\n | { kind: 'fullnav'; url: string }\n | { kind: 'spa'; url: URL };\n\nexport function resolveNavTarget(args: {\n href: string;\n external: boolean;\n windowOrigin: string;\n customerHost?: string;\n}): NavTarget {\n const { href, external, windowOrigin, customerHost } = args;\n\n // 1. Opaque-origin context (about:srcdoc, sandbox-no-base) \u2014 must escape\n // via window.open. Resolve relatives against customerHost when available.\n const isOpaqueOrigin = windowOrigin === 'null';\n if (isOpaqueOrigin) {\n let absolute = href;\n if (customerHost) {\n try {\n absolute = new URL(href, customerHost).toString();\n } catch {\n /* fall through */\n }\n }\n return { kind: 'open', url: absolute };\n }\n\n // 2. external=true \u2192 always open in new tab\n if (external) {\n return { kind: 'open', url: href };\n }\n\n // 3. Resolve URL against current origin\n let url: URL;\n try {\n url = new URL(href, windowOrigin);\n } catch {\n return { kind: 'fullnav', url: href };\n }\n\n // 4. Cross-origin \u2192 full navigation\n if (url.origin !== windowOrigin) {\n return { kind: 'fullnav', url: url.toString() };\n }\n\n // 5. Same-origin \u2192 SPA pushState\n return { kind: 'spa', url };\n}\n\n// ============================================================================\n// Route matching helper\n// ============================================================================\n\nfunction routeMatchesCurrent(routes: string[]): boolean {\n if (typeof window === 'undefined') return false;\n const current = window.location.pathname;\n return routes.some((route) => {\n const routePath = route.split('?')[0].split('#')[0];\n if (routePath.endsWith('/**')) {\n return current.startsWith(routePath.slice(0, -3));\n }\n return current === routePath;\n });\n}\n\n// ============================================================================\n// Pulse animation helper\n// ============================================================================\n\nfunction pulseElement(el: HTMLElement): void {\n const keyframes: Keyframe[] = [\n { boxShadow: '0 0 0 0 rgba(13, 148, 136, 0.5)' },\n { boxShadow: '0 0 0 8px rgba(13, 148, 136, 0)' },\n ];\n el.animate(keyframes, { duration: 600, iterations: 3, easing: 'ease-out' });\n}\n\n// ============================================================================\n// Theme helpers\n// ============================================================================\n\ntype ResolvedTheme = 'light' | 'dark';\n\nfunction resolveTheme(theme: string | undefined): ResolvedTheme {\n if (theme === 'dark') return 'dark';\n if (theme === 'light') return 'light';\n // auto or undefined: detect system preference\n if (typeof window !== 'undefined') {\n return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n}\n\n// ============================================================================\n// AnchorId type (matches sdk-contracts shape used in NavWidget.tsx)\n// ============================================================================\n\ninterface AnchorId {\n route: string | string[];\n selector: string;\n}\n\n// ============================================================================\n// NavWidgetLit \u2014 LitElement\n// ============================================================================\n\nexport class NavWidgetLit extends LitElement {\n // ---------- No shadow DOM \u2014 inherit host CSS variables --------------------\n\n override createRenderRoot() {\n return this;\n }\n\n // ---------- Reactive properties (no decorators) --------------------------\n\n static override properties = {\n // Public inputs\n config: { attribute: false },\n runtime: { attribute: false },\n instanceId: { type: String },\n\n // Internal reactive state\n _expandedIds: { state: true },\n _renderTick: { state: true },\n _hoveredId: { state: true },\n };\n\n // ---------- Public properties --------------------------------------------\n\n config: NavConfig = { expandBehavior: 'single', theme: 'auto', actions: [] };\n runtime: NavWidgetRuntime | undefined = undefined;\n instanceId: string = 'nav-widget';\n\n // ---------- Internal state -----------------------------------------------\n\n /** @internal */ _expandedIds: Set<string> = new Set();\n /** @internal */ _renderTick = 0;\n /** @internal */ _hoveredId: string | null = null;\n\n // ---------- Private subscriptions ----------------------------------------\n\n #contextUnsub: (() => void) | null = null;\n #accumulatorUnsub: (() => void) | null = null;\n\n // ---------- Lifecycle: connectedCallback ---------------------------------\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#subscribeRuntime();\n }\n\n // ---------- Lifecycle: disconnectedCallback ------------------------------\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#unsubscribeRuntime();\n }\n\n // ---------- Lifecycle: updated -------------------------------------------\n\n override updated(changed: Map<string, unknown>): void {\n if (changed.has('runtime')) {\n this.#unsubscribeRuntime();\n this.#subscribeRuntime();\n }\n }\n\n // ---------- Runtime subscriptions ----------------------------------------\n\n #subscribeRuntime(): void {\n if (!this.runtime) return;\n\n this.#contextUnsub = this.runtime.context.subscribe(() => {\n this._renderTick += 1;\n });\n\n if (this.runtime.accumulator?.subscribe) {\n this.#accumulatorUnsub = this.runtime.accumulator.subscribe(() => {\n this._renderTick += 1;\n });\n }\n }\n\n #unsubscribeRuntime(): void {\n this.#contextUnsub?.();\n this.#contextUnsub = null;\n this.#accumulatorUnsub?.();\n this.#accumulatorUnsub = null;\n }\n\n // ---------- Computed helpers (called on each render) ---------------------\n\n #getVisibleTips(): NavTipAction[] {\n // _renderTick is read here to ensure this re-runs when context/accumulator\n // notify (same pattern as useMemo with renderTick dep in React version).\n void this._renderTick;\n\n if (!this.runtime) return this.config.actions;\n\n return this.config.actions.filter((tip) => {\n if (!tip.triggerWhen) return true;\n try {\n const result = this.runtime!.evaluateSync<boolean>(tip.triggerWhen);\n return result.value;\n } catch {\n // Fail-closed: hide tip when strategy evaluation throws\n return false;\n }\n });\n }\n\n #getResolvedTheme(): ResolvedTheme {\n return resolveTheme(this.config.theme);\n }\n\n // ---------- Event handlers -----------------------------------------------\n\n #handleToggle(id: string): void {\n const wasExpanded = this._expandedIds.has(id);\n\n let next: Set<string>;\n if (this.config.expandBehavior === 'single') {\n // Emit collapse events for previously-expanded tips (single mode)\n for (const prevId of this._expandedIds) {\n if (prevId !== id) {\n this.#publishEvent('nav:toggled', {\n tipId: prevId,\n expanded: false,\n });\n }\n }\n next = wasExpanded ? new Set() : new Set([id]);\n } else {\n next = new Set(this._expandedIds);\n if (wasExpanded) {\n next.delete(id);\n } else {\n next.add(id);\n }\n }\n\n this.#publishEvent('nav:toggled', {\n tipId: id,\n expanded: !wasExpanded,\n });\n\n this._expandedIds = next;\n }\n\n #handleNavigate(href: string, external: boolean): void {\n // Reject dangerous URIs\n const normalized = href.trim().toLowerCase();\n if (normalized.startsWith('javascript:') || normalized.startsWith('data:')) return;\n\n this.#publishEvent('nav:tip_clicked', { href, external });\n\n // Also fire a standard custom event for host-page listeners\n this.dispatchEvent(\n new CustomEvent('nav-tip-clicked', {\n bubbles: true,\n detail: { href, external, instanceId: this.instanceId },\n })\n );\n\n // Routing decision is in resolveNavTarget (a pure helper, exported for\n // testing). Five-way branch:\n // - opaque-origin (about:srcdoc) \u2192 window.open against customerHost-resolved URL\n // - external=true \u2192 window.open new tab\n // - cross-origin \u2192 window.location.href full nav\n // - same-origin \u2192 SPA pushState (with framework router fallback)\n // - parse-fail \u2192 window.location.href fallback\n const target = resolveNavTarget({\n href,\n external,\n windowOrigin: typeof window !== 'undefined' ? window.location.origin : '',\n customerHost: this.runtime?.customerHost,\n });\n\n if (target.kind === 'open') {\n window.open(target.url, '_blank', 'noopener,noreferrer');\n return;\n }\n if (target.kind === 'fullnav') {\n window.location.href = target.url;\n return;\n }\n // kind === 'spa'\n target.url.search = window.location.search;\n if (!navigateWithFrameworkRouter(target.url.toString())) {\n window.history.pushState(null, '', target.url.toString());\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n }\n\n #handleFocusAnchor(anchor: AnchorId): void {\n const el = document.querySelector(anchor.selector);\n if (!(el instanceof HTMLElement)) return;\n\n this.#publishEvent('nav:tip_focused', {\n selector: anchor.selector,\n route: anchor.route,\n });\n\n this.dispatchEvent(\n new CustomEvent('nav-tip-focused', {\n bubbles: true,\n detail: { selector: anchor.selector, instanceId: this.instanceId },\n })\n );\n\n el.scrollIntoView({ behavior: 'smooth', block: 'center' });\n pulseElement(el);\n setTimeout(() => el.focus(), 400);\n }\n\n #publishEvent(name: string, props: Record<string, unknown>): void {\n this.runtime?.events.publish(name, {\n instanceId: this.instanceId,\n timestamp: Date.now(),\n ...props,\n });\n }\n\n // ---------- Tip item rendering -------------------------------------------\n\n #renderTipItem(tip: NavTipAction, index: number, total: number) {\n const { id, title, description, href, icon, external, anchor, category: _cat } = tip.config;\n const isExpanded = this._expandedIds.has(id);\n const isLast = index === total - 1;\n const isHovered = this._hoveredId === id;\n const theme = this.#getResolvedTheme();\n\n // Determine the effective href from anchor or legacy href\n const effectiveHref = anchor\n ? Array.isArray(anchor.route)\n ? anchor.route[0]\n : anchor.route\n : href;\n\n // Same-page check\n const isSamePage = anchor\n ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route])\n : effectiveHref\n ? routeMatchesCurrent([effectiveHref])\n : false;\n const hasSelector = anchor?.selector && anchor.selector !== '*';\n const isFocusAction = isSamePage && hasSelector;\n const hasAction = !!effectiveHref || isFocusAction;\n\n const ctaLabel = isFocusAction ? 'Focus \\u2192' : external ? 'Go \\u2197' : 'Go \\u2192';\n\n // Item container styles\n const itemStyle = styleMap({\n borderRadius: 'var(--sc-content-border-radius, 8px)',\n overflow: 'hidden',\n transition: 'box-shadow 0.2s ease',\n backgroundColor: 'var(--sc-content-background)',\n border: 'var(--sc-content-border)',\n ...(isExpanded\n ? {\n boxShadow:\n theme === 'dark'\n ? '0 4px 12px rgba(0, 0, 0, 0.15)'\n : '0 4px 12px rgba(0, 0, 0, 0.08)',\n }\n : {}),\n ...(!isLast ? { borderBottom: 'var(--sc-content-item-divider, none)' } : {}),\n });\n\n // Header styles\n const headerStyle = styleMap({\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n width: '100%',\n padding: 'var(--sc-content-item-padding, 12px 16px)',\n border: 'none',\n cursor: 'pointer',\n fontSize: 'var(--sc-content-item-font-size, 15px)',\n fontWeight: '500',\n fontFamily: 'inherit',\n textAlign: 'left',\n transition: 'background-color 0.15s ease',\n backgroundColor: isHovered ? 'var(--sc-content-background-hover)' : 'transparent',\n color: 'var(--sc-content-text-color)',\n });\n\n // Chevron styles\n const chevronStyle = styleMap({\n fontSize: '20px',\n transition: 'transform 0.2s ease',\n marginLeft: 'auto',\n flexShrink: '0',\n color: 'var(--sc-content-chevron-color, currentColor)',\n transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',\n });\n\n // Body styles\n const bodyStyle = styleMap({\n overflow: 'hidden',\n transition: 'max-height 0.25s ease, padding-bottom 0.25s ease',\n padding: 'var(--sc-content-body-padding, 0 16px 12px 16px)',\n color: 'var(--sc-content-text-secondary-color)',\n maxHeight: isExpanded ? '500px' : '0',\n paddingBottom: isExpanded ? '16px' : '0',\n });\n\n // Description styles\n const descriptionStyle = styleMap({\n fontSize: 'var(--sc-content-body-font-size, 14px)',\n lineHeight: '1.5',\n margin: '0',\n });\n\n // CTA / link button styles\n const linkButtonStyle = styleMap({\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n marginTop: '10px',\n padding: '6px 12px',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '13px',\n fontWeight: '500',\n cursor: 'pointer',\n border: 'none',\n transition: 'background-color 0.15s ease',\n backgroundColor: `var(--sc-color-primary, ${TOKEN_PURPLE_4})`,\n color: '#ffffff',\n });\n\n // Icon styles\n const iconStyle = styleMap({\n fontSize: '16px',\n flexShrink: '0',\n });\n\n // Anchor click handler\n const onLinkClick = (e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n if (isFocusAction && anchor) {\n this.#handleFocusAnchor(anchor);\n } else if (effectiveHref) {\n this.#handleNavigate(effectiveHref, external ?? false);\n }\n };\n\n return html`\n <div\n style=${itemStyle}\n data-nav-tip-id=${id}\n >\n <button\n type=\"button\"\n style=${headerStyle}\n aria-expanded=${isExpanded}\n @click=${() => this.#handleToggle(id)}\n @mouseenter=${() => {\n this._hoveredId = id;\n }}\n @mouseleave=${() => {\n this._hoveredId = null;\n }}\n >\n ${icon ? html`<span style=${iconStyle}>${unsafeHTML(renderIcon(icon))}</span>` : nothing}\n <span>${title}</span>\n <span style=${chevronStyle}>${'\\u203A'}</span>\n </button>\n <div style=${bodyStyle} aria-hidden=${!isExpanded}>\n <p style=${descriptionStyle}>${description}</p>\n ${\n hasAction\n ? html`\n <a\n href=${effectiveHref || '#'}\n style=${linkButtonStyle}\n target=${external ? '_blank' : nothing}\n rel=${external ? 'noopener noreferrer' : nothing}\n @click=${onLinkClick}\n >${ctaLabel}</a>\n `\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n // ---------- Render --------------------------------------------------------\n\n override render() {\n const visibleTips = this.#getVisibleTips();\n const theme = this.#getResolvedTheme();\n\n const containerStyle = styleMap({\n fontFamily: 'var(--sc-font-family, system-ui, -apple-system, sans-serif)',\n maxWidth: '100%',\n overflow: 'hidden',\n backgroundColor: 'transparent',\n color: 'inherit',\n });\n\n const accordionStyle = styleMap({\n display: 'flex',\n flexDirection: 'column',\n gap: 'var(--sc-content-item-gap, 6px)',\n });\n\n const categoryHeaderStyle = styleMap({\n fontSize: 'var(--sc-content-category-font-size, 12px)',\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n padding: 'var(--sc-content-category-padding, 8px 4px 4px 4px)',\n color: theme === 'dark' ? TOKEN_SLATE_GREY_8 : TOKEN_SLATE_GREY_7,\n });\n\n const emptyStateStyle = styleMap({\n fontSize: '13px',\n padding: '16px',\n textAlign: 'center',\n color: theme === 'dark' ? TOKEN_SLATE_GREY_7 : TOKEN_SLATE_GREY_8,\n });\n\n // Empty state\n if (visibleTips.length === 0) {\n return html`\n <div\n style=${containerStyle}\n data-adaptive-id=${this.instanceId}\n data-adaptive-type=\"adaptive-nav\"\n >\n <div style=${emptyStateStyle}>\n You're all set for now! We'll share helpful tips here when they're relevant to what\n you're doing.\n </div>\n </div>\n `;\n }\n\n // Group by category\n const categoryGroups = new Map<string | undefined, NavTipAction[]>();\n for (const tip of visibleTips) {\n const cat = tip.config.category;\n if (!categoryGroups.has(cat)) {\n categoryGroups.set(cat, []);\n }\n categoryGroups.get(cat)!.push(tip);\n }\n\n const hasCategories = visibleTips.some((t) => t.config.category);\n\n return html`\n <div\n style=${containerStyle}\n data-adaptive-id=${this.instanceId}\n data-adaptive-type=\"adaptive-nav\"\n >\n <div style=${accordionStyle}>\n ${\n hasCategories\n ? Array.from(categoryGroups.entries()).map(\n ([category, items]) => html`\n ${\n category\n ? html`<div style=${categoryHeaderStyle} data-category-header=${category}>${category}</div>`\n : nothing\n }\n ${items.map((tip, idx) => this.#renderTipItem(tip, idx, items.length))}\n `\n )\n : visibleTips.map((tip, idx) => this.#renderTipItem(tip, idx, visibleTips.length))\n }\n </div>\n </div>\n `;\n }\n}\n\n// ============================================================================\n// Custom element registration\n// ============================================================================\n\nconst TAG_NAME = 'syntro-nav-tips';\n\nexport function registerNavWidgetLit(): void {\n if (typeof window === 'undefined') return;\n if (!customElements.get(TAG_NAME)) {\n customElements.define(TAG_NAME, NavWidgetLit);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'syntro-nav-tips': NavWidgetLit;\n }\n}\n", "/**\n * Adaptive Nav - Runtime Module\n *\n * Runtime manifest for the navigation tips accordion adaptive.\n * Includes widget-based nav tips and navigation action executors\n * (scrollTo, navigate) previously in adaptive-navigation.\n */\n\nimport { NavMountableWidget } from './NavWidget';\nimport { registerNavWidgetLit } from './NavWidgetLit';\nimport type {\n ActionExecutor,\n ExecutorResult,\n NavConfig,\n NavigateAction,\n NavTipAction,\n NavWidgetRuntime,\n ScrollToAction,\n} from './types';\n\n// ============================================================================\n// Navigation Action Executors (merged from adaptive-navigation)\n// ============================================================================\n\n/**\n * Execute a scrollTo action\n */\nexport const executeScrollTo: ActionExecutor<ScrollToAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n const anchorEl = context.resolveAnchor(action.anchorId);\n if (!anchorEl) {\n console.error(\n `[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`\n );\n return { cleanup: () => {} };\n }\n\n // Scroll to element\n anchorEl.scrollIntoView({\n behavior: action.behavior ?? 'smooth',\n block: action.block ?? 'center',\n inline: action.inline ?? 'nearest',\n });\n\n context.publishEvent('action.applied', {\n id: context.generateId(),\n kind: 'navigation:scrollTo',\n anchorId: action.anchorId,\n behavior: action.behavior ?? 'smooth',\n });\n\n return {\n cleanup: () => {\n // Optionally restore scroll position on revert\n },\n };\n};\n\n/**\n * Try to navigate using the host framework's native router.\n * Returns true if a framework router handled the navigation,\n * false if no framework was detected (caller should use pushState or location.href).\n *\n * Using the native router preserves SPA behavior (no full reload),\n * layout state, scroll position, and framework-specific features\n * (RSC streaming, view transitions, etc.).\n */\nexport function navigateWithFrameworkRouter(url: string): boolean {\n if (typeof window === 'undefined') return false;\n const w = window as any;\n\n // Next.js \uFFFD\uFFFD window.next.router.push() triggers App Router navigation\n // with RSC fetch, layout preservation, and loading states\n try {\n const nextRouter = w.next?.router;\n if (nextRouter?.push) {\n nextRouter.push(url);\n return true;\n }\n } catch {\n /* fall through */\n }\n\n // Nuxt 3 \u2014 useRouter() isn't accessible from outside Vue, but\n // $nuxt.$router (Nuxt 2) or window.__NUXT__?.hooks (Nuxt 3) + navigateTo\n // aren't reliably exposed. Nuxt 2 exposes $nuxt.$router.push().\n try {\n if (w.$nuxt?.$router?.push) {\n w.$nuxt.$router.push(url);\n return true;\n }\n } catch {\n /* fall through */\n }\n\n // Angular \u2014 Angular Router isn't exposed on window by default.\n // The most reliable approach is to detect Angular and use location.href.\n if (w.ng || w.getAllAngularRootElements || document.querySelector('[ng-version]')) {\n window.location.href = url;\n return true;\n }\n\n // SvelteKit \u2014 goto() isn't on window, but __SVELTEKIT_DATA__ confirms the framework.\n if (w.__SVELTEKIT_DATA__ || document.body?.hasAttribute('data-sveltekit')) {\n window.location.href = url;\n return true;\n }\n\n // Astro (View Transitions) \u2014 no client-side router API exposed\n if (document.querySelector('[data-astro-transition-fallback]')) {\n window.location.href = url;\n return true;\n }\n\n return false;\n}\n\n/**\n * Check if a URL is same-origin as the current page.\n * Relative URLs (e.g. \"/dashboard\") are always same-origin.\n */\nfunction isSameOrigin(url: string): boolean {\n try {\n const parsed = new URL(url, window.location.origin);\n return parsed.origin === window.location.origin;\n } catch {\n // If URL parsing fails, fall back to full navigation\n return false;\n }\n}\n\n/**\n * Execute a navigate action\n */\nexport const executeNavigate: ActionExecutor<NavigateAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n // Validate URL to prevent javascript: URLs\n const url = action.url.trim();\n if (url.toLowerCase().startsWith('javascript:')) {\n throw new Error('javascript: URLs are not allowed');\n }\n\n const target = action.target ?? '_self';\n\n context.publishEvent('action.applied', {\n id: context.generateId(),\n kind: 'navigation:navigate',\n url: action.url,\n target,\n });\n\n if (target === '_blank') {\n // Open in new tab\n window.open(url, '_blank', 'noopener,noreferrer');\n } else if (!action.forceFullNavigation && isSameOrigin(url)) {\n // Try the host framework's native router first (Next.js, Nuxt, Angular, etc.)\n // Falls back to pushState for vanilla SPAs, or location.href as last resort.\n if (!navigateWithFrameworkRouter(url)) {\n window.history.pushState(null, '', url);\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n } else {\n // Full navigation for cross-origin URLs or when explicitly requested\n window.location.href = url;\n }\n\n return {\n cleanup: () => {\n // Navigation cannot be reverted\n },\n };\n};\n\n// ============================================================================\n// Lit Mountable Widget\n// ============================================================================\n\n/**\n * NavWidgetLitMountable \u2014 Mounts the `<syntro-nav-tips>` Lit web component.\n *\n * Drop-in companion to NavMountableWidget that avoids React/ReactDOM entirely.\n * Self-registers the custom element on first use.\n */\nexport const NavWidgetLitMountable = {\n mount(\n container: HTMLElement,\n config?: NavConfig & { runtime?: NavWidgetRuntime; instanceId?: string }\n ) {\n registerNavWidgetLit();\n\n const el = document.createElement('syntro-nav-tips');\n\n const {\n runtime,\n instanceId = 'nav-widget',\n ...navConfig\n } = config ?? {\n expandBehavior: 'single' as const,\n theme: 'auto' as const,\n actions: [],\n };\n\n // Assign structured props as JS properties (not HTML attributes)\n Object.assign(el, {\n config: navConfig,\n runtime,\n instanceId,\n });\n\n container.appendChild(el);\n\n return () => el.remove();\n },\n};\n\n// ============================================================================\n// Executor Definitions for Registration\n// ============================================================================\n\n/**\n * All executors provided by this app.\n * These are registered with the runtime's ExecutorRegistry.\n */\nexport const executors = [\n { kind: 'navigation:scrollTo', executor: executeScrollTo },\n { kind: 'navigation:navigate', executor: executeNavigate },\n] as const;\n\n// ============================================================================\n// App Runtime Manifest\n// ============================================================================\n\n/**\n * Runtime manifest for adaptive-nav.\n *\n * Provides:\n * - Navigation action executors (scrollTo, navigate)\n * - Widget-based nav tips accordion (compositional nav:tip actions)\n */\nexport const runtime = {\n id: 'adaptive-nav',\n version: '2.0.0',\n name: 'Navigation Tips',\n description: 'Navigation actions and accordion-based tips with per-item conditional visibility',\n\n /**\n * Navigation action executors (scrollTo, navigate).\n */\n executors,\n\n /**\n * Widget definitions for the runtime's WidgetRegistry.\n */\n widgets: [\n {\n id: 'adaptive-nav:tips',\n component: NavMountableWidget,\n metadata: {\n name: 'Navigation Tips',\n description: 'Accordion of contextual navigation tips with per-item visibility',\n icon: '\\u{1F9ED}',\n },\n },\n ],\n\n /**\n * Extract notify watcher entries from tile config props.\n * The runtime evaluates these continuously (even with drawer closed)\n * and publishes nav:tip_revealed when triggerWhen transitions false \u2192 true.\n */\n notifyWatchers(props: Record<string, unknown>) {\n const actions = (props.actions ?? []) as NavTipAction[];\n return actions\n .filter((a) => a.notify && a.triggerWhen)\n .map((a) => ({\n id: `nav:${a.config.id}`,\n strategy: a.triggerWhen!,\n eventName: 'nav:tip_revealed',\n eventProps: {\n tipId: a.config.id,\n title: a.notify!.title,\n body: a.notify!.body,\n icon: a.notify!.icon,\n },\n }));\n },\n};\n\nexport default runtime;\n", "/**\n * CDN Entry Point for Adaptive Nav\n *\n * This module is bundled for CDN delivery and self-registers with the global\n * SynOS app registry when loaded dynamically via the AppLoader.\n */\n\nimport NavEditor, { editorPanel } from './editor';\nimport { executors, runtime } from './runtime';\n\n/**\n * App manifest for registry registration.\n * Follows the AppManifest interface expected by AppLoader/AppRegistry.\n */\nexport const manifest = {\n id: 'adaptive-nav',\n version: runtime.version,\n name: runtime.name,\n description: runtime.description,\n runtime: {\n actions: executors.map(({ kind, executor }) => ({\n kind,\n executor,\n })),\n widgets: runtime.widgets,\n notifyWatchers: runtime.notifyWatchers,\n },\n editor: {\n component: NavEditor,\n panel: editorPanel,\n getActionLabel(action: Record<string, unknown>) {\n const config = (action.config as Record<string, unknown>) || {};\n return (config.title as string) || (action.kind as string) || 'nav:tip';\n },\n },\n metadata: {\n isBuiltIn: false,\n },\n};\n\n/**\n * Self-register with global registry if available.\n * This happens when loaded via script tag (UMD).\n */\nif (typeof window !== 'undefined') {\n const registry = (window as any).SynOS?.appRegistry;\n if (registry && typeof registry.register === 'function') {\n registry.register(manifest);\n }\n}\n\nexport default manifest;\n"],
|
|
5
|
+
"mappings": "sZAAO,SAASA,KAAMC,EAAS,CAC3B,OAAOA,EAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,CAC3C,CCDY,SAASC,IAAK,CACZ,OAAQ,OAAO,MAAU,KAAe,MAAM,OAAU,CAAC,CAC3D,CACA,SAASC,GAAKC,EAAMC,EAAOC,EAAK,CAC9B,IAAIC,EAAIL,GAAG,EACPM,EAAIH,GAAS,CAAC,EACdI,EAAID,EAAE,SACV,cAAOA,EAAE,SACLF,IAAQ,SAAWE,EAAE,IAAMF,GACxB,MAAM,QAAQG,CAAC,EAClBF,EAAE,cAAc,MAAM,KAAM,CAACH,EAAMI,CAAC,EAAE,OAAOC,CAAC,CAAC,EAC/CA,IAAM,OACJF,EAAE,cAAcH,EAAMI,EAAGC,CAAC,EAC1BF,EAAE,cAAcH,EAAMI,CAAC,CAC/B,CACO,IAAIE,EAAMP,GACNQ,EAAOR,GACPS,GAAWV,GAAG,EAAE,SCjB3B,SAASW,GAAK,CACZ,OAAQ,OAAO,MAAU,KAAe,MAAM,OAAU,CAAC,CAC3D,CAGA,IAAOC,GAAQ,IAAI,MAAM,CAAC,EAAG,CAAE,IAAK,SAASC,EAAGC,EAAG,CAAE,OAAOH,EAAG,EAAEG,CAAC,CAAG,CAAE,CAAC,EAGjE,SAASC,GAAW,CAAE,OAAOJ,EAAG,EAAE,SAAS,MAAM,KAAM,SAAS,CAAG,CACnE,SAASK,GAAY,CAAE,OAAOL,EAAG,EAAE,UAAU,MAAM,KAAM,SAAS,CAAG,CACrE,SAASM,IAAU,C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EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAO,CAChB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAS,CAClB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,EAAS,CAClB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACaC,GAAO,CAChB,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EAIaC,GAAS,CAClB,KAAM,CACF,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACA,OAAQ,CACJ,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACA,QAAS,CACL,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,EACA,KAAM,CACF,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,UACH,EAAG,SACP,CACJ,EAIaC,GAAO,CAChB,QAAST,EAAU,EAAE,EACrB,UAAWA,EAAU,CAAC,EACtB,SAAUA,EAAU,CAAC,CACzB,EAIaU,GAAa,CACtB,QAASV,EAAU,CAAC,EACpB,UAAWA,EAAU,CAAC,CAC1B,EAIaW,GAAS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F,EAAE,EACF,QAASH,GAAQ,QACjB,eAAgBA,GAAQ,cAC1B,EACA,OAAQ,CACN,UAAWI,GACX,MAAOC,GACP,eAAeC,EAAiC,CAE9C,OADgBA,EAAO,QAAsC,CAAC,GAC/C,OAAqBA,EAAO,MAAmB,SAChE,CACF,EACA,SAAU,CACR,UAAW,EACb,CACF,EAMA,GAAI,OAAO,OAAW,IAAa,CACjC,IAAMC,EAAY,OAAe,OAAO,YACpCA,GAAY,OAAOA,EAAS,UAAa,YAC3CA,EAAS,SAASR,EAAQ,CAE9B,CAEA,IAAOS,GAAQT",
|
|
6
|
+
"names": ["cn", "classes", "_R", "_jsx", "type", "props", "key", "R", "p", "c", "jsx", "jsxs", "Fragment", "_R", "react_default", "_", "k", "useState", "useEffect", "useMemo", "useCallback", "useRef", "useReducer", "_R", "useId", "_R", "createElement", "_R", "forwardRef", "_R", "_r", "_R", "Fragment", "Suspense", "Children", "Component", "PureComponent", "_RD", "react_dom_default", "_", "k", "CSS_SELECTOR_TYPE", "libraryName", "showWarning", "id", "args", "DEFAULT_OPTIONS", "CSS_SELECTOR_TYPE", "isRegExp", "input", "wildcardToRegExp", "input", "createPatternMatcher", "list", "matchFunctions", "item", "isRegExp", "result", "showWarning", "re", "matchFunction", "INVALID_ID_RE", "INVALID_CLASS_RE", "SELECTOR_PATTERN", "CSS_SELECTOR_TYPE", "attributeBlacklistMatch", "createPatternMatcher", "ESCAPED_COLON", "mergeClasses", "classes", "className", "index", "array", "toKebabCase", "string", "toCamelCase", "string", "match", "p1", "p2", "toPascalCase", "string", "camelCase", "toCamelCase", "defaultAttributes", "hasA11yProp", "props", "prop", "Icon", "forwardRef", "color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children", "iconNode", "rest", "ref", "createElement", "defaultAttributes", "mergeClasses", "hasA11yProp", "tag", "attrs", "createLucideIcon", "iconName", "iconNode", "Component", "forwardRef", "className", "props", "ref", "createElement", "Icon", "mergeClasses", "toKebabCase", "toPascalCase", "__iconNode", "Check", "createLucideIcon", "DetectionBadge", "found", "onClick", "title", "textColor", "dotColor", "classes", "cn", "dot", "jsx", "jsxs", "e", "DismissedSection", "count", "children", "isOpen", "setIsOpen", "useState", "jsxs", "e", "jsx", "EditorBody", "children", "jsx", "EditorCard", "children", "itemKey", "onClick", "onMouseEnter", "onMouseLeave", "className", "validated", "jsx", "e", "cn", "EditorHeader", "title", "subtitle", "jsxs", "jsx", "EditorInput", "label", "className", "id", "props", "generatedId", "useId", "inputId", "jsxs", "jsx", "cn", "EditorLayout", "children", "jsx", "base", "brand", "slateGrey", "green", "yellow", "red", "blue", "orange", "purple", "pink", "legacy", "text", "background", "border", "button", "badge", "badgeBanner", "alert", "tag", "menu", "inputDropdown", "inputField", "toggle", "checkbox", "avatar", "progressBarSlider", "card", "sidebar", "modal", "tab", "table", "breadcrumbs", "loadingIndicator", "datePicker", "scroll", "colors", "shadows", "focusRings", "backdropBlur", "overlay", "glowShadows", "elevationShadows", "syntroPreset", "colors", "shadows", "glowShadows", "elevationShadows", "focusRings", "backdropBlur", "overlay", "panelBackground", "panelShadows", "panelBackdropBlur", "fab", "base", "brand", "panelBehavior", "panelShell", "panel_shell_default", "MIN_WIDTH", "panel_shell_default", "MIN_HEIGHT", "FAB_SIZE", "FAB_INSET", "SNAP_THRESHOLD", "DRAG_THRESHOLD", "HANDLE_SIZE", "RESIZE_HANDLES", "HANDLE_SIZE", "EmptyState", "message", "jsx", "GroupHeader", "label", "count", "className", "jsxs", "cn", "jsx", "ProgressBar", "current", "target", "pct", "jsxs", "jsx", "cn", "JourneyNode", "cs", "isLast", "hasProgress", "inProgress", "Check", "TriggerJourney", "status", "conditions", "allPassed", "c", "isMulti", "i", "DEFAULTS", "panel_shell_default", "HANDLE_SIZE", "formatOperator", "op", "humanizeKey", "key", "cleanUrl", "url", "PAGE_VIEW_RE", "CLICK_RE", "formatConditionLabel", "condition", "accumulatorCount", "target", "current", "humanized", "instruction", "shortLabel", "topic", "lastWord", "w", "cleaned", "rawAnchor", "anchorId", "state", "eventName", "val", "parts", "label", "threshold", "inverted", "limit", "routeId", "getRuntime", "rt", "evaluateTriggerWhen", "triggerWhen", "runtime", "result", "conditions", "condition", "passed", "accCount", "formatted", "formatConditionLabel", "useTriggerWhenStatus", "items", "statuses", "setStatuses", "useState", "itemsRef", "useRef", "evaluate", "useCallback", "map", "item", "useEffect", "unsubs", "interval", "u", "action_step_field_mapping_default", "INTERACTIVE_TAGS", "action_step_field_mapping_default", "INTERACTIVE_ROLES", "truncate", "text", "max", "isRuleStrategy", "s", "describeTrigger", "triggerWhen", "pages", "anchors", "rule", "condition", "parts", "summarizeNavItem", "item", "icon", "title", "ACTION_NAMESPACES", "isOwnAction", "action", "ns", "isRuleStrategy", "s", "extractTargetingInfo", "triggerWhen", "pagePatterns", "anchorSelectors", "rule", "cond", "c", "hasTargeting", "extractFirstPage", "extractFirstAnchor", "savePendingHighlight", "selector", "flattenItems", "config", "isOwnAction", "tip", "i", "summarizeNavItem", "describeTrigger", "filterConfig", "dismissedKeys", "ownActions", "_", "useDetection", "items", "getCurrentRoute", "detectionMap", "setDetectionMap", "useState", "itemsRef", "useRef", "useEffect", "runDetection", "map", "currentPath", "item", "targeting", "pageMatch", "pattern", "anchorFound", "element", "interval", "NavEditor", "onChange", "editor", "typedConfig", "setDismissedKeys", "editingKey", "setEditingKey", "_previewMode", "setPreviewMode", "_hoveredKey", "setHoveredKey", "mode", "allKeys", "empty", "initialConsumed", "allItems", "activeItems", "dismissedItems", "totalLinks", "triggerWhenItems", "useMemo", "triggerWhenStatuses", "useTriggerWhenStatus", "foundCount", "handleDismiss", "useCallback", "key", "prev", "next", "handleRestore", "handleCardBodyClick", "handleTriggerClick", "pageUrl", "handleBackToList", "_handleBeforeAfter", "filtered", "handleFieldChange", "index", "field", "value", "link", "otherActions", "a", "updated", "_handlePublish", "handleBadgeClick", "handleCardHover", "handleCardLeave", "renderEditFields", "it", "jsxs", "jsx", "EditorInput", "e", "subtitle", "EditorLayout", "EditorHeader", "EditorBody", "editIndex", "editItem", "Fragment", "EmptyState", "GroupHeader", "detection", "EditorCard", "DetectionBadge", "TriggerJourney", "DismissedSection", "editorPanel", "editor_default", "NavEditor", "_RD", "client_default", "_", "k", "createRoot", "EMOJI_SVG_MAP", "renderIcon", "emoji", "escapeHtml", "str", "baseStyles", "themeStyles", "purple", "slateGrey", "routeMatchesCurrent", "routes", "current", "route", "routePath", "pulseElement", "el", "keyframes", "NavTipItem", "item", "isExpanded", "isLast", "onToggle", "onNavigate", "onFocusAnchor", "theme", "isHovered", "setIsHovered", "useState", "colors", "title", "description", "href", "icon", "external", "anchor", "itemStyle", "headerStyle", "chevronStyle", "bodyStyle", "effectiveHref", "isSamePage", "hasSelector", "isFocusAction", "hasAction", "handleLinkClick", "e", "ctaLabel", "jsxs", "jsx", "NavWidget", "config", "runtime", "instanceId", "renderTick", "forceUpdate", "useReducer", "x", "expandedIds", "setExpandedIds", "useEffect", "visibleTips", "useMemo", "tip", "categoryGroups", "groups", "cat", "hasCategories", "t", "resolvedTheme", "handleToggle", "useCallback", "id", "prev", "wasExpanded", "next", "prevId", "handleNavigate", "normalizedHref", "url", "navigateWithFrameworkRouter", "handleFocusAnchor", "containerStyle", "categoryHeaderStyle", "emptyStateStyle", "renderItems", "items", "index", "category", "react_default", "NavMountableWidget", "container", "navConfig", "createRoot", "root", "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", "adoptStyles", "renderRoot", "styles", "supportsAdoptingStyleSheets", "adoptedStyleSheets", "map", "s", "CSSStyleSheet", "styleSheet", "style", "document", "createElement", "nonce", "global", "setAttribute", "textContent", "cssText", "appendChild", "getCompatibleStyle", "sheet", "rule", "cssRules", "unsafeCSS", "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", "PartType", "ATTRIBUTE", "CHILD", "PROPERTY", "BOOLEAN_ATTRIBUTE", "EVENT", "ELEMENT", "directive", "c", "values", "_$litDirective$", "Directive", "_partInfo", "_$isConnected", "this", "_$parent", "part", "parent", "attributeIndex", "__part", "__attributeIndex", "props", "update", "_part", "render", "important", "importantFlag", "styleMap", "directive", "Directive", "partInfo", "super", "type", "PartType", "ATTRIBUTE", "name", "strings", "length", "Error", "styleInfo", "Object", "keys", "reduce", "style", "prop", "value", "includes", "replace", "toLowerCase", "part", "element", "this", "_previousStyleProperties", "Set", "render", "delete", "removeProperty", "add", "isImportant", "endsWith", "setProperty", "slice", "noChange", "UnsafeHTMLDirective", "Directive", "partInfo", "super", "this", "_value", "nothing", "type", "PartType", "CHILD", "Error", "constructor", "directiveName", "value", "_templateResult", "noChange", "strings", "raw", "_$litType$", "resultType", "values", "unsafeHTML", "directive", "TOKEN_PURPLE_4", "TOKEN_SLATE_GREY_7", "TOKEN_SLATE_GREY_8", "EMOJI_SVG_MAP", "escapeHtml", "str", "renderIcon", "emoji", "resolveNavTarget", "args", "href", "external", "windowOrigin", "customerHost", "absolute", "url", "routeMatchesCurrent", "routes", "current", "route", "routePath", "pulseElement", "el", "keyframes", "resolveTheme", "theme", "_contextUnsub", "_accumulatorUnsub", "_NavWidgetLit_instances", "subscribeRuntime_fn", "unsubscribeRuntime_fn", "getVisibleTips_fn", "getResolvedTheme_fn", "handleToggle_fn", "handleNavigate_fn", "handleFocusAnchor_fn", "publishEvent_fn", "renderTipItem_fn", "NavWidgetLit", "i", "__privateAdd", "__privateMethod", "changed", "visibleTips", "containerStyle", "o", "accordionStyle", "categoryHeaderStyle", "emptyStateStyle", "b", "categoryGroups", "tip", "cat", "hasCategories", "t", "category", "items", "A", "idx", "__privateSet", "_a", "_b", "__privateGet", "id", "wasExpanded", "next", "prevId", "normalized", "target", "navigateWithFrameworkRouter", "anchor", "name", "props", "index", "total", "title", "description", "icon", "_cat", "isExpanded", "isLast", "isHovered", "effectiveHref", "isSamePage", "hasSelector", "isFocusAction", "hasAction", "ctaLabel", "itemStyle", "headerStyle", "chevronStyle", "bodyStyle", "descriptionStyle", "linkButtonStyle", "iconStyle", "onLinkClick", "e", "executeScrollTo", "action", "context", "anchorEl", "navigateWithFrameworkRouter", "url", "w", "nextRouter", "isSameOrigin", "executeNavigate", "target", "executors", "executeScrollTo", "executeNavigate", "runtime", "NavMountableWidget", "props", "manifest", "runtime", "executors", "kind", "executor", "editor_default", "editorPanel", "action", "registry", "cdn_default"]
|
|
7
7
|
}
|