eligius 3.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.mjs","names":["operationMetadata","controllerMetadata","operationMetadata"],"sources":["../src/operation/helper/flow-control-names.ts","../src/operation/helper/assert-safe-property-chain.ts","../src/operation/helper/chain-cache.ts","../src/util/guards/is-plain-object.ts","../src/operation/helper/deep-copy.ts","../src/operation/helper/resolve-external-property-chain.ts","../src/operation/helper/parse-operand.ts","../src/operation/helper/parse-expression.ts","../src/util/guards/is-promise.ts","../src/action/action.ts","../src/action/endable-action.ts","../src/action/timeline-action.ts","../src/configuration/timeline-provider-overrides.ts","../src/operation/helper/flow-control-structure.ts","../src/operation/helper/get-property-chain-value.ts","../src/operation/helper/resolve-property-chain.ts","../src/util/find-closest-names.ts","../src/util/guards/is-function.ts","../src/util/guards/is-object.ts","../src/util/guards/is-string.ts","../src/configuration/configuration-resolver.ts","../src/eventbus/actionregistry-eventbus-listener.ts","../src/eventbus/eventbus.ts","../src/controllers/metadata/dom-event-listener-controller.ts","../src/controllers/metadata/keyboard-controller.ts","../src/controllers/metadata/label-controller.ts","../src/controllers/metadata/lottie-controller.ts","../src/controllers/metadata/mutation-observer-controller.ts","../src/controllers/metadata/navigation-controller.ts","../src/controllers/metadata/progressbar-controller.ts","../src/controllers/metadata/routing-controller.ts","../src/controllers/metadata/subtitles-controller.ts","../src/controllers/metadata/index.ts","../src/operation/metadata/add-class.ts","../src/operation/metadata/add-controller-to-element.ts","../src/operation/metadata/add-globals-to-operation.ts","../src/operation/metadata/animate-with-class.ts","../src/operation/metadata/animate.ts","../src/operation/metadata/announce-to-screen-reader.ts","../src/operation/metadata/break-for-each.ts","../src/operation/metadata/broadcast-event.ts","../src/operation/metadata/calc.ts","../src/operation/metadata/clear-element.ts","../src/operation/metadata/clear-operation-data.ts","../src/operation/metadata/clear-storage.ts","../src/operation/metadata/compare-date.ts","../src/operation/metadata/concatenate-strings.ts","../src/operation/metadata/continue-for-each.ts","../src/operation/metadata/create-element.ts","../src/operation/metadata/custom-function.ts","../src/operation/metadata/end-action.ts","../src/operation/metadata/end-for-each.ts","../src/operation/metadata/end-when.ts","../src/operation/metadata/extend-controller.ts","../src/operation/metadata/filter-array.ts","../src/operation/metadata/find-in-array.ts","../src/operation/metadata/for-each.ts","../src/operation/metadata/format-date.ts","../src/operation/metadata/format-text.ts","../src/operation/metadata/get-attributes-from-element.ts","../src/operation/metadata/get-controller-from-element.ts","../src/operation/metadata/get-controller-instance.ts","../src/operation/metadata/get-current-time.ts","../src/operation/metadata/get-element-dimensions.ts","../src/operation/metadata/get-focused-element.ts","../src/operation/metadata/get-form-data.ts","../src/operation/metadata/get-import.ts","../src/operation/metadata/get-query-params.ts","../src/operation/metadata/get-scroll-position.ts","../src/operation/metadata/get-text-content.ts","../src/operation/metadata/http-delete.ts","../src/operation/metadata/http-post.ts","../src/operation/metadata/http-put.ts","../src/operation/metadata/invoke-object-method.ts","../src/operation/metadata/is-element-in-viewport.ts","../src/operation/metadata/load-from-storage.ts","../src/operation/metadata/load-json.ts","../src/operation/metadata/log.ts","../src/operation/metadata/map-array.ts","../src/operation/metadata/math.ts","../src/operation/metadata/otherwise.ts","../src/operation/metadata/remove-class.ts","../src/operation/metadata/remove-controller-from-element.ts","../src/operation/metadata/remove-element.ts","../src/operation/metadata/remove-properties-from-operation-data.ts","../src/operation/metadata/reparent-element.ts","../src/operation/metadata/replace-string.ts","../src/operation/metadata/replace-text.ts","../src/operation/metadata/request-action.ts","../src/operation/metadata/save-to-storage.ts","../src/operation/metadata/scroll-to-element.ts","../src/operation/metadata/scroll-to-position.ts","../src/operation/metadata/select-element.ts","../src/operation/metadata/set-data.ts","../src/operation/metadata/set-element-attributes.ts","../src/operation/metadata/set-element-content.ts","../src/operation/metadata/set-focus.ts","../src/operation/metadata/set-form-value.ts","../src/operation/metadata/set-global-data.ts","../src/operation/metadata/set-operation-data.ts","../src/operation/metadata/set-style.ts","../src/operation/metadata/set-variable.ts","../src/operation/metadata/sort-array.ts","../src/operation/metadata/split-string.ts","../src/operation/metadata/start-action.ts","../src/operation/metadata/substring-text.ts","../src/operation/metadata/toggle-class.ts","../src/operation/metadata/toggle-element.ts","../src/operation/metadata/toggle-form-element.ts","../src/operation/metadata/validate-form.ts","../src/operation/metadata/wait.ts","../src/operation/metadata/when.ts","../src/operation/metadata/index.ts","../src/lint/built-in-names.ts","../src/lint/lint-importer.ts","../src/lint/operation-lists.ts","../src/lint/operation-metadata.ts","../src/lint/resolving-fields.ts","../src/lint/rules.ts","../src/lint/lint-configuration.ts"],"sourcesContent":["/**\n * System names of the control-flow operations, in one place so that the\n * operations and the flow-control scans can share them without importing\n * each other.\n */\nexport const whenSystemName = 'when';\nexport const otherwiseSystemName = 'otherwise';\nexport const endWhenSystemName = 'endWhen';\nexport const forEachSystemName = 'forEach';\nexport const endForEachSystemName = 'endForEach';\nexport const breakForEachSystemName = 'breakForEach';\nexport const continueForEachSystemName = 'continueForEach';\n","import type {IOperationScope} from '@operation/types.ts';\n\n/**\n * Property chain segments that lead to an object's prototype or constructor.\n * Reading or writing through them allows prototype pollution or reaching the\n * global `Function` constructor, so property chains may never contain them.\n */\nexport const forbiddenPropertyChainSegments: ReadonlySet<string> = new Set([\n '__proto__',\n 'prototype',\n 'constructor',\n]);\n\n/**\n * Returns true when the given segment is one of {@link forbiddenPropertyChainSegments}.\n */\nexport function isForbiddenPropertyChainSegment(segment: string): boolean {\n return forbiddenPropertyChainSegments.has(segment);\n}\n\n/**\n * Throws when any of the given segments is `__proto__`, `prototype` or `constructor`.\n *\n * A segment may carry a `+suffix` (as used by `getPropertyChainValue`); only the part\n * before the `+` is checked.\n *\n * @param segments The property chain segments to check.\n * @param propertyChain The chain as written in the configuration, used in the error message.\n * @param operationName The name of the operation resolving the chain, if known.\n * @throws When a forbidden segment is found. The message names the operation, the chain and the segment.\n */\nexport function assertSafePropertyChain(\n segments: readonly string[],\n propertyChain: string,\n operationName?: string\n): void {\n const forbidden = segments.find(segment =>\n isForbiddenPropertyChainSegment(segment.split('+')[0])\n );\n if (forbidden === undefined) {\n return;\n }\n\n const prefix = operationName\n ? `${operationName}: property chain`\n : 'Property chain';\n throw new Error(\n `${prefix} '${propertyChain}' contains forbidden segment '${forbidden.split('+')[0]}'. Property chains may not contain __proto__, prototype or constructor.`\n );\n}\n\n/**\n * Returns the system name of the operation the given scope is currently executing, if known.\n */\nexport function getCurrentOperationName(\n scope: IOperationScope | undefined\n): string | undefined {\n return scope?.operations?.[scope.currentIndex]?.systemName;\n}\n","import {isForbiddenPropertyChainSegment} from '@operation/helper/assert-safe-property-chain.ts';\n\n/**\n * Property chain parsing, shared by every helper that reads or writes a\n * chain, with a cache for the chains written in configuration.\n *\n * Before, every read of `$operationdata.items[2].label` split the text,\n * lower-cased the prefix, expanded the bracket index with a regular\n * expression, checked every segment for forbidden names and split the last\n * segment on `+`, on every execution. The chain text comes from the\n * configuration, so the parsed form is computed once and reused. Errors keep\n * their exact messages: they are built when they are thrown, from the parsed\n * chain and the name of the operation that is running.\n */\n\n/**\n * A property chain prepared for {@link walkChain}.\n */\nexport interface IParsedSegments {\n /** The segments after bracket expansion: `items[2].label` gives `['items', '2', 'label']` */\n segments: string[];\n /** `segments` joined with dots, as the error messages print the chain */\n chainText: string;\n /** The last segment without its `+suffix` */\n lastProperty: string;\n /** The text after the `+` of the last segment, or null when there is none */\n suffix: string | null;\n /** The first segment as written, before expansion */\n head: string;\n /** The first forbidden segment, with the chain text the error names */\n forbidden: {chainText: string; segment: string} | undefined;\n}\n\nexport type TChainPrefix = 'operationdata' | 'globaldata' | 'scope';\n\n/**\n * A parsed `$operationdata.`, `$globaldata.` or `$scope.` chain.\n */\nexport interface IParsedChain extends IParsedSegments {\n prefix: TChainPrefix;\n}\n\nconst bracketPattern = /\\[(\\d+)\\]/g;\n\n/**\n * Expands bracket indices into their own segments and drops empty segments,\n * so `items[2].label` and `items.2.label` resolve the same way.\n */\nexport function expandSegments(unexpanded: readonly string[]): string[] {\n const segments: string[] = [];\n for (const segment of unexpanded) {\n if (!segment.includes('[') && !segment.includes('.')) {\n if (segment.length > 0) {\n segments.push(segment);\n }\n continue;\n }\n for (const part of segment.replace(bracketPattern, '.$1').split('.')) {\n if (part.length > 0) {\n segments.push(part);\n }\n }\n }\n return segments;\n}\n\n/**\n * Returns the first segment whose name (before a `+suffix`) is forbidden.\n */\nexport function findForbiddenSegment(\n segments: readonly string[]\n): string | undefined {\n for (const segment of segments) {\n const name = segment.split('+')[0];\n if (isForbiddenPropertyChainSegment(name)) {\n return name;\n }\n }\n return undefined;\n}\n\n/**\n * Parses chain segments once.\n *\n * @param unexpanded The segments as written, split on dots\n * @param writtenChain The whole chain as written in the configuration. When\n * given, a forbidden segment found before expansion is reported with this\n * text; one found only after expansion is reported with the expanded chain.\n */\nexport function parseSegments(\n unexpanded: readonly string[],\n writtenChain?: string\n): IParsedSegments {\n let forbidden: IParsedSegments['forbidden'];\n if (writtenChain !== undefined) {\n const segment = findForbiddenSegment(unexpanded);\n if (segment !== undefined) {\n forbidden = {chainText: writtenChain, segment};\n }\n }\n const segments = expandSegments(unexpanded);\n const chainText = segments.join('.');\n if (forbidden === undefined) {\n const segment = findForbiddenSegment(segments);\n if (segment !== undefined) {\n forbidden = {chainText, segment};\n }\n }\n const last = segments.length > 0 ? segments[segments.length - 1] : '';\n const plus = last.indexOf('+');\n return {\n segments,\n chainText,\n lastProperty: plus >= 0 ? last.substring(0, plus) : last,\n suffix: plus >= 0 ? last.substring(plus + 1).split('+')[0] : null,\n head: unexpanded[0] ?? '',\n forbidden,\n };\n}\n\nfunction messagePrefix(operationName: string | undefined): string {\n return operationName ? `${operationName}: property chain` : 'Property chain';\n}\n\n/**\n * Throws when the parsed chain contains a forbidden segment.\n *\n * @throws Error naming the operation, the chain and the segment\n */\nexport function assertParsedChainSafe(\n parsed: IParsedSegments,\n operationName?: string\n): void {\n if (parsed.forbidden === undefined) {\n return;\n }\n throw new Error(\n `${messagePrefix(operationName)} '${parsed.forbidden.chainText}' contains forbidden segment '${parsed.forbidden.segment}'. Property chains may not contain __proto__, prototype or constructor.`\n );\n}\n\nfunction globalObjectError(\n operationName: string | undefined,\n parsed: IParsedSegments,\n index: number\n): Error {\n return new Error(\n `${messagePrefix(operationName)} '${parsed.chainText}' reaches the global object at '${parsed.segments\n .slice(0, index)\n .join('.')}'. Property chains may not access the global object.`\n );\n}\n\n/**\n * Returns true for the global object (`window`), including the window of another frame.\n */\nexport function isGlobalObject(value: unknown): boolean {\n return (\n value === globalThis ||\n (typeof value === 'object' &&\n value !== null &&\n Object.prototype.toString.call(value) === '[object Window]')\n );\n}\n\n/**\n * Reads a parsed chain from `sourceObject`.\n *\n * An empty chain returns `sourceObject`. Only null and undefined cannot be\n * indexed; `''`, `0` and `false` are valid intermediates. A `+suffix` on the\n * last segment is appended to the value; an empty suffix returns the value\n * as it is.\n *\n * @throws When an intermediate value is null or undefined (the message names\n * the part of the chain that did resolve), or when the chain passes through\n * or ends at the global object\n */\nexport function walkChain(\n parsed: IParsedSegments,\n sourceObject: Record<string, any>,\n operationName?: string\n): unknown {\n const {segments} = parsed;\n const count = segments.length;\n let current: any = sourceObject;\n for (let index = 0; index < count; index++) {\n if (current === null || current === undefined) {\n throw new Error(\n `${messagePrefix(operationName)} '${parsed.chainText}' cannot be resolved: '${segments\n .slice(0, index)\n .join('.')}' is ${current}.`\n );\n }\n if (index > 0 && isGlobalObject(current)) {\n throw globalObjectError(operationName, parsed, index);\n }\n current =\n current[index === count - 1 ? parsed.lastProperty : segments[index]];\n }\n if (count > 0 && isGlobalObject(current)) {\n throw globalObjectError(operationName, parsed, count);\n }\n return parsed.suffix ? `${current}${parsed.suffix}` : current;\n}\n\nconst prefixes: Record<string, TChainPrefix | undefined> = {\n '$operationdata.': 'operationdata',\n '$globaldata.': 'globaldata',\n '$scope.': 'scope',\n};\n\n/**\n * Returns the kind of external chain `value` is, or undefined when it is not\n * one. The prefix is matched without regard to case, like before.\n */\nexport function externalPrefixOf(value: string): TChainPrefix | undefined {\n if (value.charCodeAt(0) !== 36 /* $ */) {\n return undefined;\n }\n const dot = value.indexOf('.');\n if (dot < 0) {\n return undefined;\n }\n return prefixes[value.substring(0, dot + 1).toLocaleLowerCase()];\n}\n\n/**\n * The cache is cleared when it grows past this size, so chains built at\n * runtime cannot leak memory.\n */\nconst MAX_CACHED_CHAINS = 2000;\nconst parsedChains = new Map<string, IParsedChain>();\n\n/**\n * Returns the parsed form of an external property chain, parsing it on the\n * first use, or null when `value` is not an external chain.\n */\nexport function getParsedChain(value: string): IParsedChain | null {\n const cached = parsedChains.get(value);\n if (cached !== undefined) {\n return cached;\n }\n const prefix = externalPrefixOf(value);\n if (prefix === undefined) {\n return null;\n }\n const unexpanded = value.split('.');\n unexpanded.shift();\n const parsed: IParsedChain = {...parseSegments(unexpanded, value), prefix};\n if (parsedChains.size >= MAX_CACHED_CHAINS) {\n parsedChains.clear();\n }\n parsedChains.set(value, parsed);\n return parsed;\n}\n\n/**\n * Empties the chain cache. `EngineFactory` calls this when the last engine\n * is destroyed.\n */\nexport function clearChainCache(): void {\n parsedChains.clear();\n}\n","const functionToString = Function.prototype.toString;\n/** Source text of `Object`, the same in every realm */\nconst objectConstructorSource = functionToString.call(Object);\n\n/**\n * Returns true for plain data objects: object literals, parsed JSON objects\n * and `Object.create(null)` objects, also when they were created in another\n * realm (an iframe, a worker, the realm `fetch` parses JSON in). Returns false\n * for arrays, class instances, `Date`, `Map`, DOM nodes, jQuery objects and\n * objects that inherit from another object.\n *\n * @param value - Any value\n * @returns Whether `value` is a plain data object\n */\nexport function isPlainObject(\n value: unknown\n): value is Record<PropertyKey, unknown> {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype === null || prototype === Object.prototype) {\n return true;\n }\n // Another realm's Object.prototype: no prototype of its own, and its own\n // constructor is that realm's Object.\n if (Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n const objectConstructor = Object.hasOwn(prototype, 'constructor')\n ? prototype.constructor\n : undefined;\n return (\n typeof objectConstructor === 'function' &&\n functionToString.call(objectConstructor) === objectConstructorSource\n );\n}\n","import {isPlainObject} from '@util/guards/is-plain-object.ts';\n\nexport {isPlainObject};\n\nconst copyFunction =\n typeof structuredClone !== 'undefined'\n ? structuredClone\n : <T>(original: any) => JSON.parse(JSON.stringify(original)) as T;\n\n/**\n * Deep-copies plain data: arrays and plain objects are copied recursively (cycles are preserved),\n * Date, RegExp, Map, Set, Error, ArrayBuffer and typed arrays are cloned, and everything else\n * (functions, jQuery objects, DOM nodes, class instances) is kept by reference.\n *\n * An own `__proto__` key (as `JSON.parse` creates) stays an own data property of the copy.\n *\n * This runs for every execution of every operation with nested configured data, so it avoids\n * work on the common shapes: the cycle map is only created once a nested object or array\n * appears, and plain keys are assigned instead of defined.\n *\n * @param original The value to copy\n * @returns The copy, or the value itself when it is not copied\n */\nexport function deepCopy<T>(original: T): T {\n if (\n original === null ||\n typeof original !== 'object' ||\n isReferenceOnly(original)\n ) {\n return original;\n }\n return copyObject(original, {seen: null}) as T;\n}\n\ninterface ICopyContext {\n /**\n * Copies made so far, so that a cycle or a shared reference maps to one\n * copy. Created on the first nested object, because most configured data\n * is flat and never needs it.\n */\n seen: WeakMap<object, unknown> | null;\n}\n\n/**\n * Copies a child value of `parentValue`, whose copy is `parentCopy`.\n */\nfunction copyChild(\n child: unknown,\n parentValue: object,\n parentCopy: unknown,\n context: ICopyContext\n): unknown {\n // Primitives, functions, jQuery objects, DOM nodes: as-is.\n if (child === null || typeof child !== 'object' || isReferenceOnly(child)) {\n return child;\n }\n if (context.seen === null) {\n context.seen = new WeakMap();\n context.seen.set(parentValue, parentCopy);\n }\n return copyObject(child, context);\n}\n\n/**\n * Copies an object that is not reference-only.\n */\nfunction copyObject(value: object, context: ICopyContext): unknown {\n const {seen} = context;\n // Copies are always objects, so undefined means \"not seen\".\n const prior = seen?.get(value);\n if (prior !== undefined) {\n return prior;\n }\n\n if (Array.isArray(value)) {\n const copy: unknown[] = new Array(value.length);\n if (seen !== null) {\n seen.set(value, copy);\n }\n // forEach skips holes, so a sparse array stays sparse.\n value.forEach((item, index) => {\n copy[index] = copyChild(item, value, copy, context);\n });\n return copy;\n }\n\n if (isPlainObject(value)) {\n const copy: Record<string, unknown> = {};\n if (seen !== null) {\n seen.set(value, copy);\n }\n for (const key of Object.keys(value)) {\n const copied = copyChild(\n (value as Record<string, unknown>)[key],\n value,\n copy,\n context\n );\n if (key === '__proto__') {\n // defineProperty, so an own '__proto__' key (e.g. from JSON.parse) stays\n // a data property instead of replacing the copy's prototype.\n Object.defineProperty(copy, key, {\n value: copied,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n } else {\n copy[key] = copied;\n }\n }\n return copy;\n }\n\n if (!isStructuredCloneable(value)) {\n return value;\n }\n\n const copy = copyFunction(value);\n if (seen !== null) {\n seen.set(value, copy);\n }\n return copy;\n}\n\nfunction isReferenceOnly(value: object) {\n return (\n typeof (value as {jquery?: unknown}).jquery === 'string' ||\n (typeof Node !== 'undefined' && value instanceof Node)\n );\n}\n\nfunction isStructuredCloneable(value: object) {\n // Tags instead of instanceof, so values from another realm are recognised.\n return (\n cloneableTags.has(Object.prototype.toString.call(value)) ||\n ArrayBuffer.isView(value)\n );\n}\n\nconst cloneableTags = new Set([\n '[object Date]',\n '[object RegExp]',\n '[object Map]',\n '[object Set]',\n '[object Error]',\n '[object ArrayBuffer]',\n]);\n","import {getCurrentOperationName} from '@operation/helper/assert-safe-property-chain.ts';\nimport {\n assertParsedChainSafe,\n externalPrefixOf,\n getParsedChain,\n walkChain,\n} from '@operation/helper/chain-cache.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {getGlobals} from '@operation/helper/globals.ts';\nimport type {IOperationScope, TOperationData} from '@operation/types.ts';\n\n/**\n * Resolves operation and global data property chains.\n *\n * An operation data property chain is designated by a `operationdata.` suffix, followed by an arbitrary property chain.\n * For global data the suffix should be `globaldata.`\n *\n * If the propertyChainOrRegularObject is not a property chain, this value is returned instead.\n *\n * A `$globaldata` chain returns a deep copy of the global value (jQuery objects, DOM nodes,\n * functions and class instances stay references), the same as `getGlobals(name)`, so changing\n * the returned value in place never changes the shared global store. Write to the store with\n * `setGlobalData` or `setData` instead.\n *\n * The chain text is parsed once and cached (see `chain-cache.ts`); the value is read on every\n * call.\n */\nexport function resolveExternalPropertyChain(\n sourceObject: TOperationData,\n operationScope: IOperationScope,\n propertyChainOrRegularObject:\n | ExternalProperty\n | Record<string, any>\n | null\n | undefined\n) {\n if (\n propertyChainOrRegularObject === null ||\n propertyChainOrRegularObject === undefined\n ) {\n return null;\n }\n\n if (typeof propertyChainOrRegularObject !== 'string') {\n return propertyChainOrRegularObject;\n }\n\n const parsed = getParsedChain(propertyChainOrRegularObject);\n if (parsed === null) {\n return propertyChainOrRegularObject;\n }\n\n const operationName = getCurrentOperationName(operationScope);\n assertParsedChainSafe(parsed, operationName);\n switch (parsed.prefix) {\n case 'operationdata':\n return walkChain(parsed, sourceObject, operationName);\n case 'globaldata':\n return deepCopy(walkChain(parsed, getGlobals(), operationName));\n case 'scope':\n return walkChain(\n parsed,\n findDeclaringScope(parsed.head, operationScope) ?? operationScope,\n operationName\n );\n }\n}\n\n/**\n * Resolves a `$scope` property chain, walking up the parent scope chain.\n *\n * `forEach` and `when` execute in a child scope created by `Action._pushScope`,\n * which proxies only a few fields from its parent. A variable set with\n * `setVariable` lives on the scope that declares `variables` (the action's root\n * scope), not on the child scope an operation inside a loop or conditional runs\n * in.\n *\n * The chain is resolved against the nearest scope (the current one or an\n * ancestor) that declares the chain's head property, see\n * {@link findDeclaringScope}. `setVariable` and `setData` pick their write\n * target with the same rule, so reads and writes of `$scope.variables.*` always\n * meet on the same scope object.\n *\n * @param head The first segment of the chain as written, for example `variables`\n * @param scope The scope the operation runs in\n * @returns The nearest scope that has `head` as an own or inherited property, or undefined\n */\nexport function findDeclaringScope(\n head: string,\n scope: IOperationScope\n): IOperationScope | undefined {\n let current: IOperationScope | undefined = scope;\n while (current) {\n if (head in current) {\n return current;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/**\n * Returns the outermost scope of the given scope's parent chain: the\n * action's root scope.\n */\nexport function findRootScope(scope: IOperationScope): IOperationScope {\n let current = scope;\n while (current.parent) {\n current = current.parent;\n }\n return current;\n}\n\n/**\n * Returns true when the value is a `$operationdata.`, `$globaldata.` or\n * `$scope.` property chain. The prefix is matched without regard to case.\n */\nexport function isExternalProperty(\n value: ExternalProperty | Record<string, any>\n): value is ExternalProperty {\n return typeof value === 'string' && externalPrefixOf(value) !== undefined;\n}\n\nexport type ExternalProperty =\n | `$operationdata.${string}`\n | `$globaldata.${string}`\n | `$scope.${string}`;\n","import {\n type ExternalProperty,\n isExternalProperty,\n resolveExternalPropertyChain,\n} from '@operation/helper/resolve-external-property-chain.ts';\nimport type {IOperationScope, TOperationData} from '@operation/types.ts';\n\n/**\n * A parsed expression operand: either a literal value or a property chain that is\n * resolved when the expression is evaluated.\n */\nexport type TOperand =\n | {kind: 'literal'; value: string | number | boolean | null}\n | {kind: 'chain'; chain: ExternalProperty};\n\nconst numberPattern = /^[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?$/;\nconst quotedPattern = /^'(.*)'$/s;\n// After the prefix: one or more segments separated by single dots, without\n// whitespace or quotes. Segments may use bracket indices and a '+suffix'.\nconst chainPattern =\n /^\\$(operationdata|globaldata|scope)\\.[^\\s.'\"]+(\\.[^\\s.'\"]+)*$/i;\n\nconst keywords: Record<string, boolean | null> = {\n true: true,\n false: false,\n null: null,\n};\n\n/**\n * Parses one operand of a condition expression. The tokenizer in `parse-expression.ts`\n * calls it for every operand it finds, so this function is the single definition of the\n * operand grammar.\n *\n * The operand grammar:\n * - a number: `100`, `-1.5`, `2e3` (the whole token must be numeric, so `10px` is invalid);\n * - a string in single quotes: `'John'`;\n * - the keywords `true`, `false` and `null`;\n * - a property chain starting with `$operationdata.`, `$globaldata.` or `$scope.` (the prefix\n * is case-insensitive), for example `$scope.variables.count`.\n *\n * @param token The operand text, already trimmed.\n * @param operationName The operation parsing the expression, named in the error.\n * @param expression The whole expression, quoted in the error.\n * @param position The 0-based position of the operand in the expression, named in the error\n * when given.\n * @returns The parsed operand.\n * @throws When the token matches none of the forms above.\n */\nexport function parseOperand(\n token: string,\n operationName: string,\n expression: string,\n position?: number\n): TOperand {\n const quoted = quotedPattern.exec(token);\n if (quoted) {\n return {kind: 'literal', value: quoted[1]};\n }\n if (Object.hasOwn(keywords, token)) {\n return {kind: 'literal', value: keywords[token]};\n }\n if (numberPattern.test(token)) {\n return {kind: 'literal', value: Number(token)};\n }\n if (\n isExternalProperty(token as ExternalProperty) &&\n chainPattern.test(token)\n ) {\n return {kind: 'chain', chain: token as ExternalProperty};\n }\n throw new Error(\n `${operationName}: unknown operand '${token}' in expression '${expression}'${position === undefined ? '' : ` at position ${position}`}. Use a number, a quoted string ('text'), true, false, null, or a property chain starting with $operationdata., $globaldata. or $scope.`\n );\n}\n\n/**\n * Returns the value of a parsed operand, resolving a property chain against the given\n * operation data and scope.\n *\n * @param operand The operand returned by {@link parseOperand}.\n * @param operationData The operation data `$operationdata` chains are resolved against.\n * @param scope The scope `$scope` chains are resolved against.\n * @returns The operand's value.\n */\nexport function resolveOperand(\n operand: TOperand,\n operationData: TOperationData,\n scope: IOperationScope\n): unknown {\n return operand.kind === 'literal'\n ? operand.value\n : resolveExternalPropertyChain(operationData, scope, operand.chain);\n}\n","import {\n parseOperand,\n resolveOperand,\n type TOperand,\n} from '@operation/helper/parse-operand.ts';\nimport type {IOperationScope, TOperationData} from '@operation/types.ts';\n\n/**\n * The comparison operators a condition expression supports.\n */\nexport type TComparisonOperator = '==' | '!=' | '>=' | '<=' | '>' | '<';\n\n/**\n * A node of a parsed condition expression, see {@link parseExpression}.\n */\nexport type TExpressionNode =\n | {kind: 'operand'; operand: TOperand}\n | {kind: 'not'; operand: TExpressionNode}\n | {kind: 'and' | 'or'; left: TExpressionNode; right: TExpressionNode}\n | {\n kind: 'comparison';\n operator: TComparisonOperator;\n left: TExpressionNode;\n right: TExpressionNode;\n };\n\ntype TSymbol = TComparisonOperator | '&&' | '||' | '!' | '(' | ')';\n\ntype TToken =\n | {type: 'symbol'; text: TSymbol; position: number}\n | {type: 'operand'; text: string; position: number; operand: TOperand};\n\n// Longest first, so '!=' is not read as '!' followed by '=', and '>=' not as '>' and '='.\nconst symbols: readonly TSymbol[] = [\n '&&',\n '||',\n '==',\n '!=',\n '>=',\n '<=',\n '>',\n '<',\n '!',\n '(',\n ')',\n];\n\nconst comparisonOperators: ReadonlySet<string> = new Set<TComparisonOperator>([\n '==',\n '!=',\n '>=',\n '<=',\n '>',\n '<',\n]);\n\n// Characters that end an unquoted operand.\nconst delimiterPattern = /[\\s()!=<>&|]/;\n\nfunction isDelimiter(char: string | undefined): boolean {\n return char === undefined || delimiterPattern.test(char);\n}\n\n/**\n * Parses a condition expression into a tree that {@link evaluateExpression} evaluates.\n *\n * The grammar, from lowest to highest precedence:\n *\n * ```\n * or := and ('||' and)*\n * and := comparison ('&&' comparison)*\n * comparison := unary (('==' | '!=' | '>=' | '<=' | '>' | '<') unary)?\n * unary := '!' unary | primary\n * primary := '(' or ')' | operand\n * ```\n *\n * Operands are parsed by {@link parseOperand}: numbers, single-quoted strings, `true`,\n * `false`, `null` and `$operationdata.`, `$globaldata.` or `$scope.` property chains.\n * Inside a quoted string, operators and parentheses are part of the text. A quote ends the\n * string only when it is followed by whitespace, an operator, a parenthesis or the end of the\n * expression, so an apostrophe inside the text (`'it's'`) needs no escaping.\n *\n * Comparisons do not chain (`1<x<3` is an error, write `1<x && x<3`). Arithmetic is not\n * supported. Nothing in the expression is executed as code.\n *\n * @param expression The expression text.\n * @param operationName The operation parsing the expression, named in the error messages.\n * @returns The root node of the parsed expression.\n * @throws When the expression is not a string or is empty, contains an unknown operand, an\n * unterminated string, an unknown or misplaced operator, or unbalanced parentheses. The message\n * names the operation, the problem, its position (0-based) and the expression.\n *\n * @example\n * parseExpression(\"$scope.variables.score>=5 && !$operationdata.skipped\", 'when');\n */\nexport function parseExpression(\n expression: string,\n operationName: string\n): TExpressionNode {\n if (typeof expression !== 'string') {\n throw new Error(\n `${operationName}: expression must be a string, received ${expression === null ? 'null' : typeof expression}.`\n );\n }\n\n const tokens = tokenize(expression, operationName);\n if (!tokens.length) {\n throw new Error(`${operationName}: empty expression '${expression}'.`);\n }\n\n let index = 0;\n\n const fail = (message: string, position: number, hint?: string): never => {\n throw new Error(\n `${operationName}: ${message} at position ${position} in expression '${expression}'.${hint ? ` ${hint}` : ''}`\n );\n };\n\n const unexpected = (token: TToken | undefined, hint?: string): never =>\n token\n ? fail(`unexpected '${token.text}'`, token.position, hint)\n : fail('unexpected end of expression', expression.length, hint);\n\n const peekSymbol = (): TSymbol | undefined => {\n const token = tokens[index];\n return token?.type === 'symbol' ? token.text : undefined;\n };\n\n const parseOr = (): TExpressionNode => {\n let left = parseAnd();\n while (peekSymbol() === '||') {\n index++;\n left = {kind: 'or', left, right: parseAnd()};\n }\n return left;\n };\n\n const parseAnd = (): TExpressionNode => {\n let left = parseComparison();\n while (peekSymbol() === '&&') {\n index++;\n left = {kind: 'and', left, right: parseComparison()};\n }\n return left;\n };\n\n const parseComparison = (): TExpressionNode => {\n const left = parseUnary();\n const operator = peekSymbol();\n if (operator && comparisonOperators.has(operator)) {\n index++;\n return {\n kind: 'comparison',\n operator: operator as TComparisonOperator,\n left,\n right: parseUnary(),\n };\n }\n return left;\n };\n\n const parseUnary = (): TExpressionNode => {\n if (peekSymbol() === '!') {\n index++;\n return {kind: 'not', operand: parseUnary()};\n }\n return parsePrimary();\n };\n\n const parsePrimary = (): TExpressionNode => {\n const token = tokens[index];\n if (token?.type === 'operand') {\n index++;\n return {kind: 'operand', operand: token.operand};\n }\n if (token?.text === '(') {\n index++;\n const node = parseOr();\n const closing = tokens[index];\n if (!closing) {\n return fail(\"missing ')' for the '('\", token.position);\n }\n if (closing.text !== ')') {\n return unexpected(closing, \"Expected ')' or an operator.\");\n }\n index++;\n return node;\n }\n return unexpected(token);\n };\n\n const root = parseOr();\n if (index < tokens.length) {\n const token = tokens[index];\n const hint =\n token.text === ')'\n ? \"It has no matching '('.\"\n : token.type === 'symbol' && comparisonOperators.has(token.text)\n ? 'Comparisons do not chain, combine them with && or use parentheses.'\n : 'Expected && or || between the parts of the condition.';\n unexpected(token, hint);\n }\n return root;\n}\n\n/**\n * Splits the expression into symbols and operands. Operands are parsed with\n * {@link parseOperand}, so the operand grammar has one source.\n */\nfunction tokenize(expression: string, operationName: string): TToken[] {\n const tokens: TToken[] = [];\n let i = 0;\n while (i < expression.length) {\n const char = expression[i];\n\n if (/\\s/.test(char)) {\n i++;\n continue;\n }\n\n const symbol = symbols.find(s => expression.startsWith(s, i));\n if (symbol) {\n tokens.push({type: 'symbol', text: symbol, position: i});\n i += symbol.length;\n continue;\n }\n\n if (char === '=' || char === '&' || char === '|') {\n throw new Error(\n `${operationName}: unexpected '${char}' at position ${i} in expression '${expression}'. Did you mean '${char}${char}'?`\n );\n }\n\n const end =\n char === \"'\" ? endOfString(expression, i) : endOfWord(expression, i);\n if (end < 0) {\n throw new Error(\n `${operationName}: unterminated string at position ${i} in expression '${expression}'.`\n );\n }\n\n const text = expression.substring(i, end);\n tokens.push({\n type: 'operand',\n text,\n position: i,\n operand: parseOperand(text, operationName, expression, i),\n });\n i = end;\n }\n return tokens;\n}\n\n/**\n * Returns the index after the quote that closes the string starting at `start`, or -1 when the\n * string is not closed. A quote closes the string only when a delimiter or the end follows it.\n */\nfunction endOfString(expression: string, start: number): number {\n for (let i = start + 1; i < expression.length; i++) {\n if (expression[i] === \"'\" && isDelimiter(expression[i + 1])) {\n return i + 1;\n }\n }\n return -1;\n}\n\nfunction endOfWord(expression: string, start: number): number {\n let i = start;\n while (i < expression.length && !isDelimiter(expression[i])) {\n i++;\n }\n return i;\n}\n\n/**\n * Evaluates a parsed condition expression.\n *\n * `&&` and `||` short-circuit: the right side is not resolved when the left side already\n * decides the result, so a property chain on the right that cannot be resolved is not read.\n * `&&`, `||` and `!` work on truthiness and produce `true` or `false`. A bare operand is\n * tested for truthiness. Comparisons work as before: `==` and `!=` compare strictly,\n * `<`, `<=`, `>` and `>=` use JavaScript ordering.\n *\n * @param node The expression returned by {@link parseExpression}.\n * @param operationData The operation data `$operationdata` chains are resolved against.\n * @param scope The scope `$scope` chains are resolved against.\n * @returns Whether the expression is true.\n * @throws When a property chain that is evaluated cannot be resolved or is not allowed.\n */\nexport function evaluateExpression(\n node: TExpressionNode,\n operationData: TOperationData,\n scope: IOperationScope\n): boolean {\n return Boolean(evaluateNode(node, operationData, scope));\n}\n\nfunction evaluateNode(\n node: TExpressionNode,\n operationData: TOperationData,\n scope: IOperationScope\n): unknown {\n switch (node.kind) {\n case 'operand':\n return resolveOperand(node.operand, operationData, scope);\n case 'not':\n return !evaluateNode(node.operand, operationData, scope);\n case 'and':\n return (\n Boolean(evaluateNode(node.left, operationData, scope)) &&\n Boolean(evaluateNode(node.right, operationData, scope))\n );\n case 'or':\n return (\n Boolean(evaluateNode(node.left, operationData, scope)) ||\n Boolean(evaluateNode(node.right, operationData, scope))\n );\n case 'comparison':\n return comparisons[node.operator](\n evaluateNode(node.left, operationData, scope),\n evaluateNode(node.right, operationData, scope)\n );\n }\n}\n\nconst comparisons: Record<\n TComparisonOperator,\n (left: any, right: any) => boolean\n> = {\n '==': (left, right) => left === right,\n '!=': (left, right) => left !== right,\n '>=': (left, right) => left >= right,\n '<=': (left, right) => left <= right,\n '>': (left, right) => left > right,\n '<': (left, right) => left < right,\n};\n","/**\n * Returns true for promises and other thenables.\n *\n * @param obj - Any value\n * @returns Whether `obj` is an object with a `then` method\n */\nexport function isPromise(obj: any): obj is Promise<unknown> {\n return (\n typeof obj === 'object' && obj !== null && typeof obj.then === 'function'\n );\n}\n","import type {IAction} from '@action/types.ts';\nimport type {IResolvedOperation} from '@configuration/types.ts';\nimport type {IEventbus} from '@eventbus/types.ts';\nimport {endForEachSystemName, forEachSystemName} from '@operation/for-each.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport type {IOperationScope, TOperationData} from '@operation/types.ts';\nimport {endWhenSystemName, whenSystemName} from '@operation/when.ts';\nimport {isPlainObject} from '@util/guards/is-plain-object.ts';\nimport {isPromise} from '@util/guards/is-promise.ts';\n\nexport class Action implements IAction {\n public id = '';\n /**\n * Scope stack used by {@link executeOperation} when it is called without an\n * explicit stack. `start()` and `end()` each create their own stack, so\n * overlapping executions of the same action never share scopes.\n *\n * @deprecated Calling {@link executeOperation} without a scope stack is\n * deprecated; this fallback will be removed in the next major version.\n */\n protected _scopeStack: IOperationScope[] = [];\n /**\n * The configured `forEach` operation data copied when a loop starts, keyed\n * by the loop's scope. Later iterations of the same loop merge this copy\n * again instead of deep-copying the collection on every iteration.\n */\n private _loopOperationData = new WeakMap<IOperationScope, TOperationData>();\n\n constructor(\n public name: string,\n public startOperations: IResolvedOperation[],\n protected eventbus: IEventbus\n ) {}\n\n /**\n * Runs the start operations.\n *\n * A failure is not logged here: the returned promise rejects with the\n * error (annotated with the failing operation), and the caller reports it.\n * The engine reports it through its `error` event, the eventbus through\n * its `onHandlerError` option, and `init()` by rejecting.\n *\n * @param initOperationData - Operation data the first start operation receives\n * @returns The operation data of the last start operation\n */\n start(initOperationData?: TOperationData): Promise<TOperationData> {\n return this._runOperations(this.startOperations, initOperationData);\n }\n\n /**\n * Runs the given operations with a scope stack that belongs to this\n * execution only.\n *\n * @param operations - The operations to run\n * @param initOperationData - Operation data the first operation receives\n * @param onSettled - Called the moment the operations have completed or\n * failed, before the returned promise settles. Operations that complete\n * synchronously call it synchronously.\n * @returns The operation data of the last operation\n */\n protected _runOperations(\n operations: IResolvedOperation[],\n initOperationData?: TOperationData,\n onSettled?: () => void\n ): Promise<TOperationData> {\n const scopeStack = this._createScopeStack(operations);\n\n return new Promise<TOperationData>((resolve, reject) => {\n this.executeOperation(\n operations,\n 0,\n onSettled\n ? value => {\n onSettled();\n resolve(value);\n }\n : resolve,\n onSettled\n ? reason => {\n onSettled();\n reject(reason);\n }\n : reject,\n initOperationData,\n scopeStack\n );\n });\n }\n\n protected _createScopeStack(\n operations: IResolvedOperation[]\n ): IOperationScope[] {\n return [\n {\n currentIndex: -1,\n eventbus: this.eventbus,\n operations,\n },\n ];\n }\n\n /**\n * @deprecated Unused: `start()` and `end()` create a scope stack for each\n * execution. Will be removed in the next major version.\n */\n protected _initializeScopeStack() {\n this._scopeStack = this._createScopeStack(this.startOperations);\n }\n\n private _pushScope(\n scopeStack: IOperationScope[],\n parentScope: IOperationScope\n ): IOperationScope {\n const newScope = {\n get currentIndex() {\n return parentScope.currentIndex;\n },\n set currentIndex(value: number) {\n parentScope.currentIndex = value;\n },\n get eventbus() {\n return parentScope.eventbus;\n },\n get operations() {\n return parentScope.operations;\n },\n parent: parentScope,\n };\n scopeStack.push(newScope);\n return newScope;\n }\n\n /**\n * Executes `operations` starting at `operationIndex`.\n *\n * Synchronous operations run in a loop, so the stack depth does not grow with\n * the number of executed operations (large `forEach` loops are safe). When an\n * operation returns a promise, execution continues once it resolves.\n */\n executeOperation(\n operations: IResolvedOperation[],\n operationIndex: number,\n resolve: (value?: any | PromiseLike<any>) => void,\n reject: (reason?: any) => void,\n previousOperationData: TOperationData | undefined = {},\n scopeStack: IOperationScope[] = this._scopeStack\n ): void {\n let index = operationIndex;\n let operationData: TOperationData = previousOperationData ?? {};\n // The operation being executed, used to annotate errors\n let failingOperation: IResolvedOperation | undefined;\n let failingIndex = operationIndex;\n\n try {\n while (true) {\n let scope = scopeStack[scopeStack.length - 1];\n if (scope.newIndex !== undefined) {\n index = scope.newIndex;\n delete scope.newIndex;\n }\n\n scope.currentIndex = index;\n\n if (index >= operations.length) {\n resolve(operationData);\n return;\n }\n\n const operationInfo = operations[index];\n failingOperation = operationInfo;\n failingIndex = index;\n const isLoopIteration =\n operationInfo.systemName === forEachSystemName &&\n scope.owner === operationInfo;\n const configuredData =\n (isLoopIteration ? this._loopOperationData.get(scope) : undefined) ??\n copyConfiguredOperationData(\n operationInfo.operationData,\n operationInfo.systemName\n );\n const mergedOperationData = Object.assign(\n operationData,\n configuredData\n );\n\n if (operationInfo.systemName === whenSystemName) {\n scope = this._pushScope(scopeStack, scope);\n } else if (\n operationInfo.systemName === forEachSystemName &&\n !isLoopIteration\n ) {\n scope = this._pushScope(scopeStack, scope);\n scope.owner = operationInfo;\n this._loopOperationData.set(scope, configuredData);\n }\n\n const operationResult = operationInfo.instance.call(\n scope,\n mergedOperationData\n );\n\n if (\n operationInfo.systemName === endWhenSystemName ||\n (operationInfo.systemName === endForEachSystemName &&\n scope.newIndex === undefined)\n ) {\n scopeStack.pop();\n }\n\n index++;\n\n if (isPromise(operationResult)) {\n const nextIndex = index;\n const asyncOperation = operationInfo;\n const asyncIndex = index - 1;\n // The rejection handler annotates only this operation's own failure;\n // later operations are annotated by the executeOperation call that\n // runs them.\n operationResult\n .then(\n promisedOperationResult =>\n this.executeOperation(\n operations,\n nextIndex,\n resolve,\n reject,\n promisedOperationResult as TOperationData,\n scopeStack\n ),\n (error: unknown) =>\n reject(withOperationContext(error, asyncOperation, asyncIndex))\n )\n .catch(reject);\n return;\n }\n\n operationData = (operationResult as TOperationData | undefined) ?? {};\n }\n } catch (error) {\n reject(\n failingOperation\n ? withOperationContext(error, failingOperation, failingIndex)\n : error\n );\n }\n }\n}\n\n/**\n * An error that carries the operation it came from.\n *\n * `EligiusEngine` reads these properties to name the failing operation in its\n * `error` event.\n */\nexport interface IOperationErrorContext {\n operationSystemName?: string;\n operationIndex?: number;\n}\n\n/**\n * Adds the failing operation's system name and index to an error, unless an\n * inner action already did (the innermost operation is the most specific).\n * Non-Error values are wrapped in an Error that keeps their message.\n */\nfunction withOperationContext(\n error: unknown,\n operation: IResolvedOperation,\n index: number\n): Error & IOperationErrorContext {\n const annotated: Error & IOperationErrorContext =\n error instanceof Error ? error : new Error(String(error), {cause: error});\n if (annotated.operationSystemName === undefined) {\n annotated.operationSystemName = operation.systemName;\n annotated.operationIndex = index;\n }\n return annotated;\n}\n\nconst emptyOperationData: Readonly<TOperationData> = Object.freeze({});\n\n/**\n * Configured operation data already checked by {@link assertNoProtoKeys}.\n * Configured data is not changed after resolution, so each object is walked\n * once, not on every run of its operation.\n */\nconst checkedOperationData = new WeakSet<object>();\n\n/**\n * Throws when an own `__proto__` key occurs anywhere in the configured\n * operation data (JSON.parse creates one as a normal property). Merging with\n * Object.assign would run the `__proto__` setter at the top level, and\n * operations that assign or merge nested data could do the same below it.\n * Arrays and plain objects are walked; class instances, jQuery objects and\n * DOM nodes are not.\n *\n * @throws Error naming the operation and the path of the key\n */\nfunction assertNoProtoKeys(operationData: TOperationData, systemName: string) {\n if (checkedOperationData.has(operationData)) {\n return;\n }\n const visiting = new Set<object>();\n const walk = (value: unknown, path: string) => {\n if (value === null || typeof value !== 'object' || visiting.has(value)) {\n return;\n }\n if (Array.isArray(value)) {\n visiting.add(value);\n value.forEach((item, index) => {\n walk(item, `${path}[${index}]`);\n });\n return;\n }\n if (!isPlainObject(value)) {\n return;\n }\n visiting.add(value);\n if (Object.hasOwn(value, '__proto__')) {\n const at = path ? `${path}.__proto__` : '__proto__';\n throw new Error(\n `${systemName}: operation data must not contain a '__proto__' key (found at '${at}')`\n );\n }\n for (const key of Object.keys(value)) {\n walk(value[key], path ? `${path}.${key}` : key);\n }\n };\n walk(operationData, '');\n checkedOperationData.add(operationData);\n}\n\n/**\n * Returns the configured operation data in a form that is safe to merge into\n * the running operation data.\n *\n * Merging copies the top-level properties, so operations that delete or\n * reassign properties (such as `@erased` ones) never touch the configured\n * object. Only nested objects and arrays can be mutated through the merged\n * data, so a deep copy is made only when the configured data contains one.\n * Empty data and data holding only primitives and functions is returned as-is.\n *\n * @throws Error when the data contains a `__proto__` key at any depth\n */\nfunction copyConfiguredOperationData(\n operationData: TOperationData | undefined,\n systemName: string\n): TOperationData {\n if (!operationData) {\n return emptyOperationData;\n }\n assertNoProtoKeys(operationData, systemName);\n for (const key in operationData) {\n const value = operationData[key];\n if (\n typeof value === 'object' &&\n value !== null &&\n Object.hasOwn(operationData, key)\n ) {\n return deepCopy(operationData);\n }\n }\n return operationData;\n}\n","import {Action} from '@action/action.ts';\nimport type {IResolvedOperation} from '@configuration/types.ts';\nimport type {IEventbus} from '@eventbus/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\n\nexport class EndableAction extends Action {\n constructor(\n name: string,\n startOperations: IResolvedOperation[],\n public endOperations: IResolvedOperation[],\n eventBus: IEventbus\n ) {\n super(name, startOperations, eventBus);\n }\n\n /**\n * Runs the end operations.\n *\n * A failure is not logged here: the returned promise rejects with the\n * error (annotated with the failing operation), and the caller reports it.\n * The engine reports it through its `error` event.\n *\n * @param initOperationData - Operation data the first end operation receives\n * @returns The operation data of the last end operation\n */\n end(initOperationData?: TOperationData): Promise<TOperationData> {\n if (!this.endOperations.length) {\n return Promise.resolve(initOperationData ?? {});\n }\n\n return this._runOperations(this.endOperations, initOperationData);\n }\n}\n","import {EndableAction} from '@action/endable-action.ts';\nimport type {ITimelineAction} from '@action/types.ts';\nimport type {IResolvedOperation} from '@configuration/types.ts';\nimport type {IEventbus} from '@eventbus/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport type {IStrictDuration} from '../types.ts';\n\ntype TRun = () => Promise<TOperationData>;\n\nexport class TimelineAction extends EndableAction implements ITimelineAction {\n private _active: boolean = false;\n /** True while start or end operations of this action are running */\n private _running = false;\n /** Starts and ends called while operations were running, in call order */\n private _waiting: Array<() => void> = [];\n /**\n * Finishes the run that `_execute` is starting; handed to the operations\n * run (see `_runOperations`) so it is called the moment they settle.\n */\n private _finishPending: (() => void) | undefined;\n\n /**\n * True from the moment `start()` is called until `end()` is called, whether\n * or not the action has end operations. Both transitions happen\n * synchronously, so a second dispatch of the same start or end (a seek\n * while playing, a revisited key) is a no-op.\n */\n public get active() {\n return this._active;\n }\n\n constructor(\n name: string,\n startOperations: IResolvedOperation[],\n endOperations: IResolvedOperation[],\n public duration: IStrictDuration,\n eventBus: IEventbus\n ) {\n super(name, startOperations, endOperations, eventBus);\n }\n\n /**\n * Starts the action, unless it is already active.\n *\n * `active` becomes true at once. When the operations of an earlier start\n * or end are still running (an asynchronous end at a loop wrap, a start\n * awaiting a fetch when its range is skipped), these start operations run\n * once those have finished, so the start and end operations of one action\n * never interleave. Otherwise they run right away.\n *\n * @param initOperationData - Operation data the first start operation receives\n * @returns The operation data of the last start operation\n */\n start(initOperationData?: TOperationData): Promise<TOperationData> {\n if (this._active) {\n return Promise.resolve({});\n }\n\n this._active = true;\n return this._sequence(() => super.start(initOperationData));\n }\n\n /**\n * Ends the action, unless it is not active.\n *\n * `active` becomes false at once. Like {@link start}, the end operations\n * wait for operations of this action that are still running.\n *\n * @param initOperationData - Operation data the first end operation receives\n * @returns The operation data of the last end operation\n */\n end(initOperationData?: TOperationData): Promise<TOperationData> {\n if (!this._active) {\n return Promise.resolve({});\n }\n\n this._active = false;\n return this._sequence(() => super.end(initOperationData));\n }\n\n private _sequence(run: TRun): Promise<TOperationData> {\n if (!this._running) {\n return this._execute(run);\n }\n return new Promise<TOperationData>((resolve, reject) => {\n this._waiting.push(() => {\n this._execute(run).then(resolve, reject);\n });\n });\n }\n\n /**\n * Runs `run`, marking the action as running until its operations settle.\n * Operations that complete synchronously finish the run synchronously, so\n * a start and end called back to back both run within the same call stack.\n */\n private _execute(run: TRun): Promise<TOperationData> {\n let finished = false;\n const finish = () => {\n if (finished) {\n return;\n }\n finished = true;\n this._running = false;\n this._waiting.shift()?.();\n };\n\n this._running = true;\n this._finishPending = finish;\n let result: Promise<TOperationData>;\n try {\n result = run();\n } catch (error) {\n result = Promise.reject(error);\n }\n if (this._finishPending === finish) {\n // No operations ran (an end without end operations)\n this._finishPending = undefined;\n finish();\n }\n return result;\n }\n\n protected override _runOperations(\n operations: IResolvedOperation[],\n initOperationData?: TOperationData,\n onSettled?: () => void\n ): Promise<TOperationData> {\n const finish = this._finishPending;\n this._finishPending = undefined;\n return super._runOperations(operations, initOperationData, () => {\n onSettled?.();\n finish?.();\n });\n }\n}\n","import type {\n IContainerProviderConfig,\n IPositionSourceConfig,\n ITimelineProviderSettings,\n} from '@configuration/types.ts';\n\n/**\n * The part of a timeline configuration that can override the provider\n * settings of its type.\n */\nexport interface ITimelineProviderOverrides {\n positionSource?: Partial<IPositionSourceConfig>;\n containerProvider?: Partial<IContainerProviderConfig>;\n}\n\ntype TProviderConfig = {systemName: string; [key: string]: unknown};\n\n/**\n * Merges a per-timeline override over the settings of the timeline's type.\n *\n * - Without an override the type's settings are returned as they are.\n * - An override that leaves out `systemName`, or names the same class as the\n * type's settings, is merged over them property by property (shallow).\n * - An override that names a different class replaces the type's settings,\n * so options meant for one class never reach another.\n *\n * @param base - The settings of the timeline's type, if any\n * @param override - The timeline's override, if any\n * @returns The effective settings, or undefined when neither is given\n */\nexport function mergeProviderConfig<T extends TProviderConfig>(\n base: T | undefined,\n override: Partial<T> | undefined\n): Partial<T> | undefined {\n if (!override) {\n return base;\n }\n if (!base) {\n return {...override};\n }\n if (\n override.systemName !== undefined &&\n override.systemName !== base.systemName\n ) {\n return {...override};\n }\n return {...base, ...override};\n}\n\n/**\n * The effective position source settings of a timeline: its\n * `positionSource` override merged over the settings of its type (see\n * {@link mergeProviderConfig}).\n */\nexport function effectivePositionSource(\n timeline: ITimelineProviderOverrides,\n typeSettings: ITimelineProviderSettings | undefined\n): Partial<IPositionSourceConfig> | undefined {\n return mergeProviderConfig(\n typeSettings?.positionSource,\n timeline.positionSource\n );\n}\n\n/**\n * The effective container provider settings of a timeline: its\n * `containerProvider` override merged over the `container` settings of its\n * type (see {@link mergeProviderConfig}).\n */\nexport function effectiveContainerProvider(\n timeline: ITimelineProviderOverrides,\n typeSettings: ITimelineProviderSettings | undefined\n): Partial<IContainerProviderConfig> | undefined {\n return mergeProviderConfig(\n typeSettings?.container,\n timeline.containerProvider\n );\n}\n\n/**\n * True when the timeline's `positionSource` override changes the settings\n * of its type, so the timeline needs a position source of its own.\n */\nexport function overridesPositionSource(\n timeline: ITimelineProviderOverrides,\n typeSettings: ITimelineProviderSettings | undefined\n): boolean {\n return (\n timeline.positionSource !== undefined &&\n !isSameProviderConfig(\n effectivePositionSource(timeline, typeSettings),\n typeSettings?.positionSource\n )\n );\n}\n\n/**\n * True when the timeline's `containerProvider` override changes the\n * `container` settings of its type.\n */\nexport function overridesContainerProvider(\n timeline: ITimelineProviderOverrides,\n typeSettings: ITimelineProviderSettings | undefined\n): boolean {\n return (\n timeline.containerProvider !== undefined &&\n !isSameProviderConfig(\n effectiveContainerProvider(timeline, typeSettings),\n typeSettings?.container\n )\n );\n}\n\n/**\n * A key that is equal for equal provider settings, whatever the order of\n * their properties.\n */\nexport function providerConfigKey(config: unknown): string {\n return JSON.stringify(sortKeys(config)) ?? 'undefined';\n}\n\nfunction isSameProviderConfig(a: unknown, b: unknown): boolean {\n return providerConfigKey(a) === providerConfigKey(b);\n}\n\nfunction sortKeys(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(sortKeys);\n }\n if (value !== null && typeof value === 'object') {\n const source = value as Record<string, unknown>;\n return Object.keys(source)\n .sort()\n .reduce<Record<string, unknown>>((sorted, key) => {\n sorted[key] = sortKeys(source[key]);\n return sorted;\n }, {});\n }\n return value;\n}\n","import {\n breakForEachSystemName,\n continueForEachSystemName,\n endForEachSystemName,\n endWhenSystemName,\n forEachSystemName,\n otherwiseSystemName,\n whenSystemName,\n} from '@operation/helper/flow-control-names.ts';\n\n/**\n * A control-flow block that is not well formed, found by\n * {@link findFlowControlProblems}.\n */\nexport interface IFlowControlProblem {\n /** The index, in the operation list, of the operation the problem is reported at */\n index: number;\n /** What is wrong, naming the operations and their indices */\n message: string;\n}\n\ntype TOpener = typeof whenSystemName | typeof forEachSystemName;\n\ninterface IOpenBlock {\n name: TOpener;\n index: number;\n hasOtherwise: boolean;\n}\n\nconst closerOf: Record<TOpener, string> = {\n [whenSystemName]: endWhenSystemName,\n [forEachSystemName]: endForEachSystemName,\n};\n\n/**\n * Checks that the `when`/`otherwise`/`endWhen` and `forEach`/`endForEach`\n * blocks of an operation list are balanced and nested, and that\n * `breakForEach` and `continueForEach` sit inside a `forEach`.\n *\n * The interpreter does not check this. An `endWhen` that closes a `forEach`,\n * or an `endWhen` without a `when`, pops the wrong scope at runtime, and the\n * action then fails with a TypeError on the next operation, or runs with the\n * wrong scope. A block that is never closed runs to the end of the list.\n *\n * @param systemNames The system names of the operations, in order\n * @returns The problems in list order, empty when the blocks are well formed\n */\nexport function findFlowControlProblems(\n systemNames: readonly string[]\n): IFlowControlProblem[] {\n const problems: IFlowControlProblem[] = [];\n const stack: IOpenBlock[] = [];\n\n const close = (closer: string, expected: TOpener, index: number) => {\n const top = stack[stack.length - 1];\n if (!top) {\n problems.push({\n index,\n message: `${closer} at index ${index} has no open ${expected} to close.`,\n });\n return;\n }\n if (top.name !== expected) {\n problems.push({\n index,\n message: `${closer} at index ${index} closes the ${top.name} at index ${top.index}, which must be closed with ${closerOf[top.name]} first: blocks must nest.`,\n });\n }\n stack.pop();\n };\n\n systemNames.forEach((name, index) => {\n switch (name) {\n case whenSystemName:\n case forEachSystemName:\n stack.push({name, index, hasOtherwise: false});\n break;\n case otherwiseSystemName: {\n const top = stack[stack.length - 1];\n if (!top || top.name !== whenSystemName) {\n problems.push({\n index,\n message: top\n ? `otherwise at index ${index} is inside the forEach at index ${top.index}, not directly inside a when.`\n : `otherwise at index ${index} has no open when.`,\n });\n } else if (top.hasOtherwise) {\n problems.push({\n index,\n message: `otherwise at index ${index} is the second otherwise of the when at index ${top.index}.`,\n });\n } else {\n top.hasOtherwise = true;\n }\n break;\n }\n case endWhenSystemName:\n close(endWhenSystemName, whenSystemName, index);\n break;\n case endForEachSystemName:\n close(endForEachSystemName, forEachSystemName, index);\n break;\n case breakForEachSystemName:\n case continueForEachSystemName:\n if (!stack.some(block => block.name === forEachSystemName)) {\n problems.push({\n index,\n message: `${name} at index ${index} is not inside a forEach.`,\n });\n }\n break;\n default:\n break;\n }\n });\n\n for (const open of stack) {\n problems.push({\n index: open.index,\n message: `${open.name} at index ${open.index} is never closed with ${closerOf[open.name]}.`,\n });\n }\n\n return problems.sort((a, b) => a.index - b.index);\n}\n","import {\n assertParsedChainSafe,\n parseSegments,\n walkChain,\n} from '@operation/helper/chain-cache.ts';\n\nexport {isGlobalObject} from '@operation/helper/chain-cache.ts';\n\n/**\n * Gets the value for the given property chain. A property chain is defined by a string array.\n *\n * For example, this property chain: `[mySource, subSource, element, value]` should be extracted from an object of this shape:\n * ```ts\n * const foo = {\n * mySource: {\n * subSource: {\n * element: {\n * value: 'bar'\n * }\n * }\n * }\n * }\n * ```\n *\n * The result of the invocation `getPropertyChainValue([mySource, subSource, element, value], foo)` would then yield the value `bar`.\n *\n * Chains containing a `__proto__`, `prototype` or `constructor` segment are rejected to\n * prevent prototype pollution and access to the `Function` constructor. Chains that pass\n * through or end at the global object (`window`), for example\n * `selectedElement.0.ownerDocument.defaultView`, are rejected too, so configuration cannot\n * reach `eval`, `Function`, timers or other globals.\n *\n * Bracket indices are expanded into their own segments, so `eventArgs[0]` resolves like\n * `eventArgs.0` and `items[2].label` like `items.2.label`. The parsing is shared with the\n * cached external chains, see `chain-cache.ts`.\n *\n * @param propertyChain The chain segments. Segments may use dot or bracket notation themselves.\n * @param sourceObject The object to resolve the chain against.\n * @param operationName The operation resolving the chain, named in the error messages.\n * @throws When an intermediate value is null or undefined (the message names the part of the\n * chain that did not resolve), when the chain contains a forbidden segment, or when it reaches\n * the global object.\n */\nexport function getPropertyChainValue(\n propertyChain: string[],\n sourceObject: Record<string, any>,\n operationName?: string\n) {\n const parsed = parseSegments(propertyChain);\n assertParsedChainSafe(parsed, operationName);\n return walkChain(parsed, sourceObject, operationName);\n}\n","import {getPropertyChainValue} from '@operation/helper/get-property-chain-value.ts';\n\n/**\n * Gets the value for the given property chain. A property chain is defined by a period delimited string.\n *\n * For example, this property chain: `mySource.subSource.element.value` should be extracted from an object of this shape:\n * ```ts\n * const foo = {\n * mySource: {\n * subSource: {\n * element: {\n * value: 'bar'\n * }\n * }\n * }\n * }\n * ```\n *\n * The result of the invocation `resolvePropertyChain('mySource.subSource.element.value', foo)` would then yield the value `bar`.\n *\n * Chains containing `__proto__`, `prototype` or `constructor` segments are rejected.\n *\n * @throws When the chain cannot be resolved or contains a forbidden segment.\n */\nexport function resolvePropertyChain(\n propertyChain: string,\n sourceObject: any,\n operationName?: string\n) {\n const properties = propertyChain.split('.');\n return getPropertyChainValue(properties, sourceObject, operationName);\n}\n","/**\n * Returns the known names closest to `name`, for \"did you mean\" hints in error\n * messages. Matching ignores case and uses the Levenshtein edit distance; only\n * names within `max(2, floor(name.length / 3))` edits are returned, closest\n * first.\n *\n * @param name - The unknown name, as written in the configuration\n * @param knownNames - The names that are registered\n * @param max - The maximum number of suggestions to return\n * @returns Up to `max` known names, closest first; empty when none is close\n */\nexport function findClosestNames(\n name: string,\n knownNames: readonly string[],\n max = 3\n): string[] {\n const lowerName = name.toLowerCase();\n const maxDistance = Math.max(2, Math.floor(name.length / 3));\n\n return knownNames\n .map(knownName => ({\n knownName,\n distance: levenshtein(lowerName, knownName.toLowerCase()),\n }))\n .filter(({distance}) => distance <= maxDistance)\n .sort((a, b) => a.distance - b.distance)\n .slice(0, max)\n .map(({knownName}) => knownName);\n}\n\n/**\n * Formats suggestions from {@link findClosestNames} as a sentence.\n *\n * @param suggestions - The suggested names\n * @returns `Did you mean 'a', 'b'?`, or an empty string when there are no suggestions\n */\nexport function formatDidYouMean(suggestions: readonly string[]): string {\n if (!suggestions.length) {\n return '';\n }\n return `Did you mean ${suggestions.map(name => `'${name}'`).join(', ')}?`;\n}\n\nfunction levenshtein(a: string, b: string) {\n let previous = Array.from({length: b.length + 1}, (_, i) => i);\n for (let i = 1; i <= a.length; i++) {\n const current = [i];\n for (let j = 1; j <= b.length; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n current[j] = Math.min(\n previous[j] + 1,\n current[j - 1] + 1,\n previous[j - 1] + cost\n );\n }\n previous = current;\n }\n return previous[b.length];\n}\n","export function isFunction(value: any): value is (...arg: any) => any {\n return typeof value === 'function';\n}\n","/**\n * Returns true for any non-null, non-array object: plain objects, but also\n * class instances, `Date`, `Map`, DOM nodes and jQuery objects.\n *\n * The narrowed type is a loose record. When the value must be a plain data\n * object (an object literal or parsed JSON), use `isPlainObject` instead.\n *\n * @param value - Any value\n * @returns Whether `value` is a non-null, non-array object\n */\nexport function isObject(\n value: unknown\n): value is Record<PropertyKey, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n","export function isString(value: any): value is string {\n return typeof value === 'string';\n}\n","import {Action, EndableAction, TimelineAction} from '@action/index.ts';\nimport type {IAction} from '@action/types.ts';\nimport {\n effectiveContainerProvider,\n effectivePositionSource,\n} from '@configuration/timeline-provider-overrides.ts';\nimport type {\n IActionConfiguration,\n IEndableActionConfiguration,\n IEngineConfiguration,\n IEventActionConfiguration,\n IOperationConfiguration,\n IResolvedActionConfiguration,\n IResolvedEndableActionConfiguration,\n IResolvedEngineConfiguration,\n IResolvedOperation,\n IResolvedTimelineConfiguration,\n ITimelineActionConfiguration,\n ITimelineConfiguration,\n} from '@configuration/types.ts';\nimport type {ActionRegistryEventbusListener} from '@eventbus/index.ts';\nimport type {IEventbus} from '@eventbus/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {findFlowControlProblems} from '@operation/helper/flow-control-structure.ts';\nimport {resolvePropertyChain} from '@operation/helper/resolve-property-chain.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\nimport {isFunction} from '@util/guards/is-function.ts';\nimport {isObject} from '@util/guards/is-object.ts';\nimport {isPlainObject} from '@util/guards/is-plain-object.ts';\nimport {isString} from '@util/guards/is-string.ts';\nimport {isDefined} from 'ts-is-present';\nimport type {\n IConfigurationResolver,\n IConfigurationResolverOptions,\n IConfigurationWarning,\n IDuration,\n ISimpleResourceImporter,\n} from '../types.ts';\n\ntype TWarn = (warning: IConfigurationWarning) => void;\n\n/**\n * The default warning handler: writes the warning to the console.\n */\nfunction warnToConsole(warning: IConfigurationWarning): void {\n console.warn(\n `Eligius configuration warning at ${warning.path}: ${warning.message}`\n );\n}\n\n/**\n * Takes an `IEngineConfiguration` instance and return an `IResolvedEngineConfiguration`.\n * This means all system names within the configuration will be resolved to their associated instances.\n *\n * If the given configuration includes event actions, then those will be registered in the given\n * `ActionRegistryEventbusListener`. They are registered only after the whole configuration\n * has been accepted, so a configuration that `process` rejects leaves the listener untouched.\n *\n * Every error names the JSON path of the offending value.\n *\n * @throws When an operation's `systemName` does not resolve to an operation function (including\n * controller, timeline provider, custom function and class exports of the importer). The message\n * suggests the closest operation names the importer lists, which include the custom operations\n * registered with `EligiusResourceImporter`.\n * @throws When two actions (or an action and an event action) share the same name.\n * @throws When `actions`, `initActions`, `timelines`, an action's `startOperations` or\n * `endOperations`, or a timeline's `timelineActions` is not an array.\n * @throws When a timeline action has no valid `duration`, or when a timeline's `type` has no\n * entry in `timelineProviderSettings` and the timeline has no `positionSource` with a `systemName`\n * of its own.\n * @throws When a timeline's `positionSource` or `containerProvider` override is not an object,\n * names a `systemName` the importer does not provide, or leaves out a setting that the provider\n * requires (for example `selector` of `ScrollPositionSource`) once it is merged over the type's\n * settings.\n * @throws When a VideoPositionSource has an 'options' key, at timelineProviderSettings.<type>.positionSource\n * or at a timeline's positionSource override (also when the override inherits VideoPositionSource from its\n * type). 4.0.0 removed the video.js player options.\n * @throws When a `template:`, `json:` or `config:` placeholder cannot be resolved.\n *\n * Control-flow blocks that are not well formed (an `endWhen` without a `when`,\n * an `endWhen` that closes a `forEach`, a `when` that is never closed, a\n * `breakForEach` outside a `forEach`) are reported as warnings through\n * {@link IConfigurationResolverOptions.onWarning}, by default on the console.\n * The interpreter runs them as before: an operation list with such a block\n * fails at runtime, or runs with the wrong scope. They become errors in the\n * next major version. `eligius/lint` reports the same shapes as errors.\n */\nexport class ConfigurationResolver implements IConfigurationResolver {\n private readonly _warn: TWarn;\n\n /**\n * @param importer - Resolves system names to operations, controllers and providers\n * @param eventbus - The eventbus the resolved actions run on\n * @param options - Optional. `onWarning` receives the configuration\n * warnings instead of the console.\n */\n constructor(\n private importer: ISimpleResourceImporter,\n private eventbus: IEventbus,\n options: IConfigurationResolverOptions = {}\n ) {\n this._warn = options.onWarning ?? warnToConsole;\n }\n\n process(\n configuration: IEngineConfiguration,\n actionRegistryListener?: ActionRegistryEventbusListener\n ): [Record<string, IAction>, IResolvedEngineConfiguration] {\n // Resolve the imported placeholders (template:, json:) first, so that a config:\n // placeholder always sees the resolved value, regardless of property order.\n const imported = new WeakSet<object>();\n resolvePlaceholders(\n configuration,\n configuration,\n this.importer,\n 'import',\n imported,\n ''\n );\n resolvePlaceholders(\n configuration,\n configuration,\n this.importer,\n 'config',\n imported,\n ''\n );\n\n if (\n !isObject(configuration.timelineProviderSettings) &&\n !(\n configuration.timelineProviderSettings === undefined &&\n everyTimelineHasOwnPositionSource(configuration.timelines)\n )\n ) {\n throw new Error(\n `Configuration incomplete: it needs to have at least one timeline provider setting at timelineProviderSettings, got ${describeValue(configuration.timelineProviderSettings)}.`\n );\n }\n\n const resolvedConfig: IResolvedEngineConfiguration = {\n id: configuration.id,\n engine: {...configuration.engine},\n timelineProviderSettings:\n deepCopy(configuration.timelineProviderSettings) ?? {},\n containerSelector: configuration.containerSelector,\n cssFiles: deepCopy(configuration.cssFiles),\n language: configuration.language,\n layoutTemplate: configuration.layoutTemplate,\n availableLanguages: deepCopy(configuration.availableLanguages),\n actions: resolveActions(\n configuration.actions,\n this.importer,\n this.eventbus,\n 'actions',\n this._warn\n ),\n initActions: resolveActions(\n configuration.initActions,\n this.importer,\n this.eventbus,\n 'initActions',\n this._warn\n ),\n timelineFlow: deepCopy(configuration.timelineFlow),\n timelines: resolveTimelines(\n configuration.timelines,\n this.importer,\n this.eventbus,\n this._warn\n ),\n };\n\n assertTimelineProviderSettings(configuration, this.importer);\n\n let eventActions: IEventActionRegistration[] = [];\n if (isDefined(configuration.eventActions)) {\n assertArray(configuration.eventActions, 'eventActions');\n if (actionRegistryListener) {\n eventActions = resolveEventActions(\n configuration.eventActions,\n this.importer,\n this.eventbus,\n this._warn\n );\n }\n }\n\n const actionsLookup = createActionsLookup([\n ...(resolvedConfig.actions as IAction[]).map(\n (action, index) => [action, `actions[${index}]`] as const\n ),\n ...eventActions.map(\n ({action}, index) => [action, `eventActions[${index}]`] as const\n ),\n ]);\n\n // Register only now that the configuration is accepted, so a rejected\n // configuration leaves no live event actions behind.\n for (const {action, eventName, eventTopic} of eventActions) {\n actionRegistryListener?.registerAction(action, eventName, eventTopic);\n }\n\n return [actionsLookup, resolvedConfig];\n }\n}\n\ninterface IEventActionRegistration {\n action: IAction;\n eventName: string;\n eventTopic?: string;\n}\n\n/**\n * Describes a value for an error message by its kind only, so configuration\n * data never ends up in a message.\n */\nfunction describeValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'an array';\n }\n switch (typeof value) {\n case 'undefined':\n return 'undefined';\n case 'object':\n return 'an object';\n case 'number':\n return Number.isFinite(value) ? String(value) : 'a non-finite number';\n case 'string':\n return 'a string';\n case 'boolean':\n return 'a boolean';\n default:\n return `a ${typeof value}`;\n }\n}\n\nfunction assertArray(value: unknown, path: string): asserts value is unknown[] {\n if (!Array.isArray(value)) {\n throw new Error(\n `Invalid configuration at ${path}: expected an array, got ${describeValue(value)}.`\n );\n }\n}\n\n/**\n * Every timeline needs a position source: from the provider settings of its\n * type, or from a `positionSource` override with a `systemName` of its own.\n * Otherwise the engine silently has no position source for it.\n *\n * Overrides are checked here so a mistake fails at resolution with its JSON\n * path, not at init or on the first switch to the timeline.\n */\nfunction assertTimelineProviderSettings(\n configuration: IEngineConfiguration,\n importer: ISimpleResourceImporter\n) {\n const settings = configuration.timelineProviderSettings ?? {};\n // Every type, including types no timeline uses, so the mistake fails fast\n for (const [type, typeSettings] of Object.entries(settings)) {\n if (isObject(typeSettings) && isObject(typeSettings.positionSource)) {\n assertNoVideoOptions(\n typeSettings.positionSource,\n typeSettings.positionSource.systemName,\n `timelineProviderSettings.${type}.positionSource`\n );\n }\n }\n configuration.timelines.forEach((timeline, index) => {\n const path = `timelines[${index}]`;\n const {type} = timeline;\n const typeSettings =\n Object.hasOwn(settings, type) && isObject(settings[type])\n ? settings[type]\n : undefined;\n\n assertProviderOverride(\n timeline.positionSource,\n `${path}.positionSource`,\n 'position source',\n importer\n );\n assertProviderOverride(\n timeline.containerProvider,\n `${path}.containerProvider`,\n 'container provider',\n importer\n );\n\n // Before the missing-settings checks, so an old override whose sources\n // sit inside 'options' gets the real reason\n if (isObject(timeline.positionSource)) {\n assertNoVideoOptions(\n timeline.positionSource,\n effectivePositionSource(timeline, typeSettings)?.systemName,\n `${path}.positionSource`\n );\n }\n\n if (!typeSettings && !isString(timeline.positionSource?.systemName)) {\n throw new Error(\n `Missing timeline provider settings at timelineProviderSettings.${type} for ${path} (type '${type}'). Add a provider for the '${type}' timeline type, or give ${path}.positionSource a systemName of its own.`\n );\n }\n\n if (isDefined(timeline.positionSource)) {\n assertMergedProviderSettings(\n effectivePositionSource(timeline, typeSettings),\n `${path}.positionSource`,\n `timelineProviderSettings.${type}.positionSource`,\n 'position source'\n );\n }\n if (isDefined(timeline.containerProvider)) {\n assertMergedProviderSettings(\n effectiveContainerProvider(timeline, typeSettings),\n `${path}.containerProvider`,\n `timelineProviderSettings.${type}.container`,\n 'container provider'\n );\n }\n });\n}\n\n/**\n * True when there are timelines and every one names its own position source,\n * so the configuration needs no `timelineProviderSettings`.\n */\nfunction everyTimelineHasOwnPositionSource(timelines: unknown): boolean {\n return (\n Array.isArray(timelines) &&\n timelines.length > 0 &&\n timelines.every(\n timeline =>\n isObject(timeline) &&\n isObject(timeline.positionSource) &&\n isString(timeline.positionSource.systemName)\n )\n );\n}\n\n/**\n * Settings that the built-in providers cannot work without. They are checked\n * for timelines that override their provider settings, after the merge.\n */\nconst REQUIRED_PROVIDER_SETTINGS: Record<string, readonly string[]> = {\n ScrollPositionSource: ['selector'],\n VideoPositionSource: ['selector', 'sources'],\n DomContainerProvider: ['selector'],\n};\n\n/**\n * VideoPositionSource took video.js player options under `options` until\n * 4.0.0 removed video.js. Other position sources may still take an\n * `options` key, so only the effective system name `VideoPositionSource` is\n * checked.\n *\n * @param positionSource - The settings object as written in the configuration\n * @param systemName - The effective system name (inherited for overrides without one)\n * @param path - JSON path of `positionSource`\n * @throws When a VideoPositionSource has an `options` key\n */\nfunction assertNoVideoOptions(\n positionSource: Record<PropertyKey, unknown>,\n systemName: unknown,\n path: string\n) {\n if (\n systemName !== 'VideoPositionSource' ||\n !Object.hasOwn(positionSource, 'options')\n ) {\n return;\n }\n throw new Error(\n `Invalid configuration at ${path}.options: VideoPositionSource no longer accepts 'options' (the video.js player options were removed in 4.0.0). Put 'sources' and 'poster' directly in ${path} and delete 'options'. See the 4.0.0 migration steps in CHANGELOG.md.`\n );\n}\n\n/**\n * Checks the shape of a per-timeline provider override and that its\n * `systemName`, when given, is provided by the importer.\n */\nfunction assertProviderOverride(\n override: unknown,\n path: string,\n kind: string,\n importer: ISimpleResourceImporter\n) {\n if (!isDefined(override)) {\n return;\n }\n if (!isObject(override)) {\n throw new Error(\n `Invalid configuration at ${path}: expected an object with ${kind} settings, got ${describeValue(override)}.`\n );\n }\n const {systemName} = override;\n if (!isDefined(systemName)) {\n return;\n }\n if (!isString(systemName)) {\n throw new Error(\n `Invalid configuration at ${path}.systemName: expected the name of a ${kind} class, got ${describeValue(systemName)}.`\n );\n }\n\n let entry: unknown;\n try {\n entry = importer.import(systemName)?.[systemName];\n } catch {\n entry = undefined;\n }\n if (!isFunction(entry)) {\n const didYouMean = formatDidYouMean(\n findClosestNames(\n systemName,\n getImporterNames(importer, 'getProviderNames')\n )\n );\n throw new Error(\n `Unknown ${kind} '${systemName}' at ${path}.systemName. ${\n didYouMean ||\n `Check the spelling, or make sure the ${kind} is available from the resource importer.`\n }`\n );\n }\n const isListedAs = (getterName: string) =>\n getImporterNames(importer, getterName).includes(systemName);\n if (\n !isListedAs('getProviderNames') &&\n (isListedAs('getOperationNames') || isListedAs('getControllerNames'))\n ) {\n throw new Error(\n `Unknown ${kind} '${systemName}' at ${path}.systemName: '${systemName}' is an operation or controller, not a ${kind}.`\n );\n }\n}\n\n/**\n * Checks the settings a timeline ends up with once its override is merged\n * over the settings of its type: a `systemName`, and the settings the\n * built-in provider of that name requires.\n */\nfunction assertMergedProviderSettings(\n merged: Record<string, unknown> | undefined,\n path: string,\n typePath: string,\n kind: string\n) {\n const systemName = merged?.systemName;\n if (!merged || !isString(systemName)) {\n throw new Error(\n `Missing systemName at ${path}.systemName: there are no settings at ${typePath} to merge the override over, so it has to name the ${kind} class.`\n );\n }\n const required = Object.hasOwn(REQUIRED_PROVIDER_SETTINGS, systemName)\n ? REQUIRED_PROVIDER_SETTINGS[systemName]\n : [];\n for (const key of required) {\n if (!hasRequiredSetting(merged, key)) {\n throw new Error(\n `Missing setting at ${path}.${key}: '${systemName}' requires '${key}', and neither ${path} nor ${typePath} provides it.`\n );\n }\n }\n}\n\nfunction hasRequiredSetting(\n settings: Record<string, unknown>,\n key: string\n): boolean {\n if (key === 'sources') {\n return isNonEmptyArray(settings.sources);\n }\n const value = settings[key];\n return isString(value) ? value.length > 0 : isDefined(value);\n}\n\nfunction isNonEmptyArray(value: unknown): boolean {\n return Array.isArray(value) && value.length > 0;\n}\n\nfunction createActionsLookup(\n actions: (readonly [IAction, string])[]\n): Record<string, IAction> {\n // Null prototype objects, so that an action named '__proto__' cannot alter the prototype\n const lookup: Record<string, IAction> = Object.create(null);\n const paths: Record<string, string> = Object.create(null);\n\n for (const [action, path] of actions) {\n if (Object.hasOwn(lookup, action.name)) {\n throw new Error(\n `Duplicate action name '${action.name}' at ${paths[action.name]}.name and ${path}.name. Action names must be unique across actions and eventActions, rename one of them.`\n );\n }\n lookup[action.name] = action;\n paths[action.name] = path;\n }\n\n return lookup;\n}\n\n/**\n * Creates the event actions without registering them.\n */\nfunction resolveEventActions(\n eventActionConfigurations: IEventActionConfiguration[],\n importer: ISimpleResourceImporter,\n eventbus: IEventbus,\n warn: TWarn\n): IEventActionRegistration[] {\n const resolvedConfigs =\n eventActionConfigurations.map<IResolvedActionConfiguration>(\n (config, index) =>\n resolveActionConfiguration(\n config,\n importer,\n `eventActions[${index}]`,\n warn\n )\n );\n\n return resolvedConfigs.map((config, index) => {\n const {eventName, eventTopic} = eventActionConfigurations[index];\n return {\n action: new Action(config.name, config.startOperations, eventbus),\n eventName,\n eventTopic,\n };\n });\n}\n\nfunction resolveTimelines(\n timelines: ITimelineConfiguration[],\n importer: ISimpleResourceImporter,\n eventbus: IEventbus,\n warn: TWarn\n) {\n assertArray(timelines, 'timelines');\n return timelines.map<IResolvedTimelineConfiguration>(\n (config, timelineIndex) => {\n const path = `timelines[${timelineIndex}]`;\n assertArray(config.timelineActions, `${path}.timelineActions`);\n return {\n ...config,\n // Copies, so the resolved configuration does not share the overrides\n ...(isDefined(config.positionSource) && {\n positionSource: deepCopy(config.positionSource),\n }),\n ...(isDefined(config.containerProvider) && {\n containerProvider: deepCopy(config.containerProvider),\n }),\n timelineActions: config.timelineActions.map((actionConfig, index) =>\n resolveTimelineAction(\n importer,\n eventbus,\n actionConfig,\n `${path}.timelineActions[${index}]`,\n warn\n )\n ),\n };\n }\n );\n}\n\nfunction resolveOperation(\n importer: ISimpleResourceImporter,\n operationConfig: IOperationConfiguration<TOperationData>,\n path: string\n): IResolvedOperation {\n const {systemName} = operationConfig;\n let instance: unknown;\n try {\n instance = importer.import(systemName)?.[systemName];\n } catch (error) {\n // Importers may throw for unknown names (EligiusResourceImporter does);\n // report it like a missing entry so the message keeps the JSON path.\n throw new Error(createUnknownOperationMessage(importer, systemName, path), {\n cause: error,\n });\n }\n\n if (!isFunction(instance)) {\n throw new Error(createUnknownOperationMessage(importer, systemName, path));\n }\n\n // The importer also serves controllers, timeline providers and classes, which\n // are functions as well, but cannot be called as an operation.\n const notAnOperation = describeNonOperation(importer, systemName, instance);\n if (notAnOperation) {\n throw new Error(\n `Unknown operation '${systemName}' at ${path}.systemName. ${notAnOperation}`\n );\n }\n\n return {\n id: operationConfig.id,\n systemName,\n operationData: deepCopy(operationConfig.operationData) ?? {},\n instance,\n };\n}\n\n/**\n * Returns why the given importer export is not an operation, or `undefined`\n * when it may be one.\n */\nfunction describeNonOperation(\n importer: ISimpleResourceImporter,\n systemName: string,\n instance: (...args: any[]) => any\n): string | undefined {\n const isListedAs = (getterName: string) =>\n getImporterNames(importer, getterName).includes(systemName);\n\n if (!isListedAs('getOperationNames')) {\n if (isListedAs('getControllerNames')) {\n return `'${systemName}' is a controller, not an operation: attach it with the addControllerToElement operation.`;\n }\n if (isListedAs('getProviderNames')) {\n return `'${systemName}' is a timeline provider export, not an operation: configure it in timelineProviderSettings.`;\n }\n if (isListedAs('getFunctionNames')) {\n return `'${systemName}' is a custom function, not an operation: call it with the customFunction operation ({systemName: '${systemName}'}).`;\n }\n }\n if (isClass(instance)) {\n return `'${systemName}' is a class, not an operation function.`;\n }\n return undefined;\n}\n\nfunction isClass(value: (...args: any[]) => any): boolean {\n return /^class[\\s{]/.test(Function.prototype.toString.call(value));\n}\n\nfunction resolveOperations(\n importer: ISimpleResourceImporter,\n operationConfigs: IOperationConfiguration<TOperationData>[],\n path: string,\n warn: TWarn\n) {\n assertArray(operationConfigs, path);\n const resolved = operationConfigs.map((operationConfig, index) =>\n resolveOperation(importer, operationConfig, `${path}[${index}]`)\n );\n for (const problem of findFlowControlProblems(\n resolved.map(operation => operation.systemName)\n )) {\n warn({\n path: `${path}[${problem.index}].systemName`,\n message: `${problem.message} This will be a configuration error in the next major version.`,\n });\n }\n return resolved;\n}\n\nfunction createUnknownOperationMessage(\n importer: ISimpleResourceImporter,\n systemName: string,\n path: string\n) {\n const message = `Unknown operation '${systemName}' at ${path}.systemName.`;\n const knownNames = getImporterNames(importer, 'getOperationNames');\n const didYouMean = formatDidYouMean(\n findClosestNames(String(systemName), knownNames)\n );\n\n if (didYouMean) {\n return `${message} ${didYouMean}`;\n }\n return `${message} Check the spelling, or make sure the operation is available from the resource importer.`;\n}\n\n/**\n * Calls one of the optional `IResourceImporter` name getters, an empty list when\n * the importer does not have it.\n */\nfunction getImporterNames(\n importer: ISimpleResourceImporter,\n getterName: string\n): string[] {\n const getter = (importer as unknown as Record<string, unknown>)[getterName];\n if (isFunction(getter)) {\n const names = getter.call(importer);\n return Array.isArray(names) ? names : [];\n }\n return [];\n}\n\nfunction resolveActionConfiguration(\n config: IActionConfiguration,\n importer: ISimpleResourceImporter,\n path: string,\n warn: TWarn\n): IResolvedActionConfiguration {\n return {\n id: config.id,\n name: config.name,\n startOperations: resolveOperations(\n importer,\n config.startOperations,\n `${path}.startOperations`,\n warn\n ),\n };\n}\n\nfunction resolveEndableActionConfiguration(\n config: IEndableActionConfiguration,\n importer: ISimpleResourceImporter,\n path: string,\n warn: TWarn\n): IResolvedEndableActionConfiguration {\n const action = resolveActionConfiguration(config, importer, path, warn);\n\n return {\n ...action,\n endOperations: resolveOperations(\n importer,\n config.endOperations,\n `${path}.endOperations`,\n warn\n ),\n };\n}\n\n/**\n * Validates a timeline action duration: `start` is a number >= 0, `end` is\n * optional and, when given, not lower than `start`. An `end` of -1 marks an\n * open end, like a missing `end`.\n */\nfunction resolveDuration(duration: unknown, path: string): Required<IDuration> {\n if (!isObject(duration)) {\n throw new Error(\n `Invalid configuration at ${path}: expected {start: number, end?: number}, got ${describeValue(duration)}.`\n );\n }\n const {start, end} = duration;\n if (typeof start !== 'number' || !Number.isFinite(start) || start < 0) {\n throw new Error(\n `Invalid configuration at ${path}.start: expected a number >= 0, got ${describeValue(start)}.`\n );\n }\n if (!isDefined(end) || end === -1) {\n return {start, end: -1};\n }\n if (typeof end !== 'number' || !Number.isFinite(end)) {\n throw new Error(\n `Invalid configuration at ${path}.end: expected a number or no end, got ${describeValue(end)}.`\n );\n }\n if (end < start) {\n throw new Error(\n `Invalid configuration at ${path}.end: end (${end}) must not be lower than start (${start}).`\n );\n }\n return {start, end};\n}\n\nfunction resolveTimelineAction(\n importer: ISimpleResourceImporter,\n eventbus: IEventbus,\n actionConfiguration: ITimelineActionConfiguration,\n path: string,\n warn: TWarn\n) {\n const duration = resolveDuration(\n actionConfiguration.duration,\n `${path}.duration`\n );\n const resolvedConfig = resolveEndableActionConfiguration(\n actionConfiguration,\n importer,\n path,\n warn\n );\n\n const {id, name, endOperations, startOperations} = resolvedConfig;\n const action = new TimelineAction(\n name,\n startOperations,\n endOperations,\n duration,\n eventbus\n );\n action.id = id;\n return action;\n}\n\nfunction resolveActions(\n actionConfigurations: IEndableActionConfiguration[],\n importer: ISimpleResourceImporter,\n eventbus: IEventbus,\n path: string,\n warn: TWarn\n) {\n assertArray(actionConfigurations, path);\n const resolvedConfigs =\n actionConfigurations.map<IResolvedEndableActionConfiguration>(\n (config, index) => {\n return resolveEndableActionConfiguration(\n config,\n importer,\n `${path}[${index}]`,\n warn\n );\n }\n );\n\n return resolvedConfigs.map<EndableAction>(resolvedConfig => {\n const {name, endOperations, startOperations} = resolvedConfig;\n const action = new EndableAction(\n name,\n startOperations,\n endOperations,\n eventbus\n );\n action.id = resolvedConfig.id;\n return action;\n });\n}\n\n/**\n * `import` resolves the `template:` and `json:` placeholders, `config:` resolves the `config:` placeholders.\n */\ntype TPlaceholderPass = 'import' | 'config';\n\n/**\n * Walks arrays and plain data objects only. Class instances, jQuery objects and\n * other non-plain values (from the TypeScript API) are kept as they are.\n */\nfunction resolvePlaceholders(\n configFragment: Record<string, any> | any[],\n rootConfig: any,\n importer: ISimpleResourceImporter,\n pass: TPlaceholderPass,\n imported: WeakSet<object>,\n path: string\n) {\n if (!isDefined(configFragment) || imported.has(configFragment)) {\n return;\n }\n\n if (Array.isArray(configFragment)) {\n configFragment.forEach((_item, index) => {\n resolvePlaceholder(\n index,\n configFragment,\n rootConfig,\n importer,\n pass,\n imported,\n `${path}[${index}]`\n );\n });\n } else if (isPlainObject(configFragment)) {\n Object.keys(configFragment).forEach(key => {\n resolvePlaceholder(\n key,\n configFragment,\n rootConfig,\n importer,\n pass,\n imported,\n path ? `${path}.${key}` : key\n );\n });\n }\n}\n\nfunction resolvePlaceholder(\n key: PropertyKey,\n configFragment: any,\n rootConfig: any,\n importer: ISimpleResourceImporter,\n pass: TPlaceholderPass,\n imported: WeakSet<object>,\n path: string\n) {\n const configValue = configFragment[key];\n if (isString(configValue)) {\n if (pass === 'config') {\n if (configValue.startsWith('config:')) {\n configFragment[key] = resolveConfigPlaceholder(\n configValue,\n rootConfig,\n path\n );\n }\n } else if (configValue.startsWith('template:')) {\n const templateKey = configValue.substring(9, configValue.length);\n const template = importPlaceholder(\n importer,\n templateKey,\n configValue,\n path\n );\n configFragment[key] = template;\n } else if (configValue.startsWith('json:')) {\n const jsonKey = configValue.substring(5, configValue.length);\n // A copy, so the importer's own value is never rewritten when the\n // configuration is processed again\n const json = deepCopy(\n importPlaceholder(importer, jsonKey, configValue, path)\n );\n configFragment[key] = json;\n // Imported values are not walked for placeholders\n if (isPlainObject(json) || Array.isArray(json)) {\n imported.add(json);\n }\n }\n } else if (isPlainObject(configValue) || Array.isArray(configValue)) {\n resolvePlaceholders(\n configValue,\n rootConfig,\n importer,\n pass,\n imported,\n path\n );\n }\n}\n\n/**\n * Imports the value for a `template:` or `json:` placeholder. An importer that\n * throws for an unknown name gets its error wrapped, and an importer that returns\n * a record without an entry for the name is reported as an unknown name. Both\n * messages name the placeholder and its JSON path. An entry that is present but\n * `undefined` is accepted.\n */\nfunction importPlaceholder(\n importer: ISimpleResourceImporter,\n name: string,\n placeholder: string,\n path: string\n): unknown {\n let record: unknown;\n try {\n record = importer.import(name);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Unable to resolve placeholder '${placeholder}' at ${path}: ${reason}`,\n {cause: error}\n );\n }\n if (!isObject(record) || !Object.hasOwn(record, name)) {\n throw new Error(\n `Unable to resolve placeholder '${placeholder}' at ${path}: unknown name '${name}'.`\n );\n }\n return record[name];\n}\n\n/**\n * Resolves a `config:` placeholder against the root configuration. When the target\n * is itself a `config:` placeholder, that one is followed as well.\n *\n * @throws When the property chain cannot be resolved or yields `undefined`.\n */\nfunction resolveConfigPlaceholder(\n placeholder: string,\n rootConfig: any,\n path: string,\n visited: Set<string> = new Set()\n): any {\n if (visited.has(placeholder)) {\n throw new Error(\n `Circular config: placeholder '${placeholder}' at ${path} (chain: ${[...visited, placeholder].join(' -> ')})`\n );\n }\n visited.add(placeholder);\n\n const configProperty = placeholder.substring(7, placeholder.length);\n let value: unknown;\n try {\n value = resolvePropertyChain(configProperty, rootConfig);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Unable to resolve placeholder '${placeholder}' at ${path}: ${reason}`,\n {cause: error}\n );\n }\n if (value === undefined) {\n throw new Error(\n `Unable to resolve placeholder '${placeholder}' at ${path}: the configuration has no value at '${configProperty}'.`\n );\n }\n\n if (isString(value) && value.startsWith('config:')) {\n return resolveConfigPlaceholder(value, rootConfig, path, visited);\n }\n return value;\n}\n","import type {IAction} from '@action/types.ts';\nimport type {IEventbusListener} from '@eventbus/types.ts';\n\n/**\n * The `IEventbusListener` first registers a number of actions that are then\n * executed when the specified event is broadcast.\n */\nexport class ActionRegistryEventbusListener implements IEventbusListener {\n private _actionRegistry = new Map<string, IAction[]>();\n\n registerAction(\n action: IAction,\n eventName: string,\n eventTopic?: string\n ): void {\n if (eventTopic?.length) {\n eventName = `${eventName}:${eventTopic}`;\n }\n if (!this._actionRegistry.has(eventName)) {\n this._actionRegistry.set(eventName, []);\n }\n this._actionRegistry.get(eventName)?.push(action);\n }\n\n /**\n * Starts every action registered for the event.\n *\n * @returns A promise that settles once all started actions have finished,\n * or undefined when no action is registered. It rejects with the failing\n * action's error, or with an AggregateError when several fail. The Eventbus\n * watches this promise and reports a rejection like any handler error.\n */\n handleEvent(\n eventName: string,\n eventTopic: string | undefined,\n args: any[]\n ): Promise<void> | undefined {\n if (eventTopic) {\n eventName = `${eventName}:${eventTopic}`;\n }\n const actions = this._actionRegistry.get(eventName);\n if (!actions?.length) {\n return undefined;\n }\n\n // Each action gets its own operation data: Action merges into and\n // mutates the object it is given, so sharing one would leak state\n // (selectedElement, variables, ...) from one action into the next.\n const runs = actions.map(action =>\n action.start({eventArgs: Array.isArray(args) ? [...args] : args})\n );\n\n return Promise.allSettled(runs).then(results => {\n const errors = results\n .filter(\n (result): result is PromiseRejectedResult =>\n result.status === 'rejected'\n )\n .map(result => result.reason);\n if (errors.length === 1) {\n throw errors[0];\n }\n if (errors.length > 1) {\n throw new AggregateError(\n errors,\n `${errors.length} event actions failed for '${eventName}'`\n );\n }\n });\n }\n}\n","import type {\n IEventbus,\n IEventbusErrorContext,\n IEventbusErrorReport,\n IEventbusInterceptor,\n IEventbusListener,\n IEventbusOptions,\n RequestMap,\n RequestName,\n TEventbusErrorHandler,\n TEventbusErrorSource,\n TEventbusRemover,\n TEventHandler,\n TRequestResponder,\n TTypedRequestResponder,\n} from '@eventbus/types.ts';\nimport {isPromise} from '@util/guards/is-promise.ts';\n\n/**\n * Maps each once() decorator to the handler it wraps, so off() can remove a\n * once() registration by the original function.\n */\nconst onceOriginals = new WeakMap<TEventHandler, TEventHandler>();\n\n/**\n * Central event bus for pub/sub communication and synchronous request/response queries.\n *\n * The eventbus supports:\n * - **Pub/Sub**: `on()`, `once()`, `off()`, `broadcast()`, `broadcastForTopic()`\n * - **Request/Response**: `onRequest()`, `request()`, `requestForTopic()` for synchronous queries\n * - **Interceptors**: Transform event arguments before handlers receive them\n * - **Listeners**: Global event observers for logging/debugging\n *\n * @example Pub/Sub pattern\n * ```ts\n * const remover = eventbus.on('timeline-play', () => console.log('Playing'));\n * eventbus.broadcast('timeline-play', []);\n * remover(); // Unsubscribe\n * ```\n *\n * @example Request/Response pattern\n * ```ts\n * eventbus.onRequest('request-instance', (name) => new MyClass(name));\n * const instance = eventbus.request<MyClass>('request-instance', 'test');\n * ```\n *\n * Broadcasts isolate errors: a handler, listener or interceptor that throws, or\n * returns a promise that rejects, is reported and the others still run. Request\n * responders are not isolated; their errors reach the requester.\n *\n * @example Observing handler errors\n * ```ts\n * const eventbus = new Eventbus({\n * onHandlerError: (error, {eventName, eventTopic, source}) =>\n * myLogger.warn(`${source} failed for ${eventName}`, error),\n * });\n * ```\n */\nexport class Eventbus implements IEventbus {\n private eventHandlers = new Map<string, TEventHandler[]>();\n private eventInterceptors = new Map<string, IEventbusInterceptor[]>();\n private eventListeners: IEventbusListener[] = [];\n private requestResponders = new Map<string, TRequestResponder[]>();\n private readonly onHandlerError: TEventbusErrorHandler | undefined;\n\n /**\n * @param options - Optional settings. `onHandlerError` observes errors raised\n * by handlers, listeners and interceptors during a broadcast. It survives\n * {@link Eventbus.clear}.\n */\n constructor(options?: IEventbusOptions) {\n this.onHandlerError = options?.onHandlerError;\n this.clear();\n }\n\n /**\n * Clears all handlers, listeners, interceptors, and request responders.\n */\n clear() {\n this.eventHandlers = new Map<string, TEventHandler[]>();\n this.eventListeners = [];\n this.eventInterceptors = new Map<string, IEventbusInterceptor[]>();\n this.requestResponders = new Map<string, TRequestResponder[]>();\n }\n\n _getEventInterceptors(\n eventName: string,\n eventTopic?: string\n ): IEventbusInterceptor[] {\n if (eventTopic) {\n eventName = `${eventName}:${eventTopic}`;\n }\n if (!this.eventInterceptors.has(eventName)) {\n this.eventInterceptors.set(eventName, []);\n }\n return this.eventInterceptors.get(eventName) as IEventbusInterceptor[];\n }\n\n _getEventHandlers(eventName: string, eventTopic?: string): TEventHandler[] {\n if (eventTopic) {\n eventName = `${eventName}:${eventTopic}`;\n }\n if (!this.eventHandlers.has(eventName)) {\n this.eventHandlers.set(eventName, []);\n }\n return this.eventHandlers.get(eventName) as TEventHandler[];\n }\n\n on(\n eventName: string,\n eventHandler: TEventHandler,\n eventTopic?: string\n ): TEventbusRemover {\n this._getEventHandlers(eventName, eventTopic).push(eventHandler);\n return () => {\n this.off(eventName, eventHandler, eventTopic);\n };\n }\n\n once(\n eventName: string,\n eventHandler: TEventHandler,\n eventTopic?: string\n ): TEventbusRemover {\n // Remove the decorator before calling the handler, so a handler that\n // rebroadcasts the event or throws cannot make it fire more than once.\n // The flag covers a broadcast that already took a snapshot including it.\n let called = false;\n const eventHandlerDecorator = (...args: any[]) => {\n if (called) {\n return;\n }\n called = true;\n this.off(eventName, eventHandlerDecorator, eventTopic);\n // Return the result so a rejected promise from an async handler reaches\n // the dispatcher and gets reported.\n return eventHandler(...args);\n };\n // Lets off(eventName, eventHandler) find the decorator.\n onceOriginals.set(eventHandlerDecorator, eventHandler);\n this.on(eventName, eventHandlerDecorator, eventTopic);\n return () => {\n this.off(eventName, eventHandlerDecorator, eventTopic);\n };\n }\n\n /**\n * Removes one registration of the handler. A handler registered with\n * {@link Eventbus.once} can be removed by passing the original function. An\n * exact registration (through `on()`) is preferred over a `once()` one.\n */\n off(\n eventName: string,\n eventHandler: TEventHandler,\n eventTopic?: string\n ): void {\n const handlers = this._getEventHandlers(eventName, eventTopic);\n let idx = handlers.indexOf(eventHandler);\n if (idx === -1) {\n idx = handlers.findIndex(h => onceOriginals.get(h) === eventHandler);\n }\n if (idx > -1) {\n handlers.splice(idx, 1);\n }\n }\n\n broadcast(eventName: string, args: any[]): void {\n this._callHandlers(eventName, undefined, args);\n }\n\n broadcastForTopic(eventName: string, eventTopic: string, args: any[]): void {\n this._callHandlers(eventName, eventTopic, args);\n }\n\n registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover {\n this.eventListeners.push(eventbusListener);\n return () => {\n const index = this.eventListeners.indexOf(eventbusListener);\n if (index > -1) {\n this.eventListeners.splice(index, 1);\n }\n };\n }\n\n registerInterceptor(\n eventName: string,\n interceptor: IEventbusInterceptor,\n eventTopic?: string\n ): TEventbusRemover {\n const interceptors = this._getEventInterceptors(eventName, eventTopic);\n interceptors.push(interceptor);\n return () => {\n const index = interceptors.indexOf(interceptor);\n if (index > -1) {\n interceptors.splice(index, 1);\n }\n };\n }\n\n onRequest<K extends RequestName>(\n eventName: K,\n responder: TTypedRequestResponder<K>,\n eventTopic?: string\n ): TEventbusRemover;\n onRequest<T>(\n eventName: string,\n responder: TRequestResponder<T>,\n eventTopic?: string\n ): TEventbusRemover;\n onRequest(\n eventName: string,\n responder: TRequestResponder,\n eventTopic?: string\n ): TEventbusRemover {\n const responders = this._getRequestResponders(eventName, eventTopic);\n responders.push(responder);\n return () => {\n const index = responders.indexOf(responder);\n if (index > -1) {\n responders.splice(index, 1);\n }\n };\n }\n\n request<K extends RequestName>(\n eventName: K,\n ...args: RequestMap[K]['args']\n ): RequestMap[K]['returns'] | undefined;\n request<T>(eventName: string, ...args: unknown[]): T | undefined;\n request(eventName: string, ...args: unknown[]): unknown {\n return this._callResponder(eventName, undefined, args);\n }\n\n requestForTopic<K extends RequestName>(\n eventName: K,\n eventTopic: string,\n ...args: RequestMap[K]['args']\n ): RequestMap[K]['returns'] | undefined;\n requestForTopic<T>(\n eventName: string,\n eventTopic: string,\n ...args: unknown[]\n ): T | undefined;\n requestForTopic(\n eventName: string,\n eventTopic: string,\n ...args: unknown[]\n ): unknown {\n return this._callResponder(eventName, eventTopic, args);\n }\n\n private _getRequestResponders(\n eventName: string,\n eventTopic?: string\n ): TRequestResponder[] {\n if (eventTopic) {\n eventName = `${eventName}:${eventTopic}`;\n }\n if (!this.requestResponders.has(eventName)) {\n this.requestResponders.set(eventName, []);\n }\n return this.requestResponders.get(eventName) as TRequestResponder[];\n }\n\n private _callResponder<T>(\n eventName: string,\n eventTopic: string | undefined,\n args: unknown[]\n ): T | undefined {\n const responders = this._getRequestResponders(eventName, eventTopic);\n if (responders.length === 0) {\n return undefined;\n }\n // First responder wins\n return responders[0](...args) as T;\n }\n\n _callHandlers(\n eventName: string,\n eventTopic: string | undefined,\n args: any = []\n ): void {\n const handlers = this._getEventHandlers(eventName, eventTopic);\n\n if (handlers) {\n // Iterate snapshots: an interceptor, listener or handler that removes\n // itself (or an earlier one) during dispatch would otherwise make the\n // loop skip the entry that moves into the freed slot. Handlers added\n // during dispatch wait for the next broadcast.\n const interceptors = this._getEventInterceptors(\n eventName,\n eventTopic\n ).slice();\n const listeners = this.eventListeners.slice();\n const snapshot = handlers.slice();\n\n // Each interceptor, listener and handler is isolated: one that throws is\n // reported and the rest still run, so a faulty controller cannot abort\n // dispatch or throw into the engine code that broadcast the event.\n for (const interceptor of interceptors) {\n try {\n args = interceptor.intercept(args);\n } catch (error) {\n this._reportError(error, eventName, eventTopic, 'interceptor');\n }\n }\n\n for (const listener of listeners) {\n try {\n this._watchResult(\n listener.handleEvent(eventName, eventTopic, args),\n eventName,\n eventTopic,\n 'listener'\n );\n } catch (error) {\n this._reportError(error, eventName, eventTopic, 'listener');\n }\n }\n\n const hasArgs = args?.length > 0;\n for (const handler of snapshot) {\n // Skip a handler that an earlier one removed, or that clear() dropped,\n // during this dispatch: its owner may already be detached.\n if (!this._getEventHandlers(eventName, eventTopic).includes(handler)) {\n continue;\n }\n try {\n this._watchResult(\n hasArgs ? handler(...args) : handler(),\n eventName,\n eventTopic,\n 'handler'\n );\n } catch (error) {\n this._reportError(error, eventName, eventTopic, 'handler');\n }\n }\n }\n }\n\n /**\n * Handlers are typed to return void, but async ones return a promise that\n * nobody awaits. Report its rejection like a synchronous throw.\n */\n private _watchResult(\n result: unknown,\n eventName: string,\n eventTopic: string | undefined,\n source: TEventbusErrorSource\n ): void {\n if (result && isPromise(result)) {\n result.then(undefined, error =>\n this._reportError(error, eventName, eventTopic, source)\n );\n }\n }\n\n /**\n * Reports an error a component caught, the same way as a failing handler:\n * `console.error` naming the source, then the `onHandlerError` option with\n * source `'reported'`. Never throws.\n *\n * @param error - The caught error\n * @param context - The reporting component and, if any, the event it was\n * handling\n */\n reportError(error: unknown, context: IEventbusErrorReport): void {\n const {source, eventName} = context;\n const event = eventName ? ` for \"${eventName}\"` : '';\n console.error(`Error reported by ${source}${event}:`, error);\n this._notifyErrorHook(\n error,\n {\n eventName: eventName ?? '',\n eventTopic: undefined,\n source: 'reported',\n reporter: source,\n },\n `${source}${event}`\n );\n }\n\n /**\n * Logs the error with the event name and topic, never the event arguments\n * (they can carry configuration or user data), then passes it to the\n * `onHandlerError` option.\n */\n private _reportError(\n error: unknown,\n eventName: string,\n eventTopic: string | undefined,\n source: TEventbusErrorSource\n ): void {\n const topic = eventTopic ? ` (topic \"${eventTopic}\")` : '';\n console.error(\n `Error in eventbus ${source} for \"${eventName}\"${topic}:`,\n error\n );\n this._notifyErrorHook(\n error,\n {eventName, eventTopic, source},\n `\"${eventName}\"${topic}`\n );\n }\n\n private _notifyErrorHook(\n error: unknown,\n context: IEventbusErrorContext,\n description: string\n ): void {\n if (!this.onHandlerError) {\n return;\n }\n try {\n this.onHandlerError(error, context);\n } catch (hookError) {\n console.error(\n `Error in eventbus onHandlerError for ${description}:`,\n hookError\n );\n }\n }\n}\n","import type { IDOMEventListenerControllerOperationData } from \"@controllers/dom-event-listener-controller.ts\";\nimport type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\n\nexport function DOMEventListenerController(): IControllerMetadata<IDOMEventListenerControllerOperationData> {\n return {\n description: `This controller attaches to the given selected element and adds a DOM event listener for the specified event name that\nexecutes the given actions with the given operation data.\n\nBy default the \\`start\\` operations of the specified actions are executed. To execute the \\`end\\` operations instead,\nprefix the action name with \\`end:\\`.\n\nThe actions receive a copy of \\`actionOperationData\\` plus \\`eventTarget\\` (the event's target) and, for key events,\n\\`eventKey\\` (the \\`KeyboardEvent.key\\`). They run in order, each receiving the operation data the previous one\nreturned. When an action fails, the\nremaining actions are skipped and the failure is reported through the eventbus's \\`reportError\\` (an error naming\nthis controller, the action and the DOM event, with the original error as \\`cause\\`), or logged with\n\\`console.error\\` when the eventbus has no \\`reportError\\`.`,\n dependentProperties: ['selectedElement'],\n properties: {\n eventName: {\n type: 'ParameterType:eventName',\n required: true,\n },\n actions: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n },\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import type { IKeyboardControllerOperationData } from \"@controllers/keyboard-controller.ts\";\nimport type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\n\nexport function KeyboardController(): IControllerMetadata<IKeyboardControllerOperationData> {\n return {\n description: `This controller runs the given actions when one of the given keys is pressed.\n\nBy default the \\`start\\` operations of the specified actions are executed. To execute the \\`end\\` operations instead,\nprefix the action name with \\`end:\\`.\n\nThe actions receive a copy of \\`actionOperationData\\` plus \\`eventTarget\\` (the focused element, or the body when\nnothing has focus) and \\`eventKey\\` (the \\`KeyboardEvent.key\\`). They run in order, each receiving the operation data\nthe previous one returned. When an action fails, the remaining actions are skipped and the failure is reported\nthrough the eventbus's \\`reportError\\`, or logged with \\`console.error\\` when the eventbus has no \\`reportError\\`.\n\nWith \\`scope: 'document'\\` (the default) the keys work while the focus is inside the engine root, or while nothing\nhas focus. With \\`scope: 'element'\\` they only work while the focus is inside the selected element. Presses in\n\\`input\\`, \\`select\\`, \\`textarea\\` and contenteditable elements are ignored, so typing keeps working. A handled press\nhas its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not\nagain for every key repeat.\n\nWhen the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's\nKeyboardStepSource binds (the arrow keys, \\`shift+left\\`/\\`shift+right\\`, \\`home\\` and \\`end\\`), the controller wins: a\npress it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for\nexample outside the selected element with \\`scope: 'element'\\`) still does.\n\nThe keys are bound in the hotkeys-js \\`'all'\\` scope, so they work whatever scope a KeyboardStepSource sets. The\nhotkeys-js global \\`filter\\` still applies. Detaching removes only this controller's handler.`,\n dependentProperties: ['selectedElement'],\n properties: {\n keys: {\n type: 'ParameterType:string',\n required: true,\n },\n actions: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n },\n actionOperationData: {\n type: 'ParameterType:object',\n },\n scope: {\n type: [\n { value: 'document' },\n { value: 'element' }\n ],\n }\n },\n };\n}\n","import type { ILabelControllerMetadata } from \"@controllers/label-controller.ts\";\nimport type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\n\nexport function LabelController(): IControllerMetadata<ILabelControllerMetadata> {\n return {\n description: `This controller attaches to the given selected element and renders the text\nassociated with the given translation key.\n\nTranslations may contain simple inline markup. They are passed through\n\\`sanitizeHtml\\` before insertion, so \\`<br>\\`, \\`<strong>\\`, \\`<em>\\`,\n\\`<span>\\` and http(s)/mailto/relative links render, while scripts, event\nhandlers, \\`javascript:\\` URLs, images, iframes and SVG are removed.\n\nThe controller listens for the \\`language-change\\` event and re-renders the text\nwith the new language after such an event.\n\nUses the rosetta-based locale system via \\`request-translation\\` event.`,\n dependentProperties: ['selectedElement'],\n properties: {\n translationKey: {\n type: 'ParameterType:string',\n required: true,\n },\n attributeName: {\n type: 'ParameterType:string',\n }\n },\n };\n}\n","import type { ILottieControllerMetadata } from \"@controllers/lottie-controller.ts\";\nimport type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\n\nexport function LottieController(): IControllerMetadata<ILottieControllerMetadata> {\n return {\n description: `This controller renders a [lottie-web](https://github.com/airbnb/lottie-web) animation inside the given selected element.\n\nThe url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json\n\nlottie-web is an optional peer dependency. It is loaded with a dynamic\n\\`import()\\` the first time a LottieController attaches, so applications that\nnever use this controller do not need it installed.`,\n properties: {\n url: {\n type: 'ParameterType:url',\n }\n },\n };\n}\n","import type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\nimport type { IMutationObserverControllerMetadata } from \"@controllers/mutation-observer-controller.ts\";\n\nexport function MutationObserverController(): IControllerMetadata<IMutationObserverControllerMetadata> {\n return {\n description: `Controller that observes DOM mutations on a selected element and broadcasts events.\n\nThis controller creates a MutationObserver to monitor DOM changes (attributes, child nodes,\ntext content) on a specified element. All detected mutations are broadcasted through the\nEligius eventbus, enabling reactive behavior in response to DOM changes.\n\nThe controller follows the standard Eligius lifecycle:\n- init(): Store configuration metadata\n- attach(): Create and start the MutationObserver\n- detach(): Disconnect the observer and clean up resources`,\n dependentProperties: ['selectedElement'],\n properties: {\n observeAttributes: {\n type: 'ParameterType:boolean',\n },\n observeChildList: {\n type: 'ParameterType:boolean',\n },\n observeCharacterData: {\n type: 'ParameterType:boolean',\n },\n observeSubtree: {\n type: 'ParameterType:boolean',\n },\n attributeOldValue: {\n type: 'ParameterType:boolean',\n },\n characterDataOldValue: {\n type: 'ParameterType:boolean',\n },\n attributeFilter: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n }\n },\n };\n}\n","import type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\nimport type { INavigationControllerOperationData } from \"@controllers/navigation-controller.ts\";\n\nexport function NavigationController(): IControllerMetadata<INavigationControllerOperationData> {\n return {\n description: `Renders a navigation menu in the selected element and keeps it in sync with\nthe active navigation entry.\n\nActivating a menu item (click, Enter or Space) navigates to its entry:\n- an entry with a \\`timelineUri\\` broadcasts \\`request-timeline-uri\\`\n [timelineUri, position], which the engine handles by switching timelines;\n- an entry without one broadcasts the legacy \\`request-video-url\\`\n [videoUrlIndex, position], which the engine does not handle.\n\nWith \\`autoNext\\`, the next entry is started when the active entry's timeline\ncompletes (\\`timeline-complete\\`) or, for legacy entries, on \\`video-complete\\`.\nWhen the engine switches to a timeline that an entry names\n(\\`timeline-current-timeline-change\\`), that entry becomes the active one.`,\n dependentProperties: ['selectedElement'],\n properties: {\n json: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\nimport type { IProgressbarControllerOperationData } from \"@controllers/progressbar-controller.ts\";\n\nexport function ProgressbarController(): IControllerMetadata<IProgressbarControllerOperationData> {\n return {\n description: `This controller renders a progressbar that displays the progress of the current timeline in the given selected element.\n\nThe current progress as a percentage is rendered in the given text element.`,\n dependentProperties: ['selectedElement', 'textElement'],\n };\n}\n","import type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\nimport type { IRoutingControllerOperationData } from \"@controllers/routing-controller.ts\";\n\nexport function RoutingController(): IControllerMetadata<IRoutingControllerOperationData> {\n return {\n description: `Keeps the browser history in sync with the navigation entries: each entry\ngets a \\`#/<id>/<position>\\` URL, and back/forward navigation requests the\nentry in the URL.\n\nRequests go to the engine as \\`request-timeline-uri\\` for entries with a\n\\`timelineUri\\`, and as the legacy \\`request-video-url\\` otherwise. Before the\nengine switches timelines (\\`before-request-timeline-uri\\`, or the legacy\n\\`before-request-video-url\\`), the current entry is saved with its position.\n\nThis is a work in progress, do not use this yet please....`,\n properties: {\n json: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import type { IControllerMetadata } from \"@controllers/metadata/types.ts\";\nimport type { ISubtitlesControllerOperationData } from \"@controllers/subtitles-controller.ts\";\n\nexport function SubtitlesController(): IControllerMetadata<ISubtitlesControllerOperationData> {\n return {\n description: `This controller shows the subtitle whose duration contains the current\ntimeline position in the selected element, in the current language, and\nre-renders it after a \\`language-change\\` event.\n\nThe starting language is the locale's current language\n(\\`request-current-language\\`); the configured \\`language\\` is only used when\nnothing answers that request.\n\nSubtitle texts may contain simple inline markup. They are passed through\n\\`sanitizeHtml\\` before insertion, so \\`<br>\\`, \\`<i>\\`, \\`<em>\\`,\n\\`<strong>\\` and \\`<span>\\` render, while scripts, event handlers,\n\\`javascript:\\` URLs, images, iframes and SVG are removed.`,\n dependentProperties: ['selectedElement'],\n properties: {\n language: {\n type: 'ParameterType:languagecode',\n },\n subtitleData: {\n type: 'ParameterType:array',\n }\n },\n };\n}\n","export { DOMEventListenerController } from \"@controllers/metadata/dom-event-listener-controller.ts\";\nexport { KeyboardController } from \"@controllers/metadata/keyboard-controller.ts\";\nexport { LabelController } from \"@controllers/metadata/label-controller.ts\";\nexport { LottieController } from \"@controllers/metadata/lottie-controller.ts\";\nexport { MutationObserverController } from \"@controllers/metadata/mutation-observer-controller.ts\";\nexport { NavigationController } from \"@controllers/metadata/navigation-controller.ts\";\nexport { ProgressbarController } from \"@controllers/metadata/progressbar-controller.ts\";\nexport { RoutingController } from \"@controllers/metadata/routing-controller.ts\";\nexport { SubtitlesController } from \"@controllers/metadata/subtitles-controller.ts\";\nexport * from \"@controllers/metadata/types.ts\";\n","import type { IAddClassOperationData } from \"@operation/add-class.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function addClass(): IOperationMetadata<IAddClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IAddControllerToElementOperationData } from \"@operation/add-controller-to-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function addControllerToElement(): IOperationMetadata<IAddControllerToElementOperationData<TOperationData>> {\n return {\n description: `This operation adds the specified controller instance to the given selected element.\n\nThe controller is registered on the element only once \\`init\\` and a synchronous \\`attach\\`\nhave succeeded. When \\`attach\\` returns a promise, the controller is registered before\nthat promise settles (so detaching the element can still reach it) and is removed from\nthe element again when the promise rejects.`,\n category: `Controller`,\n dependentProperties: ['selectedElement', 'controllerInstance'],\n };\n}\n","import type { IAddGlobalsToOperationData } from \"@operation/add-globals-to-operation.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function addGlobalsToOperation(): IOperationMetadata<IAddGlobalsToOperationData> {\n return {\n description: `This operation adds the specified global property names to the current operation data.\nIt finally removes the \\`globalProperties\\` property from the current operation data.\n\nPlain data is copied, so changing it does not change the global store. jQuery objects, DOM\nnodes, functions and class instances (such as controllers) are added by reference.`,\n category: `Data`,\n properties: {\n globalProperties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IAnimateWithClassOperationData } from \"@operation/animate-with-class.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function animateWithClass(): IOperationMetadata<IAnimateWithClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element and assumes that this\nclass triggers an animation on the selected element. It then waits for this animation to complete\nbefore it resolves.\n\nThe class must put the animation on the selected element itself: \\`animationend\\` events that bubble up\nfrom descendants are ignored, and with several selected elements the operation waits for all of them.\nSet \\`includeDescendants\\` to true for a class that only animates descendants; the operation then resolves\non the first \\`animationend\\` from the element or its subtree.\n\nThe operation resolves immediately when the selection is empty, or when the class gives none of the\nselected elements a CSS animation (for example under \\`prefers-reduced-motion: reduce\\`). When an\n\\`animationend\\` event never arrives, for example because the element was hidden or removed while\nanimating, it resolves shortly after the longest computed animation should have ended. An infinite\nanimation is waited for until it is ended by an \\`animationend\\` event.`,\n category: `Animation`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n erased: true\n },\n removeClass: {\n type: 'ParameterType:boolean',\n erased: true\n },\n includeDescendants: {\n type: 'ParameterType:boolean',\n erased: true\n }\n },\n };\n}\n","import type { IAnimateOperationData } from \"@operation/animate.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function animate(): IOperationMetadata<IAnimateOperationData> {\n return {\n description: `This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.\nIt resolves after the animation completes, or immediately when the selected element set is empty.`,\n category: `Animation`,\n dependentProperties: ['selectedElement'],\n properties: {\n animationEasing: {\n type: 'ParameterType:string',\n erased: true\n },\n animationProperties: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n },\n animationDuration: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IAnnounceToScreenReaderOperationData } from \"@operation/announce-to-screen-reader.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function announceToScreenReader(): IOperationMetadata<IAnnounceToScreenReaderOperationData> {\n return {\n description: `Announces a message to screen readers using an ARIA live region.\n\nThe live region (\\`#aria-live-region\\`) is created empty on first use. The region is emptied\nand the message is written 100 milliseconds later, so that a new region\nand a message repeated verbatim are both announced. The message is removed again after 5 seconds.\nA newer announcement replaces a pending one.\n\nThe operation returns at once and does not wait for the message to be written.`,\n category: `Accessibility`,\n properties: {\n message: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n priority: {\n type: [\n { value: 'polite' },\n { value: 'assertive' }\n ],\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function breakForEach(): IOperationMetadata<TOperationData> {\n return {\n description: `This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}\noperation. This operation immediately moves to the loop end index, effectively stopping the loop.\n\nIt can be placed inside a \\`when\\`/\\`otherwise\\`/\\`endWhen\\` block within the loop, to break conditionally.`,\n category: `Control Flow`,\n };\n}\n","import type { IBroadcastEventOperationData } from \"@operation/broadcast-event.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function broadcastEvent(): IOperationMetadata<IBroadcastEventOperationData> {\n return {\n description: `This operation broadcasts the given event through the eventbus, along with the\nevent arguments and optional event topic.`,\n category: `Utility`,\n properties: {\n eventArgs: {\n type: 'ParameterType:array',\n required: true,\n erased: true\n },\n eventTopic: {\n type: 'ParameterType:eventTopic',\n erased: true\n },\n eventName: {\n type: 'ParameterType:eventName',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { ICalcOperationData } from \"@operation/calc.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function calc(): IOperationMetadata<ICalcOperationData> {\n return {\n description: `This operation calculates the given left and right hand operands using the specified operator.\n\n\\`left\\`, \\`right\\` and \\`operator\\` may be property chains (\\`$operationdata.\\`, \\`$globaldata.\\`,\n\\`$scope.\\`). Only these three inputs are resolved; the rest of the operation data is left as\nit is.`,\n category: `Utility`,\n properties: {\n left: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n },\n right: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n },\n operator: {\n type: [\n { value: '+' },\n { value: '-' },\n { value: '*' },\n { value: '/' },\n { value: '%' },\n { value: '**' }\n ],\n required: true,\n erased: true\n }\n },\n outputProperties: {\n calculationResult: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IClearElementOperationData } from \"@operation/clear-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function clearElement(): IOperationMetadata<IClearElementOperationData> {\n return {\n description: `This operation removes all of the children from the given selected element.\n\nControllers attached to the removed children or their descendants (by \\`addControllerToElement\\`)\nare detached first. Controllers on the selected element itself stay attached.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import type { IClearOperationDataOperationData } from \"@operation/clear-operation-data.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function clearOperationData(): IOperationMetadata<IClearOperationDataOperationData> {\n return {\n description: `This operation removes all of the properties on the current operation date.\nOr, if the \\`properties\\` property is set only removes the properties defined by that list.`,\n category: `Data`,\n properties: {\n properties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n erased: true\n }\n },\n };\n}\n","import type { IClearStorageOperationData } from \"@operation/clear-storage.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function clearStorage(): IOperationMetadata<IClearStorageOperationData> {\n return {\n description: `Clears data from browser storage (localStorage or sessionStorage).\n\nIf \\`key\\` is provided, removes only that key. If \\`key\\` is omitted, clears all storage.\nA \\`key\\` that is present but empty, blank or not a string is rejected, so a value resolved\nfrom missing data never wipes the whole storage.`,\n category: `Data`,\n properties: {\n key: {\n type: 'ParameterType:string',\n erased: true\n },\n storageType: {\n type: [\n { value: 'local' },\n { value: 'session' }\n ],\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { ICompareDateOperationData } from \"@operation/compare-date.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function compareDate(): IOperationMetadata<ICompareDateOperationData> {\n return {\n description: `Compares two dates.\ncomparison: -1 (before), 0 (equal), 1 (after)`,\n category: `Date`,\n properties: {\n date1: {\n type: 'ParameterType:string|ParameterType:number|ParameterType:Date',\n required: true,\n erased: true\n },\n date2: {\n type: 'ParameterType:string|ParameterType:number|ParameterType:Date',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n comparison: {\n type: 'ParameterType:number'\n },\n isEqual: {\n type: 'ParameterType:boolean'\n },\n isBefore: {\n type: 'ParameterType:boolean'\n },\n isAfter: {\n type: 'ParameterType:boolean'\n }\n }\n };\n}\n","import type { IConcatenateStringsOperationData } from \"@operation/concatenate-strings.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function concatenateStrings(): IOperationMetadata<IConcatenateStringsOperationData> {\n return {\n description: `Concatenates multiple strings with an optional separator.`,\n category: `String`,\n properties: {\n strings: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n erased: true\n },\n separator: {\n type: 'ParameterType:string',\n erased: true\n }\n },\n outputProperties: {\n result: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function continueForEach(): IOperationMetadata<TOperationData> {\n return {\n description: `This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}\noperation. This operation immediately moves to the next loop index, effectively canceling the rest\nof the operations in the current iteration.\n\nIt can be placed inside a \\`when\\`/\\`otherwise\\`/\\`endWhen\\` block within the loop, to continue conditionally.`,\n category: `Control Flow`,\n };\n}\n","import type { ICreateElementOperationData, TTagNames } from \"@operation/create-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function createElement(): IOperationMetadata<ICreateElementOperationData<TTagNames>> {\n return {\n description: `This operation creates the DOM element described by the given elementName and attributes and assigns\nthe instance to the \\`template\\` property on the current operation data.\n\nThe element is built with DOM APIs: attribute values are set with \\`.attr()\\` and \\`text\\` is set as\ntext content, so neither is parsed as HTML.\n\nValues may be resolved from user data, so nothing that runs script is created: \\`script\\`\nelements, event handler (\\`on*\\`) and \\`srcdoc\\` attributes, and \\`javascript:\\` or \\`vbscript:\\`\nURLs in URL attributes such as \\`href\\`, \\`src\\` and \\`formaction\\` are refused.`,\n category: `DOM`,\n properties: {\n elementName: {\n type: 'ParameterType:htmlElementName',\n required: true,\n erased: true\n },\n text: {\n type: 'ParameterType:string',\n erased: true\n },\n attributes: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n template: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { ICustomFunctionOperationData } from \"@operation/custom-function.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function customFunction(): IOperationMetadata<ICustomFunctionOperationData> {\n return {\n description: `This operation retrieves a custom function defined by the given system name\nand invokes it with the current operation data and eventbus.\n\nThe function is looked up with the \\`request-function\\` event, which the\n\\`EngineFactory\\` answers from its resource importer. Register the function\nwith the \\`EligiusResourceImporter\\` constructor:\n\\`new EligiusResourceImporter({functions: {myFunction}})\\`.\n\nThe function is called with the current operation data as its argument, and with \\`this\\`\nset to a view of the operation scope. Reading a property from \\`this\\` returns it from the\ninnermost scope that has it, so inside a \\`when\\` block in a loop \\`this.currentItem\\`,\n\\`this.loopIndex\\` and \\`this.variables\\` return the loop's and the action's values, the same\nas \\`$scope.\\` chains. Assigning to \\`this\\` (for example \\`this.newIndex\\`) writes to the scope the\noperation runs in.`,\n category: `Utility`,\n properties: {\n systemName: {\n type: 'ParameterType:systemName',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IEndActionOperationData } from \"@operation/end-action.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function endAction(): IOperationMetadata<IEndActionOperationData> {\n return {\n description: `This operation invokes the {@link EndableAction}.end method on the specified action instance.\n\nThe action receives its own copy of the current operation data merged with the action\noperation data. Whatever the action's end operations add, change or remove in that copy stays\nwith the action: once it has completed, this operation continues with the operation data it\nhad before, without the \\`actionOperationData\\` property.`,\n category: `Action`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function endForEach(): IOperationMetadata<TOperationData> {\n return {\n description: `This operation checks if the current loop should end or start the next iteration.`,\n category: `Control Flow`,\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function endWhen(): IOperationMetadata<TOperationData> {\n return {\n description: `This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.`,\n category: `Control Flow`,\n };\n}\n","import type { IExtendControllerOperationData } from \"@operation/extend-controller.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function extendController(): IOperationMetadata<IExtendControllerOperationData> {\n return {\n description: `Extends the current controller with given extension.\n\nThe extension's own properties are copied onto the controller instance.`,\n category: `Controller`,\n dependentProperties: ['controllerInstance'],\n properties: {\n controllerExtension: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IFilterArrayOperationData } from \"@operation/filter-array.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function filterArray(): IOperationMetadata<IFilterArrayOperationData> {\n return {\n description: `Filters an array based on property equality or custom predicate function.\n\nOperates on arrayData passed from previous operations.\nSupports two filtering modes:\n1. Property equality: \\`filterProperty\\` and \\`filterValue\\` to filter by property match\n2. Custom predicate: \\`filterPredicate\\` function for complex filtering logic`,\n category: `Array`,\n dependentProperties: ['arrayData'],\n properties: {\n filterProperty: {\n type: 'ParameterType:string',\n erased: true\n },\n filterValue: {\n type: 'ParameterType:object',\n erased: true\n },\n filterPredicate: {\n type: 'ParameterType:function',\n erased: true\n }\n },\n outputProperties: {\n filteredArray: {\n type: 'ParameterType:array'\n }\n }\n };\n}\n","import type { IFindInArrayOperationData } from \"@operation/find-in-array.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function findInArray(): IOperationMetadata<IFindInArrayOperationData> {\n return {\n description: `Finds the first element in an array matching criteria.\n\nOperates on arrayData passed from previous operations.\nSupports two search modes:\n1. Property equality: \\`findProperty\\` and \\`findValue\\` to find by property match\n2. Custom predicate: \\`findPredicate\\` function for complex search logic\n\nReturns \\`undefined\\` for \\`foundItem\\` and \\`-1\\` for \\`foundIndex\\` if no match found.`,\n category: `Array`,\n dependentProperties: ['arrayData'],\n properties: {\n findProperty: {\n type: 'ParameterType:string',\n erased: true\n },\n findValue: {\n type: 'ParameterType:object',\n erased: true\n },\n findPredicate: {\n type: 'ParameterType:function',\n erased: true\n }\n },\n outputProperties: {\n foundItem: {\n type: 'ParameterType:object'\n },\n foundIndex: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IForEachOperationData } from \"@operation/for-each.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function forEach(): IOperationMetadata<IForEachOperationData> {\n return {\n description: `This operation iterates over the given collection.\n\nEach iteration the current item from the specified collection is\nassigned to the {@link IOperationScope.currentItem |currentItem} property on the {@link IOperationScope |operation scope}.\n\nAt the start of the loop, the associated {@link endForEach} operation is determined and when\nthe last iteration is completed the flow control is set to the index of that operation.\n\nThe {@link continueForEach |continue} and {@link breakForEach |break} operations can be used to control the\nloop iterations.\n\nThe collection is resolved once, when the loop starts, and the loop iterates over a snapshot\nof it. Changing, replacing or removing the source collection inside the loop body does not\nchange the items or the number of iterations of the running loop.`,\n category: `Control Flow`,\n properties: {\n collection: {\n type: 'ParameterType:array|ParameterType:string',\n required: true\n }\n },\n };\n}\n","import type { IFormatDateOperationData } from \"@operation/format-date.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function formatDate(): IOperationMetadata<IFormatDateOperationData> {\n return {\n description: `Formats a date with a simple token pattern, in the local time zone.\n\nSupported tokens (every occurrence is replaced, other characters are kept as is):\n- \\`YYYY\\`: four digit year\n- \\`MM\\`: month, 01-12\n- \\`DD\\`: day of the month, 01-31\n- \\`HH\\`: hours, 00-23\n- \\`mm\\`: minutes, 00-59\n- \\`ss\\`: seconds, 00-59`,\n category: `Date`,\n dependentProperties: ['date'],\n properties: {\n format: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n formattedDate: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IFormatTextOperationData } from \"@operation/format-text.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function formatText(): IOperationMetadata<IFormatTextOperationData> {\n return {\n description: `Transforms text using format operations: uppercase, lowercase, capitalize, titlecase, or trim.\n\nOperates on textContent passed from previous operations (e.g., getTextContent).\n\nTransformations:\n- \\`uppercase\\`: Convert all characters to uppercase\n- \\`lowercase\\`: Convert all characters to lowercase\n- \\`capitalize\\`: Capitalize only the first letter\n- \\`titlecase\\`: Capitalize first letter of each word\n- \\`trim\\`: Remove leading and trailing whitespace`,\n category: `Text`,\n dependentProperties: ['textContent'],\n properties: {\n transformation: {\n type: [\n { value: 'uppercase' },\n { value: 'lowercase' },\n { value: 'capitalize' },\n { value: 'titlecase' },\n { value: 'trim' }\n ],\n required: true,\n erased: true\n }\n },\n outputProperties: {\n formattedText: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IGetAttributesFromElementOperationData } from \"@operation/get-attributes-from-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getAttributesFromElement(): IOperationMetadata<IGetAttributesFromElementOperationData> {\n return {\n description: `This operation retrieves the values for the specified attribute names from the given selected element.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributeNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n attributeValues: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetControllerFromElementOperationData } from \"@operation/get-controller-from-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getControllerFromElement(): IOperationMetadata<IGetControllerFromElementOperationData> {\n return {\n description: `This operation retrieves the controller instance with the specified name that is assigned to the given selected element.`,\n category: `Controller`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetControllerInstanceOperationData } from \"@operation/get-controller-instance.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getControllerInstance(): IOperationMetadata<IGetControllerInstanceOperationData> {\n return {\n description: `This operation retrieves an instance of the given controller name.\nIt assigns this instance to the \\`controllerInstance\\` property on the current operation data`,\n category: `Controller`,\n properties: {\n systemName: {\n type: 'ParameterType:controllerName',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetCurrentTimeOperationData } from \"@operation/get-current-time.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getCurrentTime(): IOperationMetadata<IGetCurrentTimeOperationData> {\n return {\n description: `Gets the current time as timestamp and Date object.`,\n category: `Date`,\n outputProperties: {\n timestamp: {\n type: 'ParameterType:number'\n },\n date: {\n type: 'ParameterType:Date'\n }\n }\n };\n}\n","import type { IGetElementDimensionsOperationData } from \"@operation/get-element-dimensions.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getElementDimensions(): IOperationMetadata<IGetElementDimensionsOperationData> {\n return {\n description: `This operation calculates the width and height of the given selected element.\nIt assigns this struct to the dimensions property on the current operation data.\nOptionally the width and height can be modified using the given modifier string.\n\nThe modifier string is formatted in the following way:\n\n<operator><amount><optional-side><optional-precentage>|<ratio-definition>\n\nWhere the ratio modifier is formatted in the following way:\n<side>[ar=<ratio-left>-<ratio-right>]\n\nFor example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\nit will add a value of 100 to the height and modify the width by a ratio of 8 to 1 relative to the height.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n modifier: {\n type: 'ParameterType:dimensionsModifier',\n erased: true\n }\n },\n outputProperties: {\n dimensions: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetFocusedElementOperationData } from \"@operation/get-focused-element.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getFocusedElement(): IOperationMetadata<IGetFocusedElementOperationData> {\n return {\n description: `Gets the currently focused element.`,\n category: `Focus`,\n outputProperties: {\n focusedElement: {\n type: 'ParameterType:jQuery'\n }\n }\n };\n}\n","import type { IGetFormDataOperationData } from \"@operation/get-form-data.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getFormData(): IOperationMetadata<IGetFormDataOperationData> {\n return {\n description: `Extracts all input, select, and textarea values from form element into operation data.\n\nThis operation reads form field values and returns them as an object with field names as keys.\nOnly processes form elements that are enabled and not hidden. Handles checkboxes, radio buttons,\nselect elements, textareas, and text inputs.`,\n category: `Form`,\n dependentProperties: ['selectedElement'],\n outputProperties: {\n formData: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetImportOperationData } from \"@operation/get-import.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getImport(): IOperationMetadata<IGetImportOperationData> {\n return {\n description: `This operation retrieves the import specified by the given \\`systemName\\` and\nassigns it to the \\`importedInstance\\` property on the current operaton date.\n\nThe import is looked up with the \\`request-function\\` event, which the\n\\`EngineFactory\\` answers from its resource importer. Functions, templates\nand JSON registered with the \\`EligiusResourceImporter\\` constructor\n(\\`new EligiusResourceImporter({json: {settings}})\\`) can be imported this\nway, as can every built-in operation, controller and provider export.`,\n category: `Utility`,\n properties: {\n systemName: {\n type: 'ParameterType:systemName',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n importedInstance: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetQueryParamsOperationData } from \"@operation/get-query-params.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData> {\n return {\n description: `This operation retrieves the current query parameters from the browser's address bar and places\nthem on the returned operation data.`,\n category: `Utility`,\n properties: {\n defaultValues: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n queryParams: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IGetScrollPositionOperationData } from \"@operation/get-scroll-position.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getScrollPosition(): IOperationMetadata<IGetScrollPositionOperationData> {\n return {\n description: `Gets the current scroll position of the viewport.\n\nReturns x (horizontal) and y (vertical) scroll positions in pixels.\nUses cross-browser compatible methods to retrieve scroll position.`,\n category: `Scroll`,\n outputProperties: {\n scrollX: {\n type: 'ParameterType:number'\n },\n scrollY: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IGetTextContentOperationData } from \"@operation/get-text-content.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function getTextContent(): IOperationMetadata<IGetTextContentOperationData> {\n return {\n description: `Extracts text content from element, stripping all HTML markup.\n\nUses jQuery's \\`.text()\\` method which is XSS-safe and returns only the text content\nwithout any HTML tags. Preserves whitespace and text from nested elements.`,\n category: `Text`,\n dependentProperties: ['selectedElement'],\n outputProperties: {\n textContent: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IHttpDeleteOperationData } from \"@operation/http-delete.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function httpDelete(): IOperationMetadata<IHttpDeleteOperationData> {\n return {\n description: `Performs an HTTP DELETE request to the specified URL.`,\n category: `HTTP`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n headers: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n response: {\n type: 'ParameterType:object'\n },\n status: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IHttpPostOperationData } from \"@operation/http-post.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function httpPost(): IOperationMetadata<IHttpPostOperationData> {\n return {\n description: `Performs an HTTP POST request to the specified URL.\n\nThe body is sent as JSON with \\`Content-Type: application/json\\`, unless the caller's headers set\nanother content type (header names are case-insensitive). With a non-JSON content type, a string\nbody is sent as is; other bodies are still JSON encoded.`,\n category: `HTTP`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n body: {\n type: 'ParameterType:object',\n erased: true\n },\n headers: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n response: {\n type: 'ParameterType:object'\n },\n status: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IHttpPutOperationData } from \"@operation/http-put.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function httpPut(): IOperationMetadata<IHttpPutOperationData> {\n return {\n description: `Performs an HTTP PUT request to the specified URL.\n\nThe body is sent as JSON with \\`Content-Type: application/json\\`, unless the caller's headers set\nanother content type (header names are case-insensitive). With a non-JSON content type, a string\nbody is sent as is; other bodies are still JSON encoded.`,\n category: `HTTP`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n body: {\n type: 'ParameterType:object',\n erased: true\n },\n headers: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n response: {\n type: 'ParameterType:object'\n },\n status: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IInvokeObjectMethodOperationData } from \"@operation/invoke-object-method.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData> {\n return {\n description: `This operation invokes the specified method on the given object with the given optional arguments\nand assigns the result to the \\`methodResult\\` operationdata property. When the method returns a\npromise, the operation waits for it and assigns the resolved value.\n\nThe operation only calls application code: methods of controllers, of other instances of\napplication classes, and of plain objects. It refuses, and throws for:\n- an \\`instance\\` that is a function, the global object (\\`window\\`), a document, a DOM node,\n a jQuery object, or any other built-in or host object (arrays, maps, promises, \\`location\\`,\n storage, ...);\n- a method that is a built-in (native) function, such as \\`eval\\`, \\`Function\\`, \\`setTimeout\\`,\n \\`setInterval\\`, \\`document.write\\`, \\`Reflect.apply\\` or a bound function, or a jQuery function;\n- the method names \\`constructor\\`, \\`__proto__\\` and \\`prototype\\`;\n- arguments that are such functions.\n\nThese checks stop configuration from reaching the platform's code-executing functions through\nthis operation. They cannot vouch for what an application method does with its arguments, so\nonly expose methods that are safe to call with configured data.`,\n category: `Utility`,\n dependentProperties: ['instance'],\n properties: {\n methodName: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n methodArguments: {\n type: 'ParameterType:array',\n erased: true\n }\n },\n outputProperties: {\n methodResult: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IIsElementInViewportOperationData } from \"@operation/is-element-in-viewport.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function isElementInViewport(): IOperationMetadata<IIsElementInViewportOperationData> {\n return {\n description: `Checks if an element is currently visible within the viewport.\n\nUses \\`getBoundingClientRect()\\` to determine if the element is within the viewport boundaries.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n outputProperties: {\n isInViewport: {\n type: 'ParameterType:boolean'\n }\n }\n };\n}\n","import type { ILoadFromStorageOperationData } from \"@operation/load-from-storage.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function loadFromStorage(): IOperationMetadata<ILoadFromStorageOperationData> {\n return {\n description: `Loads data from browser storage (localStorage or sessionStorage).\n\nDeserializes the stored JSON value. Returns \\`null\\` if key doesn't exist.\nWhen \\`storageType\\` is omitted, localStorage is used.`,\n category: `Data`,\n properties: {\n key: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n storageType: {\n type: [\n { value: 'local' },\n { value: 'session' }\n ],\n required: true,\n erased: true\n }\n },\n outputProperties: {\n loadedValue: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { ILoadJSONOperationData } from \"@operation/load-json.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function loadJson(): IOperationMetadata<ILoadJSONOperationData> {\n return {\n description: `This operation loads a JSON file from the specified url and assigns it to the json\nproperty on the current operation data.\n\nIf the cache property is set to true and a cached value already exists, a copy of it is assigned\ninstead of re-retrieving it from the url. Mutating the returned json never changes the cache.\n\nThe cache is shared by every engine. It is emptied when the last live engine created by\n\\`EngineFactory\\` is destroyed; call {@link clearJsonCache} to empty it earlier.`,\n category: `Utility`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n cache: {\n type: 'ParameterType:boolean',\n erased: true\n }\n },\n outputProperties: {\n json: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { ILogOperationData } from \"@operation/log.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function log(): IOperationMetadata<ILogOperationData> {\n return {\n description: `This operation logs the specified value, or, when no logValue property has been assigned\nit will log the current operation data, global data and scope to the console`,\n category: `Utility`,\n properties: {\n logValue: {\n type: 'ParameterType:object|ParameterType:string|ParameterType:number|ParameterType:boolean|ParameterType:array',\n erased: true\n },\n logName: {\n type: 'ParameterType:string',\n erased: true\n }\n },\n };\n}\n","import type { IMapArrayOperationData } from \"@operation/map-array.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function mapArray(): IOperationMetadata<IMapArrayOperationData> {\n return {\n description: `Transforms each element of an array using a mapping function.\n\nOperates on arrayData passed from previous operations.\nThe mapFunction receives each item and optionally its index.`,\n category: `Array`,\n dependentProperties: ['arrayData'],\n properties: {\n mapFunction: {\n type: 'ParameterType:function',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n mappedArray: {\n type: 'ParameterType:array'\n }\n }\n };\n}\n","import type { IMathOperationData } from \"@operation/math.ts\";\nimport type { IOperationMetadata } from \"@operation/metadata/types.ts\";\n\nexport function math(): IOperationMetadata<IMathOperationData> {\n return {\n description: `This operation performs the given math function with the specified arguments.\n\n\\`args\\` and \\`functionName\\` may contain property chains (\\`$operationdata.\\`, \\`$globaldata.\\`,\n\\`$scope.\\`). Only these two inputs are resolved; the rest of the operation data is left as it\nis. Arguments that name a Math constant (such as \\`'PI'\\`) are replaced by its value.`,\n category: `Utility`,\n properties: {\n args: {\n type: 'ParameterType:array',\n required: true,\n erased: true\n },\n functionName: {\n type: 'ParameterType:mathfunction',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n mathResult: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { TOperationData } from \"@operation/types.ts\";\n\nexport function otherwise(): IOperationMetadata<TOperationData> {\n return {\n description: `If the preceeding {@link when} operation evaluates to \\`true\\` subsequent operations will\nbe skipped until an {@link endWhen} operation is encountered.`,\n category: `Control Flow`,\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IRemoveClassOperationData } from \"@operation/remove-class.ts\";\n\nexport function removeClass(): IOperationMetadata<IRemoveClassOperationData> {\n return {\n description: `This operation removes the spcified class name from the given selected element.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IRemoveControllerFromElementOperationData } from \"@operation/remove-controller-from-element.ts\";\n\nexport function removeControllerFromElement(): IOperationMetadata<IRemoveControllerFromElementOperationData> {\n return {\n description: `This operation removes the controller with the specified name from the given selected element.`,\n category: `Controller`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IRemoveElementOperationData } from \"@operation/remove-element.ts\";\n\nexport function removeElement(): IOperationMetadata<IRemoveElementOperationData> {\n return {\n description: `This operation removes the given selected element from the DOM.\n\nControllers attached to the element or its descendants (by \\`addControllerToElement\\`) are\ndetached first, so their eventbus and window listeners do not outlive the element.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IRemovePropertiesFromOperationDataOperationData } from \"@operation/remove-properties-from-operation-data.ts\";\n\nexport function removePropertiesFromOperationData(): IOperationMetadata<IRemovePropertiesFromOperationDataOperationData> {\n return {\n description: `This operation removes the given list of properties from the current operation data.\nIt will also remove the property \\`propertyNames\\` from the result.`,\n category: `Data`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IReparentElementOperationData } from \"@operation/reparent-element.ts\";\n\nexport function reparentElement(): IOperationMetadata<IReparentElementOperationData> {\n return {\n description: `This operation moves the given selected element to the new parent that is defined\nby the specified \\`newParentSelector\\`. jQuery data, event handlers and attached controllers\nare preserved.\n\nThe selector is resolved inside the engine root (the root itself included), the same way\n\\`selectElement\\` resolves its selector, and must match exactly one element. HTML strings are\nnot accepted.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n newParentSelector: {\n type: 'ParameterType:selector',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IReplaceStringOperationData } from \"@operation/replace-string.ts\";\n\nexport function replaceString(): IOperationMetadata<IReplaceStringOperationData> {\n return {\n description: `Replaces occurrences of a pattern in a string (alias for replaceText for string context).\n\nLike replaceText, a string pattern replaces every occurrence and inserts the replacement\nliterally (\\`$&\\`, \\`$1\\` and similar are not expanded). A RegExp pattern follows\n\\`String.prototype.replace\\`: only a global RegExp replaces every match, and \\`$\\` patterns\nin the replacement are expanded. Unlike replaceText, the result is written to \\`result\\`\nand \\`textContent\\` is left unchanged.`,\n category: `String`,\n dependentProperties: ['textContent'],\n properties: {\n pattern: {\n type: 'ParameterType:string|ParameterType:RegExp',\n required: true,\n erased: true\n },\n replacement: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n result: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IReplaceTextOperationData } from \"@operation/replace-text.ts\";\n\nexport function replaceText(): IOperationMetadata<IReplaceTextOperationData> {\n return {\n description: `Finds and replaces text using literal string or regex pattern.\n\nOperates on textContent passed from previous operations (e.g., getTextContent).\nSupports regex patterns with global flag for multiple replacements.\nUpdates textContent with replaced text and sets replacementCount.\n\nA string pattern replaces every occurrence and inserts the replacement literally.`,\n category: `Text`,\n dependentProperties: ['textContent'],\n properties: {\n searchPattern: {\n type: 'ParameterType:string|ParameterType:RegExp',\n required: true,\n erased: true\n },\n replacement: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n replacementCount: {\n type: 'ParameterType:number'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IRequestActionOperationData } from \"@operation/request-action.ts\";\n\nexport function requestAction(): IOperationMetadata<IRequestActionOperationData> {\n return {\n description: `This operation requests an action instance with the specified name and assigns it\nto the \\`actionInstance\\` property on the current operation data.`,\n category: `Action`,\n properties: {\n systemName: {\n type: 'ParameterType:actionName',\n required: true,\n erased: true\n }\n },\n outputProperties: {\n actionInstance: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISaveToStorageOperationData } from \"@operation/save-to-storage.ts\";\n\nexport function saveToStorage(): IOperationMetadata<ISaveToStorageOperationData> {\n return {\n description: `Saves data to browser storage (localStorage or sessionStorage).\n\nSerializes the value as JSON before storing. Supports any JSON-serializable data type.\nUse \\`null\\` to store an empty value; \\`undefined\\` cannot be stored as JSON and is rejected.\nWhen \\`storageType\\` is omitted, localStorage is used.`,\n category: `Data`,\n properties: {\n key: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n value: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n },\n storageType: {\n type: [\n { value: 'local' },\n { value: 'session' }\n ],\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IScrollToElementOperationData } from \"@operation/scroll-to-element.ts\";\n\nexport function scrollToElement(): IOperationMetadata<IScrollToElementOperationData> {\n return {\n description: `Scrolls the viewport to bring the selected element into view.\n\nUses the browser's \\`scrollIntoView\\` API with configurable behavior.`,\n category: `Scroll`,\n dependentProperties: ['selectedElement'],\n properties: {\n behavior: {\n type: [\n { value: 'auto' },\n { value: 'smooth' }\n ],\n erased: true\n },\n block: {\n type: [\n { value: 'start' },\n { value: 'center' },\n { value: 'end' },\n { value: 'nearest' }\n ],\n erased: true\n },\n inline: {\n type: [\n { value: 'start' },\n { value: 'center' },\n { value: 'end' },\n { value: 'nearest' }\n ],\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IScrollToPositionOperationData } from \"@operation/scroll-to-position.ts\";\n\nexport function scrollToPosition(): IOperationMetadata<IScrollToPositionOperationData> {\n return {\n description: `Scrolls the viewport to a specific x,y coordinate position.\n\nUses the browser's \\`window.scrollTo\\` API with configurable behavior.`,\n category: `Scroll`,\n properties: {\n x: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n },\n y: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n },\n behavior: {\n type: [\n { value: 'auto' },\n { value: 'smooth' }\n ],\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISelectElementOperationData } from \"@operation/select-element.ts\";\n\nexport function selectElement(): IOperationMetadata<ISelectElementOperationData> {\n return {\n description: `This operation selects one or more elements using the specified selector.\n\nIf \\`useSelectedElementAsRoot\\` is set to true and a valid DOM element is assigned\nto the current operation data's \\`selectedElement\\` property\nthen the element will be looked for only in the descendant elements of this DOM element.`,\n category: `DOM`,\n properties: {\n selector: {\n type: 'ParameterType:selector',\n required: true,\n erased: true\n },\n useSelectedElementAsRoot: {\n type: 'ParameterType:boolean',\n erased: true\n }\n },\n outputProperties: {\n selectedElement: {\n type: 'ParameterType:object'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetDataOperationData } from \"@operation/set-data.ts\";\n\nexport function setData(): IOperationMetadata<ISetDataOperationData> {\n return {\n description: `This operation assigns the specified properties to the specified data targets.`,\n category: `Data`,\n properties: {\n properties: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetElementAttributesOperationData } from \"@operation/set-element-attributes.ts\";\n\nexport function setElementAttributes(): IOperationMetadata<ISetElementAttributesOperationData> {\n return {\n description: `This operation sets the specified set of attributes on the given selected element.\n\nEvent handler (\\`on*\\`) and \\`srcdoc\\` attributes, and \\`javascript:\\` or \\`vbscript:\\` URLs in URL\nattributes such as \\`href\\`, \\`src\\` and \\`formaction\\`, are refused, the same as in \\`createElement\\`.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributes: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetElementContentOperationData } from \"@operation/set-element-content.ts\";\n\nexport function setElementContent(): IOperationMetadata<ISetElementContentOperationData> {\n return {\n description: `This operation sets the specified content defined by the value assigned to the template property\nto the given selected element.\n\nWhen the \\`insertionType\\` is set to \\`overwrite\\` the contents of the selected element are replaced\nby the given template.\nWhen set to \\`append\\` the new content will be inserted after the current content.\nWhen set to \\`prepend\\` the new content will be inserted before the current content.\n\nWith \\`overwrite\\`, controllers attached to the replaced content (by \\`addControllerToElement\\`) are\ndetached first. Controllers on the selected element itself stay attached.\n\nThe template is inserted as HTML: a string template is parsed by jQuery, which also runs the\nscripts and inline event handlers it contains. Only use string templates from the configuration\nor the resource importer; build content from user data with \\`createElement\\`, whose \\`text\\` is\nnever parsed as HTML.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n template: {\n type: 'ParameterType:string|ParameterType:Element|ParameterType:Text|ParameterType:Comment|ParameterType:Document|ParameterType:DocumentFragment',\n erased: true\n },\n insertionType: {\n type: [\n { value: 'overwrite' },\n { value: 'append' },\n { value: 'prepend' }\n ],\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetFocusOperationData } from \"@operation/set-focus.ts\";\n\nexport function setFocus(): IOperationMetadata<ISetFocusOperationData> {\n return {\n description: `Sets focus to the selected element.`,\n category: `Focus`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetFormValueOperationData } from \"@operation/set-form-value.ts\";\n\nexport function setFormValue(): IOperationMetadata<ISetFormValueOperationData> {\n return {\n description: `Sets the value of an input, select, or textarea element.\n\nHandles different input types appropriately:\n- Text inputs, textareas, selects: sets value directly\n- Checkboxes: sets checked property for boolean values\n- Radio buttons: sets checked property for boolean values\n- Number inputs: converts to string`,\n category: `Form`,\n dependentProperties: ['selectedElement'],\n properties: {\n value: {\n type: 'ParameterType:string|ParameterType:number|ParameterType:boolean',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetGlobalDataOperationData } from \"@operation/set-global-data.ts\";\n\nexport function setGlobalData(): IOperationMetadata<ISetGlobalDataOperationData> {\n return {\n description: `This operation copies the specified properties from the operationData to the global data.\n\nPlain data is stored as a deep copy, so changing the operation data afterwards does not change\nthe global data. jQuery objects, DOM nodes, functions and class instances (such as controllers)\nare stored by reference.`,\n category: `Data`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetOperationData } from \"@operation/set-operation-data.ts\";\n\nexport function setOperationData(): IOperationMetadata<ISetOperationData> {\n return {\n description: `This operation assigns the specified properties to the current operation data.\nWhen override is set to true the properties replace the current operation data entirely.`,\n category: `Data`,\n properties: {\n override: {\n type: 'ParameterType:boolean',\n erased: true\n },\n properties: {\n type: 'ParameterType:object',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetStyleOperationData } from \"@operation/set-style.ts\";\n\nexport function setStyle(): IOperationMetadata<ISetStyleOperationData> {\n return {\n description: `This operation assigns the specified CSS style properties to the\ngiven selected element.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n properties: {\n type: 'ParameterType:cssProperties',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISetVariableOperationData } from \"@operation/set-variable.ts\";\n\nexport function setVariable(): IOperationMetadata<ISetVariableOperationData> {\n return {\n description: `This operation sets a variable with the specified name on the scope with the specified value.\n\nVariables belong to the action: a variable set inside a \\`when\\` or \\`forEach\\` block is the\nsame variable outside it, so it keeps its value after \\`endWhen\\` or \\`endForEach\\`, and\nvariables set before the block can be read and changed inside it. Read variables with\n\\`$scope.variables.<name>\\`.`,\n category: `Data`,\n properties: {\n name: {\n type: 'ParameterType:string',\n required: true,\n erased: true\n },\n value: {\n type: 'ParameterType:object|ParameterType:string|ParameterType:number|ParameterType:boolean|ParameterType:array',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISortArrayOperationData } from \"@operation/sort-array.ts\";\n\nexport function sortArray(): IOperationMetadata<ISortArrayOperationData> {\n return {\n description: `Sorts an array by property, natural order, or custom comparator function.\n\nOperates on arrayData passed from previous operations.\nSupports three sorting modes:\n1. Property sort: \\`sortProperty\\` and \\`sortOrder\\` to sort objects by property\n2. Natural sort: \\`sortOrder\\` alone for primitive arrays\n3. Custom comparator: \\`sortComparator\\` function for complex sorting logic`,\n category: `Array`,\n dependentProperties: ['arrayData'],\n properties: {\n sortProperty: {\n type: 'ParameterType:string',\n erased: true\n },\n sortOrder: {\n type: [\n { value: 'asc' },\n { value: 'desc' }\n ],\n erased: true\n },\n sortComparator: {\n type: 'ParameterType:function',\n erased: true\n }\n },\n outputProperties: {\n sortedArray: {\n type: 'ParameterType:array'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISplitStringOperationData } from \"@operation/split-string.ts\";\n\nexport function splitString(): IOperationMetadata<ISplitStringOperationData> {\n return {\n description: `Splits a string into an array by delimiter (string or regex).`,\n category: `String`,\n dependentProperties: ['textContent'],\n properties: {\n delimiter: {\n type: 'ParameterType:string|ParameterType:RegExp',\n required: true,\n erased: true\n },\n limit: {\n type: 'ParameterType:number',\n erased: true\n }\n },\n outputProperties: {\n resultArray: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IStartActionOperationData } from \"@operation/start-action.ts\";\n\nexport function startAction(): IOperationMetadata<IStartActionOperationData> {\n return {\n description: `This operation starts the specified action instance using the given action operation data.\n\nThe action receives its own copy of the current operation data merged with the action\noperation data. Whatever the action's operations add, change or remove in that copy stays\nwith the action: once it has completed, this operation continues with the operation data it\nhad before, plus \\`actionInstance\\`, without the \\`actionOperationData\\` property.`,\n category: `Action`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { ISubstringTextOperationData } from \"@operation/substring-text.ts\";\n\nexport function substringText(): IOperationMetadata<ISubstringTextOperationData> {\n return {\n description: `Extracts a substring from text between start and end indices.`,\n category: `Text`,\n dependentProperties: ['textContent'],\n properties: {\n start: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n },\n end: {\n type: 'ParameterType:number',\n erased: true\n }\n },\n outputProperties: {\n substring: {\n type: 'ParameterType:string'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IToggleClassOperationData } from \"@operation/toggle-class.ts\";\n\nexport function toggleClass(): IOperationMetadata<IToggleClassOperationData> {\n return {\n description: `This operation toggles the specfied class name on the given selected element.\n\nMeaning, if the specified class name exists on the given element it will be removed,\notherwise it will be added.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IToggleElementOperationData } from \"@operation/toggle-element.ts\";\n\nexport function toggleElement(): IOperationMetadata<IToggleElementOperationData> {\n return {\n description: `This operation toggles the visibility of the given selected element.\n\nMeaning, if the element is hidden, it will be made visible, otherwise\nit will be hidden.`,\n category: `DOM`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IToggleFormElementOperationData } from \"@operation/toggle-form-element.ts\";\n\nexport function toggleFormElement(): IOperationMetadata<IToggleFormElementOperationData> {\n return {\n description: `Enables or disables form input elements (inputs, selects, textareas, buttons).\n\nSets the \\`disabled\\` property on the element. When \\`enabled\\` is true, removes the disabled\nattribute; when false, adds the disabled attribute.`,\n category: `Form`,\n dependentProperties: ['selectedElement'],\n properties: {\n enabled: {\n type: 'ParameterType:boolean',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IValidateFormOperationData } from \"@operation/validate-form.ts\";\n\nexport function validateForm(): IOperationMetadata<IValidateFormOperationData> {\n return {\n description: `Validates form fields against HTML5 validation and custom rules.\n\nUses HTML5 validation API (checkValidity()) for native validation, and supports\ncustom validation rules for: required, minLength, maxLength, pattern (regex), and email format.\n\nCheckboxes and radio buttons are validated once per name: \\`required\\` passes when at least one\nof them is checked, and the string rules do not apply to them. For a \\`<select multiple>\\`,\n\\`required\\`, \\`minLength\\` and \\`maxLength\\` count the selected options, and \\`pattern\\` and \\`email\\`\napply to each selected value.`,\n category: `Form`,\n dependentProperties: ['selectedElement'],\n properties: {\n validationRules: {\n type: 'ParameterType:object',\n erased: true\n }\n },\n outputProperties: {\n validationErrors: {\n type: 'ParameterType:object'\n },\n isValid: {\n type: 'ParameterType:boolean'\n }\n }\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IWaitOperationData } from \"@operation/wait.ts\";\n\nexport function wait(): IOperationMetadata<IWaitOperationData> {\n return {\n description: `This operation waits for the specified amount of milliseconds.`,\n category: `Utility`,\n properties: {\n milliseconds: {\n type: 'ParameterType:number',\n required: true,\n erased: true\n }\n },\n };\n}\n","import type { IOperationMetadata } from \"@operation/metadata/types.ts\";\nimport type { IWhenOperationData } from \"@operation/when.ts\";\n\nexport function when(): IOperationMetadata<IWhenOperationData> {\n return {\n description: `When the given expression evaluates to false, subsequent operations will be skipped\nuntil an {@link endWhen} or {@link otherwise} operation is encountered.\n\nPractically, this means an \\`if\\` or \\`if\\`/\\`else\\` statement control flow implementation in a list of operations.\n\nThe expression is passed in as a formatted string. An operand can be one of:\n\n'constant': for a constant string (operators and parentheses inside the quotes are text)\n100: for a constant number (the whole operand must be numeric, \\`10px\\` is invalid)\ntrue, false, null: for a boolean or null constant\n$operationData.foo: for an operation data value\n$globaldata.foo: for a global data value\n$scope.loopIndex: for a scope value\n$scope.variables.foo: for a variable set with \\`setVariable\\`\n\nAny other operand is an error, so a misspelled chain prefix fails instead of being compared\nas a string.\n\nOperands are combined with these operators, from highest to lowest precedence:\n\n\\`!\\`: negation\n\\`==\\`, \\`!=\\`, \\`>\\`, \\`<\\`, \\`>=\\`, \\`<=\\`: comparison (\\`==\\` and \\`!=\\` compare strictly, without type\nconversion; comparisons do not chain, so write \\`0<$scope.loopIndex && $scope.loopIndex<5\\`)\n\\`&&\\`: and\n\\`||\\`: or\n\nParentheses group. A bare operand is true when its value is truthy, so \\`'false'\\` and \\`'0'\\`\nare true and \\`0\\`, \\`''\\`, \\`null\\` and a missing value are false. \\`!\\`, \\`&&\\` and \\`||\\` always\nproduce \\`true\\` or \\`false\\`. \\`!\\` binds tighter than a comparison: \\`!$operationdata.a==1\\`\ncompares \\`!$operationdata.a\\` with 1, write \\`!($operationdata.a==1)\\` to negate the comparison.\n\\`&&\\` and \\`||\\` short-circuit: when the left side decides the result, the right side is not\nresolved, so \\`$operationdata.user && $operationdata.user.name=='John'\\` does not fail when\n\\`user\\` is missing.\n\nArithmetic (\\`+\\`, \\`-\\`, \\`*\\`, \\`/\\`) is not supported: \\`-\\` is a valid character in a property\nchain, so \\`$operationdata.a-1\\` would be ambiguous. Nothing in the expression is executed as\ncode, and property chains are resolved with the usual prototype-pollution and global-object\nguards.`,\n category: `Control Flow`,\n properties: {\n expression: {\n type: 'ParameterType:expression',\n required: true,\n erased: true\n }\n },\n };\n}\n","export { addClass } from \"@operation/metadata/add-class.ts\";\nexport { addControllerToElement } from \"@operation/metadata/add-controller-to-element.ts\";\nexport { addGlobalsToOperation } from \"@operation/metadata/add-globals-to-operation.ts\";\nexport { animateWithClass } from \"@operation/metadata/animate-with-class.ts\";\nexport { animate } from \"@operation/metadata/animate.ts\";\nexport { announceToScreenReader } from \"@operation/metadata/announce-to-screen-reader.ts\";\nexport { breakForEach } from \"@operation/metadata/break-for-each.ts\";\nexport { broadcastEvent } from \"@operation/metadata/broadcast-event.ts\";\nexport { calc } from \"@operation/metadata/calc.ts\";\nexport { clearElement } from \"@operation/metadata/clear-element.ts\";\nexport { clearOperationData } from \"@operation/metadata/clear-operation-data.ts\";\nexport { clearStorage } from \"@operation/metadata/clear-storage.ts\";\nexport { compareDate } from \"@operation/metadata/compare-date.ts\";\nexport { concatenateStrings } from \"@operation/metadata/concatenate-strings.ts\";\nexport { continueForEach } from \"@operation/metadata/continue-for-each.ts\";\nexport { createElement } from \"@operation/metadata/create-element.ts\";\nexport { customFunction } from \"@operation/metadata/custom-function.ts\";\nexport { endAction } from \"@operation/metadata/end-action.ts\";\nexport { endForEach } from \"@operation/metadata/end-for-each.ts\";\nexport { endWhen } from \"@operation/metadata/end-when.ts\";\nexport { extendController } from \"@operation/metadata/extend-controller.ts\";\nexport { filterArray } from \"@operation/metadata/filter-array.ts\";\nexport { findInArray } from \"@operation/metadata/find-in-array.ts\";\nexport { forEach } from \"@operation/metadata/for-each.ts\";\nexport { formatDate } from \"@operation/metadata/format-date.ts\";\nexport { formatText } from \"@operation/metadata/format-text.ts\";\nexport { getAttributesFromElement } from \"@operation/metadata/get-attributes-from-element.ts\";\nexport { getControllerFromElement } from \"@operation/metadata/get-controller-from-element.ts\";\nexport { getControllerInstance } from \"@operation/metadata/get-controller-instance.ts\";\nexport { getCurrentTime } from \"@operation/metadata/get-current-time.ts\";\nexport { getElementDimensions } from \"@operation/metadata/get-element-dimensions.ts\";\nexport { getFocusedElement } from \"@operation/metadata/get-focused-element.ts\";\nexport { getFormData } from \"@operation/metadata/get-form-data.ts\";\nexport { getImport } from \"@operation/metadata/get-import.ts\";\nexport { getQueryParams } from \"@operation/metadata/get-query-params.ts\";\nexport { getScrollPosition } from \"@operation/metadata/get-scroll-position.ts\";\nexport { getTextContent } from \"@operation/metadata/get-text-content.ts\";\nexport { httpDelete } from \"@operation/metadata/http-delete.ts\";\nexport { httpPost } from \"@operation/metadata/http-post.ts\";\nexport { httpPut } from \"@operation/metadata/http-put.ts\";\nexport { invokeObjectMethod } from \"@operation/metadata/invoke-object-method.ts\";\nexport { isElementInViewport } from \"@operation/metadata/is-element-in-viewport.ts\";\nexport { loadFromStorage } from \"@operation/metadata/load-from-storage.ts\";\nexport { loadJson } from \"@operation/metadata/load-json.ts\";\nexport { log } from \"@operation/metadata/log.ts\";\nexport { mapArray } from \"@operation/metadata/map-array.ts\";\nexport { math } from \"@operation/metadata/math.ts\";\nexport { otherwise } from \"@operation/metadata/otherwise.ts\";\nexport { removeClass } from \"@operation/metadata/remove-class.ts\";\nexport { removeControllerFromElement } from \"@operation/metadata/remove-controller-from-element.ts\";\nexport { removeElement } from \"@operation/metadata/remove-element.ts\";\nexport { removePropertiesFromOperationData } from \"@operation/metadata/remove-properties-from-operation-data.ts\";\nexport { reparentElement } from \"@operation/metadata/reparent-element.ts\";\nexport { replaceString } from \"@operation/metadata/replace-string.ts\";\nexport { replaceText } from \"@operation/metadata/replace-text.ts\";\nexport { requestAction } from \"@operation/metadata/request-action.ts\";\nexport { saveToStorage } from \"@operation/metadata/save-to-storage.ts\";\nexport { scrollToElement } from \"@operation/metadata/scroll-to-element.ts\";\nexport { scrollToPosition } from \"@operation/metadata/scroll-to-position.ts\";\nexport { selectElement } from \"@operation/metadata/select-element.ts\";\nexport { setData } from \"@operation/metadata/set-data.ts\";\nexport { setElementAttributes } from \"@operation/metadata/set-element-attributes.ts\";\nexport { setElementContent } from \"@operation/metadata/set-element-content.ts\";\nexport { setFocus } from \"@operation/metadata/set-focus.ts\";\nexport { setFormValue } from \"@operation/metadata/set-form-value.ts\";\nexport { setGlobalData } from \"@operation/metadata/set-global-data.ts\";\nexport { setOperationData } from \"@operation/metadata/set-operation-data.ts\";\nexport { setStyle } from \"@operation/metadata/set-style.ts\";\nexport { setVariable } from \"@operation/metadata/set-variable.ts\";\nexport { sortArray } from \"@operation/metadata/sort-array.ts\";\nexport { splitString } from \"@operation/metadata/split-string.ts\";\nexport { startAction } from \"@operation/metadata/start-action.ts\";\nexport { substringText } from \"@operation/metadata/substring-text.ts\";\nexport { toggleClass } from \"@operation/metadata/toggle-class.ts\";\nexport { toggleElement } from \"@operation/metadata/toggle-element.ts\";\nexport { toggleFormElement } from \"@operation/metadata/toggle-form-element.ts\";\nexport { validateForm } from \"@operation/metadata/validate-form.ts\";\nexport { wait } from \"@operation/metadata/wait.ts\";\nexport { when } from \"@operation/metadata/when.ts\";\nexport * from \"@operation/metadata/types.ts\";\n","import * as controllerMetadata from '@controllers/metadata/index.ts';\nimport * as operationMetadata from '@operation/metadata/index.ts';\n\n/**\n * The names `EligiusResourceImporter` lists, without importing the\n * implementations: the linter must stay free of jquery and lottie-web.\n *\n * Operation and controller names come from the generated metadata. The\n * timeline provider exports have no metadata, so they are listed here, in\n * the order of `src/timelineproviders/index.ts`; the conformance test in\n * `src/test/unit/lint/built-in-names.spec.ts` keeps the three lists equal to\n * what the runtime importer returns.\n */\nexport const builtInOperationNames: readonly string[] =\n Object.keys(operationMetadata);\n\nexport const builtInControllerNames: readonly string[] =\n Object.keys(controllerMetadata);\n\nexport const builtInProviderNames: readonly string[] = [\n 'isSeekable',\n 'BasePositionSource',\n 'KeyboardStepSource',\n 'RafPositionSource',\n 'ScrollPositionSource',\n 'VideoPositionSource',\n 'DomContainerProvider',\n 'SimplePlaylist',\n];\n","import {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\nimport type {IResourceImporter} from '../types.ts';\nimport {\n builtInControllerNames,\n builtInOperationNames,\n builtInProviderNames,\n} from './built-in-names.ts';\nimport type {ILintOptions} from './types.ts';\n\n/**\n * The names the configuration's `template:` and `json:` placeholders ask\n * for, collected before the resolver runs, so the importer knows which kind\n * of value a name stands for.\n */\nexport interface IPlaceholderNames {\n templates: ReadonlySet<string>;\n json: ReadonlySet<string>;\n}\n\nfunction stubOperation(operationData: unknown): unknown {\n return operationData;\n}\n\nfunction stubFunction(): void {}\n\nclass StubController {\n name = 'StubController';\n init(): void {}\n attach(): void {}\n detach(): void {}\n}\n\nclass StubProvider {}\n\n/**\n * Creates the importer the linter runs the real `ConfigurationResolver` with.\n * It serves a stand-in for every built-in and declared name, so the resolver\n * does the same name checks it does at runtime, without loading jquery or\n * lottie-web.\n *\n * @param options - The declared custom resources\n * @param placeholders - The placeholder names found in the configuration\n */\nexport function createLintImporter(\n options: ILintOptions,\n placeholders: IPlaceholderNames\n): IResourceImporter {\n const operations = [\n ...builtInOperationNames,\n ...(options.customOperations ?? []),\n ];\n const controllers = [\n ...builtInControllerNames,\n ...(options.customControllers ?? []),\n ];\n const providers = [\n ...builtInProviderNames,\n ...(options.customProviders ?? []),\n ];\n const functions = [...(options.customFunctions ?? [])];\n const operationSet = new Set(operations);\n const controllerSet = new Set(controllers);\n const providerSet = new Set(providers);\n const functionSet = new Set(functions);\n\n const placeholderValue = (\n kind: 'templates' | 'json',\n name: string,\n fallback: unknown\n ): unknown => {\n const declared = options[kind];\n if (declared === undefined) {\n return fallback;\n }\n const names = Array.isArray(declared)\n ? (declared as readonly string[])\n : Object.keys(declared);\n if (!names.includes(name)) {\n const what = kind === 'templates' ? 'template' : 'JSON value';\n const didYouMean = formatDidYouMean(findClosestNames(name, names));\n throw new Error(\n `eligius/lint: unknown ${what} '${name}'. ${didYouMean || `Add it to the '${kind}' lint option.`}`\n );\n }\n return Array.isArray(declared)\n ? fallback\n : (declared as Readonly<Record<string, unknown>>)[name];\n };\n\n return {\n getOperationNames: () => [...operations],\n getControllerNames: () => [...controllers],\n getProviderNames: () => [...providers],\n getFunctionNames: () => [...functions],\n import(name: string): Record<string, unknown> {\n if (operationSet.has(name)) {\n return {[name]: stubOperation};\n }\n if (controllerSet.has(name)) {\n return {[name]: StubController};\n }\n if (providerSet.has(name)) {\n return {[name]: StubProvider};\n }\n if (functionSet.has(name)) {\n return {[name]: stubFunction};\n }\n if (placeholders.templates.has(name)) {\n return {[name]: placeholderValue('templates', name, '')};\n }\n if (placeholders.json.has(name)) {\n return {[name]: placeholderValue('json', name, {})};\n }\n const didYouMean = formatDidYouMean(\n findClosestNames(String(name), [\n ...operations,\n ...controllers,\n ...providers,\n ...functions,\n ])\n );\n throw new Error(\n `eligius/lint: unknown system name '${name}'.${didYouMean ? ` ${didYouMean}` : ''}`\n );\n },\n };\n}\n","import type {\n IEngineConfiguration,\n IOperationConfiguration,\n} from '@configuration/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport {isPlainObject} from '@util/guards/is-plain-object.ts';\n\n/**\n * One list of operations of a configuration, with its JSON path.\n */\nexport interface IOperationList {\n operations: readonly unknown[];\n /** For example `timelines[0].timelineActions[1].startOperations` */\n path: string;\n /**\n * True when the engine starts the list with an empty operation data\n * object: the start and end operations of timeline actions and init\n * actions. Lookup actions (`actions`) receive the caller's data through\n * `startAction` and `endAction`, and event actions start with the event's\n * `eventArgs`, so their initial data is not known.\n */\n startsEmpty: boolean;\n}\n\n/**\n * True when `value` is shaped like an operation configuration: a plain\n * object with a string `systemName`.\n */\nexport function isOperationConfiguration(\n value: unknown\n): value is IOperationConfiguration<TOperationData> {\n return isPlainObject(value) && typeof value.systemName === 'string';\n}\n\n/**\n * Collects every operation list of the configuration in document order.\n * Values that are not arrays are skipped; the resolver reports those.\n */\nexport function collectOperationLists(\n configuration: IEngineConfiguration\n): IOperationList[] {\n const lists: IOperationList[] = [];\n const add = (\n owner: unknown,\n path: string,\n key: 'startOperations' | 'endOperations',\n startsEmpty: boolean\n ) => {\n if (isPlainObject(owner) && Array.isArray(owner[key])) {\n lists.push({\n operations: owner[key] as unknown[],\n path: `${path}.${key}`,\n startsEmpty,\n });\n }\n };\n const addEndable = (\n owner: unknown,\n path: string,\n startsEmpty: boolean,\n withEnd: boolean\n ) => {\n add(owner, path, 'startOperations', startsEmpty);\n if (withEnd) {\n add(owner, path, 'endOperations', startsEmpty);\n }\n };\n const each = (\n items: unknown,\n path: string,\n visit: (item: unknown, itemPath: string) => void\n ) => {\n if (Array.isArray(items)) {\n items.forEach((item, index) => visit(item, `${path}[${index}]`));\n }\n };\n\n each(configuration.initActions, 'initActions', (action, path) =>\n addEndable(action, path, true, true)\n );\n each(configuration.actions, 'actions', (action, path) =>\n addEndable(action, path, false, true)\n );\n each(configuration.eventActions, 'eventActions', (action, path) =>\n addEndable(action, path, false, false)\n );\n each(configuration.timelines, 'timelines', (timeline, path) => {\n if (isPlainObject(timeline)) {\n each(timeline.timelineActions, `${path}.timelineActions`, (action, p) =>\n addEndable(action, p, true, true)\n );\n }\n });\n return lists;\n}\n","import * as operationMetadata from '@operation/metadata/index.ts';\nimport type {\n IOperationMetadata,\n TPropertyMetadata,\n} from '@operation/metadata/types.ts';\n\nconst factories = operationMetadata as unknown as Record<\n string,\n () => IOperationMetadata<Record<string, unknown>>\n>;\n\nconst cache = new Map<string, IOperationMetadata<Record<string, unknown>>>();\n\n/**\n * Returns the generated metadata of a built-in operation, or undefined for\n * any other name. The metadata is created once per name.\n */\nexport function getOperationMetadata(\n systemName: string\n): IOperationMetadata<Record<string, unknown>> | undefined {\n if (!Object.hasOwn(factories, systemName)) {\n return undefined;\n }\n let metadata = cache.get(systemName);\n if (metadata === undefined) {\n metadata = factories[systemName]();\n cache.set(systemName, metadata);\n }\n return metadata;\n}\n\nexport function isRequiredProperty(\n property: TPropertyMetadata | undefined\n): boolean {\n return typeof property === 'object' && property.required === true;\n}\n\nexport function isErasedProperty(\n property: TPropertyMetadata | undefined\n): boolean {\n return typeof property === 'object' && property.erased === true;\n}\n\n/**\n * The values a property restricted to a literal union accepts, or undefined\n * when the property takes any value of its type.\n */\nexport function literalValuesOf(\n property: TPropertyMetadata | undefined\n): string[] | undefined {\n if (typeof property !== 'object' || !Array.isArray(property.type)) {\n return undefined;\n }\n return property.type.map(constant => constant.value);\n}\n\nconst producersByProperty = new Map<string, string[]>();\n\n/**\n * The built-in operations whose `outputProperties` include `property`, for\n * the hint in a missing-dependency warning.\n */\nexport function findProducers(property: string): string[] {\n let producers = producersByProperty.get(property);\n if (producers === undefined) {\n producers = Object.keys(factories).filter(name => {\n const output = getOperationMetadata(name)?.outputProperties;\n return output !== undefined && Object.hasOwn(output, property);\n });\n producersByProperty.set(property, producers);\n }\n return producers;\n}\n","/**\n * The operation data fields in which an operation resolves `$operationdata.`,\n * `$globaldata.` and `$scope.` property chains. A chain in any other field of\n * any operation is passed on as text, which the linter reports (W150).\n *\n * This list is maintained by hand. The conformance test in\n * `src/test/unit/lint/resolving-fields.spec.ts` checks that exactly the\n * operations listed here import a chain-resolving helper, so a new resolving\n * operation cannot be forgotten and a removed one cannot linger.\n */\nexport const RESOLVING_FIELDS: Readonly<Record<string, readonly string[]>> = {\n broadcastEvent: ['eventArgs'],\n calc: ['left', 'right', 'operator'],\n createElement: ['elementName', 'attributes', 'text'],\n forEach: ['collection'],\n math: ['args', 'functionName'],\n selectElement: ['selector'],\n setData: ['properties'],\n setOperationData: ['properties'],\n setStyle: ['properties'],\n when: ['expression'],\n};\n\n/**\n * True when `systemName` resolves chains in its `field`.\n */\nexport function resolvesField(systemName: string, field: string): boolean {\n return (\n Object.hasOwn(RESOLVING_FIELDS, systemName) &&\n RESOLVING_FIELDS[systemName].includes(field)\n );\n}\n","import type {IOperationConfiguration} from '@configuration/types.ts';\nimport {\n findForbiddenSegment,\n getParsedChain,\n} from '@operation/helper/chain-cache.ts';\nimport {findFlowControlProblems} from '@operation/helper/flow-control-structure.ts';\nimport {\n parseExpression,\n type TExpressionNode,\n} from '@operation/helper/parse-expression.ts';\nimport type {IOperationMetadata} from '@operation/metadata/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\nimport {isPlainObject} from '@util/guards/is-plain-object.ts';\nimport {\n type IOperationList,\n isOperationConfiguration,\n} from './operation-lists.ts';\nimport {\n findProducers,\n getOperationMetadata,\n isErasedProperty,\n isRequiredProperty,\n literalValuesOf,\n} from './operation-metadata.ts';\nimport {resolvesField} from './resolving-fields.ts';\nimport type {ILintDiagnostic, TLintSeverity} from './types.ts';\n\n/**\n * What the rules know about the configuration as a whole.\n */\nexport interface ILintContext {\n diagnostics: ILintDiagnostic[];\n /** `actions[].name` and `eventActions[].name`, the names `requestAction` accepts */\n actionNames: ReadonlySet<string>;\n /** Names declared through the `customOperations` option */\n customOperations: ReadonlySet<string>;\n}\n\ntype TOperation = IOperationConfiguration<TOperationData>;\ntype TMetadata = IOperationMetadata<Record<string, unknown>>;\n\n/**\n * Scope fields the engine uses to run an action. Writing them with `setData`\n * breaks the action; `newIndex` is left out because writing it is the\n * documented way to jump.\n */\nconst RESERVED_SCOPE_KEYS: ReadonlySet<string> = new Set([\n 'eventbus',\n 'operations',\n 'currentIndex',\n 'parent',\n 'owner',\n 'loopIndex',\n 'loopLength',\n 'loopStartIndex',\n 'loopEndIndex',\n]);\n\nconst DATA_TARGETS = ['scope', 'operationdata', 'globaldata'];\n\nconst identifierPattern = /^[A-Za-z_$][\\w$]*$/;\n\n/**\n * Appends a key to a JSON path, in the resolver's notation: dots for plain\n * keys, brackets for everything else.\n */\nexport function childPath(path: string, key: string | number): string {\n if (typeof key === 'number') {\n return `${path}[${key}]`;\n }\n return identifierPattern.test(key)\n ? `${path}.${key}`\n : `${path}['${key.replace(/'/g, \"\\\\'\")}']`;\n}\n\n/**\n * The operation data keys that are known to be present when an operation\n * runs, following the list from its start. It never removes a key: a key\n * erased or cleared inside a branch may still be present on another path,\n * so the rules only report what is missing on every path.\n */\nclass DataFlow {\n private readonly _known = new Set<string>();\n /**\n * True once the data can hold anything: the list started with caller-owned\n * data, or an operation ran whose effect on the data is not described.\n */\n private _unknown: boolean;\n\n constructor(startsEmpty: boolean) {\n this._unknown = !startsEmpty;\n }\n\n /** True when the absence of a key is certain, not merely undescribed */\n get certain(): boolean {\n return !this._unknown;\n }\n\n has(key: string): boolean {\n return this._known.has(key);\n }\n\n /**\n * Records what `operation` leaves in the data for the operations after it.\n */\n after(\n operation: TOperation,\n data: Record<string, unknown> | undefined,\n metadata: TMetadata | undefined\n ): void {\n if (metadata === undefined) {\n // A custom or unknown operation may add anything\n this._unknown = true;\n }\n switch (operation.systemName) {\n case 'setOperationData':\n if (data && isPlainObject(data.properties)) {\n for (const key of Object.keys(data.properties)) {\n this._known.add(key);\n }\n }\n break;\n case 'setData':\n if (data && isPlainObject(data.properties)) {\n for (const target of Object.keys(data.properties)) {\n const segments = target.split('.');\n if (\n segments[0].toLowerCase() === '$operationdata' &&\n segments.length === 2\n ) {\n this._known.add(segments[1]);\n }\n }\n }\n break;\n case 'addGlobalsToOperation':\n if (data && Array.isArray(data.globalProperties)) {\n for (const name of data.globalProperties) {\n if (typeof name === 'string') {\n this._known.add(name);\n }\n }\n }\n break;\n case 'customFunction':\n case 'startAction':\n case 'endAction':\n // The function or the called action may change the data in any way\n this._unknown = true;\n break;\n default:\n break;\n }\n if (metadata?.outputProperties) {\n for (const key of Object.keys(metadata.outputProperties)) {\n this._known.add(key);\n }\n }\n if (data) {\n for (const key of Object.keys(data)) {\n if (\n data[key] !== undefined &&\n !isErasedProperty(metadata?.properties?.[key])\n ) {\n this._known.add(key);\n }\n }\n }\n }\n}\n\n/**\n * Runs every operation-level rule over one operation list.\n */\nexport function lintOperationList(\n list: IOperationList,\n context: ILintContext\n): void {\n const report = (\n code: string,\n severity: TLintSeverity,\n path: string,\n message: string\n ) => {\n context.diagnostics.push({code, severity, path, message});\n };\n\n // E101: control-flow blocks must be balanced and nested\n const systemNames = list.operations.map(operation =>\n isOperationConfiguration(operation) ? operation.systemName : ''\n );\n for (const problem of findFlowControlProblems(systemNames)) {\n report(\n 'E101',\n 'error',\n childPath(childPath(list.path, problem.index), 'systemName'),\n `${problem.message} The engine pops the wrong scope at runtime, and the action fails or runs with the wrong data.`\n );\n }\n\n const flow = new DataFlow(list.startsEmpty);\n\n list.operations.forEach((operation, index) => {\n if (!isOperationConfiguration(operation)) {\n return;\n }\n const {systemName} = operation;\n const operationPath = childPath(list.path, index);\n const dataPath = childPath(operationPath, 'operationData');\n const data = isPlainObject(operation.operationData)\n ? (operation.operationData as Record<string, unknown>)\n : undefined;\n const metadata = getOperationMetadata(systemName);\n const isCustom = context.customOperations.has(systemName);\n const hasOwnData = (key: string) =>\n data !== undefined && Object.hasOwn(data, key) && data[key] !== undefined;\n const isAvailable = (key: string) => flow.has(key) || hasOwnData(key);\n\n const reportUnknownRead = (chain: string, head: string, path: string) => {\n if (flow.certain && head !== '' && !isAvailable(head)) {\n report(\n 'W151',\n 'warning',\n path,\n `${systemName}: '${chain}' reads '${head}' from the operation data, but no operation before it in this list provides '${head}'.`\n );\n }\n };\n\n if (data !== undefined) {\n // E141: a '__proto__' key anywhere in the operation data\n walkData(data, dataPath, (value, path) => {\n if (isPlainObject(value) && Object.hasOwn(value, '__proto__')) {\n report(\n 'E141',\n 'error',\n childPath(path, '__proto__'),\n `${systemName}: operation data must not contain a '__proto__' key. The engine rejects the operation when it runs.`\n );\n }\n });\n\n // E140, W150, W151 for property chain strings\n walkData(data, dataPath, (value, path, topKey) => {\n if (typeof value !== 'string' || topKey === undefined) {\n return;\n }\n if (systemName === 'when' && topKey === 'expression') {\n return; // lintWhen checks the operands of the expression\n }\n const parsed = getParsedChain(value);\n if (parsed === null) {\n return;\n }\n if (parsed.forbidden !== undefined) {\n report(\n 'E140',\n 'error',\n path,\n `${systemName}: property chain '${value}' contains forbidden segment '${parsed.forbidden.segment}'. Property chains may not contain __proto__, prototype or constructor.`\n );\n return;\n }\n if (!resolvesField(systemName, topKey)) {\n if (!isCustom && metadata !== undefined) {\n report(\n 'W150',\n 'warning',\n path,\n `${systemName}: '${value}' in '${topKey}' is passed on as text, ${systemName} does not resolve property chains in '${topKey}'. Resolve it first with setOperationData, or use a literal value.`\n );\n }\n return;\n }\n if (parsed.prefix === 'operationdata') {\n reportUnknownRead(value, parsed.segments[0] ?? '', path);\n }\n });\n }\n\n if (systemName === 'when') {\n lintWhen(data, dataPath, report, reportUnknownRead);\n }\n if (systemName === 'setData') {\n lintSetData(data, dataPath, report, reportUnknownRead);\n }\n if (systemName === 'requestAction') {\n lintRequestAction(data, dataPath, context, report);\n }\n\n if (metadata !== undefined) {\n // E111 / W111: required properties\n for (const [key, property] of Object.entries(metadata.properties ?? {})) {\n if (isRequiredProperty(property) && !isAvailable(key)) {\n report(\n flow.certain ? 'E111' : 'W111',\n flow.certain ? 'error' : 'warning',\n dataPath,\n `${systemName}: '${key}' is required, and neither its operation data nor an operation before it in this list provides it.`\n );\n }\n }\n // E120: literal unions\n for (const [key, property] of Object.entries(metadata.properties ?? {})) {\n const values = literalValuesOf(property);\n const value = data?.[key];\n if (\n values !== undefined &&\n typeof value === 'string' &&\n getParsedChain(value) === null &&\n !values.includes(value)\n ) {\n report(\n 'E120',\n 'error',\n childPath(dataPath, key),\n `${systemName}: '${key}' must be one of ${values.map(v => `'${v}'`).join(', ')}, got '${value}'.`\n );\n }\n }\n // W110: dependencies on earlier operations\n for (const dependency of metadata.dependentProperties ?? []) {\n const key = String(dependency);\n if (flow.certain && !isAvailable(key)) {\n const producers = findProducers(key);\n const hint =\n producers.length > 0\n ? ` Operations that provide it: ${producers.slice(0, 4).join(', ')}.`\n : '';\n report(\n 'W110',\n 'warning',\n operationPath,\n `${systemName}: '${key}' must be provided by an earlier operation in this list, but none before it provides it.${hint}`\n );\n }\n }\n }\n\n flow.after(operation, data, metadata);\n });\n}\n\ntype TReport = (\n code: string,\n severity: TLintSeverity,\n path: string,\n message: string\n) => void;\n\ntype TReportUnknownRead = (chain: string, head: string, path: string) => void;\n\nfunction lintWhen(\n data: Record<string, unknown> | undefined,\n dataPath: string,\n report: TReport,\n reportUnknownRead: TReportUnknownRead\n): void {\n const expression = data?.expression;\n if (expression === undefined) {\n return; // E111 reports the missing expression\n }\n const path = childPath(dataPath, 'expression');\n let parsed: TExpressionNode;\n try {\n parsed = parseExpression(expression as string, 'when');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n report(\n /unknown operand/.test(message) ? 'E131' : 'E130',\n 'error',\n path,\n message\n );\n return;\n }\n for (const chain of collectChainOperands(parsed)) {\n const parsedChain = getParsedChain(chain);\n if (parsedChain === null) {\n continue;\n }\n if (parsedChain.forbidden !== undefined) {\n report(\n 'E140',\n 'error',\n path,\n `when: property chain '${chain}' contains forbidden segment '${parsedChain.forbidden.segment}'. Property chains may not contain __proto__, prototype or constructor.`\n );\n } else if (parsedChain.prefix === 'operationdata') {\n reportUnknownRead(chain, parsedChain.segments[0] ?? '', path);\n }\n }\n}\n\nfunction collectChainOperands(node: TExpressionNode): string[] {\n switch (node.kind) {\n case 'operand':\n return node.operand.kind === 'chain' ? [node.operand.chain] : [];\n case 'not':\n return collectChainOperands(node.operand);\n default:\n return [\n ...collectChainOperands(node.left),\n ...collectChainOperands(node.right),\n ];\n }\n}\n\nfunction lintSetData(\n data: Record<string, unknown> | undefined,\n dataPath: string,\n report: TReport,\n reportUnknownRead: TReportUnknownRead\n): void {\n const properties = data?.properties;\n if (!isPlainObject(properties)) {\n return;\n }\n for (const target of Object.keys(properties)) {\n const path = childPath(childPath(dataPath, 'properties'), target);\n const segments = target.split('.');\n const root = segments[0].toLowerCase().substring(1);\n if (!segments[0].startsWith('$') || !DATA_TARGETS.includes(root)) {\n report(\n 'E160',\n 'error',\n path,\n `setData: unrecognized target '${target}'; a target starts with $scope, $operationdata or $globaldata.`\n );\n continue;\n }\n const rest = segments.slice(1);\n const forbidden = findForbiddenSegment(rest);\n if (forbidden !== undefined) {\n report(\n 'E140',\n 'error',\n path,\n `setData: property chain '${target}' contains forbidden segment '${forbidden}'. Property chains may not contain __proto__, prototype or constructor.`\n );\n continue;\n }\n if (\n root === 'scope' &&\n rest.length === 1 &&\n RESERVED_SCOPE_KEYS.has(rest[0])\n ) {\n report(\n 'W160',\n 'warning',\n path,\n `setData: '${target}' overwrites '${rest[0]}', which the engine uses to run the action. Use $scope.variables.${rest[0]} for your own value.`\n );\n }\n if (root === 'operationdata' && rest.length > 1) {\n reportUnknownRead(target, rest[0], path);\n }\n }\n}\n\nfunction lintRequestAction(\n data: Record<string, unknown> | undefined,\n dataPath: string,\n context: ILintContext,\n report: TReport\n): void {\n const name = data?.systemName;\n if (\n typeof name !== 'string' ||\n getParsedChain(name) !== null ||\n context.actionNames.has(name)\n ) {\n return;\n }\n const didYouMean = formatDidYouMean(\n findClosestNames(name, [...context.actionNames])\n );\n report(\n 'E310',\n 'error',\n childPath(dataPath, 'systemName'),\n `requestAction: there is no action named '${name}'. ${didYouMean || 'Action names come from actions[].name and eventActions[].name.'}`\n );\n}\n\n/**\n * Visits every value in the operation data, depth first, with its JSON path\n * and the top-level key it sits under.\n */\nfunction walkData(\n data: Record<string, unknown>,\n dataPath: string,\n visit: (value: unknown, path: string, topKey: string | undefined) => void\n): void {\n const visiting = new Set<object>();\n const walk = (value: unknown, path: string, topKey: string | undefined) => {\n visit(value, path, topKey);\n if (value === null || typeof value !== 'object' || visiting.has(value)) {\n return;\n }\n if (Array.isArray(value)) {\n visiting.add(value);\n value.forEach((item, index) =>\n walk(item, childPath(path, index), topKey)\n );\n visiting.delete(value);\n return;\n }\n if (!isPlainObject(value)) {\n return;\n }\n visiting.add(value);\n for (const key of Object.keys(value)) {\n walk(value[key], childPath(path, key), topKey ?? key);\n }\n visiting.delete(value);\n };\n walk(data, dataPath, undefined);\n}\n","import {ConfigurationResolver} from '@configuration/configuration-resolver.ts';\nimport type {IEngineConfiguration} from '@configuration/types.ts';\nimport {ActionRegistryEventbusListener} from '@eventbus/actionregistry-eventbus-listener.ts';\nimport {Eventbus} from '@eventbus/eventbus.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {isPlainObject} from '@util/guards/is-plain-object.ts';\nimport {createLintImporter, type IPlaceholderNames} from './lint-importer.ts';\nimport {collectOperationLists} from './operation-lists.ts';\nimport {type ILintContext, lintOperationList} from './rules.ts';\nimport type {ILintDiagnostic, ILintOptions} from './types.ts';\n\n/**\n * Checks a configuration without a DOM and without running it, and returns\n * what the engine would reject or what is likely wrong.\n *\n * The real `ConfigurationResolver` runs first, with a stand-in for every\n * operation, controller and timeline provider, so every error it throws at\n * `createEngine` time is reported here with the same message and JSON path\n * (code `E001`). The structural and data-flow rules then run over every\n * operation list:\n *\n * - `E101` control-flow blocks that are not balanced or do not nest\n * - `E111` a required property that nothing provides (`W111` when the list\n * starts with caller-owned data)\n * - `E120` a literal outside its allowed values\n * - `E130`, `E131` a `when` expression that does not parse, an unknown operand\n * - `E140` a property chain with a forbidden segment\n * - `E141` a `__proto__` key in operation data\n * - `E160` an unrecognized `setData` target, `W160` a reserved scope field\n * - `E310` a `requestAction` name that no action has\n * - `W110` a dependency on an earlier operation that no earlier operation provides\n * - `W150` a property chain in a field the operation does not resolve\n * - `W151` an `$operationdata` read of a property that nothing provides\n *\n * Errors are certain: the engine throws, or the operation fails when it\n * runs. Warnings are likely mistakes. Data-flow warnings are only reported\n * for the operation lists that start with empty data (timeline actions and\n * init actions), and never after an operation whose effect on the data is\n * not described (a custom operation, `customFunction`, `startAction`).\n *\n * The configuration is not changed.\n *\n * @param configuration - The configuration to check\n * @param options - The custom resources the host registers, so their names\n * are accepted\n * @returns The diagnostics, resolver errors first, then in document order.\n * Empty when nothing was found.\n *\n * @example\n * ```ts\n * import {lintConfiguration} from 'eligius/lint';\n *\n * const diagnostics = lintConfiguration(configuration, {\n * customOperations: ['trackEvent'],\n * });\n * for (const {severity, code, path, message} of diagnostics) {\n * console.log(`${severity} ${code} at ${path}: ${message}`);\n * }\n * ```\n */\nexport function lintConfiguration(\n configuration: IEngineConfiguration,\n options: ILintOptions = {}\n): ILintDiagnostic[] {\n if (!isPlainObject(configuration)) {\n return [\n {\n code: 'E001',\n severity: 'error',\n path: '',\n message: `The configuration must be an object, got ${describeKind(configuration)}.`,\n },\n ];\n }\n\n const diagnostics: ILintDiagnostic[] = [];\n\n // The resolver replaces placeholders in place, so it gets a copy\n const copy = deepCopy(configuration);\n const importer = createLintImporter(options, collectPlaceholderNames(copy));\n const resolver = new ConfigurationResolver(importer, new Eventbus(), {\n // The structural problems are reported as E101 below\n onWarning: () => {},\n });\n try {\n resolver.process(copy, new ActionRegistryEventbusListener());\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n diagnostics.push({\n code: 'E001',\n severity: 'error',\n path: extractPath(message),\n message,\n });\n }\n\n const context: ILintContext = {\n diagnostics,\n actionNames: collectActionNames(configuration),\n customOperations: new Set(options.customOperations ?? []),\n };\n for (const list of collectOperationLists(configuration)) {\n lintOperationList(list, context);\n }\n\n return diagnostics;\n}\n\nfunction describeKind(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'an array';\n }\n return typeof value === 'undefined' ? 'undefined' : `a ${typeof value}`;\n}\n\nconst TOP_LEVEL_KEYS: ReadonlySet<string> = new Set([\n 'id',\n 'engine',\n 'timelineProviderSettings',\n 'containerSelector',\n 'cssFiles',\n 'language',\n 'layoutTemplate',\n 'availableLanguages',\n 'initActions',\n 'actions',\n 'eventActions',\n 'timelines',\n 'timelineFlow',\n 'locales',\n]);\n\nconst pathPattern =\n /\\bat ((?:[A-Za-z_$][\\w$]*)(?:\\.[A-Za-z_$][\\w$]*|\\[\\d+\\]|\\['[^']*'\\])*)/g;\n\n/**\n * The JSON path a resolver message names: the first `at <path>` whose first\n * segment is a top-level configuration key.\n */\nexport function extractPath(message: string): string {\n for (const match of message.matchAll(pathPattern)) {\n const path = match[1];\n const firstSegment = path.split(/[.[]/, 1)[0];\n if (TOP_LEVEL_KEYS.has(firstSegment)) {\n return path.replace(/[.,:]$/, '');\n }\n }\n return '';\n}\n\nfunction collectActionNames(\n configuration: IEngineConfiguration\n): ReadonlySet<string> {\n const names = new Set<string>();\n for (const list of [configuration.actions, configuration.eventActions]) {\n if (Array.isArray(list)) {\n for (const action of list) {\n if (isPlainObject(action) && typeof action.name === 'string') {\n names.add(action.name);\n }\n }\n }\n }\n return names;\n}\n\n/**\n * The names the `template:` and `json:` placeholders of the configuration\n * ask the importer for. Walks what the resolver walks: plain objects and\n * arrays.\n */\nexport function collectPlaceholderNames(\n configuration: unknown\n): IPlaceholderNames {\n const templates = new Set<string>();\n const json = new Set<string>();\n const visiting = new Set<object>();\n const walk = (value: unknown) => {\n if (typeof value === 'string') {\n if (value.startsWith('template:')) {\n templates.add(value.substring(9));\n } else if (value.startsWith('json:')) {\n json.add(value.substring(5));\n }\n return;\n }\n if (value === null || typeof value !== 'object' || visiting.has(value)) {\n return;\n }\n if (Array.isArray(value)) {\n visiting.add(value);\n value.forEach(walk);\n visiting.delete(value);\n } else if (isPlainObject(value)) {\n visiting.add(value);\n for (const key of Object.keys(value)) {\n walk(value[key]);\n }\n visiting.delete(value);\n }\n };\n walk(configuration);\n return {templates, json};\n}\n"],"mappings":";;;;;;;;;;AAKA,MAAa,iBAAiB;AAC9B,MAAa,sBAAsB;AACnC,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;AACjC,MAAa,uBAAuB;AACpC,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;;;;;;;;ACJzC,MAAa,iDAAsD,IAAI,IAAI;CACzE;CACA;CACA;AACF,CAAC;;;;AAKD,SAAgB,gCAAgC,SAA0B;CACxE,OAAO,+BAA+B,IAAI,OAAO;AACnD;;;ACwBA,MAAM,iBAAiB;;;;;AAMvB,SAAgB,eAAe,YAAyC;CACtE,MAAM,WAAqB,CAAC;CAC5B,KAAK,MAAM,WAAW,YAAY;EAChC,IAAI,CAAC,QAAQ,SAAS,GAAG,KAAK,CAAC,QAAQ,SAAS,GAAG,GAAG;GACpD,IAAI,QAAQ,SAAS,GACnB,SAAS,KAAK,OAAO;GAEvB;EACF;EACA,KAAK,MAAM,QAAQ,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,CAAC,MAAM,GAAG,GACjE,IAAI,KAAK,SAAS,GAChB,SAAS,KAAK,IAAI;CAGxB;CACA,OAAO;AACT;;;;AAKA,SAAgB,qBACd,UACoB;CACpB,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,OAAO,QAAQ,MAAM,GAAG,CAAC,CAAC;EAChC,IAAI,gCAAgC,IAAI,GACtC,O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