prototype(Carbon.Image:Helper.ImageSource) < prototype(Neos.Fusion:Component) {
    @propTypes {
        image = ${PropTypes.anyOf(PropTypes.instanceOf('Neos\\Media\\Domain\\Model\\ImageInterface'), PropTypes.instanceof('\\Sitegeist\\Kaleidoscope\\Domain\\ImageSourceInterface'), PropTypes.string)}
        package = ${PropTypes.string}
        dummyText = ${PropTypes.string}
        thumbnailPreset = ${PropTypes.string}
        variantPreset = ${PropTypes.string}
        format = ${PropTypes.string}
        width = ${PropTypes.float}
        height = ${PropTypes.float}
        quality = ${PropTypes.float}
        outputDummy = ${PropTypes.boolean}
        forceDummy = ${PropTypes.boolean}
        dummyForgroundColor = ${PropTypes.string}
        dummyBackgroundColor = ${PropTypes.string}
        dummyBaseWidth = ${PropTypes.float}
        dummyBaseHeight = ${PropTypes.float}
    }

    outputDummy = ${node.context.inBackend}
    forceDummy = ${Configuration.Setting('Carbon.Image.dummy.force')}
    dummyForgroundColor = ${Configuration.Setting('Carbon.Image.dummy.forgroundColor')}
    dummyForgroundColor.@process.toString = ${String.toString(value)}
    dummyBackgroundColor = ${Configuration.Setting('Carbon.Image.dummy.backgroundColor')}
    dummyBackgroundColor.@process.toString = ${String.toString(value)}
    dummyBaseWidth = 600
    dummyBaseHeight = 400

    @if.hasImageOrOutputDummy = ${this.image || this.outputDummy || this.forceDummy}

    renderer = Neos.Fusion:Case {
        forceDummy {
            condition = ${props.forceDummy}
            renderer = Sitegeist.Kaleidoscope:DummyImageSource {
                text = ${props.dummyText}
                foregroundColor = ${props.dummyForgroundColor || 'fff'}
                backgroundColor = ${props.dummyBackgroundColor || '999'}
                thumbnailPreset = ${props.thumbnailPreset}
                variantPreset = ${props.variantPreset}
                format = ${props.format}
                baseWidth = ${props.dummyBaseWidth}
                baseHeight = ${props.dummyBaseHeight}
                width = ${props.width}
                height = ${props.height}
            }
        }
        isAsset {
            condition = ${props.image && Type.instance(props.image, 'Neos\\Media\\Domain\\Model\\ImageInterface')}
            renderer = Sitegeist.Kaleidoscope:AssetImageSource {
                asset = ${props.image}
                thumbnailPreset = ${props.thumbnailPreset}
                variantPreset = ${props.variantPreset}
                format = ${props.format}
                width = ${props.width}
                height = ${props.height}
                quality = ${props.quality}
            }
        }
        isImageSource {
            condition = ${props.image && Type.instance(props.image, '\\Sitegeist\\Kaleidoscope\\Domain\\ImageSourceInterface')}
            renderer = ${props.image}
            renderer.@process {
                thumbnailPreset = ${props.thumbnailPreset ? value.withThumbnailPreset(props.thumbnailPreset) : value}
                variantPreset = ${props.variantPreset ? value.withVariantPreset(props.variantPreset) : value}
                format = ${props.format ? value.withFormat(props.format) : value}
                width = ${props.width ? value.withWidth(props.width) : value}
                height = ${props.height ? value.withHeight(props.height) : value}
                quality = ${props.quality ? value.withQuality(props.quality) : value}
            }
        }
        isResource {
            condition = ${Type.isString(props.image) && (String.startsWith(props.image, 'resource') || props.package)}
            renderer = Sitegeist.Kaleidoscope:ResourceImageSource {
                package = ${props.package}
                path = ${props.image}
            }
        }
        isLink {
            condition = ${Type.isString(props.image) && String.startsWith(props.image, 'http')}
            renderer = Sitegeist.Kaleidoscope:UriImageSource {
                uri = ${props.image}
            }
        }
        needDummyImage {
            condition = ${props.outputDummy}
            renderer = Sitegeist.Kaleidoscope:DummyImageSource {
                text = ${props.dummyText}
                foregroundColor = ${props.dummyForgroundColor || 'fff'}
                backgroundColor = ${props.dummyBackgroundColor || '999'}
                thumbnailPreset = ${props.thumbnailPreset}
                variantPreset = ${props.variantPreset}
                format = ${props.format}
                baseWidth = ${props.dummyBaseWidth}
                baseHeight = ${props.dummyBaseHeight}
                width = ${props.width}
                height = ${props.height}
            }
        }
    }
}
