import type { PluginFactory, Plugins } from '../../packages/artplayer/public/runtime/plugin' import type { IconName, Icons, Template } from '../../packages/artplayer/public/runtime/template' import type Artplayer from '../../packages/artplayer/src' import type iconDefaults from '../../packages/artplayer/src/icons/defaults' declare const source: Artplayer const plugins: Plugins = source.plugins const sync: Plugins = plugins.add(function (art) { // eslint-disable-next-line ts/no-this-alias -- Check the public factory's inferred receiver against the actual source instance. const same: Artplayer = this return { name: 'sync', same, art } }) const asyncRegistry: Promise> = plugins.add(async () => ({ name: 'async' })) declare const unknownFactory: PluginFactory const uncertain: Plugins | Promise> = plugins.add(unknownFactory) const template: Template = source.template const icons: Icons = source.icons const icon: HTMLElement = icons.play const customIcon: HTMLElement | undefined = icons.custom const subtitle: HTMLDivElement | null = template.$subtitle const query: HTMLVideoElement | null = template.query('video') // @ts-expect-error Sync registration is not a Promise. const syncPromise: Promise> = plugins.add(() => ({ name: 'plain' })) // @ts-expect-error Template.html belongs to the constructor, not its instance. const instanceHtml = template.html // @ts-expect-error Icon wrappers are not promised to be div elements. const div: HTMLDivElement = icons.play // @ts-expect-error Missing custom icon keys require a presence guard. const present: HTMLElement = icons.custom type Assert = Condition type AllIcons = Assert extends never ? true : false> type NoInventedIcons = Assert extends never ? true : false> export type { AllIcons, NoInventedIcons } export { asyncRegistry, customIcon, div, icon, instanceHtml, present, query, subtitle, sync, syncPromise, uncertain }