eligius 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action/timeline-action.d.ts +4 -2
- package/dist/action/types.d.ts +1 -1
- package/dist/configuration/api/configuration-factory.d.ts +9 -6
- package/dist/configuration/api/label-editor.d.ts +11 -0
- package/dist/controllers/label-controller.d.ts +1 -0
- package/dist/eligius-engine.d.ts +11 -3
- package/dist/eligius.cjs.development.js +273 -56
- package/dist/eligius.cjs.development.js.map +1 -1
- package/dist/eligius.cjs.production.min.js +1 -1
- package/dist/eligius.cjs.production.min.js.map +1 -1
- package/dist/eligius.esm.js +272 -57
- package/dist/eligius.esm.js.map +1 -1
- package/dist/operation/get-attributes-from-element.d.ts +20 -0
- package/dist/operation/helper/globals.d.ts +3 -2
- package/dist/operation/index.d.ts +2 -0
- package/dist/operation/log.d.ts +1 -1
- package/dist/operation/metadata/get-attributes-from-element.d.ts +4 -0
- package/dist/operation/metadata/index.d.ts +2 -0
- package/dist/operation/metadata/set-data.d.ts +4 -0
- package/dist/operation/set-data.d.ts +21 -0
- package/dist/timeline-event-names.d.ts +0 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eligius.cjs.production.min.js","sources":["../src/util/guards/is-function.ts","../src/util/guards/is-object.ts","../src/util/prepare-value-for-serialization.ts","../src/diagnostics/devtool-event-lister.ts","../src/diagnostics/diagnostics.ts","../src/operation/helper/deep-copy.ts","../src/action/action.ts","../src/util/guards/is-promise.ts","../src/action/endable-action.ts","../src/action/timeline-action.ts","../src/build/generate-importer-source-code.ts","../src/operation/add-class.ts","../src/operation/helper/get-element-data.ts","../src/operation/helper/merge-operation-data.ts","../src/operation/helper/internal-resolve.ts","../src/operation/add-controller-to-element.ts","../src/operation/helper/attach-controller-to-element.ts","../src/operation/animate.ts","../src/operation/animate-with-class.ts","../src/util/guards/is-string.ts","../src/operation/helper/get-property-chain-value.ts","../src/operation/helper/globals.ts","../src/operation/helper/resolve-external-property-chain.ts","../src/operation/broadcast-event.ts","../src/operation/helper/resolve-event-arguments.ts","../src/operation/helper/remove-event-data-from-operation-data.ts","../src/operation/helper/resolve-property-values.ts","../src/operation/calc.ts","../src/operation/clear-element.ts","../src/operation/clear-operation-data.ts","../src/operation/create-element.ts","../src/timeline-event-names.ts","../src/operation/custom-function.ts","../src/operation/end-action.ts","../src/operation/end-loop.ts","../src/operation/end-when.ts","../src/operation/extend-controller.ts","../src/operation/get-controller-from-element.ts","../src/operation/get-controller-instance.ts","../src/operation/get-element-dimensions.ts","../src/operation/helper/modify-dimensions.ts","../src/operation/get-import.ts","../src/operation/get-query-params.ts","../src/operation/invoke-object-method.ts","../src/operation/load-json.ts","../src/operation/log.ts","../src/operation/math.ts","../src/operation/helper/find-matching-operation-index.ts","../src/operation/otherwise.ts","../src/operation/remove-class.ts","../src/operation/remove-controller-from-element.ts","../src/operation/remove-element.ts","../src/operation/remove-properties-from-operation-data.ts","../src/operation/reparent-element.ts","../src/operation/request-action.ts","../src/operation/resize-action.ts","../src/operation/select-element.ts","../src/operation/set-element-attributes.ts","../src/operation/set-element-content.ts","../src/operation/set-global-data.ts","../src/operation/set-operation-data.ts","../src/operation/set-style.ts","../src/operation/start-action.ts","../src/operation/start-loop.ts","../src/operation/toggle-class.ts","../src/operation/toggle-element.ts","../src/operation/wait.ts","../src/operation/when.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/timelineproviders/request-animation-frame-timeline-provider.ts","../src/util/animation-interval.ts","../src/configuration/api/timeline-provider-settings-editor.ts","../src/configuration/api/configuration-factory.ts","../src/controllers/event-listener-controller.ts","../src/controllers/label-controller.ts","../src/controllers/lottie-controller.ts","../src/controllers/navigation-controller.ts","../src/controllers/progressbar-controller.ts","../src/controllers/routing-controller.ts","../src/controllers/subtitles-controller.ts","../src/operation/metadata/add-class.ts","../src/operation/metadata/add-controller-to-element.ts","../src/operation/metadata/animate.ts","../src/operation/metadata/animate-with-class.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/create-element.ts","../src/operation/metadata/custom-function.ts","../src/operation/metadata/end-action.ts","../src/operation/metadata/end-loop.ts","../src/operation/metadata/end-when.ts","../src/operation/metadata/extend-controller.ts","../src/operation/metadata/get-controller-from-element.ts","../src/operation/metadata/get-controller-instance.ts","../src/operation/metadata/get-element-dimensions.ts","../src/operation/metadata/get-import.ts","../src/operation/metadata/get-query-params.ts","../src/operation/metadata/invoke-object-method.ts","../src/operation/metadata/load-json.ts","../src/operation/metadata/log.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/request-action.ts","../src/operation/metadata/resize-action.ts","../src/operation/metadata/select-element.ts","../src/operation/metadata/set-element-attributes.ts","../src/operation/metadata/set-element-content.ts","../src/operation/metadata/set-global-data.ts","../src/operation/metadata/set-operation-data.ts","../src/operation/metadata/set-style.ts","../src/operation/metadata/start-action.ts","../src/operation/metadata/start-loop.ts","../src/operation/metadata/toggle-class.ts","../src/operation/metadata/toggle-element.ts","../src/operation/metadata/wait.ts","../src/operation/metadata/when.ts","../src/configuration/api/name-providers.ts","../src/configuration/configuration-resolver.ts","../src/operation/helper/resolve-property-chain.ts","../src/eligius-engine.ts","../src/eventbus/actionregistry-eventbus-listener.ts","../src/eventbus/eventbus.ts","../src/eventbus/request-video-uri-interceptor.ts","../src/language-manager.ts","../src/operation/helper/set-global.ts","../src/engine-factory.ts","../src/importer/eligius-resource-importer.ts","../src/diagnostics/types.ts","../src/util/dash-to-camel-case.ts"],"sourcesContent":["export function isFunction(value: any): value is Function {\r\n return typeof value === 'function';\r\n}\r\n","export function isObject(value: any): value is Object {\r\n return value !== null && typeof value === 'object';\r\n}\r\n","import jQuery from 'jquery';\r\nimport { isFunction } from './guards/is-function';\r\nimport { isObject } from './guards/is-object';\r\n\r\nexport function prepareValueForSerialization(value: any): any {\r\n if (Array.isArray(value)) {\r\n return (value as Array<any>).map(prepareValueForSerialization);\r\n } else if (value instanceof jQuery) {\r\n return 'jQuery object';\r\n } else if (isObject(value)) {\r\n if (\r\n value.constructor.toString().substring(0, 5) === 'class' ||\r\n !value.constructor.toString().startsWith('function Object()')\r\n ) {\r\n const funcString: string = value.constructor.toString();\r\n return funcString.substring(0, funcString.indexOf('{') + 1);\r\n }\r\n return Object.fromEntries(\r\n Object.entries(value).map(([propName, propValue]) => [\r\n propName,\r\n prepareValueForSerialization(propValue),\r\n ])\r\n );\r\n } else if (isFunction(value)) {\r\n const funcString: string = value.toString();\r\n const paranIndex = funcString.indexOf('{');\r\n if (paranIndex > -1) {\r\n return funcString.substring(0, funcString.indexOf('{') + 1);\r\n }\r\n return funcString;\r\n }\r\n return value;\r\n}\r\n","import { IEventbusListener } from '../eventbus';\r\nimport { prepareValueForSerialization } from '../util/prepare-value-for-serialization';\r\nimport { IDiagnosticsAgent } from './types';\r\n\r\nexport class DevToolEventListener implements IEventbusListener {\r\n constructor(private agent: IDiagnosticsAgent) {}\r\n\r\n handleEvent(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any[]\r\n ): void {\r\n const message = {\r\n eventName,\r\n eventTopic,\r\n args: prepareValueForSerialization(args),\r\n };\r\n try {\r\n this.agent.postMessage('eligius-diagnostics-event', message);\r\n } catch (e) {\r\n console.error('postmessage failed');\r\n console.error(e);\r\n console.log('message', message);\r\n }\r\n }\r\n}\r\n","import { TDiagnosticType } from './types';\r\n\r\nexport class Diagnostics {\r\n static send(_name: TDiagnosticType, _data: any): void {\r\n console.log(_name, _data);\r\n }\r\n static active: boolean;\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\n\r\nconst copyFunction =\r\n typeof structuredClone !== 'undefined'\r\n ? structuredClone\r\n : (original: any) => JSON.parse(JSON.stringify(original));\r\n\r\nexport function deepCopy<T>(original: T): T {\r\n if (isDefined(original)) {\r\n return copyFunction(original) as T;\r\n }\r\n return original;\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { Diagnostics } from '../diagnostics';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { IOperationContext, TOperationData } from '../operation/types';\r\nimport { isPromise } from '../util/guards/is-promise';\r\nimport { IAction } from './types';\r\n\r\nexport class Action implements IAction {\r\n public id = '';\r\n protected _contextStack: IOperationContext[] = [];\r\n\r\n constructor(\r\n public name: string,\r\n public startOperations: IResolvedOperation[],\r\n protected eventbus: IEventbus\r\n ) {}\r\n\r\n start(initOperationData?: TOperationData): Promise<TOperationData> {\r\n Diagnostics.active &&\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} begins executing start operations`\r\n );\r\n\r\n this._initializeContextStack();\r\n\r\n const result = new Promise<TOperationData>((resolve, reject) => {\r\n this.executeOperation(\r\n this.startOperations,\r\n 0,\r\n resolve,\r\n reject,\r\n initOperationData\r\n );\r\n }).catch((e) => {\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-action-error', {\r\n name: this.name,\r\n error: e,\r\n });\r\n console.error(`Error in action start '${this.name}'`);\r\n console.error(e);\r\n throw e;\r\n });\r\n return !Diagnostics.active\r\n ? result\r\n : result.then((operationsResult) => {\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} finished executing start operations`\r\n );\r\n return operationsResult;\r\n });\r\n }\r\n\r\n protected _initializeContextStack() {\r\n this._contextStack = [\r\n {\r\n currentIndex: -1,\r\n eventbus: this.eventbus,\r\n operations: this.startOperations,\r\n },\r\n ];\r\n }\r\n\r\n private _pushContext(parentContext: IOperationContext): IOperationContext {\r\n const newContext = {\r\n get currentIndex() {\r\n return parentContext.currentIndex;\r\n },\r\n set currentIndex(value: number) {\r\n parentContext.currentIndex = value;\r\n },\r\n get eventbus() {\r\n return parentContext.eventbus;\r\n },\r\n get operations() {\r\n return parentContext.operations;\r\n },\r\n parent: parentContext,\r\n };\r\n this._contextStack.push(newContext);\r\n return newContext;\r\n }\r\n\r\n private _popContext() {\r\n this._contextStack.pop();\r\n }\r\n\r\n executeOperation(\r\n operations: IResolvedOperation[],\r\n operationIndex: number,\r\n resolve: (value?: any | PromiseLike<any>) => void,\r\n reject: (reason?: any) => void,\r\n previousOperationData: TOperationData | undefined = {}\r\n ): void {\r\n let context = this._contextStack[this._contextStack.length - 1];\r\n if (context.newIndex !== undefined) {\r\n operationIndex = context.newIndex;\r\n delete context.newIndex;\r\n }\r\n\r\n context.currentIndex = operationIndex;\r\n\r\n if (operationIndex < operations.length) {\r\n const operationInfo = operations[operationIndex];\r\n\r\n const copy = deepCopy(operationInfo.operationData ?? {});\r\n\r\n const mergedOperationData = Object.assign(previousOperationData, copy);\r\n\r\n if (operationInfo.systemName === 'when') {\r\n context = this._pushContext(context);\r\n } else if (\r\n operationInfo.systemName === 'startLoop' &&\r\n context.owner !== operationInfo\r\n ) {\r\n context = this._pushContext(context);\r\n context.owner = operationInfo;\r\n }\r\n\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-operation', {\r\n systemName: operationInfo.systemName,\r\n operationData: mergedOperationData,\r\n context: {\r\n ...context,\r\n eventbus: undefined,\r\n },\r\n });\r\n\r\n const operationResult = operationInfo.instance.call(\r\n context,\r\n mergedOperationData\r\n );\r\n\r\n if (\r\n operationInfo.systemName === 'endWhen' ||\r\n (operationInfo.systemName === 'endLoop' &&\r\n context.newIndex === undefined)\r\n ) {\r\n this._popContext();\r\n }\r\n\r\n if (isPromise(operationResult)) {\r\n operationResult\r\n .then((promisedOperationResult) =>\r\n this.executeOperation(\r\n operations,\r\n ++operationIndex,\r\n resolve,\r\n reject,\r\n promisedOperationResult\r\n )\r\n )\r\n .catch((error: any) => {\r\n reject(error);\r\n });\r\n } else {\r\n this.executeOperation(\r\n operations,\r\n ++operationIndex,\r\n resolve,\r\n reject,\r\n operationResult\r\n );\r\n }\r\n } else {\r\n resolve(previousOperationData);\r\n }\r\n }\r\n}\r\n","export function isPromise(obj: any): obj is Promise<any> {\r\n return typeof obj === 'object' && typeof obj.then === 'function';\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { Diagnostics } from '../diagnostics';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { Action } from './action';\r\n\r\nexport class EndableAction extends Action {\r\n constructor(\r\n name: string,\r\n startOperations: IResolvedOperation[],\r\n public endOperations: IResolvedOperation[],\r\n eventBus: IEventbus\r\n ) {\r\n super(name, startOperations, eventBus);\r\n }\r\n\r\n end(initOperationData?: TOperationData): Promise<TOperationData> {\r\n Diagnostics.active &&\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} begins executing end operations`\r\n );\r\n\r\n if (!this.endOperations.length) {\r\n return Promise.resolve(initOperationData ?? {});\r\n }\r\n\r\n this._initializeContextStack();\r\n\r\n const result = new Promise<TOperationData>((resolve, reject) => {\r\n this.executeOperation(\r\n this.endOperations,\r\n 0,\r\n resolve,\r\n reject,\r\n initOperationData\r\n );\r\n }).catch((e) => {\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-action-error', {\r\n name: this.name,\r\n error: e,\r\n });\r\n console.error(`Error in action end '${this.name}'`);\r\n throw e;\r\n });\r\n\r\n return !Diagnostics.active\r\n ? result\r\n : result.then((operationsResult) => {\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} finished executing start operations`\r\n );\r\n return operationsResult;\r\n });\r\n }\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { IStrictDuration } from '../types';\r\nimport { EndableAction } from './endable-action';\r\n\r\nexport class TimelineAction extends EndableAction {\r\n public active = false;\r\n\r\n constructor(\r\n name: string,\r\n startOperations: IResolvedOperation[],\r\n endOperations: IResolvedOperation[],\r\n public duration: IStrictDuration,\r\n eventBus: IEventbus\r\n ) {\r\n super(name, startOperations, endOperations, eventBus);\r\n }\r\n\r\n start(initOperationData?: TOperationData): Promise<TOperationData> {\r\n if (!this.active || this.duration.end < 0) {\r\n this.active = this.duration.end > -1;\r\n return super.start(initOperationData);\r\n }\r\n\r\n return Promise.resolve({});\r\n }\r\n\r\n end(initOperationData: TOperationData): Promise<TOperationData> {\r\n this.active = false;\r\n return super.end(initOperationData);\r\n }\r\n}\r\n","import fs from 'fs';\r\nimport path from 'path';\r\nimport {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IOperationConfiguration\r\n} from '../configuration/types';\r\nimport dashToCamelCase from '../util/dash-to-camel-case';\r\n\r\ninterface ImportInfo {\r\n systemName: string;\r\n path?: string;\r\n defaultImport?: boolean;\r\n}\r\n\r\nexport interface IAssetInfo {\r\n path: string;\r\n extension: string;\r\n}\r\n\r\n/**\r\n * This function takes an Eligius engine configuration, a root path for the configuration file and an arbitrary list of asset info.\r\n * The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.\r\n * I.e. html, json, etc.\r\n *\r\n * @param config\r\n * @param configPath\r\n * @param assetInfo\r\n */\r\nexport function generateImporterSourceCode(\r\n config: IEngineConfiguration,\r\n configPath: string,\r\n assetInfo: IAssetInfo[]\r\n) {\r\n const importPaths = _gatherImportPaths(config, configPath, assetInfo);\r\n\r\n const importerSourceCode = _generateSourceCode(importPaths);\r\n\r\n return importerSourceCode;\r\n}\r\n\r\nfunction _generateSourceCode(importPaths: ImportInfo[]) {\r\n const result = importPaths\r\n .filter((x) => x.defaultImport)\r\n .map((imp) => `import ${imp.systemName} from '${imp.path}';`)\r\n .concat(\r\n importPaths\r\n .filter((x) => !x.defaultImport)\r\n .map(\r\n (imp) => `import {${imp.systemName}} from '${imp.path ?? 'eligius'}';`\r\n )\r\n );\r\n result.push(`import { ISimpleResourceImporter } from 'eligius';`);\r\n result.push('');\r\n\r\n result.push('const imports: Record<string, any> = {');\r\n result.push(\r\n ...importPaths.map(\r\n (imp) => `${imp.systemName}: { '${imp.systemName}': ${imp.systemName} },`\r\n )\r\n );\r\n result.push('};');\r\n result.push('');\r\n result.push(\r\n 'class EligiusResourceImporter implements ISimpleResourceImporter {'\r\n );\r\n result.push('import(name: string): Record<string, any> {');\r\n result.push('if (imports.hasOwnProperty(name)) { return imports[name]; }');\r\n result.push('throw Error(`Unknown systemName: ${name}`);');\r\n result.push('}}');\r\n result.push('');\r\n result.push('export default EligiusResourceImporter;');\r\n\r\n return result.join('\\n');\r\n}\r\n\r\nfunction _gatherImportPaths(\r\n config: IEngineConfiguration,\r\n configPath: string,\r\n assetInfo: IAssetInfo[]\r\n): ImportInfo[] {\r\n return [\r\n ..._gatherOperations(config),\r\n ...assetInfo.flatMap((info) =>\r\n _gatherAssets(configPath, info.path, info.extension)\r\n ),\r\n ..._gatherControllers(config),\r\n ..._gatherProviders(config),\r\n ..._gatherEngines(config),\r\n ];\r\n}\r\n\r\nfunction _gatherAssets(assetPath: string, subdir: string, extension: string) {\r\n const entries = fs.readdirSync(path.join(assetPath, subdir));\r\n return entries.map((file) => {\r\n const importName = `${dashToCamelCase(path.basename(file, extension))}`;\r\n return {\r\n systemName: importName,\r\n path: `./${subdir}/${file}`,\r\n defaultImport: true,\r\n };\r\n });\r\n}\r\n\r\nfunction _gatherControllers(config: IEngineConfiguration) {\r\n let importPaths = [] as [] as ImportInfo[];\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(config.initActions)\r\n );\r\n importPaths.push(..._gatherControllerImportPathsFromActions(config.actions));\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(\r\n config.timelines.flatMap((x) => x.timelineActions)\r\n )\r\n );\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(config.eventActions)\r\n );\r\n importPaths = dedupe(importPaths);\r\n return importPaths;\r\n}\r\n\r\nfunction _gatherProviders(config: any) {\r\n if (config.timelineProviderSettings) {\r\n return Object.values(config.timelineProviderSettings).map<ImportInfo>(\r\n (settings: any) => {\r\n return {\r\n systemName: settings.systemName,\r\n };\r\n }\r\n );\r\n }\r\n return [] as ImportInfo[];\r\n}\r\n\r\nfunction _gatherEngines(config: any) {\r\n if (config.engine) {\r\n const { systemName } = config.engine;\r\n return [\r\n {\r\n systemName,\r\n },\r\n ];\r\n }\r\n return [];\r\n}\r\n\r\nfunction _gatherOperations(config: IEngineConfiguration): ImportInfo[] {\r\n let importPaths = _gatherOperationImportPathsFromActions(\r\n config.initActions\r\n .concat(config.actions)\r\n .concat(config.eventActions ?? ([] as any[]))\r\n );\r\n\r\n if (config.timelines) {\r\n const timelineActions = config.timelines.flatMap((x) => x.timelineActions);\r\n\r\n importPaths = importPaths.concat(\r\n _gatherOperationImportPathsFromActions(timelineActions)\r\n );\r\n }\r\n\r\n return dedupe(importPaths);\r\n}\r\n\r\nfunction _gatherControllerImportPathsFromActions(\r\n actionsConfig?: IActionConfiguration[] | IEndableActionConfiguration[]\r\n): ImportInfo[] {\r\n if (!actionsConfig) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n const operations = actionsConfig.flatMap((x) => [\r\n ...x.startOperations,\r\n ...((x as any).endOperations ?? []),\r\n ]);\r\n\r\n return _gatherControllerImportPaths(operations);\r\n}\r\n\r\nfunction _gatherOperationImportPathsFromActions(\r\n actionsConfig?: IActionConfiguration[] | IEndableActionConfiguration[]\r\n): ImportInfo[] {\r\n if (!actionsConfig) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n const operations = actionsConfig.flatMap((x) => [\r\n ...x.startOperations,\r\n ...((x as any).endOperations ?? []),\r\n ]);\r\n\r\n return _gatherOperationImportPaths(operations);\r\n}\r\n\r\nfunction _gatherControllerImportPaths(\r\n operationConfigs: IOperationConfiguration[]\r\n): ImportInfo[] {\r\n if (!operationConfigs) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n return operationConfigs\r\n .filter((operationConfig) => {\r\n if (operationConfig.operationData?.hasOwnProperty('systemName')) {\r\n return operationConfig.operationData.systemName.endsWith('Controller');\r\n }\r\n return false;\r\n })\r\n .map((operationConfig) => {\r\n const { systemName } = operationConfig.operationData ?? {};\r\n return {\r\n systemName,\r\n };\r\n });\r\n}\r\n\r\nfunction _gatherOperationImportPaths(operationConfigs: any[]): ImportInfo[] {\r\n if (!operationConfigs) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n return operationConfigs.map((operationConfig) => {\r\n const { systemName } = operationConfig;\r\n return {\r\n systemName,\r\n };\r\n });\r\n}\r\n\r\nfunction dedupe(importPaths: ImportInfo[]): ImportInfo[] {\r\n const lookup: Record<string, true> = {};\r\n return importPaths.filter((imp) => {\r\n if (lookup[imp.systemName]) {\r\n return false;\r\n }\r\n lookup[imp.systemName] = true;\r\n return true;\r\n });\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IAddClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation adds the specified class name to the specified selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const addClass: TOperation<IAddClassOperationData> = function (\r\n operationData: IAddClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.addClass(className);\r\n return operationData;\r\n};\r\n","import { IController } from '../../controllers/types';\r\n\r\nexport const controllersDataName = 'eligiusEngineControllers';\r\n\r\nfunction getElementData(name: string, element: JQuery): IController<any>[] {\r\n return element.data(name);\r\n}\r\n\r\nconst getElementControllers = getElementData.bind(null, controllersDataName);\r\n\r\nexport { getElementData, getElementControllers };\r\n\r\n","import { TOperationData } from '../types';\r\n\r\nexport function mergeOperationData<T extends TOperationData, K = T>(\r\n operationData: T,\r\n newOperationData: TOperationData\r\n): K {\r\n return { ...(operationData as any), ...newOperationData } as K;\r\n}\r\n","import { TOperationData } from '../types';\r\nimport { mergeOperationData } from './merge-operation-data';\r\n\r\nexport function internalResolve(\r\n resolve: Function,\r\n operationData: TOperationData,\r\n newOperationData?: TOperationData\r\n) {\r\n if (newOperationData) {\r\n resolve(mergeOperationData(operationData, newOperationData));\r\n } else {\r\n resolve(operationData);\r\n }\r\n}\r\n","import { IController } from '../controllers/types';\r\nimport { attachControllerToElement } from './helper/attach-controller-to-element';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { IOperationContext, TOperation, TOperationData } from './types';\r\n\r\nexport type IAddControllerToElementOperationData<\r\n T extends TOperationData = TOperationData\r\n> = {\r\n selectedElement: JQuery;\r\n controllerInstance: IController<T>;\r\n} & T;\r\n\r\n/**\r\n * This operation adds the specified controller instance to the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const addControllerToElement: TOperation<IAddControllerToElementOperationData> =\r\n function <T extends TOperationData = TOperationData>(\r\n this: IOperationContext,\r\n operationData: IAddControllerToElementOperationData<T>\r\n ) {\r\n const { selectedElement, controllerInstance } = operationData;\r\n\r\n attachControllerToElement(selectedElement, controllerInstance);\r\n\r\n controllerInstance.init(operationData);\r\n\r\n const promise = controllerInstance.attach(this.eventbus);\r\n\r\n if (promise) {\r\n return new Promise((resolve, reject) => {\r\n promise.then((newOperationData: TOperationData) => {\r\n internalResolve(resolve, operationData, newOperationData);\r\n }, reject);\r\n });\r\n } else {\r\n return operationData;\r\n }\r\n };\r\n","import { controllersDataName, getElementControllers } from './get-element-data';\r\n\r\nexport function attachControllerToElement(element: JQuery, controller: any) {\r\n if (!element.data(controllersDataName)) {\r\n element.data(controllersDataName, []);\r\n }\r\n const controllers = getElementControllers(element);\r\n if (controllers) {\r\n controllers.push(controller);\r\n }\r\n}\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IAnimateOperationData {\r\n animationEasing?: string;\r\n selectedElement: JQuery;\r\n animationProperties: any;\r\n animationDuration: JQuery.Duration;\r\n}\r\n\r\n/**\r\n * This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.\r\n * It resolves after the animation completes.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const animate: TOperation<IAnimateOperationData> = function (\r\n operationData: IAnimateOperationData\r\n) {\r\n const {\r\n animationEasing,\r\n selectedElement,\r\n animationProperties,\r\n animationDuration,\r\n } = operationData;\r\n const promise = new Promise<IAnimateOperationData>((resolve, reject) => {\r\n try {\r\n if (animationEasing) {\r\n selectedElement.animate(\r\n animationProperties,\r\n animationDuration,\r\n animationEasing,\r\n () => {\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n );\r\n } else {\r\n selectedElement.animate(animationProperties, animationDuration, () => {\r\n internalResolve(resolve, {}, operationData);\r\n });\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n return promise;\r\n};\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IAnimateWithClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n removeClass?: boolean;\r\n}\r\n\r\n/**\r\n * This operation adds the specified class name to the specified selected element and assumes that this\r\n * class triggers and animation on the selected element. It then waits for this animation to complete\r\n * before it resolves.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const animateWithClass: TOperation<IAnimateWithClassOperationData> =\r\n function (operationData: IAnimateWithClassOperationData) {\r\n let { selectedElement, className, removeClass } = operationData;\r\n removeClass = removeClass !== undefined ? removeClass : true;\r\n\r\n const promise = new Promise<IAnimateWithClassOperationData>(\r\n (resolve, reject) => {\r\n try {\r\n selectedElement.one(\r\n 'webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationEnd',\r\n () => {\r\n if (removeClass) {\r\n selectedElement.removeClass(className);\r\n }\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n );\r\n } catch (e) {\r\n reject(e);\r\n }\r\n }\r\n );\r\n\r\n selectedElement.addClass(className);\r\n\r\n return promise;\r\n };\r\n","export function isString(value: any): value is string {\r\n return typeof value === 'string';\r\n}\r\n","/**\r\n /**\r\n * Gets the value for the given property chain. A property chain is defined by a string array.\r\n *\r\n * For example, this property chain: `[mySource, subSource, element, value]` should be extracted from an object of this shape:\r\n * ```ts\r\n * const foo = {\r\n * mySource: {\r\n * subSource: {\r\n * element: {\r\n * value: 'bar'\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * The result of the invocation `getPropertyChainValue([mySource, subSource, element, value], foo)` would then yield the value `bar`.\r\n * \r\n * @param propertyChain\r\n * @param sourceObject\r\n * @returns\r\n */\r\nexport function getPropertyChainValue(\r\n propertyChain: string[],\r\n sourceObject: any\r\n) {\r\n let currentInstance = sourceObject;\r\n let suffix = null;\r\n\r\n propertyChain.forEach((prop: string, index: number) => {\r\n if (index === propertyChain.length - 1) {\r\n const parts = prop.split('+');\r\n if (parts.length > 1) {\r\n prop = parts[0];\r\n suffix = parts[1];\r\n }\r\n }\r\n currentInstance = currentInstance[prop];\r\n });\r\n\r\n return suffix ? `${currentInstance}${suffix}` : currentInstance;\r\n}\r\n","import { deepCopy } from './deep-copy';\r\nconst cache: Record<string, any> = {};\r\n\r\nfunction _getGlobals(\r\n cache: Record<string, any>,\r\n name?: string\r\n): Record<string, any> | any {\r\n const value = name ? cache[name] : cache;\r\n return value && value !== cache ? deepCopy(value) : value;\r\n}\r\n\r\nfunction _setGlobals(\r\n cache: Record<string, any>,\r\n newValues: Record<string, any>\r\n): void {\r\n Object.entries(newValues).forEach(([name, value]) => (cache[name] = value));\r\n}\r\n\r\nfunction _clearGlobals(cache: Record<string, any>): void {\r\n const keys = Object.keys(cache);\r\n keys.forEach((key) => delete cache[key]);\r\n}\r\n\r\nexport const getGlobals: (name?: string) => Record<string, any> | any =\r\n _getGlobals.bind(null, cache);\r\n\r\nexport const setGlobals: (newValues: Record<string, any>) => void =\r\n _setGlobals.bind(null, cache);\r\n\r\nexport const clearGlobals: () => void = _clearGlobals.bind(null, cache);\r\n","import { isString } from '../../util/guards/is-string';\r\nimport { IOperationContext } from '../types';\r\nimport { getPropertyChainValue } from './get-property-chain-value';\r\nimport { getGlobals } from './globals';\r\n\r\n/**\r\n * Resolves operation and global data property chains.\r\n *\r\n * An operation data property chain is designated by a `operationdata.` suffix, followed by an arbitrary property chain.\r\n * For global data the suffix should be `globaldata.`\r\n *\r\n * If the propertyChainOrRegularObject is not a property chain, this value is returned instead.\r\n *\r\n * @param sourceObject The object that represents the operation data\r\n * @param propertyChainOrRegularObject A period delimited string, or just a regular object\r\n * @returns\r\n */\r\nexport function resolveExternalPropertyChain(\r\n sourceObject: any,\r\n operationContext: IOperationContext,\r\n propertyChainOrRegularObject: any\r\n) {\r\n if (isString(propertyChainOrRegularObject)) {\r\n const propNames = propertyChainOrRegularObject.split('.');\r\n const prefix = propNames.shift()?.toLowerCase();\r\n switch (prefix) {\r\n case 'operationdata':\r\n return getPropertyChainValue(propNames, sourceObject);\r\n case 'globaldata':\r\n return getPropertyChainValue(propNames, getGlobals());\r\n case 'context':\r\n return getPropertyChainValue(propNames, operationContext);\r\n }\r\n }\r\n\r\n return propertyChainOrRegularObject;\r\n}\r\n","import { removeEventDataFromOperationData } from './helper/remove-event-data-from-operation-data';\r\nimport { resolveEventArguments } from './helper/resolve-event-arguments';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IBroadcastEventOperationData {\r\n eventArgs: any[];\r\n eventTopic?: string;\r\n eventName: string;\r\n}\r\n\r\n/**\r\n * This operation broadcasts the given event through the eventbus, along with the\r\n * event argumetns and optional event topic.\r\n *\r\n * @param operationData\r\n */\r\nexport const broadcastEvent: TOperation<IBroadcastEventOperationData> =\r\n function (operationData: IBroadcastEventOperationData) {\r\n const { eventArgs, eventTopic, eventName } = operationData;\r\n\r\n const eventArguments = resolveEventArguments(\r\n operationData,\r\n this,\r\n eventArgs\r\n );\r\n\r\n if (eventTopic) {\r\n this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);\r\n } else {\r\n this.eventbus.broadcast(eventName, eventArguments);\r\n }\r\n\r\n removeEventDataFromOperationData(operationData);\r\n return operationData;\r\n };\r\n","import { IOperationContext, TOperationData } from '../../operation/types';\r\nimport { resolveExternalPropertyChain } from './resolve-external-property-chain';\r\n\r\nexport function resolveEventArguments(\r\n operationData: TOperationData,\r\n operationContext: IOperationContext,\r\n eventArgs?: any[]\r\n) {\r\n if (!eventArgs) {\r\n return;\r\n }\r\n const resolve = resolveExternalPropertyChain.bind(\r\n null,\r\n operationData,\r\n operationContext\r\n );\r\n return eventArgs.map(resolve);\r\n}\r\n","import { TOperationData } from '../../operation/types';\r\n\r\nexport function removeEventDataFromOperationData(\r\n operationData: TOperationData\r\n) {\r\n delete operationData.eventName;\r\n delete operationData.eventTopic;\r\n delete operationData.eventArgs;\r\n}\r\n","import $ from 'jquery';\r\nimport { IOperationContext, TOperationData } from '../../operation/types';\r\nimport { isObject } from '../../util/guards/is-object';\r\nimport { isString } from '../../util/guards/is-string';\r\nimport { deepCopy } from './deep-copy';\r\nimport { resolveExternalPropertyChain } from './resolve-external-property-chain';\r\n\r\nconst cache: any[] = [];\r\n\r\n/**\r\n * This takes a `newProperties` instance, resolves all of the properties on this object and then\r\n * assigns these properties to the given operationData.\r\n * \r\n * @param operationData \r\n * @param operationContext \r\n * @param newProperties \r\n * @returns \r\n */\r\nexport function resolvePropertyValues<T extends TOperationData>(\r\n operationData: T,\r\n operationContext: IOperationContext,\r\n newProperties: Record<string, any>\r\n): T {\r\n const copy =\r\n newProperties !== operationData ? deepCopy(newProperties) : newProperties;\r\n\r\n const resolvePropertyChain = resolveExternalPropertyChain.bind(\r\n null,\r\n operationData,\r\n operationContext\r\n );\r\n\r\n resolveNewProperties(newProperties, copy, resolvePropertyChain);\r\n\r\n return copy as T;\r\n}\r\n\r\nfunction resolveNewProperties(\r\n properties: Record<string, any>,\r\n copy: Record<string, any>,\r\n resolvePropertyChain: (propertyChain: string) => any\r\n) {\r\n // Prevent recursive looping\r\n if (cache.indexOf(properties) > -1) {\r\n return;\r\n }\r\n\r\n cache.push(properties);\r\n\r\n try {\r\n Object.entries(properties).forEach(([key, value]) => {\r\n if (value instanceof $) {\r\n return;\r\n }\r\n\r\n if (isString(value)) {\r\n copy[key] = resolvePropertyChain(value);\r\n } else if (Array.isArray(value)) {\r\n value.forEach((item, index, arr) => {\r\n if (isString(item)) {\r\n arr[index] = resolvePropertyChain(item);\r\n } else {\r\n resolveNewProperties(item, item, resolvePropertyChain);\r\n }\r\n });\r\n } else if (isObject(value)) {\r\n resolveNewProperties(value, value, resolvePropertyChain);\r\n } else {\r\n copy[key] = value;\r\n }\r\n });\r\n } finally {\r\n const index = cache.indexOf(properties);\r\n cache.splice(index, 1);\r\n }\r\n}\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport type TCalculationOperator = '+' | '-' | '*' | '/' | '%' | '**';\r\n\r\nexport interface ICalcOperationData {\r\n left: string | number;\r\n right: string | number;\r\n operator: TCalculationOperator;\r\n calculationResult?: number;\r\n}\r\n\r\nconst calcFunctions: Record<\r\n TCalculationOperator,\r\n (left: number, right: number) => number\r\n> = {\r\n '+': (left: number, right: number) => left + right,\r\n '-': (left: number, right: number) => left - right,\r\n '*': (left: number, right: number) => left * right,\r\n '/': (left: number, right: number) => left / right,\r\n '%': (left: number, right: number) => left % right,\r\n '**': (left: number, right: number) => left ** right,\r\n};\r\n\r\n/**\r\n * This operation calculates the given left and right hand operands using the specified operator.\r\n *\r\n * @param operationData\r\n */\r\nexport const calc: TOperation<ICalcOperationData> = function (\r\n operationData: ICalcOperationData\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n\r\n const { left, right, operator } = operationData;\r\n\r\n operationData.calculationResult = calcFunctions[operator](+left, +right);\r\n\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IClearElementOperationData {\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation removes all of the children from the given selected element.\r\n * \r\n */\r\nexport const clearElement: TOperation<IClearElementOperationData> = function(\r\n operationData: IClearElementOperationData\r\n) {\r\n const { selectedElement } = operationData;\r\n selectedElement.empty();\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IClearOperationDataOperationData {\r\n properties?: string[];\r\n}\r\n\r\n/**\r\n * This operation removes all of the properties on the current operation date.\r\n * Or, if the properties property is set only removes the properties defined by that list.\r\n * \r\n */\r\nexport const clearOperationData: TOperation<IClearOperationDataOperationData> = function(\r\n operationData: IClearOperationDataOperationData\r\n) {\r\n const { properties } = operationData;\r\n\r\n if (properties) {\r\n properties.forEach(name => {\r\n delete (operationData as any)[name];\r\n });\r\n delete operationData.properties;\r\n return operationData;\r\n }\r\n\r\n return {};\r\n};\r\n","import $ from 'jquery';\r\nimport { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\nexport type TTagNames = keyof HTMLElementTagNameMap;\r\n\r\nexport interface ICreateElementOperationData<T extends TTagNames> {\r\n elementName: T;\r\n text?: string;\r\n attributes?: Partial<HTMLElementTagNameMap[T]>;\r\n template?: JQuery;\r\n}\r\n\r\n/**\r\n * This operation creates the DOM element described by the given elementName and attributes and assigns\r\n * the instance to the `template` property on the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const createElement: TOperation<ICreateElementOperationData<any>> =\r\n function <T extends TTagNames>(\r\n this: IOperationContext,\r\n operationData: ICreateElementOperationData<T>\r\n ) {\r\n operationData = resolvePropertyValues(\r\n operationData,\r\n this,\r\n operationData\r\n ) as ICreateElementOperationData<T>;\r\n\r\n const { elementName, attributes, text } = operationData;\r\n\r\n const serializedAttrs = attributes\r\n ? ` ${Object.entries(attributes)\r\n .filter(([_, value]) => Boolean(value))\r\n .map(([key, value]) => `${key}=\"${value}\"`)\r\n .join(' ')}`\r\n : '';\r\n\r\n const template = text\r\n ? $(`<${elementName}${serializedAttrs}>${text}</${elementName}>`)\r\n : $(`<${elementName}${serializedAttrs}/>`);\r\n\r\n operationData.template = template;\r\n\r\n return operationData;\r\n };\r\n","/**\r\n * These are the event names that are being braodcast and/or handled by Eligius.\r\n */\r\nexport class TimelineEventNames {\r\n // timeline requests\r\n /**\r\n * Broadcasting this event will start the current timeline when it is currently paused, or pauses when it is playing.\r\n */\r\n static PLAY_TOGGLE_REQUEST = 'timeline-play-toggle-request';\r\n /**\r\n * Broadcasting this event will start the current timeline.\r\n */\r\n static PLAY_REQUEST = 'timeline-play-request';\r\n /**\r\n * Broadcasting this event will stop the current timeline.\r\n */\r\n static STOP_REQUEST = 'timeline-stop-request';\r\n /**\r\n * Broadcasting this event will pause the current timeline.\r\n */\r\n static PAUSE_REQUEST = 'timeline-pause-request';\r\n /**\r\n * Broadcasting this event will seek the specified position in the current timeline.\r\n * This event takes one argument: A numeric value that represents the new position.\r\n */\r\n static SEEK_REQUEST = 'timeline-seek-request';\r\n /**\r\n * Broadcasting this event will tell the current {@link ITimelineProvider} to resize.\r\n */\r\n static RESIZE_REQUEST = 'timeline-resize-request';\r\n /**\r\n * Broadcasting this event will return the element in which the current timeline is being rendered.\r\n * This event takes one argument: The callback function that will return the specified element.\r\n */\r\n static CONTAINER_REQUEST = 'timeline-container-request';\r\n /**\r\n * Broadcasting this event will return the duration of the current timeline.\r\n * This event takes one argument: The callback function that will return the duration.\r\n */\r\n static DURATION_REQUEST = 'timeline-duration-request';\r\n /**\r\n * Broadcasting this event will return the uri of the current timeline.\r\n * This event takes one argument: The callback function that will return the uri.\r\n */\r\n static REQUEST_CURRENT_TIMELINE = 'timeline-request-current-timeline';\r\n\r\n // timeline announcements\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce their duration.\r\n */\r\n static DURATION = 'timeline-duration';\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce the current play position whenever it changes.\r\n */\r\n static TIME = 'timeline-time';\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce the new play position and duration after a seek was executed.\r\n */\r\n static SEEKED = 'timeline-seeked';\r\n /**\r\n *\r\n */\r\n static COMPLETE = 'timeline-complete';\r\n static RESTART = 'timeline-restart';\r\n static PLAY = 'timeline-play';\r\n static STOP = 'timeline-stop';\r\n static PAUSE = 'timeline-pause';\r\n static SEEK = 'timeline-seek';\r\n static RESIZE = 'timeline-resize';\r\n static CURRENT_TIMELINE_CHANGE = 'timeline-current-timeline-change';\r\n static FIRST_FRAME = 'timeline-firstframe';\r\n\r\n // factory and engine events\r\n static REQUEST_INSTANCE = 'request-instance';\r\n static REQUEST_ACTION = 'request-action';\r\n static REQUEST_FUNCTION = 'request-function';\r\n static REQUEST_TIMELINE_URI = 'request-timeline-uri';\r\n static BEFORE_REQUEST_TIMELINE_URI = 'before-request-timeline-uri';\r\n static REQUEST_ENGINE_ROOT = 'request-engine-root';\r\n static REQUEST_CURRENT_TIMELINE_POSITION =\r\n 'request-current-timeline-position';\r\n static REQUEST_TIMELINE_CLEANUP = 'request-timeline-cleanup';\r\n static EXECUTE_TIMELINEACTION = 'execute-timelineaction';\r\n static RESIZE_TIMELINEACTION = 'resize-timelineaction';\r\n\r\n //language manager events\r\n static REQUEST_LABEL_COLLECTION = 'request-label-collection';\r\n static REQUEST_LABEL_COLLECTIONS = 'request-label-collections';\r\n static REQUEST_CURRENT_LANGUAGE = 'request-current-language';\r\n static LANGUAGE_CHANGE = 'language-change';\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ICustomFunctionOperationData {\r\n systemName: string;\r\n}\r\n\r\n/**\r\n * This operation retrieves a custom function defined by the given system name\r\n * and invokes it with the current operation data and eventbus.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const customFunction: TOperation<ICustomFunctionOperationData> =\r\n function (operationData: ICustomFunctionOperationData) {\r\n const { systemName } = operationData;\r\n return new Promise<ICustomFunctionOperationData>((resolve, reject) => {\r\n const resultCallback = (func: Function) => {\r\n const promise = func.apply(this, [operationData]);\r\n if (promise) {\r\n promise.then(() => {\r\n internalResolve(resolve, {}, operationData);\r\n }, reject);\r\n } else {\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_FUNCTION, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n });\r\n };\r\n","import { IEndableAction } from '../action/types';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IEndActionOperationData {\r\n actionInstance: IEndableAction;\r\n actionOperationData: any;\r\n}\r\n\r\n/**\r\n * This operation invokes the {@link EndableAction.end} method on the specified action instance.\r\n *\r\n * The action operation data is first merged with the current operation data before it is\r\n * passed on to the action. After the action has completed the action operation data properties\r\n * are removed from the current operation data.\r\n * \r\n * @param operationData\r\n * @returns\r\n */\r\nexport const endAction: TOperation<IEndActionOperationData> = function (\r\n operationData: IEndActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n delete operationData.actionOperationData;\r\n\r\n return new Promise<IEndActionOperationData>((resolve, reject) => {\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n actionInstance.end(operationData).then(() => {\r\n Object.keys(actionOperationData).forEach((key) => {\r\n delete (operationData as any)[key];\r\n });\r\n internalResolve(resolve, operationData);\r\n }, reject);\r\n });\r\n};\r\n","import { TOperation, TOperationData } from './types';\r\n\r\n/**\r\n * This operation checks if the current loop should end or start the next iteration.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const endLoop: TOperation<TOperationData> = function (\r\n operationData: TOperationData\r\n) {\r\n if (\r\n this.loopIndex !== undefined &&\r\n this.loopLength !== undefined &&\r\n this.loopIndex < this.loopLength\r\n ) {\r\n this.loopIndex = this.loopIndex + 1;\r\n this.newIndex = this.loopStartIndex;\r\n delete this.currentItem;\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\n/**\r\n * This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.\r\n * \r\n * @param operationData \r\n * @returns \r\n */\r\nexport const endWhen: TOperation<{}> = function (operationData: {}) {\r\n delete this.whenEvaluation;\r\n return operationData;\r\n};\r\n","import { IController } from '../controllers/types';\r\nimport { TOperation } from './types';\r\n\r\n/**\r\n * This operation extends the specified controller instance with the specified extension.\r\n */\r\nexport interface IExtendControllerOperationData {\r\n controllerInstance: IController<any>;\r\n controllerExtension: any;\r\n}\r\n\r\nexport const extendController: TOperation<IExtendControllerOperationData> =\r\n function (operationData: IExtendControllerOperationData) {\r\n const { controllerInstance, controllerExtension } = operationData;\r\n\r\n operationData.controllerInstance = Object.assign(\r\n controllerInstance,\r\n controllerExtension\r\n );\r\n\r\n return operationData;\r\n };\r\n","import { IController } from '../controllers/types';\r\nimport { getElementControllers } from './helper/get-element-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetControllerFromElementOperationData {\r\n selectedElement: JQuery;\r\n controllerName: string;\r\n controllerInstance?: IController<any>;\r\n}\r\n\r\n/**\r\n * This operation retrieves the controller instance with the specified name that is assigned to the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getControllerFromElement: TOperation<IGetControllerFromElementOperationData> =\r\n function (operationData: IGetControllerFromElementOperationData) {\r\n const { selectedElement, controllerName } = operationData;\r\n const controllers = getElementControllers(selectedElement);\r\n const controller = controllers.find((ctrl) => {\r\n return ctrl.name === controllerName;\r\n });\r\n\r\n if (!controller) {\r\n console.warn(\r\n `controller for name '${controllerName}' was not found on the given element`\r\n );\r\n }\r\n\r\n operationData.controllerInstance = controller;\r\n return operationData;\r\n };\r\n","import * as controllers from '../controllers';\r\nimport { IController } from '../controllers/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\ntype TSystemName = keyof typeof controllers;\r\nexport interface IGetControllerInstanceOperationData {\r\n systemName: TSystemName;\r\n controllerInstance?: IController<TOperationData>;\r\n}\r\n\r\n/**\r\n * This operation retrieves an instance of the given controller name.\r\n * It assigns this instance to the `controllerInstance` property on the current operation data\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getControllerInstance: TOperation<IGetControllerInstanceOperationData> =\r\n function (operationData: IGetControllerInstanceOperationData) {\r\n const { systemName } = operationData;\r\n\r\n operationData.controllerInstance = undefined;\r\n const resultCallback = (instance: IController<TOperationData>) => {\r\n operationData.controllerInstance = instance;\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_INSTANCE, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n return operationData;\r\n };\r\n","import { modifyDimensions } from './helper/modify-dimensions';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetElementDimensionsOperationData {\r\n selectedElement: JQuery;\r\n modifier?: string;\r\n dimensions?: { width?: number; height?: number };\r\n}\r\n\r\n/**\r\n * This operation calculates the width and height of the given selected element.\r\n * It assigns this struct to the dimensions property on the current operation data.\r\n * Optionally the width and height can be modified using the given modifier string.\r\n *\r\n * The modifier string is formatted in the following way:\r\n *\r\n * <operator><amount><optional-side><optional-precentage>|<ratio-definition>\r\n *\r\n * Where the ratio modifier is formatted in the following way:\r\n * <side>[ar=<ratio-left>-<ratio-right>]\r\n *\r\n * For example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\r\n * it will add a value of 100 to the height and modify the width by a ration of 8 to 1 relative to the height.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getElementDimensions: TOperation<IGetElementDimensionsOperationData> =\r\n function (operationData: IGetElementDimensionsOperationData) {\r\n const { selectedElement, modifier } = operationData;\r\n let dimensions = {\r\n width: selectedElement.innerWidth() ?? 0,\r\n height: selectedElement.innerHeight() ?? 0,\r\n };\r\n if (dimensions.height === 0) {\r\n dimensions.height = dimensions.width;\r\n }\r\n if (modifier) {\r\n dimensions = modifyDimensions(dimensions, modifier);\r\n }\r\n operationData.dimensions = dimensions;\r\n return operationData;\r\n };\r\n","import { IDimensions } from '../../types';\r\n\r\nfunction _modifyDimensionsByRatio(\r\n ratioModifier: string,\r\n dimensions: IDimensions\r\n) {\r\n const modifiedDimensions = { ...dimensions };\r\n //h[ar=8-1]\r\n let prefix = ratioModifier.substring(0, 1);\r\n\r\n let ratio = ratioModifier.substring(\r\n ratioModifier.indexOf('[') + 1,\r\n ratioModifier.indexOf(']') - (ratioModifier.indexOf('[') - 1)\r\n );\r\n\r\n let ratios = ratio.split('=')[1].split('-');\r\n\r\n if (ratios.filter(Boolean).length !== 2) {\r\n throw new Error(`Badly formatted modifier, expect two ratios: ${ratio}`);\r\n }\r\n\r\n if (prefix === 'h') {\r\n modifiedDimensions.height =\r\n (modifiedDimensions.width / +ratios[0]) * +ratios[1];\r\n } else if (prefix === 'w') {\r\n modifiedDimensions.width =\r\n (modifiedDimensions.height / +ratios[1]) * +ratios[0];\r\n }\r\n\r\n return modifiedDimensions;\r\n}\r\n\r\nfunction _getModifierSuffix(\r\n modifier: string //*100h%\r\n): [string | null, number, boolean] {\r\n let endIdx = 1;\r\n let suffix: string | null = modifier.substring(\r\n modifier.length - endIdx,\r\n modifier.length\r\n );\r\n\r\n if (suffix !== 'h' && suffix !== 'w' && suffix !== '%') {\r\n suffix = null;\r\n }\r\n\r\n const isPercent = suffix === '%';\r\n\r\n if (isPercent) {\r\n suffix = modifier.substring(\r\n modifier.length - endIdx,\r\n modifier.length - (endIdx + 1)\r\n );\r\n\r\n if (suffix !== 'h' && suffix !== 'w') {\r\n suffix = null;\r\n }\r\n }\r\n\r\n return [suffix, endIdx, isPercent];\r\n}\r\n\r\nfunction _modifyDimensions(\r\n dimensions: IDimensions,\r\n prefix: string,\r\n suffix: string | null,\r\n widthModifier: number,\r\n heightModifier: number\r\n) {\r\n const modifiedDimension = { ...dimensions };\r\n switch (prefix) {\r\n case '+':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height += heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width += widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height += heightModifier;\r\n modifiedDimension.width += widthModifier;\r\n }\r\n break;\r\n case '-':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height -= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width -= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height -= heightModifier;\r\n modifiedDimension.width -= widthModifier;\r\n }\r\n break;\r\n case '/':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height /= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width /= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height /= heightModifier;\r\n modifiedDimension.width /= widthModifier;\r\n }\r\n break;\r\n case '*':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height *= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width *= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height *= heightModifier;\r\n modifiedDimension.width *= widthModifier;\r\n }\r\n break;\r\n default:\r\n console.error(`Unknown operator found: ${prefix}`);\r\n }\r\n return modifiedDimension;\r\n}\r\n\r\n/**\r\n * Modifies the given dimensions using the given modifier string.\r\n * The modifier string is formatted in the following way:\r\n *\r\n * <operator><amount><optional-side><optional-precentage>|<ratio-definition>\r\n *\r\n * Where the ratio modifier is formatted in the following way:\r\n * <side>[ar=<ratio-left>-<ratio-right>]\r\n *\r\n * For example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\r\n * it will add a value of 100 to the height and modify the width by a ration of 8 to 1 relative to the height.\r\n *\r\n * @param dimensions\r\n * @param modifier\r\n */\r\nexport function modifyDimensions(dimensions: IDimensions, modifier: string) {\r\n const clonedDimensions = { ...dimensions };\r\n let ratioModifier: string | null = null;\r\n if (modifier.indexOf('|') > -1) {\r\n [modifier, ratioModifier] = modifier.split('|');\r\n }\r\n\r\n const prefix = modifier.substring(0, 1);\r\n let [suffix, endIdx, isPercent] = _getModifierSuffix(modifier);\r\n\r\n const value = parseInt(\r\n suffix !== null\r\n ? modifier.substring(1, modifier.length - (endIdx - 1))\r\n : modifier.substring(1),\r\n 10\r\n );\r\n\r\n let widthModifier = value;\r\n let heightModifier = value;\r\n if (isPercent) {\r\n widthModifier = (clonedDimensions.width / 100) * value;\r\n heightModifier = (clonedDimensions.height / 100) * value;\r\n }\r\n\r\n const modifiedDimension = _modifyDimensions(\r\n clonedDimensions,\r\n prefix,\r\n suffix,\r\n widthModifier,\r\n heightModifier\r\n );\r\n\r\n if (ratioModifier) {\r\n return _modifyDimensionsByRatio(ratioModifier, modifiedDimension);\r\n }\r\n\r\n return modifiedDimension;\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetImportOperationData {\r\n systemName: string;\r\n importedInstance?: any;\r\n}\r\n\r\n/**\r\n * This operation retrieves the import specified by the given system name and\r\n * assigns it to the importedInstance property on the current operaton date.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getImport: TOperation<IGetImportOperationData> = function (\r\n operationData: IGetImportOperationData\r\n) {\r\n const { systemName } = operationData;\r\n const callBack = (instance: any) => {\r\n operationData.importedInstance = instance;\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_FUNCTION, [\r\n systemName,\r\n callBack,\r\n ]);\r\n delete (operationData as any).systemName;\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IGetQueryParamsOperationData {\r\n /**\r\n * The query params will be added as property/values to this object.\r\n * So, the query string `?foo=bar&bar=foo` will result in:\r\n * ```json\r\n * {\r\n * foo: \"bar\",\r\n * bar: \"foo\"\r\n * }\r\n * ```\r\n * This object will be assigned to the `queryParams` property.\r\n */\r\n queryParams?: Record<string, string>;\r\n /**\r\n * The properties on this object will be assigned to the queryParams result\r\n * when the given property name is not part of the query string.\r\n */\r\n defaultValues?: Record<string, string>;\r\n}\r\n\r\n/**\r\n * This operation retrieves the current query parameters from the browser's address bar and places\r\n * them on the returned operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getQueryParams: TOperation<IGetQueryParamsOperationData> =\r\n function (operationData: IGetQueryParamsOperationData) {\r\n const searchParams = new URLSearchParams(window.location.search);\r\n const queryParams = Object.fromEntries(searchParams.entries());\r\n\r\n const { defaultValues = {} } = operationData;\r\n delete (operationData as any).defaultValues;\r\n\r\n operationData.queryParams = {\r\n ...defaultValues,\r\n ...queryParams,\r\n };\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IInvokeObjectMethodOperationData {\r\n /**\r\n * The given object instance\r\n * \r\n */\r\n instance: any;\r\n /**\r\n * The method name on the given object that will be invoked\r\n */\r\n methodName: string;\r\n /**\r\n * Arguments that will be passed to the specified method\r\n */\r\n methodArguments?: any[];\r\n /**\r\n * If any, the results of the method invocation are assigned to the property\r\n */\r\n methodResult?: any;\r\n}\r\n\r\n/**\r\n * This operation invokes the specified method on the given object with the given optional arguments\r\n * and assigns the result to the `methodResult` operationdata property.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const invokeObjectMethod: TOperation<IInvokeObjectMethodOperationData> =\r\n function (operationData: IInvokeObjectMethodOperationData) {\r\n const { methodName, methodArguments } = operationData;\r\n delete (operationData as any).methodName;\r\n delete (operationData as any).methodArguments;\r\n\r\n operationData.methodResult = (operationData.instance as any)[\r\n methodName\r\n ].apply(operationData.instance, methodArguments ?? []);\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nconst jsonCache: Record<string, any> = {};\r\n\r\nexport interface ILoadJSONOperationData {\r\n /**\r\n * The URL where the JSON will be retrieved from\r\n */\r\n url: string;\r\n /**\r\n * If true, the results will be added to the cache and any subsequent call will use this cache\r\n */\r\n cache: boolean;\r\n /**\r\n * The JSON retrieved from the given URL\r\n */\r\n json?: any;\r\n}\r\n\r\nexport const clearCache = () => {\r\n for (let p in jsonCache) {\r\n delete jsonCache[p];\r\n }\r\n};\r\n\r\nexport const addToCache = (key: string, value: any) => {\r\n jsonCache[key] = value;\r\n};\r\n\r\n/**\r\n * This operation loads a JSON file from the specified url and assigns it to the json\r\n * property on the current operation data.\r\n *\r\n * If the cache property is set to true and a cached value already exists, this is assigned\r\n * instead of re-retrieving it from the url.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const loadJSON: TOperation<ILoadJSONOperationData> = async function (\r\n operationData: ILoadJSONOperationData\r\n) {\r\n const { url, cache } = operationData;\r\n\r\n if (cache && jsonCache[url]) {\r\n operationData.json = jsonCache[url];\r\n return operationData;\r\n }\r\n\r\n const response = await fetch(url);\r\n const json = await response.json();\r\n const cacheValue = (operationData.json = json);\r\n\r\n if (cache) {\r\n addToCache(url, cacheValue);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { deepCopy } from './helper/deep-copy';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\n/**\r\n * This operation logs the current operation data and context to the console.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const log: TOperation<TOperationData> = function (\r\n operationData: TOperationData\r\n) {\r\n console.group('Operation info');\r\n console.dir({ context: deepCopy(this) });\r\n console.dir({ operationData: deepCopy(operationData) });\r\n console.groupEnd();\r\n return operationData;\r\n};\r\n","import { isFunction } from '../util/guards/is-function';\r\nimport { isString } from '../util/guards/is-string';\r\nimport { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IMathOperationData {\r\n args: (number | string | keyof Math)[];\r\n functionName: keyof Math;\r\n mathResult?: number;\r\n}\r\n\r\n/**\r\n * This operation performs the given math function with the specified arguments.\r\n *\r\n * @param operationData\r\n */\r\nexport const math: TOperation<IMathOperationData> = function (\r\n operationData: IMathOperationData\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n operationData.args = resolveMathConstants(operationData.args);\r\n\r\n const { args, functionName } = operationData;\r\n\r\n operationData.mathResult = (Math[functionName] as Function).apply(null, args);\r\n\r\n return operationData;\r\n};\r\n\r\nfunction resolveMathConstants(args: any[]) {\r\n return args.map((arg: any) => {\r\n if (isMathProperty(arg)) {\r\n return Math[arg];\r\n }\r\n return arg;\r\n });\r\n}\r\n\r\nfunction isMathProperty(value: string | Symbol): value is keyof Math {\r\n return (\r\n isString(value) && value in Math && !isFunction(Math[value as keyof Math])\r\n );\r\n}\r\n","import { IResolvedOperation } from '../../configuration/types';\r\n\r\n/**\r\n * This function can be used to find the index of a matching operation within a list of operations.\r\n * \r\n * Given the array of operations:\r\n * ```ts\r\n * [\r\n * {systemName:'name1'}, // index 0\r\n * {systemName:'startLoop'}, // index 1\r\n * {systemName:'name2'}, // index 2\r\n * {systemName:'startLoop'} // index 3\r\n * {systemName:'name3'} // index 4\r\n * {systemName:'endLoop'} // index 5\r\n * {systemName:'endLoop'} // index 6\r\n * {systemName:'name3'} // index 7\r\n * ]\r\n * ```\r\n * \r\n * Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.\r\n * \r\n * Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.\r\n * \r\n * If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.\r\n * \r\n * If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.\r\n *\r\n * @param this\r\n * @param operation\r\n * @returns\r\n */\r\nexport function findMatchingOperationIndex(\r\n this: { counter: number; self: string; matchingName: string },\r\n operation: IResolvedOperation\r\n) {\r\n if (operation.systemName === this.self) {\r\n this.counter = this.counter + 1;\r\n return false;\r\n }\r\n\r\n if (operation.systemName === this.matchingName && this.counter === 0) {\r\n return true;\r\n }\r\n\r\n if (operation.systemName === this.matchingName && this.counter > 0) {\r\n this.counter = this.counter - 1;\r\n }\r\n\r\n return false;\r\n}\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\n/**\r\n * If the preceeding {@link when} operation evaluates to `true` subsequent operations will\r\n * be skipped until an {@link endWhen} operation is encountered.\r\n * \r\n * @param operationData \r\n * @returns \r\n */\r\nexport const otherwise: TOperation<{}> = function (operationData: {}) {\r\n if (this.whenEvaluation) {\r\n this.newIndex = findEndWhenIndex(this);\r\n }\r\n return operationData;\r\n};\r\n\r\nfunction findEndWhenIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const endWhenIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'endWhen',\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemoveClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation removes the spcified class name from the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeClass: TOperation<IRemoveClassOperationData> = function (\r\n operationData: IRemoveClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.removeClass(className);\r\n return operationData;\r\n};\r\n","import { IController } from '../controllers/types';\r\nimport { getElementControllers } from './helper/get-element-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IRemoveControllerFromElementOperationData {\r\n selectedElement: JQuery;\r\n controllerName: string;\r\n}\r\n\r\n/**\r\n * This operation removes the controller with the specified name from the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeControllerFromElement: TOperation<IRemoveControllerFromElementOperationData> =\r\n function (operationData: IRemoveControllerFromElementOperationData) {\r\n const { selectedElement, controllerName } = operationData;\r\n\r\n const controllers = getElementControllers(selectedElement);\r\n const controller = controllers?.find(\r\n (ctrl: IController<any>) => ctrl.name === controllerName\r\n );\r\n\r\n if (controller) {\r\n const idx = controllers.indexOf(controller);\r\n controllers.splice(idx, 1);\r\n controller.detach(this.eventbus);\r\n }\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemoveElementOperationData {\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation removes the given selected element from the DOM.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeElement: TOperation<IRemoveElementOperationData> = function (\r\n operationData: IRemoveElementOperationData\r\n) {\r\n const { selectedElement } = operationData;\r\n selectedElement.remove();\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemovePropertiesFromOperationDataOperationData {\r\n propertyNames: string[];\r\n}\r\n\r\n/**\r\n * This operation removes the given list of properties from the current operation data.\r\n * It will also omit the property 'propertyNames' from the result.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removePropertiesFromOperationData: TOperation<IRemovePropertiesFromOperationDataOperationData> =\r\n function (operationData: IRemovePropertiesFromOperationDataOperationData) {\r\n const { propertyNames } = operationData;\r\n if (propertyNames.indexOf('propertyNames') < 0) {\r\n propertyNames.push('propertyNames');\r\n }\r\n\r\n return Object.fromEntries(\r\n Object.entries(operationData).filter(\r\n ([name, _value]) => !propertyNames.includes(name)\r\n )\r\n ) as any;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IReparentElementOperationData {\r\n selectedElement: JQuery;\r\n newParentSelector: string;\r\n}\r\n\r\n/**\r\n * This operation moves the given selected element to the new parent that is defined\r\n * by the specified `newParentSelector`.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const reparentElement: TOperation<IReparentElementOperationData> =\r\n function (operationData: IReparentElementOperationData) {\r\n const { selectedElement, newParentSelector } = operationData;\r\n selectedElement.remove().appendTo(newParentSelector);\r\n return operationData;\r\n };\r\n","import { IAction } from '../action/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IRequestActionOperationData {\r\n systemName: string;\r\n actionInstance?: IAction;\r\n}\r\n\r\n/**\r\n * This operation requests an action instance with the specified name and assigns it\r\n * to the `actionInstance` property on the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const requestAction: TOperation<IRequestActionOperationData> = function (\r\n operationData: IRequestActionOperationData\r\n) {\r\n const { systemName } = operationData;\r\n\r\n const resultCallback = (action: IAction) => {\r\n operationData.actionInstance = action;\r\n };\r\n\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_ACTION, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n return operationData;\r\n};\r\n","import { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IResizeActionOperationData {\r\n actionInstance: any;\r\n actionOperationData: any;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const resizeAction: TOperation<IResizeActionOperationData> = function (\r\n operationData: IResizeActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n if (actionInstance.resize) {\r\n return actionInstance.resize(operationData);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation } from './types';\r\n\r\nfunction findElementBySelector(root: JQuery, selector: string) {\r\n const element = root.find(selector);\r\n if (!element.length) {\r\n console.warn(`selector '${selector}' wasn't found!`);\r\n }\r\n return element;\r\n}\r\n\r\nexport interface ISelectElementOperationData {\r\n selector: string;\r\n useSelectedElementAsRoot?: boolean;\r\n selectedElement?: JQuery;\r\n}\r\n\r\n/**\r\n * This operation selects one or more elements using the specified selector.\r\n *\r\n * If `useSelectedElementAsRoot` is set to true and a valid DOM element is assigned\r\n * to the current operation data's `selectedElement` property\r\n * then the element will be looked for only in the descendant elements of this DOM element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const selectElement: TOperation<ISelectElementOperationData> = function (\r\n operationData: ISelectElementOperationData\r\n) {\r\n const { selector, useSelectedElementAsRoot = false } = operationData;\r\n\r\n if (!selector) {\r\n throw new Error('selectElement: selector is either empty or not defined.');\r\n }\r\n\r\n if (useSelectedElementAsRoot && operationData.selectedElement) {\r\n const currentRoot = operationData.selectedElement;\r\n operationData.selectedElement = findElementBySelector(\r\n currentRoot,\r\n selector\r\n );\r\n return operationData;\r\n }\r\n\r\n const rootCallback = (root: JQuery) => {\r\n operationData.selectedElement = findElementBySelector(root, selector);\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [\r\n rootCallback,\r\n ]);\r\n\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface ISetElementAttributesOperationData {\r\n attributes: Record<string, any>;\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation sets the specified set of attributes on the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setElementAttributes: TOperation<ISetElementAttributesOperationData> =\r\n function (operationData: ISetElementAttributesOperationData) {\r\n const { attributes, selectedElement } = operationData;\r\n selectedElement.attr(attributes);\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface ISetElementContentOperationData {\r\n selectedElement: JQuery;\r\n template: string | JQuery.Node;\r\n insertionType: 'overwrite' | 'append' | 'prepend';\r\n}\r\n\r\n/**\r\n * This operation sets the specified content defined by the value assigned to the template property\r\n * to the given selected element.\r\n *\r\n * When the `insertionType` is set to `overwrite` the contents of the selected element are replaced\r\n * by the given template.\r\n * When set to `append` the new content will be inserted after the current content.\r\n * When set to `prepend` the new content will be inserted before the current content.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setElementContent: TOperation<ISetElementContentOperationData> =\r\n function (operationData: ISetElementContentOperationData) {\r\n const {\r\n insertionType = 'overwrite',\r\n selectedElement,\r\n template,\r\n } = operationData;\r\n\r\n switch (true) {\r\n case insertionType === 'overwrite':\r\n selectedElement.html(template);\r\n break;\r\n case insertionType === 'append':\r\n selectedElement.append(template);\r\n break;\r\n case insertionType === 'prepend':\r\n selectedElement.prepend(template);\r\n break;\r\n }\r\n\r\n delete (operationData as any).insertionType;\r\n\r\n return operationData;\r\n };\r\n","import { setGlobals } from './helper/globals';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetGlobalDataOperationData {\r\n properties: string[];\r\n}\r\n\r\n/**\r\n * This operation copies the specified property values from the operationData to the global data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setGlobalData: TOperation<ISetGlobalDataOperationData> = function (\r\n operationData: ISetGlobalDataOperationData\r\n) {\r\n const { properties } = operationData;\r\n const newGlobals = Object.fromEntries(\r\n Object.entries(operationData).filter(([name, _value]) =>\r\n properties.includes(name)\r\n )\r\n );\r\n\r\n setGlobals(newGlobals);\r\n\r\n delete (operationData as any).properties;\r\n\r\n return operationData;\r\n};\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetOperationData {\r\n override?: boolean;\r\n properties: Record<string, any>;\r\n}\r\n\r\n/**\r\n * This operation assigns the specified properties to the current operation data.\r\n * When override is set to true the properties replace the current operation data entirely.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setOperationData: TOperation<ISetOperationData> = function (\r\n operationData: ISetOperationData\r\n) {\r\n const { override = false, properties } = operationData;\r\n delete (operationData as any).properties;\r\n delete operationData.override;\r\n\r\n const resolvedProperties = resolvePropertyValues(\r\n operationData,\r\n this,\r\n properties\r\n );\r\n\r\n if (override) {\r\n return resolvedProperties;\r\n }\r\n\r\n return {\r\n ...operationData,\r\n ...resolvedProperties,\r\n };\r\n};\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetStyleOperationData {\r\n properties: Record<string, any>;\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation assigns the specified CSS style properties to the\r\n * given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setStyle: TOperation<ISetStyleOperationData> = function (\r\n operationData: ISetStyleOperationData\r\n) {\r\n const properties = resolvePropertyValues(\r\n operationData,\r\n this,\r\n operationData.properties\r\n );\r\n operationData.selectedElement.css(properties as JQuery.PlainObject);\r\n\r\n return operationData;\r\n};\r\n","import { IAction } from '../action/types';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\nexport interface IStartActionOperationData {\r\n actionInstance: IAction;\r\n actionOperationData: TOperationData;\r\n}\r\n\r\n/**\r\n * This operation starts the specified action instance using the given action operation data.\r\n *\r\n * The action operation data is first merged with the current operation data before it is\r\n * passed on to the action. After the action has completed the action operation data properties\r\n * are removed from the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const startAction: TOperation<IStartActionOperationData> = function (\r\n operationData: IStartActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n delete (operationData as any).actionOperationData;\r\n\r\n return new Promise((resolve, reject) => {\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n actionInstance.start(operationData).then(() => {\r\n Object.keys(actionOperationData).forEach((key) => {\r\n delete (operationData as any)[key];\r\n });\r\n internalResolve(resolve, operationData);\r\n }, reject);\r\n });\r\n};\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\nexport interface IStartLoopOperationData {\r\n collection: any[] | string;\r\n}\r\n\r\n/**\r\n * This operation starts a loop using the given collection.\r\n *\r\n * Each iteration the current item from the specified collection is\r\n * assigned to the {@link IOperationContext.currentItem} property on the operation context.\r\n *\r\n * At the start of the loop, the associated {@link endLoop} operation is determined and when\r\n * the last iteration is completed the flow control is set to the index of that operation.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const startLoop: TOperation<IStartLoopOperationData> = function (\r\n operationData: IStartLoopOperationData\r\n) {\r\n const { collection } = operationData;\r\n\r\n if (collection !== null && !Array.isArray(collection)) {\r\n throw new Error(\r\n 'Expected collection to be array type, string value was probably not resolved correctly'\r\n );\r\n }\r\n\r\n // First iteration of the loop\r\n if (this.loopIndex === undefined) {\r\n this.loopEndIndex = findLoopEndIndex(this);\r\n if (collection?.length) {\r\n this.loopIndex = 0;\r\n this.loopLength = collection.length - 1;\r\n this.loopStartIndex = this.currentIndex;\r\n } else {\r\n this.newIndex = this.loopEndIndex;\r\n\r\n delete this.loopIndex;\r\n delete this.loopLength;\r\n delete this.loopStartIndex;\r\n delete this.loopEndIndex;\r\n }\r\n }\r\n\r\n if (collection?.length && this.loopIndex !== undefined) {\r\n this.currentItem = collection[this.loopIndex];\r\n }\r\n\r\n return operationData;\r\n};\r\n\r\nfunction findLoopEndIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const index = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'startLoop',\r\n matchingName: 'endLoop',\r\n })\r\n );\r\n const endLoopIndex =\r\n index > -1 ? index + currentIndex : context.operations.length;\r\n\r\n return endLoopIndex;\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IToggleClassOperationData {\r\n /**\r\n * The element on which the class will be toggled\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * The class that will be toggled\r\n */\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation toggles the specfied class name on the given selected element.\r\n * \r\n * Meaning, if the specified class name exists on the given element it will be removed,\r\n * otherwise it will be added.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const toggleClass: TOperation<IToggleClassOperationData> = function (\r\n operationData: IToggleClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.toggleClass(className);\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IToggleElementOperationData {\r\n /**\r\n * The element whose visibility will be toggled\r\n */\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation toggles the visibility of the given selected element.\r\n * \r\n * Meaning, if the element is hidden, it will be made visible, otherwise\r\n * it will be hidden.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const toggleElement: TOperation<IToggleElementOperationData> =\r\n function toggleElement(operationData: IToggleElementOperationData) {\r\n operationData.selectedElement.toggle();\r\n return operationData;\r\n };\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IWaitOperationData {\r\n /**\r\n * The amount of milliseconds the operation will wait for.\r\n */\r\n milliseconds: number;\r\n}\r\n\r\n/**\r\n * This operation waits for the specified amount of milliseconds.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const wait: TOperation<IWaitOperationData> = function (\r\n operationData: IWaitOperationData\r\n) {\r\n const { milliseconds } = operationData;\r\n\r\n return new Promise((resolve) => {\r\n setTimeout(() => {\r\n internalResolve(resolve, operationData);\r\n }, milliseconds);\r\n });\r\n};\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { resolveExternalPropertyChain } from './helper/resolve-external-property-chain';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\ntype TOperator = '!=' | '==' | '>=' | '<=' | '>' | '<';\r\ntype TValue =\r\n | `'${string}'`\r\n | number\r\n | `operationdata.${string}`\r\n | `globaldata.${string}`\r\n | `context.${string}`;\r\n\r\ntype TExpression = `${TValue}${TOperator}${TValue}`;\r\n\r\nexport interface IWhenOperationData {\r\n expression: TExpression;\r\n}\r\n\r\n/**\r\n * When the given expression evaluates to false, subsequent operations will be skipped\r\n * until an {@link endWhen} or {@link otherwise} operation is encountered.\r\n * \r\n * Practically, this means an `if` or `if`/`else` statement control flow implementation in a list of operations.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const when: TOperation<IWhenOperationData> = function (\r\n operationData: IWhenOperationData\r\n) {\r\n const [left, operator, right] = parseExpression(\r\n operationData.expression,\r\n operationData,\r\n this\r\n );\r\n\r\n this.whenEvaluation = evaluations[operator](left, right);\r\n\r\n if (!this.whenEvaluation) {\r\n this.newIndex = findNextFlowControlIndex(this);\r\n }\r\n\r\n delete (operationData as any).expression;\r\n\r\n return operationData;\r\n};\r\n\r\nfunction parseExpression(\r\n expression: TExpression,\r\n operationData: IWhenOperationData,\r\n operationContext: IOperationContext\r\n): [TValue, TOperator, TValue] {\r\n let [left, right] = expression.split(/!=|==|>=|<=|>|</);\r\n const operator = expression.substring(\r\n left.length,\r\n expression.length - right.length\r\n ) as TOperator;\r\n const leftNr = +left;\r\n const rightNr = +right;\r\n return [\r\n (isNaN(leftNr)\r\n ? resolveExternalPropertyChain(operationData, operationContext, left)\r\n : leftNr) as TValue,\r\n operator,\r\n (isNaN(rightNr)\r\n ? resolveExternalPropertyChain(operationData, operationContext, right)\r\n : rightNr) as TValue,\r\n ];\r\n}\r\n\r\nconst evaluations: Record<\r\n TOperator,\r\n (left: string | number, right: string | number) => boolean\r\n> = {\r\n '==': (left: string | number, right: string | number) => left === right,\r\n '!=': (left: string | number, right: string | number) => left !== right,\r\n '>=': (left: string | number, right: string | number) => left >= right,\r\n '<=': (left: string | number, right: string | number) => left <= right,\r\n '>': (left: string | number, right: string | number) => left > right,\r\n '<': (left: string | number, right: string | number) => left < right,\r\n};\r\n\r\nfunction findNextFlowControlIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const otherWiseIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'otherwise',\r\n })\r\n );\r\n if (otherWiseIndex > -1) {\r\n return otherWiseIndex + currentIndex;\r\n }\r\n\r\n const endWhenIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'endWhen',\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport * as operations from '../../operation';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { TOperation, TOperationData } from '../../operation/types';\r\nimport {\r\n ExtractDataType,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n ITimelineActionConfiguration,\r\n} from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\nexport class ActionCreatorFactory {\r\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\r\n\r\n createAction(name: string): EndableActionCreator {\r\n const creator = new EndableActionCreator(name, this);\r\n this.configurationfactory.addAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createInitAction(name: string): EndableActionCreator {\r\n const creator = new EndableActionCreator(name, this);\r\n this.configurationfactory.addInitAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createEventAction(name: string): ActionCreator {\r\n const creator = new ActionCreator(name, this);\r\n this.configurationfactory.addEventAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createTimelineAction(uri: string, name: string): TimelineActionCreator {\r\n const creator = new TimelineActionCreator(name, this);\r\n this.configurationfactory.addTimelineAction(uri, creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n end() {\r\n return this.configurationfactory;\r\n }\r\n}\r\n\r\nexport class ActionCreator<\r\n T extends IActionConfiguration = IActionConfiguration\r\n> {\r\n actionConfig: T;\r\n\r\n constructor(\r\n name: string | undefined,\r\n private readonly factory: ActionCreatorFactory\r\n ) {\r\n this.actionConfig = {\r\n name: '',\r\n id: uuidv4(),\r\n startOperations: [],\r\n } as any;\r\n if (name?.length) {\r\n this.actionConfig.name = name;\r\n }\r\n }\r\n\r\n getId() {\r\n return this.actionConfig.id;\r\n }\r\n\r\n setName(name: string) {\r\n this.actionConfig.name = name;\r\n return this;\r\n }\r\n\r\n getConfiguration(callBack: (config: T) => T) {\r\n const copy = deepCopy(this.actionConfig);\r\n const newConfig = callBack.call(this, copy);\r\n if (newConfig) {\r\n this.actionConfig = newConfig;\r\n }\r\n return this;\r\n }\r\n\r\n addStartOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ) {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addStartOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addStartOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as Record<string, any>)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const { startOperations } = this.actionConfig;\r\n startOperations.push({\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n });\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.factory;\r\n }\r\n}\r\n\r\nexport class EndableActionCreator<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration\r\n> extends ActionCreator<T> {\r\n constructor(name: string | undefined, factory: ActionCreatorFactory) {\r\n super(name, factory);\r\n this.actionConfig.endOperations = [];\r\n }\r\n\r\n addEndOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ) {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addEndOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addEndOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as Record<string, any>)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n let { endOperations } = this.actionConfig;\r\n if (!endOperations) {\r\n endOperations = this.actionConfig.endOperations = [];\r\n }\r\n endOperations.push({\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n });\r\n return this;\r\n }\r\n}\r\n\r\nexport class TimelineActionCreator extends EndableActionCreator<\r\n ITimelineActionConfiguration\r\n> {\r\n addDuration(start: number, end?: number) {\r\n this.actionConfig.duration = {\r\n start: start,\r\n };\r\n if (end) {\r\n this.actionConfig.duration.end = end;\r\n }\r\n return this;\r\n }\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport * as operations from '../../operation';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { TOperation, TOperationData } from '../../operation/types';\r\nimport { IDuration } from '../../types';\r\nimport {\r\n ExtractDataType,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IOperationConfiguration,\r\n ITimelineActionConfiguration,\r\n} from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\ntype TOperationName = keyof typeof operations;\r\n\r\nfunction array_move(arr: any[], old_index: number, new_index: number) {\r\n if (new_index >= arr.length) {\r\n new_index = 0;\r\n } else if (new_index < 0) {\r\n new_index = arr.length - 1;\r\n }\r\n arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\r\n}\r\n\r\nexport class ActionEditor<\r\n T extends IActionConfiguration = IActionConfiguration\r\n> {\r\n constructor(\r\n protected actionConfig: T,\r\n protected readonly configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n updateConfiguration() {\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n };\r\n }\r\n\r\n getConfiguration(callBack: (config: T) => T | undefined) {\r\n const copy = deepCopy(this.actionConfig);\r\n const newConfig = callBack.call(this, copy);\r\n if (newConfig) {\r\n this.actionConfig = newConfig;\r\n }\r\n return this;\r\n }\r\n\r\n setName(name: string) {\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n name,\r\n };\r\n return this;\r\n }\r\n\r\n getName() {\r\n return this.actionConfig.name;\r\n }\r\n\r\n addStartOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ): OperationEditor<this> {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addStartOperation(\r\n entries[0] as TOperationName,\r\n operationData\r\n );\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addStartOperation(\r\n systemName: TOperationName,\r\n operationData: TOperationData,\r\n id?: string\r\n ): OperationEditor<this> {\r\n if (!(operations as any)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n\r\n const newConfig = {\r\n id: id ?? uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n };\r\n\r\n startOperations.push(newConfig);\r\n\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n\r\n return new OperationEditor<this>(newConfig, this);\r\n }\r\n\r\n editStartOperation(id: string) {\r\n const { startOperations } = this.actionConfig;\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (isDefined(operation)) {\r\n return new OperationEditor<ActionEditor<T>>(operation, this);\r\n }\r\n\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n removeStartOperation(id: string) {\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (!operation) {\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n const idx = startOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n startOperations.splice(idx, 1);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n moveStartOperation(id: string, direction: 'up' | 'down') {\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (!operation) {\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n const idx = startOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\r\n array_move(startOperations, idx, newIdx);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\nexport class EndableActionEditor<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration\r\n> extends ActionEditor<T> {\r\n addEndOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ): OperationEditor<this> {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addEndOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addEndOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as any)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n\r\n const newConfig = {\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n };\r\n\r\n endOperations.push(newConfig);\r\n\r\n this.actionConfig.endOperations = endOperations;\r\n\r\n return new OperationEditor<this>(newConfig, this);\r\n }\r\n\r\n editEndOperation(id: string) {\r\n const { endOperations } = this.actionConfig;\r\n const operationConfig = endOperations.find(o => o.id === id);\r\n\r\n if (isDefined(operationConfig)) {\r\n return new OperationEditor<this>(operationConfig, this);\r\n }\r\n\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n removeEndOperation(id: string) {\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n const operation = endOperations.find(o => o.id === id);\r\n\r\n if (!isDefined(operation)) {\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n const idx = endOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n endOperations.splice(idx, 1);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n endOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n moveEndOperation(id: string, direction: 'up' | 'down') {\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n const operation = endOperations.find(o => o.id === id);\r\n\r\n if (!isDefined(operation)) {\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n const idx = endOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\r\n array_move(endOperations, idx, newIdx);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n endOperations,\r\n };\r\n }\r\n return this;\r\n }\r\n}\r\n\r\nexport class TimelineActionEditor extends EndableActionEditor<\r\n ITimelineActionConfiguration\r\n> {\r\n setDuration(start: number, end?: number) {\r\n if (end != undefined && start > end) {\r\n throw Error('start position cannot be higher than end position');\r\n }\r\n\r\n const duration: IDuration = {\r\n start,\r\n };\r\n\r\n if (end) {\r\n duration.end = end;\r\n }\r\n\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n duration,\r\n };\r\n return this;\r\n }\r\n}\r\n\r\nexport class OperationEditor<T extends ActionEditor> {\r\n constructor(\r\n private operationConfig: IOperationConfiguration,\r\n private actionEditor: T\r\n ) {}\r\n\r\n getConfiguration(\r\n callBack: (config: IOperationConfiguration) => IOperationConfiguration\r\n ) {\r\n const copy = deepCopy(this.operationConfig);\r\n const newConfig = callBack.call(this, copy);\r\n\r\n if (newConfig) {\r\n this.operationConfig = newConfig;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n getSystemName() {\r\n return this.operationConfig.systemName;\r\n }\r\n\r\n setSystemName(systemName: TOperationName) {\r\n if (!operations[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n this.operationConfig.systemName = systemName;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n setOperationData(operationData: TOperationData) {\r\n this.operationConfig.operationData = operationData;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n setOperationDataItem(key: string, value: any) {\r\n const { operationData = {} } = this.operationConfig;\r\n operationData[key] = value;\r\n return this.setOperationData(operationData);\r\n }\r\n\r\n getOperationDataKeys() {\r\n const { operationData } = this.operationConfig;\r\n return operationData ? Object.keys(operationData) : [];\r\n }\r\n\r\n getOperationDataValue(key: string) {\r\n const { operationData } = this.operationConfig;\r\n return operationData?.[key];\r\n }\r\n\r\n next() {\r\n return this.actionEditor;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport {\r\n IResolvedEngineConfiguration,\r\n IResolvedTimelineConfiguration,\r\n} from '../configuration/types';\r\nimport { animationInterval } from '../util/animation-interval';\r\nimport { ITimelineProvider, TPlayState } from './types';\r\n\r\ntype TUpdateMethod = (now: number) => void;\r\n\r\nexport class RequestAnimationFrameTimelineProvider\r\n implements ITimelineProvider\r\n{\r\n private _currentPosition: number = 0;\r\n private _updateBound: TUpdateMethod = this._update.bind(this);\r\n private _firstFramePending = true;\r\n private _currentPlaylistItem: IResolvedTimelineConfiguration;\r\n private _tickInterval = 1000;\r\n private _playlist: IResolvedTimelineConfiguration[];\r\n private _containerElement: JQuery<HTMLElement> | undefined;\r\n private _abortController: AbortController | undefined;\r\n private _onTime: ((position: number) => void) | undefined;\r\n private _onComplete: (() => void) | undefined;\r\n private _onRestart: (() => void) | undefined;\r\n private _onFirstFrame: (() => void) | undefined;\r\n loop: boolean = false;\r\n\r\n private _playState: TPlayState = 'stopped';\r\n public get playState(): TPlayState {\r\n return this._playState;\r\n }\r\n\r\n constructor(config: IResolvedEngineConfiguration) {\r\n this._playlist = this._extractPlaylist(config);\r\n this._currentPlaylistItem = this._playlist[0];\r\n }\r\n\r\n private _extractPlaylist(\r\n configuration: IResolvedEngineConfiguration\r\n ): IResolvedTimelineConfiguration[] {\r\n const playlist = configuration.timelines.filter(\r\n (timeline) => timeline.type === 'animation'\r\n );\r\n return playlist;\r\n }\r\n\r\n onTime(callback: (position: number) => void) {\r\n this._onTime = callback;\r\n }\r\n\r\n onComplete(callback: () => void) {\r\n this._onComplete = callback;\r\n }\r\n\r\n onRestart(callback: () => void) {\r\n this._onRestart = callback;\r\n }\r\n\r\n onFirstFrame(callback: () => void) {\r\n this._onFirstFrame = callback;\r\n }\r\n\r\n playlistItem(uri: string): void {\r\n if (uri === null || !uri.length || this._playlist.length === 0) {\r\n return;\r\n }\r\n\r\n const item = this._playlist.find((item) => {\r\n return item.uri === uri;\r\n });\r\n\r\n if (!item) {\r\n throw new Error(`Unknown playlist uri: ${uri}`);\r\n }\r\n\r\n this._currentPlaylistItem = item;\r\n }\r\n\r\n private _update(_now: number): void {\r\n if (this.playState !== 'running') {\r\n return;\r\n }\r\n\r\n this._currentPosition++;\r\n\r\n if (this._currentPosition > this._currentPlaylistItem.duration) {\r\n if (this.loop) {\r\n this._resetToStartPosition();\r\n this._onRestart?.();\r\n this._callbackPosition();\r\n } else {\r\n this.stop();\r\n this._onComplete?.();\r\n return;\r\n }\r\n }\r\n\r\n this._callbackPosition();\r\n }\r\n\r\n private _callbackPosition() {\r\n this._onTime?.(this._currentPosition);\r\n }\r\n\r\n start() {\r\n if (this.playState === 'running') {\r\n if (this._currentPosition == 0) {\r\n this._callbackPosition();\r\n }\r\n return;\r\n }\r\n\r\n this._playState = 'running';\r\n this._abortController?.abort();\r\n this._abortController = new AbortController();\r\n\r\n if (this._firstFramePending) {\r\n this._firstFramePending = false;\r\n this._onFirstFrame?.();\r\n }\r\n if (this._currentPosition == 0) {\r\n this._callbackPosition();\r\n }\r\n\r\n animationInterval(\r\n this._tickInterval,\r\n this._abortController.signal,\r\n this._updateBound\r\n );\r\n }\r\n\r\n private _resetToStartPosition() {\r\n this._currentPosition = 0;\r\n }\r\n\r\n getContainer() {\r\n return this._containerElement;\r\n }\r\n\r\n private _stopAnimationInterval(resetPosition: boolean = true) {\r\n this._abortController?.abort();\r\n this._abortController = undefined;\r\n\r\n if (resetPosition) {\r\n this._resetToStartPosition();\r\n }\r\n }\r\n\r\n init(): Promise<void> {\r\n this._currentPlaylistItem = this._playlist[0];\r\n this._containerElement = $(this._currentPlaylistItem.selector);\r\n\r\n if (!this._containerElement.length) {\r\n throw new Error(\r\n `timeline selector '${this._currentPlaylistItem.selector}' not found`\r\n );\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n destroy() {\r\n this.stop();\r\n this._containerElement = undefined;\r\n }\r\n\r\n stop() {\r\n this._stopAnimationInterval();\r\n this._playState = 'stopped';\r\n }\r\n\r\n pause() {\r\n this._stopAnimationInterval(false);\r\n this._playState = 'stopped';\r\n }\r\n\r\n seek(position: number) {\r\n if (position < 0 || position > this._currentPlaylistItem.duration) {\r\n return Promise.resolve(this._currentPosition);\r\n }\r\n this._currentPosition = position;\r\n return Promise.resolve(position);\r\n }\r\n\r\n getPosition() {\r\n return this._currentPosition;\r\n }\r\n\r\n getDuration() {\r\n return this._currentPlaylistItem.duration;\r\n }\r\n}\r\n","// https://gist.github.com/jakearchibald/cb03f15670817001b1157e62a076fe95\r\nexport function animationInterval(\r\n ms: number,\r\n signal: AbortSignal,\r\n callback: (time: number) => void\r\n) {\r\n // Prefer currentTime, as it'll better sync animations queued in the\r\n // same frame, but if it isn't supported, performance.now() is fine.\r\n const start = document?.timeline?.currentTime ?? performance.now();\r\n\r\n function frame(time: number) {\r\n if (signal.aborted) return;\r\n callback(time);\r\n scheduleFrame(time);\r\n }\r\n\r\n function scheduleFrame(time: number) {\r\n const elapsed = time - start;\r\n const roundedElapsed = Math.round(elapsed / ms) * ms;\r\n const targetNext = start + roundedElapsed + ms;\r\n const delay = targetNext - performance.now();\r\n setTimeout(() => requestAnimationFrame(frame), delay);\r\n }\r\n\r\n scheduleFrame(start);\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport * as timelineProviders from '../../timelineproviders';\r\nimport { TimelineTypes } from '../../types';\r\nimport { ITimelineProviderSettings, TTimelineProviderSettings } from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\nexport class TimelineProvidersSettingsEditor {\r\n constructor(\r\n private providersSettings: TTimelineProviderSettings,\r\n private configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n addProvider(timelineType: TimelineTypes) {\r\n if (this.providersSettings[timelineType]) {\r\n throw new Error(\r\n `Settings for a '${timelineType}' provider already exist`\r\n );\r\n }\r\n const settings: ITimelineProviderSettings = {\r\n id: uuidv4(),\r\n poster: undefined,\r\n selector: undefined,\r\n systemName: '',\r\n vendor: '',\r\n };\r\n this.providersSettings[timelineType] = settings;\r\n return new TimelineProviderSettingsEditor(\r\n settings,\r\n this,\r\n this.configurationFactory\r\n );\r\n }\r\n\r\n editProvider(timelineType: TimelineTypes) {\r\n if (!this.providersSettings[timelineType]) {\r\n throw new Error(`No settings for a '${timelineType}' provider exist yet`);\r\n }\r\n\r\n return new TimelineProviderSettingsEditor(\r\n this.providersSettings[timelineType] as ITimelineProviderSettings,\r\n this,\r\n this.configurationFactory\r\n );\r\n }\r\n\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\nexport class TimelineProviderSettingsEditor {\r\n constructor(\r\n private providerSettings: ITimelineProviderSettings,\r\n private providersSettingsEditor: TimelineProvidersSettingsEditor,\r\n private configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n setVendor(vendor: string) {\r\n this.providerSettings.vendor = vendor;\r\n return this;\r\n }\r\n\r\n setSelector(selector: string) {\r\n this.providerSettings.selector = selector;\r\n return this;\r\n }\r\n\r\n setSystemName(systemName: string) {\r\n if (!(timelineProviders as any)[systemName]) {\r\n throw new Error(`Unknown timeline provider system name: ${systemName}`);\r\n }\r\n this.providerSettings.systemName = systemName;\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.providersSettingsEditor;\r\n }\r\n\r\n end() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { ILabel, ILanguageLabel, TimelineTypes } from '../../types';\r\nimport {\r\n IActionConfiguration,\r\n IEngineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration\r\n} from '../types';\r\nimport { ActionCreatorFactory } from './action-creator-factory';\r\nimport {\r\n ActionEditor,\r\n EndableActionEditor,\r\n TimelineActionEditor\r\n} from './action-editor';\r\nimport { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';\r\n\r\nexport type TEngineConfigurationLists = Pick<\r\n IEngineConfiguration,\r\n | 'availableLanguages'\r\n | 'initActions'\r\n | 'actions'\r\n | 'eventActions'\r\n | 'timelines'\r\n | 'labels'\r\n>;\r\n\r\ntype ConfigurationFactoryExtension = (\r\n this: ConfigurationFactory,\r\n ...rest: any[]\r\n) => void;\r\n\r\n/**\r\n * This class offers a fluent and strongly typed DSL for creating Eligius configurations.\r\n *\r\n * @example Building a configuration using the factory\r\n * To initialize a basic configuration to start off of:\r\n * ```ts\r\n * const factory = new ConfigurationFactory()\r\n * .init(\"en-US\") // Define the default language\r\n * .addLanguage(\"en-US\", \"English\") // Add English as a supported language\r\n * .addLanguage(\"nl-NL\", \"Nederlands\") // Add Dutch as a supported language\r\n * .setLayoutTemplate(\"<div class=\\\"main.container\\\"></div>\") // Add the main container for the presentation\r\n * .setContainerSelector(\"#ct-container\") // Selector for the element in the body that will contain the presentation\r\n * .addTimeline( // Add a first timeline\r\n * 'timeline-1', // Give it a name\r\n * \"animation\", // This is RAF based timeline\r\n * 200, // The duration of the timeline in seconds\r\n * false, // The presentation does NOT play in a loop\r\n * \".timeline-container\" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered\r\n * )\r\n * .editTimelineProviderSettings() // Add a timeline provider\r\n * .addProvider(\"animation\") // One that provides timelines for type 'animation'\r\n * .setSystemName(\"RequestAnimationFrameTimelineProvider\") // The system name of the provider\r\n * .setVendor(\"eligius\") // Eligius is the vendor in this case\r\n * .end(); // This finally returns the ConfigurationFactory instance\r\n * ```\r\n *\r\n * Then to add an init action:\r\n * ```ts\r\n * factory\r\n * .createInitAction(\"GetUserName\")\r\n * .addStartOperationByType(getQueryParams, {\r\n * defaultValues: { username: \"guest\" },\r\n * })\r\n * .addStartOperationByType(setGlobalData, { properties: [\"queryParams\"] });\r\n * ```\r\n *\r\n * After that, add a timeline action:\r\n * ```ts\r\n * factory.createTimelineAction(\"timeline-1\", \"AddIntroContainer\")\r\n * .addDuration(0, 10)\r\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\r\n * .addStartOperationByType(setElementContent, {\r\n * template: '<div class=\"intro-text\"></div>',\r\n * })\r\n * .addEndOperationByType(selectElement, { selector: \".intro-text\" })\r\n * .addEndOperationByType(removeElement, {});\r\n * ```\r\n *\r\n * It also possible to extend the factory with specialized creation methods for the particular\r\n * configuration you are building:\r\n * ```ts\r\n * function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {\r\n * this.createInitAction(actionName)\r\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\r\n * .addStartOperationByType(createElement, { element: 'img', attributes: {src: imageSrc, imageId} })\r\n * .addStartOperationByType(setElementContent, { insertionType: \"append\" })\r\n * .addEndOperationByType(selectElement, { selector: `#${imageId}` })\r\n * .addEndOperationByType(removeElement, {});\r\n * }\r\n *\r\n * const customFactory = ConfigurationFactory.extend(factory, \"addImage\", addImage);\r\n *\r\n * customFactory.addImage(\"MyImageActionName\", \"my-image.png\", \"my-image-id\");\r\n * ```\r\n *\r\n * Finally, retrieve the configuration and save it:\r\n * ```ts\r\n * import fs from \"fs\";\r\n *\r\n * const configuration = customFactory.getConfiguration();\r\n *\r\n * fs.writeFileSync(\"/my/path/configuration.json\", JSON.stringify(configuration), {encoding:'utf-8'})\r\n * ```\r\n *\r\n * The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply\r\n * pass the JSON configuration to the `ConfigurationFactory`'s constructor:\r\n * ```ts\r\n * import myConfiguration from './my-configuration.json';\r\n *\r\n * const factory = new ConfigurationFactory(myConfiguration);\r\n *\r\n * factory.editInitAction(\"existingActionName\")\r\n * .removeEndOperation(\"475fd0ab-5755-4e60-8f7c-e1988a109678\");\r\n * ```\r\n *\r\n */\r\nexport class ConfigurationFactory {\r\n actionCreatorFactory: ActionCreatorFactory;\r\n configuration: IEngineConfiguration;\r\n\r\n constructor(config?: IEngineConfiguration) {\r\n this.configuration = config || ({} as any);\r\n this.actionCreatorFactory = new ActionCreatorFactory(this);\r\n }\r\n\r\n static extend<\r\n T extends ConfigurationFactory,\r\n K extends string | number | symbol,\r\n C extends ConfigurationFactoryExtension\r\n >(factory: T, extensionMethodName: K, extensionMethod: C) {\r\n (factory as any)[extensionMethodName] = extensionMethod.bind(factory);\r\n return factory as T & { [k in K]: typeof extensionMethod };\r\n }\r\n\r\n static extendMultiple<\r\n T extends ConfigurationFactory,\r\n C extends ConfigurationFactoryExtension,\r\n D extends { [name: string]: C }\r\n >(factory: T, extensions: D) {\r\n Object.entries(extensions).forEach(([name, method]) =>\r\n ConfigurationFactory.extend(factory, name, method)\r\n );\r\n return factory as T & typeof extensions;\r\n }\r\n\r\n init(defaultLanguage: string) {\r\n this.configuration = {\r\n id: uuidv4(),\r\n engine: {\r\n systemName: 'EligiusEngine',\r\n },\r\n containerSelector: '[data-ct-container=true]',\r\n timelineProviderSettings: {} as any,\r\n language: defaultLanguage,\r\n availableLanguages: [],\r\n layoutTemplate: '',\r\n initActions: [],\r\n actions: [],\r\n timelines: [],\r\n labels: [],\r\n };\r\n\r\n return this;\r\n }\r\n\r\n setLayoutTemplate(layoutTemplate: string) {\r\n this.configuration.layoutTemplate = layoutTemplate;\r\n return this;\r\n }\r\n\r\n setDefaultLanguage(defaultLanguage: string) {\r\n this.configuration.language = defaultLanguage;\r\n return this;\r\n }\r\n\r\n setContainerSelector(selector: string) {\r\n this.configuration.containerSelector = selector;\r\n return this;\r\n }\r\n\r\n editTimelineProviderSettings() {\r\n return new TimelineProvidersSettingsEditor(\r\n this.configuration.timelineProviderSettings || {},\r\n this\r\n );\r\n }\r\n\r\n getConfiguration(\r\n callBack?: (copy: IEngineConfiguration) => IEngineConfiguration | undefined\r\n ) {\r\n const copy = deepCopy<IEngineConfiguration>(this.configuration);\r\n if (callBack) {\r\n const newConfig = callBack.call(this, copy);\r\n if (newConfig) {\r\n this.configuration = newConfig;\r\n }\r\n }\r\n return copy;\r\n }\r\n\r\n addLanguage(languageCode: string, languageLabel: string) {\r\n const languages = this._initializeCollection(\r\n this.configuration,\r\n 'availableLanguages'\r\n );\r\n const existing = languages.find(\r\n (lang) => lang.languageCode === languageCode\r\n );\r\n\r\n if (existing) {\r\n throw new Error(`Language code '${languageCode}' already exists`);\r\n }\r\n\r\n languages.push({\r\n id: uuidv4(),\r\n languageCode: languageCode,\r\n label: languageLabel,\r\n });\r\n return this;\r\n }\r\n\r\n _internalAddAction(\r\n collectionName: keyof TEngineConfigurationLists,\r\n action: IActionConfiguration\r\n ) {\r\n const actions = this._initializeCollection(\r\n this.configuration,\r\n collectionName\r\n );\r\n actions?.push(action as any);\r\n }\r\n\r\n _initializeCollection<T, K extends keyof T>(parent: T, name: K): T[K] {\r\n if (!parent[name]) {\r\n (parent[name] as any) = [];\r\n }\r\n return parent[name] as T[K];\r\n }\r\n\r\n addAction(action: IActionConfiguration) {\r\n this._internalAddAction('actions', action);\r\n }\r\n\r\n addInitAction(action: IActionConfiguration) {\r\n this._internalAddAction('initActions', action);\r\n }\r\n\r\n addEventAction(action: IActionConfiguration) {\r\n this._internalAddAction('eventActions', action);\r\n }\r\n\r\n addTimelineAction(uri: string, action: ITimelineActionConfiguration) {\r\n const timeline = this.getTimeline(uri);\r\n if (timeline) {\r\n const timelineActions = this._initializeCollection(\r\n timeline,\r\n 'timelineActions'\r\n );\r\n timelineActions.push(action);\r\n } else {\r\n throw Error(`No timeline found for uri '${uri}'`);\r\n }\r\n }\r\n\r\n createAction(name: string) {\r\n return this.actionCreatorFactory.createAction(name);\r\n }\r\n\r\n createInitAction(name: string) {\r\n return this.actionCreatorFactory.createInitAction(name);\r\n }\r\n\r\n createEventAction(name: string) {\r\n return this.actionCreatorFactory.createEventAction(name);\r\n }\r\n\r\n createTimelineAction(uri: string, name: string) {\r\n return this.actionCreatorFactory.createTimelineAction(uri, name);\r\n }\r\n\r\n addTimeline(\r\n uri: string,\r\n type: TimelineTypes,\r\n duration: number,\r\n loop: boolean,\r\n selector: string\r\n ) {\r\n const timelines = this._initializeCollection(\r\n this.configuration,\r\n 'timelines'\r\n );\r\n const timeline = this.getTimeline(uri);\r\n if (timeline) {\r\n throw Error(`timeline for uri ${uri} already exists`);\r\n }\r\n const timelineConfig: ITimelineConfiguration = {\r\n id: uuidv4(),\r\n type: type,\r\n uri: uri,\r\n duration: duration,\r\n loop: loop,\r\n selector: selector,\r\n timelineActions: [],\r\n };\r\n timelines.push(timelineConfig);\r\n return this;\r\n }\r\n\r\n getTimeline(uri: string) {\r\n return this.configuration.timelines.find((t) => t.uri === uri);\r\n }\r\n\r\n removeTimeline(uri: string) {\r\n const timelineConfig = this.getTimeline(uri);\r\n if (timelineConfig) {\r\n const idx = this.configuration.timelines.indexOf(timelineConfig);\r\n if (idx > -1) {\r\n this.configuration.timelines.splice(idx, 1);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n _initializeLabel(id: string, labels: ILanguageLabel[]) {\r\n let label = labels.find((l) => l.id === id);\r\n if (!label) {\r\n labels.push({\r\n id: id,\r\n labels: [],\r\n });\r\n label = labels[labels.length - 1];\r\n }\r\n return label;\r\n }\r\n\r\n _getLabelTranslation(labelTranslations: ILabel[], languageCode: string) {\r\n let translation = labelTranslations.find(\r\n (l) => l.languageCode === languageCode\r\n );\r\n if (!translation) {\r\n translation = {\r\n id: uuidv4(),\r\n languageCode: languageCode,\r\n label: '',\r\n };\r\n labelTranslations.push(translation);\r\n }\r\n return translation;\r\n }\r\n\r\n addLabel(id: string, code: string, translation: string) {\r\n const labels = this._initializeCollection(this.configuration, 'labels');\r\n const labelConfig = this._initializeLabel(id, labels);\r\n const labelTranslation = this._getLabelTranslation(\r\n labelConfig.labels,\r\n code\r\n );\r\n labelTranslation.label = translation;\r\n return this;\r\n }\r\n\r\n removeLabel(id: string) {\r\n const idx = this.configuration.labels.findIndex((x) => x.id === id);\r\n if (idx > -1) {\r\n this.configuration.labels.splice(idx, 1);\r\n } else {\r\n throw new Error(`Label with id '${id}' not found!`);\r\n }\r\n return this;\r\n }\r\n\r\n editAction(id: string) {\r\n const actionConfig = this.configuration.actions.find((a) => a.id === id);\r\n if (actionConfig) {\r\n return new EndableActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Action not found for id ${id}`);\r\n }\r\n\r\n editEventAction(id: string) {\r\n const actionConfig = this.configuration.eventActions?.find(\r\n (a) => a.id === id\r\n );\r\n if (actionConfig) {\r\n return new ActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Event action not found for id ${id}`);\r\n }\r\n\r\n editInitAction(id: string) {\r\n const actionConfig = this.configuration.initActions.find(\r\n (a) => a.id === id\r\n );\r\n if (actionConfig) {\r\n return new EndableActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Init action not found for id ${id}`);\r\n }\r\n\r\n editTimelineAction(uri: string, id: string) {\r\n const timeline = this.getTimeline(uri);\r\n if (!timeline) {\r\n throw new Error(`Timeline not found for id ${id}`);\r\n }\r\n const actionConfig = timeline.timelineActions.find((a) => a.id === id);\r\n if (actionConfig) {\r\n return new TimelineActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Timeline action not found for id ${id}`);\r\n }\r\n}","import { IEndableAction } from '../action/types';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\ninterface IActionInstanceInfo {\r\n start: boolean;\r\n action: IEndableAction;\r\n}\r\n\r\nexport interface IEventListenerControllerOperationData {\r\n selectedElement: JQuery;\r\n eventName: string;\r\n actions: string[];\r\n actionOperationData?: TOperationData;\r\n}\r\n\r\n/**\r\n * This controller attaches to the given selected element and adds an event listener for the specified event name that\r\n * executes the given actions with the given operation data.\r\n * \r\n * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead, \r\n * prefix the action name with `end:`.\r\n */\r\nexport class EventListenerController\r\n implements IController<IEventListenerControllerOperationData>\r\n{\r\n operationData?: IEventListenerControllerOperationData;\r\n actionInstanceInfos?: IActionInstanceInfo[];\r\n name = 'EventListenerController';\r\n\r\n constructor() {}\r\n\r\n init(operationData: IEventListenerControllerOperationData) {\r\n this.operationData = {\r\n selectedElement: operationData.selectedElement,\r\n eventName: operationData.eventName,\r\n actions: operationData.actions.slice(),\r\n actionOperationData: deepCopy(operationData.actionOperationData),\r\n };\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n const { selectedElement, actions, eventName } = this.operationData;\r\n if (!this.actionInstanceInfos) {\r\n this.actionInstanceInfos = [];\r\n\r\n const resultCallback =\r\n (isStart: boolean) => (actionInstance: IEndableAction) => {\r\n this.actionInstanceInfos?.push({\r\n start: isStart,\r\n action: actionInstance,\r\n });\r\n };\r\n\r\n actions.forEach((actionName: string) => {\r\n const [isStart, name] = this._isStartAction(actionName);\r\n eventbus.broadcast(TimelineEventNames.REQUEST_ACTION, [\r\n name,\r\n resultCallback(isStart),\r\n ]);\r\n });\r\n\r\n selectedElement.on(eventName, this._eventHandler.bind(this));\r\n }\r\n }\r\n\r\n private _isStartAction(actionName: string): [boolean, string] {\r\n const prefix = actionName.substring(0, 'end:'.length);\r\n if (prefix === 'end:') {\r\n return [false, actionName.substring('end:'.length)];\r\n } else {\r\n return [true, actionName];\r\n }\r\n }\r\n\r\n private _eventHandler(event: any) {\r\n if (!this.operationData || !this.actionInstanceInfos) {\r\n return;\r\n }\r\n\r\n const actionOperationData = this.operationData.actionOperationData\r\n ? deepCopy(this.operationData.actionOperationData)\r\n : {};\r\n\r\n if (event.target) {\r\n actionOperationData.targetValue = event.target.value;\r\n }\r\n\r\n this._executeAction(this.actionInstanceInfos, actionOperationData, 0);\r\n }\r\n\r\n private async _executeAction(\r\n actions: IActionInstanceInfo[],\r\n operationData: TOperationData,\r\n idx: number\r\n ) {\r\n if (idx < actions.length) {\r\n const actionInfo = actions[idx];\r\n const { action } = actionInfo;\r\n const method = actionInfo.start\r\n ? action.start.bind(action)\r\n : action.end.bind(action);\r\n const resultOperationData = await method(operationData);\r\n this._executeAction(\r\n actions,\r\n Object.assign(operationData, resultOperationData),\r\n ++idx\r\n );\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.operationData?.selectedElement.off(this.operationData.eventName);\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { ILabel } from '../types';\r\nimport { IController } from './types';\r\n\r\nexport interface ILabelControllerMetadata {\r\n selectedElement: JQuery;\r\n labelId: string;\r\n}\r\n\r\n/**\r\n * This controller attaches to the given selected element and renders the text associated with the given label id in it.\r\n * \r\n * The controller also listen for the `LANGUAGE_CHANGE` event and re-renders the text with the new language after such an event.\r\n * \r\n */\r\nexport class LabelController implements IController<ILabelControllerMetadata> {\r\n listeners: TEventbusRemover[] = [];\r\n currentLanguage: string | null = null;\r\n operationData: ILabelControllerMetadata | null = null;\r\n labelData: Record<string, string> = {};\r\n name = 'LabelController';\r\n requestLabelDataBound?: (labelId: string) => void;\r\n\r\n init(operationData: ILabelControllerMetadata) {\r\n this.operationData = Object.assign({}, operationData);\r\n }\r\n\r\n setLabelId(newLabelId: string) {\r\n if (this.requestLabelDataBound) {\r\n this.requestLabelDataBound(newLabelId);\r\n this._setLabel();\r\n }\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [\r\n (language: string) => {\r\n this.currentLanguage = language;\r\n },\r\n ]);\r\n\r\n this.requestLabelDataBound = this._requestLabelData.bind(this, eventbus);\r\n this.requestLabelDataBound(this.operationData.labelId);\r\n\r\n this._setLabel();\r\n this.listeners.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n }\r\n\r\n private _requestLabelData(eventbus: IEventbus, labelId: string) {\r\n eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [\r\n labelId,\r\n (labelCollection: ILabel[]) => {\r\n this._createTextDataLookup(labelCollection);\r\n },\r\n ]);\r\n }\r\n\r\n private _setLabel() {\r\n if (this.currentLanguage) {\r\n this.operationData?.selectedElement.html(\r\n this.labelData[this.currentLanguage]\r\n );\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.listeners.forEach((func) => func());\r\n this.requestLabelDataBound = undefined;\r\n }\r\n\r\n private _handleLanguageChange(code: string) {\r\n this.currentLanguage = code;\r\n this._setLabel();\r\n }\r\n\r\n private _createTextDataLookup(data: ILabel[]) {\r\n data.forEach((d) => {\r\n this.labelData[d.languageCode] = d.label;\r\n });\r\n }\r\n}\r\n","import lottie, {\r\n AnimationConfigWithData,\r\n AnimationItem,\r\n CanvasRendererConfig,\r\n HTMLRendererConfig,\r\n SVGRendererConfig,\r\n} from 'lottie-web';\r\nimport { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface IInnerMetadata {\r\n selectedElement: JQuery;\r\n renderer: SVGRendererConfig | CanvasRendererConfig | HTMLRendererConfig;\r\n loop: boolean;\r\n autoplay: boolean;\r\n animationData: any;\r\n json: any;\r\n labelIds: string[];\r\n viewBox: string;\r\n iefallback: any;\r\n}\r\n\r\nexport interface ILottieControllerMetadata extends IInnerMetadata {\r\n url: string;\r\n}\r\n\r\n/**\r\n * This controller renders a [lottie-web](https://github.com/airbnb/lottie-web) animation inside the given selected element.\r\n *\r\n * The url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json\r\n *\r\n */\r\nexport class LottieController\r\n implements IController<ILottieControllerMetadata>\r\n{\r\n name = 'LottieController';\r\n currentLanguage: string = 'nl-NL';\r\n labelData: Record<string, Record<string, string>> = {};\r\n eventbusRemovers: TEventbusRemover[] = [];\r\n animationItem: AnimationItem | null = null;\r\n operationData: IInnerMetadata | null = null;\r\n serializedData: string | null = null;\r\n serializedIEData: string | null = null;\r\n freezePosition = -1;\r\n endPosition = -1;\r\n\r\n constructor() {}\r\n\r\n init(operationData: ILottieControllerMetadata) {\r\n this.operationData = { ...operationData };\r\n\r\n if (operationData.url.indexOf('[') > -1) {\r\n this._parseFilename(operationData.url);\r\n }\r\n\r\n this.serializedData = this.operationData.json\r\n ? JSON.stringify(this.operationData.json)\r\n : JSON.stringify(this.operationData.animationData);\r\n\r\n if (this.operationData.iefallback) {\r\n this.serializedIEData = JSON.stringify(this.operationData.iefallback);\r\n }\r\n }\r\n\r\n private _parseFilename(name: string) {\r\n const params = name.substring(\r\n name.indexOf('[') + 1,\r\n name.indexOf(']') - name.indexOf('[') - 1\r\n );\r\n\r\n const settings = params.split(',');\r\n\r\n settings.forEach((setting) => {\r\n const values = setting.split('=');\r\n if (values[0] === 'freeze') {\r\n this.freezePosition = +values[1];\r\n } else if (values[0] === 'end') {\r\n this.endPosition = +values[1];\r\n }\r\n });\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n const { labelIds } = this.operationData;\r\n if (labelIds && labelIds.length) {\r\n const resultHolder: {\r\n language: string;\r\n labelCollections: any[];\r\n } = {} as any;\r\n\r\n eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [\r\n resultHolder,\r\n ]);\r\n this.currentLanguage = resultHolder.language;\r\n this.eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, [\r\n this.operationData.labelIds,\r\n resultHolder,\r\n ]);\r\n this._createTextDataLookup(resultHolder.labelCollections);\r\n }\r\n this._createAnimation();\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.eventbusRemovers.forEach((func) => {\r\n func();\r\n });\r\n\r\n if (this.animationItem) {\r\n if (this.endPosition > -1) {\r\n this.animationItem.addEventListener(\r\n 'complete',\r\n this._destroy.bind(this)\r\n );\r\n this.animationItem.playSegments(\r\n [this.freezePosition, this.endPosition],\r\n true\r\n );\r\n } else {\r\n this.animationItem.destroy();\r\n }\r\n }\r\n }\r\n\r\n private _destroy() {\r\n if (this.animationItem) {\r\n this.animationItem.destroy();\r\n this.animationItem = null;\r\n }\r\n }\r\n\r\n private _createAnimation() {\r\n if (!this.operationData || !this.serializedData) {\r\n return;\r\n }\r\n\r\n this.animationItem?.destroy();\r\n let serialized =\r\n this._isIE() && this.serializedIEData\r\n ? this.serializedIEData\r\n : this.serializedData;\r\n\r\n const { labelIds } = this.operationData;\r\n if (labelIds && labelIds.length) {\r\n labelIds.forEach((id) => {\r\n serialized = serialized\r\n .split(`!!${id}!!`)\r\n .join(this.labelData[id][this.currentLanguage]);\r\n });\r\n }\r\n const animationData = JSON.parse(serialized);\r\n\r\n const animationSettings: AnimationConfigWithData<'svg'> = {\r\n autoplay: this.operationData.autoplay,\r\n container: this.operationData.selectedElement[0],\r\n loop: this.operationData.loop,\r\n rendererSettings: this.operationData.renderer,\r\n animationData,\r\n };\r\n\r\n this.animationItem = lottie.loadAnimation(animationSettings);\r\n if (this.endPosition < 0) {\r\n this.endPosition = this.animationItem.timeCompleted;\r\n }\r\n\r\n if (this.freezePosition > -1) {\r\n this.animationItem.playSegments([0, this.freezePosition], true);\r\n }\r\n if (this.operationData.viewBox) {\r\n this.operationData.selectedElement\r\n .find('svg')\r\n .attr('viewBox', this.operationData.viewBox);\r\n }\r\n }\r\n\r\n private _createTextDataLookup(data: any[]) {\r\n data.forEach((infos, index) => {\r\n infos.forEach((d: any) => {\r\n if (this.operationData) {\r\n this.labelData[this.operationData.labelIds[index]][d.code] = d.label;\r\n }\r\n });\r\n });\r\n }\r\n\r\n private _handleLanguageChange(code: string) {\r\n this.currentLanguage = code;\r\n this._createAnimation();\r\n }\r\n\r\n private _isIE() {\r\n const isIE = false || !!(window.document as any)['documentMode'];\r\n\r\n // Edge 20+\r\n const isEdge = !isIE && !!(window as any)['StyleMedia'];\r\n\r\n return isEdge || isIE;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TResultCallback } from '../types';\r\nimport { LabelController } from './label-controller';\r\nimport { IController } from './types';\r\n\r\nexport interface INavigationControllerOperationData {\r\n selectedElement: JQuery;\r\n json: any;\r\n}\r\n\r\nexport class NavigationController\r\n implements IController<INavigationControllerOperationData>\r\n{\r\n name: string = 'NavigationController';\r\n navigation: any[] = [];\r\n navLookup: Record<string, any> = {};\r\n navVidIdLookup: Record<string, any> = {};\r\n ctrlLookup: Record<string, LabelController> = {};\r\n activeNavigationPoint: any | null = null;\r\n labelControllers: LabelController[] = [];\r\n eventhandlers: TEventbusRemover[] = [];\r\n eventbus: IEventbus | null = null;\r\n container: JQuery | null = null;\r\n\r\n constructor() {}\r\n\r\n init(operationData: TOperationData) {\r\n this.container = operationData.selectedElement;\r\n this.navigation = this._buildNavigationData(operationData.json);\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.container) {\r\n return;\r\n }\r\n\r\n this.eventbus = eventbus;\r\n\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'navigate-to-video-url',\r\n this._handleNavigateVideoUrl.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('highlight-navigation', this._highlightMenu.bind(this))\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'request-current-navigation',\r\n this._handleRequestCurrentNavigation.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('video-complete', this._handleVideoComplete.bind(this))\r\n );\r\n\r\n this._buildHtml(this.container, this.navigation);\r\n this._initHistory.bind(this);\r\n }\r\n\r\n private _initHistory() {\r\n this.activeNavigationPoint = this.navVidIdLookup[0];\r\n const navId = this._getQueryVariable(0);\r\n let videoIndex = 0;\r\n if (navId) {\r\n const nav = this.navLookup[navId];\r\n videoIndex = nav.videoUrlIndex;\r\n }\r\n this._highlightMenu(videoIndex);\r\n }\r\n\r\n private _getQueryVariable(variableIdx: number) {\r\n const href = window.location.href;\r\n const hashIndex = href.indexOf('#');\r\n if (hashIndex > -1) {\r\n const query = href.substring(hashIndex + 2);\r\n if (query) {\r\n const vars = query.split('/');\r\n return vars[variableIdx];\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private _handleRequestCurrentNavigation(resultCallback: TResultCallback) {\r\n if (this.activeNavigationPoint) {\r\n const labelCtrl = this.ctrlLookup[this.activeNavigationPoint.labelId];\r\n resultCallback({\r\n navigationData: this.activeNavigationPoint,\r\n title: labelCtrl.labelData[labelCtrl.currentLanguage || ''],\r\n });\r\n } else {\r\n resultCallback(null);\r\n }\r\n }\r\n\r\n detach(eventbus: IEventbus) {\r\n this.eventhandlers.forEach((handler) => {\r\n handler();\r\n });\r\n\r\n this.labelControllers.forEach((ctrl) => {\r\n ctrl.detach(eventbus);\r\n });\r\n\r\n this.labelControllers.length = 0;\r\n this.eventbus = null;\r\n this.container = null;\r\n window.onpopstate = null;\r\n }\r\n\r\n private _pushCurrentState(position = -1) {\r\n if (!this.activeNavigationPoint) {\r\n return;\r\n }\r\n const labelCtrl: LabelController =\r\n this.ctrlLookup[this.activeNavigationPoint.labelId];\r\n\r\n if (!labelCtrl) {\r\n return;\r\n }\r\n\r\n const state = {\r\n navigationData: this.activeNavigationPoint,\r\n title: labelCtrl.labelData[labelCtrl.currentLanguage || ''],\r\n position: -1,\r\n };\r\n if (position > -1) {\r\n state.position = position;\r\n }\r\n this.eventbus?.broadcast('push-history-state', [state]);\r\n }\r\n\r\n private _buildHtml(parentElm: JQuery, data: any) {\r\n const ul = $('<ul/>');\r\n data.forEach(this._addNavElement.bind(this, ul));\r\n parentElm.append(ul);\r\n }\r\n\r\n private _addNavElement(parentElm: JQuery, data: any) {\r\n if (data.visible) {\r\n const li = $('<li/>');\r\n const a = $(`<a href='javascript:;' id='nav_${data.videoUrlIndex}'/>`);\r\n li.append(a);\r\n this._addLabel(a, data.labelId);\r\n this._addClickHandler(a, data.videoUrlIndex);\r\n\r\n if (data.children) {\r\n const ul = $('<ul/>');\r\n data.children.forEach(this._addNavElement.bind(this, ul));\r\n li.append(ul);\r\n }\r\n\r\n parentElm.append(li);\r\n }\r\n }\r\n\r\n private _addClickHandler(parentElm: JQuery, videoIndex: number) {\r\n parentElm.mouseup(this._menuMouseupHandler.bind(this, videoIndex));\r\n }\r\n\r\n private _menuMouseupHandler(videoIndex: number) {\r\n const navdata = this.navVidIdLookup[videoIndex];\r\n if (navdata) {\r\n this.eventbus?.broadcast('request-video-url', [navdata.videoUrlIndex]);\r\n this._handleNavigateVideoUrl(navdata.videoUrlIndex);\r\n }\r\n }\r\n\r\n private _handleNavigateVideoUrl(\r\n index: number,\r\n requestedVideoPosition: number = 0\r\n ) {\r\n this._highlightMenu(index);\r\n this.eventbus?.broadcast('request-video-url', [\r\n index,\r\n requestedVideoPosition,\r\n ]);\r\n this.activeNavigationPoint = this.navVidIdLookup[index];\r\n this._pushCurrentState(requestedVideoPosition);\r\n }\r\n\r\n private _highlightMenu(index: number) {\r\n const navElm = $(`#nav_${index}`);\r\n\r\n if (navElm.length) {\r\n $('.current-menu-item').removeClass('current-menu-item');\r\n navElm.addClass('current-menu-item');\r\n }\r\n }\r\n\r\n private _handleVideoComplete(index: number) {\r\n const navData = this.navVidIdLookup[index];\r\n if (navData.autoNext) {\r\n this.eventbus?.broadcast('request-video-url', [\r\n navData.next.videoUrlIndex,\r\n ]);\r\n } else {\r\n this.eventbus?.broadcast('request-video-cleanup');\r\n }\r\n }\r\n\r\n private _addLabel(parentElm: JQuery, labelId: string) {\r\n const data = {\r\n selectedElement: parentElm,\r\n labelId: labelId,\r\n };\r\n const resultCallback = (instance: LabelController) => {\r\n instance.init(data);\r\n instance.attach(this.eventbus as IEventbus);\r\n this.labelControllers.push(instance);\r\n this.ctrlLookup[labelId] = instance;\r\n };\r\n this.eventbus?.broadcast('request-instance', [\r\n 'LabelController',\r\n resultCallback,\r\n ]);\r\n }\r\n\r\n private _buildNavigationData(data: any) {\r\n const result: any[] = [];\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n this.navLookup[nav.id] = nav;\r\n this.navVidIdLookup[nav.videoUrlIndex] = nav;\r\n nav.previous = data.navigationData[index - 1];\r\n });\r\n\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n if (nav.nextId) {\r\n nav.next = this.navLookup[nav.nextId];\r\n delete nav.nextId;\r\n } else {\r\n nav.next = data.navigationData[index + 1];\r\n }\r\n });\r\n\r\n data.roots.forEach((id: string) => {\r\n const nav = this.navLookup[id];\r\n if (nav.children) {\r\n nav.children = nav.children.map((childId: string) => {\r\n return this.navLookup[childId];\r\n });\r\n }\r\n result.push(nav);\r\n });\r\n return result;\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface IProgressbarControllerOperationData {\r\n selectedElement: JQuery;\r\n textElement: JQuery;\r\n}\r\n\r\n/**\r\n * This controller renders a progressbar that displays the progress of the current timeline in the given selected element.\r\n * \r\n * The current progress as a percentage is rendered in the given text element.\r\n */\r\nexport class ProgressbarController\r\n implements IController<IProgressbarControllerOperationData>\r\n{\r\n name: string = 'ProgressbarController';\r\n selectedElement: JQuery | null = null;\r\n textElement: JQuery | null = null;\r\n eventbusRemovers: TEventbusRemover[] = [];\r\n duration: number = 0;\r\n\r\n init(operationData: TOperationData) {\r\n this.selectedElement = operationData.selectedElement;\r\n this.textElement = operationData.textElement;\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n this.eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.TIME,\r\n this._positionUpdateHandler.bind(this)\r\n )\r\n );\r\n eventbus.broadcast(TimelineEventNames.DURATION_REQUEST, [\r\n (duration: number) => (this.duration = duration),\r\n ]);\r\n\r\n this.selectedElement?.css({'pointer-events': 'none'});\r\n\r\n const container = this.selectedElement?.parent();\r\n\r\n if (container) {\r\n const clickHandler = this._clickHandler.bind(this, eventbus);\r\n container.on('click', clickHandler);\r\n this.eventbusRemovers.push(() => container.off('click', clickHandler));\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.eventbusRemovers.forEach((func: () => void) => {\r\n func();\r\n });\r\n }\r\n\r\n private _positionUpdateHandler(position: number) {\r\n const percentage = (100 / this.duration) * position;\r\n this.selectedElement?.css('width', `${percentage}%`);\r\n this.textElement?.text(`${Math.floor(percentage)}%`);\r\n }\r\n\r\n private _clickHandler(eventbus: IEventbus, event: any) {\r\n const element = event.target as HTMLElement;\r\n const rect = element.getBoundingClientRect();\r\n\r\n const x = event.clientX - rect.left; //x position within the element.\r\n\r\n const percentage = (100 / rect.width) * x;\r\n\r\n eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [\r\n Math.round((this.duration / 100) * percentage),\r\n ]);\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { IController } from './types';\r\n\r\nexport interface IRoutingControllerOperationData {\r\n json: any;\r\n}\r\n\r\n/**\r\n * This is a work in progress, do not use this yet please....\r\n */\r\nexport class RoutingController\r\n implements IController<IRoutingControllerOperationData>\r\n{\r\n name = 'RoutingController';\r\n navLookup: Record<string, any> = {};\r\n navVidIdLookup: Record<string, any> = {};\r\n navigation: any = null;\r\n eventhandlers: TEventbusRemover[] = [];\r\n eventbus: IEventbus | null = null;\r\n\r\n constructor() {}\r\n\r\n init(operationData: TOperationData) {\r\n this.navigation = this._buildNavigationData(operationData.json);\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'before-request-video-url',\r\n this._handleBeforeRequestVideoUrl.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('push-history-state', this._handlePushHistoryState.bind(this))\r\n );\r\n this.eventbus = eventbus;\r\n window.onpopstate = this._handlePopstate.bind(this);\r\n\r\n const navId = this._getQueryVariable(0);\r\n if (navId) {\r\n const nav = this.navLookup[navId];\r\n const pos = +this._getQueryVariable(1);\r\n this.eventbus.broadcast('request-video-url', [\r\n nav.videoUrlIndex,\r\n pos,\r\n true,\r\n ]);\r\n } else {\r\n window.history.pushState(\r\n { navigationId: this.navigation[0].id },\r\n '',\r\n `#/${this.navigation[0].id}`\r\n );\r\n }\r\n }\r\n\r\n private _handlePopstate(event: any) {\r\n const navigationId = event.state\r\n ? event.state.navigationId\r\n : this.navigation[0].id;\r\n const position = event.state?.position ?? 0;\r\n const nav = this.navLookup[navigationId];\r\n this.eventbus?.broadcast('highlight-navigation', [nav.videoUrlIndex]);\r\n this.eventbus?.broadcast('request-video-url', [\r\n nav.videoUrlIndex,\r\n position,\r\n true,\r\n ]);\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n if (this.eventhandlers) {\r\n this.eventhandlers.forEach((handler) => {\r\n handler();\r\n });\r\n }\r\n this.eventbus = null;\r\n }\r\n\r\n private _handleBeforeRequestVideoUrl(\r\n _index: number,\r\n _requestedVideoPosition: number = 0,\r\n isHistoryRequest: boolean = false\r\n ) {\r\n isHistoryRequest =\r\n isHistoryRequest !== undefined ? isHistoryRequest : false;\r\n if (!isHistoryRequest) {\r\n const resultCallback = (item: any) => {\r\n this._pushState(item);\r\n };\r\n this.eventbus?.broadcast('request-current-navigation', [resultCallback]);\r\n }\r\n }\r\n\r\n private _getQueryVariable(variableIdx: number) {\r\n const href = window.location.href;\r\n const hashIndex = href.indexOf('#');\r\n if (hashIndex > -1) {\r\n const query = href.substring(hashIndex + 2);\r\n if (query) {\r\n const vars = query.split('/');\r\n return vars[variableIdx];\r\n }\r\n }\r\n return '';\r\n }\r\n\r\n private _handlePushHistoryState(state: any) {\r\n this._pushState(state);\r\n }\r\n\r\n private _pushState(state: any) {\r\n if (state && state.navigationData && state.navigationData.visible) {\r\n let currentPosition = state.position !== undefined ? state.position : -1;\r\n if (currentPosition < 0) {\r\n const resultCallback = (position: number) => {\r\n currentPosition = position > 3 ? position - 3 : 0;\r\n };\r\n this.eventbus?.broadcast('request-current-video-position', [\r\n resultCallback,\r\n ]);\r\n }\r\n\r\n const currentState = window.history.state;\r\n if (\r\n currentState &&\r\n currentState.navigationId !== state.navigationData.id\r\n ) {\r\n window.history.pushState(\r\n { navigationId: state.navigationData.id, position: currentPosition },\r\n state.title,\r\n `#/${state.navigationData.id}/${currentPosition}`\r\n );\r\n } else if (\r\n currentState &&\r\n currentState.navigationId === state.navigationData.id\r\n ) {\r\n window.history.replaceState(\r\n {\r\n navigationId: currentState.navigationId,\r\n position: currentPosition,\r\n },\r\n state.title,\r\n `#/${currentState.navigationId}/${currentPosition}`\r\n );\r\n } else {\r\n window.history.pushState(\r\n { navigationId: state.navigationData.id, position: currentPosition },\r\n state.title,\r\n `#/${state.navigationData.id}/${currentPosition}`\r\n );\r\n }\r\n window.document.title = state.title;\r\n }\r\n }\r\n\r\n private _buildNavigationData(data: any) {\r\n const result: any[] = [];\r\n data.navigationData.forEach((nav: any, index: any) => {\r\n this.navLookup[nav.id] = nav;\r\n this.navVidIdLookup[nav.videoUrlIndex] = nav;\r\n nav.previous = data.navigationData[index - 1];\r\n });\r\n\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n if (nav.nextId) {\r\n nav.next = this.navLookup[nav.nextId];\r\n delete nav.nextId;\r\n } else {\r\n nav.next = data.navigationData[index + 1];\r\n }\r\n });\r\n\r\n data.roots.forEach((id: string) => {\r\n const nav = this.navLookup[id];\r\n if (nav.children) {\r\n nav.children = nav.children.map((childId: string) => {\r\n return this.navLookup[childId];\r\n });\r\n }\r\n result.push(nav);\r\n });\r\n return result;\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface ISubtitlesControllerOperationData {\r\n selectedElement: JQuery;\r\n language: string;\r\n subtitleData: any;\r\n}\r\n\r\nexport class SubtitlesController\r\n implements IController<ISubtitlesControllerOperationData>\r\n{\r\n actionLookup: Record<string, any> = {};\r\n currentLanguage: string | null = null;\r\n lastFunc: Function | null = null;\r\n name = 'SubtitlesController';\r\n\r\n attach(eventbus: IEventbus) {\r\n const detachTime = eventbus.on(\r\n TimelineEventNames.TIME,\r\n this.onTimeHandler.bind(this)\r\n );\r\n const detachSeek = eventbus.on(\r\n TimelineEventNames.SEEKED,\r\n this.onSeekedHandler.bind(this)\r\n );\r\n const detachLangChange = eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this.languageChangeHandler.bind(this)\r\n );\r\n this.internalDetach = this.internalDetach.bind(this, [\r\n detachTime,\r\n detachLangChange,\r\n detachSeek,\r\n ]);\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.internalDetach();\r\n }\r\n\r\n internalDetach(detachMethods?: TEventbusRemover[]) {\r\n if (detachMethods) {\r\n detachMethods.forEach((f) => {\r\n f();\r\n });\r\n }\r\n }\r\n\r\n languageChangeHandler(newLanguage: string) {\r\n this.currentLanguage = newLanguage;\r\n if (this.lastFunc) {\r\n this.lastFunc();\r\n }\r\n }\r\n\r\n removeTitle(container?: JQuery) {\r\n container?.empty();\r\n this.lastFunc = null;\r\n }\r\n\r\n onTimeHandler(position: number) {\r\n const func = this.actionLookup[position];\r\n if (func) {\r\n func();\r\n this.lastFunc = func;\r\n }\r\n }\r\n\r\n onSeekedHandler(arg: any) {\r\n let position = arg.position;\r\n let func = this.actionLookup[position];\r\n while (!func && --position >= 0) {\r\n func = this.actionLookup[position];\r\n }\r\n if (func) {\r\n func();\r\n this.lastFunc = func;\r\n } else {\r\n this.removeTitle();\r\n }\r\n }\r\n\r\n setTitle(container: JQuery, titleLanguageLookup: Record<string, string>) {\r\n if (this.currentLanguage) {\r\n container.html(titleLanguageLookup[this.currentLanguage]);\r\n }\r\n }\r\n\r\n createActionLookup(operationData: TOperationData, container: JQuery) {\r\n const subtitleData = operationData.subtitleData;\r\n const titles = subtitleData[0].titles;\r\n const subtitleTimeLookup: Record<number, () => void> = {};\r\n\r\n for (let i = 0, ii = titles.length; i < ii; i++) {\r\n const titleLanguageLookup: Record<string, string> = {};\r\n\r\n for (let j = 0, jj = subtitleData.length; j < jj; j++) {\r\n const subs = subtitleData[j];\r\n titleLanguageLookup[subs.lang] = subs.titles[i].text;\r\n }\r\n\r\n subtitleTimeLookup[titles[i].duration.start] = this.setTitle.bind(\r\n this,\r\n container,\r\n titleLanguageLookup\r\n );\r\n subtitleTimeLookup[titles[i].duration.end] = this.removeTitle;\r\n }\r\n\r\n return subtitleTimeLookup;\r\n }\r\n\r\n init(operationData: ISubtitlesControllerOperationData) {\r\n const container = operationData.selectedElement;\r\n this.removeTitle = this.removeTitle.bind(this, container);\r\n this.currentLanguage = operationData.language;\r\n this.actionLookup = this.createActionLookup(operationData, container);\r\n }\r\n}\r\n","import { IAddClassOperationData } from '../../operation/add-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction addClass(): IOperationMetadata<IAddClassOperationData> {\r\n return {\r\n description: 'Add a class to the selected element.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default addClass;\r\n","import { IAddControllerToElementOperationData } from '../../operation/add-controller-to-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction addControllerToElement(): IOperationMetadata<\r\n IAddControllerToElementOperationData\r\n> {\r\n return {\r\n description: 'Adds the current controller to the selected element(s)',\r\n dependentProperties: ['selectedElement', 'controllerInstance'],\r\n };\r\n}\r\nexport default addControllerToElement;\r\n","import { IAnimateOperationData } from '../../operation/animate';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction animate(): IOperationMetadata<IAnimateOperationData> {\r\n return {\r\n description:\r\n 'Animates the selected element with the given animation settings.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n animationEasing: 'ParameterType:boolean',\r\n animationProperties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n animationDuration: {\r\n type: 'ParameterType:number',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default animate;\r\n","import { IAnimateWithClassOperationData } from '../../operation/animate-with-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction animateWithClass(): IOperationMetadata<\r\n IAnimateWithClassOperationData\r\n> {\r\n return {\r\n description:\r\n 'Animates the selected element by adding the given animation class.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n removeClass: 'ParameterType:boolean',\r\n },\r\n };\r\n}\r\nexport default animateWithClass;\r\n","import { IBroadcastEventOperationData } from '../../operation/broadcast-event';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction broadcastEvent(): IOperationMetadata<IBroadcastEventOperationData> {\r\n return {\r\n description:\r\n 'Broadcasts an eventbus event with the given type, topic and optional arguments',\r\n properties: {\r\n eventArgs: 'ParameterType:array',\r\n eventTopic: 'ParameterType:eventTopic',\r\n eventName: {\r\n type: 'ParameterType:eventName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default broadcastEvent;\r\n","import { ICalcOperationData } from '../calc';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction calc(): IOperationMetadata<ICalcOperationData> {\r\n return {\r\n description:\r\n 'Calculates the given left and right hand sides using the specified operator',\r\n properties: {\r\n left: {\r\n type: 'ParameterType:number',\r\n description: 'The left operand',\r\n required: true,\r\n },\r\n right: {\r\n type: 'ParameterType:number',\r\n description: 'The right operand',\r\n required: true,\r\n },\r\n operator: [\r\n {\r\n value: '+',\r\n description: 'Adds the left and right operands',\r\n },\r\n {\r\n value: '-',\r\n description: 'Subtracts the left and right operands',\r\n },\r\n {\r\n value: '*',\r\n description: 'Multiplies the left and right operands',\r\n },\r\n {\r\n value: '/',\r\n description: 'Divides the left and right operands',\r\n },\r\n {\r\n value: '%',\r\n description:\r\n 'Returns the remainder left over after the left number is divided into a number of integer portions equal to the right number',\r\n },\r\n {\r\n value: '**',\r\n description:\r\n 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.',\r\n },\r\n ],\r\n },\r\n outputProperties: {\r\n calculationResult: 'ParameterType:number',\r\n },\r\n };\r\n}\r\n\r\nexport default calc;\r\n","import { IClearElementOperationData } from '../../operation/clear-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction clearElement(): IOperationMetadata<IClearElementOperationData> {\r\n return {\r\n description: 'clears the given element',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\n\r\nexport default clearElement;\r\n","import { IClearOperationDataOperationData } from '../../operation/clear-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction clearOperationData(): IOperationMetadata<\r\n IClearOperationDataOperationData\r\n> {\r\n return {\r\n description: 'clears the current operation data',\r\n properties: {\r\n properties: 'ParameterType:array',\r\n },\r\n };\r\n}\r\nexport default clearOperationData;\r\n","import { ICreateElementOperationData } from '../../operation/create-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction createElement(): IOperationMetadata<ICreateElementOperationData<any>> {\r\n return {\r\n description:\r\n 'Creates an HTML element with the given name and optionally adds the given attributes',\r\n properties: {\r\n elementName: {\r\n type: 'ParameterType:htmlElementName',\r\n required: true,\r\n },\r\n attributes: 'ParameterType:object',\r\n text: 'ParameterType:string',\r\n },\r\n outputProperties: {\r\n template: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default createElement;\r\n","import { ICustomFunctionOperationData } from '../../operation/custom-function';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction customFunction(): IOperationMetadata<ICustomFunctionOperationData> {\r\n return {\r\n description: 'Executes the specified custom function',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:systemName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default customFunction;\r\n","import { IEndActionOperationData } from '../../operation/end-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction endAction(): IOperationMetadata<IEndActionOperationData> {\r\n return {\r\n description: 'Ends the current action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default endAction;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction endLoop(): IOperationMetadata<never> {\r\n return {\r\n description: 'Ends the current loop',\r\n };\r\n}\r\n\r\nexport default endLoop;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction endWhen(): IOperationMetadata<never> {\r\n return {\r\n description: 'Ends the current when block',\r\n };\r\n}\r\n\r\nexport default endWhen;\r\n","import { IExtendControllerOperationData } from '../../operation/extend-controller';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction extendController(): IOperationMetadata<\r\n IExtendControllerOperationData\r\n> {\r\n return {\r\n description: 'Extends the current controller',\r\n dependentProperties: ['controllerInstance'],\r\n properties: {\r\n controllerExtension: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default extendController;\r\n","import { IGetControllerFromElementOperationData } from '../../operation/get-controller-from-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getControllerFromElement(): IOperationMetadata<\r\n IGetControllerFromElementOperationData\r\n> {\r\n return {\r\n description: 'Retrieves the specified controller from the current element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n controllerName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n controllerInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getControllerFromElement;\r\n","import { IGetControllerInstanceOperationData } from '../../operation/get-controller-instance';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getControllerInstance(): IOperationMetadata<\r\n IGetControllerInstanceOperationData\r\n> {\r\n return {\r\n description: 'Retrieves an instance of the specified controller',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n controllerInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getControllerInstance;\r\n","import { IGetElementDimensionsOperationData } from '../../operation/get-element-dimensions';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getElementDimensions(): IOperationMetadata<\r\n IGetElementDimensionsOperationData\r\n> {\r\n return {\r\n description: 'Calculates the dimensions for the current element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n modifier: 'ParameterType:dimensionsModifier',\r\n },\r\n outputProperties: {\r\n dimensions: 'ParameterType:dimensions',\r\n },\r\n };\r\n}\r\nexport default getElementDimensions;\r\n","import { IGetImportOperationData } from '../../operation/get-import';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getImport(): IOperationMetadata<IGetImportOperationData> {\r\n return {\r\n description:\r\n 'Retrieves a javascript import specified by the given system name',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:systemName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n importedInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getImport;\r\n","import { IGetQueryParamsOperationData } from '../get-query-params';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData> {\r\n return {\r\n description:\r\n \"Retrieves the current query parameters from the browser's address bar\",\r\n outputProperties: {\r\n queryParams: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getQueryParams;\r\n","import { IInvokeObjectMethodOperationData } from '../invoke-object-method';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData> {\r\n return {\r\n description:\r\n 'Invokes the specified method on the given object with the optional specified arguments',\r\n properties: {\r\n instance: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n methodName: {\r\n type: 'ParameterType:string',\r\n required: true,\r\n },\r\n methodArguments: 'ParameterType:array',\r\n },\r\n outputProperties: {\r\n methodResult: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default invokeObjectMethod;\r\n","import { ILoadJSONOperationData } from '../../operation/load-json';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction loadJSON(): IOperationMetadata<ILoadJSONOperationData> {\r\n return {\r\n description: 'Load JSON from the given url',\r\n properties: {\r\n url: {\r\n type: 'ParameterType:url',\r\n required: true,\r\n },\r\n cache: 'ParameterType:boolean',\r\n },\r\n outputProperties: {\r\n json: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default loadJSON;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction log(): IOperationMetadata<never> {\r\n return {\r\n description: 'Logs the current context and operation data to the console',\r\n };\r\n}\r\n\r\nexport default log;\r\n","import { isFunction } from '../../util/guards/is-function';\r\nimport { IMathOperationData } from '../math';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction math(): IOperationMetadata<IMathOperationData> {\r\n return {\r\n description:\r\n 'This operation performs the given math function of the specified arguments.',\r\n properties: {\r\n args: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n functionName: createMathFunctionNames(),\r\n mathResult: 'ParameterType:number',\r\n },\r\n };\r\n}\r\n\r\nfunction createMathFunctionNames() {\r\n return Object.getOwnPropertyNames(Math)\r\n .filter((x) => isFunction(Math[x as keyof Math]))\r\n .map((functionName) => ({\r\n value: functionName,\r\n }));\r\n}\r\n\r\nexport default math;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction otherwise(): IOperationMetadata<never> {\r\n return {\r\n description: 'Inverts the control flow for `when` logic',\r\n };\r\n}\r\n\r\nexport default otherwise;\r\n","import { IRemoveClassOperationData } from '../../operation/remove-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeClass(): IOperationMetadata<IRemoveClassOperationData> {\r\n return {\r\n description: 'Removes the specified class from the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default removeClass;\r\n","import { IRemoveControllerFromElementOperationData } from '../../operation/remove-controller-from-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeControllerFromElement(): IOperationMetadata<\r\n IRemoveControllerFromElementOperationData\r\n> {\r\n return {\r\n description: 'Removes the specified controller from the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n controllerName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default removeControllerFromElement;\r\n","import { IRemoveElementOperationData } from '../../operation/remove-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeElement(): IOperationMetadata<IRemoveElementOperationData> {\r\n return {\r\n description: 'Removes the selected element from the DOM',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\nexport default removeElement;\r\n","import { IRemovePropertiesFromOperationDataOperationData } from '../../operation/remove-properties-from-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removePropertiesFromOperationData(): IOperationMetadata<\r\n IRemovePropertiesFromOperationDataOperationData\r\n> {\r\n return {\r\n description:\r\n 'Removes the specified properties from the current operation data',\r\n properties: {\r\n propertyNames: 'ParameterType:array',\r\n },\r\n };\r\n}\r\nexport default removePropertiesFromOperationData;\r\n","import { IReparentElementOperationData } from '../../operation/reparent-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction reparentElement(): IOperationMetadata<IReparentElementOperationData> {\r\n return {\r\n description:\r\n 'Moves the selected element to the new location described by the given selector',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n newParentSelector: {\r\n type: 'ParameterType:selector',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default reparentElement;\r\n","import { IRequestActionOperationData } from '../../operation/request-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction requestAction(): IOperationMetadata<IRequestActionOperationData> {\r\n return {\r\n description: 'Retrieves an instance of the specified action',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:actionName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n actionInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default requestAction;\r\n","import { IResizeActionOperationData } from '../../operation/resize-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction resizeAction(): IOperationMetadata<IResizeActionOperationData> {\r\n return {\r\n description: 'Triggers a resize on the current action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default resizeAction;\r\n","import { ISelectElementOperationData } from '../../operation/select-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction selectElement(): IOperationMetadata<ISelectElementOperationData> {\r\n return {\r\n description: 'Selects an element using the given selector',\r\n properties: {\r\n selector: {\r\n type: 'ParameterType:selector',\r\n required: true,\r\n },\r\n useSelectedElementAsRoot: 'ParameterType:boolean',\r\n },\r\n outputProperties: {\r\n selectedElement: 'ParameterType:jQuery',\r\n },\r\n };\r\n}\r\nexport default selectElement;\r\n","import { ISetElementAttributesOperationData } from '../../operation/set-element-attributes';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setElementAttributes(): IOperationMetadata<\r\n ISetElementAttributesOperationData\r\n> {\r\n return {\r\n description: 'Sets the given attributes on the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n attributes: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default setElementAttributes;\r\n","import { ISetElementContentOperationData } from '../../operation/set-element-content';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setElementContent(): IOperationMetadata<\r\n ISetElementContentOperationData\r\n> {\r\n return {\r\n description: 'Sets the given HTML content in the selected element',\r\n dependentProperties: ['selectedElement', 'template'],\r\n properties: {\r\n insertionType: [\r\n {\r\n value: 'overwrite',\r\n description:\r\n 'the contents of the selected element are replaced by the given template',\r\n default: true,\r\n },\r\n {\r\n value: 'append',\r\n description:\r\n 'the new content will be inserted after the current content',\r\n },\r\n {\r\n value: 'prepend',\r\n description:\r\n 'the new content will be inserted before the current content',\r\n },\r\n ],\r\n },\r\n };\r\n}\r\nexport default setElementContent;\r\n","import { ISetGlobalDataOperationData } from '../set-global-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setGlobalData(): IOperationMetadata<ISetGlobalDataOperationData> {\r\n return {\r\n description:\r\n 'Copies the specified values from the operationData to the global data',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default setGlobalData;\r\n","import { ISetOperationData } from '../../operation/set-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setOperationData(): IOperationMetadata<ISetOperationData> {\r\n return {\r\n description: 'Sets the given properties on the current operation data',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n override: 'ParameterType:boolean',\r\n },\r\n };\r\n}\r\nexport default setOperationData;\r\n","import { ISetStyleOperationData } from '../../operation/set-style';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setStyle(): IOperationMetadata<ISetStyleOperationData> {\r\n return {\r\n description: 'Sets the given style properties on the selected element',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n selectedElement: 'ParameterType:jQuery',\r\n },\r\n };\r\n}\r\n\r\nexport default setStyle;\r\n","import { IStartActionOperationData } from '../../operation/start-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction startAction(): IOperationMetadata<IStartActionOperationData> {\r\n return {\r\n description: 'Starts the selected action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default startAction;\r\n","import { IStartLoopOperationData } from '../../operation/start-loop';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction startLoop(): IOperationMetadata<IStartLoopOperationData> {\r\n return {\r\n description: 'Starts a loop over the given collection',\r\n properties: {\r\n collection: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default startLoop;\r\n","import { IToggleClassOperationData } from '../../operation/toggle-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction toggleClass(): IOperationMetadata<IToggleClassOperationData> {\r\n return {\r\n description: 'Toggles the given class on the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default toggleClass;\r\n","import { IToggleElementOperationData } from '../../operation/toggle-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction toggleElement(): IOperationMetadata<IToggleElementOperationData> {\r\n return {\r\n description: 'Toggles the selected element',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\nexport default toggleElement;\r\n","import { IWaitOperationData } from '../../operation/wait';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction wait(): IOperationMetadata<IWaitOperationData> {\r\n return {\r\n description:\r\n 'Waits the given amount of milliseconds before the action continues',\r\n properties: {\r\n milliseconds: {\r\n type: 'ParameterType:number',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default wait;\r\n","import { IWhenOperationData } from '../../operation/when';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction wait(): IOperationMetadata<IWhenOperationData> {\r\n return {\r\n description:\r\n 'Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true',\r\n properties: {\r\n expression: {\r\n type: 'ParameterType:expression',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default wait;\r\n","import * as controllers from '../../controllers';\r\nimport * as operations from '../../operation';\r\nimport * as operationMetadata from '../../operation/metadata';\r\nimport { IOperationMetadata } from '../../operation/metadata/types';\r\nimport { TimelineEventNames } from '../../timeline-event-names';\r\n\r\nexport class OperationNamesProvider {\r\n getOperationNames() {\r\n return Object.keys(operations);\r\n }\r\n}\r\n\r\nexport class ControllerNamesProvider {\r\n getControllerNames() {\r\n return Object.keys(controllers);\r\n }\r\n}\r\n\r\nexport class OperationMetadataProvider {\r\n getOperationMetadata(operationName: string) {\r\n const getMetadata = ((operationMetadata as any) as Record<\r\n string,\r\n () => IOperationMetadata<any>\r\n >)[operationName];\r\n if (!getMetadata) {\r\n throw new Error(\r\n `Could not find metadata for operation called ${operationName}`\r\n );\r\n }\r\n return getMetadata();\r\n }\r\n}\r\n\r\nexport class TimeLineEventNamesProvider {\r\n getEventNames() {\r\n return Object.values(TimelineEventNames);\r\n }\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\nimport { Action, EndableAction, TimelineAction } from '../action';\r\nimport { IAction } from '../action/types';\r\nimport { ActionRegistryEventbusListener } from '../eventbus';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { resolvePropertyChain } from '../operation/helper/resolve-property-chain';\r\nimport { IConfigurationResolver, ISimpleResourceImporter } from '../types';\r\nimport { isObject } from '../util/guards/is-object';\r\nimport { isString } from '../util/guards/is-string';\r\nimport {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IEventActionConfiguration,\r\n IOperationConfiguration,\r\n IResolvedActionConfiguration,\r\n IResolvedEndableActionConfiguration,\r\n IResolvedEngineConfiguration,\r\n IResolvedOperation,\r\n IResolvedTimelineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration,\r\n} from './types';\r\n\r\n/**\r\n * Takes an `IEngineConfiguration` instance and return an `IResolvedEngineConfiguration`.\r\n * This means all system names within the configuration will be resolved to their associated instances.\r\n *\r\n * If the given configuration includes event actions, then those will be registered in the given `ActionRegistryEventbusListener`.\r\n *\r\n */\r\nexport class ConfigurationResolver implements IConfigurationResolver {\r\n constructor(\r\n private importer: ISimpleResourceImporter,\r\n private eventbus: IEventbus\r\n ) {}\r\n\r\n process(\r\n configuration: IEngineConfiguration,\r\n actionRegistryListener?: ActionRegistryEventbusListener\r\n ): [Record<string, IAction>, IResolvedEngineConfiguration] {\r\n resolvePlaceholders(configuration, configuration, this.importer);\r\n\r\n if (!isDefined(configuration.timelineProviderSettings)) {\r\n throw new Error(\r\n 'Configuration incomplete: it needs to have at least one timeline provider setting'\r\n );\r\n }\r\n\r\n const resolvedConfig: IResolvedEngineConfiguration = {\r\n id: configuration.id,\r\n engine: { ...configuration.engine },\r\n timelineProviderSettings: deepCopy(\r\n configuration.timelineProviderSettings\r\n ),\r\n containerSelector: configuration.containerSelector,\r\n language: configuration.language,\r\n layoutTemplate: configuration.layoutTemplate,\r\n availableLanguages: deepCopy(configuration.availableLanguages),\r\n actions: resolveActions(\r\n configuration.actions,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n initActions: resolveActions(\r\n configuration.initActions,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n labels: deepCopy(configuration.labels),\r\n timelineFlow: deepCopy(configuration.timelineFlow),\r\n timelines: resolveTimelines(\r\n configuration.timelines,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n };\r\n\r\n let eventActions: IAction[] = [];\r\n if (configuration.eventActions?.length && actionRegistryListener) {\r\n eventActions = resolveEventActions(\r\n configuration.eventActions,\r\n actionRegistryListener,\r\n this.importer,\r\n this.eventbus\r\n );\r\n }\r\n\r\n const actionsLookup = (resolvedConfig.actions as IAction[])\r\n .concat(eventActions)\r\n .reduce<Record<string, IAction>>(\r\n (aggr, action) => ({\r\n ...aggr,\r\n [action.name]: action,\r\n }),\r\n {}\r\n );\r\n\r\n return [actionsLookup, resolvedConfig];\r\n }\r\n}\r\n\r\nfunction resolveEventActions(\r\n eventActionConfigurations: IEventActionConfiguration[],\r\n actionRegistryListener: ActionRegistryEventbusListener,\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolvedConfigs =\r\n eventActionConfigurations.map<IResolvedActionConfiguration>((config) =>\r\n resolveActionConfiguration(config, importer)\r\n );\r\n\r\n return resolvedConfigs.map((config, index) => {\r\n const { eventName, eventTopic } = eventActionConfigurations[index];\r\n const eventAction = new Action(\r\n config.name,\r\n config.startOperations,\r\n eventbus\r\n );\r\n actionRegistryListener.registerAction(eventAction, eventName, eventTopic);\r\n return eventAction;\r\n });\r\n}\r\n\r\nfunction resolveTimelines(\r\n timelines: ITimelineConfiguration[],\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolve = resolveTimelineAction.bind(null, importer, eventbus);\r\n\r\n return timelines.map<IResolvedTimelineConfiguration>((config) => ({\r\n ...config,\r\n timelineActions: config.timelineActions.map(resolve),\r\n }));\r\n}\r\n\r\nfunction resolveOperation(\r\n importer: ISimpleResourceImporter,\r\n operationConfig: IOperationConfiguration\r\n): IResolvedOperation {\r\n return {\r\n id: operationConfig.id,\r\n systemName: operationConfig.systemName,\r\n operationData: deepCopy(operationConfig.operationData) ?? {},\r\n instance: importer.import(operationConfig.systemName)[\r\n operationConfig.systemName\r\n ],\r\n };\r\n}\r\n\r\nfunction resolveActionConfiguration(\r\n config: IActionConfiguration,\r\n importer: ISimpleResourceImporter\r\n): IResolvedActionConfiguration {\r\n const resolve = resolveOperation.bind(null, importer);\r\n\r\n return {\r\n id: config.id,\r\n name: config.name,\r\n startOperations: config.startOperations.map(resolve),\r\n };\r\n}\r\n\r\nfunction resolveEndableActionConfiguration(\r\n config: IEndableActionConfiguration,\r\n importer: ISimpleResourceImporter\r\n): IResolvedEndableActionConfiguration {\r\n const resolve = resolveOperation.bind(null, importer);\r\n\r\n const action = resolveActionConfiguration(config, importer);\r\n\r\n return {\r\n ...action,\r\n endOperations: config.endOperations.map(resolve),\r\n };\r\n}\r\n\r\nfunction resolveTimelineAction(\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus,\r\n actionConfiguration: ITimelineActionConfiguration\r\n) {\r\n const resolvedConfig = resolveEndableActionConfiguration(\r\n actionConfiguration,\r\n importer\r\n );\r\n const duration = {\r\n end: actionConfiguration.duration.end ?? -1,\r\n start: actionConfiguration.duration.start,\r\n };\r\n\r\n const { id, name, endOperations, startOperations } = resolvedConfig;\r\n const action = new TimelineAction(\r\n name,\r\n startOperations,\r\n endOperations,\r\n duration,\r\n eventbus\r\n );\r\n action.id = id;\r\n return action;\r\n}\r\n\r\nfunction resolveActions(\r\n actionConfigurations: IEndableActionConfiguration[],\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolvedConfigs =\r\n actionConfigurations.map<IResolvedEndableActionConfiguration>((config) => {\r\n return resolveEndableActionConfiguration(config, importer);\r\n });\r\n\r\n return resolvedConfigs.map<EndableAction>((resolvedConfig) => {\r\n const { name, endOperations, startOperations } = resolvedConfig;\r\n const action = new EndableAction(\r\n name,\r\n startOperations,\r\n endOperations,\r\n eventbus\r\n );\r\n action.id = resolvedConfig.id;\r\n return action;\r\n });\r\n}\r\n\r\nfunction resolvePlaceholders(\r\n configFragment: Record<string, any> | any[],\r\n rootConfig: any,\r\n importer: ISimpleResourceImporter\r\n) {\r\n if (!isDefined(configFragment)) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(configFragment)) {\r\n configFragment.forEach((item) => {\r\n resolvePlaceholders(item, rootConfig, importer);\r\n });\r\n } else {\r\n Object.keys(configFragment).forEach((key) => {\r\n resolvePlaceholder(key, configFragment, rootConfig, importer);\r\n });\r\n }\r\n}\r\n\r\nfunction resolvePlaceholder(\r\n key: string,\r\n configFragment: any,\r\n rootConfig: any,\r\n importer: ISimpleResourceImporter\r\n) {\r\n const configValue = configFragment[key];\r\n if (isString(configValue)) {\r\n if (configValue.startsWith('config:')) {\r\n const configProperty = configValue.substring(7, configValue.length);\r\n configFragment[key] = resolvePropertyChain(configProperty, rootConfig);\r\n } else if (configValue.startsWith('template:')) {\r\n const templateKey = configValue.substring(9, configValue.length);\r\n const template = importer.import(templateKey)[templateKey];\r\n configFragment[key] = template;\r\n } else if (configValue.startsWith('json:')) {\r\n const jsonKey = configValue.substring(5, configValue.length);\r\n const json = importer.import(jsonKey)[jsonKey];\r\n configFragment[key] = json;\r\n }\r\n } else if (isObject(configValue)) {\r\n resolvePlaceholders(configValue, rootConfig, importer);\r\n }\r\n}\r\n","import { getPropertyChainValue } from './get-property-chain-value';\r\n\r\n/**\r\n * Gets the value for the given property chain. A property chain is defined by a period delimited string.\r\n *\r\n * For example, this property chain: `mySource.subSource.element.value` should be extracted from an object of this shape:\r\n * ```ts\r\n * const foo = {\r\n * mySource: {\r\n * subSource: {\r\n * element: {\r\n * value: 'bar'\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * The result of the invocation `resolvePropertyChain('mySource.subSource.element.value', foo)` would then yield the value `bar`.\r\n *\r\n * @param propertyChain the specified property chain\r\n * @param sourceObject the given source object\r\n * @returns\r\n */\r\nexport function resolvePropertyChain(propertyChain: string, sourceObject: any) {\r\n const properties = propertyChain.split('.');\r\n return getPropertyChainValue(properties, sourceObject);\r\n}\r\n","import $ from 'jquery';\r\nimport { IEndableAction, ITimelineAction } from './action/types';\r\nimport { IResolvedEngineConfiguration } from './configuration/types';\r\nimport { IEventbus, TEventbusRemover, TEventHandler } from './eventbus/types';\r\nimport { LanguageManager } from './language-manager';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport { ITimelineProvider } from './timelineproviders/types';\r\nimport {\r\n IEligiusEngine,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types';\r\n\r\ntype ActionMethod = IEndableAction['start'] | IEndableAction['end'];\r\n\r\n/**\r\n * This is where the magic happens. The engine is responsible for starting and stopping\r\n * the given timeline provider and triggering the actions associated with the positions along the timeline.\r\n */\r\nexport class EligiusEngine implements IEligiusEngine {\r\n private _timeLineActionsLookup: Record<\r\n string,\r\n Record<number, ActionMethod[]>\r\n > = {};\r\n private _eventbusRemovers: TEventbusRemover[] = [];\r\n private _currentTimelineUri: string = '';\r\n private _activeTimelineProvider: ITimelineProvider | undefined = undefined;\r\n private _lastPosition: number = -1;\r\n\r\n constructor(\r\n private configuration: IResolvedEngineConfiguration,\r\n private eventbus: IEventbus,\r\n private timelineProviders: Record<TimelineTypes, ITimelineProviderInfo>,\r\n private languageManager: LanguageManager\r\n ) {}\r\n\r\n /**\r\n * Initializes the engine by creating the HTML layout and the first time line\r\n * by executing its initActions.\r\n */\r\n init(): Promise<ITimelineProvider> {\r\n this._createLayoutTemplate();\r\n\r\n this._addEventbusListeners();\r\n\r\n const { timelines } = this.configuration;\r\n\r\n this._currentTimelineUri = timelines?.[0].uri ?? '';\r\n\r\n this._createTimelineLookup();\r\n\r\n return this._initializeTimelineProvider();\r\n }\r\n\r\n private _createLayoutTemplate() {\r\n const { containerSelector } = this.configuration;\r\n const container = $(containerSelector);\r\n\r\n if (!container || !container.length) {\r\n throw new Error(`Container selector not found: ${containerSelector}`);\r\n }\r\n\r\n const { layoutTemplate } = this.configuration;\r\n\r\n if (layoutTemplate && layoutTemplate.length) {\r\n container.html(layoutTemplate);\r\n } else {\r\n console.warn('layoutTemplate is empty, unable to create layout');\r\n }\r\n }\r\n\r\n private async _initializeTimelineProvider() {\r\n if (!this.configuration.timelines?.length) {\r\n throw new Error('No timelines present');\r\n }\r\n\r\n const firstTimeline = this.configuration.timelines[0];\r\n const providerSettings = this.timelineProviders[firstTimeline.type];\r\n\r\n if (!providerSettings) {\r\n throw new Error(\r\n `No timeline provider configured for type ${firstTimeline.type}`\r\n );\r\n }\r\n\r\n this._activeTimelineProvider?.destroy();\r\n this._activeTimelineProvider = providerSettings.provider;\r\n\r\n if (!this._activeTimelineProvider) {\r\n throw new Error('NO ACTIVE TIMELINE PROVIDER');\r\n }\r\n\r\n this._activeTimelineProvider.onTime(\r\n this._onTimeHandler.bind(this, Math.floor)\r\n );\r\n this._activeTimelineProvider.onComplete(\r\n this._onCompleteCallback.bind(this)\r\n );\r\n this._activeTimelineProvider.onFirstFrame(\r\n this._onFirstFrameCallback.bind(this)\r\n );\r\n this._activeTimelineProvider.onRestart(this._onRestartCallback.bind(this));\r\n\r\n await this._activeTimelineProvider.init();\r\n await this._executeActions(this.configuration.initActions, 'start');\r\n return this._activeTimelineProvider;\r\n }\r\n\r\n private _onCompleteCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.COMPLETE);\r\n }\r\n\r\n private _onFirstFrameCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);\r\n this.eventbus.broadcast(TimelineEventNames.DURATION, [\r\n this._activeTimelineProvider?.getDuration,\r\n ]);\r\n }\r\n\r\n private _onRestartCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.RESTART);\r\n }\r\n\r\n private async _cleanUp() {\r\n await this._cleanUpTimeline();\r\n await this._executeActions(\r\n [...this.configuration.initActions].reverse(),\r\n 'end'\r\n );\r\n }\r\n\r\n /**\r\n * Cleans up all the necessary parts that the engine initialized.\r\n * - It ends the currently active operations and the init actions.\r\n * - It removes all its eventbus listeners, handlers and interceptors.\r\n * - It destroys all of its timeline providers\r\n * - It empties the HTML element indicated by the containerSelector configuration property.\r\n *\r\n */\r\n async destroy() {\r\n await this._cleanUp();\r\n\r\n this.languageManager.destroy();\r\n\r\n this._activeTimelineProvider = undefined;\r\n this._eventbusRemovers.forEach((remover) => remover());\r\n\r\n if (this.timelineProviders) {\r\n Object.values(this.timelineProviders).forEach((providerInfo) =>\r\n providerInfo.provider.destroy()\r\n );\r\n }\r\n\r\n const { containerSelector } = this.configuration;\r\n const container = $(containerSelector);\r\n container.empty();\r\n }\r\n\r\n private _addEventListener(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ) {\r\n this._eventbusRemovers.push(\r\n this.eventbus.on(eventName, eventHandler, eventTopic)\r\n );\r\n }\r\n\r\n private _addEventbusListeners() {\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_ENGINE_ROOT,\r\n this._handleRequestEngineRoot.bind(\r\n this,\r\n this.configuration.containerSelector\r\n )\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_TIMELINE_URI,\r\n this._handleRequestTimelineUri.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION,\r\n this._handleRequestTimelinePosition.bind(this, Math.floor)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_TIMELINE_CLEANUP,\r\n this._handleTimelineComplete.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.EXECUTE_TIMELINEACTION,\r\n this._handleExecuteTimelineAction.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.RESIZE_TIMELINEACTION,\r\n this._resizeTimelineAction.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_CURRENT_TIMELINE,\r\n this._requestCurrentTimeline.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.PLAY_TOGGLE_REQUEST,\r\n this._toggleplay.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.PLAY_REQUEST,\r\n this._playRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.STOP_REQUEST,\r\n this._stopRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.PAUSE_REQUEST,\r\n this._pauseRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.CONTAINER_REQUEST,\r\n this.containerRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.DURATION_REQUEST,\r\n this.durationRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.SEEK_REQUEST,\r\n this.seekRequest.bind(this)\r\n );\r\n }\r\n\r\n private async seekRequest(offset: number) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n const seekPosition = Math.floor(offset);\r\n\r\n const duration = this._activeTimelineProvider.getDuration();\r\n const currentPosition = this._activeTimelineProvider.getPosition();\r\n\r\n if (seekPosition < 0 || seekPosition > duration) {\r\n return;\r\n }\r\n\r\n this.eventbus.broadcast(TimelineEventNames.SEEK, [\r\n seekPosition,\r\n currentPosition,\r\n duration,\r\n ]);\r\n\r\n await this._activeTimelineProvider.seek(seekPosition);\r\n await this._executeSeekActions(seekPosition);\r\n\r\n this.eventbus.broadcast(TimelineEventNames.SEEKED, [\r\n this._activeTimelineProvider.getPosition(),\r\n duration,\r\n ]);\r\n\r\n this.eventbus.broadcast(TimelineEventNames.TIME, [\r\n this._activeTimelineProvider.getPosition(),\r\n ]);\r\n\r\n if (this._activeTimelineProvider?.playState === 'running') {\r\n this._activeTimelineProvider?.start();\r\n }\r\n }\r\n\r\n private durationRequest(callBack: TResultCallback) {\r\n callBack(this._activeTimelineProvider?.getDuration());\r\n }\r\n\r\n private containerRequest(callBack: TResultCallback) {\r\n callBack(this._activeTimelineProvider?.getContainer());\r\n }\r\n\r\n private _pauseRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.pause();\r\n this.eventbus.broadcast(TimelineEventNames.PAUSE);\r\n }\r\n\r\n private _stopRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.stop();\r\n this.eventbus.broadcast(TimelineEventNames.STOP);\r\n }\r\n\r\n private _playRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.start();\r\n this.eventbus.broadcast(TimelineEventNames.PLAY);\r\n }\r\n\r\n private _toggleplay() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n if (this._activeTimelineProvider.playState === 'running') {\r\n this._activeTimelineProvider.start();\r\n } else {\r\n this._activeTimelineProvider.pause();\r\n }\r\n }\r\n\r\n private _createTimelineLookup() {\r\n if (!this.configuration.timelines) {\r\n return;\r\n }\r\n\r\n this.configuration.timelines.forEach((timelineInfo) => {\r\n timelineInfo.timelineActions.forEach(\r\n this._addTimelineActionStart.bind(this, timelineInfo.uri)\r\n );\r\n });\r\n\r\n this.configuration.timelines.forEach((timelineInfo) => {\r\n // actions ends need to be in reversed order, otherwise, for example,\r\n // elements that were created before dependent actions will already have been\r\n // removed in the end phase.\r\n const reversed = [...timelineInfo.timelineActions].reverse();\r\n reversed.forEach(this._addTimelineActionEnd.bind(this, timelineInfo.uri));\r\n });\r\n }\r\n\r\n private _addTimelineActionStart(\r\n uri: string,\r\n timeLineAction: ITimelineAction\r\n ) {\r\n const startPosition = timeLineAction.duration.start;\r\n const timelineStartPositions = this._initializeTimelinePosition(\r\n this._initializeUriLookup(this._timeLineActionsLookup, uri),\r\n startPosition\r\n );\r\n const startMethod = timeLineAction.start.bind(timeLineAction);\r\n\r\n if (timeLineAction.id?.length) {\r\n (startMethod as any).id = timeLineAction.id;\r\n (startMethod as any).isStart = true;\r\n }\r\n\r\n timelineStartPositions.push(startMethod);\r\n }\r\n\r\n private _addTimelineActionEnd(uri: string, timeLineAction: ITimelineAction) {\r\n let end = timeLineAction.duration.end;\r\n if (end < 0) {\r\n end = timeLineAction.duration.end = Infinity;\r\n }\r\n\r\n if (isFinite(end)) {\r\n const timelineEndPositions = this._initializeTimelinePosition(\r\n this._timeLineActionsLookup[uri],\r\n end\r\n );\r\n const endMethod = timeLineAction.end.bind(timeLineAction);\r\n\r\n if (!timeLineAction.id) {\r\n (endMethod as any).id = timeLineAction.id;\r\n }\r\n\r\n timelineEndPositions.push(endMethod);\r\n }\r\n }\r\n\r\n private _initializeUriLookup(\r\n lookup: Record<string, Record<number, ActionMethod[]>>,\r\n uri: string\r\n ): Record<number, any> {\r\n if (!lookup[uri]) {\r\n lookup[uri] = {};\r\n }\r\n\r\n return lookup[uri];\r\n }\r\n\r\n private _initializeTimelinePosition(\r\n lookup: Record<number, ActionMethod[]>,\r\n position: number\r\n ): ActionMethod[] {\r\n if (!lookup[position]) {\r\n lookup[position] = [] as ActionMethod[];\r\n }\r\n\r\n return lookup[position];\r\n }\r\n\r\n private async _executeActions(\r\n actions: IEndableAction[],\r\n methodName: 'start' | 'end',\r\n idx = 0\r\n ): Promise<void> {\r\n if (actions && idx < actions.length) {\r\n const action = actions[idx];\r\n\r\n await action[methodName]();\r\n return this._executeActions(actions, methodName, ++idx);\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n private _handleRequestEngineRoot(\r\n engineRootSelector: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback($(engineRootSelector));\r\n }\r\n\r\n private async _handleRequestTimelineUri(uri: string, position: number = 0) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.stop();\r\n\r\n await this._cleanUpTimeline();\r\n\r\n const timelineConfig = this.configuration.timelines.find(\r\n (timeline) => timeline.uri === uri\r\n );\r\n if (\r\n !timelineConfig ||\r\n !this._activeTimelineProvider ||\r\n this._currentTimelineUri === timelineConfig.uri\r\n ) {\r\n return;\r\n }\r\n this._currentTimelineUri = timelineConfig.uri;\r\n\r\n this.eventbus.broadcast(TimelineEventNames.CURRENT_TIMELINE_CHANGE, [\r\n this._currentTimelineUri,\r\n ]);\r\n\r\n const newProviderSettings = this.timelineProviders[timelineConfig.type];\r\n\r\n if (this._activeTimelineProvider !== newProviderSettings.provider) {\r\n this._activeTimelineProvider.destroy();\r\n this._activeTimelineProvider = newProviderSettings.provider;\r\n }\r\n\r\n this._activeTimelineProvider.loop = timelineConfig.loop;\r\n\r\n if (!this._activeTimelineProvider.loop && position > 0) {\r\n this.eventbus.once(TimelineEventNames.FIRST_FRAME, async () => {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.pause();\r\n this.eventbus.broadcast(TimelineEventNames.DURATION, [\r\n this._activeTimelineProvider.getDuration(),\r\n ]);\r\n\r\n await this._executeStartActions();\r\n\r\n const seekPosition = await this._activeTimelineProvider.seek(position);\r\n this.seekRequest(seekPosition);\r\n });\r\n }\r\n\r\n this._activeTimelineProvider.playlistItem(uri);\r\n }\r\n\r\n private _cleanUpTimeline() {\r\n return this._executeRelevantActions(this._getActiveActions, 'end');\r\n }\r\n\r\n private _executeStartActions() {\r\n return this._executeRelevantActions(\r\n this._getActionsForPosition.bind(this, 0),\r\n 'start'\r\n );\r\n }\r\n\r\n /**\r\n * Gets all of the inactive actions whose duration falls within the given timeline position.\r\n *\r\n * @param position the given position\r\n * @param actions all of the relevant actions\r\n * @returns\r\n */\r\n private _getActionsForPosition(position: number, actions: ITimelineAction[]) {\r\n return actions.filter(\r\n (action) =>\r\n !action.active &&\r\n action.duration.start <= position &&\r\n action.duration.end >= position\r\n );\r\n }\r\n\r\n private _getActiveActions(allActions: ITimelineAction[]) {\r\n const actions = allActions.filter((action) => action.active);\r\n return actions.sort(sortActions);\r\n }\r\n\r\n private _executeRelevantActions(\r\n filter: (actions: ITimelineAction[]) => ITimelineAction[],\r\n executionType: 'start' | 'end'\r\n ) {\r\n const timelineActions = this._getRelevantTimelineActions();\r\n const currentActions = filter.apply(this, [timelineActions]);\r\n return this._executeActions(currentActions, executionType, 0);\r\n }\r\n\r\n private _handleRequestTimelinePosition(\r\n floor: Function,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(floor(this._activeTimelineProvider?.getPosition() || -1));\r\n }\r\n\r\n private _handleTimelineComplete() {\r\n this._cleanUpTimeline();\r\n }\r\n\r\n private _handleExecuteTimelineAction(\r\n uri: string,\r\n index: number,\r\n start: boolean\r\n ) {\r\n const actions = this._getTimelineActionsForUri(uri);\r\n const action = actions?.[index];\r\n if (action) {\r\n if (start) {\r\n action.start();\r\n } else {\r\n action.end();\r\n }\r\n }\r\n }\r\n\r\n private _resizeTimelineAction(/*uri: string, index: number*/) {\r\n console.error('no resizing implemented');\r\n }\r\n\r\n private _getRelevantTimelineActions() {\r\n return this._getTimelineActionsForUri(this._currentTimelineUri);\r\n }\r\n\r\n private _requestCurrentTimeline(resultCallback: TResultCallback) {\r\n resultCallback(this._currentTimelineUri);\r\n }\r\n\r\n private _getTimelineActionsForUri(uri: string): ITimelineAction[] {\r\n const info = this.configuration.timelines.find((timelineInfo) => {\r\n return timelineInfo.uri === uri;\r\n });\r\n return info?.timelineActions ?? [];\r\n }\r\n\r\n private _onTimeHandler(floor: (x: number) => number, position: number) {\r\n if (!isNaN(position)) {\r\n const pos = floor(position);\r\n\r\n if (this._lastPosition !== pos) {\r\n this._executeActionsForPosition(pos);\r\n this.eventbus.broadcast(TimelineEventNames.TIME, [pos]);\r\n }\r\n }\r\n }\r\n\r\n private _executeActionsForPosition(position: number) {\r\n this._lastPosition = position;\r\n const actions = this._timeLineActionsLookup[this._currentTimelineUri];\r\n\r\n if (actions) {\r\n const executions = actions[position];\r\n executions?.forEach((exec) => {\r\n exec();\r\n });\r\n }\r\n }\r\n\r\n private async _executeSeekActions(pos: number) {\r\n const timelineActions = this._getRelevantTimelineActions();\r\n\r\n if (!timelineActions) {\r\n return Promise.resolve();\r\n }\r\n\r\n const currentActions = this._getActiveActions(timelineActions);\r\n const newActions = this._getActionsForPosition(pos, timelineActions);\r\n const currentActionsEnd = this._executeActions(currentActions, 'end', 0);\r\n\r\n await currentActionsEnd;\r\n\r\n return this._executeActions(newActions, 'start', 0);\r\n }\r\n}\r\n\r\nconst sortActions = (a: ITimelineAction, b: ITimelineAction) => {\r\n if (b.duration.start < a.duration.start) {\r\n return -1;\r\n } else if (b.duration.start > a.duration.start) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n};","import { IAction } from '../action/types';\r\nimport { IEventbusListener } from './types';\r\n\r\n/**\r\n * The `IEventbusListener` first registers a number of actions that are then\r\n * executed when the specified event is broadcast.\r\n */\r\nexport class ActionRegistryEventbusListener implements IEventbusListener {\r\n private _actionRegistry = new Map<string, IAction[]>();\r\n\r\n registerAction(\r\n action: IAction,\r\n eventName: string,\r\n eventTopic?: string\r\n ): void {\r\n if (eventTopic && eventTopic.length) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this._actionRegistry.has(eventName)) {\r\n this._actionRegistry.set(eventName, []);\r\n }\r\n this._actionRegistry.get(eventName)?.push(action);\r\n }\r\n\r\n handleEvent(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any[]\r\n ): void {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n const actions = this._actionRegistry.get(eventName);\r\n if (actions) {\r\n const operationData = {\r\n eventArgs: args,\r\n };\r\n actions.forEach((action) => {\r\n action.start(operationData);\r\n });\r\n }\r\n }\r\n}\r\n","import {\r\n IEventbus,\r\n IEventbusInterceptor,\r\n IEventbusListener,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './types';\r\n\r\nexport class Eventbus implements IEventbus {\r\n private eventHandlers = new Map<string, TEventHandler[]>();\r\n private eventInterceptors = new Map<string, IEventbusInterceptor[]>();\r\n private eventListeners: IEventbusListener[] = [];\r\n\r\n constructor() {\r\n this.clear();\r\n }\r\n\r\n clear() {\r\n this.eventHandlers = new Map<string, TEventHandler[]>();\r\n this.eventListeners = [];\r\n this.eventInterceptors = new Map<string, IEventbusInterceptor[]>();\r\n }\r\n\r\n _getEventInterceptors(\r\n eventName: string,\r\n eventTopic?: string\r\n ): IEventbusInterceptor[] {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this.eventInterceptors.has(eventName)) {\r\n this.eventInterceptors.set(eventName, []);\r\n }\r\n return this.eventInterceptors.get(eventName) as IEventbusInterceptor[];\r\n }\r\n\r\n _getEventHandlers(eventName: string, eventTopic?: string): TEventHandler[] {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this.eventHandlers.has(eventName)) {\r\n this.eventHandlers.set(eventName, []);\r\n }\r\n return this.eventHandlers.get(eventName) as TEventHandler[];\r\n }\r\n\r\n on(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n this._getEventHandlers(eventName, eventTopic).push(eventHandler);\r\n return () => {\r\n this.off(eventName, eventHandler, eventTopic);\r\n };\r\n }\r\n\r\n once(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n const eventHandlerDecorator = (...args: any[]) => {\r\n eventHandler(...args);\r\n this.off(eventName, eventHandlerDecorator, eventTopic);\r\n };\r\n this.on(eventName, eventHandlerDecorator, eventTopic);\r\n return () => {\r\n this.off(eventName, eventHandlerDecorator, eventTopic);\r\n };\r\n }\r\n\r\n off(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): void {\r\n const handlers = this._getEventHandlers(eventName, eventTopic);\r\n if (handlers) {\r\n const idx = handlers.indexOf(eventHandler);\r\n if (idx > -1) {\r\n handlers.splice(idx, 1);\r\n }\r\n }\r\n }\r\n\r\n broadcast(eventName: string, args: any[]): void {\r\n this._callHandlers(eventName, undefined, args);\r\n }\r\n\r\n broadcastForTopic(eventName: string, eventTopic: string, args: any[]): void {\r\n this._callHandlers(eventName, eventTopic, args);\r\n }\r\n\r\n registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover {\r\n this.eventListeners.push(eventbusListener);\r\n return () => {\r\n const index = this.eventListeners.indexOf(eventbusListener);\r\n if (index > -1) {\r\n this.eventListeners.splice(index, 1);\r\n }\r\n };\r\n }\r\n\r\n registerInterceptor(\r\n eventName: string,\r\n interceptor: IEventbusInterceptor,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n const interceptors = this._getEventInterceptors(eventName, eventTopic);\r\n interceptors.push(interceptor);\r\n return () => {\r\n const index = interceptors.indexOf(interceptor);\r\n if (index > -1) {\r\n interceptors.splice(index, 1);\r\n }\r\n };\r\n }\r\n\r\n _callHandlers(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any = []\r\n ): void {\r\n const handlers = this._getEventHandlers(eventName, eventTopic);\r\n\r\n if (handlers) {\r\n const interceptors = this._getEventInterceptors(eventName, eventTopic);\r\n\r\n interceptors.forEach((interceptor) => {\r\n args = interceptor.intercept(args);\r\n });\r\n\r\n this.eventListeners.forEach((listener: IEventbusListener) => {\r\n listener.handleEvent(eventName, eventTopic, args);\r\n });\r\n\r\n if (args?.length) {\r\n handlers.forEach((handler: TEventHandler) => handler(...args));\r\n } else {\r\n handlers.forEach((handler: TEventHandler) => handler());\r\n }\r\n }\r\n }\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { IEventbus, IEventbusInterceptor } from './types';\r\n\r\nexport class RequestVideoUriInterceptor implements IEventbusInterceptor {\r\n constructor(private eventbus: IEventbus) {}\r\n\r\n intercept(args: any[]): any[] {\r\n this.eventbus.broadcast(\r\n TimelineEventNames.BEFORE_REQUEST_TIMELINE_URI,\r\n args.slice()\r\n );\r\n return args;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport { IEventbus, TEventbusRemover } from './eventbus/types';\r\nimport { setGlobal } from './operation/helper/set-global';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport { ILabel, ILanguageLabel, TResultCallback } from './types';\r\n\r\n/**\r\n * This class manages the labels for an {@link IEligiusEngine} instance.\r\n * \r\n * It handles the {@link TimelineEventNames.REQUEST_LABEL_COLLECTION}, {@link TimelineEventNames.REQUEST_LABEL_COLLECTIONS}, {@link TimelineEventNames.REQUEST_CURRENT_LANGUAGE} and {@link TimelineEventNames.LANGUAGE_CHANGE} events.\r\n * \r\n */\r\nexport class LanguageManager {\r\n private _labelLookup: Record<string, ILabel[]>;\r\n private _eventbusRemovers: TEventbusRemover[] = [];\r\n\r\n constructor(\r\n private _currentLanguage: string,\r\n labels: ILanguageLabel[],\r\n private _eventbus: IEventbus\r\n ) {\r\n if (!_currentLanguage) {\r\n throw new Error('language ctor arg cannot have zero length');\r\n }\r\n setGlobal('defaultLanguage', _currentLanguage);\r\n this._setRootElementLang(_currentLanguage);\r\n this._labelLookup = this._createLabelLookup(labels);\r\n this._addEventbusListeners(_eventbus);\r\n }\r\n\r\n destroy() {\r\n this._eventbusRemovers.forEach((x) => x());\r\n }\r\n\r\n _addEventbusListeners(eventbus: IEventbus) {\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_LABEL_COLLECTION,\r\n this._handleRequestLabelCollection.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_LABEL_COLLECTIONS,\r\n this._handleRequestLabelCollections.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_CURRENT_LANGUAGE,\r\n this._handleRequestCurrentLanguage.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n }\r\n\r\n _handleRequestCurrentLanguage(resultCallback: TResultCallback) {\r\n resultCallback(this._currentLanguage);\r\n }\r\n\r\n _handleRequestLabelCollection(\r\n labelId: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._labelLookup[labelId]);\r\n }\r\n\r\n _handleRequestLabelCollections(\r\n labelIds: string[],\r\n resultCallback: TResultCallback\r\n ) {\r\n const labelCollections = labelIds.map((labelId) => {\r\n return this._labelLookup[labelId];\r\n });\r\n resultCallback(labelCollections);\r\n }\r\n\r\n _handleLanguageChange(language: string) {\r\n if (language && language.length) {\r\n this._currentLanguage = language;\r\n this._setRootElementLang(this._currentLanguage);\r\n } else {\r\n console.error('Language cannot be changed to null or empty string');\r\n }\r\n }\r\n\r\n _setRootElementLang(language: string) {\r\n const callBack = (rootSelector: string) => {\r\n const lang = this._extractLanguageFromCulture(language);\r\n $(rootSelector).attr('lang', lang);\r\n };\r\n this._eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [\r\n callBack,\r\n ]);\r\n }\r\n\r\n _extractLanguageFromCulture(culture: string) {\r\n if (culture.indexOf('-') > -1) {\r\n return culture.split('-').shift() as string;\r\n }\r\n return culture;\r\n }\r\n\r\n _createLabelLookup(labels: ILanguageLabel[]) {\r\n return labels.reduce<Record<string, ILabel[]>>((acc, label) => {\r\n acc[label.id] = label.labels;\r\n return acc;\r\n }, {});\r\n }\r\n}\r\n","import { getGlobals } from './globals';\r\n\r\nexport function setGlobal(name: string, value: any) {\r\n const cache = getGlobals();\r\n cache[name] = value;\r\n}\r\n","import hotkeys, { HotkeysEvent } from 'hotkeys-js';\r\nimport $ from 'jquery';\r\nimport { IAction } from './action/types';\r\nimport { ConfigurationResolver } from './configuration/configuration-resolver';\r\nimport {\r\n IEngineConfiguration,\r\n IResolvedEngineConfiguration,\r\n} from './configuration/types';\r\nimport { DevToolEventListener } from './diagnostics/devtool-event-lister';\r\nimport { Diagnostics } from './diagnostics/diagnostics';\r\nimport {\r\n DEV_TOOLS_KEY,\r\n TDiagnosticType,\r\n TWindowWithDevtools,\r\n} from './diagnostics/types';\r\nimport {\r\n ActionRegistryEventbusListener,\r\n Eventbus,\r\n IEventbus,\r\n RequestVideoUriInterceptor,\r\n TEventbusRemover,\r\n} from './eventbus';\r\nimport { LanguageManager } from './language-manager';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport {\r\n IConfigurationResolver,\r\n IEligiusEngine,\r\n IEngineFactory,\r\n IEngineFactoryOptions,\r\n ISimpleResourceImporter,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types';\r\nimport { prepareValueForSerialization } from './util/prepare-value-for-serialization';\r\n\r\n/**\r\n * The EngineFactory is used to create and initialize an {@link IEligiusEngine} instance.\r\n *\r\n * It prepares a resolved configuration and creates the engine based on the class defined in the configuration.\r\n *\r\n * @example Loading a configuration and creating an IEligiusEngine instance\r\n * ```ts\r\n * import { IEngineConfiguration, EngineFactory, WebpackResourceImporter } from 'eligius';\r\n * import * as engineConfig from './my-eligius-config.json';\r\n *\r\n * const factory = new EngineFactory(new WebpackResourceImporter(), window);\r\n *\r\n * const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);\r\n *\r\n * engine.init().then(()=> {console.log('Eligius engine ready for business');});\r\n * ```\r\n */\r\nexport class EngineFactory implements IEngineFactory {\r\n private _actionsLookup: Record<string, IAction> = {};\r\n private _eventbus: IEventbus;\r\n private _eventRemovers: TEventbusRemover[] = [];\r\n private _importer: ISimpleResourceImporter;\r\n private _resizeTimeout: any = -1;\r\n\r\n constructor(\r\n importer: ISimpleResourceImporter,\r\n windowRef: Window,\r\n options?: IEngineFactoryOptions\r\n ) {\r\n this._importer = importer;\r\n this._eventbus = options?.eventbus ?? new Eventbus();\r\n\r\n Diagnostics.active = options?.devtools ?? false;\r\n if (Diagnostics.active) {\r\n this._initializeDevtools(this._eventbus);\r\n }\r\n\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_INSTANCE,\r\n this._requestInstanceHandler.bind(this)\r\n )\r\n );\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_ACTION,\r\n this._requestActionHandler.bind(this)\r\n )\r\n );\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_FUNCTION,\r\n this._requestFunctionHandler.bind(this)\r\n )\r\n );\r\n\r\n const handleSpaceBound = this._handleSpacePress.bind(this);\r\n hotkeys('space', handleSpaceBound);\r\n this._eventRemovers.push(() => hotkeys.unbind('space', handleSpaceBound));\r\n\r\n const resizeBound = this._resizeHandler.bind(this);\r\n const jqWin = $(windowRef);\r\n jqWin.on('resize', resizeBound);\r\n this._eventRemovers.push(() => jqWin.off('resize', resizeBound));\r\n }\r\n\r\n private _handleSpacePress(\r\n keyboardEvent: KeyboardEvent,\r\n _hotkeysEvent: HotkeysEvent\r\n ): void | boolean {\r\n keyboardEvent.preventDefault();\r\n this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);\r\n return false;\r\n }\r\n\r\n private _initializeDevtools(eventbus: IEventbus) {\r\n const diagnosticInfo = (window as unknown as TWindowWithDevtools)[\r\n DEV_TOOLS_KEY\r\n ];\r\n\r\n if (diagnosticInfo) {\r\n const { agent } = diagnosticInfo;\r\n\r\n this._eventRemovers.push(\r\n eventbus.registerEventlistener(new DevToolEventListener(agent))\r\n );\r\n\r\n this._eventRemovers.push(\r\n agent.subscribe((message) => {\r\n if (message.type === 'playcontrol') {\r\n switch (message.data.kind) {\r\n case 'play':\r\n this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);\r\n break;\r\n case 'stop':\r\n this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);\r\n break;\r\n case 'pause':\r\n this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);\r\n break;\r\n case 'seek':\r\n this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [\r\n message.data.args,\r\n ]);\r\n break;\r\n }\r\n }\r\n })\r\n );\r\n\r\n Diagnostics.send = (name: TDiagnosticType, messageData: any) => {\r\n const message = prepareValueForSerialization(messageData);\r\n try {\r\n agent.postMessage(name, message);\r\n } catch (e) {\r\n console.error('postmessage failed');\r\n console.error(e);\r\n console.log('message', message);\r\n }\r\n };\r\n\r\n Diagnostics.send(\r\n 'eligius-diagnostics-factory',\r\n 'Diagnostics initialized'\r\n );\r\n } else {\r\n console.warn(\r\n `${DEV_TOOLS_KEY} property not found on window, please install the Eligius Devtools extension.`\r\n );\r\n }\r\n }\r\n\r\n destroy() {\r\n this._eventRemovers.forEach((x) => x());\r\n }\r\n\r\n private _resizeHandler() {\r\n if (this._resizeTimeout) {\r\n clearTimeout(this._resizeTimeout);\r\n this._resizeTimeout = -1;\r\n }\r\n this._resizeTimeout = setTimeout(() => {\r\n this._eventbus.broadcast(TimelineEventNames.RESIZE);\r\n }, 200);\r\n }\r\n\r\n private _importSystemEntryWithEventbusDependency(systemName: string): any {\r\n const ctor = this._importSystemEntry(systemName);\r\n return new ctor(this._eventbus);\r\n }\r\n\r\n private _importSystemEntry(systemName: string): any {\r\n return this._importer.import(systemName)[systemName];\r\n }\r\n\r\n private _requestInstanceHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._importSystemEntryWithEventbusDependency(systemName));\r\n }\r\n\r\n private _requestFunctionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._importSystemEntry(systemName));\r\n }\r\n\r\n private _requestActionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n const action = this._actionsLookup[systemName];\r\n if (action) {\r\n resultCallback(action);\r\n } else {\r\n console.error(`Unknown action: ${systemName}`);\r\n resultCallback(null);\r\n }\r\n }\r\n\r\n createEngine(\r\n configuration: IEngineConfiguration,\r\n resolver?: IConfigurationResolver\r\n ): IEligiusEngine {\r\n const { systemName } = configuration.engine;\r\n const EngineClass = this._importSystemEntry(systemName);\r\n\r\n let actionRegistryListener: ActionRegistryEventbusListener | undefined =\r\n undefined;\r\n if (configuration.eventActions?.length) {\r\n actionRegistryListener = new ActionRegistryEventbusListener();\r\n this._eventRemovers.push(\r\n this._eventbus.registerEventlistener(actionRegistryListener)\r\n );\r\n }\r\n\r\n this._eventRemovers.push(\r\n this._eventbus.registerInterceptor(\r\n TimelineEventNames.REQUEST_TIMELINE_URI,\r\n new RequestVideoUriInterceptor(this._eventbus)\r\n )\r\n );\r\n\r\n resolver =\r\n resolver || new ConfigurationResolver(this._importer, this._eventbus);\r\n const [actionLookup, resolvedConfiguration] = resolver.process(\r\n configuration,\r\n actionRegistryListener\r\n );\r\n this._actionsLookup = actionLookup;\r\n\r\n const timelineProviders = this._createTimelineProviders(\r\n resolvedConfiguration\r\n );\r\n\r\n const { language, labels } = configuration;\r\n const languageManager = new LanguageManager(\r\n language,\r\n labels,\r\n this._eventbus\r\n );\r\n\r\n const engineInstance = new EngineClass(\r\n resolvedConfiguration,\r\n this._eventbus,\r\n timelineProviders,\r\n languageManager\r\n );\r\n\r\n return engineInstance;\r\n }\r\n\r\n private _createTimelineProviders(\r\n configuration: IResolvedEngineConfiguration\r\n ): Record<TimelineTypes, ITimelineProviderInfo> {\r\n const { timelineProviderSettings } = configuration;\r\n\r\n const result = Object.entries(timelineProviderSettings).reduce<\r\n Record<TimelineTypes, ITimelineProviderInfo>\r\n >((acc, [timelineType, settings]) => {\r\n if (!settings) {\r\n return acc;\r\n }\r\n\r\n const TimelineProviderClass = this._importSystemEntry(\r\n settings.systemName\r\n );\r\n acc[timelineType as TimelineTypes] = {\r\n id: settings.id,\r\n vendor: settings.vendor,\r\n provider: new TimelineProviderClass(configuration),\r\n };\r\n return acc;\r\n }, {} as Record<TimelineTypes, ITimelineProviderInfo>);\r\n\r\n return result;\r\n }\r\n}\r\n","import * as ctrls from '../controllers';\r\nimport { EligiusEngine } from '../eligius-engine';\r\nimport * as evtb from '../eventbus';\r\nimport * as ops from '../operation';\r\nimport { TOperation } from '../operation/types';\r\nimport * as prvdrs from '../timelineproviders';\r\nimport { IResourceImporter } from '../types';\r\n\r\nconst operations: Record<string, TOperation<any>> = ops as any;\r\nconst controllers: Record<string, any> = ctrls;\r\nconst providers: Record<string, any> = prvdrs;\r\nconst eventbus: Record<string, any> = evtb;\r\n\r\nexport class EligiusResourceImporter implements IResourceImporter {\r\n engines = new Map();\r\n constructor() {\r\n this.engines.set('EligiusEngine', EligiusEngine);\r\n }\r\n\r\n getOperationNames(): string[] {\r\n return Object.keys(operations);\r\n }\r\n\r\n getControllerNames(): string[] {\r\n return Object.keys(controllers);\r\n }\r\n\r\n getProviderNames(): string[] {\r\n return Object.keys(providers);\r\n }\r\n\r\n import(name: string): Record<string, any> {\r\n const value =\r\n operations[name] ??\r\n controllers[name] ??\r\n providers[name] ??\r\n eventbus[name] ??\r\n this.engines.get(name);\r\n\r\n return { [name]: value };\r\n }\r\n}\r\n","export type TDevToolsEventSubscriber = (event: TEventData) => void;\r\n\r\nexport type TPlayControlEventKind = 'play' | 'stop' | 'pause' | 'seek';\r\nexport const DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';\r\n\r\nexport type TWindowWithDevtools = Window & {\r\n [DEV_TOOLS_KEY]: IDiagnosticsInfo | undefined;\r\n};\r\n\r\nexport type TDevToolsMessage = {\r\n source: 'eligius-inspect-devtools';\r\n name: 'event';\r\n data: TEventData;\r\n};\r\n\r\nexport type TEventData = {\r\n type: 'playcontrol';\r\n data: IPlayControlEvent;\r\n};\r\n\r\nexport interface IPlayControlEvent {\r\n kind: TPlayControlEventKind;\r\n args?: any[];\r\n}\r\n\r\nexport interface IDiagnosticsAgent {\r\n postMessage(name: TDiagnosticType, messageData: any): void;\r\n subscribe(subscriber: TDevToolsEventSubscriber): () => void;\r\n}\r\n\r\nexport interface IDiagnosticsInfo {\r\n get agent(): IDiagnosticsAgent;\r\n}\r\n\r\nexport type TDiagnosticType =\r\n | 'eligius-diagnostics-factory'\r\n | 'eligius-diagnostics-engine'\r\n | 'eligius-diagnostics-event'\r\n | 'eligius-diagnostics-action'\r\n | 'eligius-diagnostics-action-error'\r\n | 'eligius-diagnostics-operation';\r\n\r\nexport type TDiagnosticsMessageSource =\r\n | 'eligius-inspect-agent'\r\n | 'eligius-inspect-devtools';\r\n","export default function dashToCamelCase(input: string) {\r\n return input.replace(/-([a-z])/g, g => g[1].toUpperCase());\r\n}\r\n"],"names":["isFunction","value","isObject","prepareValueForSerialization","Array","isArray","map","jQuery","constructor","toString","substring","startsWith","funcString","indexOf","Object","fromEntries","entries","DevToolEventListener","agent","this","handleEvent","eventName","eventTopic","args","message","postMessage","e","console","error","log","Diagnostics","send","_name","_data","active","copyFunction","structuredClone","original","JSON","parse","stringify","deepCopy","isDefined","Action","name","startOperations","eventbus","id","_contextStack","_proto","start","initOperationData","_initializeContextStack","result","Promise","resolve","reject","_this","executeOperation","then","operationsResult","currentIndex","operations","_pushContext","parentContext","newContext","parent","push","_popContext","pop","operationIndex","previousOperationData","obj","context","length","undefined","newIndex","operationInfo","copy","operationData","mergedOperationData","assign","systemName","owner","operationResult","instance","call","promisedOperationResult","_this2","EndableAction","endOperations","eventBus","_inheritsLoose","end","TimelineAction","duration","_gatherControllerImportPathsFromActions","actionsConfig","operationConfigs","flatMap","x","filter","operationConfig","_operationConfig$oper","hasOwnProperty","endsWith","_gatherOperationImportPathsFromActions","dedupe","importPaths","lookup","imp","addClass","selectedElement","className","getElementControllers","element","data","bind","mergeOperationData","newOperationData","internalResolve","addControllerToElement","controllerInstance","controller","controllers","attachControllerToElement","init","promise","attach","animate","animationEasing","animationProperties","animationDuration","animateWithClass","removeClass","one","isString","getPropertyChainValue","propertyChain","sourceObject","currentInstance","suffix","forEach","prop","index","parts","split","cache","getGlobals","setGlobals","newValues","resolveExternalPropertyChain","operationContext","propertyChainOrRegularObject","propNames","shift","_propNames$shift","toLowerCase","broadcastEvent","eventArguments","eventArgs","resolveEventArguments","broadcastForTopic","broadcast","removeEventDataFromOperationData","resolvePropertyValues","newProperties","resolveNewProperties","properties","resolvePropertyChain","key","$","item","arr","splice","calcFunctions","left","right","calc","calculationResult","operator","clearElement","empty","clearOperationData","createElement","elementName","attributes","text","serializedAttrs","Boolean","join","template","TimelineEventNames","PLAY_TOGGLE_REQUEST","PLAY_REQUEST","STOP_REQUEST","PAUSE_REQUEST","SEEK_REQUEST","RESIZE_REQUEST","CONTAINER_REQUEST","DURATION_REQUEST","REQUEST_CURRENT_TIMELINE","DURATION","TIME","SEEKED","COMPLETE","RESTART","PLAY","STOP","PAUSE","SEEK","RESIZE","CURRENT_TIMELINE_CHANGE","FIRST_FRAME","REQUEST_INSTANCE","REQUEST_ACTION","REQUEST_FUNCTION","REQUEST_TIMELINE_URI","BEFORE_REQUEST_TIMELINE_URI","REQUEST_ENGINE_ROOT","REQUEST_CURRENT_TIMELINE_POSITION","REQUEST_TIMELINE_CLEANUP","EXECUTE_TIMELINEACTION","RESIZE_TIMELINEACTION","REQUEST_LABEL_COLLECTION","REQUEST_LABEL_COLLECTIONS","REQUEST_CURRENT_LANGUAGE","LANGUAGE_CHANGE","customFunction","func","apply","endAction","actionInstance","actionOperationData","keys","endLoop","loopIndex","loopLength","loopStartIndex","currentItem","endWhen","whenEvaluation","extendController","controllerExtension","getControllerFromElement","controllerName","find","ctrl","warn","getControllerInstance","getElementDimensions","modifier","dimensions","width","innerWidth","height","innerHeight","clonedDimensions","ratioModifier","prefix","isPercent","_getModifierSuffix","parseInt","widthModifier","heightModifier","modifiedDimension","_modifyDimensions","modifiedDimensions","ratio","ratios","Error","_modifyDimensionsByRatio","modifyDimensions","getImport","importedInstance","getQueryParams","searchParams","URLSearchParams","window","location","search","queryParams","defaultValues","invokeObjectMethod","methodName","methodArguments","methodResult","jsonCache","loadJSON","url","_context","json","fetch","response","cacheValue","group","dir","groupEnd","math","arg","Math","mathResult","functionName","findMatchingOperationIndex","operation","self","counter","matchingName","otherwise","endWhenIndex","slice","findIndex","removeControllerFromElement","idx","detach","removeElement","remove","removePropertiesFromOperationData","propertyNames","includes","reparentElement","newParentSelector","appendTo","requestAction","action","resizeAction","resize","findElementBySelector","root","selector","selectElement","useSelectedElementAsRoot","setElementAttributes","attr","setElementContent","insertionType","html","append","prepend","setGlobalData","newGlobals","setOperationData","override","resolvedProperties","setStyle","css","startAction","startLoop","collection","loopEndIndex","toggleClass","toggleElement","toggle","wait","milliseconds","setTimeout","when","expression","leftNr","rightNr","isNaN","parseExpression","evaluations","list","otherWiseIndex","findNextFlowControlIndex","ActionCreatorFactory","configurationfactory","createAction","creator","EndableActionCreator","addAction","actionConfig","createInitAction","addInitAction","createEventAction","ActionCreator","addEventAction","createTimelineAction","uri","TimelineActionCreator","addTimelineAction","factory","uuidv4","_proto2","getId","setName","getConfiguration","callBack","newConfig","addStartOperationByType","operationClass","addStartOperation","next","_proto3","addEndOperationByType","addEndOperation","addDuration","array_move","old_index","new_index","ActionEditor","configurationFactory","updateConfiguration","getName","OperationEditor","editStartOperation","o","removeStartOperation","moveStartOperation","direction","EndableActionEditor","editEndOperation","removeEndOperation","moveEndOperation","TimelineActionEditor","setDuration","actionEditor","_proto4","getSystemName","setSystemName","setOperationDataItem","getOperationDataKeys","getOperationDataValue","RequestAnimationFrameTimelineProvider","config","_currentPosition","_updateBound","_update","_firstFramePending","_currentPlaylistItem","_tickInterval","_playlist","_containerElement","_abortController","_onTime","_onComplete","_onRestart","_onFirstFrame","loop","_playState","_extractPlaylist","configuration","timelines","timeline","type","onTime","callback","onComplete","onRestart","onFirstFrame","playlistItem","_now","playState","stop","_resetToStartPosition","_callbackPosition","abort","AbortController","ms","signal","document","_document","_document$timeline","currentTime","performance","now","frame","time","aborted","scheduleFrame","roundedElapsed","round","delay","requestAnimationFrame","animationInterval","getContainer","_stopAnimationInterval","resetPosition","destroy","pause","seek","position","getPosition","getDuration","get","TimelineProvidersSettingsEditor","providersSettings","addProvider","timelineType","settings","poster","vendor","TimelineProviderSettingsEditor","editProvider","providerSettings","providersSettingsEditor","setVendor","setSelector","timelineProviders","ConfigurationFactory","actionCreatorFactory","extend","extensionMethodName","extensionMethod","extendMultiple","extensions","defaultLanguage","engine","containerSelector","timelineProviderSettings","language","availableLanguages","layoutTemplate","initActions","actions","labels","setLayoutTemplate","setDefaultLanguage","setContainerSelector","editTimelineProviderSettings","addLanguage","languageCode","languageLabel","languages","_initializeCollection","lang","label","_internalAddAction","collectionName","getTimeline","addTimeline","timelineConfig","timelineActions","t","removeTimeline","_initializeLabel","l","_getLabelTranslation","labelTranslations","translation","addLabel","code","labelConfig","removeLabel","editAction","a","editEventAction","eventActions","_this$configuration$e","editInitAction","editTimelineAction","EventListenerController","actionInstanceInfos","actionName","isStart","_isStartAction","on","_eventHandler","event","target","targetValue","_executeAction","actionInfo","method","_eventbus","off","LabelController","listeners","currentLanguage","labelData","requestLabelDataBound","setLabelId","newLabelId","_setLabel","_requestLabelData","labelId","_handleLanguageChange","labelCollection","_createTextDataLookup","d","_this3","LottieController","eventbusRemovers","animationItem","serializedData","serializedIEData","freezePosition","endPosition","_parseFilename","animationData","iefallback","setting","values","labelIds","resultHolder","labelCollections","_createAnimation","addEventListener","_destroy","playSegments","serialized","_isIE","lottie","loadAnimation","autoplay","container","rendererSettings","renderer","timeCompleted","viewBox","infos","isIE","NavigationController","navigation","navLookup","navVidIdLookup","ctrlLookup","activeNavigationPoint","labelControllers","eventhandlers","_buildNavigationData","_handleNavigateVideoUrl","_highlightMenu","_handleRequestCurrentNavigation","_handleVideoComplete","_buildHtml","_initHistory","navId","_getQueryVariable","videoIndex","videoUrlIndex","variableIdx","href","hashIndex","query","resultCallback","labelCtrl","navigationData","title","handler","onpopstate","_pushCurrentState","state","parentElm","ul","_addNavElement","visible","li","_addLabel","_addClickHandler","children","mouseup","_menuMouseupHandler","navdata","requestedVideoPosition","navElm","navData","autoNext","nav","previous","nextId","roots","childId","ProgressbarController","textElement","_positionUpdateHandler","_this$selectedElement2","clickHandler","_clickHandler","percentage","floor","rect","getBoundingClientRect","clientX","RoutingController","_handleBeforeRequestVideoUrl","_handlePushHistoryState","_handlePopstate","pos","history","pushState","navigationId","_event$state","_index","_requestedVideoPosition","isHistoryRequest","_pushState","currentPosition","currentState","replaceState","SubtitlesController","actionLookup","lastFunc","detachTime","onTimeHandler","detachSeek","onSeekedHandler","detachLangChange","languageChangeHandler","internalDetach","detachMethods","f","newLanguage","removeTitle","setTitle","titleLanguageLookup","createActionLookup","subtitleData","titles","subtitleTimeLookup","i","ii","j","jj","subs","description","dependentProperties","required","outputProperties","getOwnPropertyNames","default","OperationNamesProvider","getOperationNames","ControllerNamesProvider","getControllerNames","OperationMetadataProvider","getOperationMetadata","operationName","getMetadata","operationMetadata","TimeLineEventNamesProvider","getEventNames","ConfigurationResolver","importer","process","actionRegistryListener","resolvePlaceholders","resolvedConfig","resolveActions","timelineFlow","resolveTimelines","eventActionConfigurations","resolveActionConfiguration","eventAction","registerAction","resolveEventActions","concat","reduce","aggr","resolveTimelineAction","resolveOperation","resolveEndableActionConfiguration","actionConfiguration","actionConfigurations","configFragment","rootConfig","configValue","configProperty","templateKey","jsonKey","resolvePlaceholder","EligiusEngine","languageManager","_timeLineActionsLookup","_eventbusRemovers","_currentTimelineUri","_activeTimelineProvider","_lastPosition","_createLayoutTemplate","_addEventbusListeners","_createTimelineLookup","_initializeTimelineProvider","_this$configuration$t","firstTimeline","provider","_onTimeHandler","_onCompleteCallback","_onFirstFrameCallback","_onRestartCallback","_executeActions","_this$_activeTimeline2","_cleanUp","_context2","_cleanUpTimeline","reverse","_context3","remover","providerInfo","_addEventListener","eventHandler","_handleRequestEngineRoot","_handleRequestTimelineUri","_handleRequestTimelinePosition","_handleTimelineComplete","_handleExecuteTimelineAction","_resizeTimelineAction","_requestCurrentTimeline","_toggleplay","_playRequest","_stopRequest","_pauseRequest","containerRequest","durationRequest","seekRequest","offset","_context4","seekPosition","_executeSeekActions","_this$_activeTimeline5","_this$_activeTimeline6","timelineInfo","_addTimelineActionStart","_addTimelineActionEnd","timeLineAction","startPosition","timelineStartPositions","_initializeTimelinePosition","_initializeUriLookup","startMethod","_timeLineAction$id","Infinity","isFinite","timelineEndPositions","endMethod","_context5","engineRootSelector","_context7","newProviderSettings","once","_context6","_executeStartActions","_executeRelevantActions","_getActiveActions","_getActionsForPosition","allActions","sort","sortActions","executionType","_getRelevantTimelineActions","currentActions","_getTimelineActionsForUri","info","_executeActionsForPosition","executions","exec","_context8","newActions","currentActionsEnd","b","ActionRegistryEventbusListener","_actionRegistry","Map","has","set","Eventbus","eventHandlers","eventInterceptors","eventListeners","clear","_getEventInterceptors","_getEventHandlers","eventHandlerDecorator","handlers","_callHandlers","registerEventlistener","eventbusListener","registerInterceptor","interceptor","interceptors","intercept","listener","_args","RequestVideoUriInterceptor","LanguageManager","_currentLanguage","_labelLookup","_setRootElementLang","_createLabelLookup","_handleRequestLabelCollection","_handleRequestLabelCollections","_handleRequestCurrentLanguage","rootSelector","_extractLanguageFromCulture","culture","acc","EngineFactory","windowRef","options","_actionsLookup","_eventRemovers","_importer","_resizeTimeout","devtools","_initializeDevtools","_requestInstanceHandler","_requestActionHandler","_requestFunctionHandler","handleSpaceBound","_handleSpacePress","hotkeys","unbind","resizeBound","_resizeHandler","jqWin","keyboardEvent","_hotkeysEvent","preventDefault","diagnosticInfo","subscribe","kind","messageData","DEV_TOOLS_KEY","clearTimeout","_importSystemEntryWithEventbusDependency","_importSystemEntry","createEngine","resolver","EngineClass","_configuration$eventA","resolvedConfiguration","_createTimelineProviders","TimelineProviderClass","ops","ctrls","providers","prvdrs","evtb","EligiusResourceImporter","engines","getProviderNames","configPath","assetInfo","_gatherOperations","extension","fs","readdirSync","path","subdir","file","basename","replace","g","toUpperCase","defaultImport","_gatherControllers","_gatherProviders","_gatherEngines","_gatherImportPaths","importerSourceCode","_generateSourceCode"],"mappings":"63OAAgBA,EAAWC,GACzB,MAAwB,mBAAVA,WCDAC,EAASD,GACvB,OAAiB,OAAVA,GAAmC,iBAAVA,WCGlBE,EAA6BF,GAC3C,GAAIG,MAAMC,QAAQJ,GAChB,OAAQA,EAAqBK,IAAIH,GAC5B,GAAIF,aAAiBM,UAC1B,MAAO,gBACF,GAAIL,EAASD,GAAQ,CAC1B,GACmD,UAAjDA,EAAMO,YAAYC,WAAWC,UAAU,EAAG,KACzCT,EAAMO,YAAYC,WAAWE,WAAW,qBACzC,CACA,IAAMC,EAAqBX,EAAMO,YAAYC,WAC7C,OAAOG,EAAWF,UAAU,EAAGE,EAAWC,QAAQ,KAAO,GAE3D,OAAOC,OAAOC,YACZD,OAAOE,QAAQf,GAAOK,KAAI,YAAA,MAA2B,MAEnDH,aAGC,GAAIH,EAAWC,GAAQ,CAC5B,IAAMW,EAAqBX,EAAMQ,WAEjC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ACKuD,EAAYtG,KACb,SAACwG,GAAD,OAAYA,EAAI5B,mBAAkB4B,EAAI5B,iBAAgB4B,EAAI5B,qBAG9D7B,EAAOc,KAAK,MACZd,EAAOc,KAAK,IACZd,EAAOc,KACL,sEAEFd,EAAOc,KAAK,+CACZd,EAAOc,KAAK,+DACZd,EAAOc,KAAK,+CACZd,EAAOc,KAAK,MACZd,EAAOc,KAAK,IACZd,EAAOc,KAAK,2CAELd,EAAOyI,KAAK,MArCQwvB,CAAoB10B,GAE/C,OAAOy0B"}
|
|
1
|
+
{"version":3,"file":"eligius.cjs.production.min.js","sources":["../src/util/guards/is-function.ts","../src/util/guards/is-object.ts","../src/util/prepare-value-for-serialization.ts","../src/diagnostics/devtool-event-lister.ts","../src/diagnostics/diagnostics.ts","../src/operation/helper/deep-copy.ts","../src/action/action.ts","../src/util/guards/is-promise.ts","../src/action/endable-action.ts","../src/action/timeline-action.ts","../src/build/generate-importer-source-code.ts","../src/operation/add-class.ts","../src/operation/helper/get-element-data.ts","../src/operation/helper/merge-operation-data.ts","../src/operation/helper/internal-resolve.ts","../src/operation/add-controller-to-element.ts","../src/operation/helper/attach-controller-to-element.ts","../src/operation/animate.ts","../src/operation/animate-with-class.ts","../src/util/guards/is-string.ts","../src/operation/helper/get-property-chain-value.ts","../src/operation/helper/globals.ts","../src/operation/helper/resolve-external-property-chain.ts","../src/operation/broadcast-event.ts","../src/operation/helper/resolve-event-arguments.ts","../src/operation/helper/remove-event-data-from-operation-data.ts","../src/operation/helper/resolve-property-values.ts","../src/operation/calc.ts","../src/operation/clear-element.ts","../src/operation/clear-operation-data.ts","../src/operation/create-element.ts","../src/timeline-event-names.ts","../src/operation/custom-function.ts","../src/operation/end-action.ts","../src/operation/end-loop.ts","../src/operation/end-when.ts","../src/operation/extend-controller.ts","../src/operation/get-attributes-from-element.ts","../src/operation/get-controller-from-element.ts","../src/operation/get-controller-instance.ts","../src/operation/get-element-dimensions.ts","../src/operation/helper/modify-dimensions.ts","../src/operation/get-import.ts","../src/operation/get-query-params.ts","../src/operation/invoke-object-method.ts","../src/operation/load-json.ts","../src/operation/log.ts","../src/operation/math.ts","../src/operation/helper/find-matching-operation-index.ts","../src/operation/otherwise.ts","../src/operation/remove-class.ts","../src/operation/remove-controller-from-element.ts","../src/operation/remove-element.ts","../src/operation/remove-properties-from-operation-data.ts","../src/operation/reparent-element.ts","../src/operation/request-action.ts","../src/operation/resize-action.ts","../src/operation/select-element.ts","../src/operation/set-data.ts","../src/operation/set-element-attributes.ts","../src/operation/set-element-content.ts","../src/operation/set-global-data.ts","../src/operation/set-operation-data.ts","../src/operation/set-style.ts","../src/operation/start-action.ts","../src/operation/start-loop.ts","../src/operation/toggle-class.ts","../src/operation/toggle-element.ts","../src/operation/wait.ts","../src/operation/when.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/configuration/api/label-editor.ts","../src/timelineproviders/request-animation-frame-timeline-provider.ts","../src/util/animation-interval.ts","../src/configuration/api/timeline-provider-settings-editor.ts","../src/configuration/api/configuration-factory.ts","../src/controllers/event-listener-controller.ts","../src/controllers/label-controller.ts","../src/controllers/lottie-controller.ts","../src/controllers/navigation-controller.ts","../src/controllers/progressbar-controller.ts","../src/controllers/routing-controller.ts","../src/controllers/subtitles-controller.ts","../src/operation/metadata/add-class.ts","../src/operation/metadata/add-controller-to-element.ts","../src/operation/metadata/animate.ts","../src/operation/metadata/animate-with-class.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/create-element.ts","../src/operation/metadata/custom-function.ts","../src/operation/metadata/end-action.ts","../src/operation/metadata/end-loop.ts","../src/operation/metadata/end-when.ts","../src/operation/metadata/extend-controller.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-element-dimensions.ts","../src/operation/metadata/get-import.ts","../src/operation/metadata/get-query-params.ts","../src/operation/metadata/invoke-object-method.ts","../src/operation/metadata/load-json.ts","../src/operation/metadata/log.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/request-action.ts","../src/operation/metadata/resize-action.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-global-data.ts","../src/operation/metadata/set-operation-data.ts","../src/operation/metadata/set-style.ts","../src/operation/metadata/start-action.ts","../src/operation/metadata/start-loop.ts","../src/operation/metadata/toggle-class.ts","../src/operation/metadata/toggle-element.ts","../src/operation/metadata/wait.ts","../src/operation/metadata/when.ts","../src/configuration/api/name-providers.ts","../src/configuration/configuration-resolver.ts","../src/operation/helper/resolve-property-chain.ts","../src/eligius-engine.ts","../src/eventbus/actionregistry-eventbus-listener.ts","../src/eventbus/eventbus.ts","../src/eventbus/request-video-uri-interceptor.ts","../src/language-manager.ts","../src/operation/helper/set-global.ts","../src/engine-factory.ts","../src/importer/eligius-resource-importer.ts","../src/diagnostics/types.ts","../src/util/dash-to-camel-case.ts"],"sourcesContent":["export function isFunction(value: any): value is Function {\r\n return typeof value === 'function';\r\n}\r\n","export function isObject(value: any): value is Object {\r\n return value !== null && typeof value === 'object';\r\n}\r\n","import jQuery from 'jquery';\r\nimport { isFunction } from './guards/is-function';\r\nimport { isObject } from './guards/is-object';\r\n\r\nexport function prepareValueForSerialization(value: any): any {\r\n if (Array.isArray(value)) {\r\n return (value as Array<any>).map(prepareValueForSerialization);\r\n } else if (value instanceof jQuery) {\r\n return 'jQuery object';\r\n } else if (isObject(value)) {\r\n if (\r\n value.constructor.toString().substring(0, 5) === 'class' ||\r\n !value.constructor.toString().startsWith('function Object()')\r\n ) {\r\n const funcString: string = value.constructor.toString();\r\n return funcString.substring(0, funcString.indexOf('{') + 1);\r\n }\r\n return Object.fromEntries(\r\n Object.entries(value).map(([propName, propValue]) => [\r\n propName,\r\n prepareValueForSerialization(propValue),\r\n ])\r\n );\r\n } else if (isFunction(value)) {\r\n const funcString: string = value.toString();\r\n const paranIndex = funcString.indexOf('{');\r\n if (paranIndex > -1) {\r\n return funcString.substring(0, funcString.indexOf('{') + 1);\r\n }\r\n return funcString;\r\n }\r\n return value;\r\n}\r\n","import { IEventbusListener } from '../eventbus';\r\nimport { prepareValueForSerialization } from '../util/prepare-value-for-serialization';\r\nimport { IDiagnosticsAgent } from './types';\r\n\r\nexport class DevToolEventListener implements IEventbusListener {\r\n constructor(private agent: IDiagnosticsAgent) {}\r\n\r\n handleEvent(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any[]\r\n ): void {\r\n const message = {\r\n eventName,\r\n eventTopic,\r\n args: prepareValueForSerialization(args),\r\n };\r\n try {\r\n this.agent.postMessage('eligius-diagnostics-event', message);\r\n } catch (e) {\r\n console.error('postmessage failed');\r\n console.error(e);\r\n console.log('message', message);\r\n }\r\n }\r\n}\r\n","import { TDiagnosticType } from './types';\r\n\r\nexport class Diagnostics {\r\n static send(_name: TDiagnosticType, _data: any): void {\r\n console.log(_name, _data);\r\n }\r\n static active: boolean;\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\n\r\nconst copyFunction =\r\n typeof structuredClone !== 'undefined'\r\n ? structuredClone\r\n : (original: any) => JSON.parse(JSON.stringify(original));\r\n\r\nexport function deepCopy<T>(original: T): T {\r\n if (isDefined(original)) {\r\n return copyFunction(original) as T;\r\n }\r\n return original;\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { Diagnostics } from '../diagnostics';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { IOperationContext, TOperationData } from '../operation/types';\r\nimport { isPromise } from '../util/guards/is-promise';\r\nimport { IAction } from './types';\r\n\r\nexport class Action implements IAction {\r\n public id = '';\r\n protected _contextStack: IOperationContext[] = [];\r\n\r\n constructor(\r\n public name: string,\r\n public startOperations: IResolvedOperation[],\r\n protected eventbus: IEventbus\r\n ) {}\r\n\r\n start(initOperationData?: TOperationData): Promise<TOperationData> {\r\n Diagnostics.active &&\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} begins executing start operations`\r\n );\r\n\r\n this._initializeContextStack();\r\n\r\n const result = new Promise<TOperationData>((resolve, reject) => {\r\n this.executeOperation(\r\n this.startOperations,\r\n 0,\r\n resolve,\r\n reject,\r\n initOperationData\r\n );\r\n }).catch((e) => {\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-action-error', {\r\n name: this.name,\r\n error: e,\r\n });\r\n console.error(`Error in action start '${this.name}'`);\r\n console.error(e);\r\n throw e;\r\n });\r\n return !Diagnostics.active\r\n ? result\r\n : result.then((operationsResult) => {\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} finished executing start operations`\r\n );\r\n return operationsResult;\r\n });\r\n }\r\n\r\n protected _initializeContextStack() {\r\n this._contextStack = [\r\n {\r\n currentIndex: -1,\r\n eventbus: this.eventbus,\r\n operations: this.startOperations,\r\n },\r\n ];\r\n }\r\n\r\n private _pushContext(parentContext: IOperationContext): IOperationContext {\r\n const newContext = {\r\n get currentIndex() {\r\n return parentContext.currentIndex;\r\n },\r\n set currentIndex(value: number) {\r\n parentContext.currentIndex = value;\r\n },\r\n get eventbus() {\r\n return parentContext.eventbus;\r\n },\r\n get operations() {\r\n return parentContext.operations;\r\n },\r\n parent: parentContext,\r\n };\r\n this._contextStack.push(newContext);\r\n return newContext;\r\n }\r\n\r\n private _popContext() {\r\n this._contextStack.pop();\r\n }\r\n\r\n executeOperation(\r\n operations: IResolvedOperation[],\r\n operationIndex: number,\r\n resolve: (value?: any | PromiseLike<any>) => void,\r\n reject: (reason?: any) => void,\r\n previousOperationData: TOperationData | undefined = {}\r\n ): void {\r\n let context = this._contextStack[this._contextStack.length - 1];\r\n if (context.newIndex !== undefined) {\r\n operationIndex = context.newIndex;\r\n delete context.newIndex;\r\n }\r\n\r\n context.currentIndex = operationIndex;\r\n\r\n if (operationIndex < operations.length) {\r\n const operationInfo = operations[operationIndex];\r\n\r\n const copy = deepCopy(operationInfo.operationData ?? {});\r\n\r\n const mergedOperationData = Object.assign(previousOperationData, copy);\r\n\r\n if (operationInfo.systemName === 'when') {\r\n context = this._pushContext(context);\r\n } else if (\r\n operationInfo.systemName === 'startLoop' &&\r\n context.owner !== operationInfo\r\n ) {\r\n context = this._pushContext(context);\r\n context.owner = operationInfo;\r\n }\r\n\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-operation', {\r\n systemName: operationInfo.systemName,\r\n operationData: mergedOperationData,\r\n context: {\r\n ...context,\r\n eventbus: undefined,\r\n },\r\n });\r\n\r\n const operationResult = operationInfo.instance.call(\r\n context,\r\n mergedOperationData\r\n );\r\n\r\n if (\r\n operationInfo.systemName === 'endWhen' ||\r\n (operationInfo.systemName === 'endLoop' &&\r\n context.newIndex === undefined)\r\n ) {\r\n this._popContext();\r\n }\r\n\r\n if (isPromise(operationResult)) {\r\n operationResult\r\n .then((promisedOperationResult) =>\r\n this.executeOperation(\r\n operations,\r\n ++operationIndex,\r\n resolve,\r\n reject,\r\n promisedOperationResult\r\n )\r\n )\r\n .catch((error: any) => {\r\n reject(error);\r\n });\r\n } else {\r\n this.executeOperation(\r\n operations,\r\n ++operationIndex,\r\n resolve,\r\n reject,\r\n operationResult\r\n );\r\n }\r\n } else {\r\n resolve(previousOperationData);\r\n }\r\n }\r\n}\r\n","export function isPromise(obj: any): obj is Promise<any> {\r\n return typeof obj === 'object' && typeof obj.then === 'function';\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { Diagnostics } from '../diagnostics';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { Action } from './action';\r\n\r\nexport class EndableAction extends Action {\r\n constructor(\r\n name: string,\r\n startOperations: IResolvedOperation[],\r\n public endOperations: IResolvedOperation[],\r\n eventBus: IEventbus\r\n ) {\r\n super(name, startOperations, eventBus);\r\n }\r\n\r\n end(initOperationData?: TOperationData): Promise<TOperationData> {\r\n Diagnostics.active &&\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} begins executing end operations`\r\n );\r\n\r\n if (!this.endOperations.length) {\r\n return Promise.resolve(initOperationData ?? {});\r\n }\r\n\r\n this._initializeContextStack();\r\n\r\n const result = new Promise<TOperationData>((resolve, reject) => {\r\n this.executeOperation(\r\n this.endOperations,\r\n 0,\r\n resolve,\r\n reject,\r\n initOperationData\r\n );\r\n }).catch((e) => {\r\n Diagnostics.active &&\r\n Diagnostics.send('eligius-diagnostics-action-error', {\r\n name: this.name,\r\n error: e,\r\n });\r\n console.error(`Error in action end '${this.name}'`);\r\n throw e;\r\n });\r\n\r\n return !Diagnostics.active\r\n ? result\r\n : result.then((operationsResult) => {\r\n Diagnostics.send(\r\n 'eligius-diagnostics-action',\r\n `${this.name ?? 'Action'} finished executing start operations`\r\n );\r\n return operationsResult;\r\n });\r\n }\r\n}\r\n","import { IResolvedOperation } from '../configuration/types';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { IStrictDuration } from '../types';\r\nimport { EndableAction } from './endable-action';\r\nimport { ITimelineAction } from './types';\r\n\r\nexport class TimelineAction extends EndableAction implements ITimelineAction {\r\n private _active: boolean = false;\r\n public get active() {\r\n return this._active;\r\n }\r\n\r\n constructor(\r\n name: string,\r\n startOperations: IResolvedOperation[],\r\n endOperations: IResolvedOperation[],\r\n public duration: IStrictDuration,\r\n eventBus: IEventbus\r\n ) {\r\n super(name, startOperations, endOperations, eventBus);\r\n }\r\n\r\n start(initOperationData?: TOperationData): Promise<TOperationData> {\r\n if (!this.active || this.duration.end < 0) {\r\n this._active = this.endOperations.length > 0;\r\n return super.start(initOperationData);\r\n }\r\n\r\n return Promise.resolve({});\r\n }\r\n\r\n end(initOperationData: TOperationData): Promise<TOperationData> {\r\n this._active = false;\r\n return super.end(initOperationData);\r\n }\r\n}\r\n","import fs from 'fs';\r\nimport path from 'path';\r\nimport {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IOperationConfiguration\r\n} from '../configuration/types';\r\nimport dashToCamelCase from '../util/dash-to-camel-case';\r\n\r\ninterface ImportInfo {\r\n systemName: string;\r\n path?: string;\r\n defaultImport?: boolean;\r\n}\r\n\r\nexport interface IAssetInfo {\r\n path: string;\r\n extension: string;\r\n}\r\n\r\n/**\r\n * This function takes an Eligius engine configuration, a root path for the configuration file and an arbitrary list of asset info.\r\n * The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.\r\n * I.e. html, json, etc.\r\n *\r\n * @param config\r\n * @param configPath\r\n * @param assetInfo\r\n */\r\nexport function generateImporterSourceCode(\r\n config: IEngineConfiguration,\r\n configPath: string,\r\n assetInfo: IAssetInfo[]\r\n) {\r\n const importPaths = _gatherImportPaths(config, configPath, assetInfo);\r\n\r\n const importerSourceCode = _generateSourceCode(importPaths);\r\n\r\n return importerSourceCode;\r\n}\r\n\r\nfunction _generateSourceCode(importPaths: ImportInfo[]) {\r\n const result = importPaths\r\n .filter((x) => x.defaultImport)\r\n .map((imp) => `import ${imp.systemName} from '${imp.path}';`)\r\n .concat(\r\n importPaths\r\n .filter((x) => !x.defaultImport)\r\n .map(\r\n (imp) => `import {${imp.systemName}} from '${imp.path ?? 'eligius'}';`\r\n )\r\n );\r\n result.push(`import { ISimpleResourceImporter } from 'eligius';`);\r\n result.push('');\r\n\r\n result.push('const imports: Record<string, any> = {');\r\n result.push(\r\n ...importPaths.map(\r\n (imp) => `${imp.systemName}: { '${imp.systemName}': ${imp.systemName} },`\r\n )\r\n );\r\n result.push('};');\r\n result.push('');\r\n result.push(\r\n 'class EligiusResourceImporter implements ISimpleResourceImporter {'\r\n );\r\n result.push('import(name: string): Record<string, any> {');\r\n result.push('if (imports.hasOwnProperty(name)) { return imports[name]; }');\r\n result.push('throw Error(`Unknown systemName: ${name}`);');\r\n result.push('}}');\r\n result.push('');\r\n result.push('export default EligiusResourceImporter;');\r\n\r\n return result.join('\\n');\r\n}\r\n\r\nfunction _gatherImportPaths(\r\n config: IEngineConfiguration,\r\n configPath: string,\r\n assetInfo: IAssetInfo[]\r\n): ImportInfo[] {\r\n return [\r\n ..._gatherOperations(config),\r\n ...assetInfo.flatMap((info) =>\r\n _gatherAssets(configPath, info.path, info.extension)\r\n ),\r\n ..._gatherControllers(config),\r\n ..._gatherProviders(config),\r\n ..._gatherEngines(config),\r\n ];\r\n}\r\n\r\nfunction _gatherAssets(assetPath: string, subdir: string, extension: string) {\r\n const entries = fs.readdirSync(path.join(assetPath, subdir));\r\n return entries.map((file) => {\r\n const importName = `${dashToCamelCase(path.basename(file, extension))}`;\r\n return {\r\n systemName: importName,\r\n path: `./${subdir}/${file}`,\r\n defaultImport: true,\r\n };\r\n });\r\n}\r\n\r\nfunction _gatherControllers(config: IEngineConfiguration) {\r\n let importPaths = [] as [] as ImportInfo[];\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(config.initActions)\r\n );\r\n importPaths.push(..._gatherControllerImportPathsFromActions(config.actions));\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(\r\n config.timelines.flatMap((x) => x.timelineActions)\r\n )\r\n );\r\n importPaths.push(\r\n ..._gatherControllerImportPathsFromActions(config.eventActions)\r\n );\r\n importPaths = dedupe(importPaths);\r\n return importPaths;\r\n}\r\n\r\nfunction _gatherProviders(config: any) {\r\n if (config.timelineProviderSettings) {\r\n return Object.values(config.timelineProviderSettings).map<ImportInfo>(\r\n (settings: any) => {\r\n return {\r\n systemName: settings.systemName,\r\n };\r\n }\r\n );\r\n }\r\n return [] as ImportInfo[];\r\n}\r\n\r\nfunction _gatherEngines(config: any) {\r\n if (config.engine) {\r\n const { systemName } = config.engine;\r\n return [\r\n {\r\n systemName,\r\n },\r\n ];\r\n }\r\n return [];\r\n}\r\n\r\nfunction _gatherOperations(config: IEngineConfiguration): ImportInfo[] {\r\n let importPaths = _gatherOperationImportPathsFromActions(\r\n config.initActions\r\n .concat(config.actions)\r\n .concat(config.eventActions ?? ([] as any[]))\r\n );\r\n\r\n if (config.timelines) {\r\n const timelineActions = config.timelines.flatMap((x) => x.timelineActions);\r\n\r\n importPaths = importPaths.concat(\r\n _gatherOperationImportPathsFromActions(timelineActions)\r\n );\r\n }\r\n\r\n return dedupe(importPaths);\r\n}\r\n\r\nfunction _gatherControllerImportPathsFromActions(\r\n actionsConfig?: IActionConfiguration[] | IEndableActionConfiguration[]\r\n): ImportInfo[] {\r\n if (!actionsConfig) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n const operations = actionsConfig.flatMap((x) => [\r\n ...x.startOperations,\r\n ...((x as any).endOperations ?? []),\r\n ]);\r\n\r\n return _gatherControllerImportPaths(operations);\r\n}\r\n\r\nfunction _gatherOperationImportPathsFromActions(\r\n actionsConfig?: IActionConfiguration[] | IEndableActionConfiguration[]\r\n): ImportInfo[] {\r\n if (!actionsConfig) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n const operations = actionsConfig.flatMap((x) => [\r\n ...x.startOperations,\r\n ...((x as any).endOperations ?? []),\r\n ]);\r\n\r\n return _gatherOperationImportPaths(operations);\r\n}\r\n\r\nfunction _gatherControllerImportPaths(\r\n operationConfigs: IOperationConfiguration[]\r\n): ImportInfo[] {\r\n if (!operationConfigs) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n return operationConfigs\r\n .filter((operationConfig) => {\r\n if (operationConfig.operationData?.hasOwnProperty('systemName')) {\r\n return operationConfig.operationData.systemName.endsWith('Controller');\r\n }\r\n return false;\r\n })\r\n .map((operationConfig) => {\r\n const { systemName } = operationConfig.operationData ?? {};\r\n return {\r\n systemName,\r\n };\r\n });\r\n}\r\n\r\nfunction _gatherOperationImportPaths(operationConfigs: any[]): ImportInfo[] {\r\n if (!operationConfigs) {\r\n return [] as ImportInfo[];\r\n }\r\n\r\n return operationConfigs.map((operationConfig) => {\r\n const { systemName } = operationConfig;\r\n return {\r\n systemName,\r\n };\r\n });\r\n}\r\n\r\nfunction dedupe(importPaths: ImportInfo[]): ImportInfo[] {\r\n const lookup: Record<string, true> = {};\r\n return importPaths.filter((imp) => {\r\n if (lookup[imp.systemName]) {\r\n return false;\r\n }\r\n lookup[imp.systemName] = true;\r\n return true;\r\n });\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IAddClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation adds the specified class name to the specified selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const addClass: TOperation<IAddClassOperationData> = function (\r\n operationData: IAddClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.addClass(className);\r\n return operationData;\r\n};\r\n","import { IController } from '../../controllers/types';\r\n\r\nexport const controllersDataName = 'eligiusEngineControllers';\r\n\r\nfunction getElementData(name: string, element: JQuery): IController<any>[] {\r\n return element.data(name);\r\n}\r\n\r\nconst getElementControllers = getElementData.bind(null, controllersDataName);\r\n\r\nexport { getElementData, getElementControllers };\r\n\r\n","import { TOperationData } from '../types';\r\n\r\nexport function mergeOperationData<T extends TOperationData, K = T>(\r\n operationData: T,\r\n newOperationData: TOperationData\r\n): K {\r\n return { ...(operationData as any), ...newOperationData } as K;\r\n}\r\n","import { TOperationData } from '../types';\r\nimport { mergeOperationData } from './merge-operation-data';\r\n\r\nexport function internalResolve(\r\n resolve: Function,\r\n operationData: TOperationData,\r\n newOperationData?: TOperationData\r\n) {\r\n if (newOperationData) {\r\n resolve(mergeOperationData(operationData, newOperationData));\r\n } else {\r\n resolve(operationData);\r\n }\r\n}\r\n","import { IController } from '../controllers/types';\r\nimport { attachControllerToElement } from './helper/attach-controller-to-element';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { IOperationContext, TOperation, TOperationData } from './types';\r\n\r\nexport type IAddControllerToElementOperationData<\r\n T extends TOperationData = TOperationData\r\n> = {\r\n selectedElement: JQuery;\r\n controllerInstance: IController<T>;\r\n} & T;\r\n\r\n/**\r\n * This operation adds the specified controller instance to the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const addControllerToElement: TOperation<IAddControllerToElementOperationData> =\r\n function <T extends TOperationData = TOperationData>(\r\n this: IOperationContext,\r\n operationData: IAddControllerToElementOperationData<T>\r\n ) {\r\n const { selectedElement, controllerInstance } = operationData;\r\n\r\n attachControllerToElement(selectedElement, controllerInstance);\r\n\r\n controllerInstance.init(operationData);\r\n\r\n const promise = controllerInstance.attach(this.eventbus);\r\n\r\n if (promise) {\r\n return new Promise((resolve, reject) => {\r\n promise.then((newOperationData: TOperationData) => {\r\n internalResolve(resolve, operationData, newOperationData);\r\n }, reject);\r\n });\r\n } else {\r\n return operationData;\r\n }\r\n };\r\n","import { controllersDataName, getElementControllers } from './get-element-data';\r\n\r\nexport function attachControllerToElement(element: JQuery, controller: any) {\r\n if (!element.data(controllersDataName)) {\r\n element.data(controllersDataName, []);\r\n }\r\n const controllers = getElementControllers(element);\r\n if (controllers) {\r\n controllers.push(controller);\r\n }\r\n}\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IAnimateOperationData {\r\n animationEasing?: string;\r\n selectedElement: JQuery;\r\n animationProperties: any;\r\n animationDuration: JQuery.Duration;\r\n}\r\n\r\n/**\r\n * This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.\r\n * It resolves after the animation completes.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const animate: TOperation<IAnimateOperationData> = function (\r\n operationData: IAnimateOperationData\r\n) {\r\n const {\r\n animationEasing,\r\n selectedElement,\r\n animationProperties,\r\n animationDuration,\r\n } = operationData;\r\n const promise = new Promise<IAnimateOperationData>((resolve, reject) => {\r\n try {\r\n if (animationEasing) {\r\n selectedElement.animate(\r\n animationProperties,\r\n animationDuration,\r\n animationEasing,\r\n () => {\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n );\r\n } else {\r\n selectedElement.animate(animationProperties, animationDuration, () => {\r\n internalResolve(resolve, {}, operationData);\r\n });\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n return promise;\r\n};\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IAnimateWithClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n removeClass?: boolean;\r\n}\r\n\r\n/**\r\n * This operation adds the specified class name to the specified selected element and assumes that this\r\n * class triggers and animation on the selected element. It then waits for this animation to complete\r\n * before it resolves.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const animateWithClass: TOperation<IAnimateWithClassOperationData> =\r\n function (operationData: IAnimateWithClassOperationData) {\r\n let { selectedElement, className, removeClass } = operationData;\r\n removeClass = removeClass !== undefined ? removeClass : true;\r\n\r\n const promise = new Promise<IAnimateWithClassOperationData>(\r\n (resolve, reject) => {\r\n try {\r\n selectedElement.one(\r\n 'webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationEnd',\r\n () => {\r\n if (removeClass) {\r\n selectedElement.removeClass(className);\r\n }\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n );\r\n } catch (e) {\r\n reject(e);\r\n }\r\n }\r\n );\r\n\r\n selectedElement.addClass(className);\r\n\r\n return promise;\r\n };\r\n","export function isString(value: any): value is string {\r\n return typeof value === 'string';\r\n}\r\n","/**\r\n /**\r\n * Gets the value for the given property chain. A property chain is defined by a string array.\r\n *\r\n * For example, this property chain: `[mySource, subSource, element, value]` should be extracted from an object of this shape:\r\n * ```ts\r\n * const foo = {\r\n * mySource: {\r\n * subSource: {\r\n * element: {\r\n * value: 'bar'\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * The result of the invocation `getPropertyChainValue([mySource, subSource, element, value], foo)` would then yield the value `bar`.\r\n * \r\n * @param propertyChain\r\n * @param sourceObject\r\n * @returns\r\n */\r\nexport function getPropertyChainValue(\r\n propertyChain: string[],\r\n sourceObject: any\r\n) {\r\n let currentInstance = sourceObject;\r\n let suffix = null;\r\n\r\n propertyChain.forEach((prop: string, index: number) => {\r\n if (!currentInstance) {\r\n throw new Error(\r\n `Property chain '${propertyChain.join('.')}' cannot be resolved.`\r\n );\r\n }\r\n\r\n if (index === propertyChain.length - 1) {\r\n const parts = prop.split('+');\r\n if (parts.length > 1) {\r\n prop = parts[0];\r\n suffix = parts[1];\r\n }\r\n }\r\n currentInstance = currentInstance[prop];\r\n });\r\n\r\n return suffix ? `${currentInstance}${suffix}` : currentInstance;\r\n}\r\n","import { deepCopy } from './deep-copy';\r\nexport type TGlobalCache = Record<string, any>;\r\nconst cache: TGlobalCache = {};\r\n\r\nfunction _getGlobals(\r\n cache: TGlobalCache,\r\n name?: string\r\n): Record<string, any> | any {\r\n const value = name ? cache[name] : cache;\r\n return value && value !== cache ? deepCopy(value) : value;\r\n}\r\n\r\nfunction _setGlobals(cache: TGlobalCache, newValues: TGlobalCache): void {\r\n Object.entries(newValues).forEach(([name, value]) => (cache[name] = value));\r\n}\r\n\r\nfunction _clearGlobals(cache: TGlobalCache): void {\r\n const keys = Object.keys(cache);\r\n keys.forEach((key) => delete cache[key]);\r\n}\r\n\r\nexport const getGlobals: (name?: string) => TGlobalCache | any =\r\n _getGlobals.bind(null, cache);\r\n\r\nexport const setGlobals: (newValues: TGlobalCache) => void = _setGlobals.bind(\r\n null,\r\n cache\r\n);\r\n\r\nexport const clearGlobals: () => void = _clearGlobals.bind(null, cache);\r\n","import { isString } from '../../util/guards/is-string';\r\nimport { IOperationContext } from '../types';\r\nimport { getPropertyChainValue } from './get-property-chain-value';\r\nimport { getGlobals } from './globals';\r\n\r\n/**\r\n * Resolves operation and global data property chains.\r\n *\r\n * An operation data property chain is designated by a `operationdata.` suffix, followed by an arbitrary property chain.\r\n * For global data the suffix should be `globaldata.`\r\n *\r\n * If the propertyChainOrRegularObject is not a property chain, this value is returned instead.\r\n *\r\n * @param sourceObject The object that represents the operation data\r\n * @param propertyChainOrRegularObject A period delimited string, or just a regular object\r\n * @returns\r\n */\r\nexport function resolveExternalPropertyChain(\r\n sourceObject: any,\r\n operationContext: IOperationContext,\r\n propertyChainOrRegularObject: any\r\n) {\r\n if (isString(propertyChainOrRegularObject)) {\r\n const propNames = propertyChainOrRegularObject.split('.');\r\n const prefix = propNames.shift()?.toLowerCase();\r\n switch (prefix) {\r\n case 'operationdata':\r\n return getPropertyChainValue(propNames, sourceObject);\r\n case 'globaldata':\r\n return getPropertyChainValue(propNames, getGlobals());\r\n case 'context':\r\n return getPropertyChainValue(propNames, operationContext);\r\n }\r\n }\r\n\r\n return propertyChainOrRegularObject;\r\n}\r\n","import { removeEventDataFromOperationData } from './helper/remove-event-data-from-operation-data';\r\nimport { resolveEventArguments } from './helper/resolve-event-arguments';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IBroadcastEventOperationData {\r\n eventArgs: any[];\r\n eventTopic?: string;\r\n eventName: string;\r\n}\r\n\r\n/**\r\n * This operation broadcasts the given event through the eventbus, along with the\r\n * event argumetns and optional event topic.\r\n *\r\n * @param operationData\r\n */\r\nexport const broadcastEvent: TOperation<IBroadcastEventOperationData> =\r\n function (operationData: IBroadcastEventOperationData) {\r\n const { eventArgs, eventTopic, eventName } = operationData;\r\n\r\n const eventArguments = resolveEventArguments(\r\n operationData,\r\n this,\r\n eventArgs\r\n );\r\n\r\n if (eventTopic) {\r\n this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);\r\n } else {\r\n this.eventbus.broadcast(eventName, eventArguments);\r\n }\r\n\r\n removeEventDataFromOperationData(operationData);\r\n return operationData;\r\n };\r\n","import { IOperationContext, TOperationData } from '../../operation/types';\r\nimport { resolveExternalPropertyChain } from './resolve-external-property-chain';\r\n\r\nexport function resolveEventArguments(\r\n operationData: TOperationData,\r\n operationContext: IOperationContext,\r\n eventArgs?: any[]\r\n) {\r\n if (!eventArgs) {\r\n return;\r\n }\r\n const resolve = resolveExternalPropertyChain.bind(\r\n null,\r\n operationData,\r\n operationContext\r\n );\r\n return eventArgs.map(resolve);\r\n}\r\n","import { TOperationData } from '../../operation/types';\r\n\r\nexport function removeEventDataFromOperationData(\r\n operationData: TOperationData\r\n) {\r\n delete operationData.eventName;\r\n delete operationData.eventTopic;\r\n delete operationData.eventArgs;\r\n}\r\n","import $ from 'jquery';\r\nimport { IOperationContext, TOperationData } from '../../operation/types';\r\nimport { isObject } from '../../util/guards/is-object';\r\nimport { isString } from '../../util/guards/is-string';\r\nimport { deepCopy } from './deep-copy';\r\nimport { resolveExternalPropertyChain } from './resolve-external-property-chain';\r\n\r\nconst cache: any[] = [];\r\n\r\n/**\r\n * This takes a `newProperties` instance, resolves all of the properties on this object and then\r\n * assigns these properties to the given operationData.\r\n * \r\n * @param operationData \r\n * @param operationContext \r\n * @param newProperties \r\n * @returns \r\n */\r\nexport function resolvePropertyValues<T extends TOperationData>(\r\n operationData: T,\r\n operationContext: IOperationContext,\r\n newProperties: Record<string, any>\r\n): T {\r\n const copy =\r\n newProperties !== operationData ? deepCopy(newProperties) : newProperties;\r\n\r\n const resolvePropertyChain = resolveExternalPropertyChain.bind(\r\n null,\r\n operationData,\r\n operationContext\r\n );\r\n\r\n resolveNewProperties(newProperties, copy, resolvePropertyChain);\r\n\r\n return copy as T;\r\n}\r\n\r\nfunction resolveNewProperties(\r\n properties: Record<string, any>,\r\n copy: Record<string, any>,\r\n resolvePropertyChain: (propertyChain: string) => any\r\n) {\r\n // Prevent recursive looping\r\n if (cache.indexOf(properties) > -1) {\r\n return;\r\n }\r\n\r\n cache.push(properties);\r\n\r\n try {\r\n Object.entries(properties).forEach(([key, value]) => {\r\n if (value instanceof $) {\r\n return;\r\n }\r\n\r\n if (isString(value)) {\r\n copy[key] = resolvePropertyChain(value);\r\n } else if (Array.isArray(value)) {\r\n value.forEach((item, index, arr) => {\r\n if (isString(item)) {\r\n arr[index] = resolvePropertyChain(item);\r\n } else {\r\n resolveNewProperties(item, item, resolvePropertyChain);\r\n }\r\n });\r\n } else if (isObject(value)) {\r\n resolveNewProperties(value, value, resolvePropertyChain);\r\n } else {\r\n copy[key] = value;\r\n }\r\n });\r\n } finally {\r\n const index = cache.indexOf(properties);\r\n cache.splice(index, 1);\r\n }\r\n}\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport type TCalculationOperator = '+' | '-' | '*' | '/' | '%' | '**';\r\n\r\nexport interface ICalcOperationData {\r\n left: string | number;\r\n right: string | number;\r\n operator: TCalculationOperator;\r\n calculationResult?: number;\r\n}\r\n\r\nconst calcFunctions: Record<\r\n TCalculationOperator,\r\n (left: number, right: number) => number\r\n> = {\r\n '+': (left: number, right: number) => left + right,\r\n '-': (left: number, right: number) => left - right,\r\n '*': (left: number, right: number) => left * right,\r\n '/': (left: number, right: number) => left / right,\r\n '%': (left: number, right: number) => left % right,\r\n '**': (left: number, right: number) => left ** right,\r\n};\r\n\r\n/**\r\n * This operation calculates the given left and right hand operands using the specified operator.\r\n *\r\n * @param operationData\r\n */\r\nexport const calc: TOperation<ICalcOperationData> = function (\r\n operationData: ICalcOperationData\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n\r\n const { left, right, operator } = operationData;\r\n\r\n operationData.calculationResult = calcFunctions[operator](+left, +right);\r\n\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IClearElementOperationData {\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation removes all of the children from the given selected element.\r\n * \r\n */\r\nexport const clearElement: TOperation<IClearElementOperationData> = function(\r\n operationData: IClearElementOperationData\r\n) {\r\n const { selectedElement } = operationData;\r\n selectedElement.empty();\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IClearOperationDataOperationData {\r\n properties?: string[];\r\n}\r\n\r\n/**\r\n * This operation removes all of the properties on the current operation date.\r\n * Or, if the properties property is set only removes the properties defined by that list.\r\n * \r\n */\r\nexport const clearOperationData: TOperation<IClearOperationDataOperationData> = function(\r\n operationData: IClearOperationDataOperationData\r\n) {\r\n const { properties } = operationData;\r\n\r\n if (properties) {\r\n properties.forEach(name => {\r\n delete (operationData as any)[name];\r\n });\r\n delete operationData.properties;\r\n return operationData;\r\n }\r\n\r\n return {};\r\n};\r\n","import $ from 'jquery';\r\nimport { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\nexport type TTagNames = keyof HTMLElementTagNameMap;\r\n\r\nexport interface ICreateElementOperationData<T extends TTagNames> {\r\n elementName: T;\r\n text?: string;\r\n attributes?: Partial<HTMLElementTagNameMap[T]>;\r\n template?: JQuery;\r\n}\r\n\r\n/**\r\n * This operation creates the DOM element described by the given elementName and attributes and assigns\r\n * the instance to the `template` property on the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const createElement: TOperation<ICreateElementOperationData<any>> =\r\n function <T extends TTagNames>(\r\n this: IOperationContext,\r\n operationData: ICreateElementOperationData<T>\r\n ) {\r\n operationData = resolvePropertyValues(\r\n operationData,\r\n this,\r\n operationData\r\n ) as ICreateElementOperationData<T>;\r\n\r\n const { elementName, attributes, text } = operationData;\r\n\r\n const serializedAttrs = attributes\r\n ? ` ${Object.entries(attributes)\r\n .filter(([_, value]) => Boolean(value))\r\n .map(([key, value]) => `${key}=\"${value}\"`)\r\n .join(' ')}`\r\n : '';\r\n\r\n const template = text\r\n ? $(`<${elementName}${serializedAttrs}>${text}</${elementName}>`)\r\n : $(`<${elementName}${serializedAttrs}/>`);\r\n\r\n operationData.template = template;\r\n\r\n return operationData;\r\n };\r\n","/**\r\n * These are the event names that are being braodcast and/or handled by Eligius.\r\n */\r\nexport class TimelineEventNames {\r\n // timeline requests\r\n /**\r\n * Broadcasting this event will start the current timeline when it is currently paused, or pauses when it is playing.\r\n */\r\n static PLAY_TOGGLE_REQUEST = 'timeline-play-toggle-request';\r\n /**\r\n * Broadcasting this event will start the current timeline.\r\n */\r\n static PLAY_REQUEST = 'timeline-play-request';\r\n /**\r\n * Broadcasting this event will stop the current timeline.\r\n */\r\n static STOP_REQUEST = 'timeline-stop-request';\r\n /**\r\n * Broadcasting this event will pause the current timeline.\r\n */\r\n static PAUSE_REQUEST = 'timeline-pause-request';\r\n /**\r\n * Broadcasting this event will seek the specified position in the current timeline.\r\n * This event takes one argument: A numeric value that represents the new position.\r\n */\r\n static SEEK_REQUEST = 'timeline-seek-request';\r\n /**\r\n * Broadcasting this event will tell the current {@link ITimelineProvider} to resize.\r\n */\r\n static RESIZE_REQUEST = 'timeline-resize-request';\r\n /**\r\n * Broadcasting this event will return the element in which the current timeline is being rendered.\r\n * This event takes one argument: The callback function that will return the specified element.\r\n */\r\n static CONTAINER_REQUEST = 'timeline-container-request';\r\n /**\r\n * Broadcasting this event will return the duration of the current timeline.\r\n * This event takes one argument: The callback function that will return the duration.\r\n */\r\n static DURATION_REQUEST = 'timeline-duration-request';\r\n /**\r\n * Broadcasting this event will return the uri of the current timeline.\r\n * This event takes one argument: The callback function that will return the uri.\r\n */\r\n static REQUEST_CURRENT_TIMELINE = 'timeline-request-current-timeline';\r\n\r\n // timeline announcements\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce their duration.\r\n */\r\n static DURATION = 'timeline-duration';\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce the current play position whenever it changes.\r\n */\r\n static TIME = 'timeline-time';\r\n /**\r\n * This event is broadcast by {@link ITimelineProvider} instances to announce the new play position and duration after a seek was executed.\r\n */\r\n static SEEKED = 'timeline-seeked';\r\n /**\r\n *\r\n */\r\n static COMPLETE = 'timeline-complete';\r\n static RESTART = 'timeline-restart';\r\n static PLAY = 'timeline-play';\r\n static STOP = 'timeline-stop';\r\n static PAUSE = 'timeline-pause';\r\n static SEEK = 'timeline-seek';\r\n static RESIZE = 'timeline-resize';\r\n static CURRENT_TIMELINE_CHANGE = 'timeline-current-timeline-change';\r\n static FIRST_FRAME = 'timeline-firstframe';\r\n\r\n // factory and engine events\r\n static REQUEST_INSTANCE = 'request-instance';\r\n static REQUEST_ACTION = 'request-action';\r\n static REQUEST_FUNCTION = 'request-function';\r\n static REQUEST_TIMELINE_URI = 'request-timeline-uri';\r\n static BEFORE_REQUEST_TIMELINE_URI = 'before-request-timeline-uri';\r\n static REQUEST_ENGINE_ROOT = 'request-engine-root';\r\n static REQUEST_CURRENT_TIMELINE_POSITION =\r\n 'request-current-timeline-position';\r\n static REQUEST_TIMELINE_CLEANUP = 'request-timeline-cleanup';\r\n\r\n //language manager events\r\n static REQUEST_LABEL_COLLECTION = 'request-label-collection';\r\n static REQUEST_LABEL_COLLECTIONS = 'request-label-collections';\r\n static REQUEST_CURRENT_LANGUAGE = 'request-current-language';\r\n static LANGUAGE_CHANGE = 'language-change';\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ICustomFunctionOperationData {\r\n systemName: string;\r\n}\r\n\r\n/**\r\n * This operation retrieves a custom function defined by the given system name\r\n * and invokes it with the current operation data and eventbus.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const customFunction: TOperation<ICustomFunctionOperationData> =\r\n function (operationData: ICustomFunctionOperationData) {\r\n const { systemName } = operationData;\r\n return new Promise<ICustomFunctionOperationData>((resolve, reject) => {\r\n const resultCallback = (func: Function) => {\r\n const promise = func.apply(this, [operationData]);\r\n if (promise) {\r\n promise.then(() => {\r\n internalResolve(resolve, {}, operationData);\r\n }, reject);\r\n } else {\r\n internalResolve(resolve, {}, operationData);\r\n }\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_FUNCTION, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n });\r\n };\r\n","import { IEndableAction } from '../action/types';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IEndActionOperationData {\r\n actionInstance: IEndableAction;\r\n actionOperationData: any;\r\n}\r\n\r\n/**\r\n * This operation invokes the {@link EndableAction.end} method on the specified action instance.\r\n *\r\n * The action operation data is first merged with the current operation data before it is\r\n * passed on to the action. After the action has completed the action operation data properties\r\n * are removed from the current operation data.\r\n * \r\n * @param operationData\r\n * @returns\r\n */\r\nexport const endAction: TOperation<IEndActionOperationData> = function (\r\n operationData: IEndActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n delete operationData.actionOperationData;\r\n\r\n return new Promise<IEndActionOperationData>((resolve, reject) => {\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n actionInstance.end(operationData).then(() => {\r\n Object.keys(actionOperationData).forEach((key) => {\r\n delete (operationData as any)[key];\r\n });\r\n internalResolve(resolve, operationData);\r\n }, reject);\r\n });\r\n};\r\n","import { TOperation, TOperationData } from './types';\r\n\r\n/**\r\n * This operation checks if the current loop should end or start the next iteration.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const endLoop: TOperation<TOperationData> = function (\r\n operationData: TOperationData\r\n) {\r\n if (\r\n this.loopIndex !== undefined &&\r\n this.loopLength !== undefined &&\r\n this.loopIndex < this.loopLength\r\n ) {\r\n this.loopIndex = this.loopIndex + 1;\r\n this.newIndex = this.loopStartIndex;\r\n delete this.currentItem;\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\n/**\r\n * This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.\r\n * \r\n * @param operationData \r\n * @returns \r\n */\r\nexport const endWhen: TOperation<{}> = function (operationData: {}) {\r\n delete this.whenEvaluation;\r\n return operationData;\r\n};\r\n","import { IController } from '../controllers/types';\r\nimport { TOperation } from './types';\r\n\r\n/**\r\n * This operation extends the specified controller instance with the specified extension.\r\n */\r\nexport interface IExtendControllerOperationData {\r\n controllerInstance: IController<any>;\r\n controllerExtension: any;\r\n}\r\n\r\nexport const extendController: TOperation<IExtendControllerOperationData> =\r\n function (operationData: IExtendControllerOperationData) {\r\n const { controllerInstance, controllerExtension } = operationData;\r\n\r\n operationData.controllerInstance = Object.assign(\r\n controllerInstance,\r\n controllerExtension\r\n );\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IGetAttributesFromElementOperationData {\r\n /**\r\n * The HTML element whose attributes will be retrieved\r\n */\r\n selectedElement?: JQuery;\r\n /**\r\n * The specified attribute names that will be retrieved\r\n */\r\n attributeNames: string[];\r\n /**\r\n * The retrieved attributes\r\n */\r\n attributeValues?: Record<string, any>;\r\n}\r\n\r\n/**\r\n * This operation retrieves the values for the specified attribute names from the given selected element.\r\n */\r\nexport const getAttributesFromElement: TOperation<IGetAttributesFromElementOperationData> =\r\n function (operationData: IGetAttributesFromElementOperationData) {\r\n const { selectedElement, attributeNames } = operationData;\r\n\r\n operationData.attributeValues = attributeNames.reduce((acc, attrName) => {\r\n if (attrName !== 'value') {\r\n acc[attrName] = selectedElement?.attr(attrName);\r\n } else {\r\n acc[attrName] = selectedElement?.val();\r\n }\r\n return acc;\r\n }, {} as Record<string, any>);\r\n\r\n return operationData;\r\n };\r\n","import { IController } from '../controllers/types';\r\nimport { getElementControllers } from './helper/get-element-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetControllerFromElementOperationData {\r\n selectedElement: JQuery;\r\n controllerName: string;\r\n controllerInstance?: IController<any>;\r\n}\r\n\r\n/**\r\n * This operation retrieves the controller instance with the specified name that is assigned to the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getControllerFromElement: TOperation<IGetControllerFromElementOperationData> =\r\n function (operationData: IGetControllerFromElementOperationData) {\r\n const { selectedElement, controllerName } = operationData;\r\n const controllers = getElementControllers(selectedElement);\r\n const controller = controllers.find((ctrl) => {\r\n return ctrl.name === controllerName;\r\n });\r\n\r\n if (!controller) {\r\n console.warn(\r\n `controller for name '${controllerName}' was not found on the given element`\r\n );\r\n }\r\n\r\n operationData.controllerInstance = controller;\r\n return operationData;\r\n };\r\n","import * as controllers from '../controllers';\r\nimport { IController } from '../controllers/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\ntype TSystemName = keyof typeof controllers;\r\nexport interface IGetControllerInstanceOperationData {\r\n systemName: TSystemName;\r\n controllerInstance?: IController<TOperationData>;\r\n}\r\n\r\n/**\r\n * This operation retrieves an instance of the given controller name.\r\n * It assigns this instance to the `controllerInstance` property on the current operation data\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getControllerInstance: TOperation<IGetControllerInstanceOperationData> =\r\n function (operationData: IGetControllerInstanceOperationData) {\r\n const { systemName } = operationData;\r\n\r\n operationData.controllerInstance = undefined;\r\n const resultCallback = (instance: IController<TOperationData>) => {\r\n operationData.controllerInstance = instance;\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_INSTANCE, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n return operationData;\r\n };\r\n","import { modifyDimensions } from './helper/modify-dimensions';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetElementDimensionsOperationData {\r\n selectedElement: JQuery;\r\n modifier?: string;\r\n dimensions?: { width?: number; height?: number };\r\n}\r\n\r\n/**\r\n * This operation calculates the width and height of the given selected element.\r\n * It assigns this struct to the dimensions property on the current operation data.\r\n * Optionally the width and height can be modified using the given modifier string.\r\n *\r\n * The modifier string is formatted in the following way:\r\n *\r\n * <operator><amount><optional-side><optional-precentage>|<ratio-definition>\r\n *\r\n * Where the ratio modifier is formatted in the following way:\r\n * <side>[ar=<ratio-left>-<ratio-right>]\r\n *\r\n * For example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\r\n * it will add a value of 100 to the height and modify the width by a ration of 8 to 1 relative to the height.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getElementDimensions: TOperation<IGetElementDimensionsOperationData> =\r\n function (operationData: IGetElementDimensionsOperationData) {\r\n const { selectedElement, modifier } = operationData;\r\n let dimensions = {\r\n width: selectedElement.innerWidth() ?? 0,\r\n height: selectedElement.innerHeight() ?? 0,\r\n };\r\n if (dimensions.height === 0) {\r\n dimensions.height = dimensions.width;\r\n }\r\n if (modifier) {\r\n dimensions = modifyDimensions(dimensions, modifier);\r\n }\r\n operationData.dimensions = dimensions;\r\n return operationData;\r\n };\r\n","import { IDimensions } from '../../types';\r\n\r\nfunction _modifyDimensionsByRatio(\r\n ratioModifier: string,\r\n dimensions: IDimensions\r\n) {\r\n const modifiedDimensions = { ...dimensions };\r\n //h[ar=8-1]\r\n let prefix = ratioModifier.substring(0, 1);\r\n\r\n let ratio = ratioModifier.substring(\r\n ratioModifier.indexOf('[') + 1,\r\n ratioModifier.indexOf(']') - (ratioModifier.indexOf('[') - 1)\r\n );\r\n\r\n let ratios = ratio.split('=')[1].split('-');\r\n\r\n if (ratios.filter(Boolean).length !== 2) {\r\n throw new Error(`Badly formatted modifier, expect two ratios: ${ratio}`);\r\n }\r\n\r\n if (prefix === 'h') {\r\n modifiedDimensions.height =\r\n (modifiedDimensions.width / +ratios[0]) * +ratios[1];\r\n } else if (prefix === 'w') {\r\n modifiedDimensions.width =\r\n (modifiedDimensions.height / +ratios[1]) * +ratios[0];\r\n }\r\n\r\n return modifiedDimensions;\r\n}\r\n\r\nfunction _getModifierSuffix(\r\n modifier: string //*100h%\r\n): [string | null, number, boolean] {\r\n let endIdx = 1;\r\n let suffix: string | null = modifier.substring(\r\n modifier.length - endIdx,\r\n modifier.length\r\n );\r\n\r\n if (suffix !== 'h' && suffix !== 'w' && suffix !== '%') {\r\n suffix = null;\r\n }\r\n\r\n const isPercent = suffix === '%';\r\n\r\n if (isPercent) {\r\n suffix = modifier.substring(\r\n modifier.length - endIdx,\r\n modifier.length - (endIdx + 1)\r\n );\r\n\r\n if (suffix !== 'h' && suffix !== 'w') {\r\n suffix = null;\r\n }\r\n }\r\n\r\n return [suffix, endIdx, isPercent];\r\n}\r\n\r\nfunction _modifyDimensions(\r\n dimensions: IDimensions,\r\n prefix: string,\r\n suffix: string | null,\r\n widthModifier: number,\r\n heightModifier: number\r\n) {\r\n const modifiedDimension = { ...dimensions };\r\n switch (prefix) {\r\n case '+':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height += heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width += widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height += heightModifier;\r\n modifiedDimension.width += widthModifier;\r\n }\r\n break;\r\n case '-':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height -= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width -= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height -= heightModifier;\r\n modifiedDimension.width -= widthModifier;\r\n }\r\n break;\r\n case '/':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height /= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width /= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height /= heightModifier;\r\n modifiedDimension.width /= widthModifier;\r\n }\r\n break;\r\n case '*':\r\n switch (suffix) {\r\n case 'h':\r\n modifiedDimension.height *= heightModifier;\r\n break;\r\n case 'w':\r\n modifiedDimension.width *= widthModifier;\r\n break;\r\n default:\r\n modifiedDimension.height *= heightModifier;\r\n modifiedDimension.width *= widthModifier;\r\n }\r\n break;\r\n default:\r\n console.error(`Unknown operator found: ${prefix}`);\r\n }\r\n return modifiedDimension;\r\n}\r\n\r\n/**\r\n * Modifies the given dimensions using the given modifier string.\r\n * The modifier string is formatted in the following way:\r\n *\r\n * <operator><amount><optional-side><optional-precentage>|<ratio-definition>\r\n *\r\n * Where the ratio modifier is formatted in the following way:\r\n * <side>[ar=<ratio-left>-<ratio-right>]\r\n *\r\n * For example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\r\n * it will add a value of 100 to the height and modify the width by a ration of 8 to 1 relative to the height.\r\n *\r\n * @param dimensions\r\n * @param modifier\r\n */\r\nexport function modifyDimensions(dimensions: IDimensions, modifier: string) {\r\n const clonedDimensions = { ...dimensions };\r\n let ratioModifier: string | null = null;\r\n if (modifier.indexOf('|') > -1) {\r\n [modifier, ratioModifier] = modifier.split('|');\r\n }\r\n\r\n const prefix = modifier.substring(0, 1);\r\n let [suffix, endIdx, isPercent] = _getModifierSuffix(modifier);\r\n\r\n const value = parseInt(\r\n suffix !== null\r\n ? modifier.substring(1, modifier.length - (endIdx - 1))\r\n : modifier.substring(1),\r\n 10\r\n );\r\n\r\n let widthModifier = value;\r\n let heightModifier = value;\r\n if (isPercent) {\r\n widthModifier = (clonedDimensions.width / 100) * value;\r\n heightModifier = (clonedDimensions.height / 100) * value;\r\n }\r\n\r\n const modifiedDimension = _modifyDimensions(\r\n clonedDimensions,\r\n prefix,\r\n suffix,\r\n widthModifier,\r\n heightModifier\r\n );\r\n\r\n if (ratioModifier) {\r\n return _modifyDimensionsByRatio(ratioModifier, modifiedDimension);\r\n }\r\n\r\n return modifiedDimension;\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IGetImportOperationData {\r\n systemName: string;\r\n importedInstance?: any;\r\n}\r\n\r\n/**\r\n * This operation retrieves the import specified by the given system name and\r\n * assigns it to the importedInstance property on the current operaton date.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getImport: TOperation<IGetImportOperationData> = function (\r\n operationData: IGetImportOperationData\r\n) {\r\n const { systemName } = operationData;\r\n const callBack = (instance: any) => {\r\n operationData.importedInstance = instance;\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_FUNCTION, [\r\n systemName,\r\n callBack,\r\n ]);\r\n delete (operationData as any).systemName;\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IGetQueryParamsOperationData {\r\n /**\r\n * The query params will be added as property/values to this object.\r\n * So, the query string `?foo=bar&bar=foo` will result in:\r\n * ```json\r\n * {\r\n * foo: \"bar\",\r\n * bar: \"foo\"\r\n * }\r\n * ```\r\n * This object will be assigned to the `queryParams` property.\r\n */\r\n queryParams?: Record<string, string>;\r\n /**\r\n * The properties on this object will be assigned to the queryParams result\r\n * when the given property name is not part of the query string.\r\n */\r\n defaultValues?: Record<string, string>;\r\n}\r\n\r\n/**\r\n * This operation retrieves the current query parameters from the browser's address bar and places\r\n * them on the returned operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const getQueryParams: TOperation<IGetQueryParamsOperationData> =\r\n function (operationData: IGetQueryParamsOperationData) {\r\n const searchParams = new URLSearchParams(window.location.search);\r\n const queryParams = Object.fromEntries(searchParams.entries());\r\n\r\n const { defaultValues = {} } = operationData;\r\n delete (operationData as any).defaultValues;\r\n\r\n operationData.queryParams = {\r\n ...defaultValues,\r\n ...queryParams,\r\n };\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IInvokeObjectMethodOperationData {\r\n /**\r\n * The given object instance\r\n * \r\n */\r\n instance: any;\r\n /**\r\n * The method name on the given object that will be invoked\r\n */\r\n methodName: string;\r\n /**\r\n * Arguments that will be passed to the specified method\r\n */\r\n methodArguments?: any[];\r\n /**\r\n * If any, the results of the method invocation are assigned to the property\r\n */\r\n methodResult?: any;\r\n}\r\n\r\n/**\r\n * This operation invokes the specified method on the given object with the given optional arguments\r\n * and assigns the result to the `methodResult` operationdata property.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const invokeObjectMethod: TOperation<IInvokeObjectMethodOperationData> =\r\n function (operationData: IInvokeObjectMethodOperationData) {\r\n const { methodName, methodArguments } = operationData;\r\n delete (operationData as any).methodName;\r\n delete (operationData as any).methodArguments;\r\n\r\n operationData.methodResult = (operationData.instance as any)[\r\n methodName\r\n ].apply(operationData.instance, methodArguments ?? []);\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nconst jsonCache: Record<string, any> = {};\r\n\r\nexport interface ILoadJSONOperationData {\r\n /**\r\n * The URL where the JSON will be retrieved from\r\n */\r\n url: string;\r\n /**\r\n * If true, the results will be added to the cache and any subsequent call will use this cache\r\n */\r\n cache: boolean;\r\n /**\r\n * The JSON retrieved from the given URL\r\n */\r\n json?: any;\r\n}\r\n\r\nexport const clearCache = () => {\r\n for (let p in jsonCache) {\r\n delete jsonCache[p];\r\n }\r\n};\r\n\r\nexport const addToCache = (key: string, value: any) => {\r\n jsonCache[key] = value;\r\n};\r\n\r\n/**\r\n * This operation loads a JSON file from the specified url and assigns it to the json\r\n * property on the current operation data.\r\n *\r\n * If the cache property is set to true and a cached value already exists, this is assigned\r\n * instead of re-retrieving it from the url.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const loadJSON: TOperation<ILoadJSONOperationData> = async function (\r\n operationData: ILoadJSONOperationData\r\n) {\r\n const { url, cache } = operationData;\r\n\r\n if (cache && jsonCache[url]) {\r\n operationData.json = jsonCache[url];\r\n return operationData;\r\n }\r\n\r\n const response = await fetch(url);\r\n const json = await response.json();\r\n const cacheValue = (operationData.json = json);\r\n\r\n if (cache) {\r\n addToCache(url, cacheValue);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { getGlobals } from './helper/globals';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\n/**\r\n * This operation logs the current operation data, global data and context to the console.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const log: TOperation<TOperationData> = function (\r\n operationData: TOperationData\r\n) {\r\n const globalData = getGlobals();\r\n\r\n console.group('Operation info');\r\n console.log('context', this);\r\n console.log('operationData', operationData);\r\n console.log('globalData', globalData);\r\n console.groupEnd();\r\n return operationData;\r\n};\r\n","import { isFunction } from '../util/guards/is-function';\r\nimport { isString } from '../util/guards/is-string';\r\nimport { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IMathOperationData {\r\n args: (number | string | keyof Math)[];\r\n functionName: keyof Math;\r\n mathResult?: number;\r\n}\r\n\r\n/**\r\n * This operation performs the given math function with the specified arguments.\r\n *\r\n * @param operationData\r\n */\r\nexport const math: TOperation<IMathOperationData> = function (\r\n operationData: IMathOperationData\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n operationData.args = resolveMathConstants(operationData.args);\r\n\r\n const { args, functionName } = operationData;\r\n\r\n operationData.mathResult = (Math[functionName] as Function).apply(null, args);\r\n\r\n return operationData;\r\n};\r\n\r\nfunction resolveMathConstants(args: any[]) {\r\n return args.map((arg: any) => {\r\n if (isMathProperty(arg)) {\r\n return Math[arg];\r\n }\r\n return arg;\r\n });\r\n}\r\n\r\nfunction isMathProperty(value: string | Symbol): value is keyof Math {\r\n return (\r\n isString(value) && value in Math && !isFunction(Math[value as keyof Math])\r\n );\r\n}\r\n","import { IResolvedOperation } from '../../configuration/types';\r\n\r\n/**\r\n * This function can be used to find the index of a matching operation within a list of operations.\r\n * \r\n * Given the array of operations:\r\n * ```ts\r\n * [\r\n * {systemName:'name1'}, // index 0\r\n * {systemName:'startLoop'}, // index 1\r\n * {systemName:'name2'}, // index 2\r\n * {systemName:'startLoop'} // index 3\r\n * {systemName:'name3'} // index 4\r\n * {systemName:'endLoop'} // index 5\r\n * {systemName:'endLoop'} // index 6\r\n * {systemName:'name3'} // index 7\r\n * ]\r\n * ```\r\n * \r\n * Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.\r\n * \r\n * Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.\r\n * \r\n * If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.\r\n * \r\n * If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.\r\n *\r\n * @param this\r\n * @param operation\r\n * @returns\r\n */\r\nexport function findMatchingOperationIndex(\r\n this: { counter: number; self: string; matchingName: string },\r\n operation: IResolvedOperation\r\n) {\r\n if (operation.systemName === this.self) {\r\n this.counter = this.counter + 1;\r\n return false;\r\n }\r\n\r\n if (operation.systemName === this.matchingName && this.counter === 0) {\r\n return true;\r\n }\r\n\r\n if (operation.systemName === this.matchingName && this.counter > 0) {\r\n this.counter = this.counter - 1;\r\n }\r\n\r\n return false;\r\n}\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\n/**\r\n * If the preceeding {@link when} operation evaluates to `true` subsequent operations will\r\n * be skipped until an {@link endWhen} operation is encountered.\r\n * \r\n * @param operationData \r\n * @returns \r\n */\r\nexport const otherwise: TOperation<{}> = function (operationData: {}) {\r\n if (this.whenEvaluation) {\r\n this.newIndex = findEndWhenIndex(this);\r\n }\r\n return operationData;\r\n};\r\n\r\nfunction findEndWhenIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const endWhenIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'endWhen',\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemoveClassOperationData {\r\n selectedElement: JQuery;\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation removes the spcified class name from the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeClass: TOperation<IRemoveClassOperationData> = function (\r\n operationData: IRemoveClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.removeClass(className);\r\n return operationData;\r\n};\r\n","import { IController } from '../controllers/types';\r\nimport { getElementControllers } from './helper/get-element-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IRemoveControllerFromElementOperationData {\r\n selectedElement: JQuery;\r\n controllerName: string;\r\n}\r\n\r\n/**\r\n * This operation removes the controller with the specified name from the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeControllerFromElement: TOperation<IRemoveControllerFromElementOperationData> =\r\n function (operationData: IRemoveControllerFromElementOperationData) {\r\n const { selectedElement, controllerName } = operationData;\r\n\r\n const controllers = getElementControllers(selectedElement);\r\n const controller = controllers?.find(\r\n (ctrl: IController<any>) => ctrl.name === controllerName\r\n );\r\n\r\n if (controller) {\r\n const idx = controllers.indexOf(controller);\r\n controllers.splice(idx, 1);\r\n controller.detach(this.eventbus);\r\n }\r\n\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemoveElementOperationData {\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation removes the given selected element from the DOM.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removeElement: TOperation<IRemoveElementOperationData> = function (\r\n operationData: IRemoveElementOperationData\r\n) {\r\n const { selectedElement } = operationData;\r\n selectedElement.remove();\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IRemovePropertiesFromOperationDataOperationData {\r\n propertyNames: string[];\r\n}\r\n\r\n/**\r\n * This operation removes the given list of properties from the current operation data.\r\n * It will also omit the property 'propertyNames' from the result.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const removePropertiesFromOperationData: TOperation<IRemovePropertiesFromOperationDataOperationData> =\r\n function (operationData: IRemovePropertiesFromOperationDataOperationData) {\r\n const { propertyNames } = operationData;\r\n if (propertyNames.indexOf('propertyNames') < 0) {\r\n propertyNames.push('propertyNames');\r\n }\r\n\r\n return Object.fromEntries(\r\n Object.entries(operationData).filter(\r\n ([name, _value]) => !propertyNames.includes(name)\r\n )\r\n ) as any;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface IReparentElementOperationData {\r\n selectedElement: JQuery;\r\n newParentSelector: string;\r\n}\r\n\r\n/**\r\n * This operation moves the given selected element to the new parent that is defined\r\n * by the specified `newParentSelector`.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const reparentElement: TOperation<IReparentElementOperationData> =\r\n function (operationData: IReparentElementOperationData) {\r\n const { selectedElement, newParentSelector } = operationData;\r\n selectedElement.remove().appendTo(newParentSelector);\r\n return operationData;\r\n };\r\n","import { IAction } from '../action/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IRequestActionOperationData {\r\n systemName: string;\r\n actionInstance?: IAction;\r\n}\r\n\r\n/**\r\n * This operation requests an action instance with the specified name and assigns it\r\n * to the `actionInstance` property on the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const requestAction: TOperation<IRequestActionOperationData> = function (\r\n operationData: IRequestActionOperationData\r\n) {\r\n const { systemName } = operationData;\r\n\r\n const resultCallback = (action: IAction) => {\r\n operationData.actionInstance = action;\r\n };\r\n\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_ACTION, [\r\n systemName,\r\n resultCallback,\r\n ]);\r\n return operationData;\r\n};\r\n","import { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IResizeActionOperationData {\r\n actionInstance: any;\r\n actionOperationData: any;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const resizeAction: TOperation<IResizeActionOperationData> = function (\r\n operationData: IResizeActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n if (actionInstance.resize) {\r\n return actionInstance.resize(operationData);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { resolveExternalPropertyChain } from './helper/resolve-external-property-chain';\r\nimport { TOperation } from './types';\r\n\r\nfunction findElementBySelector(root: JQuery, selector: string) {\r\n const element = root.find(selector);\r\n if (!element.length) {\r\n console.warn(`selector '${selector}' wasn't found!`);\r\n }\r\n return element;\r\n}\r\n\r\nexport interface ISelectElementOperationData {\r\n selector: string;\r\n useSelectedElementAsRoot?: boolean;\r\n selectedElement?: JQuery;\r\n}\r\n\r\n/**\r\n * This operation selects one or more elements using the specified selector.\r\n *\r\n * If `useSelectedElementAsRoot` is set to true and a valid DOM element is assigned\r\n * to the current operation data's `selectedElement` property\r\n * then the element will be looked for only in the descendant elements of this DOM element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const selectElement: TOperation<ISelectElementOperationData> = function (\r\n operationData: ISelectElementOperationData\r\n) {\r\n operationData.selector = resolveExternalPropertyChain(\r\n operationData,\r\n this,\r\n operationData.selector\r\n );\r\n const { selector, useSelectedElementAsRoot = false } = operationData;\r\n\r\n if (!selector) {\r\n throw new Error('selectElement: selector is either empty or not defined.');\r\n }\r\n\r\n if (useSelectedElementAsRoot && operationData.selectedElement) {\r\n const currentRoot = operationData.selectedElement;\r\n operationData.selectedElement = findElementBySelector(\r\n currentRoot,\r\n selector\r\n );\r\n return operationData;\r\n }\r\n\r\n const rootCallback = (root: JQuery) => {\r\n operationData.selectedElement = findElementBySelector(root, selector);\r\n };\r\n this.eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [\r\n rootCallback,\r\n ]);\r\n\r\n return operationData;\r\n};\r\n","import { getPropertyChainValue } from './helper/get-property-chain-value';\r\nimport { getGlobals, TGlobalCache } from './helper/globals';\r\nimport { resolveExternalPropertyChain } from './helper/resolve-external-property-chain';\r\nimport { IOperationContext, TOperation, TOperationData } from './types';\r\n\r\nexport type TDataTarget =\r\n | `context.${string}`\r\n | `operationdata.${string}`\r\n | `globaldata.${string}`;\r\n\r\nexport interface ISetDataOperationData {\r\n properties: Record<TDataTarget, any>;\r\n}\r\n\r\n/**\r\n * This operation assigns the specified properties to the specified data targets.\r\n *\r\n * @example The various ways of assigning data\r\n * ```ts\r\n * setData({\r\n * 'operationdata.foo': 'context.currentItem', // context.currentItem will be assigned to operationdata.foo\r\n * 'globaldata.foo': 'context.currentItem', // context.currentItem will be assigned to globaldata.foo\r\n * 'context.newIndex': 100, // The constant 100 will be assigned to context.newIndex\r\n * })\r\n * ```\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setData: TOperation<ISetDataOperationData> = function (\r\n operationData: ISetDataOperationData\r\n) {\r\n const { properties } = operationData;\r\n delete (operationData as any).properties;\r\n\r\n resolveTargets(properties, operationData, this);\r\n\r\n return operationData;\r\n};\r\n\r\nfunction resolveTargets(\r\n data: Record<TDataTarget, any>,\r\n operationData: Record<string, any>,\r\n context: IOperationContext\r\n) {\r\n const propertyChains = Object.keys(data);\r\n\r\n return propertyChains.forEach((item) => {\r\n const path = item.split('.');\r\n const rootTarget = path.shift()?.toLowerCase() ?? '';\r\n if (!isDataTarget(rootTarget)) {\r\n throw new Error(\r\n `Unrecognized target: ${rootTarget}, known targets are: ${knownTargets.join(\r\n ', '\r\n )}`\r\n );\r\n }\r\n const property = path.pop() ?? '';\r\n const propertyValue = resolveExternalPropertyChain(\r\n operationData,\r\n context,\r\n (data as any)[item]\r\n );\r\n\r\n const targets: {\r\n context: IOperationContext;\r\n operationdata: TOperationData;\r\n globaldata: TGlobalCache;\r\n } = {\r\n context: context,\r\n operationdata: operationData,\r\n globaldata: getGlobals(),\r\n };\r\n\r\n const propertyTarget = getPropertyChainValue(\r\n path,\r\n (targets as any)[rootTarget]\r\n );\r\n\r\n propertyTarget[property] = propertyValue;\r\n });\r\n}\r\n\r\nconst knownTargets = ['context', 'operationdata', 'globaldata'];\r\nfunction isDataTarget(value: string): value is TDataTarget {\r\n return knownTargets.includes(value);\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface ISetElementAttributesOperationData {\r\n attributes: Record<string, any>;\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation sets the specified set of attributes on the given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setElementAttributes: TOperation<ISetElementAttributesOperationData> =\r\n function (operationData: ISetElementAttributesOperationData) {\r\n const { attributes, selectedElement } = operationData;\r\n selectedElement.attr(attributes);\r\n return operationData;\r\n };\r\n","import { TOperation } from './types';\r\n\r\nexport interface ISetElementContentOperationData {\r\n selectedElement: JQuery;\r\n template: string | JQuery.Node;\r\n insertionType: 'overwrite' | 'append' | 'prepend';\r\n}\r\n\r\n/**\r\n * This operation sets the specified content defined by the value assigned to the template property\r\n * to the given selected element.\r\n *\r\n * When the `insertionType` is set to `overwrite` the contents of the selected element are replaced\r\n * by the given template.\r\n * When set to `append` the new content will be inserted after the current content.\r\n * When set to `prepend` the new content will be inserted before the current content.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setElementContent: TOperation<ISetElementContentOperationData> =\r\n function (operationData: ISetElementContentOperationData) {\r\n const {\r\n insertionType = 'overwrite',\r\n selectedElement,\r\n template,\r\n } = operationData;\r\n\r\n switch (true) {\r\n case insertionType === 'overwrite':\r\n selectedElement.html(template);\r\n break;\r\n case insertionType === 'append':\r\n selectedElement.append(template);\r\n break;\r\n case insertionType === 'prepend':\r\n selectedElement.prepend(template);\r\n break;\r\n }\r\n\r\n delete (operationData as any).insertionType;\r\n\r\n return operationData;\r\n };\r\n","import { setGlobals } from './helper/globals';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetGlobalDataOperationData {\r\n properties: string[];\r\n}\r\n\r\n/**\r\n * This operation copies the specified property values from the operationData to the global data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setGlobalData: TOperation<ISetGlobalDataOperationData> = function (\r\n operationData: ISetGlobalDataOperationData\r\n) {\r\n const { properties } = operationData;\r\n const newGlobals = Object.fromEntries(\r\n Object.entries(operationData).filter(([name, _value]) =>\r\n properties.includes(name)\r\n )\r\n );\r\n\r\n setGlobals(newGlobals);\r\n\r\n delete (operationData as any).properties;\r\n\r\n return operationData;\r\n};\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetOperationData {\r\n override?: boolean;\r\n properties: Record<string, any>;\r\n}\r\n\r\n/**\r\n * This operation assigns the specified properties to the current operation data.\r\n * When override is set to true the properties replace the current operation data entirely.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setOperationData: TOperation<ISetOperationData> = function (\r\n operationData: ISetOperationData\r\n) {\r\n const { override = false, properties } = operationData;\r\n delete (operationData as any).properties;\r\n delete operationData.override;\r\n\r\n const resolvedProperties = resolvePropertyValues(\r\n operationData,\r\n this,\r\n properties\r\n );\r\n\r\n if (override) {\r\n return resolvedProperties;\r\n }\r\n\r\n return {\r\n ...operationData,\r\n ...resolvedProperties,\r\n };\r\n};\r\n","import { resolvePropertyValues } from './helper/resolve-property-values';\r\nimport { TOperation } from './types';\r\n\r\nexport interface ISetStyleOperationData {\r\n properties: Record<string, any>;\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation assigns the specified CSS style properties to the\r\n * given selected element.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const setStyle: TOperation<ISetStyleOperationData> = function (\r\n operationData: ISetStyleOperationData\r\n) {\r\n const properties = resolvePropertyValues(\r\n operationData,\r\n this,\r\n operationData.properties\r\n );\r\n operationData.selectedElement.css(properties as JQuery.PlainObject);\r\n\r\n return operationData;\r\n};\r\n","import { IAction } from '../action/types';\r\nimport { internalResolve } from './helper/internal-resolve';\r\nimport { mergeOperationData } from './helper/merge-operation-data';\r\nimport { TOperation, TOperationData } from './types';\r\n\r\nexport interface IStartActionOperationData {\r\n actionInstance: IAction;\r\n actionOperationData: TOperationData;\r\n}\r\n\r\n/**\r\n * This operation starts the specified action instance using the given action operation data.\r\n *\r\n * The action operation data is first merged with the current operation data before it is\r\n * passed on to the action. After the action has completed the action operation data properties\r\n * are removed from the current operation data.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const startAction: TOperation<IStartActionOperationData> = function (\r\n operationData: IStartActionOperationData\r\n) {\r\n const { actionInstance, actionOperationData } = operationData;\r\n delete (operationData as any).actionOperationData;\r\n\r\n return new Promise((resolve, reject) => {\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n actionInstance.start(operationData).then(() => {\r\n Object.keys(actionOperationData).forEach((key) => {\r\n delete (operationData as any)[key];\r\n });\r\n internalResolve(resolve, operationData);\r\n }, reject);\r\n });\r\n};\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\nexport interface IStartLoopOperationData {\r\n collection: any[] | string;\r\n}\r\n\r\n/**\r\n * This operation starts a loop using the given collection.\r\n *\r\n * Each iteration the current item from the specified collection is\r\n * assigned to the {@link IOperationContext.currentItem} property on the operation context.\r\n *\r\n * At the start of the loop, the associated {@link endLoop} operation is determined and when\r\n * the last iteration is completed the flow control is set to the index of that operation.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const startLoop: TOperation<IStartLoopOperationData> = function (\r\n operationData: IStartLoopOperationData\r\n) {\r\n const { collection } = operationData;\r\n\r\n if (collection !== null && !Array.isArray(collection)) {\r\n throw new Error(\r\n 'Expected collection to be array type, string value was probably not resolved correctly'\r\n );\r\n }\r\n\r\n // First iteration of the loop\r\n if (this.loopIndex === undefined) {\r\n this.loopEndIndex = findLoopEndIndex(this);\r\n if (collection?.length) {\r\n this.loopIndex = 0;\r\n this.loopLength = collection.length - 1;\r\n this.loopStartIndex = this.currentIndex;\r\n } else {\r\n this.newIndex = this.loopEndIndex;\r\n\r\n delete this.loopIndex;\r\n delete this.loopLength;\r\n delete this.loopStartIndex;\r\n delete this.loopEndIndex;\r\n }\r\n }\r\n\r\n if (collection?.length && this.loopIndex !== undefined) {\r\n this.currentItem = collection[this.loopIndex];\r\n }\r\n\r\n return operationData;\r\n};\r\n\r\nfunction findLoopEndIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const index = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'startLoop',\r\n matchingName: 'endLoop',\r\n })\r\n );\r\n const endLoopIndex =\r\n index > -1 ? index + currentIndex : context.operations.length;\r\n\r\n return endLoopIndex;\r\n}\r\n","import { TOperation } from './types';\r\n\r\nexport interface IToggleClassOperationData {\r\n /**\r\n * The element on which the class will be toggled\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * The class that will be toggled\r\n */\r\n className: string;\r\n}\r\n\r\n/**\r\n * This operation toggles the specfied class name on the given selected element.\r\n * \r\n * Meaning, if the specified class name exists on the given element it will be removed,\r\n * otherwise it will be added.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const toggleClass: TOperation<IToggleClassOperationData> = function (\r\n operationData: IToggleClassOperationData\r\n) {\r\n const { selectedElement, className } = operationData;\r\n selectedElement.toggleClass(className);\r\n return operationData;\r\n};\r\n","import { TOperation } from './types';\r\n\r\nexport interface IToggleElementOperationData {\r\n /**\r\n * The element whose visibility will be toggled\r\n */\r\n selectedElement: JQuery;\r\n}\r\n\r\n/**\r\n * This operation toggles the visibility of the given selected element.\r\n * \r\n * Meaning, if the element is hidden, it will be made visible, otherwise\r\n * it will be hidden.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const toggleElement: TOperation<IToggleElementOperationData> =\r\n function toggleElement(operationData: IToggleElementOperationData) {\r\n operationData.selectedElement.toggle();\r\n return operationData;\r\n };\r\n","import { internalResolve } from './helper/internal-resolve';\r\nimport { TOperation } from './types';\r\n\r\nexport interface IWaitOperationData {\r\n /**\r\n * The amount of milliseconds the operation will wait for.\r\n */\r\n milliseconds: number;\r\n}\r\n\r\n/**\r\n * This operation waits for the specified amount of milliseconds.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const wait: TOperation<IWaitOperationData> = function (\r\n operationData: IWaitOperationData\r\n) {\r\n const { milliseconds } = operationData;\r\n\r\n return new Promise((resolve) => {\r\n setTimeout(() => {\r\n internalResolve(resolve, operationData);\r\n }, milliseconds);\r\n });\r\n};\r\n","import { findMatchingOperationIndex } from './helper/find-matching-operation-index';\r\nimport { resolveExternalPropertyChain } from './helper/resolve-external-property-chain';\r\nimport { IOperationContext, TOperation } from './types';\r\n\r\ntype TOperator = '!=' | '==' | '>=' | '<=' | '>' | '<';\r\ntype TValue =\r\n | `'${string}'`\r\n | number\r\n | `operationdata.${string}`\r\n | `globaldata.${string}`\r\n | `context.${string}`;\r\n\r\ntype TExpression = `${TValue}${TOperator}${TValue}`;\r\n\r\nexport interface IWhenOperationData {\r\n expression: TExpression;\r\n}\r\n\r\n/**\r\n * When the given expression evaluates to false, subsequent operations will be skipped\r\n * until an {@link endWhen} or {@link otherwise} operation is encountered.\r\n * \r\n * Practically, this means an `if` or `if`/`else` statement control flow implementation in a list of operations.\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\nexport const when: TOperation<IWhenOperationData> = function (\r\n operationData: IWhenOperationData\r\n) {\r\n const [left, operator, right] = parseExpression(\r\n operationData.expression,\r\n operationData,\r\n this\r\n );\r\n\r\n this.whenEvaluation = evaluations[operator](left, right);\r\n\r\n if (!this.whenEvaluation) {\r\n this.newIndex = findNextFlowControlIndex(this);\r\n }\r\n\r\n delete (operationData as any).expression;\r\n\r\n return operationData;\r\n};\r\n\r\nfunction parseExpression(\r\n expression: TExpression,\r\n operationData: IWhenOperationData,\r\n operationContext: IOperationContext\r\n): [TValue, TOperator, TValue] {\r\n let [left, right] = expression.split(/!=|==|>=|<=|>|</);\r\n const operator = expression.substring(\r\n left.length,\r\n expression.length - right.length\r\n ) as TOperator;\r\n const leftNr = +left;\r\n const rightNr = +right;\r\n return [\r\n (isNaN(leftNr)\r\n ? resolveExternalPropertyChain(operationData, operationContext, left)\r\n : leftNr) as TValue,\r\n operator,\r\n (isNaN(rightNr)\r\n ? resolveExternalPropertyChain(operationData, operationContext, right)\r\n : rightNr) as TValue,\r\n ];\r\n}\r\n\r\nconst evaluations: Record<\r\n TOperator,\r\n (left: string | number, right: string | number) => boolean\r\n> = {\r\n '==': (left: string | number, right: string | number) => left === right,\r\n '!=': (left: string | number, right: string | number) => left !== right,\r\n '>=': (left: string | number, right: string | number) => left >= right,\r\n '<=': (left: string | number, right: string | number) => left <= right,\r\n '>': (left: string | number, right: string | number) => left > right,\r\n '<': (left: string | number, right: string | number) => left < right,\r\n};\r\n\r\nfunction findNextFlowControlIndex(context: IOperationContext) {\r\n const currentIndex = context.currentIndex + 1;\r\n const list = context.operations.slice(currentIndex);\r\n\r\n const otherWiseIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'otherwise',\r\n })\r\n );\r\n if (otherWiseIndex > -1) {\r\n return otherWiseIndex + currentIndex;\r\n }\r\n\r\n const endWhenIndex = list.findIndex(\r\n findMatchingOperationIndex.bind({\r\n counter: 0,\r\n self: 'when',\r\n matchingName: 'endWhen',\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport * as operations from '../../operation';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { TOperation, TOperationData } from '../../operation/types';\r\nimport {\r\n ExtractDataType,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n ITimelineActionConfiguration,\r\n} from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\nexport class ActionCreatorFactory {\r\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\r\n\r\n createAction(name: string): EndableActionCreator {\r\n const creator = new EndableActionCreator(name, this);\r\n this.configurationfactory.addAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createInitAction(name: string): EndableActionCreator {\r\n const creator = new EndableActionCreator(name, this);\r\n this.configurationfactory.addInitAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createEventAction(name: string): ActionCreator {\r\n const creator = new ActionCreator(name, this);\r\n this.configurationfactory.addEventAction(creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n createTimelineAction(uri: string, name: string): TimelineActionCreator {\r\n const creator = new TimelineActionCreator(name, this);\r\n this.configurationfactory.addTimelineAction(uri, creator.actionConfig);\r\n return creator;\r\n }\r\n\r\n end() {\r\n return this.configurationfactory;\r\n }\r\n}\r\n\r\nexport class ActionCreator<\r\n T extends IActionConfiguration = IActionConfiguration\r\n> {\r\n actionConfig: T;\r\n\r\n constructor(\r\n name: string | undefined,\r\n private readonly factory: ActionCreatorFactory\r\n ) {\r\n this.actionConfig = {\r\n name: '',\r\n id: uuidv4(),\r\n startOperations: [],\r\n } as any;\r\n if (name?.length) {\r\n this.actionConfig.name = name;\r\n }\r\n }\r\n\r\n getId() {\r\n return this.actionConfig.id;\r\n }\r\n\r\n setName(name: string) {\r\n this.actionConfig.name = name;\r\n return this;\r\n }\r\n\r\n getConfiguration(callBack: (config: T) => T) {\r\n const copy = deepCopy(this.actionConfig);\r\n const newConfig = callBack.call(this, copy);\r\n if (newConfig) {\r\n this.actionConfig = newConfig;\r\n }\r\n return this;\r\n }\r\n\r\n addStartOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ) {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addStartOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addStartOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as Record<string, any>)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const { startOperations } = this.actionConfig;\r\n startOperations.push({\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n });\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.factory;\r\n }\r\n}\r\n\r\nexport class EndableActionCreator<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration\r\n> extends ActionCreator<T> {\r\n constructor(name: string | undefined, factory: ActionCreatorFactory) {\r\n super(name, factory);\r\n this.actionConfig.endOperations = [];\r\n }\r\n\r\n addEndOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ) {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addEndOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addEndOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as Record<string, any>)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n let { endOperations } = this.actionConfig;\r\n if (!endOperations) {\r\n endOperations = this.actionConfig.endOperations = [];\r\n }\r\n endOperations.push({\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n });\r\n return this;\r\n }\r\n}\r\n\r\nexport class TimelineActionCreator extends EndableActionCreator<\r\n ITimelineActionConfiguration\r\n> {\r\n addDuration(start: number, end?: number) {\r\n this.actionConfig.duration = {\r\n start: start,\r\n };\r\n if (end) {\r\n this.actionConfig.duration.end = end;\r\n }\r\n return this;\r\n }\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport * as operations from '../../operation';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { TOperation, TOperationData } from '../../operation/types';\r\nimport { IDuration } from '../../types';\r\nimport {\r\n ExtractDataType,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IOperationConfiguration,\r\n ITimelineActionConfiguration,\r\n} from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\ntype TOperationName = keyof typeof operations;\r\n\r\nfunction array_move(arr: any[], old_index: number, new_index: number) {\r\n if (new_index >= arr.length) {\r\n new_index = 0;\r\n } else if (new_index < 0) {\r\n new_index = arr.length - 1;\r\n }\r\n arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\r\n}\r\n\r\nexport class ActionEditor<\r\n T extends IActionConfiguration = IActionConfiguration\r\n> {\r\n constructor(\r\n protected actionConfig: T,\r\n protected readonly configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n updateConfiguration() {\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n };\r\n }\r\n\r\n getConfiguration(callBack: (config: T) => T | undefined) {\r\n const copy = deepCopy(this.actionConfig);\r\n const newConfig = callBack.call(this, copy);\r\n if (newConfig) {\r\n this.actionConfig = newConfig;\r\n }\r\n return this;\r\n }\r\n\r\n setName(name: string) {\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n name,\r\n };\r\n return this;\r\n }\r\n\r\n getName() {\r\n return this.actionConfig.name;\r\n }\r\n\r\n addStartOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ): OperationEditor<this> {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addStartOperation(\r\n entries[0] as TOperationName,\r\n operationData\r\n );\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addStartOperation(\r\n systemName: TOperationName,\r\n operationData: TOperationData,\r\n id?: string\r\n ): OperationEditor<this> {\r\n if (!(operations as any)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n\r\n const newConfig = {\r\n id: id ?? uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n };\r\n\r\n startOperations.push(newConfig);\r\n\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n\r\n return new OperationEditor<this>(newConfig, this);\r\n }\r\n\r\n editStartOperation(id: string) {\r\n const { startOperations } = this.actionConfig;\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (isDefined(operation)) {\r\n return new OperationEditor<ActionEditor<T>>(operation, this);\r\n }\r\n\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n removeStartOperation(id: string) {\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (!operation) {\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n const idx = startOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n startOperations.splice(idx, 1);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n moveStartOperation(id: string, direction: 'up' | 'down') {\r\n const startOperations = this.actionConfig.startOperations\r\n ? this.actionConfig.startOperations.slice()\r\n : [];\r\n const operation = startOperations.find(o => o.id === id);\r\n\r\n if (!operation) {\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n const idx = startOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\r\n array_move(startOperations, idx, newIdx);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n startOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\nexport class EndableActionEditor<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration\r\n> extends ActionEditor<T> {\r\n addEndOperationByType<T extends TOperation<any>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractDataType<T>>\r\n ): OperationEditor<this> {\r\n const entries = Object.entries(operations).find(\r\n ([, value]) => value === operationClass\r\n );\r\n\r\n if (entries) {\r\n return this.addEndOperation(entries[0], operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n addEndOperation(systemName: string, operationData: TOperationData) {\r\n if (!(operations as any)[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n\r\n const newConfig = {\r\n id: uuidv4(),\r\n systemName: systemName,\r\n operationData: operationData,\r\n };\r\n\r\n endOperations.push(newConfig);\r\n\r\n this.actionConfig.endOperations = endOperations;\r\n\r\n return new OperationEditor<this>(newConfig, this);\r\n }\r\n\r\n editEndOperation(id: string) {\r\n const { endOperations } = this.actionConfig;\r\n const operationConfig = endOperations.find(o => o.id === id);\r\n\r\n if (isDefined(operationConfig)) {\r\n return new OperationEditor<this>(operationConfig, this);\r\n }\r\n\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n removeEndOperation(id: string) {\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n const operation = endOperations.find(o => o.id === id);\r\n\r\n if (!isDefined(operation)) {\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n const idx = endOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n endOperations.splice(idx, 1);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n endOperations,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n moveEndOperation(id: string, direction: 'up' | 'down') {\r\n const endOperations = this.actionConfig.endOperations\r\n ? this.actionConfig.endOperations.slice()\r\n : [];\r\n const operation = endOperations.find(o => o.id === id);\r\n\r\n if (!isDefined(operation)) {\r\n throw new Error(`operation not found for id ${id}`);\r\n }\r\n\r\n const idx = endOperations.indexOf(operation);\r\n\r\n if (idx > -1) {\r\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\r\n array_move(endOperations, idx, newIdx);\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n endOperations,\r\n };\r\n }\r\n return this;\r\n }\r\n}\r\n\r\nexport class TimelineActionEditor extends EndableActionEditor<\r\n ITimelineActionConfiguration\r\n> {\r\n setDuration(start: number, end?: number) {\r\n if (end != undefined && start > end) {\r\n throw Error('start position cannot be higher than end position');\r\n }\r\n\r\n const duration: IDuration = {\r\n start,\r\n };\r\n\r\n if (end) {\r\n duration.end = end;\r\n }\r\n\r\n this.actionConfig = {\r\n ...this.actionConfig,\r\n duration,\r\n };\r\n return this;\r\n }\r\n}\r\n\r\nexport class OperationEditor<T extends ActionEditor> {\r\n constructor(\r\n private operationConfig: IOperationConfiguration,\r\n private actionEditor: T\r\n ) {}\r\n\r\n getConfiguration(\r\n callBack: (config: IOperationConfiguration) => IOperationConfiguration\r\n ) {\r\n const copy = deepCopy(this.operationConfig);\r\n const newConfig = callBack.call(this, copy);\r\n\r\n if (newConfig) {\r\n this.operationConfig = newConfig;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n getSystemName() {\r\n return this.operationConfig.systemName;\r\n }\r\n\r\n setSystemName(systemName: TOperationName) {\r\n if (!operations[systemName]) {\r\n throw Error(`Unknown operation: ${systemName}`);\r\n }\r\n\r\n this.operationConfig.systemName = systemName;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n setOperationData(operationData: TOperationData) {\r\n this.operationConfig.operationData = operationData;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n setOperationDataItem(key: string, value: any) {\r\n const { operationData = {} } = this.operationConfig;\r\n operationData[key] = value;\r\n return this.setOperationData(operationData);\r\n }\r\n\r\n getOperationDataKeys() {\r\n const { operationData } = this.operationConfig;\r\n return operationData ? Object.keys(operationData) : [];\r\n }\r\n\r\n getOperationDataValue(key: string) {\r\n const { operationData } = this.operationConfig;\r\n return operationData?.[key];\r\n }\r\n\r\n next() {\r\n return this.actionEditor;\r\n }\r\n}\r\n","import { ILanguageLabel } from '../../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\nexport class LabelEditor {\r\n constructor(\r\n private factory: ConfigurationFactory,\r\n private languageLabel: ILanguageLabel\r\n ) {}\r\n\r\n private _internalGetLabel(languageCode: string) {\r\n return this.languageLabel.labels.find(\r\n (x) => x.languageCode === languageCode\r\n );\r\n }\r\n\r\n setLabel(languageCode: string, translation: string) {\r\n const label = this._internalGetLabel(languageCode);\r\n if (label) {\r\n label.label === translation;\r\n } else {\r\n throw new Error(`No label found for language code '${languageCode}'`);\r\n }\r\n return this;\r\n }\r\n\r\n removeLabel(languageCode: string) {\r\n const idx = this.languageLabel.labels.findIndex(\r\n (x) => x.languageCode === languageCode\r\n );\r\n if (idx > -1) {\r\n this.languageLabel.labels.splice(idx, 1);\r\n } else {\r\n throw new Error(`No label found for language code '${languageCode}'`);\r\n }\r\n return this;\r\n }\r\n\r\n end() {\r\n return this.factory;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport {\r\n IResolvedEngineConfiguration,\r\n IResolvedTimelineConfiguration,\r\n} from '../configuration/types';\r\nimport { animationInterval } from '../util/animation-interval';\r\nimport { ITimelineProvider, TPlayState } from './types';\r\n\r\ntype TUpdateMethod = (now: number) => void;\r\n\r\nexport class RequestAnimationFrameTimelineProvider\r\n implements ITimelineProvider\r\n{\r\n private _currentPosition: number = 0;\r\n private _updateBound: TUpdateMethod = this._update.bind(this);\r\n private _firstFramePending = true;\r\n private _currentPlaylistItem: IResolvedTimelineConfiguration;\r\n private _tickInterval = 1000;\r\n private _playlist: IResolvedTimelineConfiguration[];\r\n private _containerElement: JQuery<HTMLElement> | undefined;\r\n private _abortController: AbortController | undefined;\r\n private _onTime: ((position: number) => void) | undefined;\r\n private _onComplete: (() => void) | undefined;\r\n private _onRestart: (() => void) | undefined;\r\n private _onFirstFrame: (() => void) | undefined;\r\n loop: boolean = false;\r\n\r\n private _playState: TPlayState = 'stopped';\r\n public get playState(): TPlayState {\r\n return this._playState;\r\n }\r\n\r\n constructor(config: IResolvedEngineConfiguration) {\r\n this._playlist = this._extractPlaylist(config);\r\n this._currentPlaylistItem = this._playlist[0];\r\n }\r\n\r\n private _extractPlaylist(\r\n configuration: IResolvedEngineConfiguration\r\n ): IResolvedTimelineConfiguration[] {\r\n const playlist = configuration.timelines.filter(\r\n (timeline) => timeline.type === 'animation'\r\n );\r\n return playlist;\r\n }\r\n\r\n onTime(callback: (position: number) => void) {\r\n this._onTime = callback;\r\n }\r\n\r\n onComplete(callback: () => void) {\r\n this._onComplete = callback;\r\n }\r\n\r\n onRestart(callback: () => void) {\r\n this._onRestart = callback;\r\n }\r\n\r\n onFirstFrame(callback: () => void) {\r\n this._onFirstFrame = callback;\r\n }\r\n\r\n playlistItem(uri: string): void {\r\n if (uri === null || !uri.length || this._playlist.length === 0) {\r\n return;\r\n }\r\n\r\n const item = this._playlist.find((item) => {\r\n return item.uri === uri;\r\n });\r\n\r\n if (!item) {\r\n throw new Error(`Unknown playlist uri: ${uri}`);\r\n }\r\n\r\n this._currentPlaylistItem = item;\r\n }\r\n\r\n private _update(_now: number): void {\r\n if (this.playState !== 'running') {\r\n return;\r\n }\r\n\r\n this._currentPosition++;\r\n\r\n if (this._currentPosition > this._currentPlaylistItem.duration) {\r\n if (this.loop) {\r\n this._resetToStartPosition();\r\n this._onRestart?.();\r\n this._callbackPosition();\r\n } else {\r\n this.stop();\r\n this._onComplete?.();\r\n return;\r\n }\r\n }\r\n\r\n this._callbackPosition();\r\n }\r\n\r\n private _callbackPosition() {\r\n this._onTime?.(this._currentPosition);\r\n }\r\n\r\n start() {\r\n if (this.playState === 'running') {\r\n if (this._currentPosition == 0) {\r\n this._callbackPosition();\r\n }\r\n return;\r\n }\r\n\r\n this._playState = 'running';\r\n this._abortController?.abort();\r\n this._abortController = new AbortController();\r\n\r\n if (this._firstFramePending) {\r\n this._firstFramePending = false;\r\n this._onFirstFrame?.();\r\n }\r\n if (this._currentPosition == 0) {\r\n this._callbackPosition();\r\n }\r\n\r\n animationInterval(\r\n this._tickInterval,\r\n this._abortController.signal,\r\n this._updateBound\r\n );\r\n }\r\n\r\n private _resetToStartPosition() {\r\n this._currentPosition = 0;\r\n }\r\n\r\n getContainer() {\r\n return this._containerElement;\r\n }\r\n\r\n private _stopAnimationInterval(resetPosition: boolean = true) {\r\n this._abortController?.abort();\r\n this._abortController = undefined;\r\n\r\n if (resetPosition) {\r\n this._resetToStartPosition();\r\n }\r\n }\r\n\r\n init(): Promise<void> {\r\n this._currentPlaylistItem = this._playlist[0];\r\n this._containerElement = $(this._currentPlaylistItem.selector);\r\n\r\n if (!this._containerElement.length) {\r\n throw new Error(\r\n `timeline selector '${this._currentPlaylistItem.selector}' not found`\r\n );\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n destroy() {\r\n this.stop();\r\n this._containerElement = undefined;\r\n }\r\n\r\n stop() {\r\n this._stopAnimationInterval();\r\n this._playState = 'stopped';\r\n }\r\n\r\n pause() {\r\n this._stopAnimationInterval(false);\r\n this._playState = 'stopped';\r\n }\r\n\r\n seek(position: number) {\r\n if (position < 0 || position > this._currentPlaylistItem.duration) {\r\n return Promise.resolve(this._currentPosition);\r\n }\r\n this._currentPosition = position;\r\n return Promise.resolve(position);\r\n }\r\n\r\n getPosition() {\r\n return this._currentPosition;\r\n }\r\n\r\n getDuration() {\r\n return this._currentPlaylistItem.duration;\r\n }\r\n}\r\n","// https://gist.github.com/jakearchibald/cb03f15670817001b1157e62a076fe95\r\nexport function animationInterval(\r\n ms: number,\r\n signal: AbortSignal,\r\n callback: (time: number) => void\r\n) {\r\n // Prefer currentTime, as it'll better sync animations queued in the\r\n // same frame, but if it isn't supported, performance.now() is fine.\r\n const start = document?.timeline?.currentTime ?? performance.now();\r\n\r\n function frame(time: number) {\r\n if (signal.aborted) return;\r\n callback(time);\r\n scheduleFrame(time);\r\n }\r\n\r\n function scheduleFrame(time: number) {\r\n const elapsed = time - start;\r\n const roundedElapsed = Math.round(elapsed / ms) * ms;\r\n const targetNext = start + roundedElapsed + ms;\r\n const delay = targetNext - performance.now();\r\n setTimeout(() => requestAnimationFrame(frame), delay);\r\n }\r\n\r\n scheduleFrame(start);\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport * as timelineProviders from '../../timelineproviders';\r\nimport { TimelineTypes } from '../../types';\r\nimport { ITimelineProviderSettings, TTimelineProviderSettings } from '../types';\r\nimport { ConfigurationFactory } from './configuration-factory';\r\n\r\nexport class TimelineProvidersSettingsEditor {\r\n constructor(\r\n private providersSettings: TTimelineProviderSettings,\r\n private configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n addProvider(timelineType: TimelineTypes) {\r\n if (this.providersSettings[timelineType]) {\r\n throw new Error(\r\n `Settings for a '${timelineType}' provider already exist`\r\n );\r\n }\r\n const settings: ITimelineProviderSettings = {\r\n id: uuidv4(),\r\n poster: undefined,\r\n selector: undefined,\r\n systemName: '',\r\n vendor: '',\r\n };\r\n this.providersSettings[timelineType] = settings;\r\n return new TimelineProviderSettingsEditor(\r\n settings,\r\n this,\r\n this.configurationFactory\r\n );\r\n }\r\n\r\n editProvider(timelineType: TimelineTypes) {\r\n if (!this.providersSettings[timelineType]) {\r\n throw new Error(`No settings for a '${timelineType}' provider exist yet`);\r\n }\r\n\r\n return new TimelineProviderSettingsEditor(\r\n this.providersSettings[timelineType] as ITimelineProviderSettings,\r\n this,\r\n this.configurationFactory\r\n );\r\n }\r\n\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\nexport class TimelineProviderSettingsEditor {\r\n constructor(\r\n private providerSettings: ITimelineProviderSettings,\r\n private providersSettingsEditor: TimelineProvidersSettingsEditor,\r\n private configurationFactory: ConfigurationFactory\r\n ) {}\r\n\r\n setVendor(vendor: string) {\r\n this.providerSettings.vendor = vendor;\r\n return this;\r\n }\r\n\r\n setSelector(selector: string) {\r\n this.providerSettings.selector = selector;\r\n return this;\r\n }\r\n\r\n setSystemName(systemName: string) {\r\n if (!(timelineProviders as any)[systemName]) {\r\n throw new Error(`Unknown timeline provider system name: ${systemName}`);\r\n }\r\n this.providerSettings.systemName = systemName;\r\n return this;\r\n }\r\n\r\n next() {\r\n return this.providersSettingsEditor;\r\n }\r\n\r\n end() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\nimport { deepCopy } from '../../operation/helper/deep-copy';\r\nimport { ILabel, ILanguageLabel, TimelineTypes } from '../../types';\r\nimport {\r\n IActionConfiguration,\r\n IEngineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration\r\n} from '../types';\r\nimport { ActionCreatorFactory } from './action-creator-factory';\r\nimport {\r\n ActionEditor,\r\n EndableActionEditor,\r\n TimelineActionEditor\r\n} from './action-editor';\r\nimport { LabelEditor } from './label-editor';\r\nimport { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';\r\n\r\nexport type TEngineConfigurationLists = Pick<\r\n IEngineConfiguration,\r\n | 'availableLanguages'\r\n | 'initActions'\r\n | 'actions'\r\n | 'eventActions'\r\n | 'timelines'\r\n | 'labels'\r\n>;\r\n\r\ntype ConfigurationFactoryExtension = (\r\n this: ConfigurationFactory,\r\n ...rest: any[]\r\n) => void;\r\n\r\n/**\r\n * This class offers a fluent and strongly typed DSL for creating Eligius configurations.\r\n *\r\n * @example Building a configuration using the factory\r\n * To initialize a basic configuration to start off of:\r\n * ```ts\r\n * const factory = new ConfigurationFactory()\r\n * .init(\"en-US\") // Define the default language\r\n * .addLanguage(\"en-US\", \"English\") // Add English as a supported language\r\n * .addLanguage(\"nl-NL\", \"Nederlands\") // Add Dutch as a supported language\r\n * .setLayoutTemplate(\"<div class=\\\"main.container\\\"></div>\") // Add the main container for the presentation\r\n * .setContainerSelector(\"#ct-container\") // Selector for the element in the body that will contain the presentation\r\n * .addTimeline( // Add a first timeline\r\n * 'timeline-1', // Give it a name\r\n * \"animation\", // This is RAF based timeline\r\n * 200, // The duration of the timeline in seconds\r\n * false, // The presentation does NOT play in a loop\r\n * \".timeline-container\" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered\r\n * )\r\n * .editTimelineProviderSettings() // Add a timeline provider\r\n * .addProvider(\"animation\") // One that provides timelines for type 'animation'\r\n * .setSystemName(\"RequestAnimationFrameTimelineProvider\") // The system name of the provider\r\n * .setVendor(\"eligius\") // Eligius is the vendor in this case\r\n * .end(); // This finally returns the ConfigurationFactory instance\r\n * ```\r\n *\r\n * Then to add an init action:\r\n * ```ts\r\n * factory\r\n * .createInitAction(\"GetUserName\")\r\n * .addStartOperationByType(getQueryParams, {\r\n * defaultValues: { username: \"guest\" },\r\n * })\r\n * .addStartOperationByType(setGlobalData, { properties: [\"queryParams\"] });\r\n * ```\r\n *\r\n * After that, add a timeline action:\r\n * ```ts\r\n * factory.createTimelineAction(\"timeline-1\", \"AddIntroContainer\")\r\n * .addDuration(0, 10)\r\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\r\n * .addStartOperationByType(setElementContent, {\r\n * template: '<div class=\"intro-text\"></div>',\r\n * })\r\n * .addEndOperationByType(selectElement, { selector: \".intro-text\" })\r\n * .addEndOperationByType(removeElement, {});\r\n * ```\r\n *\r\n * It also possible to extend the factory with specialized creation methods for the particular\r\n * configuration you are building:\r\n * ```ts\r\n * function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {\r\n * this.createInitAction(actionName)\r\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\r\n * .addStartOperationByType(createElement, { element: 'img', attributes: {src: imageSrc, imageId} })\r\n * .addStartOperationByType(setElementContent, { insertionType: \"append\" })\r\n * .addEndOperationByType(selectElement, { selector: `#${imageId}` })\r\n * .addEndOperationByType(removeElement, {});\r\n * }\r\n *\r\n * const customFactory = ConfigurationFactory.extend(factory, \"addImage\", addImage);\r\n *\r\n * customFactory.addImage(\"MyImageActionName\", \"my-image.png\", \"my-image-id\");\r\n * ```\r\n *\r\n * Finally, retrieve the configuration and save it:\r\n * ```ts\r\n * import fs from \"fs\";\r\n *\r\n * const configuration = customFactory.getConfiguration();\r\n *\r\n * fs.writeFileSync(\"/my/path/configuration.json\", JSON.stringify(configuration), {encoding:'utf-8'})\r\n * ```\r\n *\r\n * The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply\r\n * pass the JSON configuration to the `ConfigurationFactory`'s constructor:\r\n * ```ts\r\n * import myConfiguration from './my-configuration.json';\r\n *\r\n * const factory = new ConfigurationFactory(myConfiguration);\r\n *\r\n * factory.editInitAction(\"existingActionName\")\r\n * .removeEndOperation(\"475fd0ab-5755-4e60-8f7c-e1988a109678\");\r\n * ```\r\n *\r\n */\r\nexport class ConfigurationFactory {\r\n actionCreatorFactory: ActionCreatorFactory;\r\n configuration: IEngineConfiguration;\r\n\r\n constructor(config?: IEngineConfiguration) {\r\n this.configuration = config || ({} as any);\r\n this.actionCreatorFactory = new ActionCreatorFactory(this);\r\n }\r\n\r\n static extend<\r\n T extends ConfigurationFactory,\r\n K extends string | number | symbol,\r\n C extends ConfigurationFactoryExtension\r\n >(factory: T, extensionMethodName: K, extensionMethod: C) {\r\n (factory as any)[extensionMethodName] = extensionMethod.bind(factory);\r\n return factory as T & { [k in K]: typeof extensionMethod };\r\n }\r\n\r\n static extendMultiple<\r\n T extends ConfigurationFactory,\r\n C extends ConfigurationFactoryExtension,\r\n D extends { [name: string]: C }\r\n >(factory: T, extensions: D) {\r\n Object.entries(extensions).forEach(([name, method]) =>\r\n ConfigurationFactory.extend(factory, name, method)\r\n );\r\n return factory as T & typeof extensions;\r\n }\r\n\r\n init(defaultLanguage: string) {\r\n this.configuration = {\r\n id: uuidv4(),\r\n engine: {\r\n systemName: 'EligiusEngine',\r\n },\r\n containerSelector: '[data-ct-container=true]',\r\n timelineProviderSettings: {} as any,\r\n language: defaultLanguage,\r\n availableLanguages: [],\r\n layoutTemplate: '',\r\n initActions: [],\r\n actions: [],\r\n timelines: [],\r\n labels: [],\r\n };\r\n\r\n return this;\r\n }\r\n\r\n setLayoutTemplate(layoutTemplate: string) {\r\n this.configuration.layoutTemplate = layoutTemplate;\r\n return this;\r\n }\r\n\r\n setDefaultLanguage(defaultLanguage: string) {\r\n this.configuration.language = defaultLanguage;\r\n return this;\r\n }\r\n\r\n setContainerSelector(selector: string) {\r\n this.configuration.containerSelector = selector;\r\n return this;\r\n }\r\n\r\n editTimelineProviderSettings() {\r\n return new TimelineProvidersSettingsEditor(\r\n this.configuration.timelineProviderSettings || {},\r\n this\r\n );\r\n }\r\n\r\n getConfiguration(\r\n callBack?: (copy: IEngineConfiguration) => IEngineConfiguration\r\n ) {\r\n const copy = deepCopy<IEngineConfiguration>(this.configuration);\r\n if (callBack) {\r\n const newConfig = callBack.call(this, copy);\r\n this.configuration = deepCopy<IEngineConfiguration>(newConfig);\r\n }\r\n return copy;\r\n }\r\n\r\n addLanguage(languageCode: string, languageLabel: string) {\r\n const languages = this._initializeCollection(\r\n this.configuration,\r\n 'availableLanguages'\r\n );\r\n const existing = languages.find(\r\n (lang) => lang.languageCode === languageCode\r\n );\r\n\r\n if (existing) {\r\n throw new Error(`Language code '${languageCode}' already exists`);\r\n }\r\n\r\n languages.push({\r\n id: uuidv4(),\r\n languageCode: languageCode,\r\n label: languageLabel,\r\n });\r\n return this;\r\n }\r\n\r\n private _internalAddAction(\r\n collectionName: keyof TEngineConfigurationLists,\r\n action: IActionConfiguration\r\n ) {\r\n const actions = this._initializeCollection(\r\n this.configuration,\r\n collectionName\r\n );\r\n actions?.push(action as any);\r\n }\r\n\r\n private _initializeCollection<T, K extends keyof T>(\r\n parent: T,\r\n name: K\r\n ): T[K] {\r\n if (!parent[name]) {\r\n (parent[name] as any) = [];\r\n }\r\n return parent[name] as T[K];\r\n }\r\n\r\n addAction(action: IActionConfiguration) {\r\n this._internalAddAction('actions', action);\r\n }\r\n\r\n addInitAction(action: IActionConfiguration) {\r\n this._internalAddAction('initActions', action);\r\n }\r\n\r\n addEventAction(action: IActionConfiguration) {\r\n this._internalAddAction('eventActions', action);\r\n }\r\n\r\n addTimelineAction(uri: string, action: ITimelineActionConfiguration) {\r\n const timeline = this.getTimeline(uri);\r\n if (timeline) {\r\n const timelineActions = this._initializeCollection(\r\n timeline,\r\n 'timelineActions'\r\n );\r\n timelineActions.push(action);\r\n } else {\r\n throw Error(`No timeline found for uri '${uri}'`);\r\n }\r\n }\r\n\r\n createAction(name: string) {\r\n return this.actionCreatorFactory.createAction(name);\r\n }\r\n\r\n createInitAction(name: string) {\r\n return this.actionCreatorFactory.createInitAction(name);\r\n }\r\n\r\n createEventAction(name: string) {\r\n return this.actionCreatorFactory.createEventAction(name);\r\n }\r\n\r\n createTimelineAction(uri: string, name: string) {\r\n return this.actionCreatorFactory.createTimelineAction(uri, name);\r\n }\r\n\r\n addTimeline(\r\n uri: string,\r\n type: TimelineTypes,\r\n duration: number,\r\n loop: boolean,\r\n selector: string\r\n ) {\r\n const timelines = this._initializeCollection(\r\n this.configuration,\r\n 'timelines'\r\n );\r\n const timeline = this.getTimeline(uri);\r\n if (timeline) {\r\n throw Error(`timeline for uri ${uri} already exists`);\r\n }\r\n const timelineConfig: ITimelineConfiguration = {\r\n id: uuidv4(),\r\n type: type,\r\n uri: uri,\r\n duration: duration,\r\n loop: loop,\r\n selector: selector,\r\n timelineActions: [],\r\n };\r\n timelines.push(timelineConfig);\r\n return this;\r\n }\r\n\r\n getTimeline(uri: string) {\r\n return this.configuration.timelines.find((t) => t.uri === uri);\r\n }\r\n\r\n removeTimeline(uri: string) {\r\n const timelineConfig = this.getTimeline(uri);\r\n if (timelineConfig) {\r\n const idx = this.configuration.timelines.indexOf(timelineConfig);\r\n if (idx > -1) {\r\n this.configuration.timelines.splice(idx, 1);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n private _initializeLabel(id: string, labels: ILanguageLabel[]) {\r\n let label = labels.find((l) => l.id === id);\r\n if (!label) {\r\n labels.push({\r\n id: id,\r\n labels: [],\r\n });\r\n label = labels[labels.length - 1];\r\n }\r\n return label;\r\n }\r\n\r\n private _getLabelTranslation(\r\n labelTranslations: ILabel[],\r\n languageCode: string\r\n ) {\r\n let translation = labelTranslations.find(\r\n (l) => l.languageCode === languageCode\r\n );\r\n if (!translation) {\r\n translation = {\r\n id: uuidv4(),\r\n languageCode: languageCode,\r\n label: '',\r\n };\r\n labelTranslations.push(translation);\r\n }\r\n return translation;\r\n }\r\n\r\n editLabel(id: string) {\r\n const label = this.configuration.labels?.find((x) => x.id === id);\r\n if (label) {\r\n return new LabelEditor(this, label);\r\n } else {\r\n throw new Error(`Language label with id '${id}' not found`);\r\n }\r\n }\r\n\r\n addLabel(id: string, code: string, translation: string) {\r\n const labels = this._initializeCollection(this.configuration, 'labels');\r\n const labelConfig = this._initializeLabel(id, labels);\r\n const labelTranslation = this._getLabelTranslation(\r\n labelConfig.labels,\r\n code\r\n );\r\n labelTranslation.label = translation;\r\n return this;\r\n }\r\n\r\n addLabels(id: string, translations: Record<string, string>) {\r\n Object.entries(translations).forEach(([code, translation]) =>\r\n this.addLabel(id, code, translation)\r\n );\r\n return this;\r\n }\r\n\r\n removeLabel(id: string) {\r\n const idx = this.configuration.labels.findIndex((x) => x.id === id);\r\n if (idx > -1) {\r\n this.configuration.labels.splice(idx, 1);\r\n } else {\r\n throw new Error(`Label with id '${id}' not found!`);\r\n }\r\n return this;\r\n }\r\n\r\n editAction(id: string) {\r\n const actionConfig = this.configuration.actions.find((a) => a.id === id);\r\n if (actionConfig) {\r\n return new EndableActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Action not found for id ${id}`);\r\n }\r\n\r\n editEventAction(id: string) {\r\n const actionConfig = this.configuration.eventActions?.find(\r\n (a) => a.id === id\r\n );\r\n if (actionConfig) {\r\n return new ActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Event action not found for id ${id}`);\r\n }\r\n\r\n editInitAction(id: string) {\r\n const actionConfig = this.configuration.initActions.find(\r\n (a) => a.id === id\r\n );\r\n if (actionConfig) {\r\n return new EndableActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Init action not found for id ${id}`);\r\n }\r\n\r\n editTimelineAction(uri: string, id: string) {\r\n const timeline = this.getTimeline(uri);\r\n if (!timeline) {\r\n throw new Error(`Timeline not found for id ${id}`);\r\n }\r\n const actionConfig = timeline.timelineActions.find((a) => a.id === id);\r\n if (actionConfig) {\r\n return new TimelineActionEditor(actionConfig, this);\r\n }\r\n throw new Error(`Timeline action not found for id ${id}`);\r\n }\r\n}","import { IEndableAction } from '../action/types';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\ninterface IActionInstanceInfo {\r\n start: boolean;\r\n action: IEndableAction;\r\n}\r\n\r\nexport interface IEventListenerControllerOperationData {\r\n selectedElement: JQuery;\r\n eventName: string;\r\n actions: string[];\r\n actionOperationData?: TOperationData;\r\n}\r\n\r\n/**\r\n * This controller attaches to the given selected element and adds an event listener for the specified event name that\r\n * executes the given actions with the given operation data.\r\n * \r\n * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead, \r\n * prefix the action name with `end:`.\r\n */\r\nexport class EventListenerController\r\n implements IController<IEventListenerControllerOperationData>\r\n{\r\n operationData?: IEventListenerControllerOperationData;\r\n actionInstanceInfos?: IActionInstanceInfo[];\r\n name = 'EventListenerController';\r\n\r\n constructor() {}\r\n\r\n init(operationData: IEventListenerControllerOperationData) {\r\n this.operationData = {\r\n selectedElement: operationData.selectedElement,\r\n eventName: operationData.eventName,\r\n actions: operationData.actions.slice(),\r\n actionOperationData: deepCopy(operationData.actionOperationData),\r\n };\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n const { selectedElement, actions, eventName } = this.operationData;\r\n if (!this.actionInstanceInfos) {\r\n this.actionInstanceInfos = [];\r\n\r\n const resultCallback =\r\n (isStart: boolean) => (actionInstance: IEndableAction) => {\r\n this.actionInstanceInfos?.push({\r\n start: isStart,\r\n action: actionInstance,\r\n });\r\n };\r\n\r\n actions.forEach((actionName: string) => {\r\n const [isStart, name] = this._isStartAction(actionName);\r\n eventbus.broadcast(TimelineEventNames.REQUEST_ACTION, [\r\n name,\r\n resultCallback(isStart),\r\n ]);\r\n });\r\n\r\n selectedElement.on(eventName, this._eventHandler.bind(this));\r\n }\r\n }\r\n\r\n private _isStartAction(actionName: string): [boolean, string] {\r\n const prefix = actionName.substring(0, 'end:'.length);\r\n if (prefix === 'end:') {\r\n return [false, actionName.substring('end:'.length)];\r\n } else {\r\n return [true, actionName];\r\n }\r\n }\r\n\r\n private _eventHandler(event: any) {\r\n if (!this.operationData || !this.actionInstanceInfos) {\r\n return;\r\n }\r\n\r\n const actionOperationData = this.operationData.actionOperationData\r\n ? deepCopy(this.operationData.actionOperationData)\r\n : {};\r\n\r\n if (event.target) {\r\n actionOperationData.eventTarget = event.target;\r\n }\r\n\r\n this._executeAction(this.actionInstanceInfos, actionOperationData, 0);\r\n }\r\n\r\n private async _executeAction(\r\n actions: IActionInstanceInfo[],\r\n operationData: TOperationData,\r\n idx: number\r\n ) {\r\n if (idx < actions.length) {\r\n const actionInfo = actions[idx];\r\n const { action } = actionInfo;\r\n const method = actionInfo.start\r\n ? action.start.bind(action)\r\n : action.end.bind(action);\r\n const resultOperationData = await method(operationData);\r\n this._executeAction(\r\n actions,\r\n Object.assign(operationData, resultOperationData),\r\n ++idx\r\n );\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.operationData?.selectedElement.off(this.operationData.eventName);\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { ILabel } from '../types';\r\nimport { IController } from './types';\r\n\r\nexport interface ILabelControllerMetadata {\r\n selectedElement: JQuery;\r\n labelId: string;\r\n attributeName?: string;\r\n}\r\n\r\n/**\r\n * This controller attaches to the given selected element and renders the text associated with the given label id in it.\r\n *\r\n * The controller also listen for the `LANGUAGE_CHANGE` event and re-renders the text with the new language after such an event.\r\n *\r\n */\r\nexport class LabelController implements IController<ILabelControllerMetadata> {\r\n listeners: TEventbusRemover[] = [];\r\n currentLanguage: string | null = null;\r\n operationData: ILabelControllerMetadata | null = null;\r\n labelData: Record<string, string> = {};\r\n name = 'LabelController';\r\n requestLabelDataBound?: (labelId: string) => void;\r\n\r\n init(operationData: ILabelControllerMetadata) {\r\n this.operationData = Object.assign({}, operationData);\r\n }\r\n\r\n setLabelId(newLabelId: string) {\r\n if (this.requestLabelDataBound) {\r\n this.requestLabelDataBound(newLabelId);\r\n this._setLabel();\r\n }\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [\r\n (language: string) => {\r\n this.currentLanguage = language;\r\n },\r\n ]);\r\n\r\n this.requestLabelDataBound = this._requestLabelData.bind(this, eventbus);\r\n this.requestLabelDataBound(this.operationData.labelId);\r\n\r\n this._setLabel();\r\n this.listeners.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n }\r\n\r\n private _requestLabelData(eventbus: IEventbus, labelId: string) {\r\n eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [\r\n labelId,\r\n (labelCollection: ILabel[]) => {\r\n if (labelCollection) {\r\n this._createTextDataLookup(labelCollection);\r\n } else {\r\n throw new Error(`Label id '${labelId}' does not exist!`);\r\n }\r\n },\r\n ]);\r\n }\r\n\r\n private _setLabel() {\r\n if (this.currentLanguage) {\r\n const text = this.labelData[this.currentLanguage];\r\n if (!this.operationData?.attributeName) {\r\n this.operationData?.selectedElement.html(text);\r\n } else {\r\n this.operationData?.selectedElement.attr(\r\n this.operationData?.attributeName,\r\n text\r\n );\r\n }\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.listeners.forEach((func) => func());\r\n this.requestLabelDataBound = undefined;\r\n }\r\n\r\n private _handleLanguageChange(code: string) {\r\n this.currentLanguage = code;\r\n this._setLabel();\r\n }\r\n\r\n private _createTextDataLookup(data: ILabel[]) {\r\n data.forEach((d) => {\r\n this.labelData[d.languageCode] = d.label;\r\n });\r\n }\r\n}\r\n","import lottie, {\r\n AnimationConfigWithData,\r\n AnimationItem,\r\n CanvasRendererConfig,\r\n HTMLRendererConfig,\r\n SVGRendererConfig,\r\n} from 'lottie-web';\r\nimport { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface IInnerMetadata {\r\n selectedElement: JQuery;\r\n renderer: SVGRendererConfig | CanvasRendererConfig | HTMLRendererConfig;\r\n loop: boolean;\r\n autoplay: boolean;\r\n animationData: any;\r\n json: any;\r\n labelIds: string[];\r\n viewBox: string;\r\n iefallback: any;\r\n}\r\n\r\nexport interface ILottieControllerMetadata extends IInnerMetadata {\r\n url: string;\r\n}\r\n\r\n/**\r\n * This controller renders a [lottie-web](https://github.com/airbnb/lottie-web) animation inside the given selected element.\r\n *\r\n * The url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json\r\n *\r\n */\r\nexport class LottieController\r\n implements IController<ILottieControllerMetadata>\r\n{\r\n name = 'LottieController';\r\n currentLanguage: string = 'nl-NL';\r\n labelData: Record<string, Record<string, string>> = {};\r\n eventbusRemovers: TEventbusRemover[] = [];\r\n animationItem: AnimationItem | null = null;\r\n operationData: IInnerMetadata | null = null;\r\n serializedData: string | null = null;\r\n serializedIEData: string | null = null;\r\n freezePosition = -1;\r\n endPosition = -1;\r\n\r\n constructor() {}\r\n\r\n init(operationData: ILottieControllerMetadata) {\r\n this.operationData = { ...operationData };\r\n\r\n if (operationData.url.indexOf('[') > -1) {\r\n this._parseFilename(operationData.url);\r\n }\r\n\r\n this.serializedData = this.operationData.json\r\n ? JSON.stringify(this.operationData.json)\r\n : JSON.stringify(this.operationData.animationData);\r\n\r\n if (this.operationData.iefallback) {\r\n this.serializedIEData = JSON.stringify(this.operationData.iefallback);\r\n }\r\n }\r\n\r\n private _parseFilename(name: string) {\r\n const params = name.substring(\r\n name.indexOf('[') + 1,\r\n name.indexOf(']') - name.indexOf('[') - 1\r\n );\r\n\r\n const settings = params.split(',');\r\n\r\n settings.forEach((setting) => {\r\n const values = setting.split('=');\r\n if (values[0] === 'freeze') {\r\n this.freezePosition = +values[1];\r\n } else if (values[0] === 'end') {\r\n this.endPosition = +values[1];\r\n }\r\n });\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.operationData) {\r\n return;\r\n }\r\n\r\n const { labelIds } = this.operationData;\r\n if (labelIds && labelIds.length) {\r\n const resultHolder: {\r\n language: string;\r\n labelCollections: any[];\r\n } = {} as any;\r\n\r\n eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [\r\n resultHolder,\r\n ]);\r\n this.currentLanguage = resultHolder.language;\r\n this.eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, [\r\n this.operationData.labelIds,\r\n resultHolder,\r\n ]);\r\n this._createTextDataLookup(resultHolder.labelCollections);\r\n }\r\n this._createAnimation();\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.eventbusRemovers.forEach((func) => {\r\n func();\r\n });\r\n\r\n if (this.animationItem) {\r\n if (this.endPosition > -1) {\r\n this.animationItem.addEventListener(\r\n 'complete',\r\n this._destroy.bind(this)\r\n );\r\n this.animationItem.playSegments(\r\n [this.freezePosition, this.endPosition],\r\n true\r\n );\r\n } else {\r\n this.animationItem.destroy();\r\n }\r\n }\r\n }\r\n\r\n private _destroy() {\r\n if (this.animationItem) {\r\n this.animationItem.destroy();\r\n this.animationItem = null;\r\n }\r\n }\r\n\r\n private _createAnimation() {\r\n if (!this.operationData || !this.serializedData) {\r\n return;\r\n }\r\n\r\n this.animationItem?.destroy();\r\n let serialized =\r\n this._isIE() && this.serializedIEData\r\n ? this.serializedIEData\r\n : this.serializedData;\r\n\r\n const { labelIds } = this.operationData;\r\n if (labelIds && labelIds.length) {\r\n labelIds.forEach((id) => {\r\n serialized = serialized\r\n .split(`!!${id}!!`)\r\n .join(this.labelData[id][this.currentLanguage]);\r\n });\r\n }\r\n const animationData = JSON.parse(serialized);\r\n\r\n const animationSettings: AnimationConfigWithData<'svg'> = {\r\n autoplay: this.operationData.autoplay,\r\n container: this.operationData.selectedElement[0],\r\n loop: this.operationData.loop,\r\n rendererSettings: this.operationData.renderer,\r\n animationData,\r\n };\r\n\r\n this.animationItem = lottie.loadAnimation(animationSettings);\r\n if (this.endPosition < 0) {\r\n this.endPosition = this.animationItem.timeCompleted;\r\n }\r\n\r\n if (this.freezePosition > -1) {\r\n this.animationItem.playSegments([0, this.freezePosition], true);\r\n }\r\n if (this.operationData.viewBox) {\r\n this.operationData.selectedElement\r\n .find('svg')\r\n .attr('viewBox', this.operationData.viewBox);\r\n }\r\n }\r\n\r\n private _createTextDataLookup(data: any[]) {\r\n data.forEach((infos, index) => {\r\n infos.forEach((d: any) => {\r\n if (this.operationData) {\r\n this.labelData[this.operationData.labelIds[index]][d.code] = d.label;\r\n }\r\n });\r\n });\r\n }\r\n\r\n private _handleLanguageChange(code: string) {\r\n this.currentLanguage = code;\r\n this._createAnimation();\r\n }\r\n\r\n private _isIE() {\r\n const isIE = false || !!(window.document as any)['documentMode'];\r\n\r\n // Edge 20+\r\n const isEdge = !isIE && !!(window as any)['StyleMedia'];\r\n\r\n return isEdge || isIE;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TResultCallback } from '../types';\r\nimport { LabelController } from './label-controller';\r\nimport { IController } from './types';\r\n\r\nexport interface INavigationControllerOperationData {\r\n selectedElement: JQuery;\r\n json: any;\r\n}\r\n\r\nexport class NavigationController\r\n implements IController<INavigationControllerOperationData>\r\n{\r\n name: string = 'NavigationController';\r\n navigation: any[] = [];\r\n navLookup: Record<string, any> = {};\r\n navVidIdLookup: Record<string, any> = {};\r\n ctrlLookup: Record<string, LabelController> = {};\r\n activeNavigationPoint: any | null = null;\r\n labelControllers: LabelController[] = [];\r\n eventhandlers: TEventbusRemover[] = [];\r\n eventbus: IEventbus | null = null;\r\n container: JQuery | null = null;\r\n\r\n constructor() {}\r\n\r\n init(operationData: TOperationData) {\r\n this.container = operationData.selectedElement;\r\n this.navigation = this._buildNavigationData(operationData.json);\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n if (!this.container) {\r\n return;\r\n }\r\n\r\n this.eventbus = eventbus;\r\n\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'navigate-to-video-url',\r\n this._handleNavigateVideoUrl.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('highlight-navigation', this._highlightMenu.bind(this))\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'request-current-navigation',\r\n this._handleRequestCurrentNavigation.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('video-complete', this._handleVideoComplete.bind(this))\r\n );\r\n\r\n this._buildHtml(this.container, this.navigation);\r\n this._initHistory.bind(this);\r\n }\r\n\r\n private _initHistory() {\r\n this.activeNavigationPoint = this.navVidIdLookup[0];\r\n const navId = this._getQueryVariable(0);\r\n let videoIndex = 0;\r\n if (navId) {\r\n const nav = this.navLookup[navId];\r\n videoIndex = nav.videoUrlIndex;\r\n }\r\n this._highlightMenu(videoIndex);\r\n }\r\n\r\n private _getQueryVariable(variableIdx: number) {\r\n const href = window.location.href;\r\n const hashIndex = href.indexOf('#');\r\n if (hashIndex > -1) {\r\n const query = href.substring(hashIndex + 2);\r\n if (query) {\r\n const vars = query.split('/');\r\n return vars[variableIdx];\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private _handleRequestCurrentNavigation(resultCallback: TResultCallback) {\r\n if (this.activeNavigationPoint) {\r\n const labelCtrl = this.ctrlLookup[this.activeNavigationPoint.labelId];\r\n resultCallback({\r\n navigationData: this.activeNavigationPoint,\r\n title: labelCtrl.labelData[labelCtrl.currentLanguage || ''],\r\n });\r\n } else {\r\n resultCallback(null);\r\n }\r\n }\r\n\r\n detach(eventbus: IEventbus) {\r\n this.eventhandlers.forEach((handler) => {\r\n handler();\r\n });\r\n\r\n this.labelControllers.forEach((ctrl) => {\r\n ctrl.detach(eventbus);\r\n });\r\n\r\n this.labelControllers.length = 0;\r\n this.eventbus = null;\r\n this.container = null;\r\n window.onpopstate = null;\r\n }\r\n\r\n private _pushCurrentState(position = -1) {\r\n if (!this.activeNavigationPoint) {\r\n return;\r\n }\r\n const labelCtrl: LabelController =\r\n this.ctrlLookup[this.activeNavigationPoint.labelId];\r\n\r\n if (!labelCtrl) {\r\n return;\r\n }\r\n\r\n const state = {\r\n navigationData: this.activeNavigationPoint,\r\n title: labelCtrl.labelData[labelCtrl.currentLanguage || ''],\r\n position: -1,\r\n };\r\n if (position > -1) {\r\n state.position = position;\r\n }\r\n this.eventbus?.broadcast('push-history-state', [state]);\r\n }\r\n\r\n private _buildHtml(parentElm: JQuery, data: any) {\r\n const ul = $('<ul/>');\r\n data.forEach(this._addNavElement.bind(this, ul));\r\n parentElm.append(ul);\r\n }\r\n\r\n private _addNavElement(parentElm: JQuery, data: any) {\r\n if (data.visible) {\r\n const li = $('<li/>');\r\n const a = $(`<a href='javascript:;' id='nav_${data.videoUrlIndex}'/>`);\r\n li.append(a);\r\n this._addLabel(a, data.labelId);\r\n this._addClickHandler(a, data.videoUrlIndex);\r\n\r\n if (data.children) {\r\n const ul = $('<ul/>');\r\n data.children.forEach(this._addNavElement.bind(this, ul));\r\n li.append(ul);\r\n }\r\n\r\n parentElm.append(li);\r\n }\r\n }\r\n\r\n private _addClickHandler(parentElm: JQuery, videoIndex: number) {\r\n parentElm.mouseup(this._menuMouseupHandler.bind(this, videoIndex));\r\n }\r\n\r\n private _menuMouseupHandler(videoIndex: number) {\r\n const navdata = this.navVidIdLookup[videoIndex];\r\n if (navdata) {\r\n this.eventbus?.broadcast('request-video-url', [navdata.videoUrlIndex]);\r\n this._handleNavigateVideoUrl(navdata.videoUrlIndex);\r\n }\r\n }\r\n\r\n private _handleNavigateVideoUrl(\r\n index: number,\r\n requestedVideoPosition: number = 0\r\n ) {\r\n this._highlightMenu(index);\r\n this.eventbus?.broadcast('request-video-url', [\r\n index,\r\n requestedVideoPosition,\r\n ]);\r\n this.activeNavigationPoint = this.navVidIdLookup[index];\r\n this._pushCurrentState(requestedVideoPosition);\r\n }\r\n\r\n private _highlightMenu(index: number) {\r\n const navElm = $(`#nav_${index}`);\r\n\r\n if (navElm.length) {\r\n $('.current-menu-item').removeClass('current-menu-item');\r\n navElm.addClass('current-menu-item');\r\n }\r\n }\r\n\r\n private _handleVideoComplete(index: number) {\r\n const navData = this.navVidIdLookup[index];\r\n if (navData.autoNext) {\r\n this.eventbus?.broadcast('request-video-url', [\r\n navData.next.videoUrlIndex,\r\n ]);\r\n } else {\r\n this.eventbus?.broadcast('request-video-cleanup');\r\n }\r\n }\r\n\r\n private _addLabel(parentElm: JQuery, labelId: string) {\r\n const data = {\r\n selectedElement: parentElm,\r\n labelId: labelId,\r\n };\r\n const resultCallback = (instance: LabelController) => {\r\n instance.init(data);\r\n instance.attach(this.eventbus as IEventbus);\r\n this.labelControllers.push(instance);\r\n this.ctrlLookup[labelId] = instance;\r\n };\r\n this.eventbus?.broadcast('request-instance', [\r\n 'LabelController',\r\n resultCallback,\r\n ]);\r\n }\r\n\r\n private _buildNavigationData(data: any) {\r\n const result: any[] = [];\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n this.navLookup[nav.id] = nav;\r\n this.navVidIdLookup[nav.videoUrlIndex] = nav;\r\n nav.previous = data.navigationData[index - 1];\r\n });\r\n\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n if (nav.nextId) {\r\n nav.next = this.navLookup[nav.nextId];\r\n delete nav.nextId;\r\n } else {\r\n nav.next = data.navigationData[index + 1];\r\n }\r\n });\r\n\r\n data.roots.forEach((id: string) => {\r\n const nav = this.navLookup[id];\r\n if (nav.children) {\r\n nav.children = nav.children.map((childId: string) => {\r\n return this.navLookup[childId];\r\n });\r\n }\r\n result.push(nav);\r\n });\r\n return result;\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface IProgressbarControllerOperationData {\r\n selectedElement: JQuery;\r\n textElement: JQuery;\r\n}\r\n\r\n/**\r\n * This controller renders a progressbar that displays the progress of the current timeline in the given selected element.\r\n * \r\n * The current progress as a percentage is rendered in the given text element.\r\n */\r\nexport class ProgressbarController\r\n implements IController<IProgressbarControllerOperationData>\r\n{\r\n name: string = 'ProgressbarController';\r\n selectedElement: JQuery | null = null;\r\n textElement: JQuery | null = null;\r\n eventbusRemovers: TEventbusRemover[] = [];\r\n duration: number = 0;\r\n\r\n init(operationData: TOperationData) {\r\n this.selectedElement = operationData.selectedElement;\r\n this.textElement = operationData.textElement;\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n this.eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.TIME,\r\n this._positionUpdateHandler.bind(this)\r\n )\r\n );\r\n eventbus.broadcast(TimelineEventNames.DURATION_REQUEST, [\r\n (duration: number) => (this.duration = duration),\r\n ]);\r\n\r\n this.selectedElement?.css({'pointer-events': 'none'});\r\n\r\n const container = this.selectedElement?.parent();\r\n\r\n if (container) {\r\n const clickHandler = this._clickHandler.bind(this, eventbus);\r\n container.on('click', clickHandler);\r\n this.eventbusRemovers.push(() => container.off('click', clickHandler));\r\n }\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.eventbusRemovers.forEach((func: () => void) => {\r\n func();\r\n });\r\n }\r\n\r\n private _positionUpdateHandler(position: number) {\r\n const percentage = (100 / this.duration) * position;\r\n this.selectedElement?.css('width', `${percentage}%`);\r\n this.textElement?.text(`${Math.floor(percentage)}%`);\r\n }\r\n\r\n private _clickHandler(eventbus: IEventbus, event: any) {\r\n const element = event.target as HTMLElement;\r\n const rect = element.getBoundingClientRect();\r\n\r\n const x = event.clientX - rect.left; //x position within the element.\r\n\r\n const percentage = (100 / rect.width) * x;\r\n\r\n eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [\r\n Math.round((this.duration / 100) * percentage),\r\n ]);\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { IController } from './types';\r\n\r\nexport interface IRoutingControllerOperationData {\r\n json: any;\r\n}\r\n\r\n/**\r\n * This is a work in progress, do not use this yet please....\r\n */\r\nexport class RoutingController\r\n implements IController<IRoutingControllerOperationData>\r\n{\r\n name = 'RoutingController';\r\n navLookup: Record<string, any> = {};\r\n navVidIdLookup: Record<string, any> = {};\r\n navigation: any = null;\r\n eventhandlers: TEventbusRemover[] = [];\r\n eventbus: IEventbus | null = null;\r\n\r\n constructor() {}\r\n\r\n init(operationData: TOperationData) {\r\n this.navigation = this._buildNavigationData(operationData.json);\r\n }\r\n\r\n attach(eventbus: IEventbus) {\r\n this.eventhandlers.push(\r\n eventbus.on(\r\n 'before-request-video-url',\r\n this._handleBeforeRequestVideoUrl.bind(this)\r\n )\r\n );\r\n this.eventhandlers.push(\r\n eventbus.on('push-history-state', this._handlePushHistoryState.bind(this))\r\n );\r\n this.eventbus = eventbus;\r\n window.onpopstate = this._handlePopstate.bind(this);\r\n\r\n const navId = this._getQueryVariable(0);\r\n if (navId) {\r\n const nav = this.navLookup[navId];\r\n const pos = +this._getQueryVariable(1);\r\n this.eventbus.broadcast('request-video-url', [\r\n nav.videoUrlIndex,\r\n pos,\r\n true,\r\n ]);\r\n } else {\r\n window.history.pushState(\r\n { navigationId: this.navigation[0].id },\r\n '',\r\n `#/${this.navigation[0].id}`\r\n );\r\n }\r\n }\r\n\r\n private _handlePopstate(event: any) {\r\n const navigationId = event.state\r\n ? event.state.navigationId\r\n : this.navigation[0].id;\r\n const position = event.state?.position ?? 0;\r\n const nav = this.navLookup[navigationId];\r\n this.eventbus?.broadcast('highlight-navigation', [nav.videoUrlIndex]);\r\n this.eventbus?.broadcast('request-video-url', [\r\n nav.videoUrlIndex,\r\n position,\r\n true,\r\n ]);\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n if (this.eventhandlers) {\r\n this.eventhandlers.forEach((handler) => {\r\n handler();\r\n });\r\n }\r\n this.eventbus = null;\r\n }\r\n\r\n private _handleBeforeRequestVideoUrl(\r\n _index: number,\r\n _requestedVideoPosition: number = 0,\r\n isHistoryRequest: boolean = false\r\n ) {\r\n isHistoryRequest =\r\n isHistoryRequest !== undefined ? isHistoryRequest : false;\r\n if (!isHistoryRequest) {\r\n const resultCallback = (item: any) => {\r\n this._pushState(item);\r\n };\r\n this.eventbus?.broadcast('request-current-navigation', [resultCallback]);\r\n }\r\n }\r\n\r\n private _getQueryVariable(variableIdx: number) {\r\n const href = window.location.href;\r\n const hashIndex = href.indexOf('#');\r\n if (hashIndex > -1) {\r\n const query = href.substring(hashIndex + 2);\r\n if (query) {\r\n const vars = query.split('/');\r\n return vars[variableIdx];\r\n }\r\n }\r\n return '';\r\n }\r\n\r\n private _handlePushHistoryState(state: any) {\r\n this._pushState(state);\r\n }\r\n\r\n private _pushState(state: any) {\r\n if (state && state.navigationData && state.navigationData.visible) {\r\n let currentPosition = state.position !== undefined ? state.position : -1;\r\n if (currentPosition < 0) {\r\n const resultCallback = (position: number) => {\r\n currentPosition = position > 3 ? position - 3 : 0;\r\n };\r\n this.eventbus?.broadcast('request-current-video-position', [\r\n resultCallback,\r\n ]);\r\n }\r\n\r\n const currentState = window.history.state;\r\n if (\r\n currentState &&\r\n currentState.navigationId !== state.navigationData.id\r\n ) {\r\n window.history.pushState(\r\n { navigationId: state.navigationData.id, position: currentPosition },\r\n state.title,\r\n `#/${state.navigationData.id}/${currentPosition}`\r\n );\r\n } else if (\r\n currentState &&\r\n currentState.navigationId === state.navigationData.id\r\n ) {\r\n window.history.replaceState(\r\n {\r\n navigationId: currentState.navigationId,\r\n position: currentPosition,\r\n },\r\n state.title,\r\n `#/${currentState.navigationId}/${currentPosition}`\r\n );\r\n } else {\r\n window.history.pushState(\r\n { navigationId: state.navigationData.id, position: currentPosition },\r\n state.title,\r\n `#/${state.navigationData.id}/${currentPosition}`\r\n );\r\n }\r\n window.document.title = state.title;\r\n }\r\n }\r\n\r\n private _buildNavigationData(data: any) {\r\n const result: any[] = [];\r\n data.navigationData.forEach((nav: any, index: any) => {\r\n this.navLookup[nav.id] = nav;\r\n this.navVidIdLookup[nav.videoUrlIndex] = nav;\r\n nav.previous = data.navigationData[index - 1];\r\n });\r\n\r\n data.navigationData.forEach((nav: any, index: number) => {\r\n if (nav.nextId) {\r\n nav.next = this.navLookup[nav.nextId];\r\n delete nav.nextId;\r\n } else {\r\n nav.next = data.navigationData[index + 1];\r\n }\r\n });\r\n\r\n data.roots.forEach((id: string) => {\r\n const nav = this.navLookup[id];\r\n if (nav.children) {\r\n nav.children = nav.children.map((childId: string) => {\r\n return this.navLookup[childId];\r\n });\r\n }\r\n result.push(nav);\r\n });\r\n return result;\r\n }\r\n}\r\n","import { IEventbus, TEventbusRemover } from '../eventbus/types';\r\nimport { TOperationData } from '../operation/types';\r\nimport { TimelineEventNames } from '../timeline-event-names';\r\nimport { IController } from './types';\r\n\r\nexport interface ISubtitlesControllerOperationData {\r\n selectedElement: JQuery;\r\n language: string;\r\n subtitleData: any;\r\n}\r\n\r\nexport class SubtitlesController\r\n implements IController<ISubtitlesControllerOperationData>\r\n{\r\n actionLookup: Record<string, any> = {};\r\n currentLanguage: string | null = null;\r\n lastFunc: Function | null = null;\r\n name = 'SubtitlesController';\r\n\r\n attach(eventbus: IEventbus) {\r\n const detachTime = eventbus.on(\r\n TimelineEventNames.TIME,\r\n this.onTimeHandler.bind(this)\r\n );\r\n const detachSeek = eventbus.on(\r\n TimelineEventNames.SEEKED,\r\n this.onSeekedHandler.bind(this)\r\n );\r\n const detachLangChange = eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this.languageChangeHandler.bind(this)\r\n );\r\n this.internalDetach = this.internalDetach.bind(this, [\r\n detachTime,\r\n detachLangChange,\r\n detachSeek,\r\n ]);\r\n }\r\n\r\n detach(_eventbus: IEventbus) {\r\n this.internalDetach();\r\n }\r\n\r\n internalDetach(detachMethods?: TEventbusRemover[]) {\r\n if (detachMethods) {\r\n detachMethods.forEach((f) => {\r\n f();\r\n });\r\n }\r\n }\r\n\r\n languageChangeHandler(newLanguage: string) {\r\n this.currentLanguage = newLanguage;\r\n if (this.lastFunc) {\r\n this.lastFunc();\r\n }\r\n }\r\n\r\n removeTitle(container?: JQuery) {\r\n container?.empty();\r\n this.lastFunc = null;\r\n }\r\n\r\n onTimeHandler(position: number) {\r\n const func = this.actionLookup[position];\r\n if (func) {\r\n func();\r\n this.lastFunc = func;\r\n }\r\n }\r\n\r\n onSeekedHandler(arg: any) {\r\n let position = arg.position;\r\n let func = this.actionLookup[position];\r\n while (!func && --position >= 0) {\r\n func = this.actionLookup[position];\r\n }\r\n if (func) {\r\n func();\r\n this.lastFunc = func;\r\n } else {\r\n this.removeTitle();\r\n }\r\n }\r\n\r\n setTitle(container: JQuery, titleLanguageLookup: Record<string, string>) {\r\n if (this.currentLanguage) {\r\n container.html(titleLanguageLookup[this.currentLanguage]);\r\n }\r\n }\r\n\r\n createActionLookup(operationData: TOperationData, container: JQuery) {\r\n const subtitleData = operationData.subtitleData;\r\n const titles = subtitleData[0].titles;\r\n const subtitleTimeLookup: Record<number, () => void> = {};\r\n\r\n for (let i = 0, ii = titles.length; i < ii; i++) {\r\n const titleLanguageLookup: Record<string, string> = {};\r\n\r\n for (let j = 0, jj = subtitleData.length; j < jj; j++) {\r\n const subs = subtitleData[j];\r\n titleLanguageLookup[subs.lang] = subs.titles[i].text;\r\n }\r\n\r\n subtitleTimeLookup[titles[i].duration.start] = this.setTitle.bind(\r\n this,\r\n container,\r\n titleLanguageLookup\r\n );\r\n subtitleTimeLookup[titles[i].duration.end] = this.removeTitle;\r\n }\r\n\r\n return subtitleTimeLookup;\r\n }\r\n\r\n init(operationData: ISubtitlesControllerOperationData) {\r\n const container = operationData.selectedElement;\r\n this.removeTitle = this.removeTitle.bind(this, container);\r\n this.currentLanguage = operationData.language;\r\n this.actionLookup = this.createActionLookup(operationData, container);\r\n }\r\n}\r\n","import { IAddClassOperationData } from '../../operation/add-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction addClass(): IOperationMetadata<IAddClassOperationData> {\r\n return {\r\n description: 'Add a class to the selected element.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default addClass;\r\n","import { IAddControllerToElementOperationData } from '../../operation/add-controller-to-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction addControllerToElement(): IOperationMetadata<\r\n IAddControllerToElementOperationData\r\n> {\r\n return {\r\n description: 'Adds the current controller to the selected element(s)',\r\n dependentProperties: ['selectedElement', 'controllerInstance'],\r\n };\r\n}\r\nexport default addControllerToElement;\r\n","import { IAnimateOperationData } from '../../operation/animate';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction animate(): IOperationMetadata<IAnimateOperationData> {\r\n return {\r\n description:\r\n 'Animates the selected element with the given animation settings.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n animationEasing: 'ParameterType:boolean',\r\n animationProperties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n animationDuration: {\r\n type: 'ParameterType:number',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default animate;\r\n","import { IAnimateWithClassOperationData } from '../../operation/animate-with-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction animateWithClass(): IOperationMetadata<\r\n IAnimateWithClassOperationData\r\n> {\r\n return {\r\n description:\r\n 'Animates the selected element by adding the given animation class.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n removeClass: 'ParameterType:boolean',\r\n },\r\n };\r\n}\r\nexport default animateWithClass;\r\n","import { IBroadcastEventOperationData } from '../../operation/broadcast-event';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction broadcastEvent(): IOperationMetadata<IBroadcastEventOperationData> {\r\n return {\r\n description:\r\n 'Broadcasts an eventbus event with the given type, topic and optional arguments',\r\n properties: {\r\n eventArgs: 'ParameterType:array',\r\n eventTopic: 'ParameterType:eventTopic',\r\n eventName: {\r\n type: 'ParameterType:eventName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default broadcastEvent;\r\n","import { ICalcOperationData } from '../calc';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction calc(): IOperationMetadata<ICalcOperationData> {\r\n return {\r\n description:\r\n 'Calculates the given left and right hand sides using the specified operator',\r\n properties: {\r\n left: {\r\n type: 'ParameterType:number',\r\n description: 'The left operand',\r\n required: true,\r\n },\r\n right: {\r\n type: 'ParameterType:number',\r\n description: 'The right operand',\r\n required: true,\r\n },\r\n operator: [\r\n {\r\n value: '+',\r\n description: 'Adds the left and right operands',\r\n },\r\n {\r\n value: '-',\r\n description: 'Subtracts the left and right operands',\r\n },\r\n {\r\n value: '*',\r\n description: 'Multiplies the left and right operands',\r\n },\r\n {\r\n value: '/',\r\n description: 'Divides the left and right operands',\r\n },\r\n {\r\n value: '%',\r\n description:\r\n 'Returns the remainder left over after the left number is divided into a number of integer portions equal to the right number',\r\n },\r\n {\r\n value: '**',\r\n description:\r\n 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.',\r\n },\r\n ],\r\n },\r\n outputProperties: {\r\n calculationResult: 'ParameterType:number',\r\n },\r\n };\r\n}\r\n\r\nexport default calc;\r\n","import { IClearElementOperationData } from '../../operation/clear-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction clearElement(): IOperationMetadata<IClearElementOperationData> {\r\n return {\r\n description: 'clears the given element',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\n\r\nexport default clearElement;\r\n","import { IClearOperationDataOperationData } from '../../operation/clear-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction clearOperationData(): IOperationMetadata<\r\n IClearOperationDataOperationData\r\n> {\r\n return {\r\n description: 'clears the current operation data',\r\n properties: {\r\n properties: 'ParameterType:array',\r\n },\r\n };\r\n}\r\nexport default clearOperationData;\r\n","import { ICreateElementOperationData } from '../../operation/create-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction createElement(): IOperationMetadata<ICreateElementOperationData<any>> {\r\n return {\r\n description:\r\n 'Creates an HTML element with the given name and optionally adds the given attributes',\r\n properties: {\r\n elementName: {\r\n type: 'ParameterType:htmlElementName',\r\n required: true,\r\n },\r\n attributes: 'ParameterType:object',\r\n text: 'ParameterType:string',\r\n },\r\n outputProperties: {\r\n template: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default createElement;\r\n","import { ICustomFunctionOperationData } from '../../operation/custom-function';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction customFunction(): IOperationMetadata<ICustomFunctionOperationData> {\r\n return {\r\n description: 'Executes the specified custom function',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:systemName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default customFunction;\r\n","import { IEndActionOperationData } from '../../operation/end-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction endAction(): IOperationMetadata<IEndActionOperationData> {\r\n return {\r\n description: 'Ends the current action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default endAction;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction endLoop(): IOperationMetadata<never> {\r\n return {\r\n description: 'Ends the current loop',\r\n };\r\n}\r\n\r\nexport default endLoop;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction endWhen(): IOperationMetadata<never> {\r\n return {\r\n description: 'Ends the current when block',\r\n };\r\n}\r\n\r\nexport default endWhen;\r\n","import { IExtendControllerOperationData } from '../../operation/extend-controller';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction extendController(): IOperationMetadata<\r\n IExtendControllerOperationData\r\n> {\r\n return {\r\n description: 'Extends the current controller',\r\n dependentProperties: ['controllerInstance'],\r\n properties: {\r\n controllerExtension: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default extendController;\r\n","import { IGetAttributesFromElementOperationData } from '../get-attributes-from-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getAttributesFromElement(): IOperationMetadata<IGetAttributesFromElementOperationData> {\r\n return {\r\n description:\r\n 'Retrieves the values for the specified attribute names from the given selected element.',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n attributeNames: {\r\n type: 'ParameterType:array',\r\n itemType: 'ParameterType:string',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n attributeValues: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getAttributesFromElement;\r\n","import { IGetControllerFromElementOperationData } from '../../operation/get-controller-from-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getControllerFromElement(): IOperationMetadata<\r\n IGetControllerFromElementOperationData\r\n> {\r\n return {\r\n description: 'Retrieves the specified controller from the current element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n controllerName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n controllerInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getControllerFromElement;\r\n","import { IGetControllerInstanceOperationData } from '../../operation/get-controller-instance';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getControllerInstance(): IOperationMetadata<\r\n IGetControllerInstanceOperationData\r\n> {\r\n return {\r\n description: 'Retrieves an instance of the specified controller',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n controllerInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getControllerInstance;\r\n","import { IGetElementDimensionsOperationData } from '../../operation/get-element-dimensions';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getElementDimensions(): IOperationMetadata<\r\n IGetElementDimensionsOperationData\r\n> {\r\n return {\r\n description: 'Calculates the dimensions for the current element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n modifier: 'ParameterType:dimensionsModifier',\r\n },\r\n outputProperties: {\r\n dimensions: 'ParameterType:dimensions',\r\n },\r\n };\r\n}\r\nexport default getElementDimensions;\r\n","import { IGetImportOperationData } from '../../operation/get-import';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getImport(): IOperationMetadata<IGetImportOperationData> {\r\n return {\r\n description:\r\n 'Retrieves a javascript import specified by the given system name',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:systemName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n importedInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getImport;\r\n","import { IGetQueryParamsOperationData } from '../get-query-params';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData> {\r\n return {\r\n description:\r\n \"Retrieves the current query parameters from the browser's address bar\",\r\n outputProperties: {\r\n queryParams: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default getQueryParams;\r\n","import { IInvokeObjectMethodOperationData } from '../invoke-object-method';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData> {\r\n return {\r\n description:\r\n 'Invokes the specified method on the given object with the optional specified arguments',\r\n properties: {\r\n instance: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n methodName: {\r\n type: 'ParameterType:string',\r\n required: true,\r\n },\r\n methodArguments: 'ParameterType:array',\r\n },\r\n outputProperties: {\r\n methodResult: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default invokeObjectMethod;\r\n","import { ILoadJSONOperationData } from '../../operation/load-json';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction loadJSON(): IOperationMetadata<ILoadJSONOperationData> {\r\n return {\r\n description: 'Load JSON from the given url',\r\n properties: {\r\n url: {\r\n type: 'ParameterType:url',\r\n required: true,\r\n },\r\n cache: 'ParameterType:boolean',\r\n },\r\n outputProperties: {\r\n json: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default loadJSON;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction log(): IOperationMetadata<never> {\r\n return {\r\n description: 'Logs the current context and operation data to the console',\r\n };\r\n}\r\n\r\nexport default log;\r\n","import { isFunction } from '../../util/guards/is-function';\r\nimport { IMathOperationData } from '../math';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction math(): IOperationMetadata<IMathOperationData> {\r\n return {\r\n description:\r\n 'This operation performs the given math function of the specified arguments.',\r\n properties: {\r\n args: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n functionName: createMathFunctionNames(),\r\n mathResult: 'ParameterType:number',\r\n },\r\n };\r\n}\r\n\r\nfunction createMathFunctionNames() {\r\n return Object.getOwnPropertyNames(Math)\r\n .filter((x) => isFunction(Math[x as keyof Math]))\r\n .map((functionName) => ({\r\n value: functionName,\r\n }));\r\n}\r\n\r\nexport default math;\r\n","import { IOperationMetadata } from './types';\r\n\r\nfunction otherwise(): IOperationMetadata<never> {\r\n return {\r\n description: 'Inverts the control flow for `when` logic',\r\n };\r\n}\r\n\r\nexport default otherwise;\r\n","import { IRemoveClassOperationData } from '../../operation/remove-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeClass(): IOperationMetadata<IRemoveClassOperationData> {\r\n return {\r\n description: 'Removes the specified class from the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default removeClass;\r\n","import { IRemoveControllerFromElementOperationData } from '../../operation/remove-controller-from-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeControllerFromElement(): IOperationMetadata<\r\n IRemoveControllerFromElementOperationData\r\n> {\r\n return {\r\n description: 'Removes the specified controller from the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n controllerName: {\r\n type: 'ParameterType:controllerName',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default removeControllerFromElement;\r\n","import { IRemoveElementOperationData } from '../../operation/remove-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removeElement(): IOperationMetadata<IRemoveElementOperationData> {\r\n return {\r\n description: 'Removes the selected element from the DOM',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\nexport default removeElement;\r\n","import { IRemovePropertiesFromOperationDataOperationData } from '../../operation/remove-properties-from-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction removePropertiesFromOperationData(): IOperationMetadata<\r\n IRemovePropertiesFromOperationDataOperationData\r\n> {\r\n return {\r\n description:\r\n 'Removes the specified properties from the current operation data',\r\n properties: {\r\n propertyNames: 'ParameterType:array',\r\n },\r\n };\r\n}\r\nexport default removePropertiesFromOperationData;\r\n","import { IReparentElementOperationData } from '../../operation/reparent-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction reparentElement(): IOperationMetadata<IReparentElementOperationData> {\r\n return {\r\n description:\r\n 'Moves the selected element to the new location described by the given selector',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n newParentSelector: {\r\n type: 'ParameterType:selector',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default reparentElement;\r\n","import { IRequestActionOperationData } from '../../operation/request-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction requestAction(): IOperationMetadata<IRequestActionOperationData> {\r\n return {\r\n description: 'Retrieves an instance of the specified action',\r\n properties: {\r\n systemName: {\r\n type: 'ParameterType:actionName',\r\n required: true,\r\n },\r\n },\r\n outputProperties: {\r\n actionInstance: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default requestAction;\r\n","import { IResizeActionOperationData } from '../../operation/resize-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction resizeAction(): IOperationMetadata<IResizeActionOperationData> {\r\n return {\r\n description: 'Triggers a resize on the current action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default resizeAction;\r\n","import { ISelectElementOperationData } from '../../operation/select-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction selectElement(): IOperationMetadata<ISelectElementOperationData> {\r\n return {\r\n description: 'Selects an element using the given selector',\r\n properties: {\r\n selector: {\r\n type: 'ParameterType:selector',\r\n required: true,\r\n },\r\n useSelectedElementAsRoot: 'ParameterType:boolean',\r\n },\r\n outputProperties: {\r\n selectedElement: 'ParameterType:jQuery',\r\n },\r\n };\r\n}\r\nexport default selectElement;\r\n","import { ISetDataOperationData } from '../set-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setData(): IOperationMetadata<ISetDataOperationData> {\r\n return {\r\n description: 'Copies the specified values to the specified targets',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default setData;\r\n","import { ISetElementAttributesOperationData } from '../../operation/set-element-attributes';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setElementAttributes(): IOperationMetadata<\r\n ISetElementAttributesOperationData\r\n> {\r\n return {\r\n description: 'Sets the given attributes on the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n attributes: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default setElementAttributes;\r\n","import { ISetElementContentOperationData } from '../../operation/set-element-content';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setElementContent(): IOperationMetadata<\r\n ISetElementContentOperationData\r\n> {\r\n return {\r\n description: 'Sets the given HTML content in the selected element',\r\n dependentProperties: ['selectedElement', 'template'],\r\n properties: {\r\n insertionType: [\r\n {\r\n value: 'overwrite',\r\n description:\r\n 'the contents of the selected element are replaced by the given template',\r\n default: true,\r\n },\r\n {\r\n value: 'append',\r\n description:\r\n 'the new content will be inserted after the current content',\r\n },\r\n {\r\n value: 'prepend',\r\n description:\r\n 'the new content will be inserted before the current content',\r\n },\r\n ],\r\n },\r\n };\r\n}\r\nexport default setElementContent;\r\n","import { ISetGlobalDataOperationData } from '../set-global-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setGlobalData(): IOperationMetadata<ISetGlobalDataOperationData> {\r\n return {\r\n description:\r\n 'Copies the specified values from the operationData to the global data',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default setGlobalData;\r\n","import { ISetOperationData } from '../../operation/set-operation-data';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setOperationData(): IOperationMetadata<ISetOperationData> {\r\n return {\r\n description: 'Sets the given properties on the current operation data',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n override: 'ParameterType:boolean',\r\n },\r\n };\r\n}\r\nexport default setOperationData;\r\n","import { ISetStyleOperationData } from '../../operation/set-style';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction setStyle(): IOperationMetadata<ISetStyleOperationData> {\r\n return {\r\n description: 'Sets the given style properties on the selected element',\r\n properties: {\r\n properties: {\r\n type: 'ParameterType:object',\r\n required: true,\r\n },\r\n selectedElement: 'ParameterType:jQuery',\r\n },\r\n };\r\n}\r\n\r\nexport default setStyle;\r\n","import { IStartActionOperationData } from '../../operation/start-action';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction startAction(): IOperationMetadata<IStartActionOperationData> {\r\n return {\r\n description: 'Starts the selected action',\r\n dependentProperties: ['actionInstance'],\r\n properties: {\r\n actionOperationData: 'ParameterType:object',\r\n },\r\n };\r\n}\r\nexport default startAction;\r\n","import { IStartLoopOperationData } from '../../operation/start-loop';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction startLoop(): IOperationMetadata<IStartLoopOperationData> {\r\n return {\r\n description: 'Starts a loop over the given collection',\r\n properties: {\r\n collection: {\r\n type: 'ParameterType:array',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\n\r\nexport default startLoop;\r\n","import { IToggleClassOperationData } from '../../operation/toggle-class';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction toggleClass(): IOperationMetadata<IToggleClassOperationData> {\r\n return {\r\n description: 'Toggles the given class on the selected element',\r\n dependentProperties: ['selectedElement'],\r\n properties: {\r\n className: {\r\n type: 'ParameterType:className',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default toggleClass;\r\n","import { IToggleElementOperationData } from '../../operation/toggle-element';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction toggleElement(): IOperationMetadata<IToggleElementOperationData> {\r\n return {\r\n description: 'Toggles the selected element',\r\n dependentProperties: ['selectedElement'],\r\n };\r\n}\r\nexport default toggleElement;\r\n","import { IWaitOperationData } from '../../operation/wait';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction wait(): IOperationMetadata<IWaitOperationData> {\r\n return {\r\n description:\r\n 'Waits the given amount of milliseconds before the action continues',\r\n properties: {\r\n milliseconds: {\r\n type: 'ParameterType:number',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default wait;\r\n","import { IWhenOperationData } from '../../operation/when';\r\nimport { IOperationMetadata } from './types';\r\n\r\nfunction wait(): IOperationMetadata<IWhenOperationData> {\r\n return {\r\n description:\r\n 'Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true',\r\n properties: {\r\n expression: {\r\n type: 'ParameterType:expression',\r\n required: true,\r\n },\r\n },\r\n };\r\n}\r\nexport default wait;\r\n","import * as controllers from '../../controllers';\r\nimport * as operations from '../../operation';\r\nimport * as operationMetadata from '../../operation/metadata';\r\nimport { IOperationMetadata } from '../../operation/metadata/types';\r\nimport { TimelineEventNames } from '../../timeline-event-names';\r\n\r\nexport class OperationNamesProvider {\r\n getOperationNames() {\r\n return Object.keys(operations);\r\n }\r\n}\r\n\r\nexport class ControllerNamesProvider {\r\n getControllerNames() {\r\n return Object.keys(controllers);\r\n }\r\n}\r\n\r\nexport class OperationMetadataProvider {\r\n getOperationMetadata(operationName: string) {\r\n const getMetadata = ((operationMetadata as any) as Record<\r\n string,\r\n () => IOperationMetadata<any>\r\n >)[operationName];\r\n if (!getMetadata) {\r\n throw new Error(\r\n `Could not find metadata for operation called ${operationName}`\r\n );\r\n }\r\n return getMetadata();\r\n }\r\n}\r\n\r\nexport class TimeLineEventNamesProvider {\r\n getEventNames() {\r\n return Object.values(TimelineEventNames);\r\n }\r\n}\r\n","import { isDefined } from 'ts-is-present';\r\nimport { Action, EndableAction, TimelineAction } from '../action';\r\nimport { IAction } from '../action/types';\r\nimport { ActionRegistryEventbusListener } from '../eventbus';\r\nimport { IEventbus } from '../eventbus/types';\r\nimport { deepCopy } from '../operation/helper/deep-copy';\r\nimport { resolvePropertyChain } from '../operation/helper/resolve-property-chain';\r\nimport { IConfigurationResolver, ISimpleResourceImporter } from '../types';\r\nimport { isObject } from '../util/guards/is-object';\r\nimport { isString } from '../util/guards/is-string';\r\nimport {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IEventActionConfiguration,\r\n IOperationConfiguration,\r\n IResolvedActionConfiguration,\r\n IResolvedEndableActionConfiguration,\r\n IResolvedEngineConfiguration,\r\n IResolvedOperation,\r\n IResolvedTimelineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration,\r\n} from './types';\r\n\r\n/**\r\n * Takes an `IEngineConfiguration` instance and return an `IResolvedEngineConfiguration`.\r\n * This means all system names within the configuration will be resolved to their associated instances.\r\n *\r\n * If the given configuration includes event actions, then those will be registered in the given `ActionRegistryEventbusListener`.\r\n *\r\n */\r\nexport class ConfigurationResolver implements IConfigurationResolver {\r\n constructor(\r\n private importer: ISimpleResourceImporter,\r\n private eventbus: IEventbus\r\n ) {}\r\n\r\n process(\r\n configuration: IEngineConfiguration,\r\n actionRegistryListener?: ActionRegistryEventbusListener\r\n ): [Record<string, IAction>, IResolvedEngineConfiguration] {\r\n resolvePlaceholders(configuration, configuration, this.importer);\r\n\r\n if (!isDefined(configuration.timelineProviderSettings)) {\r\n throw new Error(\r\n 'Configuration incomplete: it needs to have at least one timeline provider setting'\r\n );\r\n }\r\n\r\n const resolvedConfig: IResolvedEngineConfiguration = {\r\n id: configuration.id,\r\n engine: { ...configuration.engine },\r\n timelineProviderSettings: deepCopy(\r\n configuration.timelineProviderSettings\r\n ),\r\n containerSelector: configuration.containerSelector,\r\n language: configuration.language,\r\n layoutTemplate: configuration.layoutTemplate,\r\n availableLanguages: deepCopy(configuration.availableLanguages),\r\n actions: resolveActions(\r\n configuration.actions,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n initActions: resolveActions(\r\n configuration.initActions,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n labels: deepCopy(configuration.labels),\r\n timelineFlow: deepCopy(configuration.timelineFlow),\r\n timelines: resolveTimelines(\r\n configuration.timelines,\r\n this.importer,\r\n this.eventbus\r\n ),\r\n };\r\n\r\n let eventActions: IAction[] = [];\r\n if (configuration.eventActions?.length && actionRegistryListener) {\r\n eventActions = resolveEventActions(\r\n configuration.eventActions,\r\n actionRegistryListener,\r\n this.importer,\r\n this.eventbus\r\n );\r\n }\r\n\r\n const actionsLookup = (resolvedConfig.actions as IAction[])\r\n .concat(eventActions)\r\n .reduce<Record<string, IAction>>(\r\n (aggr, action) => ({\r\n ...aggr,\r\n [action.name]: action,\r\n }),\r\n {}\r\n );\r\n\r\n return [actionsLookup, resolvedConfig];\r\n }\r\n}\r\n\r\nfunction resolveEventActions(\r\n eventActionConfigurations: IEventActionConfiguration[],\r\n actionRegistryListener: ActionRegistryEventbusListener,\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolvedConfigs =\r\n eventActionConfigurations.map<IResolvedActionConfiguration>((config) =>\r\n resolveActionConfiguration(config, importer)\r\n );\r\n\r\n return resolvedConfigs.map((config, index) => {\r\n const { eventName, eventTopic } = eventActionConfigurations[index];\r\n const eventAction = new Action(\r\n config.name,\r\n config.startOperations,\r\n eventbus\r\n );\r\n actionRegistryListener.registerAction(eventAction, eventName, eventTopic);\r\n return eventAction;\r\n });\r\n}\r\n\r\nfunction resolveTimelines(\r\n timelines: ITimelineConfiguration[],\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolve = resolveTimelineAction.bind(null, importer, eventbus);\r\n\r\n return timelines.map<IResolvedTimelineConfiguration>((config) => ({\r\n ...config,\r\n timelineActions: config.timelineActions.map(resolve),\r\n }));\r\n}\r\n\r\nfunction resolveOperation(\r\n importer: ISimpleResourceImporter,\r\n operationConfig: IOperationConfiguration\r\n): IResolvedOperation {\r\n return {\r\n id: operationConfig.id,\r\n systemName: operationConfig.systemName,\r\n operationData: deepCopy(operationConfig.operationData) ?? {},\r\n instance: importer.import(operationConfig.systemName)[\r\n operationConfig.systemName\r\n ],\r\n };\r\n}\r\n\r\nfunction resolveActionConfiguration(\r\n config: IActionConfiguration,\r\n importer: ISimpleResourceImporter\r\n): IResolvedActionConfiguration {\r\n const resolve = resolveOperation.bind(null, importer);\r\n\r\n return {\r\n id: config.id,\r\n name: config.name,\r\n startOperations: config.startOperations.map(resolve),\r\n };\r\n}\r\n\r\nfunction resolveEndableActionConfiguration(\r\n config: IEndableActionConfiguration,\r\n importer: ISimpleResourceImporter\r\n): IResolvedEndableActionConfiguration {\r\n const resolve = resolveOperation.bind(null, importer);\r\n\r\n const action = resolveActionConfiguration(config, importer);\r\n\r\n return {\r\n ...action,\r\n endOperations: config.endOperations.map(resolve),\r\n };\r\n}\r\n\r\nfunction resolveTimelineAction(\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus,\r\n actionConfiguration: ITimelineActionConfiguration\r\n) {\r\n const resolvedConfig = resolveEndableActionConfiguration(\r\n actionConfiguration,\r\n importer\r\n );\r\n const duration = {\r\n end: actionConfiguration.duration.end ?? -1,\r\n start: actionConfiguration.duration.start,\r\n };\r\n\r\n const { id, name, endOperations, startOperations } = resolvedConfig;\r\n const action = new TimelineAction(\r\n name,\r\n startOperations,\r\n endOperations,\r\n duration,\r\n eventbus\r\n );\r\n action.id = id;\r\n return action;\r\n}\r\n\r\nfunction resolveActions(\r\n actionConfigurations: IEndableActionConfiguration[],\r\n importer: ISimpleResourceImporter,\r\n eventbus: IEventbus\r\n) {\r\n const resolvedConfigs =\r\n actionConfigurations.map<IResolvedEndableActionConfiguration>((config) => {\r\n return resolveEndableActionConfiguration(config, importer);\r\n });\r\n\r\n return resolvedConfigs.map<EndableAction>((resolvedConfig) => {\r\n const { name, endOperations, startOperations } = resolvedConfig;\r\n const action = new EndableAction(\r\n name,\r\n startOperations,\r\n endOperations,\r\n eventbus\r\n );\r\n action.id = resolvedConfig.id;\r\n return action;\r\n });\r\n}\r\n\r\nfunction resolvePlaceholders(\r\n configFragment: Record<string, any> | any[],\r\n rootConfig: any,\r\n importer: ISimpleResourceImporter\r\n) {\r\n if (!isDefined(configFragment)) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(configFragment)) {\r\n configFragment.forEach((item) => {\r\n resolvePlaceholders(item, rootConfig, importer);\r\n });\r\n } else {\r\n Object.keys(configFragment).forEach((key) => {\r\n resolvePlaceholder(key, configFragment, rootConfig, importer);\r\n });\r\n }\r\n}\r\n\r\nfunction resolvePlaceholder(\r\n key: string,\r\n configFragment: any,\r\n rootConfig: any,\r\n importer: ISimpleResourceImporter\r\n) {\r\n const configValue = configFragment[key];\r\n if (isString(configValue)) {\r\n if (configValue.startsWith('config:')) {\r\n const configProperty = configValue.substring(7, configValue.length);\r\n configFragment[key] = resolvePropertyChain(configProperty, rootConfig);\r\n } else if (configValue.startsWith('template:')) {\r\n const templateKey = configValue.substring(9, configValue.length);\r\n const template = importer.import(templateKey)[templateKey];\r\n configFragment[key] = template;\r\n } else if (configValue.startsWith('json:')) {\r\n const jsonKey = configValue.substring(5, configValue.length);\r\n const json = importer.import(jsonKey)[jsonKey];\r\n configFragment[key] = json;\r\n }\r\n } else if (isObject(configValue)) {\r\n resolvePlaceholders(configValue, rootConfig, importer);\r\n }\r\n}\r\n","import { getPropertyChainValue } from './get-property-chain-value';\r\n\r\n/**\r\n * Gets the value for the given property chain. A property chain is defined by a period delimited string.\r\n *\r\n * For example, this property chain: `mySource.subSource.element.value` should be extracted from an object of this shape:\r\n * ```ts\r\n * const foo = {\r\n * mySource: {\r\n * subSource: {\r\n * element: {\r\n * value: 'bar'\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * The result of the invocation `resolvePropertyChain('mySource.subSource.element.value', foo)` would then yield the value `bar`.\r\n *\r\n * @param propertyChain the specified property chain\r\n * @param sourceObject the given source object\r\n * @returns\r\n */\r\nexport function resolvePropertyChain(propertyChain: string, sourceObject: any) {\r\n const properties = propertyChain.split('.');\r\n return getPropertyChainValue(properties, sourceObject);\r\n}\r\n","import $ from 'jquery';\r\nimport { IEndableAction, ITimelineAction } from './action/types';\r\nimport { IResolvedEngineConfiguration } from './configuration/types';\r\nimport { IEventbus, TEventbusRemover, TEventHandler } from './eventbus/types';\r\nimport { LanguageManager } from './language-manager';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport { ITimelineProvider } from './timelineproviders/types';\r\nimport {\r\n IEligiusEngine,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types';\r\n\r\ntype ActionMethod =\r\n | (IEndableAction['start'] & ActionMethodMetadata)\r\n | (IEndableAction['end'] & ActionMethodMetadata);\r\n\r\ninterface ActionMethodMetadata {\r\n id: string;\r\n isStart: boolean;\r\n startPosition?: number;\r\n}\r\n\r\n/**\r\n * This is where the magic happens. The engine is responsible for starting and stopping\r\n * the given timeline provider and triggering the actions associated with the positions along the timeline.\r\n */\r\nexport class EligiusEngine implements IEligiusEngine {\r\n private _timeLineActionsLookup: Record<\r\n string,\r\n Record<number, ActionMethod[]>\r\n > = {};\r\n private _eventbusRemovers: TEventbusRemover[] = [];\r\n private _currentTimelineUri: string = '';\r\n private _activeTimelineProvider: ITimelineProvider | undefined = undefined;\r\n private _lastPosition: number = -1;\r\n\r\n constructor(\r\n private configuration: IResolvedEngineConfiguration,\r\n private eventbus: IEventbus,\r\n private timelineProviders: Record<TimelineTypes, ITimelineProviderInfo>,\r\n private languageManager: LanguageManager\r\n ) {}\r\n\r\n /**\r\n * Initializes the engine by creating the HTML layout and the first time line\r\n * by executing its initActions.\r\n */\r\n init(): Promise<ITimelineProvider> {\r\n this._createLayoutTemplate();\r\n\r\n this._addEventbusListeners();\r\n\r\n const { timelines } = this.configuration;\r\n\r\n this._currentTimelineUri = timelines?.[0].uri ?? '';\r\n\r\n this._createTimelineLookup();\r\n\r\n return this._initializeTimelineProvider();\r\n }\r\n\r\n private _createLayoutTemplate() {\r\n const { containerSelector } = this.configuration;\r\n const container = $(containerSelector);\r\n\r\n if (!container || !container.length) {\r\n throw new Error(`Container selector not found: ${containerSelector}`);\r\n }\r\n\r\n const { layoutTemplate } = this.configuration;\r\n\r\n if (layoutTemplate && layoutTemplate.length) {\r\n container.html(layoutTemplate);\r\n } else {\r\n console.warn('layoutTemplate is empty, unable to create layout');\r\n }\r\n }\r\n\r\n private async _initializeTimelineProvider() {\r\n if (!this.configuration.timelines?.length) {\r\n throw new Error('No timelines present');\r\n }\r\n\r\n const firstTimeline = this.configuration.timelines[0];\r\n const providerSettings = this.timelineProviders[firstTimeline.type];\r\n\r\n if (!providerSettings) {\r\n throw new Error(\r\n `No timeline provider configured for type ${firstTimeline.type}`\r\n );\r\n }\r\n\r\n this._activeTimelineProvider?.destroy();\r\n this._activeTimelineProvider = providerSettings.provider;\r\n\r\n if (!this._activeTimelineProvider) {\r\n throw new Error('NO ACTIVE TIMELINE PROVIDER');\r\n }\r\n\r\n this._activeTimelineProvider.onTime(\r\n this._onTimeHandler.bind(this, Math.floor)\r\n );\r\n this._activeTimelineProvider.onComplete(\r\n this._onCompleteCallback.bind(this)\r\n );\r\n this._activeTimelineProvider.onFirstFrame(\r\n this._onFirstFrameCallback.bind(this)\r\n );\r\n this._activeTimelineProvider.onRestart(this._onRestartCallback.bind(this));\r\n\r\n await this._activeTimelineProvider.init();\r\n await this._executeActions(this.configuration.initActions, 'start');\r\n return this._activeTimelineProvider;\r\n }\r\n\r\n private _onCompleteCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.COMPLETE);\r\n }\r\n\r\n private _onFirstFrameCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);\r\n this.eventbus.broadcast(TimelineEventNames.DURATION, [\r\n this._activeTimelineProvider?.getDuration,\r\n ]);\r\n }\r\n\r\n private _onRestartCallback() {\r\n this.eventbus.broadcast(TimelineEventNames.RESTART);\r\n }\r\n\r\n private async _cleanUp() {\r\n await this._cleanUpTimeline();\r\n await this._executeActions(\r\n [...this.configuration.initActions].reverse(),\r\n 'end'\r\n );\r\n }\r\n\r\n /**\r\n * Cleans up all the necessary parts that the engine initialized.\r\n * - It ends the currently active operations and the init actions.\r\n * - It removes all its eventbus listeners, handlers and interceptors.\r\n * - It destroys all of its timeline providers\r\n * - It empties the HTML element indicated by the containerSelector configuration property.\r\n *\r\n */\r\n async destroy() {\r\n await this._cleanUp();\r\n\r\n this.languageManager.destroy();\r\n\r\n this._activeTimelineProvider = undefined;\r\n this._eventbusRemovers.forEach((remover) => remover());\r\n\r\n if (this.timelineProviders) {\r\n Object.values(this.timelineProviders).forEach((providerInfo) =>\r\n providerInfo.provider.destroy()\r\n );\r\n }\r\n\r\n const { containerSelector } = this.configuration;\r\n const container = $(containerSelector);\r\n container.empty();\r\n }\r\n\r\n private _addEventListener(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ) {\r\n this._eventbusRemovers.push(\r\n this.eventbus.on(eventName, eventHandler, eventTopic)\r\n );\r\n }\r\n\r\n private _addEventbusListeners() {\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_ENGINE_ROOT,\r\n this._handleRequestEngineRoot.bind(\r\n this,\r\n this.configuration.containerSelector\r\n )\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_TIMELINE_URI,\r\n this._handleRequestTimelineUri.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION,\r\n this._handleRequestTimelinePosition.bind(this, Math.floor)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_TIMELINE_CLEANUP,\r\n this._handleTimelineComplete.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.REQUEST_CURRENT_TIMELINE,\r\n this._requestCurrentTimeline.bind(this)\r\n );\r\n this._addEventListener(\r\n TimelineEventNames.PLAY_TOGGLE_REQUEST,\r\n this._toggleplay.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.PLAY_REQUEST,\r\n this._playRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.STOP_REQUEST,\r\n this._stopRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.PAUSE_REQUEST,\r\n this._pauseRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.CONTAINER_REQUEST,\r\n this.containerRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.DURATION_REQUEST,\r\n this.durationRequest.bind(this)\r\n );\r\n\r\n this._addEventListener(\r\n TimelineEventNames.SEEK_REQUEST,\r\n this.seekRequest.bind(this)\r\n );\r\n }\r\n\r\n private async seekRequest(offset: number) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n const seekPosition = Math.floor(offset);\r\n\r\n const duration = this._activeTimelineProvider.getDuration();\r\n const currentPosition = this._activeTimelineProvider.getPosition();\r\n\r\n if (seekPosition < 0 || seekPosition > duration) {\r\n return;\r\n }\r\n\r\n this.eventbus.broadcast(TimelineEventNames.SEEK, [\r\n seekPosition,\r\n currentPosition,\r\n duration,\r\n ]);\r\n\r\n await this._activeTimelineProvider.seek(seekPosition);\r\n await this._executeSeekActions(seekPosition);\r\n\r\n this.eventbus.broadcast(TimelineEventNames.SEEKED, [\r\n this._activeTimelineProvider.getPosition(),\r\n duration,\r\n ]);\r\n\r\n this.eventbus.broadcast(TimelineEventNames.TIME, [\r\n this._activeTimelineProvider.getPosition(),\r\n ]);\r\n\r\n if (this._activeTimelineProvider?.playState === 'running') {\r\n this._activeTimelineProvider?.start();\r\n }\r\n }\r\n\r\n private durationRequest(callBack: TResultCallback) {\r\n callBack(this._activeTimelineProvider?.getDuration());\r\n }\r\n\r\n private containerRequest(callBack: TResultCallback) {\r\n callBack(this._activeTimelineProvider?.getContainer());\r\n }\r\n\r\n private _pauseRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.pause();\r\n this.eventbus.broadcast(TimelineEventNames.PAUSE);\r\n }\r\n\r\n private _stopRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.stop();\r\n this.eventbus.broadcast(TimelineEventNames.STOP);\r\n }\r\n\r\n private _playRequest() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.start();\r\n this.eventbus.broadcast(TimelineEventNames.PLAY);\r\n }\r\n\r\n private _toggleplay() {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n if (this._activeTimelineProvider.playState === 'running') {\r\n this._activeTimelineProvider.start();\r\n } else {\r\n this._activeTimelineProvider.pause();\r\n }\r\n }\r\n\r\n private _createTimelineLookup() {\r\n if (!this.configuration.timelines) {\r\n return;\r\n }\r\n\r\n this.configuration.timelines.forEach((timelineInfo) => {\r\n timelineInfo.timelineActions.forEach(\r\n this._addTimelineActionStart.bind(this, timelineInfo.uri)\r\n );\r\n });\r\n\r\n this.configuration.timelines.forEach((timelineInfo) => {\r\n // actions ends need to be in reversed order, otherwise, for example,\r\n // elements that were created before dependent actions will already have been\r\n // removed in the end phase.\r\n timelineInfo.timelineActions.forEach(\r\n this._addTimelineActionEnd.bind(this, timelineInfo.uri)\r\n );\r\n });\r\n\r\n EligiusEngine.sortTimelines(Object.values(this._timeLineActionsLookup));\r\n }\r\n\r\n static sortTimelines(timelines: Record<number, ActionMethod[]>[]) {\r\n timelines.forEach((timelineActions) => {\r\n Object.keys(timelineActions).forEach(\r\n (key) =>\r\n ((timelineActions as any)[key] = EligiusEngine.sortActionsPerPosition(\r\n (timelineActions as any)[key]\r\n ))\r\n );\r\n });\r\n }\r\n\r\n static sortActionsPerPosition(actions: ActionMethod[]) {\r\n const [startMethods, endMethods] = actions.reduce(\r\n (acc, item) => {\r\n if (item.isStart) {\r\n acc[0].push(item);\r\n } else {\r\n acc[1].push(item);\r\n }\r\n return acc;\r\n },\r\n [[], []] as [ActionMethod[], ActionMethod[]]\r\n );\r\n return [\r\n ...endMethods.sort(sortActionMethodsHighestStartPositionFirst),\r\n ...startMethods,\r\n ];\r\n }\r\n\r\n private _addTimelineActionStart(\r\n uri: string,\r\n timeLineAction: ITimelineAction\r\n ) {\r\n const startPosition = timeLineAction.duration.start;\r\n const timelineStartPositions = this._initializeTimelinePosition(\r\n this._initializeUriLookup(this._timeLineActionsLookup, uri),\r\n startPosition\r\n );\r\n const startMethod = timeLineAction.start.bind(\r\n timeLineAction\r\n ) as ActionMethod;\r\n\r\n if (timeLineAction.id?.length) {\r\n startMethod.id = timeLineAction.id;\r\n }\r\n startMethod.isStart = true;\r\n\r\n timelineStartPositions.push(startMethod);\r\n }\r\n\r\n private _addTimelineActionEnd(uri: string, timeLineAction: ITimelineAction) {\r\n let end = timeLineAction.duration.end;\r\n if (end < 0) {\r\n end = timeLineAction.duration.end = Infinity;\r\n }\r\n\r\n if (isFinite(end)) {\r\n const timelineEndPositions = this._initializeTimelinePosition(\r\n this._timeLineActionsLookup[uri],\r\n end\r\n );\r\n const endMethod = timeLineAction.end.bind(timeLineAction) as ActionMethod;\r\n\r\n if (timeLineAction.id?.length) {\r\n endMethod.id = timeLineAction.id;\r\n endMethod.startPosition = timeLineAction.duration.start;\r\n }\r\n endMethod.isStart = false;\r\n\r\n timelineEndPositions.push(endMethod);\r\n }\r\n }\r\n\r\n private _initializeUriLookup(\r\n lookup: Record<string, Record<number, ActionMethod[]>>,\r\n uri: string\r\n ): Record<number, any> {\r\n if (!lookup[uri]) {\r\n lookup[uri] = {};\r\n }\r\n\r\n return lookup[uri];\r\n }\r\n\r\n private _initializeTimelinePosition(\r\n lookup: Record<number, ActionMethod[]>,\r\n position: number\r\n ): ActionMethod[] {\r\n if (!lookup[position]) {\r\n lookup[position] = [] as ActionMethod[];\r\n }\r\n\r\n return lookup[position];\r\n }\r\n\r\n private async _executeActions(\r\n actions: IEndableAction[],\r\n methodName: 'start' | 'end',\r\n idx = 0\r\n ): Promise<void> {\r\n if (actions && idx < actions.length) {\r\n const action = actions[idx];\r\n\r\n await action[methodName]();\r\n return this._executeActions(actions, methodName, ++idx);\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n private _handleRequestEngineRoot(\r\n engineRootSelector: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback($(engineRootSelector));\r\n }\r\n\r\n private async _handleRequestTimelineUri(uri: string, position: number = 0) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.stop();\r\n\r\n await this._cleanUpTimeline();\r\n\r\n const timelineConfig = this.configuration.timelines.find(\r\n (timeline) => timeline.uri === uri\r\n );\r\n if (\r\n !timelineConfig ||\r\n !this._activeTimelineProvider ||\r\n this._currentTimelineUri === timelineConfig.uri\r\n ) {\r\n return;\r\n }\r\n this._currentTimelineUri = timelineConfig.uri;\r\n\r\n this.eventbus.broadcast(TimelineEventNames.CURRENT_TIMELINE_CHANGE, [\r\n this._currentTimelineUri,\r\n ]);\r\n\r\n const newProviderSettings = this.timelineProviders[timelineConfig.type];\r\n\r\n if (this._activeTimelineProvider !== newProviderSettings.provider) {\r\n this._activeTimelineProvider.destroy();\r\n this._activeTimelineProvider = newProviderSettings.provider;\r\n }\r\n\r\n this._activeTimelineProvider.loop = timelineConfig.loop;\r\n\r\n if (!this._activeTimelineProvider.loop && position > 0) {\r\n this.eventbus.once(TimelineEventNames.FIRST_FRAME, async () => {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n\r\n this._activeTimelineProvider.pause();\r\n this.eventbus.broadcast(TimelineEventNames.DURATION, [\r\n this._activeTimelineProvider.getDuration(),\r\n ]);\r\n\r\n await this._executeStartActions();\r\n\r\n const seekPosition = await this._activeTimelineProvider.seek(position);\r\n this.seekRequest(seekPosition);\r\n });\r\n }\r\n\r\n this._activeTimelineProvider.playlistItem(uri);\r\n }\r\n\r\n private _cleanUpTimeline() {\r\n return this._executeRelevantActions(this._getActiveActions, 'end');\r\n }\r\n\r\n private _executeStartActions() {\r\n return this._executeRelevantActions(\r\n this._getActionsForPosition.bind(this, 0),\r\n 'start'\r\n );\r\n }\r\n\r\n /**\r\n * Gets all of the inactive actions whose duration falls within the given timeline position.\r\n *\r\n * @param position the given position\r\n * @param actions all of the relevant actions\r\n * @returns\r\n */\r\n private _getActionsForPosition(position: number, actions: ITimelineAction[]) {\r\n return actions.filter(\r\n (action) =>\r\n !action.active &&\r\n action.duration.start <= position &&\r\n action.duration.end >= position\r\n );\r\n }\r\n\r\n private _getActiveActions(allActions: ITimelineAction[]) {\r\n const actions = allActions.filter((action) => action.active);\r\n return actions.sort(sortActionsHighestStartPositionFirst);\r\n }\r\n\r\n private _executeRelevantActions(\r\n filter: (actions: ITimelineAction[]) => ITimelineAction[],\r\n executionType: 'start' | 'end'\r\n ) {\r\n const timelineActions = this._getTimelineActionsForCurrentTimeline();\r\n const currentActions = filter.apply(this, [timelineActions]);\r\n return this._executeActions(currentActions, executionType, 0);\r\n }\r\n\r\n private _handleRequestTimelinePosition(\r\n floor: Function,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(floor(this._activeTimelineProvider?.getPosition() || -1));\r\n }\r\n\r\n private _handleTimelineComplete() {\r\n this._cleanUpTimeline();\r\n }\r\n\r\n private _getTimelineActionsForCurrentTimeline() {\r\n return this._getTimelineActionsForUri(this._currentTimelineUri);\r\n }\r\n\r\n private _requestCurrentTimeline(resultCallback: TResultCallback) {\r\n resultCallback(this._currentTimelineUri);\r\n }\r\n\r\n private _getTimelineActionsForUri(uri: string): ITimelineAction[] {\r\n const info = this.configuration.timelines.find((timelineInfo) => {\r\n return timelineInfo.uri === uri;\r\n });\r\n return info?.timelineActions ?? [];\r\n }\r\n\r\n private _onTimeHandler(floor: (x: number) => number, position: number) {\r\n if (!isNaN(position)) {\r\n const pos = floor(position);\r\n\r\n if (this._lastPosition !== pos) {\r\n this._executeActionsForPosition(pos);\r\n this.eventbus.broadcast(TimelineEventNames.TIME, [pos]);\r\n }\r\n }\r\n }\r\n\r\n private _executeActionsForPosition(position: number) {\r\n this._lastPosition = position;\r\n const actions = this._timeLineActionsLookup[this._currentTimelineUri];\r\n\r\n if (actions) {\r\n const executions = actions[position];\r\n executions?.forEach((exec) => exec());\r\n }\r\n }\r\n\r\n private async _executeSeekActions(position: number) {\r\n const timelineActions = this._getTimelineActionsForCurrentTimeline();\r\n\r\n if (!timelineActions) {\r\n return Promise.resolve();\r\n }\r\n\r\n const currentActions = this._getActiveActions(timelineActions).filter(\r\n (action) =>\r\n !(action.duration.start <= position && action.duration.end >= position)\r\n );\r\n const newActions = this._getActionsForPosition(position, timelineActions);\r\n const currentActionsEnd = this._executeActions(currentActions, 'end', 0);\r\n\r\n await currentActionsEnd;\r\n\r\n return this._executeActions(newActions, 'start', 0);\r\n }\r\n}\r\n\r\nconst sortActionsHighestStartPositionFirst = (\r\n a: ITimelineAction,\r\n b: ITimelineAction\r\n) => {\r\n if (b.duration.start < a.duration.start) {\r\n return -1;\r\n } else if (b.duration.start > a.duration.start) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n};\r\n\r\nconst sortActionMethodsHighestStartPositionFirst = (\r\n a: ActionMethod,\r\n b: ActionMethod\r\n) => {\r\n if (b.startPosition === undefined || a.startPosition === undefined) {\r\n return 0;\r\n }\r\n if (b.startPosition < a.startPosition) {\r\n return -1;\r\n } else if (b.startPosition > a.startPosition) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n};","import { IAction } from '../action/types';\r\nimport { IEventbusListener } from './types';\r\n\r\n/**\r\n * The `IEventbusListener` first registers a number of actions that are then\r\n * executed when the specified event is broadcast.\r\n */\r\nexport class ActionRegistryEventbusListener implements IEventbusListener {\r\n private _actionRegistry = new Map<string, IAction[]>();\r\n\r\n registerAction(\r\n action: IAction,\r\n eventName: string,\r\n eventTopic?: string\r\n ): void {\r\n if (eventTopic && eventTopic.length) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this._actionRegistry.has(eventName)) {\r\n this._actionRegistry.set(eventName, []);\r\n }\r\n this._actionRegistry.get(eventName)?.push(action);\r\n }\r\n\r\n handleEvent(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any[]\r\n ): void {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n const actions = this._actionRegistry.get(eventName);\r\n if (actions) {\r\n const operationData = {\r\n eventArgs: args,\r\n };\r\n actions.forEach((action) => {\r\n action.start(operationData);\r\n });\r\n }\r\n }\r\n}\r\n","import {\r\n IEventbus,\r\n IEventbusInterceptor,\r\n IEventbusListener,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './types';\r\n\r\nexport class Eventbus implements IEventbus {\r\n private eventHandlers = new Map<string, TEventHandler[]>();\r\n private eventInterceptors = new Map<string, IEventbusInterceptor[]>();\r\n private eventListeners: IEventbusListener[] = [];\r\n\r\n constructor() {\r\n this.clear();\r\n }\r\n\r\n clear() {\r\n this.eventHandlers = new Map<string, TEventHandler[]>();\r\n this.eventListeners = [];\r\n this.eventInterceptors = new Map<string, IEventbusInterceptor[]>();\r\n }\r\n\r\n _getEventInterceptors(\r\n eventName: string,\r\n eventTopic?: string\r\n ): IEventbusInterceptor[] {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this.eventInterceptors.has(eventName)) {\r\n this.eventInterceptors.set(eventName, []);\r\n }\r\n return this.eventInterceptors.get(eventName) as IEventbusInterceptor[];\r\n }\r\n\r\n _getEventHandlers(eventName: string, eventTopic?: string): TEventHandler[] {\r\n if (eventTopic) {\r\n eventName = `${eventName}:${eventTopic}`;\r\n }\r\n if (!this.eventHandlers.has(eventName)) {\r\n this.eventHandlers.set(eventName, []);\r\n }\r\n return this.eventHandlers.get(eventName) as TEventHandler[];\r\n }\r\n\r\n on(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n this._getEventHandlers(eventName, eventTopic).push(eventHandler);\r\n return () => {\r\n this.off(eventName, eventHandler, eventTopic);\r\n };\r\n }\r\n\r\n once(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n const eventHandlerDecorator = (...args: any[]) => {\r\n eventHandler(...args);\r\n this.off(eventName, eventHandlerDecorator, eventTopic);\r\n };\r\n this.on(eventName, eventHandlerDecorator, eventTopic);\r\n return () => {\r\n this.off(eventName, eventHandlerDecorator, eventTopic);\r\n };\r\n }\r\n\r\n off(\r\n eventName: string,\r\n eventHandler: TEventHandler,\r\n eventTopic?: string\r\n ): void {\r\n const handlers = this._getEventHandlers(eventName, eventTopic);\r\n if (handlers) {\r\n const idx = handlers.indexOf(eventHandler);\r\n if (idx > -1) {\r\n handlers.splice(idx, 1);\r\n }\r\n }\r\n }\r\n\r\n broadcast(eventName: string, args: any[]): void {\r\n this._callHandlers(eventName, undefined, args);\r\n }\r\n\r\n broadcastForTopic(eventName: string, eventTopic: string, args: any[]): void {\r\n this._callHandlers(eventName, eventTopic, args);\r\n }\r\n\r\n registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover {\r\n this.eventListeners.push(eventbusListener);\r\n return () => {\r\n const index = this.eventListeners.indexOf(eventbusListener);\r\n if (index > -1) {\r\n this.eventListeners.splice(index, 1);\r\n }\r\n };\r\n }\r\n\r\n registerInterceptor(\r\n eventName: string,\r\n interceptor: IEventbusInterceptor,\r\n eventTopic?: string\r\n ): TEventbusRemover {\r\n const interceptors = this._getEventInterceptors(eventName, eventTopic);\r\n interceptors.push(interceptor);\r\n return () => {\r\n const index = interceptors.indexOf(interceptor);\r\n if (index > -1) {\r\n interceptors.splice(index, 1);\r\n }\r\n };\r\n }\r\n\r\n _callHandlers(\r\n eventName: string,\r\n eventTopic: string | undefined,\r\n args: any = []\r\n ): void {\r\n const handlers = this._getEventHandlers(eventName, eventTopic);\r\n\r\n if (handlers) {\r\n const interceptors = this._getEventInterceptors(eventName, eventTopic);\r\n\r\n interceptors.forEach((interceptor) => {\r\n args = interceptor.intercept(args);\r\n });\r\n\r\n this.eventListeners.forEach((listener: IEventbusListener) => {\r\n listener.handleEvent(eventName, eventTopic, args);\r\n });\r\n\r\n if (args?.length) {\r\n handlers.forEach((handler: TEventHandler) => handler(...args));\r\n } else {\r\n handlers.forEach((handler: TEventHandler) => handler());\r\n }\r\n }\r\n }\r\n}\r\n","import { TimelineEventNames } from '../timeline-event-names';\r\nimport { IEventbus, IEventbusInterceptor } from './types';\r\n\r\nexport class RequestVideoUriInterceptor implements IEventbusInterceptor {\r\n constructor(private eventbus: IEventbus) {}\r\n\r\n intercept(args: any[]): any[] {\r\n this.eventbus.broadcast(\r\n TimelineEventNames.BEFORE_REQUEST_TIMELINE_URI,\r\n args.slice()\r\n );\r\n return args;\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport { IEventbus, TEventbusRemover } from './eventbus/types';\r\nimport { setGlobal } from './operation/helper/set-global';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport { ILabel, ILanguageLabel, TResultCallback } from './types';\r\n\r\n/**\r\n * This class manages the labels for an {@link IEligiusEngine} instance.\r\n * \r\n * It handles the {@link TimelineEventNames.REQUEST_LABEL_COLLECTION}, {@link TimelineEventNames.REQUEST_LABEL_COLLECTIONS}, {@link TimelineEventNames.REQUEST_CURRENT_LANGUAGE} and {@link TimelineEventNames.LANGUAGE_CHANGE} events.\r\n * \r\n */\r\nexport class LanguageManager {\r\n private _labelLookup: Record<string, ILabel[]>;\r\n private _eventbusRemovers: TEventbusRemover[] = [];\r\n\r\n constructor(\r\n private _currentLanguage: string,\r\n labels: ILanguageLabel[],\r\n private _eventbus: IEventbus\r\n ) {\r\n if (!_currentLanguage) {\r\n throw new Error('language ctor arg cannot have zero length');\r\n }\r\n setGlobal('defaultLanguage', _currentLanguage);\r\n this._setRootElementLang(_currentLanguage);\r\n this._labelLookup = this._createLabelLookup(labels);\r\n this._addEventbusListeners(_eventbus);\r\n }\r\n\r\n destroy() {\r\n this._eventbusRemovers.forEach((x) => x());\r\n }\r\n\r\n _addEventbusListeners(eventbus: IEventbus) {\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_LABEL_COLLECTION,\r\n this._handleRequestLabelCollection.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_LABEL_COLLECTIONS,\r\n this._handleRequestLabelCollections.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.REQUEST_CURRENT_LANGUAGE,\r\n this._handleRequestCurrentLanguage.bind(this)\r\n )\r\n );\r\n this._eventbusRemovers.push(\r\n eventbus.on(\r\n TimelineEventNames.LANGUAGE_CHANGE,\r\n this._handleLanguageChange.bind(this)\r\n )\r\n );\r\n }\r\n\r\n _handleRequestCurrentLanguage(resultCallback: TResultCallback) {\r\n resultCallback(this._currentLanguage);\r\n }\r\n\r\n _handleRequestLabelCollection(\r\n labelId: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._labelLookup[labelId]);\r\n }\r\n\r\n _handleRequestLabelCollections(\r\n labelIds: string[],\r\n resultCallback: TResultCallback\r\n ) {\r\n const labelCollections = labelIds.map((labelId) => {\r\n return this._labelLookup[labelId];\r\n });\r\n resultCallback(labelCollections);\r\n }\r\n\r\n _handleLanguageChange(language: string) {\r\n if (language && language.length) {\r\n this._currentLanguage = language;\r\n this._setRootElementLang(this._currentLanguage);\r\n } else {\r\n console.error('Language cannot be changed to null or empty string');\r\n }\r\n }\r\n\r\n _setRootElementLang(language: string) {\r\n const callBack = (rootSelector: string) => {\r\n const lang = this._extractLanguageFromCulture(language);\r\n $(rootSelector).attr('lang', lang);\r\n };\r\n this._eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [\r\n callBack,\r\n ]);\r\n }\r\n\r\n _extractLanguageFromCulture(culture: string) {\r\n if (culture.indexOf('-') > -1) {\r\n return culture.split('-').shift() as string;\r\n }\r\n return culture;\r\n }\r\n\r\n _createLabelLookup(labels: ILanguageLabel[]) {\r\n return labels.reduce<Record<string, ILabel[]>>((acc, label) => {\r\n acc[label.id] = label.labels;\r\n return acc;\r\n }, {});\r\n }\r\n}\r\n","import { getGlobals } from './globals';\r\n\r\nexport function setGlobal(name: string, value: any) {\r\n const cache = getGlobals();\r\n cache[name] = value;\r\n}\r\n","import hotkeys, { HotkeysEvent } from 'hotkeys-js';\r\nimport $ from 'jquery';\r\nimport { IAction } from './action/types';\r\nimport { ConfigurationResolver } from './configuration/configuration-resolver';\r\nimport {\r\n IEngineConfiguration,\r\n IResolvedEngineConfiguration,\r\n} from './configuration/types';\r\nimport { DevToolEventListener } from './diagnostics/devtool-event-lister';\r\nimport { Diagnostics } from './diagnostics/diagnostics';\r\nimport {\r\n DEV_TOOLS_KEY,\r\n TDiagnosticType,\r\n TWindowWithDevtools,\r\n} from './diagnostics/types';\r\nimport {\r\n ActionRegistryEventbusListener,\r\n Eventbus,\r\n IEventbus,\r\n RequestVideoUriInterceptor,\r\n TEventbusRemover,\r\n} from './eventbus';\r\nimport { LanguageManager } from './language-manager';\r\nimport { TimelineEventNames } from './timeline-event-names';\r\nimport {\r\n IConfigurationResolver,\r\n IEligiusEngine,\r\n IEngineFactory,\r\n IEngineFactoryOptions,\r\n ISimpleResourceImporter,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types';\r\nimport { prepareValueForSerialization } from './util/prepare-value-for-serialization';\r\n\r\n/**\r\n * The EngineFactory is used to create and initialize an {@link IEligiusEngine} instance.\r\n *\r\n * It prepares a resolved configuration and creates the engine based on the class defined in the configuration.\r\n *\r\n * @example Loading a configuration and creating an IEligiusEngine instance\r\n * ```ts\r\n * import { IEngineConfiguration, EngineFactory, WebpackResourceImporter } from 'eligius';\r\n * import * as engineConfig from './my-eligius-config.json';\r\n *\r\n * const factory = new EngineFactory(new WebpackResourceImporter(), window);\r\n *\r\n * const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);\r\n *\r\n * engine.init().then(()=> {console.log('Eligius engine ready for business');});\r\n * ```\r\n */\r\nexport class EngineFactory implements IEngineFactory {\r\n private _actionsLookup: Record<string, IAction> = {};\r\n private _eventbus: IEventbus;\r\n private _eventRemovers: TEventbusRemover[] = [];\r\n private _importer: ISimpleResourceImporter;\r\n private _resizeTimeout: any = -1;\r\n\r\n constructor(\r\n importer: ISimpleResourceImporter,\r\n windowRef: Window,\r\n options?: IEngineFactoryOptions\r\n ) {\r\n this._importer = importer;\r\n this._eventbus = options?.eventbus ?? new Eventbus();\r\n\r\n Diagnostics.active = options?.devtools ?? false;\r\n if (Diagnostics.active) {\r\n this._initializeDevtools(this._eventbus);\r\n }\r\n\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_INSTANCE,\r\n this._requestInstanceHandler.bind(this)\r\n )\r\n );\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_ACTION,\r\n this._requestActionHandler.bind(this)\r\n )\r\n );\r\n this._eventRemovers.push(\r\n this._eventbus.on(\r\n TimelineEventNames.REQUEST_FUNCTION,\r\n this._requestFunctionHandler.bind(this)\r\n )\r\n );\r\n\r\n const handleSpaceBound = this._handleSpacePress.bind(this);\r\n hotkeys('space', handleSpaceBound);\r\n this._eventRemovers.push(() => hotkeys.unbind('space', handleSpaceBound));\r\n\r\n const resizeBound = this._resizeHandler.bind(this);\r\n const jqWin = $(windowRef);\r\n jqWin.on('resize', resizeBound);\r\n this._eventRemovers.push(() => jqWin.off('resize', resizeBound));\r\n }\r\n\r\n private _handleSpacePress(\r\n keyboardEvent: KeyboardEvent,\r\n _hotkeysEvent: HotkeysEvent\r\n ): void | boolean {\r\n keyboardEvent.preventDefault();\r\n this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);\r\n return false;\r\n }\r\n\r\n private _initializeDevtools(eventbus: IEventbus) {\r\n const diagnosticInfo = (window as unknown as TWindowWithDevtools)[\r\n DEV_TOOLS_KEY\r\n ];\r\n\r\n if (diagnosticInfo) {\r\n const { agent } = diagnosticInfo;\r\n\r\n this._eventRemovers.push(\r\n eventbus.registerEventlistener(new DevToolEventListener(agent))\r\n );\r\n\r\n this._eventRemovers.push(\r\n agent.subscribe((message) => {\r\n if (message.type === 'playcontrol') {\r\n switch (message.data.kind) {\r\n case 'play':\r\n this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);\r\n break;\r\n case 'stop':\r\n this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);\r\n break;\r\n case 'pause':\r\n this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);\r\n break;\r\n case 'seek':\r\n this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [\r\n message.data.args,\r\n ]);\r\n break;\r\n }\r\n }\r\n })\r\n );\r\n\r\n Diagnostics.send = (name: TDiagnosticType, messageData: any) => {\r\n const message = prepareValueForSerialization(messageData);\r\n try {\r\n agent.postMessage(name, message);\r\n } catch (e) {\r\n console.error('postmessage failed');\r\n console.error(e);\r\n console.log('message', message);\r\n }\r\n };\r\n\r\n Diagnostics.send(\r\n 'eligius-diagnostics-factory',\r\n 'Diagnostics initialized'\r\n );\r\n } else {\r\n console.warn(\r\n `${DEV_TOOLS_KEY} property not found on window, please install the Eligius Devtools extension.`\r\n );\r\n }\r\n }\r\n\r\n destroy() {\r\n this._eventRemovers.forEach((x) => x());\r\n }\r\n\r\n private _resizeHandler() {\r\n if (this._resizeTimeout) {\r\n clearTimeout(this._resizeTimeout);\r\n this._resizeTimeout = -1;\r\n }\r\n this._resizeTimeout = setTimeout(() => {\r\n this._eventbus.broadcast(TimelineEventNames.RESIZE);\r\n }, 200);\r\n }\r\n\r\n private _importSystemEntryWithEventbusDependency(systemName: string): any {\r\n const ctor = this._importSystemEntry(systemName);\r\n return new ctor(this._eventbus);\r\n }\r\n\r\n private _importSystemEntry(systemName: string): any {\r\n return this._importer.import(systemName)[systemName];\r\n }\r\n\r\n private _requestInstanceHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._importSystemEntryWithEventbusDependency(systemName));\r\n }\r\n\r\n private _requestFunctionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n resultCallback(this._importSystemEntry(systemName));\r\n }\r\n\r\n private _requestActionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback\r\n ) {\r\n const action = this._actionsLookup[systemName];\r\n if (action) {\r\n resultCallback(action);\r\n } else {\r\n console.error(`Unknown action: ${systemName}`);\r\n resultCallback(null);\r\n }\r\n }\r\n\r\n createEngine(\r\n configuration: IEngineConfiguration,\r\n resolver?: IConfigurationResolver\r\n ): IEligiusEngine {\r\n const { systemName } = configuration.engine;\r\n const EngineClass = this._importSystemEntry(systemName);\r\n\r\n let actionRegistryListener: ActionRegistryEventbusListener | undefined =\r\n undefined;\r\n if (configuration.eventActions?.length) {\r\n actionRegistryListener = new ActionRegistryEventbusListener();\r\n this._eventRemovers.push(\r\n this._eventbus.registerEventlistener(actionRegistryListener)\r\n );\r\n }\r\n\r\n this._eventRemovers.push(\r\n this._eventbus.registerInterceptor(\r\n TimelineEventNames.REQUEST_TIMELINE_URI,\r\n new RequestVideoUriInterceptor(this._eventbus)\r\n )\r\n );\r\n\r\n resolver =\r\n resolver || new ConfigurationResolver(this._importer, this._eventbus);\r\n const [actionLookup, resolvedConfiguration] = resolver.process(\r\n configuration,\r\n actionRegistryListener\r\n );\r\n this._actionsLookup = actionLookup;\r\n\r\n const timelineProviders = this._createTimelineProviders(\r\n resolvedConfiguration\r\n );\r\n\r\n const { language, labels } = configuration;\r\n const languageManager = new LanguageManager(\r\n language,\r\n labels,\r\n this._eventbus\r\n );\r\n\r\n const engineInstance = new EngineClass(\r\n resolvedConfiguration,\r\n this._eventbus,\r\n timelineProviders,\r\n languageManager\r\n );\r\n\r\n return engineInstance;\r\n }\r\n\r\n private _createTimelineProviders(\r\n configuration: IResolvedEngineConfiguration\r\n ): Record<TimelineTypes, ITimelineProviderInfo> {\r\n const { timelineProviderSettings } = configuration;\r\n\r\n const result = Object.entries(timelineProviderSettings).reduce<\r\n Record<TimelineTypes, ITimelineProviderInfo>\r\n >((acc, [timelineType, settings]) => {\r\n if (!settings) {\r\n return acc;\r\n }\r\n\r\n const TimelineProviderClass = this._importSystemEntry(\r\n settings.systemName\r\n );\r\n acc[timelineType as TimelineTypes] = {\r\n id: settings.id,\r\n vendor: settings.vendor,\r\n provider: new TimelineProviderClass(configuration),\r\n };\r\n return acc;\r\n }, {} as Record<TimelineTypes, ITimelineProviderInfo>);\r\n\r\n return result;\r\n }\r\n}\r\n","import * as ctrls from '../controllers';\r\nimport { EligiusEngine } from '../eligius-engine';\r\nimport * as evtb from '../eventbus';\r\nimport * as ops from '../operation';\r\nimport { TOperation } from '../operation/types';\r\nimport * as prvdrs from '../timelineproviders';\r\nimport { IResourceImporter } from '../types';\r\n\r\nconst operations: Record<string, TOperation<any>> = ops as any;\r\nconst controllers: Record<string, any> = ctrls;\r\nconst providers: Record<string, any> = prvdrs;\r\nconst eventbus: Record<string, any> = evtb;\r\n\r\nexport class EligiusResourceImporter implements IResourceImporter {\r\n engines = new Map();\r\n constructor() {\r\n this.engines.set('EligiusEngine', EligiusEngine);\r\n }\r\n\r\n getOperationNames(): string[] {\r\n return Object.keys(operations);\r\n }\r\n\r\n getControllerNames(): string[] {\r\n return Object.keys(controllers);\r\n }\r\n\r\n getProviderNames(): string[] {\r\n return Object.keys(providers);\r\n }\r\n\r\n import(name: string): Record<string, any> {\r\n const value =\r\n operations[name] ??\r\n controllers[name] ??\r\n providers[name] ??\r\n eventbus[name] ??\r\n this.engines.get(name);\r\n\r\n return { [name]: value };\r\n }\r\n}\r\n","export type TDevToolsEventSubscriber = (event: TEventData) => void;\r\n\r\nexport type TPlayControlEventKind = 'play' | 'stop' | 'pause' | 'seek';\r\nexport const DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';\r\n\r\nexport type TWindowWithDevtools = Window & {\r\n [DEV_TOOLS_KEY]: IDiagnosticsInfo | undefined;\r\n};\r\n\r\nexport type TDevToolsMessage = {\r\n source: 'eligius-inspect-devtools';\r\n name: 'event';\r\n data: TEventData;\r\n};\r\n\r\nexport type TEventData = {\r\n type: 'playcontrol';\r\n data: IPlayControlEvent;\r\n};\r\n\r\nexport interface IPlayControlEvent {\r\n kind: TPlayControlEventKind;\r\n args?: any[];\r\n}\r\n\r\nexport interface IDiagnosticsAgent {\r\n postMessage(name: TDiagnosticType, messageData: any): void;\r\n subscribe(subscriber: TDevToolsEventSubscriber): () => void;\r\n}\r\n\r\nexport interface IDiagnosticsInfo {\r\n get agent(): IDiagnosticsAgent;\r\n}\r\n\r\nexport type TDiagnosticType =\r\n | 'eligius-diagnostics-factory'\r\n | 'eligius-diagnostics-engine'\r\n | 'eligius-diagnostics-event'\r\n | 'eligius-diagnostics-action'\r\n | 'eligius-diagnostics-action-error'\r\n | 'eligius-diagnostics-operation';\r\n\r\nexport type TDiagnosticsMessageSource =\r\n | 'eligius-inspect-agent'\r\n | 'eligius-inspect-devtools';\r\n","export default function dashToCamelCase(input: string) {\r\n return input.replace(/-([a-z])/g, g => g[1].toUpperCase());\r\n}\r\n"],"names":["isFunction","value","isObject","prepareValueForSerialization","Array","isArray","map","jQuery","constructor","toString","substring","startsWith","funcString","indexOf","Object","fromEntries","entries","DevToolEventListener","agent","this","handleEvent","eventName","eventTopic","args","message","postMessage","e","console","error","log","Diagnostics","send","_name","_data","active","copyFunction","structuredClone","original","JSON","parse","stringify","deepCopy","isDefined","Action","name","startOperations","eventbus","id","_contextStack","_proto","start","initOperationData","_initializeContextStack","result","Promise","resolve","reject","_this","executeOperation","then","operationsResult","currentIndex","operations","_pushContext","parentContext","newContext","parent","push","_popContext","pop","operationIndex","previousOperationData","obj","context","length","undefined","newIndex","operationInfo","copy","operationData","mergedOperationData","assign","systemName","owner","operationResult","instance","call","promisedOperationResult","_this2","EndableAction","endOperations","eventBus","_inheritsLoose","end","TimelineAction","duration","_active","_createClass","key","get","_gatherControllerImportPathsFromActions","actionsConfig","operationConfigs","flatMap","x","filter","operationConfig","_operationConfig$oper","hasOwnProperty","endsWith","_gatherOperationImportPathsFromActions","dedupe","importPaths","lookup","imp","addClass","selectedElement","className","getElementControllers","element","data","bind","mergeOperationData","newOperationData","internalResolve","addControllerToElement","controllerInstance","controller","controllers","attachControllerToElement","init","promise","attach","animate","animationEasing","animationProperties","animationDuration","animateWithClass","removeClass","one","isString","getPropertyChainValue","propertyChain","sourceObject","currentInstance","suffix","forEach","prop","index","Error","join","parts","split","cache","getGlobals","setGlobals","newValues","resolveExternalPropertyChain","operationContext","propertyChainOrRegularObject","propNames","shift","_propNames$shift","toLowerCase","broadcastEvent","eventArguments","eventArgs","resolveEventArguments","broadcastForTopic","broadcast","removeEventDataFromOperationData","resolvePropertyValues","newProperties","resolveNewProperties","properties","resolvePropertyChain","$","item","arr","splice","calcFunctions","left","right","calc","calculationResult","operator","clearElement","empty","clearOperationData","createElement","elementName","attributes","text","serializedAttrs","Boolean","template","TimelineEventNames","PLAY_TOGGLE_REQUEST","PLAY_REQUEST","STOP_REQUEST","PAUSE_REQUEST","SEEK_REQUEST","RESIZE_REQUEST","CONTAINER_REQUEST","DURATION_REQUEST","REQUEST_CURRENT_TIMELINE","DURATION","TIME","SEEKED","COMPLETE","RESTART","PLAY","STOP","PAUSE","SEEK","RESIZE","CURRENT_TIMELINE_CHANGE","FIRST_FRAME","REQUEST_INSTANCE","REQUEST_ACTION","REQUEST_FUNCTION","REQUEST_TIMELINE_URI","BEFORE_REQUEST_TIMELINE_URI","REQUEST_ENGINE_ROOT","REQUEST_CURRENT_TIMELINE_POSITION","REQUEST_TIMELINE_CLEANUP","REQUEST_LABEL_COLLECTION","REQUEST_LABEL_COLLECTIONS","REQUEST_CURRENT_LANGUAGE","LANGUAGE_CHANGE","customFunction","func","apply","endAction","actionInstance","actionOperationData","keys","endLoop","loopIndex","loopLength","loopStartIndex","currentItem","endWhen","whenEvaluation","extendController","controllerExtension","getAttributesFromElement","attributeValues","attributeNames","reduce","acc","attrName","attr","val","getControllerFromElement","controllerName","find","ctrl","warn","getControllerInstance","getElementDimensions","modifier","dimensions","width","innerWidth","height","innerHeight","clonedDimensions","ratioModifier","prefix","isPercent","_getModifierSuffix","parseInt","widthModifier","heightModifier","modifiedDimension","_modifyDimensions","modifiedDimensions","ratio","ratios","_modifyDimensionsByRatio","modifyDimensions","getImport","importedInstance","getQueryParams","searchParams","URLSearchParams","window","location","search","queryParams","defaultValues","invokeObjectMethod","methodName","methodArguments","methodResult","jsonCache","loadJSON","url","_context","json","fetch","response","cacheValue","globalData","group","groupEnd","math","arg","Math","mathResult","functionName","findMatchingOperationIndex","operation","self","counter","matchingName","otherwise","endWhenIndex","slice","findIndex","removeControllerFromElement","idx","detach","removeElement","remove","removePropertiesFromOperationData","propertyNames","includes","reparentElement","newParentSelector","appendTo","requestAction","action","resizeAction","resize","findElementBySelector","root","selector","selectElement","useSelectedElementAsRoot","setData","path","rootTarget","_path$shift","knownTargets","property","propertyValue","operationdata","globaldata","resolveTargets","setElementAttributes","setElementContent","insertionType","html","append","prepend","setGlobalData","newGlobals","setOperationData","override","resolvedProperties","setStyle","css","startAction","startLoop","collection","loopEndIndex","toggleClass","toggleElement","toggle","wait","milliseconds","setTimeout","when","expression","leftNr","rightNr","isNaN","parseExpression","evaluations","list","otherWiseIndex","findNextFlowControlIndex","ActionCreatorFactory","configurationfactory","createAction","creator","EndableActionCreator","addAction","actionConfig","createInitAction","addInitAction","createEventAction","ActionCreator","addEventAction","createTimelineAction","uri","TimelineActionCreator","addTimelineAction","factory","uuidv4","_proto2","getId","setName","getConfiguration","callBack","newConfig","addStartOperationByType","operationClass","addStartOperation","next","_proto3","addEndOperationByType","addEndOperation","addDuration","array_move","old_index","new_index","ActionEditor","configurationFactory","updateConfiguration","getName","OperationEditor","editStartOperation","o","removeStartOperation","moveStartOperation","direction","EndableActionEditor","editEndOperation","removeEndOperation","moveEndOperation","TimelineActionEditor","setDuration","actionEditor","_proto4","getSystemName","setSystemName","setOperationDataItem","getOperationDataKeys","getOperationDataValue","LabelEditor","languageLabel","_internalGetLabel","languageCode","labels","setLabel","translation","removeLabel","RequestAnimationFrameTimelineProvider","config","_currentPosition","_updateBound","_update","_firstFramePending","_currentPlaylistItem","_tickInterval","_playlist","_containerElement","_abortController","_onTime","_onComplete","_onRestart","_onFirstFrame","loop","_playState","_extractPlaylist","configuration","timelines","timeline","type","onTime","callback","onComplete","onRestart","onFirstFrame","playlistItem","_now","playState","stop","_resetToStartPosition","_callbackPosition","abort","AbortController","ms","signal","document","_document","_document$timeline","currentTime","performance","now","frame","time","aborted","scheduleFrame","roundedElapsed","round","delay","requestAnimationFrame","animationInterval","getContainer","_stopAnimationInterval","resetPosition","destroy","pause","seek","position","getPosition","getDuration","TimelineProvidersSettingsEditor","providersSettings","addProvider","timelineType","settings","poster","vendor","TimelineProviderSettingsEditor","editProvider","providerSettings","providersSettingsEditor","setVendor","setSelector","timelineProviders","ConfigurationFactory","actionCreatorFactory","extend","extensionMethodName","extensionMethod","extendMultiple","extensions","defaultLanguage","engine","containerSelector","timelineProviderSettings","language","availableLanguages","layoutTemplate","initActions","actions","setLayoutTemplate","setDefaultLanguage","setContainerSelector","editTimelineProviderSettings","addLanguage","languages","_initializeCollection","lang","label","_internalAddAction","collectionName","getTimeline","addTimeline","timelineConfig","timelineActions","t","removeTimeline","_initializeLabel","l","_getLabelTranslation","labelTranslations","editLabel","_this$configuration$l","addLabel","code","labelConfig","addLabels","translations","editAction","a","editEventAction","eventActions","_this$configuration$e","editInitAction","editTimelineAction","EventListenerController","actionInstanceInfos","actionName","isStart","_isStartAction","on","_eventHandler","event","target","eventTarget","_executeAction","actionInfo","method","_eventbus","off","LabelController","listeners","currentLanguage","labelData","requestLabelDataBound","setLabelId","newLabelId","_setLabel","_requestLabelData","labelId","_handleLanguageChange","labelCollection","_createTextDataLookup","_this$operationData","attributeName","_this$operationData4","d","_this3","LottieController","eventbusRemovers","animationItem","serializedData","serializedIEData","freezePosition","endPosition","_parseFilename","animationData","iefallback","setting","values","labelIds","resultHolder","labelCollections","_createAnimation","addEventListener","_destroy","playSegments","serialized","_isIE","lottie","loadAnimation","autoplay","container","rendererSettings","renderer","timeCompleted","viewBox","infos","isIE","NavigationController","navigation","navLookup","navVidIdLookup","ctrlLookup","activeNavigationPoint","labelControllers","eventhandlers","_buildNavigationData","_handleNavigateVideoUrl","_highlightMenu","_handleRequestCurrentNavigation","_handleVideoComplete","_buildHtml","_initHistory","navId","_getQueryVariable","videoIndex","videoUrlIndex","variableIdx","href","hashIndex","query","resultCallback","labelCtrl","navigationData","title","handler","onpopstate","_pushCurrentState","state","parentElm","ul","_addNavElement","visible","li","_addLabel","_addClickHandler","children","mouseup","_menuMouseupHandler","navdata","requestedVideoPosition","navElm","navData","autoNext","nav","previous","nextId","roots","childId","ProgressbarController","textElement","_positionUpdateHandler","_this$selectedElement2","clickHandler","_clickHandler","percentage","floor","rect","getBoundingClientRect","clientX","RoutingController","_handleBeforeRequestVideoUrl","_handlePushHistoryState","_handlePopstate","pos","history","pushState","navigationId","_event$state","_index","_requestedVideoPosition","isHistoryRequest","_pushState","currentPosition","currentState","replaceState","SubtitlesController","actionLookup","lastFunc","detachTime","onTimeHandler","detachSeek","onSeekedHandler","detachLangChange","languageChangeHandler","internalDetach","detachMethods","f","newLanguage","removeTitle","setTitle","titleLanguageLookup","createActionLookup","subtitleData","titles","subtitleTimeLookup","i","ii","j","jj","subs","description","dependentProperties","required","outputProperties","itemType","getOwnPropertyNames","default","OperationNamesProvider","getOperationNames","ControllerNamesProvider","getControllerNames","OperationMetadataProvider","getOperationMetadata","operationName","getMetadata","operationMetadata","TimeLineEventNamesProvider","getEventNames","ConfigurationResolver","importer","process","actionRegistryListener","resolvePlaceholders","resolvedConfig","resolveActions","timelineFlow","resolveTimelines","eventActionConfigurations","resolveActionConfiguration","eventAction","registerAction","resolveEventActions","concat","aggr","resolveTimelineAction","resolveOperation","resolveEndableActionConfiguration","actionConfiguration","actionConfigurations","configFragment","rootConfig","configValue","configProperty","templateKey","jsonKey","resolvePlaceholder","EligiusEngine","languageManager","_timeLineActionsLookup","_eventbusRemovers","_currentTimelineUri","_activeTimelineProvider","_lastPosition","_createLayoutTemplate","_addEventbusListeners","_createTimelineLookup","_initializeTimelineProvider","_this$configuration$t","firstTimeline","provider","_onTimeHandler","_onCompleteCallback","_onFirstFrameCallback","_onRestartCallback","_executeActions","_this$_activeTimeline2","_cleanUp","_context2","_cleanUpTimeline","reverse","_context3","remover","providerInfo","_addEventListener","eventHandler","_handleRequestEngineRoot","_handleRequestTimelineUri","_handleRequestTimelinePosition","_handleTimelineComplete","_requestCurrentTimeline","_toggleplay","_playRequest","_stopRequest","_pauseRequest","containerRequest","durationRequest","seekRequest","offset","_context4","seekPosition","_executeSeekActions","_this$_activeTimeline5","_this$_activeTimeline6","timelineInfo","_addTimelineActionStart","_addTimelineActionEnd","sortTimelines","sortActionsPerPosition","startMethods","sort","sortActionMethodsHighestStartPositionFirst","timeLineAction","startPosition","timelineStartPositions","_initializeTimelinePosition","_initializeUriLookup","startMethod","_timeLineAction$id","Infinity","isFinite","timelineEndPositions","endMethod","_timeLineAction$id2","_context5","engineRootSelector","_context7","newProviderSettings","once","_context6","_executeStartActions","_executeRelevantActions","_getActiveActions","_getActionsForPosition","allActions","sortActionsHighestStartPositionFirst","executionType","_getTimelineActionsForCurrentTimeline","currentActions","_getTimelineActionsForUri","info","_executeActionsForPosition","executions","exec","_context8","newActions","currentActionsEnd","b","ActionRegistryEventbusListener","_actionRegistry","Map","has","set","Eventbus","eventHandlers","eventInterceptors","eventListeners","clear","_getEventInterceptors","_getEventHandlers","eventHandlerDecorator","handlers","_callHandlers","registerEventlistener","eventbusListener","registerInterceptor","interceptor","interceptors","intercept","listener","_args","RequestVideoUriInterceptor","LanguageManager","_currentLanguage","_labelLookup","_setRootElementLang","_createLabelLookup","_handleRequestLabelCollection","_handleRequestLabelCollections","_handleRequestCurrentLanguage","rootSelector","_extractLanguageFromCulture","culture","EngineFactory","windowRef","options","_actionsLookup","_eventRemovers","_importer","_resizeTimeout","devtools","_initializeDevtools","_requestInstanceHandler","_requestActionHandler","_requestFunctionHandler","handleSpaceBound","_handleSpacePress","hotkeys","unbind","resizeBound","_resizeHandler","jqWin","keyboardEvent","_hotkeysEvent","preventDefault","diagnosticInfo","subscribe","kind","messageData","DEV_TOOLS_KEY","clearTimeout","_importSystemEntryWithEventbusDependency","_importSystemEntry","createEngine","resolver","EngineClass","_configuration$eventA","resolvedConfiguration","_createTimelineProviders","TimelineProviderClass","ops","ctrls","providers","prvdrs","evtb","EligiusResourceImporter","engines","getProviderNames","configPath","assetInfo","_gatherOperations","extension","fs","readdirSync","subdir","file","basename","replace","g","toUpperCase","defaultImport","_gatherControllers","_gatherProviders","_gatherEngines","_gatherImportPaths","importerSourceCode","_generateSourceCode"],"mappings":"+oPAAgBA,EAAWC,GACzB,MAAwB,mBAAVA,WCDAC,EAASD,GACvB,OAAiB,OAAVA,GAAmC,iBAAVA,WCGlBE,EAA6BF,GAC3C,GAAIG,MAAMC,QAAQJ,GAChB,OAAQA,EAAqBK,IAAIH,GAC5B,GAAIF,aAAiBM,UAC1B,MAAO,gBACF,GAAIL,EAASD,GAAQ,CAC1B,GACmD,UAAjDA,EAAMO,YAAYC,WAAWC,UAAU,EAAG,KACzCT,EAAMO,YAAYC,WAAWE,WAAW,qBACzC,CACA,IAAMC,EAAqBX,EAAMO,YAAYC,WAC7C,OAAOG,EAAWF,UAAU,EAAGE,EAAWC,QAAQ,KAAO,GAE3D,OAAOC,OAAOC,YACZD,OAAOE,QAAQf,GAAOK,KAAI,YAAA,MAA2B,MAEnDH,aAGC,GAAIH,EAAWC,GAAQ,CAC5B,IAAMW,EAAqBX,EAAMQ,WAEjC,OADmBG,EAAWC,QAAQ,MACpB,EACTD,EAAWF,UAAU,EAAGE,EAAWC,QAAQ,KAAO,GAEpDD,EAET,OAAOX,MC3BIgB,aACX,WAAoBC,QAAAA,aAAAC,WAAAD,EADtB,mBAGEE,YAAA,SACEC,EACAC,EACAC,GAEA,IAAMC,EAAU,CACdH,UAAAA,EACAC,WAAAA,EACAC,KAAMpB,EAA6BoB,IAErC,IACEJ,KAAKD,MAAMO,YAAY,4BAA6BD,GACpD,MAAOE,GACPC,QAAQC,MAAM,sBACdD,QAAQC,MAAMF,GACdC,QAAQE,IAAI,UAAWL,UCpBhBM,aAAb,cAAA,OAAAA,EACSC,KAAP,SAAYC,EAAwBC,GAClCN,QAAQE,IAAIG,EAAOC,SAFVH,EAIJI,kBCJHC,EACuB,oBAApBC,gBACHA,gBACA,SAACC,GAAD,OAAmBC,KAAKC,MAAMD,KAAKE,UAAUH,cAEnCI,EAAYJ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