{{ $params := . }}

{{ $class := $params.class | default "paige-video ratio ratio-16x9" }}
{{ $fullscreen := $params.fullscreen }}
{{ $height := $params.height }}
{{ $maxHeight := $params.maxheight }}
{{ $maxWidth := $params.maxwidth }}
{{ $policy := $params.referrerpolicy | default "no-referrer" }}
{{ $src := $params.src }}
{{ $title := $params.title }}
{{ $width := $params.width }}

{{ $styles := slice }}

{{ if $height }}
    {{ $styles = $styles | append (print "height: " $height) }}
{{ end }}

{{ if $maxHeight }}
    {{ $styles = $styles | append (print "max-height: " $maxHeight) }}
{{ end }}

{{ if $maxWidth }}
    {{ $styles = $styles | append (print "max-width: " $maxWidth) }}
{{ end }}

{{ if $width }}
    {{ $styles = $styles | append (print "width: " $width) }}
{{ end }}

{{ $styles = delimit $styles "; " }}

<div class="{{ $class }}" {{ with $styles }} style="{{ . | safeCSS }}" {{ end }}>
    {{ partial "paige/tag-iframe.html" (dict
        "fullscreen" $fullscreen
        "referrerpolicy" $policy
        "src" $src
        "title" $title
    ) }}
</div>
