'use strict' ; import type Chart from '../Chart/Chart' ; import type Series from './Series.js' ; import type SeriesOptions from './SeriesOptions' ; import type { SeriesTypeOptions , SeriesTypeRegistry } from './SeriesType' ; import H from '../Globals.js' ; import D from '../DefaultOptions.js' ; const { defaultOptions } = D ; import Point from './Point.js' ; import U from '../Utilities.js' ; const { error , extendClass , merge } = U ; namespace SeriesRegistry { internal export let series ; internal todo export const seriesTypes = H . seriesTypes ; private export function getSeries ( chart , options = { } ) { const optionsChart = chart . options . chart , type = ( options . type || optionsChart . type || optionsChart . defaultSeriesType || '' ) , SeriesClass = seriesTypes [ type ] as any ; if ( ! SeriesRegistry ) { error ( 17 , true , chart as any , { missingModuleFor : type } ) ; } const series = new SeriesClass ( ) ; if ( typeof series . init === 'function' ) { series . init ( chart , options ) ; } return series ; } private export function registerSeriesType ( seriesType , seriesClass ) { const defaultPlotOptions = defaultOptions . plotOptions || { } , seriesOptions = ( seriesClass as any ) . defaultOptions ; if ( ! seriesClass . prototype . pointClass ) { seriesClass . prototype . pointClass = Point ; } seriesClass . prototype . type = seriesType ; if ( seriesOptions ) { defaultPlotOptions [ seriesType ] = seriesOptions ; } seriesTypes [ seriesType ] = seriesClass ; } deprecated function param { string } type param { string } parent The parent series type name. Use `line` to inherit from the basic
     *  Series object.
     *
     *  param { Highcharts . SeriesOptionsType | Highcharts . Dictionary < * > } options param { Highcharts . Dictionary < * > } props param { Highcharts . Dictionary < * > } pointProps Members for a series-specific extension of the  Point prototype if
     * needed.
     *
     *  return { Highcharts . Series } * The newly created prototype as extended from  Series or its
     * derivatives.
      export function seriesType < T extends typeof Series > ( type , parent , options , seriesProto ? , pointProto ? ) { const defaultPlotOptions = defaultOptions . plotOptions || { } ; parent = parent || '' ; defaultPlotOptions [ type ] = merge ( defaultPlotOptions [ parent ] , options ) ; registerSeriesType ( type , extendClass ( seriesTypes [ parent ] as any || function ( ) : void { } , seriesProto ) as any ) ; seriesTypes [ type ] . prototype . type = type ; if ( pointProto ) { seriesTypes [ type ] . prototype . pointClass = extendClass ( Point , pointProto ) as any ; } return seriesTypes [ type ] as unknown as T ; } } export default SeriesRegistry ;