eligius 1.1.5 → 1.1.7
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/index.d.ts +53 -8
- package/dist/index.js +75 -160
- package/dist/index.js.map +1 -1
- package/package.json +93 -100
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["jQuery","agent: IDiagnosticsAgent","cache: TGlobalCache","cache","getGlobals: (name?: string) => TGlobalCache | any","setGlobals: (newValues: TGlobalCache) => void","clearGlobals: () => void","forEach: TOperation<IForEachOperationData>","when: TOperation<IWhenOperationData>","evaluations: Record<\r\n TOperator,\r\n (left: string | number, right: string | number) => boolean\r\n>","name: string","startOperations: IResolvedOperation[]","eventbus: IEventbus","operations","endOperations: IResolvedOperation[]","duration: IStrictDuration","operations","lookup: Record<string, true>","addClass: TOperation<IAddClassOperationData>","controllers","addControllerToElement: TOperation<IAddControllerToElementOperationData>","animate: TOperation<IAnimateOperationData>","animateWithClass: TOperation<\r\n IAnimateWithClassOperationData,\r\n Promise<IAnimateWithClassOperationData>\r\n>","removeClass","broadcastEvent: TOperation<IBroadcastEventOperationData>","cache: any[]","resolvePropertyChain","calcFunctions: Record<\r\n TCalculationOperator,\r\n (left: number, right: number) => number\r\n>","calc: TOperation<ICalcOperationData>","clearElement: TOperation<IClearElementOperationData>","clearOperationData: TOperation<\r\n IClearOperationDataOperationData\r\n>","createElement: TOperation<\r\n ICreateElementOperationData<TTagNames>,\r\n RequireKeys<ICreateElementOperationData<TTagNames>, 'template'>\r\n>","customFunction: TOperation<ICustomFunctionOperationData>","endAction: TOperation<IEndActionOperationData>","endForEach: TOperation<TOperationData>","endWhen: TOperation<Record<string, unknown>>","extendController: TOperation<IExtendControllerOperationData>","getAttributesFromElement: TOperation<\r\n IGetAttributesFromElementOperationData\r\n>","getControllerFromElement: TOperation<\r\n IGetControllerFromElementOperationData\r\n>","getControllerInstance: TOperation<IGetControllerInstanceOperationData>","suffix: string | null","ratioModifier: string | null","getElementDimensions: TOperation<\r\n IGetElementDimensionsOperationData\r\n>","getImport: TOperation<\r\n IGetImportOperationData,\r\n Omit<RequireKeys<IGetImportOperationData, 'importedInstance'>, 'systemName'>\r\n>","getQueryParams: TOperation<IGetQueryParamsOperationData>","invokeObjectMethod: TOperation<\r\n IInvokeObjectMethodOperationData,\r\n Omit<IInvokeObjectMethodOperationData, 'methodName' | 'methodArguments'>\r\n>","jsonCache: Record<string, unknown>","loadJson: TOperation<ILoadJSONOperationData>","cache","log: TOperation<TOperationData>","math: TOperation<\r\n IMathOperationData,\r\n Omit<IMathOperationData, 'args' | 'functionName'>\r\n>","otherwise: TOperation<Record<string, unknown>>","removeClass: TOperation<IRemoveClassOperationData>","removeControllerFromElement: TOperation<IRemoveControllerFromElementOperationData>","controllers","removeElement: TOperation<IRemoveElementOperationData>","removePropertiesFromOperationData: TOperation<\r\n IRemovePropertiesFromOperationDataOperationData,\r\n Omit<IRemovePropertiesFromOperationDataOperationData, 'propertyNames'>\r\n>","reparentElement: TOperation<IReparentElementOperationData>","requestAction: TOperation<\r\n IRequestActionOperationData,\r\n Required<IRequestActionOperationData>\r\n>","resizeAction: TOperation<IResizeActionOperationData>","selectElement: TOperation<ISelectElementOperationData>","setData: TOperation<ISetDataOperationData>","path","targets: {\r\n context: IOperationContext;\r\n operationdata: TOperationData;\r\n globaldata: TGlobalCache;\r\n }","setElementAttributes: TOperation<\r\n ISetElementAttributesOperationData\r\n>","setElementContent: TOperation<ISetElementContentOperationData>","setGlobalData: TOperation<\r\n ISetGlobalDataOperationData,\r\n Omit<ISetGlobalDataOperationData, 'propertyNames'>\r\n>","setOperationData: TOperation<\r\n ISetOperationData,\r\n Omit<ISetOperationData, 'override' | 'properties'>\r\n>","setStyle: TOperation<ISetStyleOperationData>","startAction: TOperation<IStartActionOperationData>","toggleClass: TOperation<IToggleClassOperationData>","toggleElement: TOperation<IToggleElementOperationData>","toggleElement","wait: TOperation<IWaitOperationData>","configurationfactory: ConfigurationFactory","factory: ActionCreatorFactory","uuidv4","operations","actionConfig: T","configurationFactory: ConfigurationFactory","operations","uuidv4","duration: IDuration","operationConfig: IOperationConfiguration<\r\n ExtractOperationDataType<O>\r\n >","actionEditor: T","configurationFactory: ConfigurationFactory","languageLabel: ILanguageLabel","item","uuidv4","config: IResolvedEngineConfiguration","providersSettings: TTimelineProviderSettings","configurationFactory: ConfigurationFactory","settings: ITimelineProviderSettings","uuidv4","providerSettings: ITimelineProviderSettings","providersSettingsEditor: TimelineProvidersSettingsEditor","timelineProviders","configuration: IEngineConfiguration","newConfiguration: IEngineConfiguration","uuidv4","timelineConfig: ITimelineConfiguration","eventbus","resultHolder: {\r\n language: string;\r\n labelCollections: any[];\r\n }","eventbus","animationSettings: AnimationConfigWithData<'svg'>","eventbus","labelCtrl: LabelController","result: any[]","eventbus","eventbus","result: any[]","eventbus","subtitleTimeLookup: Record<number, () => void>","titleLanguageLookup: Record<string, string>","addClass","addControllerToElement","animateWithClass","animate","broadcastEvent","calc","clearElement","clearOperationData","createElement","customFunction","endAction","endForEach","endWhen","extendController","forEach","getAttributesFromElement","getControllerFromElement","getControllerInstance","getElementDimensions","getImport","getQueryParams","invokeObjectMethod","loadJson","log","math","otherwise","removeClass","removeControllerFromElement","removeElement","removePropertiesFromOperationData","reparentElement","requestAction","resizeAction","selectElement","setData","setElementAttributes","setElementContent","setGlobalData","setOperationData","setStyle","startAction","toggleClass","toggleElement","wait","when","operations","controllers","operationMetadata","result: ISubtitle[]","lines: string[]","i: number","l: number","rawLine: string","caption: Partial<ISubtitle> | null","res: string","times: string[]","parts: string[]","collection: ISubtitleCollection[]","newLanguage: ISubtitleCollection","uuidv4","importer: ISimpleResourceImporter","eventbus: IEventbus","resolvedConfig: IResolvedEngineConfiguration","eventActions: IAction[]","eventbus","configuration: IResolvedEngineConfiguration","eventbus: IEventbus","timelineProviders: Record<TimelineTypes, ITimelineProviderInfo>","languageManager: LanguageManager","eventbus: IEventbus","cache","_currentLanguage: TLanguageCode","_eventbus: IEventbus","eventbus","eventbus","actionRegistryListener: ActionRegistryEventbusListener | undefined","operations: Record<string, TOperation<any>>","ops","controllers: Record<string, any>","ctrls","providers: Record<string, any>","prvdrs","eventbus: Record<string, any>","evtb"],"sources":["../src/util/guards/is-function.ts","../src/util/guards/is-object.ts","../src/util/prepare-value-for-serialization.ts","../src/diagnostics/devtool-event-listener.ts","../src/diagnostics/diagnostics.ts","../src/diagnostics/types.ts","../src/operation/helper/find-matching-operation-index.ts","../src/operation/helper/get-property-chain-value.ts","../src/operation/helper/deep-copy.ts","../src/operation/helper/globals.ts","../src/operation/helper/resolve-external-property-chain.ts","../src/operation/for-each.ts","../src/operation/when.ts","../src/util/guards/is-promise.ts","../src/action/action.ts","../src/action/endable-action.ts","../src/action/timeline-action.ts","../src/util/dash-to-camel-case.ts","../src/build/generate-importer-source-code.ts","../src/operation/add-class.ts","../src/operation/helper/get-element-data.ts","../src/operation/helper/attach-controller-to-element.ts","../src/operation/helper/merge-operation-data.ts","../src/operation/helper/internal-resolve.ts","../src/operation/add-controller-to-element.ts","../src/operation/animate.ts","../src/operation/animate-with-class.ts","../src/operation/helper/remove-event-data-from-operation-data.ts","../src/operation/helper/resolve-event-arguments.ts","../src/operation/broadcast-event.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-for-each.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/helper/modify-dimensions.ts","../src/operation/get-element-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/util/guards/is-string.ts","../src/operation/math.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/toggle-class.ts","../src/operation/toggle-element.ts","../src/operation/wait.ts","../src/operation/index.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/util/merge-if-missing.ts","../src/configuration/api/label-editor.ts","../src/util/animation-interval.ts","../src/timelineproviders/request-animation-frame-timeline-provider.ts","../src/timelineproviders/video-js-timeline-provider.ts","../src/timelineproviders/index.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/controllers/index.ts","../src/operation/metadata/add-class.ts","../src/operation/metadata/add-controller-to-element.ts","../src/operation/metadata/add-globals-to-operation.ts","../src/operation/metadata/animate-with-class.ts","../src/operation/metadata/animate.ts","../src/operation/metadata/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-for-each.ts","../src/operation/metadata/end-when.ts","../src/operation/metadata/extend-controller.ts","../src/operation/metadata/for-each.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/toggle-class.ts","../src/operation/metadata/toggle-element.ts","../src/operation/metadata/wait.ts","../src/operation/metadata/when.ts","../src/operation/metadata/index.ts","../src/configuration/api/name-providers.ts","../src/configuration/api/subtitle-converter.ts","../src/configuration/api/subtitle-editor.ts","../src/operation/helper/resolve-property-chain.ts","../src/configuration/configuration-resolver.ts","../src/eligius-engine.ts","../src/eventbus/actionregistry-eventbus-listener.ts","../src/eventbus/eventbus.ts","../src/eventbus/request-video-uri-interceptor.ts","../src/eventbus/index.ts","../src/operation/helper/set-global.ts","../src/language-manager.ts","../src/engine-factory.ts","../src/importer/eligius-resource-importer.ts"],"sourcesContent":["export function isFunction(value: any): value is (...arg: any) => any {\r\n return typeof value === 'function';\r\n}\r\n","export function isObject(\r\n value: unknown\r\n): value is Record<PropertyKey, unknown> {\r\n return !!value && typeof value === 'object' && !Array.isArray(value);\r\n}\r\n","import jQuery from 'jquery';\r\nimport {isFunction} from './guards/is-function.ts';\r\nimport {isObject} from './guards/is-object.ts';\r\n\r\nexport function prepareValueForSerialization(value: unknown): 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 = 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 = value.toString();\r\n const parenIndex = funcString.indexOf('{');\r\n if (parenIndex > -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 type {IEventbusListener} from '../eventbus/index.ts';\r\nimport {prepareValueForSerialization} from '../util/prepare-value-for-serialization.ts';\r\nimport type {IDiagnosticsAgent} from './types.ts';\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.info('message', message);\r\n }\r\n }\r\n}\r\n","import type {TDiagnosticType} from './types.ts';\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","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","import type {IResolvedOperation} from '../../configuration/types.ts';\r\n\r\n/**\r\n * This function can be used to find the index of a matching closing operation within a list of operations.\r\n *\r\n * Assume the following array of operations:\r\n * ```ts\r\n * [\r\n * {systemName:'name1'}, // index 0\r\n * {systemName:'forEach'}, // index 1\r\n * {systemName:'name2'}, // index 2\r\n * {systemName:'forEach'} // index 3\r\n * {systemName:'name3'} // index 4\r\n * {systemName:'endForEach'} // index 5\r\n * {systemName:'endForEach'} // index 6\r\n * {systemName:'name3'} // index 7\r\n * ]\r\n * ```\r\n *\r\n * Given the `forEach` instance at index 1, this function will return index 6. Given the `forEach` 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` equals `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 *\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","/**\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\nexport function getPropertyChainValue(\r\n propertyChain: string[],\r\n sourceObject: Record<string, any>\r\n) {\r\n let suffix = null;\r\n\r\n const result = propertyChain.reduce((currentInstance, prop, index) => {\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 return currentInstance[prop];\r\n }, sourceObject);\r\n\r\n return suffix ? `${result}${suffix}` : result;\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 : <T>(original: any) => JSON.parse(JSON.stringify(original)) as T;\r\n\r\nexport function deepCopy<T>(original: T): T {\r\n if (isDefined(original)) {\r\n return copyFunction<T>(original);\r\n }\r\n return original;\r\n}\r\n","import {deepCopy} from './deep-copy.ts';\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 type {IOperationContext, TOperationData} from '../types.ts';\r\nimport {getPropertyChainValue} from './get-property-chain-value.ts';\r\nimport {getGlobals} from './globals.ts';\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\nexport function resolveExternalPropertyChain(\r\n sourceObject: TOperationData,\r\n operationContext: IOperationContext,\r\n propertyChainOrRegularObject:\r\n | ExternalProperty\r\n | Record<string, any>\r\n | null\r\n | undefined\r\n) {\r\n if (\r\n propertyChainOrRegularObject === null ||\r\n propertyChainOrRegularObject === undefined\r\n ) {\r\n return null;\r\n }\r\n\r\n if (isExternalProperty(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\r\nexport function isExternalProperty(\r\n value: ExternalProperty | Record<string, any>\r\n): value is ExternalProperty {\r\n return (\r\n typeof value === 'string' &&\r\n (value.toLocaleLowerCase().startsWith('operationdata.') ||\r\n value.toLocaleLowerCase().startsWith('globaldata.') ||\r\n value.toLocaleLowerCase().startsWith('context.'))\r\n );\r\n}\r\n\r\nexport type ExternalProperty =\r\n | `operationdata.${string}`\r\n | `globaldata.${string}`\r\n | `context.${string}`;\r\n","import {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\r\n\r\nexport interface IForEachOperationData {\r\n /**\r\n * @type=ParameterType:array\r\n * @required\r\n */\r\n collection: unknown[] | string;\r\n}\r\n\r\n/**\r\n * This operation iterates over 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 endForEach} 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\nexport const forEach: TOperation<IForEachOperationData> = function (\r\n operationData: IForEachOperationData\r\n) {\r\n const {collection} = operationData;\r\n const resolvedCollection =\r\n typeof collection === 'string'\r\n ? (resolveExternalPropertyChain(\r\n operationData,\r\n this,\r\n collection as ExternalProperty\r\n ) as any[])\r\n : collection;\r\n\r\n if (\r\n resolvedCollection !== null &&\r\n resolvedCollection !== undefined &&\r\n !Array.isArray(resolvedCollection)\r\n ) {\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 = findEndForEachIndex(this);\r\n if (resolvedCollection?.length) {\r\n this.loopIndex = 0;\r\n this.loopLength = resolvedCollection.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 (resolvedCollection?.length && this.loopIndex !== undefined) {\r\n this.currentItem = resolvedCollection[this.loopIndex];\r\n }\r\n\r\n return operationData;\r\n};\r\n\r\nfunction findEndForEachIndex(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: forEachSystemName,\r\n matchingName: endForEachSystemName,\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\r\nexport const forEachSystemName = 'forEach';\r\nexport const endForEachSystemName = 'endForEach';\r\n","import {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\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 /**\r\n * @required\r\n */\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 const [left, right] = expression.split(/!=|==|>=|<=|>|</);\r\n\r\n const operator = expression.substring(\r\n left.length,\r\n expression.length - right.length\r\n ) as TOperator;\r\n\r\n const leftNr = parseInt(left);\r\n const rightNr = parseInt(right);\r\n\r\n return [\r\n (isNaN(leftNr)\r\n ? resolveExternalPropertyChain(\r\n operationData,\r\n operationContext,\r\n left as ExternalProperty\r\n )\r\n : leftNr) as TValue,\r\n operator,\r\n (isNaN(rightNr)\r\n ? resolveExternalPropertyChain(\r\n operationData,\r\n operationContext,\r\n right as ExternalProperty\r\n )\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: whenSystemName,\r\n matchingName: otherwiseSystemName,\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: whenSystemName,\r\n matchingName: endWhenSystemName,\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n\r\nexport const whenSystemName = 'when';\r\nexport const otherwiseSystemName = 'otherwise';\r\nexport const endWhenSystemName = 'endWhen';\r\n","export function isPromise(obj: any): obj is Promise<unknown> {\r\n return typeof obj === 'object' && typeof obj.then === 'function';\r\n}\r\n","import type {IResolvedOperation} from '../configuration/types.ts';\r\nimport {Diagnostics} from '../diagnostics/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {\r\n endForEachSystemName,\r\n forEachSystemName,\r\n} from '../operation/for-each.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport type {IOperationContext, TOperationData} from '../operation/types.ts';\r\nimport {endWhenSystemName, whenSystemName} from '../operation/when.ts';\r\nimport {isPromise} from '../util/guards/is-promise.ts';\r\nimport type {IAction} from './types.ts';\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 === whenSystemName) {\r\n context = this._pushContext(context);\r\n } else if (\r\n operationInfo.systemName === forEachSystemName &&\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 === endWhenSystemName ||\r\n (operationInfo.systemName === endForEachSystemName &&\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 as TOperationData\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","import type {IResolvedOperation} from '../configuration/types.ts';\r\nimport {Diagnostics} from '../diagnostics/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {Action} from './action.ts';\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 type {IResolvedOperation} from '../configuration/types.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {IStrictDuration} from '../types.ts';\r\nimport {EndableAction} from './endable-action.ts';\r\nimport type {ITimelineAction} from './types.ts';\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) {\r\n this._active = Boolean(this.endOperations.length);\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 return super.end(initOperationData).then(result => {\r\n this._active = false;\r\n return result;\r\n });\r\n }\r\n}\r\n","export default function dashToCamelCase(input: string) {\r\n return input.replace(/-([a-z])/g, g => g[1].toUpperCase());\r\n}\r\n","import fs from 'node:fs';\r\nimport path from 'node:path';\r\nimport type { TOperationData } from 'operation/types.ts';\r\nimport type {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IOperationConfiguration,\r\n} from '../configuration/types.ts';\r\nimport dashToCamelCase from '../util/dash-to-camel-case.ts';\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 = _deduplicate(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 _deduplicate(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<TOperationData>[]\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 _deduplicate(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 return (lookup[imp.systemName] = true);\r\n });\r\n}\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IAddClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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 */\r\nexport const addClass: TOperation<IAddClassOperationData> = operationData => {\r\n const {selectedElement, className} = operationData;\r\n selectedElement.addClass(className);\r\n return operationData;\r\n};\r\n","import type {IController} from '../../controllers/types.ts';\r\n\r\nconst controllersDataName = 'eligiusEngineControllers';\r\n\r\nfunction getElementData(\r\n name: string,\r\n element: JQuery\r\n): IController<any>[] | undefined {\r\n return element.data(name);\r\n}\r\n\r\nconst getElementControllers = getElementData.bind(null, controllersDataName);\r\n\r\nexport {getElementData, getElementControllers, controllersDataName};\r\n","import {\r\n controllersDataName,\r\n getElementControllers,\r\n} from './get-element-data.ts';\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 type {TOperationData} from '../types.ts';\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 type {TOperationData} from '../types.ts';\r\nimport {mergeOperationData} from './merge-operation-data.ts';\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 type {IController} from '../controllers/types.ts';\r\nimport {attachControllerToElement} from './helper/attach-controller-to-element.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {IOperationContext, TOperation, TOperationData} from './types.ts';\r\n\r\nexport type IAddControllerToElementOperationData<\r\n T extends TOperationData = TOperationData,\r\n> = {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\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 */\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 {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IAnimateOperationData {\r\n /**\r\n * @type=ParameterType:boolean\r\n */\r\n animationEasing?: string;\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @required\r\n */\r\n animationProperties: Record<string, unknown>;\r\n /**\r\n * @type=ParameterType:number\r\n * @required\r\n */\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> = (\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IAnimateWithClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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\nexport const animateWithClass: TOperation<\r\n IAnimateWithClassOperationData,\r\n Promise<IAnimateWithClassOperationData>\r\n> = (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","import type {TOperationData} from '../../operation/types.ts';\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 type {IOperationContext, TOperationData} from '../../operation/types.ts';\r\nimport {resolveExternalPropertyChain} from './resolve-external-property-chain.ts';\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 {removeEventDataFromOperationData} from './helper/remove-event-data-from-operation-data.ts';\r\nimport {resolveEventArguments} from './helper/resolve-event-arguments.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IBroadcastEventOperationData {\r\n eventArgs: unknown[];\r\n /**\r\n * @type=ParameterType:eventTopic\r\n */\r\n eventTopic?: string;\r\n /**\r\n * @type=ParameterType:eventName\r\n * @required\r\n */\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\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 $ from 'jquery';\r\nimport type {IOperationContext, TOperationData} from '../../operation/types.ts';\r\nimport {isObject} from '../../util/guards/is-object.ts';\r\nimport {deepCopy} from './deep-copy.ts';\r\nimport type {ExternalProperty} from './resolve-external-property-chain.ts';\r\nimport {\r\n isExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './resolve-external-property-chain.ts';\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\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: (\r\n propertyChain: ExternalProperty | Record<string, any>\r\n ) => 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 (isExternalProperty(value)) {\r\n copy[key] = resolvePropertyChain(value);\r\n } else if (Array.isArray(value)) {\r\n value.forEach((item, index, arr) => {\r\n if (isExternalProperty(item)) {\r\n arr[index] = resolvePropertyChain(item);\r\n } else if (isObject(item)) {\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport type TCalculationOperator = '+' | '-' | '*' | '/' | '%' | '**';\r\n\r\nexport interface ICalcOperationData {\r\n /**\r\n * The left operand\r\n * @type=ParameterType:number\r\n * @required\r\n */\r\n left: string | number;\r\n /**\r\n * The right operand\r\n * @type=ParameterType:number\r\n * @required\r\n */\r\n right: string | number;\r\n /**\r\n * @required\r\n */\r\n operator: TCalculationOperator;\r\n /**\r\n * @output\r\n */\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IClearElementOperationData {\r\n /**\r\n * @dependency\r\n */\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> = (\r\n operationData: IClearElementOperationData\r\n) => {\r\n const {selectedElement} = operationData;\r\n selectedElement.empty();\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\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<\r\n IClearOperationDataOperationData\r\n> = (operationData: IClearOperationDataOperationData) => {\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 type {RequireKeys} from 'types.ts';\r\nimport {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\r\n\r\nexport type TTagNames = keyof HTMLElementTagNameMap;\r\n\r\nexport interface ICreateElementOperationData<T extends TTagNames> {\r\n /**\r\n * @required\r\n */\r\n elementName: T;\r\n text?: string;\r\n /**\r\n * @type=ParameterType:object\r\n */\r\n attributes?: Partial<HTMLElementTagNameMap[T]>;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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<\r\n ICreateElementOperationData<TTagNames>,\r\n RequireKeys<ICreateElementOperationData<TTagNames>, 'template'>\r\n> = function <T extends TTagNames>(\r\n this: IOperationContext,\r\n operationData: ICreateElementOperationData<T>\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\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 as RequireKeys<\r\n ICreateElementOperationData<TTagNames>,\r\n 'template'\r\n >;\r\n};\r\n","export type TimelineEventName = keyof typeof TimelineEventNames;\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.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {TOperation} from './types.ts';\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 type {IEndableAction} from '../action/types.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IEndActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: IEndableAction;\r\n actionOperationData: Record<string, unknown>;\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\nexport const endAction: TOperation<IEndActionOperationData> = (\r\n operationData: IEndActionOperationData\r\n) => {\r\n let {actionOperationData, ...newOperationData} = operationData;\r\n\r\n return new Promise<IEndActionOperationData>((resolve, reject) => {\r\n newOperationData = mergeOperationData(\r\n newOperationData,\r\n actionOperationData\r\n );\r\n\r\n newOperationData.actionInstance.end(newOperationData).then(() => {\r\n Object.keys(actionOperationData).forEach(key => {\r\n delete (newOperationData as any)[key];\r\n });\r\n internalResolve(resolve, newOperationData);\r\n }, reject);\r\n });\r\n};\r\n","import type {TOperation, TOperationData} from './types.ts';\r\n\r\n/**\r\n * This operation checks if the current loop should end or start the next iteration.\r\n */\r\nexport const endForEach: 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 type {TOperation} from './types.ts';\r\n\r\n/**\r\n * This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.\r\n */\r\nexport const endWhen: TOperation<Record<string, unknown>> = function (\r\n operationData: Record<string, unknown>\r\n) {\r\n delete this.whenEvaluation;\r\n return operationData;\r\n};\r\n","import type {IController} from '../controllers/types.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\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 /**\r\n * @dependency\r\n */\r\n controllerInstance: IController<TOperationData>;\r\n controllerExtension: Record<PropertyKey, unknown>;\r\n}\r\n\r\n/**\r\n * Extends the current controller with given extension.\r\n */\r\nexport const extendController: TOperation<IExtendControllerOperationData> = (\r\n operationData: IExtendControllerOperationData\r\n) => {\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IGetAttributesFromElementOperationData {\r\n /**\r\n * The HTML element whose attributes will be retrieved\r\n * @dependency\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 * @output\r\n */\r\n attributeValues?: Record<string, unknown>;\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<\r\n IGetAttributesFromElementOperationData\r\n> = (operationData: IGetAttributesFromElementOperationData) => {\r\n const {selectedElement, attributeNames} = operationData;\r\n\r\n operationData.attributeValues = attributeNames.reduce(\r\n (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 },\r\n {} as Record<string, unknown>\r\n );\r\n\r\n return operationData;\r\n};\r\n","import type {IController} from '../controllers/types.ts';\r\nimport {getElementControllers} from './helper/get-element-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetControllerFromElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:controllerName\r\n * @required\r\n */\r\n controllerName: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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<\r\n IGetControllerFromElementOperationData\r\n> = (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 type * as controllers from '../controllers/index.ts';\r\nimport type {IController} from '../controllers/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\ntype TSystemName = keyof typeof controllers;\r\nexport interface IGetControllerInstanceOperationData {\r\n /**\r\n * @required\r\n */\r\n systemName: TSystemName;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\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 type {IDimensions} from '../../types.ts';\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 const prefix = ratioModifier.substring(0, 1);\r\n\r\n const ratio = ratioModifier.substring(\r\n ratioModifier.indexOf('[') + 1,\r\n ratioModifier.indexOf(']') - (ratioModifier.indexOf('[') - 1)\r\n );\r\n\r\n const 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 const 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 const [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 {modifyDimensions} from './helper/modify-dimensions.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetElementDimensionsOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:dimensionsModifier\r\n */\r\n modifier?: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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 ratio of 8 to 1 relative to the height.\r\n */\r\nexport const getElementDimensions: TOperation<\r\n IGetElementDimensionsOperationData\r\n> = (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\r\n if (dimensions.height === 0) {\r\n dimensions.height = dimensions.width;\r\n }\r\n\r\n if (modifier) {\r\n dimensions = modifyDimensions(dimensions, modifier);\r\n }\r\n\r\n operationData.dimensions = dimensions;\r\n return operationData;\r\n};\r\n","import type {RequireKeys} from 'types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetImportOperationData {\r\n /**\r\n * @type=ParameterType:systemName\r\n * @required\r\n */\r\n systemName: string;\r\n /**\r\n * @output\r\n */\r\n importedInstance?: unknown;\r\n}\r\n\r\n/**\r\n * This operation retrieves the import specified by the given `systemName` 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<\r\n IGetImportOperationData,\r\n Omit<RequireKeys<IGetImportOperationData, 'importedInstance'>, 'systemName'>\r\n> = function (operationData: IGetImportOperationData) {\r\n const {systemName} = operationData;\r\n const callBack = (instance: unknown) => {\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 as Omit<\r\n RequireKeys<IGetImportOperationData, 'importedInstance'>,\r\n 'systemName'\r\n >;\r\n};\r\n","import type {TOperation} from './types.ts';\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 * @output\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\nexport const getQueryParams: TOperation<IGetQueryParamsOperationData> = (\r\n operationData: IGetQueryParamsOperationData\r\n) => {\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 type {TOperation} from './types.ts';\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?: unknown[];\r\n /**\r\n * If any, the results of the method invocation are assigned to the property\r\n */\r\n methodResult?: unknown;\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<\r\n IInvokeObjectMethodOperationData,\r\n Omit<IInvokeObjectMethodOperationData, 'methodName' | 'methodArguments'>\r\n> = (operationData: IInvokeObjectMethodOperationData) => {\r\n const {methodName, methodArguments, ...newOperationData} = operationData;\r\n\r\n const func = operationData.instance[methodName];\r\n if (typeof func === 'function') {\r\n newOperationData.methodResult = func.apply(\r\n operationData.instance,\r\n methodArguments ?? []\r\n );\r\n } else {\r\n console.error(`The given member name ${methodName} is not a function`);\r\n }\r\n\r\n return newOperationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nconst jsonCache: Record<string, unknown> = {};\r\n\r\nexport interface ILoadJSONOperationData {\r\n /**\r\n * The URL where the JSON will be retrieved from\r\n * @required\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 * @output\r\n */\r\n json?: any;\r\n}\r\n\r\nconst 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\nexport const loadJson: TOperation<ILoadJSONOperationData> = async (\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\r\nexport const clearCache = () => {\r\n for (const p in jsonCache) {\r\n delete jsonCache[p];\r\n }\r\n};\r\n","import {getGlobals} from './helper/globals.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\n/**\r\n * This operation logs the current operation data, global data and context to the console.\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","export function isString(value: any): value is string {\r\n return typeof value === 'string';\r\n}\r\n","import {isFunction} from '../util/guards/is-function.ts';\r\nimport {isString} from '../util/guards/is-string.ts';\r\nimport {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport type MathFunctionKeys = {\r\n [K in keyof Math]: Math[K] extends (...args: any) => any ? K : never;\r\n}[keyof Math];\r\n\r\nexport type MathNonFunctionKeys = {\r\n [K in keyof Math]: Math[K] extends (...args: any) => any ? never : K;\r\n}[keyof Math];\r\n\r\nexport interface IMathOperationData {\r\n /**\r\n * @type=ParameterType:array\r\n * @required\r\n */\r\n args: (number | string | MathNonFunctionKeys)[];\r\n /**\r\n * @required\r\n */\r\n functionName: MathFunctionKeys;\r\n /**\r\n * @output\r\n */\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\nexport const math: TOperation<\r\n IMathOperationData,\r\n Omit<IMathOperationData, 'args' | 'functionName'>\r\n> = function (operationData: IMathOperationData) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n operationData.args = resolveMathConstants(operationData.args);\r\n\r\n const {args, functionName, ...newOperationData} = operationData;\r\n\r\n newOperationData.mathResult = (Math[functionName] as Function).apply(\r\n null,\r\n args\r\n );\r\n\r\n return newOperationData;\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 {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\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\nexport const otherwise: TOperation<Record<string, unknown>> = function (\r\n operationData: Record<string, unknown>\r\n) {\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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> = (\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 type {IController} from '../controllers/types.ts';\r\nimport {getElementControllers} from './helper/get-element-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveControllerFromElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:controllerName\r\n */\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 && controllers) {\r\n const idx = controllers.indexOf(controller);\r\n controllers.splice(idx, 1);\r\n controller.detach(this.eventbus);\r\n } else {\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 return operationData;\r\n };\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveElementOperationData {\r\n /**\r\n * @dependency\r\n */\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> = (\r\n operationData: IRemoveElementOperationData\r\n) => {\r\n const {selectedElement} = operationData;\r\n selectedElement.remove();\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IRemovePropertiesFromOperationDataOperationData {\r\n /**\r\n * @required\r\n */\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 remove the property `propertyNames` from the result.\r\n */\r\nexport const removePropertiesFromOperationData: TOperation<\r\n IRemovePropertiesFromOperationDataOperationData,\r\n Omit<IRemovePropertiesFromOperationDataOperationData, 'propertyNames'>\r\n> = (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 );\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IReparentElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:selector\r\n * @required\r\n */\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 operationData: IReparentElementOperationData\r\n) => {\r\n const {selectedElement, newParentSelector} = operationData;\r\n selectedElement.remove().appendTo(newParentSelector);\r\n return operationData;\r\n};\r\n","import type {IAction} from '../action/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IRequestActionOperationData {\r\n /**\r\n * @type=ParameterType:actionName\r\n * @required\r\n */\r\n systemName: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\nexport const requestAction: TOperation<\r\n IRequestActionOperationData,\r\n Required<IRequestActionOperationData>\r\n> = function (operationData: IRequestActionOperationData) {\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 as Required<IRequestActionOperationData>;\r\n};\r\n","import {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\nexport interface IResizeActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: any;\r\n /**\r\n * @type=ParameterType:object\r\n */\r\n actionOperationData: TOperationData;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n */\r\nexport const resizeAction: TOperation<IResizeActionOperationData> = (\r\n operationData: IResizeActionOperationData\r\n) => {\r\n const {actionInstance, actionOperationData} = operationData;\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n if (\r\n 'resize' in actionInstance &&\r\n typeof actionInstance.resize === 'function'\r\n ) {\r\n return actionInstance.resize(operationData);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {TOperation} from './types.ts';\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 /**\r\n * @type=ParameterType:selector\r\n * @required\r\n */\r\n selector: string;\r\n useSelectedElementAsRoot?: boolean;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\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 as ExternalProperty\r\n ) as string;\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.ts';\r\nimport {getGlobals, type TGlobalCache} from './helper/globals.ts';\r\nimport {resolveExternalPropertyChain} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation, TOperationData} from './types.ts';\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 /**\r\n * @required\r\n */\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\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 ) as Record<string, any>;\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 type {TOperation} from './types.ts';\r\n\r\nexport interface ISetElementAttributesOperationData {\r\n /**\r\n * @required\r\n */\r\n attributes: Record<string, unknown>;\r\n /**\r\n * @dependency\r\n */\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\nexport const setElementAttributes: TOperation<\r\n ISetElementAttributesOperationData\r\n> = (operationData: ISetElementAttributesOperationData) => {\r\n const {attributes, selectedElement} = operationData;\r\n selectedElement.attr(attributes);\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface ISetElementContentOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\r\n template: string | JQuery.Node;\r\n /**\r\n * overwite = the contents of the selected element are replaced by the given template\r\n *\r\n * append = the new content will be inserted after the current content\r\n *\r\n * prepend = the new content will be inserted before the current content\r\n */\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\nexport const setElementContent: TOperation<ISetElementContentOperationData> = (\r\n operationData: ISetElementContentOperationData\r\n) => {\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetGlobalDataOperationData {\r\n /**\r\n * @required\r\n */\r\n propertyNames: string[];\r\n}\r\n\r\n/**\r\n * This operation copies the specified properties from the operationData to the global data.\r\n */\r\nexport const setGlobalData: TOperation<\r\n ISetGlobalDataOperationData,\r\n Omit<ISetGlobalDataOperationData, 'propertyNames'>\r\n> = (operationData: ISetGlobalDataOperationData) => {\r\n const {propertyNames, ...newOperationData} = operationData;\r\n const newGlobals = Object.fromEntries(\r\n Object.entries(operationData).filter(([name, _value]) =>\r\n propertyNames.includes(name)\r\n )\r\n );\r\n\r\n setGlobals(newGlobals);\r\n\r\n return newOperationData;\r\n};\r\n","import {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetOperationData {\r\n /**\r\n * If set to true, the plucked properties replace the current operation data.\r\n */\r\n override?: boolean;\r\n /**\r\n * @required\r\n */\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\nexport const setOperationData: TOperation<\r\n ISetOperationData,\r\n Omit<ISetOperationData, 'override' | 'properties'>\r\n> = function (operationData: ISetOperationData) {\r\n const {override = false, properties, ...newOperationData} = operationData;\r\n\r\n const resolvedProperties = resolvePropertyValues(\r\n newOperationData,\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 ...newOperationData,\r\n ...resolvedProperties,\r\n };\r\n};\r\n","import {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetStyleOperationData {\r\n /**\r\n * @required\r\n */\r\n properties: Record<string, any>;\r\n /**\r\n * @dependency\r\n */\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\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 type {IAction} from '../action/types.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\nexport interface IStartActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: IAction;\r\n /**\r\n * @type=ParameterType:object\r\n */\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\nexport const startAction: TOperation<IStartActionOperationData> = (\r\n operationData: IStartActionOperationData\r\n) => {\r\n let {actionInstance, actionOperationData, ...newOperationData} =\r\n operationData;\r\n\r\n return new Promise((resolve, reject) => {\r\n newOperationData = mergeOperationData(\r\n newOperationData,\r\n actionOperationData\r\n );\r\n\r\n actionInstance.start(newOperationData).then(() => {\r\n Object.keys(actionOperationData).forEach(key => {\r\n delete (newOperationData as any)[key];\r\n });\r\n internalResolve(resolve, {...newOperationData, actionInstance});\r\n }, reject);\r\n });\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IToggleClassOperationData {\r\n /**\r\n * The element on which the class will be toggled\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * The class that will be toggled\r\n * @type=ParameterType:className\r\n * @required\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\nexport const toggleClass: TOperation<IToggleClassOperationData> = (\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IToggleElementOperationData {\r\n /**\r\n * The element whose visibility will be toggled\r\n * @dependency\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\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IWaitOperationData {\r\n /**\r\n * The amount of milliseconds the operation will wait for.\r\n * @required\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\nexport const wait: TOperation<IWaitOperationData> = (\r\n operationData: IWaitOperationData\r\n) => {\r\n const {milliseconds, ...newOperationData} = operationData;\r\n\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n internalResolve(resolve, newOperationData);\r\n }, milliseconds);\r\n });\r\n};\r\n","export {addClass} from './add-class.ts';\r\nexport {addControllerToElement} from './add-controller-to-element.ts';\r\nexport {animate} from './animate.ts';\r\nexport {animateWithClass} from './animate-with-class.ts';\r\nexport {broadcastEvent} from './broadcast-event.ts';\r\nexport {calc} from './calc.ts';\r\nexport {clearElement} from './clear-element.ts';\r\nexport {clearOperationData} from './clear-operation-data.ts';\r\nexport {createElement} from './create-element.ts';\r\nexport {customFunction} from './custom-function.ts';\r\nexport {endAction} from './end-action.ts';\r\nexport {endForEach} from './end-for-each.ts';\r\nexport {endWhen} from './end-when.ts';\r\nexport {extendController} from './extend-controller.ts';\r\nexport {forEach} from './for-each.ts';\r\nexport {getAttributesFromElement} from './get-attributes-from-element.ts';\r\nexport {getControllerFromElement} from './get-controller-from-element.ts';\r\nexport {getControllerInstance} from './get-controller-instance.ts';\r\nexport {getElementDimensions} from './get-element-dimensions.ts';\r\nexport {getImport} from './get-import.ts';\r\nexport {getQueryParams} from './get-query-params.ts';\r\nexport {invokeObjectMethod} from './invoke-object-method.ts';\r\nexport {loadJson} from './load-json.ts';\r\nexport {log} from './log.ts';\r\nexport {math} from './math.ts';\r\nexport {otherwise} from './otherwise.ts';\r\nexport {removeClass} from './remove-class.ts';\r\nexport {removeControllerFromElement} from './remove-controller-from-element.ts';\r\nexport {removeElement} from './remove-element.ts';\r\nexport {removePropertiesFromOperationData} from './remove-properties-from-operation-data.ts';\r\nexport {reparentElement} from './reparent-element.ts';\r\nexport {requestAction} from './request-action.ts';\r\nexport {resizeAction} from './resize-action.ts';\r\nexport {selectElement} from './select-element.ts';\r\nexport {setData} from './set-data.ts';\r\nexport {setElementAttributes} from './set-element-attributes.ts';\r\nexport {setElementContent} from './set-element-content.ts';\r\nexport {setGlobalData} from './set-global-data.ts';\r\nexport {setOperationData} from './set-operation-data.ts';\r\nexport {setStyle} from './set-style.ts';\r\nexport {startAction} from './start-action.ts';\r\nexport {toggleClass} from './toggle-class.ts';\r\nexport {toggleElement} from './toggle-element.ts';\r\nexport * from './types.ts';\r\nexport {wait} from './wait.ts';\r\nexport {when} from './when.ts';\r\n","import {v4 as uuidv4} from 'uuid';\r\nimport {deepCopy} from '../../operation/helper/deep-copy.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport type {TOperation, TOperationData} from '../../operation/types.ts';\r\nimport type {\r\n ExtractOperationDataType,\r\n GetOperationByName,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n ITimelineActionConfiguration,\r\n TOperationName,\r\n TOperationType,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\r\n\r\n/**\r\n *\r\n * Container factory capable of creating the different kinds of actions.\r\n * For each type of action a dedicated factory will be returned.\r\n *\r\n */\r\nexport class ActionCreatorFactory {\r\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\r\n\r\n /**\r\n *\r\n * Starts the creation of an action in the `actions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `initActions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `eventActions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `timelineActions` list with the specified name and uri\r\n *\r\n * @param uri\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Returns the fluent scope back to the `Configurationfactory`\r\n *\r\n * @returns\r\n */\r\n end() {\r\n return this.configurationfactory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in creating an action\r\n *\r\n */\r\nexport class ActionCreator<\r\n T extends IActionConfiguration = IActionConfiguration,\r\n> {\r\n actionConfig: T;\r\n\r\n /**\r\n *\r\n * Initializes an action configuration with the given name\r\n *\r\n * @param name\r\n * @param factory\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: name ?? '',\r\n id: uuidv4(),\r\n startOperations: [],\r\n } as unknown as T;\r\n }\r\n\r\n /**\r\n *\r\n * The unique id of the action\r\n *\r\n * @returns\r\n */\r\n getId() {\r\n return this.actionConfig.id;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the name of the action\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n setName(name: string) {\r\n this.actionConfig.name = name;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Returns a copy of the internal state of the `ActionCreator`\r\n *\r\n * @param callBack\r\n * @returns\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 /**\r\n *\r\n * Adds the operation data for a start operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(operationClass: T, operationData: Dt) {\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 /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: T, operationData: O) {\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 /**\r\n *\r\n * Returns the fluent scope back to the `ActionCreatorFactory`\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.factory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in creating an endable action\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 /**\r\n *\r\n * Adds the operation data for an end operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(operationClass: T, operationData: Dt) {\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] as TOperationName, operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for an end operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: TOperationName, operationData: O) {\r\n if (!operations[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\n/**\r\n *\r\n * A factory that assists in creating a timeline action\r\n *\r\n */\r\nexport class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {\r\n /**\r\n *\r\n * Sets the duration specified by the given start and optional end positions\r\n *\r\n * @param start\r\n * @param end\r\n * @returns\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 {deepCopy} from '../../operation/helper/deep-copy.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport type {TOperation, TOperationData} from '../../operation/types.ts';\r\nimport type {IDuration} from '../../types.ts';\r\nimport type {\r\n ExtractOperationDataType,\r\n GetOperationByName,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IOperationConfiguration,\r\n ITimelineActionConfiguration,\r\n TOperationName,\r\n TOperationType,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\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\n/**\r\n *\r\n * A factory that assists in editing an action\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 = structuredClone(this.actionConfig);\r\n }\r\n\r\n /**\r\n *\r\n * Returns a copy of the current internal state of the factory\r\n *\r\n * @param callBack\r\n * @returns\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 /**\r\n *\r\n * Sets the action name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Gets the action name\r\n *\r\n * @returns\r\n */\r\n getName() {\r\n return this.actionConfig.name;\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperationByType<T extends TOperation<TOperationData>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractOperationDataType<T>>\r\n ): OperationEditor<this, T> {\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 ) as OperationEditor<this, T>;\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @param id\r\n * @returns\r\n */\r\n addStartOperation(\r\n systemName: TOperationName,\r\n operationData: TOperationData,\r\n id: string = uuidv4()\r\n ): OperationEditor<this, TOperation<TOperationData>> {\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,\r\n systemName: systemName,\r\n operationData: operationData,\r\n } as IOperationConfiguration<TOperation<TOperationData>>;\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, TOperation<TOperationData>>(\r\n newConfig,\r\n this\r\n );\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editor for the start operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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>, TOperation<TOperationData>>(\r\n operation,\r\n this\r\n );\r\n }\r\n\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n /**\r\n *\r\n * Removes the start operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Moves the start operation associated with the given id in the given direction\r\n *\r\n * @param id\r\n * @param direction\r\n * @returns\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 /**\r\n *\r\n * Return the fluent scopt to the `ConfigurationFactory`\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in editing an endable action\r\n *\r\n */\r\nexport class EndableActionEditor<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\r\n> extends ActionEditor<T> {\r\n /**\r\n *\r\n * Adds the operation data for a end operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(\r\n operationClass: T,\r\n operationData: Dt\r\n ): OperationEditor<this, TOperationType> {\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] as TOperationName, operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: TOperationName, operationData: O) {\r\n if (!operations[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 const operationCsl = operations[systemName];\r\n return new OperationEditor<this, typeof operationCsl>(newConfig, this);\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editor for the end operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Removes the end operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Moves the end operation associated with the given id in the specified direction\r\n *\r\n * @param id\r\n * @param direction\r\n * @returns\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\n/**\r\n *\r\n * A factory that assists in editing a timeline action\r\n *\r\n */\r\nexport class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {\r\n /**\r\n *\r\n * Sets the duration specified by the given start and optional end positions\r\n *\r\n * @param start\r\n * @param end\r\n * @returns\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\n/**\r\n *\r\n * A factory that assists in editing an operation\r\n *\r\n */\r\nexport class OperationEditor<\r\n T extends ActionEditor,\r\n O extends TOperationType = TOperation<TOperationData>,\r\n> {\r\n constructor(\r\n private operationConfig: IOperationConfiguration<\r\n ExtractOperationDataType<O>\r\n >,\r\n private actionEditor: T\r\n ) {}\r\n\r\n /**\r\n *\r\n * Invokes the given callback with a copy of the internal state of the factory\r\n *\r\n * @param callBack\r\n * @returns\r\n */\r\n getConfiguration(\r\n callBack: (\r\n config: IOperationConfiguration<ExtractOperationDataType<O>>\r\n ) => IOperationConfiguration<ExtractOperationDataType<O>>\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 /**\r\n *\r\n * Gets the system name\r\n *\r\n * @returns\r\n */\r\n getSystemName() {\r\n return this.operationConfig.systemName;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the system name\r\n *\r\n * @param systemName\r\n * @returns\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 /**\r\n *\r\n * Sets the operation data\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\n setOperationData(operationData: ExtractOperationDataType<O>) {\r\n this.operationConfig.operationData = operationData;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the value on the current `operationData` with the given key\r\n *\r\n * @param key\r\n * @param value\r\n * @returns\r\n */\r\n setOperationDataItem(\r\n key: keyof ExtractOperationDataType<O>,\r\n value: ExtractOperationDataType<O>[keyof ExtractOperationDataType<O>]\r\n ) {\r\n let {operationData} = this.operationConfig;\r\n if (!operationData) {\r\n operationData = {} as ExtractOperationDataType<O>;\r\n }\r\n operationData[key] = value;\r\n return this.setOperationData(operationData);\r\n }\r\n\r\n /**\r\n *\r\n * returns all of the defined property names on the current `operationData`\r\n *\r\n * @returns\r\n */\r\n getOperationDataKeys(): keyof ExtractOperationDataType<O> {\r\n const {operationData} = this.operationConfig;\r\n return (operationData\r\n ? Object.keys(operationData)\r\n : []) as unknown as keyof ExtractOperationDataType<O>;\r\n }\r\n\r\n /**\r\n *\r\n * Gets the value of the given key on the current `operationData`\r\n *\r\n * @param key\r\n * @returns\r\n */\r\n getOperationDataValue(key: keyof ExtractOperationDataType<O>) {\r\n const {operationData} = this.operationConfig;\r\n return operationData?.[key];\r\n }\r\n\r\n /**\r\n *\r\n * Returns the fluent scope back to the action editor\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.actionEditor;\r\n }\r\n}\r\n","/**\r\n *\r\n * Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.\r\n *\r\n * This function is pure, so it returns a new instance that reflects the merging of the two objects.\r\n *\r\n * The merge is shallow.\r\n *\r\n * @param target\r\n * @param source\r\n * @returns\r\n */\r\nexport const mergeIfMissing = <\r\n Src extends Record<PropertyKey, any>,\r\n Trg extends Partial<Src> & Record<PropertyKey, any>,\r\n>(\r\n target: Src,\r\n source: Trg\r\n): Src & Trg =>\r\n Object.entries(source).reduce(\r\n (acc, [key, value]) => (key in acc ? acc : {...acc, [key]: value}),\r\n target\r\n );\r\n","import type {ILanguageLabel, TLanguageCode} from '../../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\r\n\r\n/**\r\n * Factory that assists with editing a label\r\n */\r\nexport class LabelEditor {\r\n constructor(\r\n private configurationFactory: ConfigurationFactory,\r\n private languageLabel: ILanguageLabel\r\n ) {}\r\n\r\n private _internalGetLabel(languageCode: string) {\r\n return this.languageLabel.labels.find(x => x.languageCode === languageCode);\r\n }\r\n\r\n /**\r\n *\r\n * Set the translation associated with the given language code\r\n *\r\n * @param languageCode\r\n * @param translation\r\n * @returns\r\n */\r\n setLabel(languageCode: TLanguageCode, 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 /**\r\n *\r\n * Remove all of the translations for the given language code\r\n *\r\n * @param languageCode\r\n * @returns\r\n */\r\n removeLabel(languageCode: TLanguageCode) {\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 /**\r\n *\r\n * Returns the fluent scope back to the `ConfigurationFactory`\r\n *\r\n * @returns\r\n */\r\n end() {\r\n return this.configurationFactory;\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 currentTime = document?.timeline?.currentTime;\r\n const start = currentTime ? Number(currentTime) : performance.now();\r\n\r\n const frame = (time: number) => {\r\n if (signal.aborted) return;\r\n callback(time);\r\n scheduleFrame(time);\r\n };\r\n\r\n const {round} = Math;\r\n const scheduleFrame = (time: number) => {\r\n const elapsed = time - start;\r\n const roundedElapsed = 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 $ from 'jquery';\r\nimport type {\r\n IResolvedEngineConfiguration,\r\n IResolvedTimelineConfiguration,\r\n} from '../configuration/types.ts';\r\nimport {animationInterval} from '../util/animation-interval.ts';\r\nimport type {ITimelineProvider, TPlayState} from './types.ts';\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","import $ from 'jquery';\r\nimport {v4 as uuidv4} from 'uuid';\r\nimport vjs from 'video.js';\r\nimport type {IResolvedEngineConfiguration} from '../configuration/types.ts';\r\nimport type {ITimelineProvider, TPlayState} from './types.ts';\r\n\r\nconst videojs = vjs.default ?? vjs;\r\n\r\nexport class VideoJsTimelineProvider implements ITimelineProvider {\r\n private _videoElementId: string = uuidv4();\r\n private _eventHandlers: (() => void)[] = [];\r\n\r\n private _playState: TPlayState = 'stopped';\r\n public get playState(): TPlayState {\r\n return this._playState;\r\n }\r\n loop = false;\r\n private _urls: string[] = [];\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 private _player: any | undefined;\r\n\r\n constructor(private config: IResolvedEngineConfiguration) {}\r\n\r\n init(): Promise<void> {\r\n videojs.log.level('all');\r\n\r\n const selector =\r\n this.config.timelineProviderSettings.mediaplayer?.selector ?? '';\r\n this._urls = this._extractUrls(this.config);\r\n this._addVideoElements(selector, this._urls);\r\n\r\n const self = this;\r\n\r\n const promise = new Promise<void>(resolve => {\r\n setTimeout(() => {\r\n this._player = videojs(\r\n this._videoElementId,\r\n {\r\n controls: false,\r\n controlBar: false,\r\n liveui: false,\r\n autoplay: false,\r\n preload: 'auto',\r\n loop: this.loop,\r\n src: this._urls[0],\r\n },\r\n function onPlayerReady(this: any) {\r\n this.one('firstplay', () => self._onFirstFrame?.());\r\n this.one('canplay', () => resolve());\r\n self._addPlayerListener(\r\n this,\r\n 'ended',\r\n self._handleEnded.bind(self)\r\n );\r\n self._addPlayerListener(\r\n this,\r\n 'timeupdate',\r\n self._handleTimeUpdate.bind(self)\r\n );\r\n this.load();\r\n }\r\n ); //as PlayerReadyCallback\r\n }, 0);\r\n });\r\n\r\n return promise;\r\n }\r\n\r\n private _addPlayerListener(\r\n instance: any,\r\n type: string,\r\n eventHandler: (...args: any[]) => void\r\n ) {\r\n instance.on(type, eventHandler);\r\n this._eventHandlers.push(() => instance.off(type, eventHandler));\r\n }\r\n\r\n private _handleEnded() {\r\n if (!this._player?.loop) {\r\n this._onComplete?.();\r\n } else {\r\n this._onRestart?.();\r\n }\r\n }\r\n\r\n private _handleTimeUpdate() {\r\n if (this._player) {\r\n const time = this._player.currentTime();\r\n if (time !== undefined) {\r\n this._onTime?.(time);\r\n }\r\n }\r\n }\r\n\r\n start(): void {\r\n this._player?.play();\r\n }\r\n\r\n stop(): void {\r\n this._player?.pause();\r\n this._player?.currentTime(0);\r\n }\r\n\r\n pause(): void {\r\n this._player?.pause();\r\n }\r\n\r\n seek(position: number): Promise<number> {\r\n return new Promise<number>(resolve => {\r\n (this._player as any).one('seeked', () => {\r\n resolve(this._player?.currentTime() ?? 0);\r\n });\r\n this._player?.currentTime(position);\r\n });\r\n }\r\n\r\n playlistItem(uri: string): void {\r\n if (this._urls.includes(uri)) {\r\n this._player?.selectSource([uri]);\r\n }\r\n }\r\n\r\n getPosition(): number {\r\n return this._player?.currentTime() ?? 0;\r\n }\r\n\r\n getDuration(): number {\r\n return this._player?.duration() ?? 0;\r\n }\r\n\r\n getContainer(): JQuery<HTMLElement> | undefined {\r\n const selector =\r\n this.config.timelineProviderSettings.mediaplayer?.selector ?? '';\r\n return $(selector);\r\n }\r\n\r\n destroy(): void {\r\n this._eventHandlers.forEach(remover => remover());\r\n this._eventHandlers.length = 0;\r\n }\r\n\r\n onTime(callback: (position: number) => void): void {\r\n this._onTime = callback;\r\n }\r\n\r\n onComplete(callback: () => void): void {\r\n this._onComplete = callback;\r\n }\r\n\r\n onRestart(callback: () => void): void {\r\n this._onRestart = callback;\r\n }\r\n\r\n onFirstFrame(callback: () => void): void {\r\n this._onFirstFrame = callback;\r\n }\r\n\r\n private _extractUrls(configuration: IResolvedEngineConfiguration) {\r\n const urls = configuration.timelines\r\n .filter(timeline => timeline.type === 'mediaplayer')\r\n .map(timeline => timeline.uri);\r\n return urls;\r\n }\r\n\r\n private _addVideoElements(selector: string, urls: string[]) {\r\n const videoElm = [`<video id=${this._videoElementId}>`];\r\n urls.forEach(url => {\r\n videoElm.push(\r\n `<source src='${url}' type='${this._extractFileType(url)}'/>`\r\n );\r\n });\r\n videoElm.push('</video>');\r\n $(selector).append(videoElm.join(''));\r\n }\r\n\r\n _extractFileType(url: string) {\r\n const lastIdx = url.lastIndexOf('.');\r\n return `video/${url.substring(lastIdx + 1)}`;\r\n }\r\n}\r\n","// export { MediaElementTimelineProvider } from './media-element-timeline-provider';\r\nexport {RequestAnimationFrameTimelineProvider} from './request-animation-frame-timeline-provider.ts';\r\nexport {VideoJsTimelineProvider} from './video-js-timeline-provider.ts';\r\n","import {v4 as uuidv4} from 'uuid';\r\nimport * as timelineProviders from '../../timelineproviders/index.ts';\r\nimport type {TimelineTypes} from '../../types.ts';\r\nimport type {\r\n ITimelineProviderSettings,\r\n TTimelineProviderSettings,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\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.ts';\r\nimport type {\r\n ILabel,\r\n ILanguageLabel,\r\n KeysOfType,\r\n TimelineTypes,\r\n TLanguageCode,\r\n} from '../../types.ts';\r\nimport { mergeIfMissing } from '../../util/merge-if-missing.ts';\r\nimport type {\r\n IActionConfiguration,\r\n IEngineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration,\r\n} from '../types.ts';\r\nimport { ActionCreatorFactory } from './action-creator-factory.ts';\r\nimport {\r\n ActionEditor,\r\n EndableActionEditor,\r\n TimelineActionEditor,\r\n} from './action-editor.ts';\r\nimport { LabelEditor } from './label-editor.ts';\r\nimport { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor.ts';\r\n\r\n/** */\r\nexport type TEngineConfigurationLists = KeysOfType<IEngineConfiguration, any[]>;\r\n\r\ntype ConfigurationFactoryExtension<NewFactory extends ConfigurationFactory> = (\r\n this: NewFactory,\r\n ...rest: any[]\r\n) => void;\r\n\r\n/**\r\n * This class offers a fluent, extensible 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 \"node: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\nexport class ConfigurationFactory {\r\n actionCreatorFactory: ActionCreatorFactory;\r\n\r\n /**\r\n * Constructs a new `ConfigurationFactory`\r\n * @param config an optional existing configuration that will be used as a starting point\r\n */\r\n constructor(public configuration: IEngineConfiguration = {} as any) {\r\n this.actionCreatorFactory = new ActionCreatorFactory(this);\r\n }\r\n\r\n /**\r\n * Add specialized method to a factory\r\n *\r\n * @param factory\r\n * @param extensionMethodName\r\n * @param extensionMethod\r\n * @returns\r\n */\r\n static extend<\r\n T extends ConfigurationFactory,\r\n K extends PropertyKey,\r\n C extends (this: T & { [P in K]: C }, ...args: any[]) => any,\r\n >(factory: T, extensionMethodName: K, extensionMethod: C): T & { [P in K]: C } {\r\n return Object.defineProperty<T & { [P in K]: C }>(\r\n factory as any,\r\n extensionMethodName,\r\n {\r\n value: function (this: T & { [P in K]: C }, ...args: Parameters<C>) {\r\n return extensionMethod.apply(this, args);\r\n },\r\n writable: true,\r\n configurable: true,\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Add specialized methods to a factory\r\n *\r\n * @param factory\r\n * @param extensions\r\n * @returns\r\n */\r\n static extendMultiple<\r\n T extends ConfigurationFactory,\r\n C extends ConfigurationFactoryExtension<T>,\r\n D extends { [name: string]: C; },\r\n >(factory: T, extensions: D) {\r\n return Object.entries(extensions).reduce<T & typeof extensions>(\r\n (acc, [name, method]) =>\r\n ConfigurationFactory.extend(acc, name, method) as T & typeof extensions,\r\n factory as T & typeof extensions\r\n );\r\n }\r\n\r\n /**\r\n * Initialize the configuration with a minimal shape.\r\n *\r\n * It assigns an ID, sets the engine to `EligiusEngine`, default the containerSelector `[data-ct-container=true]`\r\n * and initializes all of the list properties with empty arrays.\r\n * @param defaultLanguage\r\n * @returns\r\n */\r\n init(defaultLanguage: TLanguageCode) {\r\n const newConfiguration: IEngineConfiguration = {\r\n id: uuidv4(),\r\n engine: {\r\n systemName: 'EligiusEngine',\r\n },\r\n containerSelector: '[data-ct-container=true]',\r\n timelineProviderSettings: {},\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 this.configuration = mergeIfMissing(this.configuration, newConfiguration);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns the engine system name\r\n * @param systemName\r\n * @returns\r\n */\r\n setEngine(systemName: string) {\r\n this.configuration.engine.systemName = systemName;\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns a string representation of the HTML layout template for the engine.\r\n *\r\n * @param layoutTemplate\r\n * @returns\r\n */\r\n setLayoutTemplate(layoutTemplate: string) {\r\n this.configuration.layoutTemplate = layoutTemplate;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Assigns the default language\r\n *\r\n * @param defaultLanguage\r\n * @returns\r\n */\r\n setDefaultLanguage(defaultLanguage: TLanguageCode) {\r\n this.configuration.language = defaultLanguage;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Assign the css selector that specifies the DOM location where the engine renders its output\r\n *\r\n * @param selector\r\n * @returns\r\n */\r\n setContainerSelector(selector: string) {\r\n this.configuration.containerSelector = selector;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editing process for the timeline provider settings.\r\n *\r\n * @returns\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 /**\r\n *\r\n * Return a copy of the current state of the configuration\r\n *\r\n * @param callBack the callback receives the configuration as well and can return a mutated version wich will be assigned to the factory's internal state\r\n * @returns\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 /**\r\n *\r\n * Adds a language to the `availableLanguages` list.\r\n * The label represents the name of the language.\r\n *\r\n * An error is thrown if a language with the given language code already exists\r\n *\r\n * @example\r\n * factory.addLanguage('en-GB', 'English');\r\n *\r\n * @param languageCode The given alnguage code\r\n * @param languageLabel The human readable name of the language\r\n * @returns\r\n */\r\n addLanguage(languageCode: TLanguageCode, languageLabel: string) {\r\n const languages = this._initializeCollection(\r\n this.configuration,\r\n 'availableLanguages'\r\n );\r\n const existing = languages.find(lang => lang.languageCode === languageCode);\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: 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 /**\r\n *\r\n * Adds the specified action to the `actions` list.\r\n *\r\n * @param action\r\n */\r\n addAction(action: IActionConfiguration) {\r\n this._internalAddAction('actions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the specified action to the `initActions` list\r\n *\r\n * @param action\r\n */\r\n addInitAction(action: IActionConfiguration) {\r\n this._internalAddAction('initActions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the specified action to the `eventActions` list\r\n *\r\n * @param action\r\n */\r\n addEventAction(action: IActionConfiguration) {\r\n this._internalAddAction('eventActions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the given actions to `timelineActions` list that is associated with the specified uri\r\n *\r\n * @param uri\r\n * @param action\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 /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `actions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createAction(name: string) {\r\n return this.actionCreatorFactory.createAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `initActions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createInitAction(name: string) {\r\n return this.actionCreatorFactory.createInitAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `eventActions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createEventAction(name: string) {\r\n return this.actionCreatorFactory.createEventAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `timelineActions` list that is associated with the specified uri\r\n *\r\n * @param uri\r\n * @param name\r\n * @returns\r\n */\r\n createTimelineAction(uri: string, name: string) {\r\n return this.actionCreatorFactory.createTimelineAction(uri, name);\r\n }\r\n\r\n /**\r\n * Add a timeline with the given data\r\n *\r\n * @param uri identifier for the timeline\r\n * @param type animation or mediaplayer\r\n * @param duration the duration of the timeline in seconds\r\n * @param isLooped True if the timeline should automatically restart at the end\r\n * @param selector css selector for the container where the timeline will be rendered\r\n * @returns\r\n */\r\n addTimeline(\r\n uri: string,\r\n type: TimelineTypes,\r\n duration: number,\r\n isLooped: 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: isLooped,\r\n selector: selector,\r\n timelineActions: [],\r\n };\r\n timelines.push(timelineConfig);\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Gets the timeline associated with the specified uri\r\n *\r\n * @param uri\r\n * @returns\r\n */\r\n getTimeline(uri: string) {\r\n return this.configuration.timelines.find(t => t.uri === uri);\r\n }\r\n\r\n /**\r\n *\r\n * Removes the timeline associated with the specified uri\r\n *\r\n * @param uri\r\n * @returns\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: TLanguageCode\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 /**\r\n *\r\n * Starts an editor for the label that is associated with the specified id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Adds a label translation with the specified data\r\n *\r\n * @param id The id for the label\r\n * @param languageCode The language code associated with the label\r\n * @param translation The label text in the language specified by the language code\r\n * @returns\r\n */\r\n addLabel(id: string, languageCode: TLanguageCode, 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 languageCode\r\n );\r\n labelTranslation.label = translation;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Adds multiple translations with the specified data\r\n *\r\n * @param id The id for the label\r\n * @param translations A record that holds language code to translations lookups\r\n * @returns\r\n */\r\n addLabels(id: string, translations: Record<TLanguageCode, string>) {\r\n Object.entries(translations).forEach(([code, translation]) =>\r\n this.addLabel(id, code as TLanguageCode, translation)\r\n );\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Removes all translations with the given id\r\n *\r\n * @param id the id for the label\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `actions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `eventActions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `initActions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\r\n */\r\n editInitAction(id: string) {\r\n const actionConfig = this.configuration.initActions.find(a => a.id === id);\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 /**\r\n *\r\n * Starts an editor for the action from the `timelineActions` list associated with the given uri and id\r\n *\r\n * @param uri\r\n * @param id\r\n * @returns\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}\r\n","import type {IEndableAction} from '../action/types.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\ninterface IActionInstanceInfo {\r\n start: boolean;\r\n action: IEndableAction;\r\n}\r\n\r\nexport interface IEventListenerControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:eventName\r\n * @required\r\n */\r\n eventName: string;\r\n actions: string[];\r\n /**\r\n * @type=ParameterType:object\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {ILabel} from '../types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface ILabelControllerMetadata {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:labelId\r\n * @required\r\n */\r\n labelId: string;\r\n /**\r\n * By default the label is added to the inner HTML of the `selectedElement`,\r\n * otherwise if this property is set, the label text is added to the specified attribute\r\n * of the `selectedElement`.\r\n */\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 type {\r\n AnimationConfigWithData,\r\n AnimationItem,\r\n CanvasRendererConfig,\r\n HTMLRendererConfig,\r\n SVGRendererConfig,\r\n} from 'lottie-web';\r\nimport lt from 'lottie-web';\r\nimport type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nconst lottie = lt.default ?? lt;\r\n\r\nexport interface IInnerMetadata {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:string\r\n */\r\n renderer: SVGRendererConfig | CanvasRendererConfig | HTMLRendererConfig;\r\n loop: boolean;\r\n autoplay: boolean;\r\n /**\r\n * ParameterType:object\r\n */\r\n animationData: any;\r\n /**\r\n * @required\r\n */\r\n json: any;\r\n /**\r\n * @type=ParameterType:array\r\n * @itemType=ParameterType:labelId\r\n */\r\n labelIds: string[];\r\n viewBox: string;\r\n iefallback: any;\r\n}\r\n\r\nexport interface ILottieControllerMetadata extends IInnerMetadata {\r\n /**\r\n * @type=ParameterType:url\r\n * @required\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {TResultCallback} from '../types.ts';\r\nimport type {LabelController} from './label-controller.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface INavigationControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @required\r\n */\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(\r\n resultCallback: TResultCallback<{navigationData: any; title: string} | null>\r\n ) {\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface IProgressbarControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface IRoutingControllerOperationData {\r\n /**\r\n * @required\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IStrictDuration, ISubtitleCollection} from '../types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface ISubtitlesControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n language: string;\r\n /**\r\n * @type=ParameterType:array\r\n * @itemType=ParameterType:object\r\n */\r\n subtitleData: ISubtitleCollection[];\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 subtitleDurations: IStrictDuration[] | null = null;\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 && this.lastFunc !== func) {\r\n this.lastFunc = func;\r\n func();\r\n }\r\n }\r\n\r\n onSeekedHandler(args: any[]) {\r\n const position = args[0];\r\n\r\n const duration = this.subtitleDurations?.find(\r\n x => x.start <= position || x.end >= position\r\n );\r\n\r\n const func = duration ? this.actionLookup[duration.start ?? -1] : undefined;\r\n if (func && this.lastFunc !== func) {\r\n this.lastFunc = func;\r\n func();\r\n } else if (!func) {\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(\r\n operationData: ISubtitlesControllerOperationData,\r\n container: JQuery\r\n ) {\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.languageCode] = 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.bind(\r\n this,\r\n container\r\n );\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 this.subtitleDurations = operationData.subtitleData?.[0].titles.map(\r\n x => x.duration\r\n );\r\n }\r\n}\r\n","export {EventListenerController} from './event-listener-controller.ts';\r\nexport {LabelController} from './label-controller.ts';\r\nexport {LottieController} from './lottie-controller.ts';\r\nexport {NavigationController} from './navigation-controller.ts';\r\nexport {ProgressbarController} from './progressbar-controller.ts';\r\nexport {RoutingController} from './routing-controller.ts';\r\nexport {SubtitlesController} from './subtitles-controller.ts';\r\n","import { type IAddClassOperationData } from \"../add-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addClass(): IOperationMetadata<IAddClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IAddControllerToElementOperationData } from \"../add-controller-to-element.ts\";\nimport { type TOperationData } from \"../types.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addControllerToElement(): IOperationMetadata<IAddControllerToElementOperationData<TOperationData>> {\n return {\n description: `This operation adds the specified controller instance to the given selected element.`,\n dependentProperties: ['selectedElement', 'controllerInstance'],\n };\n}\n","import { type IAddGlobalsToOperationData } from \"../add-globals-to-operation.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addGlobalsToOperation(): IOperationMetadata<IAddGlobalsToOperationData> {\n return {\n description: `This operation adds the specified global property names to the current operation data.\nIt finally removes the \\`globalProperties\\` property from the current operation data.`,\n properties: {\n globalProperties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type IAnimateWithClassOperationData } from \"../animate-with-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function animateWithClass(): IOperationMetadata<IAnimateWithClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element and assumes that this\nclass triggers and animation on the selected element. It then waits for this animation to complete\nbefore it resolves.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n },\n removeClass: {\n type: 'ParameterType:boolean',\n }\n },\n };\n}\n","import { type IAnimateOperationData } from \"../animate.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function animate(): IOperationMetadata<IAnimateOperationData> {\n return {\n description: `This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.\nIt resolves after the animation completes.`,\n dependentProperties: ['selectedElement'],\n properties: {\n animationEasing: {\n type: 'ParameterType:boolean',\n },\n animationProperties: {\n type: 'ParameterType:object',\n required: true,\n },\n animationDuration: {\n type: 'ParameterType:number',\n required: true,\n }\n },\n };\n}\n","import { type IBroadcastEventOperationData } from \"../broadcast-event.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function broadcastEvent(): IOperationMetadata<IBroadcastEventOperationData> {\n return {\n description: `This operation broadcasts the given event through the eventbus, along with the\nevent argumetns and optional event topic.`,\n properties: {\n eventArgs: {\n type: 'ParameterType:array',\n },\n eventTopic: {\n type: 'ParameterType:eventTopic',\n },\n eventName: {\n type: 'ParameterType:eventName',\n required: true,\n }\n },\n };\n}\n","import { type ICalcOperationData } from \"../calc.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function calc(): IOperationMetadata<ICalcOperationData> {\n return {\n description: `This operation calculates the given left and right hand operands using the specified operator.`,\n properties: {\n left: {\n type: 'ParameterType:number',\n required: true,\n },\n right: {\n type: 'ParameterType:number',\n required: true,\n },\n operator: {\n type: [\n { value: '+' },\n { value: '-' },\n { value: '*' },\n { value: '/' },\n { value: '%' },\n { value: '**' }\n ],\n required: true,\n }\n },\n outputProperties: {\n calculationResult: {\n type: 'ParameterType:number',\n }\n }\n };\n}\n","import { type IClearElementOperationData } from \"../clear-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function clearElement(): IOperationMetadata<IClearElementOperationData> {\n return {\n description: `This operation removes all of the children from the given selected element.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IClearOperationDataOperationData } from \"../clear-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function clearOperationData(): IOperationMetadata<IClearOperationDataOperationData> {\n return {\n description: `This operation removes all of the properties on the current operation date.\nOr, if the \\`properties\\` property is set only removes the properties defined by that list.`,\n properties: {\n properties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n }\n },\n };\n}\n","import { type ICreateElementOperationData, type TTagNames } from \"../create-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function createElement(): IOperationMetadata<ICreateElementOperationData<TTagNames>> {\n return {\n description: `This operation creates the DOM element described by the given elementName and attributes and assigns\nthe instance to the \\`template\\` property on the current operation data.`,\n properties: {\n elementName: {\n type: [\n { value: 'object' },\n { value: 'a' },\n { value: 'abbr' },\n { value: 'address' },\n { value: 'area' },\n { value: 'article' },\n { value: 'aside' },\n { value: 'audio' },\n { value: 'b' },\n { value: 'base' },\n { value: 'bdi' },\n { value: 'bdo' },\n { value: 'blockquote' },\n { value: 'body' },\n { value: 'br' },\n { value: 'button' },\n { value: 'canvas' },\n { value: 'caption' },\n { value: 'cite' },\n { value: 'code' },\n { value: 'col' },\n { value: 'colgroup' },\n { value: 'data' },\n { value: 'datalist' },\n { value: 'dd' },\n { value: 'del' },\n { value: 'details' },\n { value: 'dfn' },\n { value: 'dialog' },\n { value: 'div' },\n { value: 'dl' },\n { value: 'dt' },\n { value: 'em' },\n { value: 'embed' },\n { value: 'fieldset' },\n { value: 'figcaption' },\n { value: 'figure' },\n { value: 'footer' },\n { value: 'form' },\n { value: 'h1' },\n { value: 'h2' },\n { value: 'h3' },\n { value: 'h4' },\n { value: 'h5' },\n { value: 'h6' },\n { value: 'head' },\n { value: 'header' },\n { value: 'hgroup' },\n { value: 'hr' },\n { value: 'html' },\n { value: 'i' },\n { value: 'iframe' },\n { value: 'img' },\n { value: 'input' },\n { value: 'ins' },\n { value: 'kbd' },\n { value: 'label' },\n { value: 'legend' },\n { value: 'li' },\n { value: 'link' },\n { value: 'main' },\n { value: 'map' },\n { value: 'mark' },\n { value: 'menu' },\n { value: 'meta' },\n { value: 'meter' },\n { value: 'nav' },\n { value: 'noscript' },\n { value: 'ol' },\n { value: 'optgroup' },\n { value: 'option' },\n { value: 'output' },\n { value: 'p' },\n { value: 'picture' },\n { value: 'pre' },\n { value: 'progress' },\n { value: 'q' },\n { value: 'rp' },\n { value: 'rt' },\n { value: 'ruby' },\n { value: 's' },\n { value: 'samp' },\n { value: 'script' },\n { value: 'search' },\n { value: 'section' },\n { value: 'select' },\n { value: 'slot' },\n { value: 'small' },\n { value: 'source' },\n { value: 'span' },\n { value: 'strong' },\n { value: 'style' },\n { value: 'sub' },\n { value: 'summary' },\n { value: 'sup' },\n { value: 'table' },\n { value: 'tbody' },\n { value: 'td' },\n { value: 'template' },\n { value: 'textarea' },\n { value: 'tfoot' },\n { value: 'th' },\n { value: 'thead' },\n { value: 'time' },\n { value: 'title' },\n { value: 'tr' },\n { value: 'track' },\n { value: 'u' },\n { value: 'ul' },\n { value: 'var' },\n { value: 'video' },\n { value: 'wbr' }\n ],\n required: true,\n },\n text: {\n type: 'ParameterType:string',\n },\n attributes: {\n type: 'ParameterType:object',\n }\n },\n outputProperties: {\n template: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type ICustomFunctionOperationData } from \"../custom-function.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function customFunction(): IOperationMetadata<ICustomFunctionOperationData> {\n return {\n description: `This operation retrieves a custom function defined by the given system name\nand invokes it with the current operation data and eventbus.`,\n properties: {\n systemName: {\n type: 'ParameterType:string',\n }\n },\n };\n}\n","import { type IEndActionOperationData } from \"../end-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function endAction(): IOperationMetadata<IEndActionOperationData> {\n return {\n description: `This operation invokes the {@link EndableAction}.end method on the specified action instance.\n\nThe action operation data is first merged with the current operation data before it is\npassed on to the action. After the action has completed the action operation data properties\nare removed from the current operation data.`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function endForEach(): IOperationMetadata<undefined> {\n return {\n description: `This operation checks if the current loop should end or start the next iteration.`,\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function endWhen(): IOperationMetadata<undefined> {\n return {\n description: `This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.`,\n };\n}\n","import { type IExtendControllerOperationData } from \"../extend-controller.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function extendController(): IOperationMetadata<IExtendControllerOperationData> {\n return {\n description: `Extends the current controller with given extension.`,\n dependentProperties: ['controllerInstance'],\n properties: {\n controllerExtension: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IForEachOperationData } from \"../for-each.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function forEach(): IOperationMetadata<IForEachOperationData> {\n return {\n description: `This operation iterates over the given collection.\n\nEach iteration the current item from the specified collection is\nassigned to the {@link IOperationContext.currentItem} property on the operation context.\n\nAt the start of the loop, the associated {@link endForEach} operation is determined and when\nthe last iteration is completed the flow control is set to the index of that operation.`,\n properties: {\n collection: {\n type: 'ParameterType:array',\n required: true,\n }\n },\n };\n}\n","import { type IGetAttributesFromElementOperationData } from \"../get-attributes-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getAttributesFromElement(): IOperationMetadata<IGetAttributesFromElementOperationData> {\n return {\n description: `This operation retrieves the values for the specified attribute names from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributeNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n }\n },\n outputProperties: {\n attributeValues: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetControllerFromElementOperationData } from \"../get-controller-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getControllerFromElement(): IOperationMetadata<IGetControllerFromElementOperationData> {\n return {\n description: `This operation retrieves the controller instance with the specified name that is assigned to the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n required: true,\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetControllerInstanceOperationData } from \"../get-controller-instance.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getControllerInstance(): IOperationMetadata<IGetControllerInstanceOperationData> {\n return {\n description: `This operation retrieves an instance of the given controller name.\nIt assigns this instance to the \\`controllerInstance\\` property on the current operation data`,\n properties: {\n systemName: {\n type: [\n { value: 'EventListenerController' },\n { value: 'LabelController' },\n { value: 'LottieController' },\n { value: 'NavigationController' },\n { value: 'ProgressbarController' },\n { value: 'RoutingController' },\n { value: 'SubtitlesController' }\n ],\n required: true,\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetElementDimensionsOperationData } from \"../get-element-dimensions.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getElementDimensions(): IOperationMetadata<IGetElementDimensionsOperationData> {\n return {\n description: `This operation calculates the width and height of the given selected element.\nIt assigns this struct to the dimensions property on the current operation data.\nOptionally the width and height can be modified using the given modifier string.\n\nThe modifier string is formatted in the following way:\n\n<operator><amount><optional-side><optional-precentage>|<ratio-definition>\n\nWhere the ratio modifier is formatted in the following way:\n<side>[ar=<ratio-left>-<ratio-right>]\n\nFor example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\nit will add a value of 100 to the height and modify the width by a ratio of 8 to 1 relative to the height.`,\n dependentProperties: ['selectedElement'],\n properties: {\n modifier: {\n type: 'ParameterType:dimensionsModifier',\n }\n },\n outputProperties: {\n dimensions: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetImportOperationData } from \"../get-import.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getImport(): IOperationMetadata<IGetImportOperationData> {\n return {\n description: `This operation retrieves the import specified by the given \\`systemName\\` and\nassigns it to the \\`importedInstance\\` property on the current operaton date.`,\n properties: {\n systemName: {\n type: 'ParameterType:systemName',\n required: true,\n }\n },\n outputProperties: {\n importedInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetQueryParamsOperationData } from \"../get-query-params.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData> {\n return {\n description: `This operation retrieves the current query parameters from the browser's address bar and places\nthem on the returned operation data.`,\n properties: {\n defaultValues: {\n type: 'ParameterType:object',\n }\n },\n outputProperties: {\n queryParams: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IInvokeObjectMethodOperationData } from \"../invoke-object-method.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData> {\n return {\n description: `This operation invokes the specified method on the given object with the given optional arguments\nand assigns the result to the \\`methodResult\\` operationdata property.`,\n properties: {\n instance: {\n type: 'ParameterType:object',\n },\n methodName: {\n type: 'ParameterType:string',\n },\n methodArguments: {\n type: 'ParameterType:array',\n },\n methodResult: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type ILoadJSONOperationData } from \"../load-json.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function loadJson(): IOperationMetadata<ILoadJSONOperationData> {\n return {\n description: `This operation loads a JSON file from the specified url and assigns it to the json\nproperty on the current operation data.\n\nIf the cache property is set to true and a cached value already exists, this is assigned\ninstead of re-retrieving it from the url.`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n },\n cache: {\n type: 'ParameterType:boolean',\n }\n },\n outputProperties: {\n json: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function log(): IOperationMetadata<undefined> {\n return {\n description: `This operation logs the current operation data, global data and context to the console.`,\n };\n}\n","import { type IMathOperationData } from \"../math.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function math(): IOperationMetadata<IMathOperationData> {\n return {\n description: `This operation performs the given math function with the specified arguments.`,\n properties: {\n args: {\n type: 'ParameterType:array',\n required: true,\n },\n functionName: {\n type: [\n { value: 'abs' },\n { value: 'acos' },\n { value: 'asin' },\n { value: 'atan' },\n { value: 'atan2' },\n { value: 'ceil' },\n { value: 'cos' },\n { value: 'exp' },\n { value: 'floor' },\n { value: 'log' },\n { value: 'max' },\n { value: 'min' },\n { value: 'pow' },\n { value: 'random' },\n { value: 'round' },\n { value: 'sin' },\n { value: 'sqrt' },\n { value: 'tan' },\n { value: 'clz32' },\n { value: 'imul' },\n { value: 'sign' },\n { value: 'log10' },\n { value: 'log2' },\n { value: 'log1p' },\n { value: 'expm1' },\n { value: 'cosh' },\n { value: 'sinh' },\n { value: 'tanh' },\n { value: 'acosh' },\n { value: 'asinh' },\n { value: 'atanh' },\n { value: 'hypot' },\n { value: 'trunc' },\n { value: 'fround' },\n { value: 'cbrt' },\n { value: 'f16round' }\n ],\n required: true,\n }\n },\n outputProperties: {\n mathResult: {\n type: 'ParameterType:number',\n }\n }\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function otherwise(): IOperationMetadata<undefined> {\n return {\n description: `If the preceeding {@link when} operation evaluates to \\`true\\` subsequent operations will\nbe skipped until an {@link endWhen} operation is encountered.`,\n };\n}\n","import { type IRemoveClassOperationData } from \"../remove-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeClass(): IOperationMetadata<IRemoveClassOperationData> {\n return {\n description: `This operation removes the spcified class name from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IRemoveControllerFromElementOperationData } from \"../remove-controller-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeControllerFromElement(): IOperationMetadata<IRemoveControllerFromElementOperationData> {\n return {\n description: `This operation removes the controller with the specified name from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n }\n },\n };\n}\n","import { type IRemoveElementOperationData } from \"../remove-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeElement(): IOperationMetadata<IRemoveElementOperationData> {\n return {\n description: `This operation removes the given selected element from the DOM.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IRemovePropertiesFromOperationDataOperationData } from \"../remove-properties-from-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removePropertiesFromOperationData(): IOperationMetadata<IRemovePropertiesFromOperationDataOperationData> {\n return {\n description: `This operation removes the given list of properties from the current operation data.\nIt will also remove the property \\`propertyNames\\` from the result.`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type IReparentElementOperationData } from \"../reparent-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function reparentElement(): IOperationMetadata<IReparentElementOperationData> {\n return {\n description: `This operation moves the given selected element to the new parent that is defined\nby the specified \\`newParentSelector\\`.`,\n dependentProperties: ['selectedElement'],\n properties: {\n newParentSelector: {\n type: 'ParameterType:selector',\n required: true,\n }\n },\n };\n}\n","import { type IRequestActionOperationData } from \"../request-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function requestAction(): IOperationMetadata<IRequestActionOperationData> {\n return {\n description: `This operation requests an action instance with the specified name and assigns it\nto the \\`actionInstance\\` property on the current operation data.`,\n properties: {\n systemName: {\n type: 'ParameterType:actionName',\n required: true,\n }\n },\n outputProperties: {\n actionInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IResizeActionOperationData } from \"../resize-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function resizeAction(): IOperationMetadata<IResizeActionOperationData> {\n return {\n description: ``,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type ISelectElementOperationData } from \"../select-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function selectElement(): IOperationMetadata<ISelectElementOperationData> {\n return {\n description: `This operation selects one or more elements using the specified selector.\n\nIf \\`useSelectedElementAsRoot\\` is set to true and a valid DOM element is assigned\nto the current operation data's \\`selectedElement\\` property\nthen the element will be looked for only in the descendant elements of this DOM element.`,\n properties: {\n selector: {\n type: 'ParameterType:selector',\n required: true,\n },\n useSelectedElementAsRoot: {\n type: 'ParameterType:boolean',\n }\n },\n outputProperties: {\n selectedElement: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type ISetDataOperationData } from \"../set-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setData(): IOperationMetadata<ISetDataOperationData> {\n return {\n description: `This operation assigns the specified properties to the specified data targets.`,\n properties: {\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetElementAttributesOperationData } from \"../set-element-attributes.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setElementAttributes(): IOperationMetadata<ISetElementAttributesOperationData> {\n return {\n description: `This operation sets the specified set of attributes on the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributes: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetElementContentOperationData } from \"../set-element-content.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setElementContent(): IOperationMetadata<ISetElementContentOperationData> {\n return {\n description: `This operation sets the specified content defined by the value assigned to the template property\nto the given selected element.\n\nWhen the \\`insertionType\\` is set to \\`overwrite\\` the contents of the selected element are replaced\nby the given template.\nWhen set to \\`append\\` the new content will be inserted after the current content.\nWhen set to \\`prepend\\` the new content will be inserted before the current content.`,\n dependentProperties: ['selectedElement', 'template'],\n properties: {\n insertionType: {\n type: [\n { value: 'overwrite' },\n { value: 'append' },\n { value: 'prepend' }\n ],\n }\n },\n };\n}\n","import { type ISetGlobalDataOperationData } from \"../set-global-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setGlobalData(): IOperationMetadata<ISetGlobalDataOperationData> {\n return {\n description: `This operation copies the specified properties from the operationData to the global data.`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type ISetOperationData } from \"../set-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setOperationData(): IOperationMetadata<ISetOperationData> {\n return {\n description: `This operation assigns the specified properties to the current operation data.\nWhen override is set to true the properties replace the current operation data entirely.`,\n properties: {\n override: {\n type: 'ParameterType:boolean',\n },\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetStyleOperationData } from \"../set-style.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setStyle(): IOperationMetadata<ISetStyleOperationData> {\n return {\n description: `This operation assigns the specified CSS style properties to the\ngiven selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type IStartActionOperationData } from \"../start-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function startAction(): IOperationMetadata<IStartActionOperationData> {\n return {\n description: `This operation starts the specified action instance using the given action operation data.\n\nThe action operation data is first merged with the current operation data before it is\npassed on to the action. After the action has completed the action operation data properties\nare removed from the current operation data.`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IToggleClassOperationData } from \"../toggle-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function toggleClass(): IOperationMetadata<IToggleClassOperationData> {\n return {\n description: `This operation toggles the specfied class name on the given selected element.\n\nMeaning, if the specified class name exists on the given element it will be removed,\notherwise it will be added.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IToggleElementOperationData } from \"../toggle-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function toggleElement(): IOperationMetadata<IToggleElementOperationData> {\n return {\n description: `This operation toggles the visibility of the given selected element.\n\nMeaning, if the element is hidden, it will be made visible, otherwise\nit will be hidden.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IWaitOperationData } from \"../wait.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function wait(): IOperationMetadata<IWaitOperationData> {\n return {\n description: `This operation waits for the specified amount of milliseconds.`,\n properties: {\n milliseconds: {\n type: 'ParameterType:number',\n required: true,\n }\n },\n };\n}\n","import { type IWhenOperationData } from \"../when.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function when(): IOperationMetadata<IWhenOperationData> {\n return {\n description: `When the given expression evaluates to false, subsequent operations will be skipped\nuntil an {@link endWhen} or {@link otherwise} operation is encountered.\n\nPractically, this means an \\`if\\` or \\`if\\`/\\`else\\` statement control flow implementation in a list of operations.`,\n properties: {\n expression: {\n type: [\n { value: '\\`${number}!=${number}\\`' },\n { value: '\\`${number}!=\\'${string}\\'\\`' },\n { value: '\\`${number}!=operationdata.${string}\\`' },\n { value: '\\`${number}!=globaldata.${string}\\`' },\n { value: '\\`${number}!=context.${string}\\`' },\n { value: '\\`${number}==${number}\\`' },\n { value: '\\`${number}==\\'${string}\\'\\`' },\n { value: '\\`${number}==operationdata.${string}\\`' },\n { value: '\\`${number}==globaldata.${string}\\`' },\n { value: '\\`${number}==context.${string}\\`' },\n { value: '\\`${number}>=${number}\\`' },\n { value: '\\`${number}>=\\'${string}\\'\\`' },\n { value: '\\`${number}>=operationdata.${string}\\`' },\n { value: '\\`${number}>=globaldata.${string}\\`' },\n { value: '\\`${number}>=context.${string}\\`' },\n { value: '\\`${number}<=${number}\\`' },\n { value: '\\`${number}<=\\'${string}\\'\\`' },\n { value: '\\`${number}<=operationdata.${string}\\`' },\n { value: '\\`${number}<=globaldata.${string}\\`' },\n { value: '\\`${number}<=context.${string}\\`' },\n { value: '\\`${number}>${number}\\`' },\n { value: '\\`${number}>\\'${string}\\'\\`' },\n { value: '\\`${number}>operationdata.${string}\\`' },\n { value: '\\`${number}>globaldata.${string}\\`' },\n { value: '\\`${number}>context.${string}\\`' },\n { value: '\\`${number}<${number}\\`' },\n { value: '\\`${number}<\\'${string}\\'\\`' },\n { value: '\\`${number}<operationdata.${string}\\`' },\n { value: '\\`${number}<globaldata.${string}\\`' },\n { value: '\\`${number}<context.${string}\\`' },\n { value: '\\`\\'${string}\\'!=${number}\\`' },\n { value: '\\`\\'${string}\\'!=\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'!=operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'!=globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'!=context.${string}\\`' },\n { value: '\\`\\'${string}\\'==${number}\\`' },\n { value: '\\`\\'${string}\\'==\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'==operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'==globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'==context.${string}\\`' },\n { value: '\\`\\'${string}\\'>=${number}\\`' },\n { value: '\\`\\'${string}\\'>=\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'>=operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'>=globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'>=context.${string}\\`' },\n { value: '\\`\\'${string}\\'<=${number}\\`' },\n { value: '\\`\\'${string}\\'<=\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'<=operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'<=globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'<=context.${string}\\`' },\n { value: '\\`\\'${string}\\'>${number}\\`' },\n { value: '\\`\\'${string}\\'>\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'>operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'>globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'>context.${string}\\`' },\n { value: '\\`\\'${string}\\'<${number}\\`' },\n { value: '\\`\\'${string}\\'<\\'${string}\\'\\`' },\n { value: '\\`\\'${string}\\'<operationdata.${string}\\`' },\n { value: '\\`\\'${string}\\'<globaldata.${string}\\`' },\n { value: '\\`\\'${string}\\'<context.${string}\\`' },\n { value: '\\`operationdata.${string}!=${number}\\`' },\n { value: '\\`operationdata.${string}!=\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}!=operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}!=globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}!=context.${string}\\`' },\n { value: '\\`operationdata.${string}==${number}\\`' },\n { value: '\\`operationdata.${string}==\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}==operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}==globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}==context.${string}\\`' },\n { value: '\\`operationdata.${string}>=${number}\\`' },\n { value: '\\`operationdata.${string}>=\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}>=operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}>=globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}>=context.${string}\\`' },\n { value: '\\`operationdata.${string}<=${number}\\`' },\n { value: '\\`operationdata.${string}<=\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}<=operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}<=globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}<=context.${string}\\`' },\n { value: '\\`operationdata.${string}>${number}\\`' },\n { value: '\\`operationdata.${string}>\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}>operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}>globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}>context.${string}\\`' },\n { value: '\\`operationdata.${string}<${number}\\`' },\n { value: '\\`operationdata.${string}<\\'${string}\\'\\`' },\n { value: '\\`operationdata.${string}<operationdata.${string}\\`' },\n { value: '\\`operationdata.${string}<globaldata.${string}\\`' },\n { value: '\\`operationdata.${string}<context.${string}\\`' },\n { value: '\\`globaldata.${string}!=${number}\\`' },\n { value: '\\`globaldata.${string}!=\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}!=operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}!=globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}!=context.${string}\\`' },\n { value: '\\`globaldata.${string}==${number}\\`' },\n { value: '\\`globaldata.${string}==\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}==operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}==globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}==context.${string}\\`' },\n { value: '\\`globaldata.${string}>=${number}\\`' },\n { value: '\\`globaldata.${string}>=\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}>=operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}>=globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}>=context.${string}\\`' },\n { value: '\\`globaldata.${string}<=${number}\\`' },\n { value: '\\`globaldata.${string}<=\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}<=operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}<=globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}<=context.${string}\\`' },\n { value: '\\`globaldata.${string}>${number}\\`' },\n { value: '\\`globaldata.${string}>\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}>operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}>globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}>context.${string}\\`' },\n { value: '\\`globaldata.${string}<${number}\\`' },\n { value: '\\`globaldata.${string}<\\'${string}\\'\\`' },\n { value: '\\`globaldata.${string}<operationdata.${string}\\`' },\n { value: '\\`globaldata.${string}<globaldata.${string}\\`' },\n { value: '\\`globaldata.${string}<context.${string}\\`' },\n { value: '\\`context.${string}!=${number}\\`' },\n { value: '\\`context.${string}!=\\'${string}\\'\\`' },\n { value: '\\`context.${string}!=operationdata.${string}\\`' },\n { value: '\\`context.${string}!=globaldata.${string}\\`' },\n { value: '\\`context.${string}!=context.${string}\\`' },\n { value: '\\`context.${string}==${number}\\`' },\n { value: '\\`context.${string}==\\'${string}\\'\\`' },\n { value: '\\`context.${string}==operationdata.${string}\\`' },\n { value: '\\`context.${string}==globaldata.${string}\\`' },\n { value: '\\`context.${string}==context.${string}\\`' },\n { value: '\\`context.${string}>=${number}\\`' },\n { value: '\\`context.${string}>=\\'${string}\\'\\`' },\n { value: '\\`context.${string}>=operationdata.${string}\\`' },\n { value: '\\`context.${string}>=globaldata.${string}\\`' },\n { value: '\\`context.${string}>=context.${string}\\`' },\n { value: '\\`context.${string}<=${number}\\`' },\n { value: '\\`context.${string}<=\\'${string}\\'\\`' },\n { value: '\\`context.${string}<=operationdata.${string}\\`' },\n { value: '\\`context.${string}<=globaldata.${string}\\`' },\n { value: '\\`context.${string}<=context.${string}\\`' },\n { value: '\\`context.${string}>${number}\\`' },\n { value: '\\`context.${string}>\\'${string}\\'\\`' },\n { value: '\\`context.${string}>operationdata.${string}\\`' },\n { value: '\\`context.${string}>globaldata.${string}\\`' },\n { value: '\\`context.${string}>context.${string}\\`' },\n { value: '\\`context.${string}<${number}\\`' },\n { value: '\\`context.${string}<\\'${string}\\'\\`' },\n { value: '\\`context.${string}<operationdata.${string}\\`' },\n { value: '\\`context.${string}<globaldata.${string}\\`' },\n { value: '\\`context.${string}<context.${string}\\`' }\n ],\n required: true,\n }\n },\n };\n}\n","export { addClass } from \"./add-class.ts\";\nexport { addControllerToElement } from \"./add-controller-to-element.ts\";\nexport { addGlobalsToOperation } from \"./add-globals-to-operation.ts\";\nexport { animateWithClass } from \"./animate-with-class.ts\";\nexport { animate } from \"./animate.ts\";\nexport { broadcastEvent } from \"./broadcast-event.ts\";\nexport { calc } from \"./calc.ts\";\nexport { clearElement } from \"./clear-element.ts\";\nexport { clearOperationData } from \"./clear-operation-data.ts\";\nexport { createElement } from \"./create-element.ts\";\nexport { customFunction } from \"./custom-function.ts\";\nexport { endAction } from \"./end-action.ts\";\nexport { endForEach } from \"./end-for-each.ts\";\nexport { endWhen } from \"./end-when.ts\";\nexport { extendController } from \"./extend-controller.ts\";\nexport { forEach } from \"./for-each.ts\";\nexport { getAttributesFromElement } from \"./get-attributes-from-element.ts\";\nexport { getControllerFromElement } from \"./get-controller-from-element.ts\";\nexport { getControllerInstance } from \"./get-controller-instance.ts\";\nexport { getElementDimensions } from \"./get-element-dimensions.ts\";\nexport { getImport } from \"./get-import.ts\";\nexport { getQueryParams } from \"./get-query-params.ts\";\nexport { invokeObjectMethod } from \"./invoke-object-method.ts\";\nexport { loadJson } from \"./load-json.ts\";\nexport { log } from \"./log.ts\";\nexport { math } from \"./math.ts\";\nexport { otherwise } from \"./otherwise.ts\";\nexport { removeClass } from \"./remove-class.ts\";\nexport { removeControllerFromElement } from \"./remove-controller-from-element.ts\";\nexport { removeElement } from \"./remove-element.ts\";\nexport { removePropertiesFromOperationData } from \"./remove-properties-from-operation-data.ts\";\nexport { reparentElement } from \"./reparent-element.ts\";\nexport { requestAction } from \"./request-action.ts\";\nexport { resizeAction } from \"./resize-action.ts\";\nexport { selectElement } from \"./select-element.ts\";\nexport { setData } from \"./set-data.ts\";\nexport { setElementAttributes } from \"./set-element-attributes.ts\";\nexport { setElementContent } from \"./set-element-content.ts\";\nexport { setGlobalData } from \"./set-global-data.ts\";\nexport { setOperationData } from \"./set-operation-data.ts\";\nexport { setStyle } from \"./set-style.ts\";\nexport { startAction } from \"./start-action.ts\";\nexport { toggleClass } from \"./toggle-class.ts\";\nexport { toggleElement } from \"./toggle-element.ts\";\nexport { wait } from \"./wait.ts\";\nexport { when } from \"./when.ts\";\nexport * from \"./types.ts\";\n","import type {TControllerName, TOperationName} from 'configuration/types.ts';\r\nimport * as controllers from '../../controllers/index.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport * as operationMetadata from '../../operation/metadata/index.ts';\r\nimport type {IOperationMetadata} from '../../operation/metadata/types.ts';\r\nimport {\r\n type TimelineEventName,\r\n TimelineEventNames,\r\n} from '../../timeline-event-names.ts';\r\n\r\n/**\r\n *\r\n * Provider for all the available operation names\r\n *\r\n */\r\nexport class OperationNamesProvider {\r\n getOperationNames(): TOperationName {\r\n return Object.keys(operations) as unknown as TOperationName;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * Provider for all the available controller names\r\n *\r\n */\r\nexport class ControllerNamesProvider {\r\n getControllerNames(): TControllerName {\r\n return Object.keys(controllers) as unknown as TControllerName;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * Provider that can retrieve the metadata associated with a given operation name\r\n *\r\n */\r\nexport class OperationMetadataProvider {\r\n getOperationMetadata(operationName: TOperationName) {\r\n const getMetadata = (\r\n operationMetadata as Record<\r\n TOperationName,\r\n () => IOperationMetadata<operations.TOperationData>\r\n >\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\n/**\r\n *\r\n * Provider for all the available event names\r\n *\r\n */\r\nexport class TimeLineEventNamesProvider {\r\n getEventNames() {\r\n return Object.values(TimelineEventNames) as unknown as TimelineEventName;\r\n }\r\n}\r\n","import type {IStrictDuration, ISubtitle} from '../../types.ts';\r\n\r\n/**\r\n * This class converts an AVID subtitle file to an `ISubtitle` array.\r\n */\r\nexport class SubtitleImporter {\r\n importSubtitles(rawLines: string[]): ISubtitle[] {\r\n const result: ISubtitle[] = [];\r\n const lines: string[] = [];\r\n for (let i: number = 0, l: number = rawLines.length; i < l; i++) {\r\n const rawLine: string = this.stripNewlineChars(rawLines[i].toString());\r\n if (this.isValidLine(rawLine)) {\r\n lines.push(rawLine);\r\n }\r\n }\r\n if (lines[0] === '') {\r\n lines.splice(0, 1);\r\n }\r\n while (lines[lines.length - 1] === '') {\r\n lines.pop();\r\n }\r\n let caption: Partial<ISubtitle> | null = null;\r\n lines.forEach((line: string) => {\r\n if (line.length === 0 || !caption) {\r\n caption = {text: ''};\r\n if (line.length) {\r\n //this happens for first caption only\r\n caption.duration = this.convertDuration(line);\r\n }\r\n result.push(caption as ISubtitle);\r\n } else {\r\n if (!Object.hasOwn(caption, 'duration')) {\r\n caption.duration = this.convertDuration(line);\r\n } else {\r\n caption.text += line;\r\n }\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n stripNewlineChars(str: string): string {\r\n let res: string = '';\r\n for (let i: number = 0, l: number = str.length; i < l; i++) {\r\n if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {\r\n res += str.charAt(i);\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n isValidLine(line: string): boolean {\r\n return (\r\n !line.startsWith('@') &&\r\n !line.startsWith('<begin subtitles>') &&\r\n !line.startsWith('<end subtitles>')\r\n );\r\n }\r\n\r\n convertDuration(time: string): IStrictDuration {\r\n const times: string[] = time.split(' ');\r\n return {\r\n start: this.convertTimeToSeconds(times[0]),\r\n end: this.convertTimeToSeconds(times[1]),\r\n };\r\n }\r\n\r\n convertTimeToSeconds(time: string): number {\r\n const parts: string[] = time.split(':');\r\n return (\r\n parseInt(parts[0], 10) * 3600 +\r\n parseInt(parts[1], 10) * 60 +\r\n parseInt(parts[2], 10)\r\n );\r\n }\r\n}\r\n","import {v4 as uuidv4} from 'uuid';\r\nimport type {\r\n IStrictDuration,\r\n ISubtitle,\r\n ISubtitleCollection,\r\n TLanguageCode,\r\n} from '../../types.ts';\r\n\r\n/**\r\n * Used to edit and add to an {@link ISubtitleCollection}.\r\n */\r\nexport class SubtitleEditor {\r\n constructor(private collection: ISubtitleCollection[] = []) {}\r\n\r\n private _getLanguage(languageCode: string) {\r\n return this.collection.find(x => x.languageCode === languageCode);\r\n }\r\n\r\n /**\r\n * Adds a new {@link ISubtitleCollection} for the given `languageCode`.\r\n *\r\n * If collections already exist for existing language codes then a duplicate\r\n * of these collections is created with the same duration info but all of the\r\n * text is left empty.\r\n *\r\n * @param languageCode\r\n * @returns\r\n */\r\n addLanguage(languageCode: TLanguageCode) {\r\n const language = this._getLanguage(languageCode);\r\n if (language) {\r\n throw new Error(`Language ${languageCode} already exists.`);\r\n }\r\n const newLanguage: ISubtitleCollection = this.collection.length\r\n ? {\r\n ...this.collection[0],\r\n languageCode,\r\n titles: this.collection[0].titles.map(x => ({\r\n id: uuidv4(),\r\n duration: {...x.duration},\r\n text: '',\r\n })),\r\n }\r\n : {\r\n languageCode,\r\n titles: [],\r\n };\r\n this.collection.push(newLanguage);\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Add a single subtitle line that is associated with the given `languageCode`\r\n *\r\n * @param languageCode\r\n * @param subtitle\r\n * @returns\r\n */\r\n addSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\r\n const language = this._getLanguage(languageCode);\r\n if (!language) {\r\n throw new Error(`Language ${languageCode} does not exist.`);\r\n }\r\n language.titles.push(subtitle);\r\n return this;\r\n }\r\n\r\n addSubtitles(\r\n duration: IStrictDuration,\r\n subtitles: Record<TLanguageCode, string>\r\n ) {\r\n Object.entries(subtitles).forEach(([languageCode, subtitle]) =>\r\n this.addSubtitle(languageCode as TLanguageCode, {\r\n id: uuidv4(),\r\n duration: {...duration},\r\n text: subtitle,\r\n })\r\n );\r\n return this;\r\n }\r\n\r\n setSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\r\n const language = this._getLanguage(languageCode);\r\n if (!language) {\r\n throw new Error(`Language ${languageCode} does not exist.`);\r\n }\r\n\r\n const titleIdx = language.titles.findIndex(x => x.id === subtitle.id);\r\n if (titleIdx < 0) {\r\n throw new Error(\r\n `Subtitle with id '${subtitle.id}' was not found in language with code ${languageCode}.`\r\n );\r\n }\r\n\r\n language.titles[titleIdx] = {\r\n ...subtitle,\r\n duration: {...subtitle.duration},\r\n };\r\n return this;\r\n }\r\n\r\n export() {\r\n return this.collection;\r\n }\r\n}\r\n","import {getPropertyChainValue} from './get-property-chain-value.ts';\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\nexport function resolvePropertyChain(propertyChain: string, sourceObject: any) {\r\n const properties = propertyChain.split('.');\r\n return getPropertyChainValue(properties, sourceObject);\r\n}\r\n","import type {TOperationData} from 'operation/types.ts';\r\nimport {isDefined} from 'ts-is-present';\r\nimport {Action, EndableAction, TimelineAction} from '../action/index.ts';\r\nimport type {IAction} from '../action/types.ts';\r\nimport type {ActionRegistryEventbusListener} from '../eventbus/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport {resolvePropertyChain} from '../operation/helper/resolve-property-chain.ts';\r\nimport type {\r\n IConfigurationResolver,\r\n ISimpleResourceImporter,\r\n} from '../types.ts';\r\nimport {isObject} from '../util/guards/is-object.ts';\r\nimport {isString} from '../util/guards/is-string.ts';\r\nimport type {\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.ts';\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<TOperationData>\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, index) => {\r\n resolvePlaceholders(item, rootConfig, importer);\r\n });\r\n } else if (isObject(configFragment)) {\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: PropertyKey,\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) || Array.isArray(configValue)) {\r\n resolvePlaceholders(configValue, rootConfig, importer);\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport type {IEndableAction, ITimelineAction} from './action/types.ts';\r\nimport type {IResolvedEngineConfiguration} from './configuration/types.ts';\r\nimport type {\r\n IEventbus,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './eventbus/types.ts';\r\nimport type {LanguageManager} from './language-manager.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {ITimelineProvider} from './timelineproviders/types.ts';\r\nimport type {\r\n IEligiusEngine,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types.ts';\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(position: number) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n const seekPosition = Math.floor(position);\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<number | undefined>) {\r\n callBack(this._activeTimelineProvider?.getDuration());\r\n }\r\n\r\n private containerRequest(\r\n callBack: TResultCallback<JQuery<HTMLElement> | undefined>\r\n ) {\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.pause();\r\n } else {\r\n this._activeTimelineProvider.start();\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 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<JQuery<HTMLElement>>\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<number>\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<string>) {\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};\r\n","import type {IAction} from '../action/types.ts';\r\nimport type {IEventbusListener} from './types.ts';\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 type {\r\n IEventbus,\r\n IEventbusInterceptor,\r\n IEventbusListener,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './types.ts';\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.ts';\r\nimport type {IEventbus, IEventbusInterceptor} from './types.ts';\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","export {ActionRegistryEventbusListener} from './actionregistry-eventbus-listener.ts';\r\nexport {Eventbus} from './eventbus.ts';\r\nexport {RequestVideoUriInterceptor} from './request-video-uri-interceptor.ts';\r\nexport * from './types.ts';\r\n","import {getGlobals} from './globals.ts';\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 $ from 'jquery';\r\nimport type {IEventbus, TEventbusRemover} from './eventbus/types.ts';\r\nimport {setGlobal} from './operation/helper/set-global.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {\r\n ILabel,\r\n ILanguageLabel,\r\n TLanguageCode,\r\n TResultCallback,\r\n} from './types.ts';\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: TLanguageCode,\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(\r\n resultCallback: TResultCallback<TLanguageCode>\r\n ) {\r\n resultCallback(this._currentLanguage);\r\n }\r\n\r\n _handleRequestLabelCollection(\r\n labelId: string,\r\n resultCallback: TResultCallback<ILabel[]>\r\n ) {\r\n resultCallback(this._labelLookup[labelId]);\r\n }\r\n\r\n _handleRequestLabelCollections(\r\n labelIds: string[],\r\n resultCallback: TResultCallback<ILabel[][]>\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: TLanguageCode) {\r\n this._currentLanguage = language;\r\n this._setRootElementLang(this._currentLanguage);\r\n }\r\n\r\n _setRootElementLang(language: TLanguageCode) {\r\n const callBack = (rootSelector: string) => {\r\n const lang = this._extractPrimaryLanguage(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 _extractPrimaryLanguage(culture: TLanguageCode) {\r\n return culture.split('-').shift() as string;\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 hk, {type HotkeysEvent} from 'hotkeys-js';\r\nimport $ from 'jquery';\r\nimport type {IAction} from './action/types.ts';\r\nimport {ConfigurationResolver} from './configuration/configuration-resolver.ts';\r\nimport type {\r\n IEngineConfiguration,\r\n IResolvedEngineConfiguration,\r\n} from './configuration/types.ts';\r\nimport {DevToolEventListener} from './diagnostics/devtool-event-listener.ts';\r\nimport {Diagnostics} from './diagnostics/diagnostics.ts';\r\nimport {\r\n DEV_TOOLS_KEY,\r\n type TDiagnosticType,\r\n type TWindowWithDevtools,\r\n} from './diagnostics/types.ts';\r\nimport {\r\n ActionRegistryEventbusListener,\r\n Eventbus,\r\n type IEventbus,\r\n RequestVideoUriInterceptor,\r\n type TEventbusRemover,\r\n} from './eventbus/index.ts';\r\nimport {LanguageManager} from './language-manager.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {\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.ts';\r\nimport {prepareValueForSerialization} from './util/prepare-value-for-serialization.ts';\r\n\r\nconst hotkeys = hk.default || hk;\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<any>\r\n ) {\r\n resultCallback(this._importSystemEntryWithEventbusDependency(systemName));\r\n }\r\n\r\n private _requestFunctionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback<any>\r\n ) {\r\n resultCallback(this._importSystemEntry(systemName));\r\n }\r\n\r\n private _requestActionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback<IAction | null>\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 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 >(\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 },\r\n {} as Record<TimelineTypes, ITimelineProviderInfo>\r\n );\r\n\r\n return result;\r\n }\r\n}\r\n","import * as ctrls from '../controllers/index.ts';\r\nimport {EligiusEngine} from '../eligius-engine.ts';\r\nimport * as evtb from '../eventbus/index.ts';\r\nimport * as ops from '../operation/index.ts';\r\nimport type {TOperation} from '../operation/types.ts';\r\nimport * as prvdrs from '../timelineproviders/index.ts';\r\nimport type {IResourceImporter} from '../types.ts';\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"],"mappings":";;;;;;;;;;;AAAA,SAAgB,WAAW,OAA2C;AACpE,QAAO,OAAO,UAAU;;;;;ACD1B,SAAgB,SACd,OACuC;AACvC,QAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;;;;ACCtE,SAAgB,6BAA6B,OAAqB;AAChE,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAQ,MAAqB,IAAI,6BAA6B;UACrD,iBAAiBA,EAC1B,QAAO;UACE,SAAS,MAAM,EAAE;AAC1B,MACE,MAAM,YAAY,UAAU,CAAC,UAAU,GAAG,EAAE,KAAK,WACjD,CAAC,MAAM,YAAY,UAAU,CAAC,WAAW,oBAAoB,EAC7D;GACA,MAAM,aAAa,MAAM,YAAY,UAAU;AAC/C,UAAO,WAAW,UAAU,GAAG,WAAW,QAAQ,IAAI,GAAG,EAAE;;AAE7D,SAAO,OAAO,YACZ,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,UAAU,eAAe,CACnD,UACA,6BAA6B,UAAU,CACxC,CAAC,CACH;YACQ,WAAW,MAAM,EAAE;EAC5B,MAAM,aAAa,MAAM,UAAU;AAEnC,MADmB,WAAW,QAAQ,IAAI,GACzB,GACf,QAAO,WAAW,UAAU,GAAG,WAAW,QAAQ,IAAI,GAAG,EAAE;AAE7D,SAAO;;AAET,QAAO;;;;;AC3BT,IAAa,uBAAb,MAA+D;CAC7D,YAAY,AAAQC,OAA0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A4B;AAuBnC,SArBe,OAAO,QAAQ,yBAAyB,CAAC,QAGrD,KAAK,CAAC,cAAc,cAAc;AACjC,OAAI,CAAC,SACH,QAAO;GAGT,MAAM,wBAAwB,KAAK,mBACjC,SAAS,WACV;AACD,OAAI,gBAAiC;IACnC,IAAI,SAAS;IACb,QAAQ,SAAS;IACjB,UAAU,IAAI,sBAAsB,cAAc;IACnD;AACD,UAAO;KAET,EAAE,CACH;;;;;;AC/RL,MAAMC,aAA8CC;AACpD,MAAMC,cAAmCC;AACzC,MAAMC,YAAiCC;AACvC,MAAMC,WAAgCC;AAEtC,IAAa,0BAAb,MAAkE;CAChE,0BAAU,IAAI,KAAK;CACnB,cAAc;AACZ,OAAK,QAAQ,IAAI,iBAAiB,cAAc;;CAGlD,oBAA8B;AAC5B,SAAO,OAAO,KAAK,WAAW;;CAGhC,qBAA+B;AAC7B,SAAO,OAAO,KAAK,YAAY;;CAGjC,mBAA6B;AAC3B,SAAO,OAAO,KAAK,UAAU;;CAG/B,OAAO,MAAmC;EACxC,MAAM,QACJ,WAAW,SACX,YAAY,SACZ,UAAU,SACV,SAAS,SACT,KAAK,QAAQ,IAAI,KAAK;AAExB,SAAO,GAAE,OAAO,OAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["jQuery","agent: IDiagnosticsAgent","cache: TGlobalCache","cache","getGlobals: (name?: string) => TGlobalCache | any","setGlobals: (newValues: TGlobalCache) => void","clearGlobals: () => void","forEach: TOperation<IForEachOperationData>","when: TOperation<IWhenOperationData>","evaluations: Record<\r\n TOperator,\r\n (left: string | number, right: string | number) => boolean\r\n>","name: string","startOperations: IResolvedOperation[]","eventbus: IEventbus","operations","endOperations: IResolvedOperation[]","duration: IStrictDuration","operations","lookup: Record<string, true>","addClass: TOperation<IAddClassOperationData>","controllers","addControllerToElement: TOperation<IAddControllerToElementOperationData>","animate: TOperation<IAnimateOperationData>","animateWithClass: TOperation<\r\n IAnimateWithClassOperationData,\r\n Promise<IAnimateWithClassOperationData>\r\n>","removeClass","broadcastEvent: TOperation<IBroadcastEventOperationData>","cache: any[]","resolvePropertyChain","calcFunctions: Record<\r\n TCalculationOperator,\r\n (left: number, right: number) => number\r\n>","calc: TOperation<ICalcOperationData>","clearElement: TOperation<IClearElementOperationData>","clearOperationData: TOperation<\r\n IClearOperationDataOperationData\r\n>","createElement: TOperation<\r\n ICreateElementOperationData<TTagNames>,\r\n RequireKeys<ICreateElementOperationData<TTagNames>, 'template'>\r\n>","customFunction: TOperation<ICustomFunctionOperationData>","endAction: TOperation<IEndActionOperationData>","endForEach: TOperation<TOperationData>","endWhen: TOperation<Record<string, unknown>>","extendController: TOperation<IExtendControllerOperationData>","getAttributesFromElement: TOperation<\r\n IGetAttributesFromElementOperationData\r\n>","getControllerFromElement: TOperation<\r\n IGetControllerFromElementOperationData\r\n>","getControllerInstance: TOperation<IGetControllerInstanceOperationData>","suffix: string | null","ratioModifier: string | null","getElementDimensions: TOperation<\r\n IGetElementDimensionsOperationData\r\n>","getImport: TOperation<\r\n IGetImportOperationData,\r\n Omit<RequireKeys<IGetImportOperationData, 'importedInstance'>, 'systemName'>\r\n>","getQueryParams: TOperation<IGetQueryParamsOperationData>","invokeObjectMethod: TOperation<\r\n IInvokeObjectMethodOperationData,\r\n Omit<IInvokeObjectMethodOperationData, 'methodName' | 'methodArguments'>\r\n>","jsonCache: Record<string, unknown>","loadJson: TOperation<ILoadJSONOperationData>","cache","log: TOperation<TOperationData>","math: TOperation<\r\n IMathOperationData,\r\n Omit<IMathOperationData, 'args' | 'functionName'>\r\n>","otherwise: TOperation<Record<string, unknown>>","removeClass: TOperation<IRemoveClassOperationData>","removeControllerFromElement: TOperation<IRemoveControllerFromElementOperationData>","controllers","removeElement: TOperation<IRemoveElementOperationData>","removePropertiesFromOperationData: TOperation<\r\n IRemovePropertiesFromOperationDataOperationData,\r\n Omit<IRemovePropertiesFromOperationDataOperationData, 'propertyNames'>\r\n>","reparentElement: TOperation<IReparentElementOperationData>","requestAction: TOperation<\r\n IRequestActionOperationData,\r\n Required<IRequestActionOperationData>\r\n>","resizeAction: TOperation<IResizeActionOperationData>","selectElement: TOperation<ISelectElementOperationData>","setData: TOperation<ISetDataOperationData>","path","targets: {\r\n context: IOperationContext;\r\n operationdata: TOperationData;\r\n globaldata: TGlobalCache;\r\n }","setElementAttributes: TOperation<\r\n ISetElementAttributesOperationData\r\n>","setElementContent: TOperation<ISetElementContentOperationData>","setGlobalData: TOperation<\r\n ISetGlobalDataOperationData,\r\n Omit<ISetGlobalDataOperationData, 'propertyNames'>\r\n>","setOperationData: TOperation<\r\n ISetOperationData,\r\n Omit<ISetOperationData, 'override' | 'properties'>\r\n>","setStyle: TOperation<ISetStyleOperationData>","setVariable: TOperation<ISetVariableOperationData>","startAction: TOperation<IStartActionOperationData>","toggleClass: TOperation<IToggleClassOperationData>","toggleElement: TOperation<IToggleElementOperationData>","toggleElement","wait: TOperation<IWaitOperationData>","configurationfactory: ConfigurationFactory","factory: ActionCreatorFactory","uuidv4","operations","actionConfig: T","configurationFactory: ConfigurationFactory","operations","uuidv4","duration: IDuration","operationConfig: IOperationConfiguration<\r\n ExtractOperationDataType<O>\r\n >","actionEditor: T","configurationFactory: ConfigurationFactory","languageLabel: ILanguageLabel","item","uuidv4","config: IResolvedEngineConfiguration","providersSettings: TTimelineProviderSettings","configurationFactory: ConfigurationFactory","settings: ITimelineProviderSettings","uuidv4","providerSettings: ITimelineProviderSettings","providersSettingsEditor: TimelineProvidersSettingsEditor","timelineProviders","configuration: IEngineConfiguration","newConfiguration: IEngineConfiguration","uuidv4","timelineConfig: ITimelineConfiguration","eventbus","resultHolder: {\r\n language: string;\r\n labelCollections: any[];\r\n }","eventbus","animationSettings: AnimationConfigWithData<'svg'>","eventbus","labelCtrl: LabelController","result: any[]","eventbus","eventbus","result: any[]","eventbus","subtitleTimeLookup: Record<number, () => void>","titleLanguageLookup: Record<string, string>","addClass","addControllerToElement","animateWithClass","animate","broadcastEvent","calc","clearElement","clearOperationData","createElement","customFunction","endAction","endForEach","endWhen","extendController","forEach","getAttributesFromElement","getControllerFromElement","getControllerInstance","getElementDimensions","getImport","getQueryParams","invokeObjectMethod","loadJson","log","math","otherwise","removeClass","removeControllerFromElement","removeElement","removePropertiesFromOperationData","reparentElement","requestAction","resizeAction","selectElement","setData","setElementAttributes","setElementContent","setGlobalData","setOperationData","setStyle","setVariable","startAction","toggleClass","toggleElement","wait","when","operations","controllers","operationMetadata","result: ISubtitle[]","lines: string[]","i: number","l: number","rawLine: string","caption: Partial<ISubtitle> | null","res: string","times: string[]","parts: string[]","collection: ISubtitleCollection[]","newLanguage: ISubtitleCollection","uuidv4","importer: ISimpleResourceImporter","eventbus: IEventbus","resolvedConfig: IResolvedEngineConfiguration","eventActions: IAction[]","eventbus","configuration: IResolvedEngineConfiguration","eventbus: IEventbus","timelineProviders: Record<TimelineTypes, ITimelineProviderInfo>","languageManager: LanguageManager","eventbus: IEventbus","cache","_currentLanguage: TLanguageCode","_eventbus: IEventbus","eventbus","eventbus","actionRegistryListener: ActionRegistryEventbusListener | undefined","operations: Record<string, TOperation<any>>","ops","controllers: Record<string, any>","ctrls","providers: Record<string, any>","prvdrs","eventbus: Record<string, any>","evtb"],"sources":["../src/util/guards/is-function.ts","../src/util/guards/is-object.ts","../src/util/prepare-value-for-serialization.ts","../src/diagnostics/devtool-event-listener.ts","../src/diagnostics/diagnostics.ts","../src/diagnostics/types.ts","../src/operation/helper/find-matching-operation-index.ts","../src/operation/helper/get-context-var.ts","../src/operation/helper/get-property-chain-value.ts","../src/operation/helper/deep-copy.ts","../src/operation/helper/globals.ts","../src/operation/helper/resolve-external-property-chain.ts","../src/operation/for-each.ts","../src/operation/when.ts","../src/util/guards/is-promise.ts","../src/action/action.ts","../src/action/endable-action.ts","../src/action/timeline-action.ts","../src/util/dash-to-camel-case.ts","../src/build/generate-importer-source-code.ts","../src/operation/add-class.ts","../src/operation/helper/get-element-data.ts","../src/operation/helper/attach-controller-to-element.ts","../src/operation/helper/merge-operation-data.ts","../src/operation/helper/internal-resolve.ts","../src/operation/add-controller-to-element.ts","../src/operation/animate.ts","../src/operation/animate-with-class.ts","../src/operation/helper/remove-event-data-from-operation-data.ts","../src/operation/helper/resolve-event-arguments.ts","../src/operation/broadcast-event.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-for-each.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/helper/modify-dimensions.ts","../src/operation/get-element-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/util/guards/is-string.ts","../src/operation/math.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/set-variable.ts","../src/operation/start-action.ts","../src/operation/toggle-class.ts","../src/operation/toggle-element.ts","../src/operation/wait.ts","../src/operation/index.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/util/merge-if-missing.ts","../src/configuration/api/label-editor.ts","../src/util/animation-interval.ts","../src/timelineproviders/request-animation-frame-timeline-provider.ts","../src/timelineproviders/video-js-timeline-provider.ts","../src/timelineproviders/index.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/controllers/index.ts","../src/operation/metadata/add-class.ts","../src/operation/metadata/add-controller-to-element.ts","../src/operation/metadata/add-globals-to-operation.ts","../src/operation/metadata/animate-with-class.ts","../src/operation/metadata/animate.ts","../src/operation/metadata/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-for-each.ts","../src/operation/metadata/end-when.ts","../src/operation/metadata/extend-controller.ts","../src/operation/metadata/for-each.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/set-variable.ts","../src/operation/metadata/start-action.ts","../src/operation/metadata/toggle-class.ts","../src/operation/metadata/toggle-element.ts","../src/operation/metadata/wait.ts","../src/operation/metadata/when.ts","../src/operation/metadata/index.ts","../src/configuration/api/name-providers.ts","../src/configuration/api/subtitle-converter.ts","../src/configuration/api/subtitle-editor.ts","../src/operation/helper/resolve-property-chain.ts","../src/configuration/configuration-resolver.ts","../src/eligius-engine.ts","../src/eventbus/actionregistry-eventbus-listener.ts","../src/eventbus/eventbus.ts","../src/eventbus/request-video-uri-interceptor.ts","../src/eventbus/index.ts","../src/operation/helper/set-global.ts","../src/language-manager.ts","../src/engine-factory.ts","../src/importer/eligius-resource-importer.ts"],"sourcesContent":["export function isFunction(value: any): value is (...arg: any) => any {\r\n return typeof value === 'function';\r\n}\r\n","export function isObject(\r\n value: unknown\r\n): value is Record<PropertyKey, unknown> {\r\n return !!value && typeof value === 'object' && !Array.isArray(value);\r\n}\r\n","import jQuery from 'jquery';\r\nimport {isFunction} from './guards/is-function.ts';\r\nimport {isObject} from './guards/is-object.ts';\r\n\r\nexport function prepareValueForSerialization(value: unknown): 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 = 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 = value.toString();\r\n const parenIndex = funcString.indexOf('{');\r\n if (parenIndex > -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 type {IEventbusListener} from '../eventbus/index.ts';\r\nimport {prepareValueForSerialization} from '../util/prepare-value-for-serialization.ts';\r\nimport type {IDiagnosticsAgent} from './types.ts';\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.info('message', message);\r\n }\r\n }\r\n}\r\n","import type {TDiagnosticType} from './types.ts';\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","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","import type {IResolvedOperation} from '../../configuration/types.ts';\r\n\r\n/**\r\n * This function can be used to find the index of a matching closing operation within a list of operations.\r\n *\r\n * Assume the following array of operations:\r\n * ```ts\r\n * [\r\n * {systemName:'name1'}, // index 0\r\n * {systemName:'forEach'}, // index 1\r\n * {systemName:'name2'}, // index 2\r\n * {systemName:'forEach'} // index 3\r\n * {systemName:'name3'} // index 4\r\n * {systemName:'endForEach'} // index 5\r\n * {systemName:'endForEach'} // index 6\r\n * {systemName:'name3'} // index 7\r\n * ]\r\n * ```\r\n *\r\n * Given the `forEach` instance at index 1, this function will return index 6. Given the `forEach` 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` equals `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 *\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","export type VariableName = `@${string}`;\r\n\r\nexport const getContextVar = (variables: Record<string, any>|undefined, identifier: VariableName) => {\r\n const name = identifier.substring(1);\r\n return variables ? variables[name] : undefined;\r\n};\r\n\r\n\r\nexport const isVariableName = (value: string): value is VariableName => value.startsWith('@');","/**\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\nexport function getPropertyChainValue(\r\n propertyChain: string[],\r\n sourceObject: Record<string, any>\r\n) {\r\n let suffix = null;\r\n\r\n const result = propertyChain.reduce((currentInstance, prop, index) => {\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 return currentInstance[prop];\r\n }, sourceObject);\r\n\r\n return suffix ? `${result}${suffix}` : result;\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 : <T>(original: any) => JSON.parse(JSON.stringify(original)) as T;\r\n\r\nexport function deepCopy<T>(original: T): T {\r\n if (isDefined(original)) {\r\n return copyFunction<T>(original);\r\n }\r\n return original;\r\n}\r\n","import {deepCopy} from './deep-copy.ts';\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 type {IOperationContext, TOperationData} from '../types.ts';\r\nimport {getPropertyChainValue} from './get-property-chain-value.ts';\r\nimport {getGlobals} from './globals.ts';\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\nexport function resolveExternalPropertyChain(\r\n sourceObject: TOperationData,\r\n operationContext: IOperationContext,\r\n propertyChainOrRegularObject:\r\n | ExternalProperty\r\n | Record<string, any>\r\n | null\r\n | undefined\r\n) {\r\n if (\r\n propertyChainOrRegularObject === null ||\r\n propertyChainOrRegularObject === undefined\r\n ) {\r\n return null;\r\n }\r\n\r\n if (isExternalProperty(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\r\nexport function isExternalProperty(\r\n value: ExternalProperty | Record<string, any>\r\n): value is ExternalProperty {\r\n return (\r\n typeof value === 'string' &&\r\n (value.toLocaleLowerCase().startsWith('operationdata.') ||\r\n value.toLocaleLowerCase().startsWith('globaldata.') ||\r\n value.toLocaleLowerCase().startsWith('context.'))\r\n );\r\n}\r\n\r\nexport type ExternalProperty =\r\n | `operationdata.${string}`\r\n | `globaldata.${string}`\r\n | `context.${string}`;\r\n","import {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport { getContextVar, isVariableName, type VariableName } from './helper/get-context-var.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\r\n\r\nexport interface IForEachOperationData {\r\n /**\r\n * @type=ParameterType:array|string\r\n * @required\r\n */\r\n collection: unknown[] | string | VariableName;\r\n}\r\n\r\n/**\r\n * This operation iterates over 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 endForEach} 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\nexport const forEach: TOperation<IForEachOperationData> = function (\r\n operationData: IForEachOperationData\r\n) {\r\n const {collection} = operationData;\r\n const resolvedCollection =\r\n typeof collection === 'string'\r\n ? isVariableName(collection) ? getContextVar(this.variables, collection) : (resolveExternalPropertyChain(\r\n operationData,\r\n this,\r\n collection as ExternalProperty\r\n ) as any[])\r\n : collection;\r\n\r\n if (\r\n resolvedCollection !== null &&\r\n resolvedCollection !== undefined &&\r\n !Array.isArray(resolvedCollection)\r\n ) {\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 = findEndForEachIndex(this);\r\n if (resolvedCollection?.length) {\r\n this.loopIndex = 0;\r\n this.loopLength = resolvedCollection.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 (resolvedCollection?.length && this.loopIndex !== undefined) {\r\n this.currentItem = resolvedCollection[this.loopIndex];\r\n }\r\n\r\n return operationData;\r\n};\r\n\r\nfunction findEndForEachIndex(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: forEachSystemName,\r\n matchingName: endForEachSystemName,\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\r\nexport const forEachSystemName = 'forEach';\r\nexport const endForEachSystemName = 'endForEach';\r\n","import {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport { getContextVar, isVariableName } from './helper/get-context-var.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\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 | `@${string}`;\r\n\r\ntype TExpression = `${TValue}${TOperator}${TValue}`;\r\n\r\nexport interface IWhenOperationData {\r\n /**\r\n * @type=ParameterType:expression\r\n * @required\r\n */\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 * The expression is passed in as a formatted string.\r\n * The left and right values of the expression can be defined like this:\r\n * \r\n * 'constant': for a constant string\r\n * 100: for a constant number\r\n * operationData.foo: for an operation data value\r\n * globaldata.foo: for a global data value\r\n * context.loopIndex: for a context value\r\n * @foo: for a variable value\r\n * \r\n * @example\r\n * @foo=='bar'\r\n * @example\r\n * globalData.foo>@bar\r\n * @example\r\n * operationData.foo!=100\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 const [left, right] = expression.split(/!=|==|>=|<=|>|</);\r\n\r\n const operator = expression.substring(\r\n left.length,\r\n expression.length - right.length\r\n ) as TOperator;\r\n\r\n const leftNr = parseFloat(left);\r\n const rightNr = parseFloat(right);\r\n\r\n return [\r\n (Number.isNaN(leftNr)\r\n ? isVariableName(left) ? getContextVar(operationContext.variables, left) : resolveExternalPropertyChain(\r\n operationData,\r\n operationContext,\r\n left as ExternalProperty\r\n )\r\n : leftNr) as TValue,\r\n operator,\r\n (Number.isNaN(rightNr)\r\n ? isVariableName(right) ? getContextVar(operationContext.variables, right) : resolveExternalPropertyChain(\r\n operationData,\r\n operationContext,\r\n right as ExternalProperty\r\n )\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: whenSystemName,\r\n matchingName: otherwiseSystemName,\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: whenSystemName,\r\n matchingName: endWhenSystemName,\r\n })\r\n );\r\n\r\n return endWhenIndex > -1\r\n ? endWhenIndex + currentIndex\r\n : context.operations.length;\r\n}\r\n\r\nexport const whenSystemName = 'when';\r\nexport const otherwiseSystemName = 'otherwise';\r\nexport const endWhenSystemName = 'endWhen';\r\n","export function isPromise(obj: any): obj is Promise<unknown> {\r\n return typeof obj === 'object' && typeof obj.then === 'function';\r\n}\r\n","import type {IResolvedOperation} from '../configuration/types.ts';\r\nimport {Diagnostics} from '../diagnostics/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {\r\n endForEachSystemName,\r\n forEachSystemName,\r\n} from '../operation/for-each.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport type {IOperationContext, TOperationData} from '../operation/types.ts';\r\nimport {endWhenSystemName, whenSystemName} from '../operation/when.ts';\r\nimport {isPromise} from '../util/guards/is-promise.ts';\r\nimport type {IAction} from './types.ts';\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 === whenSystemName) {\r\n context = this._pushContext(context);\r\n } else if (\r\n operationInfo.systemName === forEachSystemName &&\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 === endWhenSystemName ||\r\n (operationInfo.systemName === endForEachSystemName &&\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 as TOperationData\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","import type {IResolvedOperation} from '../configuration/types.ts';\r\nimport {Diagnostics} from '../diagnostics/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {Action} from './action.ts';\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 type {IResolvedOperation} from '../configuration/types.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {IStrictDuration} from '../types.ts';\r\nimport {EndableAction} from './endable-action.ts';\r\nimport type {ITimelineAction} from './types.ts';\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) {\r\n this._active = Boolean(this.endOperations.length);\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 return super.end(initOperationData).then(result => {\r\n this._active = false;\r\n return result;\r\n });\r\n }\r\n}\r\n","export default function dashToCamelCase(input: string) {\r\n return input.replace(/-([a-z])/g, g => g[1].toUpperCase());\r\n}\r\n","import fs from 'node:fs';\r\nimport path from 'node:path';\r\nimport type { TOperationData } from 'operation/types.ts';\r\nimport type {\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IEngineConfiguration,\r\n IOperationConfiguration,\r\n} from '../configuration/types.ts';\r\nimport dashToCamelCase from '../util/dash-to-camel-case.ts';\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 = _deduplicate(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 _deduplicate(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<TOperationData>[]\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 _deduplicate(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 return (lookup[imp.systemName] = true);\r\n });\r\n}\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IAddClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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 */\r\nexport const addClass: TOperation<IAddClassOperationData> = operationData => {\r\n const {selectedElement, className} = operationData;\r\n selectedElement.addClass(className);\r\n return operationData;\r\n};\r\n","import type {IController} from '../../controllers/types.ts';\r\n\r\nconst controllersDataName = 'eligiusEngineControllers';\r\n\r\nfunction getElementData(\r\n name: string,\r\n element: JQuery\r\n): IController<any>[] | undefined {\r\n return element.data(name);\r\n}\r\n\r\nconst getElementControllers = getElementData.bind(null, controllersDataName);\r\n\r\nexport {getElementData, getElementControllers, controllersDataName};\r\n","import {\r\n controllersDataName,\r\n getElementControllers,\r\n} from './get-element-data.ts';\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 type {TOperationData} from '../types.ts';\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 type {TOperationData} from '../types.ts';\r\nimport {mergeOperationData} from './merge-operation-data.ts';\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 type {IController} from '../controllers/types.ts';\r\nimport {attachControllerToElement} from './helper/attach-controller-to-element.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {IOperationContext, TOperation, TOperationData} from './types.ts';\r\n\r\nexport type IAddControllerToElementOperationData<\r\n T extends TOperationData = TOperationData,\r\n> = {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\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 */\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 {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IAnimateOperationData {\r\n /**\r\n * @type=ParameterType:boolean\r\n */\r\n animationEasing?: string;\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @required\r\n */\r\n animationProperties: Record<string, unknown>;\r\n /**\r\n * @type=ParameterType:number\r\n * @required\r\n */\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> = (\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IAnimateWithClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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\nexport const animateWithClass: TOperation<\r\n IAnimateWithClassOperationData,\r\n Promise<IAnimateWithClassOperationData>\r\n> = (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","import type {TOperationData} from '../../operation/types.ts';\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 type {IOperationContext, TOperationData} from '../../operation/types.ts';\r\nimport {resolveExternalPropertyChain} from './resolve-external-property-chain.ts';\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 {removeEventDataFromOperationData} from './helper/remove-event-data-from-operation-data.ts';\r\nimport {resolveEventArguments} from './helper/resolve-event-arguments.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IBroadcastEventOperationData {\r\n eventArgs: unknown[];\r\n /**\r\n * @type=ParameterType:eventTopic\r\n */\r\n eventTopic?: string;\r\n /**\r\n * @type=ParameterType:eventName\r\n * @required\r\n */\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\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 $ from 'jquery';\r\nimport type {IOperationContext, TOperationData} from '../../operation/types.ts';\r\nimport {isObject} from '../../util/guards/is-object.ts';\r\nimport {deepCopy} from './deep-copy.ts';\r\nimport type {ExternalProperty} from './resolve-external-property-chain.ts';\r\nimport {\r\n isExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './resolve-external-property-chain.ts';\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\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: (\r\n propertyChain: ExternalProperty | Record<string, any>\r\n ) => 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 (isExternalProperty(value)) {\r\n copy[key] = resolvePropertyChain(value);\r\n } else if (Array.isArray(value)) {\r\n value.forEach((item, index, arr) => {\r\n if (isExternalProperty(item)) {\r\n arr[index] = resolvePropertyChain(item);\r\n } else if (isObject(item)) {\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport type TCalculationOperator = '+' | '-' | '*' | '/' | '%' | '**';\r\n\r\nexport interface ICalcOperationData {\r\n /**\r\n * The left operand\r\n * @type=ParameterType:number\r\n * @required\r\n */\r\n left: string | number;\r\n /**\r\n * The right operand\r\n * @type=ParameterType:number\r\n * @required\r\n */\r\n right: string | number;\r\n /**\r\n * @required\r\n */\r\n operator: TCalculationOperator;\r\n /**\r\n * @output\r\n */\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IClearElementOperationData {\r\n /**\r\n * @dependency\r\n */\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> = (\r\n operationData: IClearElementOperationData\r\n) => {\r\n const {selectedElement} = operationData;\r\n selectedElement.empty();\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\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<\r\n IClearOperationDataOperationData\r\n> = (operationData: IClearOperationDataOperationData) => {\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 type {RequireKeys} from 'types.ts';\r\nimport {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\r\n\r\nexport type TTagNames = keyof HTMLElementTagNameMap;\r\n\r\nexport interface ICreateElementOperationData<T extends TTagNames> {\r\n /**\r\n * @required\r\n */\r\n elementName: T;\r\n text?: string;\r\n /**\r\n * @type=ParameterType:object\r\n */\r\n attributes?: Partial<HTMLElementTagNameMap[T]>;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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<\r\n ICreateElementOperationData<TTagNames>,\r\n RequireKeys<ICreateElementOperationData<TTagNames>, 'template'>\r\n> = function <T extends TTagNames>(\r\n this: IOperationContext,\r\n operationData: ICreateElementOperationData<T>\r\n) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\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 as RequireKeys<\r\n ICreateElementOperationData<TTagNames>,\r\n 'template'\r\n >;\r\n};\r\n","export type TimelineEventName = keyof typeof TimelineEventNames;\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.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport type {TOperation} from './types.ts';\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 type {IEndableAction} from '../action/types.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IEndActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: IEndableAction;\r\n actionOperationData: Record<string, unknown>;\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\nexport const endAction: TOperation<IEndActionOperationData> = (\r\n operationData: IEndActionOperationData\r\n) => {\r\n let {actionOperationData, ...newOperationData} = operationData;\r\n\r\n return new Promise<IEndActionOperationData>((resolve, reject) => {\r\n newOperationData = mergeOperationData(\r\n newOperationData,\r\n actionOperationData\r\n );\r\n\r\n newOperationData.actionInstance.end(newOperationData).then(() => {\r\n Object.keys(actionOperationData).forEach(key => {\r\n delete (newOperationData as any)[key];\r\n });\r\n internalResolve(resolve, newOperationData);\r\n }, reject);\r\n });\r\n};\r\n","import type {TOperation, TOperationData} from './types.ts';\r\n\r\n/**\r\n * This operation checks if the current loop should end or start the next iteration.\r\n */\r\nexport const endForEach: 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 type {TOperation} from './types.ts';\r\n\r\n/**\r\n * This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.\r\n */\r\nexport const endWhen: TOperation<Record<string, unknown>> = function (\r\n operationData: Record<string, unknown>\r\n) {\r\n delete this.whenEvaluation;\r\n return operationData;\r\n};\r\n","import type {IController} from '../controllers/types.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\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 /**\r\n * @dependency\r\n */\r\n controllerInstance: IController<TOperationData>;\r\n controllerExtension: Record<PropertyKey, unknown>;\r\n}\r\n\r\n/**\r\n * Extends the current controller with given extension.\r\n */\r\nexport const extendController: TOperation<IExtendControllerOperationData> = (\r\n operationData: IExtendControllerOperationData\r\n) => {\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IGetAttributesFromElementOperationData {\r\n /**\r\n * The HTML element whose attributes will be retrieved\r\n * @dependency\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 * @output\r\n */\r\n attributeValues?: Record<string, unknown>;\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<\r\n IGetAttributesFromElementOperationData\r\n> = (operationData: IGetAttributesFromElementOperationData) => {\r\n const {selectedElement, attributeNames} = operationData;\r\n\r\n operationData.attributeValues = attributeNames.reduce(\r\n (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 },\r\n {} as Record<string, unknown>\r\n );\r\n\r\n return operationData;\r\n};\r\n","import type {IController} from '../controllers/types.ts';\r\nimport {getElementControllers} from './helper/get-element-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetControllerFromElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:controllerName\r\n * @required\r\n */\r\n controllerName: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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<\r\n IGetControllerFromElementOperationData\r\n> = (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 type * as controllers from '../controllers/index.ts';\r\nimport type {IController} from '../controllers/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\ntype TSystemName = keyof typeof controllers;\r\nexport interface IGetControllerInstanceOperationData {\r\n /**\r\n * @required\r\n */\r\n systemName: TSystemName;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\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 type {IDimensions} from '../../types.ts';\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 const prefix = ratioModifier.substring(0, 1);\r\n\r\n const ratio = ratioModifier.substring(\r\n ratioModifier.indexOf('[') + 1,\r\n ratioModifier.indexOf(']') - (ratioModifier.indexOf('[') - 1)\r\n );\r\n\r\n const 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 const 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 const [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 {modifyDimensions} from './helper/modify-dimensions.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetElementDimensionsOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:dimensionsModifier\r\n */\r\n modifier?: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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 ratio of 8 to 1 relative to the height.\r\n */\r\nexport const getElementDimensions: TOperation<\r\n IGetElementDimensionsOperationData\r\n> = (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\r\n if (dimensions.height === 0) {\r\n dimensions.height = dimensions.width;\r\n }\r\n\r\n if (modifier) {\r\n dimensions = modifyDimensions(dimensions, modifier);\r\n }\r\n\r\n operationData.dimensions = dimensions;\r\n return operationData;\r\n};\r\n","import type {RequireKeys} from 'types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IGetImportOperationData {\r\n /**\r\n * @type=ParameterType:systemName\r\n * @required\r\n */\r\n systemName: string;\r\n /**\r\n * @output\r\n */\r\n importedInstance?: unknown;\r\n}\r\n\r\n/**\r\n * This operation retrieves the import specified by the given `systemName` 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<\r\n IGetImportOperationData,\r\n Omit<RequireKeys<IGetImportOperationData, 'importedInstance'>, 'systemName'>\r\n> = function (operationData: IGetImportOperationData) {\r\n const {systemName} = operationData;\r\n const callBack = (instance: unknown) => {\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 as Omit<\r\n RequireKeys<IGetImportOperationData, 'importedInstance'>,\r\n 'systemName'\r\n >;\r\n};\r\n","import type {TOperation} from './types.ts';\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 * @output\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\nexport const getQueryParams: TOperation<IGetQueryParamsOperationData> = (\r\n operationData: IGetQueryParamsOperationData\r\n) => {\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 type {TOperation} from './types.ts';\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?: unknown[];\r\n /**\r\n * If any, the results of the method invocation are assigned to the property\r\n */\r\n methodResult?: unknown;\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<\r\n IInvokeObjectMethodOperationData,\r\n Omit<IInvokeObjectMethodOperationData, 'methodName' | 'methodArguments'>\r\n> = (operationData: IInvokeObjectMethodOperationData) => {\r\n const {methodName, methodArguments, ...newOperationData} = operationData;\r\n\r\n const func = operationData.instance[methodName];\r\n if (typeof func === 'function') {\r\n newOperationData.methodResult = func.apply(\r\n operationData.instance,\r\n methodArguments ?? []\r\n );\r\n } else {\r\n console.error(`The given member name ${methodName} is not a function`);\r\n }\r\n\r\n return newOperationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nconst jsonCache: Record<string, unknown> = {};\r\n\r\nexport interface ILoadJSONOperationData {\r\n /**\r\n * The URL where the JSON will be retrieved from\r\n * @required\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 * @output\r\n */\r\n json?: any;\r\n}\r\n\r\nconst 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\nexport const loadJson: TOperation<ILoadJSONOperationData> = async (\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\r\nexport const clearCache = () => {\r\n for (const p in jsonCache) {\r\n delete jsonCache[p];\r\n }\r\n};\r\n","import {getGlobals} from './helper/globals.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\n/**\r\n * This operation logs the current operation data, global data and context to the console.\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","export function isString(value: any): value is string {\r\n return typeof value === 'string';\r\n}\r\n","import {isFunction} from '../util/guards/is-function.ts';\r\nimport {isString} from '../util/guards/is-string.ts';\r\nimport {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport type MathFunctionKeys = {\r\n [K in keyof Math]: Math[K] extends (...args: any) => any ? K : never;\r\n}[keyof Math];\r\n\r\nexport type MathNonFunctionKeys = {\r\n [K in keyof Math]: Math[K] extends (...args: any) => any ? never : K;\r\n}[keyof Math];\r\n\r\nexport interface IMathOperationData {\r\n /**\r\n * @type=ParameterType:array\r\n * @required\r\n */\r\n args: (number | string | MathNonFunctionKeys)[];\r\n /**\r\n * @required\r\n */\r\n functionName: MathFunctionKeys;\r\n /**\r\n * @output\r\n */\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\nexport const math: TOperation<\r\n IMathOperationData,\r\n Omit<IMathOperationData, 'args' | 'functionName'>\r\n> = function (operationData: IMathOperationData) {\r\n operationData = resolvePropertyValues(operationData, this, operationData);\r\n operationData.args = resolveMathConstants(operationData.args);\r\n\r\n const {args, functionName, ...newOperationData} = operationData;\r\n\r\n newOperationData.mathResult = (Math[functionName] as Function).apply(\r\n null,\r\n args\r\n );\r\n\r\n return newOperationData;\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 {findMatchingOperationIndex} from './helper/find-matching-operation-index.ts';\r\nimport type {IOperationContext, TOperation} from './types.ts';\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\nexport const otherwise: TOperation<Record<string, unknown>> = function (\r\n operationData: Record<string, unknown>\r\n) {\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveClassOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:className\r\n * @required\r\n */\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> = (\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 type {IController} from '../controllers/types.ts';\r\nimport {getElementControllers} from './helper/get-element-data.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveControllerFromElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:controllerName\r\n */\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 && controllers) {\r\n const idx = controllers.indexOf(controller);\r\n controllers.splice(idx, 1);\r\n controller.detach(this.eventbus);\r\n } else {\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 return operationData;\r\n };\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IRemoveElementOperationData {\r\n /**\r\n * @dependency\r\n */\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> = (\r\n operationData: IRemoveElementOperationData\r\n) => {\r\n const {selectedElement} = operationData;\r\n selectedElement.remove();\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IRemovePropertiesFromOperationDataOperationData {\r\n /**\r\n * @required\r\n */\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 remove the property `propertyNames` from the result.\r\n */\r\nexport const removePropertiesFromOperationData: TOperation<\r\n IRemovePropertiesFromOperationDataOperationData,\r\n Omit<IRemovePropertiesFromOperationDataOperationData, 'propertyNames'>\r\n> = (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 );\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IReparentElementOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:selector\r\n * @required\r\n */\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 operationData: IReparentElementOperationData\r\n) => {\r\n const {selectedElement, newParentSelector} = operationData;\r\n selectedElement.remove().appendTo(newParentSelector);\r\n return operationData;\r\n};\r\n","import type {IAction} from '../action/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IRequestActionOperationData {\r\n /**\r\n * @type=ParameterType:actionName\r\n * @required\r\n */\r\n systemName: string;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\nexport const requestAction: TOperation<\r\n IRequestActionOperationData,\r\n Required<IRequestActionOperationData>\r\n> = function (operationData: IRequestActionOperationData) {\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 as Required<IRequestActionOperationData>;\r\n};\r\n","import {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\nexport interface IResizeActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: any;\r\n /**\r\n * @type=ParameterType:object\r\n */\r\n actionOperationData: TOperationData;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n */\r\nexport const resizeAction: TOperation<IResizeActionOperationData> = (\r\n operationData: IResizeActionOperationData\r\n) => {\r\n const {actionInstance, actionOperationData} = operationData;\r\n operationData = mergeOperationData(operationData, actionOperationData);\r\n\r\n if (\r\n 'resize' in actionInstance &&\r\n typeof actionInstance.resize === 'function'\r\n ) {\r\n return actionInstance.resize(operationData);\r\n }\r\n\r\n return operationData;\r\n};\r\n","import {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport {\r\n type ExternalProperty,\r\n resolveExternalPropertyChain,\r\n} from './helper/resolve-external-property-chain.ts';\r\nimport type {TOperation} from './types.ts';\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 /**\r\n * @type=ParameterType:selector\r\n * @required\r\n */\r\n selector: string;\r\n useSelectedElementAsRoot?: boolean;\r\n /**\r\n * @type=ParameterType:object\r\n * @output\r\n */\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\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 as ExternalProperty\r\n ) as string;\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.ts';\r\nimport {getGlobals, type TGlobalCache} from './helper/globals.ts';\r\nimport {resolveExternalPropertyChain} from './helper/resolve-external-property-chain.ts';\r\nimport type {IOperationContext, TOperation, TOperationData} from './types.ts';\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 /**\r\n * @required\r\n */\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\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 ) as Record<string, any>;\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 type {TOperation} from './types.ts';\r\n\r\nexport interface ISetElementAttributesOperationData {\r\n /**\r\n * @required\r\n */\r\n attributes: Record<string, unknown>;\r\n /**\r\n * @dependency\r\n */\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\nexport const setElementAttributes: TOperation<\r\n ISetElementAttributesOperationData\r\n> = (operationData: ISetElementAttributesOperationData) => {\r\n const {attributes, selectedElement} = operationData;\r\n selectedElement.attr(attributes);\r\n return operationData;\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface ISetElementContentOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\r\n template: string | JQuery.Node;\r\n /**\r\n * overwite = the contents of the selected element are replaced by the given template\r\n *\r\n * append = the new content will be inserted after the current content\r\n *\r\n * prepend = the new content will be inserted before the current content\r\n */\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\nexport const setElementContent: TOperation<ISetElementContentOperationData> = (\r\n operationData: ISetElementContentOperationData\r\n) => {\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetGlobalDataOperationData {\r\n /**\r\n * @required\r\n */\r\n propertyNames: string[];\r\n}\r\n\r\n/**\r\n * This operation copies the specified properties from the operationData to the global data.\r\n */\r\nexport const setGlobalData: TOperation<\r\n ISetGlobalDataOperationData,\r\n Omit<ISetGlobalDataOperationData, 'propertyNames'>\r\n> = (operationData: ISetGlobalDataOperationData) => {\r\n const {propertyNames, ...newOperationData} = operationData;\r\n const newGlobals = Object.fromEntries(\r\n Object.entries(operationData).filter(([name, _value]) =>\r\n propertyNames.includes(name)\r\n )\r\n );\r\n\r\n setGlobals(newGlobals);\r\n\r\n return newOperationData;\r\n};\r\n","import {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetOperationData {\r\n /**\r\n * If set to true, the plucked properties replace the current operation data.\r\n */\r\n override?: boolean;\r\n /**\r\n * @required\r\n */\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\nexport const setOperationData: TOperation<\r\n ISetOperationData,\r\n Omit<ISetOperationData, 'override' | 'properties'>\r\n> = function (operationData: ISetOperationData) {\r\n const {override = false, properties, ...newOperationData} = operationData;\r\n\r\n const resolvedProperties = resolvePropertyValues(\r\n newOperationData,\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 ...newOperationData,\r\n ...resolvedProperties,\r\n };\r\n};\r\n","import {resolvePropertyValues} from './helper/resolve-property-values.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface ISetStyleOperationData {\r\n /**\r\n * @required\r\n */\r\n properties: Record<string, any>;\r\n /**\r\n * @dependency\r\n */\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\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 type {TOperation} from './types.ts';\r\n\r\nexport interface ISetVariableOperationData {\r\n /**\r\n * @required\r\n */\r\n name: string;\r\n /**\r\n * @required\r\n */\r\n value: any;\r\n}\r\n\r\n/**\r\n * This operation sets a variable with the specified name on the context with the specified value.\r\n */\r\nexport const setVariable: TOperation<ISetVariableOperationData> = function (\r\n operationData: ISetVariableOperationData\r\n) {\r\n const {name, value} = operationData;\r\n\r\n if (!this.variables) {\r\n this.variables = {};\r\n }\r\n\r\n this.variables[name] = value;\r\n\r\n return operationData;\r\n};\r\n","import type {IAction} from '../action/types.ts';\r\nimport {internalResolve} from './helper/internal-resolve.ts';\r\nimport {mergeOperationData} from './helper/merge-operation-data.ts';\r\nimport type {TOperation, TOperationData} from './types.ts';\r\n\r\nexport interface IStartActionOperationData {\r\n /**\r\n * @dependency\r\n */\r\n actionInstance: IAction;\r\n /**\r\n * @type=ParameterType:object\r\n */\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\nexport const startAction: TOperation<IStartActionOperationData> = (\r\n operationData: IStartActionOperationData\r\n) => {\r\n let {actionInstance, actionOperationData, ...newOperationData} =\r\n operationData;\r\n\r\n return new Promise((resolve, reject) => {\r\n newOperationData = mergeOperationData(\r\n newOperationData,\r\n actionOperationData\r\n );\r\n\r\n actionInstance.start(newOperationData).then(() => {\r\n Object.keys(actionOperationData).forEach(key => {\r\n delete (newOperationData as any)[key];\r\n });\r\n internalResolve(resolve, {...newOperationData, actionInstance});\r\n }, reject);\r\n });\r\n};\r\n","import type {TOperation} from './types.ts';\r\n\r\nexport interface IToggleClassOperationData {\r\n /**\r\n * The element on which the class will be toggled\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * The class that will be toggled\r\n * @type=ParameterType:className\r\n * @required\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\nexport const toggleClass: TOperation<IToggleClassOperationData> = (\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 type {TOperation} from './types.ts';\r\n\r\nexport interface IToggleElementOperationData {\r\n /**\r\n * The element whose visibility will be toggled\r\n * @dependency\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\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.ts';\r\nimport type {TOperation} from './types.ts';\r\n\r\nexport interface IWaitOperationData {\r\n /**\r\n * The amount of milliseconds the operation will wait for.\r\n * @required\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\nexport const wait: TOperation<IWaitOperationData> = (\r\n operationData: IWaitOperationData\r\n) => {\r\n const {milliseconds, ...newOperationData} = operationData;\r\n\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n internalResolve(resolve, newOperationData);\r\n }, milliseconds);\r\n });\r\n};\r\n","export {addClass} from './add-class.ts';\r\nexport {addControllerToElement} from './add-controller-to-element.ts';\r\nexport {animate} from './animate.ts';\r\nexport {animateWithClass} from './animate-with-class.ts';\r\nexport {broadcastEvent} from './broadcast-event.ts';\r\nexport {calc} from './calc.ts';\r\nexport {clearElement} from './clear-element.ts';\r\nexport {clearOperationData} from './clear-operation-data.ts';\r\nexport {createElement} from './create-element.ts';\r\nexport {customFunction} from './custom-function.ts';\r\nexport {endAction} from './end-action.ts';\r\nexport {endForEach} from './end-for-each.ts';\r\nexport {endWhen} from './end-when.ts';\r\nexport {extendController} from './extend-controller.ts';\r\nexport {forEach} from './for-each.ts';\r\nexport {getAttributesFromElement} from './get-attributes-from-element.ts';\r\nexport {getControllerFromElement} from './get-controller-from-element.ts';\r\nexport {getControllerInstance} from './get-controller-instance.ts';\r\nexport {getElementDimensions} from './get-element-dimensions.ts';\r\nexport {getImport} from './get-import.ts';\r\nexport {getQueryParams} from './get-query-params.ts';\r\nexport {invokeObjectMethod} from './invoke-object-method.ts';\r\nexport {loadJson} from './load-json.ts';\r\nexport {log} from './log.ts';\r\nexport {math} from './math.ts';\r\nexport {otherwise} from './otherwise.ts';\r\nexport {removeClass} from './remove-class.ts';\r\nexport {removeControllerFromElement} from './remove-controller-from-element.ts';\r\nexport {removeElement} from './remove-element.ts';\r\nexport {removePropertiesFromOperationData} from './remove-properties-from-operation-data.ts';\r\nexport {reparentElement} from './reparent-element.ts';\r\nexport {requestAction} from './request-action.ts';\r\nexport {resizeAction} from './resize-action.ts';\r\nexport {selectElement} from './select-element.ts';\r\nexport {setData} from './set-data.ts';\r\nexport {setElementAttributes} from './set-element-attributes.ts';\r\nexport {setElementContent} from './set-element-content.ts';\r\nexport {setGlobalData} from './set-global-data.ts';\r\nexport {setOperationData} from './set-operation-data.ts';\r\nexport {setStyle} from './set-style.ts';\r\nexport {setVariable} from './set-variable.ts';\r\nexport {startAction} from './start-action.ts';\r\nexport {toggleClass} from './toggle-class.ts';\r\nexport {toggleElement} from './toggle-element.ts';\r\nexport * from './types.ts';\r\nexport {wait} from './wait.ts';\r\nexport {when} from './when.ts';","import {v4 as uuidv4} from 'uuid';\r\nimport {deepCopy} from '../../operation/helper/deep-copy.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport type {TOperation, TOperationData} from '../../operation/types.ts';\r\nimport type {\r\n ExtractOperationDataType,\r\n GetOperationByName,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n ITimelineActionConfiguration,\r\n TOperationName,\r\n TOperationType,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\r\n\r\n/**\r\n *\r\n * Container factory capable of creating the different kinds of actions.\r\n * For each type of action a dedicated factory will be returned.\r\n *\r\n */\r\nexport class ActionCreatorFactory {\r\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\r\n\r\n /**\r\n *\r\n * Starts the creation of an action in the `actions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `initActions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `eventActions` list with the specified name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Starts the creation of an action in the `timelineActions` list with the specified name and uri\r\n *\r\n * @param uri\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Returns the fluent scope back to the `Configurationfactory`\r\n *\r\n * @returns\r\n */\r\n end() {\r\n return this.configurationfactory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in creating an action\r\n *\r\n */\r\nexport class ActionCreator<\r\n T extends IActionConfiguration = IActionConfiguration,\r\n> {\r\n actionConfig: T;\r\n\r\n /**\r\n *\r\n * Initializes an action configuration with the given name\r\n *\r\n * @param name\r\n * @param factory\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: name ?? '',\r\n id: uuidv4(),\r\n startOperations: [],\r\n } as unknown as T;\r\n }\r\n\r\n /**\r\n *\r\n * The unique id of the action\r\n *\r\n * @returns\r\n */\r\n getId() {\r\n return this.actionConfig.id;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the name of the action\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n setName(name: string) {\r\n this.actionConfig.name = name;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Returns a copy of the internal state of the `ActionCreator`\r\n *\r\n * @param callBack\r\n * @returns\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 /**\r\n *\r\n * Adds the operation data for a start operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(operationClass: T, operationData: Dt) {\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 /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: T, operationData: O) {\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 /**\r\n *\r\n * Returns the fluent scope back to the `ActionCreatorFactory`\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.factory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in creating an endable action\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 /**\r\n *\r\n * Adds the operation data for an end operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(operationClass: T, operationData: Dt) {\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] as TOperationName, operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for an end operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: TOperationName, operationData: O) {\r\n if (!operations[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\n/**\r\n *\r\n * A factory that assists in creating a timeline action\r\n *\r\n */\r\nexport class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {\r\n /**\r\n *\r\n * Sets the duration specified by the given start and optional end positions\r\n *\r\n * @param start\r\n * @param end\r\n * @returns\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 {deepCopy} from '../../operation/helper/deep-copy.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport type {TOperation, TOperationData} from '../../operation/types.ts';\r\nimport type {IDuration} from '../../types.ts';\r\nimport type {\r\n ExtractOperationDataType,\r\n GetOperationByName,\r\n IActionConfiguration,\r\n IEndableActionConfiguration,\r\n IOperationConfiguration,\r\n ITimelineActionConfiguration,\r\n TOperationName,\r\n TOperationType,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\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\n/**\r\n *\r\n * A factory that assists in editing an action\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 = structuredClone(this.actionConfig);\r\n }\r\n\r\n /**\r\n *\r\n * Returns a copy of the current internal state of the factory\r\n *\r\n * @param callBack\r\n * @returns\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 /**\r\n *\r\n * Sets the action name\r\n *\r\n * @param name\r\n * @returns\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 /**\r\n *\r\n * Gets the action name\r\n *\r\n * @returns\r\n */\r\n getName() {\r\n return this.actionConfig.name;\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addStartOperationByType<T extends TOperation<TOperationData>>(\r\n operationClass: T,\r\n operationData: Partial<ExtractOperationDataType<T>>\r\n ): OperationEditor<this, T> {\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 ) as OperationEditor<this, T>;\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @param id\r\n * @returns\r\n */\r\n addStartOperation(\r\n systemName: TOperationName,\r\n operationData: TOperationData,\r\n id: string = uuidv4()\r\n ): OperationEditor<this, TOperation<TOperationData>> {\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,\r\n systemName: systemName,\r\n operationData: operationData,\r\n } as IOperationConfiguration<TOperation<TOperationData>>;\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, TOperation<TOperationData>>(\r\n newConfig,\r\n this\r\n );\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editor for the start operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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>, TOperation<TOperationData>>(\r\n operation,\r\n this\r\n );\r\n }\r\n\r\n throw new Error(`start operation not found for id ${id}`);\r\n }\r\n\r\n /**\r\n *\r\n * Removes the start operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Moves the start operation associated with the given id in the given direction\r\n *\r\n * @param id\r\n * @param direction\r\n * @returns\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 /**\r\n *\r\n * Return the fluent scopt to the `ConfigurationFactory`\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.configurationFactory;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * A factory that assists in editing an endable action\r\n *\r\n */\r\nexport class EndableActionEditor<\r\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\r\n> extends ActionEditor<T> {\r\n /**\r\n *\r\n * Adds the operation data for a end operation specified by the given type\r\n *\r\n * @param operationClass\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperationByType<\r\n T extends TOperationType,\r\n Dt extends Partial<ExtractOperationDataType<T>>,\r\n >(\r\n operationClass: T,\r\n operationData: Dt\r\n ): OperationEditor<this, TOperationType> {\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] as TOperationName, operationData);\r\n }\r\n\r\n throw new Error(`Operation class not found: ${operationClass.toString()}`);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the operation data for a start operation specified by the given system name\r\n *\r\n * @param systemName\r\n * @param operationData\r\n * @returns\r\n */\r\n addEndOperation<\r\n T extends TOperationName,\r\n O extends Partial<ExtractOperationDataType<GetOperationByName<T>>>,\r\n >(systemName: TOperationName, operationData: O) {\r\n if (!operations[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 const operationCsl = operations[systemName];\r\n return new OperationEditor<this, typeof operationCsl>(newConfig, this);\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editor for the end operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Removes the end operation associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Moves the end operation associated with the given id in the specified direction\r\n *\r\n * @param id\r\n * @param direction\r\n * @returns\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\n/**\r\n *\r\n * A factory that assists in editing a timeline action\r\n *\r\n */\r\nexport class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {\r\n /**\r\n *\r\n * Sets the duration specified by the given start and optional end positions\r\n *\r\n * @param start\r\n * @param end\r\n * @returns\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\n/**\r\n *\r\n * A factory that assists in editing an operation\r\n *\r\n */\r\nexport class OperationEditor<\r\n T extends ActionEditor,\r\n O extends TOperationType = TOperation<TOperationData>,\r\n> {\r\n constructor(\r\n private operationConfig: IOperationConfiguration<\r\n ExtractOperationDataType<O>\r\n >,\r\n private actionEditor: T\r\n ) {}\r\n\r\n /**\r\n *\r\n * Invokes the given callback with a copy of the internal state of the factory\r\n *\r\n * @param callBack\r\n * @returns\r\n */\r\n getConfiguration(\r\n callBack: (\r\n config: IOperationConfiguration<ExtractOperationDataType<O>>\r\n ) => IOperationConfiguration<ExtractOperationDataType<O>>\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 /**\r\n *\r\n * Gets the system name\r\n *\r\n * @returns\r\n */\r\n getSystemName() {\r\n return this.operationConfig.systemName;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the system name\r\n *\r\n * @param systemName\r\n * @returns\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 /**\r\n *\r\n * Sets the operation data\r\n *\r\n * @param operationData\r\n * @returns\r\n */\r\n setOperationData(operationData: ExtractOperationDataType<O>) {\r\n this.operationConfig.operationData = operationData;\r\n this.actionEditor.updateConfiguration();\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Sets the value on the current `operationData` with the given key\r\n *\r\n * @param key\r\n * @param value\r\n * @returns\r\n */\r\n setOperationDataItem(\r\n key: keyof ExtractOperationDataType<O>,\r\n value: ExtractOperationDataType<O>[keyof ExtractOperationDataType<O>]\r\n ) {\r\n let {operationData} = this.operationConfig;\r\n if (!operationData) {\r\n operationData = {} as ExtractOperationDataType<O>;\r\n }\r\n operationData[key] = value;\r\n return this.setOperationData(operationData);\r\n }\r\n\r\n /**\r\n *\r\n * returns all of the defined property names on the current `operationData`\r\n *\r\n * @returns\r\n */\r\n getOperationDataKeys(): keyof ExtractOperationDataType<O> {\r\n const {operationData} = this.operationConfig;\r\n return (operationData\r\n ? Object.keys(operationData)\r\n : []) as unknown as keyof ExtractOperationDataType<O>;\r\n }\r\n\r\n /**\r\n *\r\n * Gets the value of the given key on the current `operationData`\r\n *\r\n * @param key\r\n * @returns\r\n */\r\n getOperationDataValue(key: keyof ExtractOperationDataType<O>) {\r\n const {operationData} = this.operationConfig;\r\n return operationData?.[key];\r\n }\r\n\r\n /**\r\n *\r\n * Returns the fluent scope back to the action editor\r\n *\r\n * @returns\r\n */\r\n next() {\r\n return this.actionEditor;\r\n }\r\n}\r\n","/**\r\n *\r\n * Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.\r\n *\r\n * This function is pure, so it returns a new instance that reflects the merging of the two objects.\r\n *\r\n * The merge is shallow.\r\n *\r\n * @param target\r\n * @param source\r\n * @returns\r\n */\r\nexport const mergeIfMissing = <\r\n Src extends Record<PropertyKey, any>,\r\n Trg extends Partial<Src> & Record<PropertyKey, any>,\r\n>(\r\n target: Src,\r\n source: Trg\r\n): Src & Trg =>\r\n Object.entries(source).reduce(\r\n (acc, [key, value]) => (key in acc ? acc : {...acc, [key]: value}),\r\n target\r\n );\r\n","import type {ILanguageLabel, TLanguageCode} from '../../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\r\n\r\n/**\r\n * Factory that assists with editing a label\r\n */\r\nexport class LabelEditor {\r\n constructor(\r\n private configurationFactory: ConfigurationFactory,\r\n private languageLabel: ILanguageLabel\r\n ) {}\r\n\r\n private _internalGetLabel(languageCode: string) {\r\n return this.languageLabel.labels.find(x => x.languageCode === languageCode);\r\n }\r\n\r\n /**\r\n *\r\n * Set the translation associated with the given language code\r\n *\r\n * @param languageCode\r\n * @param translation\r\n * @returns\r\n */\r\n setLabel(languageCode: TLanguageCode, 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 /**\r\n *\r\n * Remove all of the translations for the given language code\r\n *\r\n * @param languageCode\r\n * @returns\r\n */\r\n removeLabel(languageCode: TLanguageCode) {\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 /**\r\n *\r\n * Returns the fluent scope back to the `ConfigurationFactory`\r\n *\r\n * @returns\r\n */\r\n end() {\r\n return this.configurationFactory;\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 currentTime = document?.timeline?.currentTime;\r\n const start = currentTime ? Number(currentTime) : performance.now();\r\n\r\n const frame = (time: number) => {\r\n if (signal.aborted) return;\r\n callback(time);\r\n scheduleFrame(time);\r\n };\r\n\r\n const {round} = Math;\r\n const scheduleFrame = (time: number) => {\r\n const elapsed = time - start;\r\n const roundedElapsed = 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 $ from 'jquery';\r\nimport type {\r\n IResolvedEngineConfiguration,\r\n IResolvedTimelineConfiguration,\r\n} from '../configuration/types.ts';\r\nimport {animationInterval} from '../util/animation-interval.ts';\r\nimport type {ITimelineProvider, TPlayState} from './types.ts';\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","import $ from 'jquery';\r\nimport {v4 as uuidv4} from 'uuid';\r\nimport vjs from 'video.js';\r\nimport type {IResolvedEngineConfiguration} from '../configuration/types.ts';\r\nimport type {ITimelineProvider, TPlayState} from './types.ts';\r\n\r\nconst videojs = vjs.default ?? vjs;\r\n\r\nexport class VideoJsTimelineProvider implements ITimelineProvider {\r\n private _videoElementId: string = uuidv4();\r\n private _eventHandlers: (() => void)[] = [];\r\n\r\n private _playState: TPlayState = 'stopped';\r\n public get playState(): TPlayState {\r\n return this._playState;\r\n }\r\n loop = false;\r\n private _urls: string[] = [];\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 private _player: any | undefined;\r\n\r\n constructor(private config: IResolvedEngineConfiguration) {}\r\n\r\n init(): Promise<void> {\r\n videojs.log.level('all');\r\n\r\n const selector =\r\n this.config.timelineProviderSettings.mediaplayer?.selector ?? '';\r\n this._urls = this._extractUrls(this.config);\r\n this._addVideoElements(selector, this._urls);\r\n\r\n const self = this;\r\n\r\n const promise = new Promise<void>(resolve => {\r\n setTimeout(() => {\r\n this._player = videojs(\r\n this._videoElementId,\r\n {\r\n controls: false,\r\n controlBar: false,\r\n liveui: false,\r\n autoplay: false,\r\n preload: 'auto',\r\n loop: this.loop,\r\n src: this._urls[0],\r\n },\r\n function onPlayerReady(this: any) {\r\n this.one('firstplay', () => self._onFirstFrame?.());\r\n this.one('canplay', () => resolve());\r\n self._addPlayerListener(\r\n this,\r\n 'ended',\r\n self._handleEnded.bind(self)\r\n );\r\n self._addPlayerListener(\r\n this,\r\n 'timeupdate',\r\n self._handleTimeUpdate.bind(self)\r\n );\r\n this.load();\r\n }\r\n ); //as PlayerReadyCallback\r\n }, 0);\r\n });\r\n\r\n return promise;\r\n }\r\n\r\n private _addPlayerListener(\r\n instance: any,\r\n type: string,\r\n eventHandler: (...args: any[]) => void\r\n ) {\r\n instance.on(type, eventHandler);\r\n this._eventHandlers.push(() => instance.off(type, eventHandler));\r\n }\r\n\r\n private _handleEnded() {\r\n if (!this._player?.loop) {\r\n this._onComplete?.();\r\n } else {\r\n this._onRestart?.();\r\n }\r\n }\r\n\r\n private _handleTimeUpdate() {\r\n if (this._player) {\r\n const time = this._player.currentTime();\r\n if (time !== undefined) {\r\n this._onTime?.(time);\r\n }\r\n }\r\n }\r\n\r\n start(): void {\r\n this._player?.play();\r\n }\r\n\r\n stop(): void {\r\n this._player?.pause();\r\n this._player?.currentTime(0);\r\n }\r\n\r\n pause(): void {\r\n this._player?.pause();\r\n }\r\n\r\n seek(position: number): Promise<number> {\r\n return new Promise<number>(resolve => {\r\n (this._player as any).one('seeked', () => {\r\n resolve(this._player?.currentTime() ?? 0);\r\n });\r\n this._player?.currentTime(position);\r\n });\r\n }\r\n\r\n playlistItem(uri: string): void {\r\n if (this._urls.includes(uri)) {\r\n this._player?.selectSource([uri]);\r\n }\r\n }\r\n\r\n getPosition(): number {\r\n return this._player?.currentTime() ?? 0;\r\n }\r\n\r\n getDuration(): number {\r\n return this._player?.duration() ?? 0;\r\n }\r\n\r\n getContainer(): JQuery<HTMLElement> | undefined {\r\n const selector =\r\n this.config.timelineProviderSettings.mediaplayer?.selector ?? '';\r\n return $(selector);\r\n }\r\n\r\n destroy(): void {\r\n this._eventHandlers.forEach(remover => remover());\r\n this._eventHandlers.length = 0;\r\n }\r\n\r\n onTime(callback: (position: number) => void): void {\r\n this._onTime = callback;\r\n }\r\n\r\n onComplete(callback: () => void): void {\r\n this._onComplete = callback;\r\n }\r\n\r\n onRestart(callback: () => void): void {\r\n this._onRestart = callback;\r\n }\r\n\r\n onFirstFrame(callback: () => void): void {\r\n this._onFirstFrame = callback;\r\n }\r\n\r\n private _extractUrls(configuration: IResolvedEngineConfiguration) {\r\n const urls = configuration.timelines\r\n .filter(timeline => timeline.type === 'mediaplayer')\r\n .map(timeline => timeline.uri);\r\n return urls;\r\n }\r\n\r\n private _addVideoElements(selector: string, urls: string[]) {\r\n const videoElm = [`<video id=${this._videoElementId}>`];\r\n urls.forEach(url => {\r\n videoElm.push(\r\n `<source src='${url}' type='${this._extractFileType(url)}'/>`\r\n );\r\n });\r\n videoElm.push('</video>');\r\n $(selector).append(videoElm.join(''));\r\n }\r\n\r\n _extractFileType(url: string) {\r\n const lastIdx = url.lastIndexOf('.');\r\n return `video/${url.substring(lastIdx + 1)}`;\r\n }\r\n}\r\n","// export { MediaElementTimelineProvider } from './media-element-timeline-provider';\r\nexport {RequestAnimationFrameTimelineProvider} from './request-animation-frame-timeline-provider.ts';\r\nexport {VideoJsTimelineProvider} from './video-js-timeline-provider.ts';\r\n","import {v4 as uuidv4} from 'uuid';\r\nimport * as timelineProviders from '../../timelineproviders/index.ts';\r\nimport type {TimelineTypes} from '../../types.ts';\r\nimport type {\r\n ITimelineProviderSettings,\r\n TTimelineProviderSettings,\r\n} from '../types.ts';\r\nimport type {ConfigurationFactory} from './configuration-factory.ts';\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.ts';\r\nimport type {\r\n ILabel,\r\n ILanguageLabel,\r\n KeysOfType,\r\n TimelineTypes,\r\n TLanguageCode,\r\n} from '../../types.ts';\r\nimport { mergeIfMissing } from '../../util/merge-if-missing.ts';\r\nimport type {\r\n IActionConfiguration,\r\n IEngineConfiguration,\r\n ITimelineActionConfiguration,\r\n ITimelineConfiguration,\r\n} from '../types.ts';\r\nimport { ActionCreatorFactory } from './action-creator-factory.ts';\r\nimport {\r\n ActionEditor,\r\n EndableActionEditor,\r\n TimelineActionEditor,\r\n} from './action-editor.ts';\r\nimport { LabelEditor } from './label-editor.ts';\r\nimport { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor.ts';\r\n\r\n/** */\r\nexport type TEngineConfigurationLists = KeysOfType<IEngineConfiguration, any[]>;\r\n\r\ntype ConfigurationFactoryExtension<NewFactory extends ConfigurationFactory> = (\r\n this: NewFactory,\r\n ...rest: any[]\r\n) => void;\r\n\r\n/**\r\n * This class offers a fluent, extensible 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 \"node: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\nexport class ConfigurationFactory {\r\n actionCreatorFactory: ActionCreatorFactory;\r\n\r\n /**\r\n * Constructs a new `ConfigurationFactory`\r\n * @param config an optional existing configuration that will be used as a starting point\r\n */\r\n constructor(public configuration: IEngineConfiguration = {} as any) {\r\n this.actionCreatorFactory = new ActionCreatorFactory(this);\r\n }\r\n\r\n /**\r\n * Add specialized method to a factory\r\n *\r\n * @param factory\r\n * @param extensionMethodName\r\n * @param extensionMethod\r\n * @returns\r\n */\r\n static extend<\r\n T extends ConfigurationFactory,\r\n K extends PropertyKey,\r\n C extends (this: T & { [P in K]: C }, ...args: any[]) => any,\r\n >(factory: T, extensionMethodName: K, extensionMethod: C): T & { [P in K]: C } {\r\n return Object.defineProperty<T & { [P in K]: C }>(\r\n factory as any,\r\n extensionMethodName,\r\n {\r\n value: function (this: T & { [P in K]: C }, ...args: Parameters<C>) {\r\n return extensionMethod.apply(this, args);\r\n },\r\n writable: true,\r\n configurable: true,\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Add specialized methods to a factory\r\n *\r\n * @param factory\r\n * @param extensions\r\n * @returns\r\n */\r\n static extendMultiple<\r\n T extends ConfigurationFactory,\r\n C extends ConfigurationFactoryExtension<T>,\r\n D extends { [name: string]: C; },\r\n >(factory: T, extensions: D) {\r\n return Object.entries(extensions).reduce<T & typeof extensions>(\r\n (acc, [name, method]) =>\r\n ConfigurationFactory.extend(acc, name, method) as T & typeof extensions,\r\n factory as T & typeof extensions\r\n );\r\n }\r\n\r\n /**\r\n * Initialize the configuration with a minimal shape.\r\n *\r\n * It assigns an ID, sets the engine to `EligiusEngine`, default the containerSelector `[data-ct-container=true]`\r\n * and initializes all of the list properties with empty arrays.\r\n * @param defaultLanguage\r\n * @returns\r\n */\r\n init(defaultLanguage: TLanguageCode) {\r\n const newConfiguration: IEngineConfiguration = {\r\n id: uuidv4(),\r\n engine: {\r\n systemName: 'EligiusEngine',\r\n },\r\n containerSelector: '[data-ct-container=true]',\r\n timelineProviderSettings: {},\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 this.configuration = mergeIfMissing(this.configuration, newConfiguration);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns the engine system name\r\n * @param systemName\r\n * @returns\r\n */\r\n setEngine(systemName: string) {\r\n this.configuration.engine.systemName = systemName;\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns a string representation of the HTML layout template for the engine.\r\n *\r\n * @param layoutTemplate\r\n * @returns\r\n */\r\n setLayoutTemplate(layoutTemplate: string) {\r\n this.configuration.layoutTemplate = layoutTemplate;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Assigns the default language\r\n *\r\n * @param defaultLanguage\r\n * @returns\r\n */\r\n setDefaultLanguage(defaultLanguage: TLanguageCode) {\r\n this.configuration.language = defaultLanguage;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Assign the css selector that specifies the DOM location where the engine renders its output\r\n *\r\n * @param selector\r\n * @returns\r\n */\r\n setContainerSelector(selector: string) {\r\n this.configuration.containerSelector = selector;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Starts an editing process for the timeline provider settings.\r\n *\r\n * @returns\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 /**\r\n *\r\n * Return a copy of the current state of the configuration\r\n *\r\n * @param callBack the callback receives the configuration as well and can return a mutated version wich will be assigned to the factory's internal state\r\n * @returns\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 /**\r\n *\r\n * Adds a language to the `availableLanguages` list.\r\n * The label represents the name of the language.\r\n *\r\n * An error is thrown if a language with the given language code already exists\r\n *\r\n * @example\r\n * factory.addLanguage('en-GB', 'English');\r\n *\r\n * @param languageCode The given alnguage code\r\n * @param languageLabel The human readable name of the language\r\n * @returns\r\n */\r\n addLanguage(languageCode: TLanguageCode, languageLabel: string) {\r\n const languages = this._initializeCollection(\r\n this.configuration,\r\n 'availableLanguages'\r\n );\r\n const existing = languages.find(lang => lang.languageCode === languageCode);\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: 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 /**\r\n *\r\n * Adds the specified action to the `actions` list.\r\n *\r\n * @param action\r\n */\r\n addAction(action: IActionConfiguration) {\r\n this._internalAddAction('actions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the specified action to the `initActions` list\r\n *\r\n * @param action\r\n */\r\n addInitAction(action: IActionConfiguration) {\r\n this._internalAddAction('initActions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the specified action to the `eventActions` list\r\n *\r\n * @param action\r\n */\r\n addEventAction(action: IActionConfiguration) {\r\n this._internalAddAction('eventActions', action);\r\n }\r\n\r\n /**\r\n *\r\n * Adds the given actions to `timelineActions` list that is associated with the specified uri\r\n *\r\n * @param uri\r\n * @param action\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 /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `actions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createAction(name: string) {\r\n return this.actionCreatorFactory.createAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `initActions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createInitAction(name: string) {\r\n return this.actionCreatorFactory.createInitAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `eventActions` list\r\n *\r\n * @param name\r\n * @returns\r\n */\r\n createEventAction(name: string) {\r\n return this.actionCreatorFactory.createEventAction(name);\r\n }\r\n\r\n /**\r\n *\r\n * Starts the creation of a new action with the specified name that gets added to the `timelineActions` list that is associated with the specified uri\r\n *\r\n * @param uri\r\n * @param name\r\n * @returns\r\n */\r\n createTimelineAction(uri: string, name: string) {\r\n return this.actionCreatorFactory.createTimelineAction(uri, name);\r\n }\r\n\r\n /**\r\n * Add a timeline with the given data\r\n *\r\n * @param uri identifier for the timeline\r\n * @param type animation or mediaplayer\r\n * @param duration the duration of the timeline in seconds\r\n * @param isLooped True if the timeline should automatically restart at the end\r\n * @param selector css selector for the container where the timeline will be rendered\r\n * @returns\r\n */\r\n addTimeline(\r\n uri: string,\r\n type: TimelineTypes,\r\n duration: number,\r\n isLooped: 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: isLooped,\r\n selector: selector,\r\n timelineActions: [],\r\n };\r\n timelines.push(timelineConfig);\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Gets the timeline associated with the specified uri\r\n *\r\n * @param uri\r\n * @returns\r\n */\r\n getTimeline(uri: string) {\r\n return this.configuration.timelines.find(t => t.uri === uri);\r\n }\r\n\r\n /**\r\n *\r\n * Removes the timeline associated with the specified uri\r\n *\r\n * @param uri\r\n * @returns\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: TLanguageCode\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 /**\r\n *\r\n * Starts an editor for the label that is associated with the specified id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Adds a label translation with the specified data\r\n *\r\n * @param id The id for the label\r\n * @param languageCode The language code associated with the label\r\n * @param translation The label text in the language specified by the language code\r\n * @returns\r\n */\r\n addLabel(id: string, languageCode: TLanguageCode, 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 languageCode\r\n );\r\n labelTranslation.label = translation;\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Adds multiple translations with the specified data\r\n *\r\n * @param id The id for the label\r\n * @param translations A record that holds language code to translations lookups\r\n * @returns\r\n */\r\n addLabels(id: string, translations: Record<TLanguageCode, string>) {\r\n Object.entries(translations).forEach(([code, translation]) =>\r\n this.addLabel(id, code as TLanguageCode, translation)\r\n );\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Removes all translations with the given id\r\n *\r\n * @param id the id for the label\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `actions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `eventActions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\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 /**\r\n *\r\n * Starts an editor for the action from the `initActions` list associated with the given id\r\n *\r\n * @param id\r\n * @returns\r\n */\r\n editInitAction(id: string) {\r\n const actionConfig = this.configuration.initActions.find(a => a.id === id);\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 /**\r\n *\r\n * Starts an editor for the action from the `timelineActions` list associated with the given uri and id\r\n *\r\n * @param uri\r\n * @param id\r\n * @returns\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}\r\n","import type {IEndableAction} from '../action/types.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\ninterface IActionInstanceInfo {\r\n start: boolean;\r\n action: IEndableAction;\r\n}\r\n\r\nexport interface IEventListenerControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:eventName\r\n * @required\r\n */\r\n eventName: string;\r\n actions: string[];\r\n /**\r\n * @type=ParameterType:object\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {ILabel} from '../types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface ILabelControllerMetadata {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:labelId\r\n * @required\r\n */\r\n labelId: string;\r\n /**\r\n * By default the label is added to the inner HTML of the `selectedElement`,\r\n * otherwise if this property is set, the label text is added to the specified attribute\r\n * of the `selectedElement`.\r\n */\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 type {\r\n AnimationConfigWithData,\r\n AnimationItem,\r\n CanvasRendererConfig,\r\n HTMLRendererConfig,\r\n SVGRendererConfig,\r\n} from 'lottie-web';\r\nimport lt from 'lottie-web';\r\nimport type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nconst lottie = lt.default ?? lt;\r\n\r\nexport interface IInnerMetadata {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @type=ParameterType:string\r\n */\r\n renderer: SVGRendererConfig | CanvasRendererConfig | HTMLRendererConfig;\r\n loop: boolean;\r\n autoplay: boolean;\r\n /**\r\n * ParameterType:object\r\n */\r\n animationData: any;\r\n /**\r\n * @required\r\n */\r\n json: any;\r\n /**\r\n * @type=ParameterType:array\r\n * @itemType=ParameterType:labelId\r\n */\r\n labelIds: string[];\r\n viewBox: string;\r\n iefallback: any;\r\n}\r\n\r\nexport interface ILottieControllerMetadata extends IInnerMetadata {\r\n /**\r\n * @type=ParameterType:url\r\n * @required\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {TResultCallback} from '../types.ts';\r\nimport type {LabelController} from './label-controller.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface INavigationControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @required\r\n */\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(\r\n resultCallback: TResultCallback<{navigationData: any; title: string} | null>\r\n ) {\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface IProgressbarControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n /**\r\n * @dependency\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport type {TOperationData} from '../operation/types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface IRoutingControllerOperationData {\r\n /**\r\n * @required\r\n */\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 type {IEventbus, TEventbusRemover} from '../eventbus/types.ts';\r\nimport {TimelineEventNames} from '../timeline-event-names.ts';\r\nimport type {IStrictDuration, ISubtitleCollection} from '../types.ts';\r\nimport type {IController} from './types.ts';\r\n\r\nexport interface ISubtitlesControllerOperationData {\r\n /**\r\n * @dependency\r\n */\r\n selectedElement: JQuery;\r\n language: string;\r\n /**\r\n * @type=ParameterType:array\r\n * @itemType=ParameterType:object\r\n */\r\n subtitleData: ISubtitleCollection[];\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 subtitleDurations: IStrictDuration[] | null = null;\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 && this.lastFunc !== func) {\r\n this.lastFunc = func;\r\n func();\r\n }\r\n }\r\n\r\n onSeekedHandler(args: any[]) {\r\n const position = args[0];\r\n\r\n const duration = this.subtitleDurations?.find(\r\n x => x.start <= position || x.end >= position\r\n );\r\n\r\n const func = duration ? this.actionLookup[duration.start ?? -1] : undefined;\r\n if (func && this.lastFunc !== func) {\r\n this.lastFunc = func;\r\n func();\r\n } else if (!func) {\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(\r\n operationData: ISubtitlesControllerOperationData,\r\n container: JQuery\r\n ) {\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.languageCode] = 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.bind(\r\n this,\r\n container\r\n );\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 this.subtitleDurations = operationData.subtitleData?.[0].titles.map(\r\n x => x.duration\r\n );\r\n }\r\n}\r\n","export {EventListenerController} from './event-listener-controller.ts';\r\nexport {LabelController} from './label-controller.ts';\r\nexport {LottieController} from './lottie-controller.ts';\r\nexport {NavigationController} from './navigation-controller.ts';\r\nexport {ProgressbarController} from './progressbar-controller.ts';\r\nexport {RoutingController} from './routing-controller.ts';\r\nexport {SubtitlesController} from './subtitles-controller.ts';\r\n","import { type IAddClassOperationData } from \"../add-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addClass(): IOperationMetadata<IAddClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IAddControllerToElementOperationData } from \"../add-controller-to-element.ts\";\nimport { type TOperationData } from \"../types.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addControllerToElement(): IOperationMetadata<IAddControllerToElementOperationData<TOperationData>> {\n return {\n description: `This operation adds the specified controller instance to the given selected element.`,\n dependentProperties: ['selectedElement', 'controllerInstance'],\n };\n}\n","import { type IAddGlobalsToOperationData } from \"../add-globals-to-operation.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function addGlobalsToOperation(): IOperationMetadata<IAddGlobalsToOperationData> {\n return {\n description: `This operation adds the specified global property names to the current operation data.\nIt finally removes the \\`globalProperties\\` property from the current operation data.`,\n properties: {\n globalProperties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type IAnimateWithClassOperationData } from \"../animate-with-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function animateWithClass(): IOperationMetadata<IAnimateWithClassOperationData> {\n return {\n description: `This operation adds the specified class name to the specified selected element and assumes that this\nclass triggers and animation on the selected element. It then waits for this animation to complete\nbefore it resolves.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n },\n removeClass: {\n type: 'ParameterType:boolean',\n }\n },\n };\n}\n","import { type IAnimateOperationData } from \"../animate.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function animate(): IOperationMetadata<IAnimateOperationData> {\n return {\n description: `This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.\nIt resolves after the animation completes.`,\n dependentProperties: ['selectedElement'],\n properties: {\n animationEasing: {\n type: 'ParameterType:boolean',\n },\n animationProperties: {\n type: 'ParameterType:object',\n required: true,\n },\n animationDuration: {\n type: 'ParameterType:number',\n required: true,\n }\n },\n };\n}\n","import { type IBroadcastEventOperationData } from \"../broadcast-event.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function broadcastEvent(): IOperationMetadata<IBroadcastEventOperationData> {\n return {\n description: `This operation broadcasts the given event through the eventbus, along with the\nevent argumetns and optional event topic.`,\n properties: {\n eventArgs: {\n type: 'ParameterType:array',\n },\n eventTopic: {\n type: 'ParameterType:eventTopic',\n },\n eventName: {\n type: 'ParameterType:eventName',\n required: true,\n }\n },\n };\n}\n","import { type ICalcOperationData } from \"../calc.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function calc(): IOperationMetadata<ICalcOperationData> {\n return {\n description: `This operation calculates the given left and right hand operands using the specified operator.`,\n properties: {\n left: {\n type: 'ParameterType:number',\n required: true,\n },\n right: {\n type: 'ParameterType:number',\n required: true,\n },\n operator: {\n type: [\n { value: '+' },\n { value: '-' },\n { value: '*' },\n { value: '/' },\n { value: '%' },\n { value: '**' }\n ],\n required: true,\n }\n },\n outputProperties: {\n calculationResult: {\n type: 'ParameterType:number',\n }\n }\n };\n}\n","import { type IClearElementOperationData } from \"../clear-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function clearElement(): IOperationMetadata<IClearElementOperationData> {\n return {\n description: `This operation removes all of the children from the given selected element.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IClearOperationDataOperationData } from \"../clear-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function clearOperationData(): IOperationMetadata<IClearOperationDataOperationData> {\n return {\n description: `This operation removes all of the properties on the current operation date.\nOr, if the \\`properties\\` property is set only removes the properties defined by that list.`,\n properties: {\n properties: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n }\n },\n };\n}\n","import { type ICreateElementOperationData, type TTagNames } from \"../create-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function createElement(): IOperationMetadata<ICreateElementOperationData<TTagNames>> {\n return {\n description: `This operation creates the DOM element described by the given elementName and attributes and assigns\nthe instance to the \\`template\\` property on the current operation data.`,\n properties: {\n elementName: {\n type: [\n { value: 'object' },\n { value: 'a' },\n { value: 'abbr' },\n { value: 'address' },\n { value: 'area' },\n { value: 'article' },\n { value: 'aside' },\n { value: 'audio' },\n { value: 'b' },\n { value: 'base' },\n { value: 'bdi' },\n { value: 'bdo' },\n { value: 'blockquote' },\n { value: 'body' },\n { value: 'br' },\n { value: 'button' },\n { value: 'canvas' },\n { value: 'caption' },\n { value: 'cite' },\n { value: 'code' },\n { value: 'col' },\n { value: 'colgroup' },\n { value: 'data' },\n { value: 'datalist' },\n { value: 'dd' },\n { value: 'del' },\n { value: 'details' },\n { value: 'dfn' },\n { value: 'dialog' },\n { value: 'div' },\n { value: 'dl' },\n { value: 'dt' },\n { value: 'em' },\n { value: 'embed' },\n { value: 'fieldset' },\n { value: 'figcaption' },\n { value: 'figure' },\n { value: 'footer' },\n { value: 'form' },\n { value: 'h1' },\n { value: 'h2' },\n { value: 'h3' },\n { value: 'h4' },\n { value: 'h5' },\n { value: 'h6' },\n { value: 'head' },\n { value: 'header' },\n { value: 'hgroup' },\n { value: 'hr' },\n { value: 'html' },\n { value: 'i' },\n { value: 'iframe' },\n { value: 'img' },\n { value: 'input' },\n { value: 'ins' },\n { value: 'kbd' },\n { value: 'label' },\n { value: 'legend' },\n { value: 'li' },\n { value: 'link' },\n { value: 'main' },\n { value: 'map' },\n { value: 'mark' },\n { value: 'menu' },\n { value: 'meta' },\n { value: 'meter' },\n { value: 'nav' },\n { value: 'noscript' },\n { value: 'ol' },\n { value: 'optgroup' },\n { value: 'option' },\n { value: 'output' },\n { value: 'p' },\n { value: 'picture' },\n { value: 'pre' },\n { value: 'progress' },\n { value: 'q' },\n { value: 'rp' },\n { value: 'rt' },\n { value: 'ruby' },\n { value: 's' },\n { value: 'samp' },\n { value: 'script' },\n { value: 'search' },\n { value: 'section' },\n { value: 'select' },\n { value: 'slot' },\n { value: 'small' },\n { value: 'source' },\n { value: 'span' },\n { value: 'strong' },\n { value: 'style' },\n { value: 'sub' },\n { value: 'summary' },\n { value: 'sup' },\n { value: 'table' },\n { value: 'tbody' },\n { value: 'td' },\n { value: 'template' },\n { value: 'textarea' },\n { value: 'tfoot' },\n { value: 'th' },\n { value: 'thead' },\n { value: 'time' },\n { value: 'title' },\n { value: 'tr' },\n { value: 'track' },\n { value: 'u' },\n { value: 'ul' },\n { value: 'var' },\n { value: 'video' },\n { value: 'wbr' }\n ],\n required: true,\n },\n text: {\n type: 'ParameterType:string',\n },\n attributes: {\n type: 'ParameterType:object',\n }\n },\n outputProperties: {\n template: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type ICustomFunctionOperationData } from \"../custom-function.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function customFunction(): IOperationMetadata<ICustomFunctionOperationData> {\n return {\n description: `This operation retrieves a custom function defined by the given system name\nand invokes it with the current operation data and eventbus.`,\n properties: {\n systemName: {\n type: 'ParameterType:string',\n }\n },\n };\n}\n","import { type IEndActionOperationData } from \"../end-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function endAction(): IOperationMetadata<IEndActionOperationData> {\n return {\n description: `This operation invokes the {@link EndableAction}.end method on the specified action instance.\n\nThe action operation data is first merged with the current operation data before it is\npassed on to the action. After the action has completed the action operation data properties\nare removed from the current operation data.`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function endForEach(): IOperationMetadata<undefined> {\n return {\n description: `This operation checks if the current loop should end or start the next iteration.`,\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function endWhen(): IOperationMetadata<undefined> {\n return {\n description: `This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.`,\n };\n}\n","import { type IExtendControllerOperationData } from \"../extend-controller.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function extendController(): IOperationMetadata<IExtendControllerOperationData> {\n return {\n description: `Extends the current controller with given extension.`,\n dependentProperties: ['controllerInstance'],\n properties: {\n controllerExtension: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IForEachOperationData } from \"../for-each.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function forEach(): IOperationMetadata<IForEachOperationData> {\n return {\n description: `This operation iterates over the given collection.\n\nEach iteration the current item from the specified collection is\nassigned to the {@link IOperationContext.currentItem} property on the operation context.\n\nAt the start of the loop, the associated {@link endForEach} operation is determined and when\nthe last iteration is completed the flow control is set to the index of that operation.`,\n properties: {\n collection: {\n type: 'ParameterType:array|string',\n required: true,\n }\n },\n };\n}\n","import { type IGetAttributesFromElementOperationData } from \"../get-attributes-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getAttributesFromElement(): IOperationMetadata<IGetAttributesFromElementOperationData> {\n return {\n description: `This operation retrieves the values for the specified attribute names from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributeNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n }\n },\n outputProperties: {\n attributeValues: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetControllerFromElementOperationData } from \"../get-controller-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getControllerFromElement(): IOperationMetadata<IGetControllerFromElementOperationData> {\n return {\n description: `This operation retrieves the controller instance with the specified name that is assigned to the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n required: true,\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetControllerInstanceOperationData } from \"../get-controller-instance.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getControllerInstance(): IOperationMetadata<IGetControllerInstanceOperationData> {\n return {\n description: `This operation retrieves an instance of the given controller name.\nIt assigns this instance to the \\`controllerInstance\\` property on the current operation data`,\n properties: {\n systemName: {\n type: [\n { value: 'EventListenerController' },\n { value: 'LabelController' },\n { value: 'LottieController' },\n { value: 'NavigationController' },\n { value: 'ProgressbarController' },\n { value: 'RoutingController' },\n { value: 'SubtitlesController' }\n ],\n required: true,\n }\n },\n outputProperties: {\n controllerInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetElementDimensionsOperationData } from \"../get-element-dimensions.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getElementDimensions(): IOperationMetadata<IGetElementDimensionsOperationData> {\n return {\n description: `This operation calculates the width and height of the given selected element.\nIt assigns this struct to the dimensions property on the current operation data.\nOptionally the width and height can be modified using the given modifier string.\n\nThe modifier string is formatted in the following way:\n\n<operator><amount><optional-side><optional-precentage>|<ratio-definition>\n\nWhere the ratio modifier is formatted in the following way:\n<side>[ar=<ratio-left>-<ratio-right>]\n\nFor example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:\nit will add a value of 100 to the height and modify the width by a ratio of 8 to 1 relative to the height.`,\n dependentProperties: ['selectedElement'],\n properties: {\n modifier: {\n type: 'ParameterType:dimensionsModifier',\n }\n },\n outputProperties: {\n dimensions: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetImportOperationData } from \"../get-import.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getImport(): IOperationMetadata<IGetImportOperationData> {\n return {\n description: `This operation retrieves the import specified by the given \\`systemName\\` and\nassigns it to the \\`importedInstance\\` property on the current operaton date.`,\n properties: {\n systemName: {\n type: 'ParameterType:systemName',\n required: true,\n }\n },\n outputProperties: {\n importedInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IGetQueryParamsOperationData } from \"../get-query-params.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData> {\n return {\n description: `This operation retrieves the current query parameters from the browser's address bar and places\nthem on the returned operation data.`,\n properties: {\n defaultValues: {\n type: 'ParameterType:object',\n }\n },\n outputProperties: {\n queryParams: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IInvokeObjectMethodOperationData } from \"../invoke-object-method.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData> {\n return {\n description: `This operation invokes the specified method on the given object with the given optional arguments\nand assigns the result to the \\`methodResult\\` operationdata property.`,\n properties: {\n instance: {\n type: 'ParameterType:object',\n },\n methodName: {\n type: 'ParameterType:string',\n },\n methodArguments: {\n type: 'ParameterType:array',\n },\n methodResult: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type ILoadJSONOperationData } from \"../load-json.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function loadJson(): IOperationMetadata<ILoadJSONOperationData> {\n return {\n description: `This operation loads a JSON file from the specified url and assigns it to the json\nproperty on the current operation data.\n\nIf the cache property is set to true and a cached value already exists, this is assigned\ninstead of re-retrieving it from the url.`,\n properties: {\n url: {\n type: 'ParameterType:string',\n required: true,\n },\n cache: {\n type: 'ParameterType:boolean',\n }\n },\n outputProperties: {\n json: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function log(): IOperationMetadata<undefined> {\n return {\n description: `This operation logs the current operation data, global data and context to the console.`,\n };\n}\n","import { type IMathOperationData } from \"../math.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function math(): IOperationMetadata<IMathOperationData> {\n return {\n description: `This operation performs the given math function with the specified arguments.`,\n properties: {\n args: {\n type: 'ParameterType:array',\n required: true,\n },\n functionName: {\n type: [\n { value: 'abs' },\n { value: 'acos' },\n { value: 'asin' },\n { value: 'atan' },\n { value: 'atan2' },\n { value: 'ceil' },\n { value: 'cos' },\n { value: 'exp' },\n { value: 'floor' },\n { value: 'log' },\n { value: 'max' },\n { value: 'min' },\n { value: 'pow' },\n { value: 'random' },\n { value: 'round' },\n { value: 'sin' },\n { value: 'sqrt' },\n { value: 'tan' },\n { value: 'clz32' },\n { value: 'imul' },\n { value: 'sign' },\n { value: 'log10' },\n { value: 'log2' },\n { value: 'log1p' },\n { value: 'expm1' },\n { value: 'cosh' },\n { value: 'sinh' },\n { value: 'tanh' },\n { value: 'acosh' },\n { value: 'asinh' },\n { value: 'atanh' },\n { value: 'hypot' },\n { value: 'trunc' },\n { value: 'fround' },\n { value: 'cbrt' },\n { value: 'f16round' }\n ],\n required: true,\n }\n },\n outputProperties: {\n mathResult: {\n type: 'ParameterType:number',\n }\n }\n };\n}\n","import { type IOperationMetadata } from \"./types.ts\";\n\nexport function otherwise(): IOperationMetadata<undefined> {\n return {\n description: `If the preceeding {@link when} operation evaluates to \\`true\\` subsequent operations will\nbe skipped until an {@link endWhen} operation is encountered.`,\n };\n}\n","import { type IRemoveClassOperationData } from \"../remove-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeClass(): IOperationMetadata<IRemoveClassOperationData> {\n return {\n description: `This operation removes the spcified class name from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IRemoveControllerFromElementOperationData } from \"../remove-controller-from-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeControllerFromElement(): IOperationMetadata<IRemoveControllerFromElementOperationData> {\n return {\n description: `This operation removes the controller with the specified name from the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n controllerName: {\n type: 'ParameterType:controllerName',\n }\n },\n };\n}\n","import { type IRemoveElementOperationData } from \"../remove-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removeElement(): IOperationMetadata<IRemoveElementOperationData> {\n return {\n description: `This operation removes the given selected element from the DOM.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IRemovePropertiesFromOperationDataOperationData } from \"../remove-properties-from-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function removePropertiesFromOperationData(): IOperationMetadata<IRemovePropertiesFromOperationDataOperationData> {\n return {\n description: `This operation removes the given list of properties from the current operation data.\nIt will also remove the property \\`propertyNames\\` from the result.`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type IReparentElementOperationData } from \"../reparent-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function reparentElement(): IOperationMetadata<IReparentElementOperationData> {\n return {\n description: `This operation moves the given selected element to the new parent that is defined\nby the specified \\`newParentSelector\\`.`,\n dependentProperties: ['selectedElement'],\n properties: {\n newParentSelector: {\n type: 'ParameterType:selector',\n required: true,\n }\n },\n };\n}\n","import { type IRequestActionOperationData } from \"../request-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function requestAction(): IOperationMetadata<IRequestActionOperationData> {\n return {\n description: `This operation requests an action instance with the specified name and assigns it\nto the \\`actionInstance\\` property on the current operation data.`,\n properties: {\n systemName: {\n type: 'ParameterType:actionName',\n required: true,\n }\n },\n outputProperties: {\n actionInstance: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type IResizeActionOperationData } from \"../resize-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function resizeAction(): IOperationMetadata<IResizeActionOperationData> {\n return {\n description: ``,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type ISelectElementOperationData } from \"../select-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function selectElement(): IOperationMetadata<ISelectElementOperationData> {\n return {\n description: `This operation selects one or more elements using the specified selector.\n\nIf \\`useSelectedElementAsRoot\\` is set to true and a valid DOM element is assigned\nto the current operation data's \\`selectedElement\\` property\nthen the element will be looked for only in the descendant elements of this DOM element.`,\n properties: {\n selector: {\n type: 'ParameterType:selector',\n required: true,\n },\n useSelectedElementAsRoot: {\n type: 'ParameterType:boolean',\n }\n },\n outputProperties: {\n selectedElement: {\n type: 'ParameterType:object',\n }\n }\n };\n}\n","import { type ISetDataOperationData } from \"../set-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setData(): IOperationMetadata<ISetDataOperationData> {\n return {\n description: `This operation assigns the specified properties to the specified data targets.`,\n properties: {\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetElementAttributesOperationData } from \"../set-element-attributes.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setElementAttributes(): IOperationMetadata<ISetElementAttributesOperationData> {\n return {\n description: `This operation sets the specified set of attributes on the given selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n attributes: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetElementContentOperationData } from \"../set-element-content.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setElementContent(): IOperationMetadata<ISetElementContentOperationData> {\n return {\n description: `This operation sets the specified content defined by the value assigned to the template property\nto the given selected element.\n\nWhen the \\`insertionType\\` is set to \\`overwrite\\` the contents of the selected element are replaced\nby the given template.\nWhen set to \\`append\\` the new content will be inserted after the current content.\nWhen set to \\`prepend\\` the new content will be inserted before the current content.`,\n dependentProperties: ['selectedElement', 'template'],\n properties: {\n insertionType: {\n type: [\n { value: 'overwrite' },\n { value: 'append' },\n { value: 'prepend' }\n ],\n }\n },\n };\n}\n","import { type ISetGlobalDataOperationData } from \"../set-global-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setGlobalData(): IOperationMetadata<ISetGlobalDataOperationData> {\n return {\n description: `This operation copies the specified properties from the operationData to the global data.`,\n properties: {\n propertyNames: {\n type: 'ParameterType:array',\n itemType: 'ParameterType:string',\n required: true,\n }\n },\n };\n}\n","import { type ISetOperationData } from \"../set-operation-data.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setOperationData(): IOperationMetadata<ISetOperationData> {\n return {\n description: `This operation assigns the specified properties to the current operation data.\nWhen override is set to true the properties replace the current operation data entirely.`,\n properties: {\n override: {\n type: 'ParameterType:boolean',\n },\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetStyleOperationData } from \"../set-style.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setStyle(): IOperationMetadata<ISetStyleOperationData> {\n return {\n description: `This operation assigns the specified CSS style properties to the\ngiven selected element.`,\n dependentProperties: ['selectedElement'],\n properties: {\n properties: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type ISetVariableOperationData } from \"../set-variable.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function setVariable(): IOperationMetadata<ISetVariableOperationData> {\n return {\n description: `This operation sets a variable with the specified name on the context with the specified value.`,\n properties: {\n name: {\n type: 'ParameterType:string',\n required: true,\n },\n value: {\n type: 'ParameterType:object',\n required: true,\n }\n },\n };\n}\n","import { type IStartActionOperationData } from \"../start-action.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function startAction(): IOperationMetadata<IStartActionOperationData> {\n return {\n description: `This operation starts the specified action instance using the given action operation data.\n\nThe action operation data is first merged with the current operation data before it is\npassed on to the action. After the action has completed the action operation data properties\nare removed from the current operation data.`,\n dependentProperties: ['actionInstance'],\n properties: {\n actionOperationData: {\n type: 'ParameterType:object',\n }\n },\n };\n}\n","import { type IToggleClassOperationData } from \"../toggle-class.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function toggleClass(): IOperationMetadata<IToggleClassOperationData> {\n return {\n description: `This operation toggles the specfied class name on the given selected element.\n\nMeaning, if the specified class name exists on the given element it will be removed,\notherwise it will be added.`,\n dependentProperties: ['selectedElement'],\n properties: {\n className: {\n type: 'ParameterType:className',\n required: true,\n }\n },\n };\n}\n","import { type IToggleElementOperationData } from \"../toggle-element.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function toggleElement(): IOperationMetadata<IToggleElementOperationData> {\n return {\n description: `This operation toggles the visibility of the given selected element.\n\nMeaning, if the element is hidden, it will be made visible, otherwise\nit will be hidden.`,\n dependentProperties: ['selectedElement'],\n };\n}\n","import { type IWaitOperationData } from \"../wait.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function wait(): IOperationMetadata<IWaitOperationData> {\n return {\n description: `This operation waits for the specified amount of milliseconds.`,\n properties: {\n milliseconds: {\n type: 'ParameterType:number',\n required: true,\n }\n },\n };\n}\n","import { type IWhenOperationData } from \"../when.ts\";\nimport { type IOperationMetadata } from \"./types.ts\";\n\nexport function when(): IOperationMetadata<IWhenOperationData> {\n return {\n description: `When the given expression evaluates to false, subsequent operations will be skipped\nuntil an {@link endWhen} or {@link otherwise} operation is encountered.\n\nPractically, this means an \\`if\\` or \\`if\\`/\\`else\\` statement control flow implementation in a list of operations.\n\nThe expression is passed in as a formatted string.\nThe left and right values of the expression can be defined like this:\n\n'constant': for a constant string\n100: for a constant number\noperationData.foo: for an operation data value\nglobaldata.foo: for a global data value\ncontext.loopIndex: for a context value`,\n properties: {\n expression: {\n type: 'ParameterType:expression',\n required: true,\n }\n },\n };\n}\n","export { addClass } from \"./add-class.ts\";\nexport { addControllerToElement } from \"./add-controller-to-element.ts\";\nexport { addGlobalsToOperation } from \"./add-globals-to-operation.ts\";\nexport { animateWithClass } from \"./animate-with-class.ts\";\nexport { animate } from \"./animate.ts\";\nexport { broadcastEvent } from \"./broadcast-event.ts\";\nexport { calc } from \"./calc.ts\";\nexport { clearElement } from \"./clear-element.ts\";\nexport { clearOperationData } from \"./clear-operation-data.ts\";\nexport { createElement } from \"./create-element.ts\";\nexport { customFunction } from \"./custom-function.ts\";\nexport { endAction } from \"./end-action.ts\";\nexport { endForEach } from \"./end-for-each.ts\";\nexport { endWhen } from \"./end-when.ts\";\nexport { extendController } from \"./extend-controller.ts\";\nexport { forEach } from \"./for-each.ts\";\nexport { getAttributesFromElement } from \"./get-attributes-from-element.ts\";\nexport { getControllerFromElement } from \"./get-controller-from-element.ts\";\nexport { getControllerInstance } from \"./get-controller-instance.ts\";\nexport { getElementDimensions } from \"./get-element-dimensions.ts\";\nexport { getImport } from \"./get-import.ts\";\nexport { getQueryParams } from \"./get-query-params.ts\";\nexport { invokeObjectMethod } from \"./invoke-object-method.ts\";\nexport { loadJson } from \"./load-json.ts\";\nexport { log } from \"./log.ts\";\nexport { math } from \"./math.ts\";\nexport { otherwise } from \"./otherwise.ts\";\nexport { removeClass } from \"./remove-class.ts\";\nexport { removeControllerFromElement } from \"./remove-controller-from-element.ts\";\nexport { removeElement } from \"./remove-element.ts\";\nexport { removePropertiesFromOperationData } from \"./remove-properties-from-operation-data.ts\";\nexport { reparentElement } from \"./reparent-element.ts\";\nexport { requestAction } from \"./request-action.ts\";\nexport { resizeAction } from \"./resize-action.ts\";\nexport { selectElement } from \"./select-element.ts\";\nexport { setData } from \"./set-data.ts\";\nexport { setElementAttributes } from \"./set-element-attributes.ts\";\nexport { setElementContent } from \"./set-element-content.ts\";\nexport { setGlobalData } from \"./set-global-data.ts\";\nexport { setOperationData } from \"./set-operation-data.ts\";\nexport { setStyle } from \"./set-style.ts\";\nexport { setVariable } from \"./set-variable.ts\";\nexport { startAction } from \"./start-action.ts\";\nexport { toggleClass } from \"./toggle-class.ts\";\nexport { toggleElement } from \"./toggle-element.ts\";\nexport { wait } from \"./wait.ts\";\nexport { when } from \"./when.ts\";\nexport * from \"./types.ts\";\n","import type {TControllerName, TOperationName} from 'configuration/types.ts';\r\nimport * as controllers from '../../controllers/index.ts';\r\nimport * as operations from '../../operation/index.ts';\r\nimport * as operationMetadata from '../../operation/metadata/index.ts';\r\nimport type {IOperationMetadata} from '../../operation/metadata/types.ts';\r\nimport {\r\n type TimelineEventName,\r\n TimelineEventNames,\r\n} from '../../timeline-event-names.ts';\r\n\r\n/**\r\n *\r\n * Provider for all the available operation names\r\n *\r\n */\r\nexport class OperationNamesProvider {\r\n getOperationNames(): TOperationName {\r\n return Object.keys(operations) as unknown as TOperationName;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * Provider for all the available controller names\r\n *\r\n */\r\nexport class ControllerNamesProvider {\r\n getControllerNames(): TControllerName {\r\n return Object.keys(controllers) as unknown as TControllerName;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * Provider that can retrieve the metadata associated with a given operation name\r\n *\r\n */\r\nexport class OperationMetadataProvider {\r\n getOperationMetadata(operationName: TOperationName) {\r\n const getMetadata = (\r\n operationMetadata as Record<\r\n TOperationName,\r\n () => IOperationMetadata<operations.TOperationData>\r\n >\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\n/**\r\n *\r\n * Provider for all the available event names\r\n *\r\n */\r\nexport class TimeLineEventNamesProvider {\r\n getEventNames() {\r\n return Object.values(TimelineEventNames) as unknown as TimelineEventName;\r\n }\r\n}\r\n","import type {IStrictDuration, ISubtitle} from '../../types.ts';\r\n\r\n/**\r\n * This class converts an AVID subtitle file to an `ISubtitle` array.\r\n */\r\nexport class SubtitleImporter {\r\n importSubtitles(rawLines: string[]): ISubtitle[] {\r\n const result: ISubtitle[] = [];\r\n const lines: string[] = [];\r\n for (let i: number = 0, l: number = rawLines.length; i < l; i++) {\r\n const rawLine: string = this.stripNewlineChars(rawLines[i].toString());\r\n if (this.isValidLine(rawLine)) {\r\n lines.push(rawLine);\r\n }\r\n }\r\n if (lines[0] === '') {\r\n lines.splice(0, 1);\r\n }\r\n while (lines[lines.length - 1] === '') {\r\n lines.pop();\r\n }\r\n let caption: Partial<ISubtitle> | null = null;\r\n lines.forEach((line: string) => {\r\n if (line.length === 0 || !caption) {\r\n caption = {text: ''};\r\n if (line.length) {\r\n //this happens for first caption only\r\n caption.duration = this.convertDuration(line);\r\n }\r\n result.push(caption as ISubtitle);\r\n } else {\r\n if (!Object.hasOwn(caption, 'duration')) {\r\n caption.duration = this.convertDuration(line);\r\n } else {\r\n caption.text += line;\r\n }\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n stripNewlineChars(str: string): string {\r\n let res: string = '';\r\n for (let i: number = 0, l: number = str.length; i < l; i++) {\r\n if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {\r\n res += str.charAt(i);\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n isValidLine(line: string): boolean {\r\n return (\r\n !line.startsWith('@') &&\r\n !line.startsWith('<begin subtitles>') &&\r\n !line.startsWith('<end subtitles>')\r\n );\r\n }\r\n\r\n convertDuration(time: string): IStrictDuration {\r\n const times: string[] = time.split(' ');\r\n return {\r\n start: this.convertTimeToSeconds(times[0]),\r\n end: this.convertTimeToSeconds(times[1]),\r\n };\r\n }\r\n\r\n convertTimeToSeconds(time: string): number {\r\n const parts: string[] = time.split(':');\r\n return (\r\n parseInt(parts[0], 10) * 3600 +\r\n parseInt(parts[1], 10) * 60 +\r\n parseInt(parts[2], 10)\r\n );\r\n }\r\n}\r\n","import {v4 as uuidv4} from 'uuid';\r\nimport type {\r\n IStrictDuration,\r\n ISubtitle,\r\n ISubtitleCollection,\r\n TLanguageCode,\r\n} from '../../types.ts';\r\n\r\n/**\r\n * Used to edit and add to an {@link ISubtitleCollection}.\r\n */\r\nexport class SubtitleEditor {\r\n constructor(private collection: ISubtitleCollection[] = []) {}\r\n\r\n private _getLanguage(languageCode: string) {\r\n return this.collection.find(x => x.languageCode === languageCode);\r\n }\r\n\r\n /**\r\n * Adds a new {@link ISubtitleCollection} for the given `languageCode`.\r\n *\r\n * If collections already exist for existing language codes then a duplicate\r\n * of these collections is created with the same duration info but all of the\r\n * text is left empty.\r\n *\r\n * @param languageCode\r\n * @returns\r\n */\r\n addLanguage(languageCode: TLanguageCode) {\r\n const language = this._getLanguage(languageCode);\r\n if (language) {\r\n throw new Error(`Language ${languageCode} already exists.`);\r\n }\r\n const newLanguage: ISubtitleCollection = this.collection.length\r\n ? {\r\n ...this.collection[0],\r\n languageCode,\r\n titles: this.collection[0].titles.map(x => ({\r\n id: uuidv4(),\r\n duration: {...x.duration},\r\n text: '',\r\n })),\r\n }\r\n : {\r\n languageCode,\r\n titles: [],\r\n };\r\n this.collection.push(newLanguage);\r\n return this;\r\n }\r\n\r\n /**\r\n *\r\n * Add a single subtitle line that is associated with the given `languageCode`\r\n *\r\n * @param languageCode\r\n * @param subtitle\r\n * @returns\r\n */\r\n addSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\r\n const language = this._getLanguage(languageCode);\r\n if (!language) {\r\n throw new Error(`Language ${languageCode} does not exist.`);\r\n }\r\n language.titles.push(subtitle);\r\n return this;\r\n }\r\n\r\n addSubtitles(\r\n duration: IStrictDuration,\r\n subtitles: Record<TLanguageCode, string>\r\n ) {\r\n Object.entries(subtitles).forEach(([languageCode, subtitle]) =>\r\n this.addSubtitle(languageCode as TLanguageCode, {\r\n id: uuidv4(),\r\n duration: {...duration},\r\n text: subtitle,\r\n })\r\n );\r\n return this;\r\n }\r\n\r\n setSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\r\n const language = this._getLanguage(languageCode);\r\n if (!language) {\r\n throw new Error(`Language ${languageCode} does not exist.`);\r\n }\r\n\r\n const titleIdx = language.titles.findIndex(x => x.id === subtitle.id);\r\n if (titleIdx < 0) {\r\n throw new Error(\r\n `Subtitle with id '${subtitle.id}' was not found in language with code ${languageCode}.`\r\n );\r\n }\r\n\r\n language.titles[titleIdx] = {\r\n ...subtitle,\r\n duration: {...subtitle.duration},\r\n };\r\n return this;\r\n }\r\n\r\n export() {\r\n return this.collection;\r\n }\r\n}\r\n","import {getPropertyChainValue} from './get-property-chain-value.ts';\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\nexport function resolvePropertyChain(propertyChain: string, sourceObject: any) {\r\n const properties = propertyChain.split('.');\r\n return getPropertyChainValue(properties, sourceObject);\r\n}\r\n","import type {TOperationData} from 'operation/types.ts';\r\nimport {isDefined} from 'ts-is-present';\r\nimport {Action, EndableAction, TimelineAction} from '../action/index.ts';\r\nimport type {IAction} from '../action/types.ts';\r\nimport type {ActionRegistryEventbusListener} from '../eventbus/index.ts';\r\nimport type {IEventbus} from '../eventbus/types.ts';\r\nimport {deepCopy} from '../operation/helper/deep-copy.ts';\r\nimport {resolvePropertyChain} from '../operation/helper/resolve-property-chain.ts';\r\nimport type {\r\n IConfigurationResolver,\r\n ISimpleResourceImporter,\r\n} from '../types.ts';\r\nimport {isObject} from '../util/guards/is-object.ts';\r\nimport {isString} from '../util/guards/is-string.ts';\r\nimport type {\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.ts';\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<TOperationData>\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, index) => {\r\n resolvePlaceholders(item, rootConfig, importer);\r\n });\r\n } else if (isObject(configFragment)) {\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: PropertyKey,\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) || Array.isArray(configValue)) {\r\n resolvePlaceholders(configValue, rootConfig, importer);\r\n }\r\n}\r\n","import $ from 'jquery';\r\nimport type {IEndableAction, ITimelineAction} from './action/types.ts';\r\nimport type {IResolvedEngineConfiguration} from './configuration/types.ts';\r\nimport type {\r\n IEventbus,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './eventbus/types.ts';\r\nimport type {LanguageManager} from './language-manager.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {ITimelineProvider} from './timelineproviders/types.ts';\r\nimport type {\r\n IEligiusEngine,\r\n ITimelineProviderInfo,\r\n TimelineTypes,\r\n TResultCallback,\r\n} from './types.ts';\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(position: number) {\r\n if (!this._activeTimelineProvider) {\r\n return;\r\n }\r\n const seekPosition = Math.floor(position);\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<number | undefined>) {\r\n callBack(this._activeTimelineProvider?.getDuration());\r\n }\r\n\r\n private containerRequest(\r\n callBack: TResultCallback<JQuery<HTMLElement> | undefined>\r\n ) {\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.pause();\r\n } else {\r\n this._activeTimelineProvider.start();\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 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<JQuery<HTMLElement>>\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<number>\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<string>) {\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};\r\n","import type {IAction} from '../action/types.ts';\r\nimport type {IEventbusListener} from './types.ts';\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 type {\r\n IEventbus,\r\n IEventbusInterceptor,\r\n IEventbusListener,\r\n TEventbusRemover,\r\n TEventHandler,\r\n} from './types.ts';\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.ts';\r\nimport type {IEventbus, IEventbusInterceptor} from './types.ts';\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","export {ActionRegistryEventbusListener} from './actionregistry-eventbus-listener.ts';\r\nexport {Eventbus} from './eventbus.ts';\r\nexport {RequestVideoUriInterceptor} from './request-video-uri-interceptor.ts';\r\nexport * from './types.ts';\r\n","import {getGlobals} from './globals.ts';\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 $ from 'jquery';\r\nimport type {IEventbus, TEventbusRemover} from './eventbus/types.ts';\r\nimport {setGlobal} from './operation/helper/set-global.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {\r\n ILabel,\r\n ILanguageLabel,\r\n TLanguageCode,\r\n TResultCallback,\r\n} from './types.ts';\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: TLanguageCode,\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(\r\n resultCallback: TResultCallback<TLanguageCode>\r\n ) {\r\n resultCallback(this._currentLanguage);\r\n }\r\n\r\n _handleRequestLabelCollection(\r\n labelId: string,\r\n resultCallback: TResultCallback<ILabel[]>\r\n ) {\r\n resultCallback(this._labelLookup[labelId]);\r\n }\r\n\r\n _handleRequestLabelCollections(\r\n labelIds: string[],\r\n resultCallback: TResultCallback<ILabel[][]>\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: TLanguageCode) {\r\n this._currentLanguage = language;\r\n this._setRootElementLang(this._currentLanguage);\r\n }\r\n\r\n _setRootElementLang(language: TLanguageCode) {\r\n const callBack = (rootSelector: string) => {\r\n const lang = this._extractPrimaryLanguage(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 _extractPrimaryLanguage(culture: TLanguageCode) {\r\n return culture.split('-').shift() as string;\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 hk, {type HotkeysEvent} from 'hotkeys-js';\r\nimport $ from 'jquery';\r\nimport type {IAction} from './action/types.ts';\r\nimport {ConfigurationResolver} from './configuration/configuration-resolver.ts';\r\nimport type {\r\n IEngineConfiguration,\r\n IResolvedEngineConfiguration,\r\n} from './configuration/types.ts';\r\nimport {DevToolEventListener} from './diagnostics/devtool-event-listener.ts';\r\nimport {Diagnostics} from './diagnostics/diagnostics.ts';\r\nimport {\r\n DEV_TOOLS_KEY,\r\n type TDiagnosticType,\r\n type TWindowWithDevtools,\r\n} from './diagnostics/types.ts';\r\nimport {\r\n ActionRegistryEventbusListener,\r\n Eventbus,\r\n type IEventbus,\r\n RequestVideoUriInterceptor,\r\n type TEventbusRemover,\r\n} from './eventbus/index.ts';\r\nimport {LanguageManager} from './language-manager.ts';\r\nimport {TimelineEventNames} from './timeline-event-names.ts';\r\nimport type {\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.ts';\r\nimport {prepareValueForSerialization} from './util/prepare-value-for-serialization.ts';\r\n\r\nconst hotkeys = hk.default || hk;\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<any>\r\n ) {\r\n resultCallback(this._importSystemEntryWithEventbusDependency(systemName));\r\n }\r\n\r\n private _requestFunctionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback<any>\r\n ) {\r\n resultCallback(this._importSystemEntry(systemName));\r\n }\r\n\r\n private _requestActionHandler(\r\n systemName: string,\r\n resultCallback: TResultCallback<IAction | null>\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 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 >(\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 },\r\n {} as Record<TimelineTypes, ITimelineProviderInfo>\r\n );\r\n\r\n return result;\r\n }\r\n}\r\n","import * as ctrls from '../controllers/index.ts';\r\nimport {EligiusEngine} from '../eligius-engine.ts';\r\nimport * as evtb from '../eventbus/index.ts';\r\nimport * as ops from '../operation/index.ts';\r\nimport type {TOperation} from '../operation/types.ts';\r\nimport * as prvdrs from '../timelineproviders/index.ts';\r\nimport type {IResourceImporter} from '../types.ts';\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"],"mappings":";;;;;;;;;;;AAAA,SAAgB,WAAW,OAA2C;AACpE,QAAO,OAAO,UAAU;;;;;ACD1B,SAAgB,SACd,OACuC;AACvC,QAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;;;;ACCtE,SAAgB,6BAA6B,OAAqB;AAChE,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAQ,MAAqB,IAAI,6BAA6B;UACrD,iBAAiBA,EAC1B,QAAO;UACE,SAAS,MAAM,EAAE;AAC1B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