{% set container_type = container_type|default('container mx-auto') %}

{% set grid_cols = grid_cols|default(12) %}
{% set grid_cols_2xl = grid_cols_2xl|default(12) %}
{% set grid_cols_xl = grid_cols_xl|default(12) %}
{% set grid_cols_lg = grid_cols_lg|default(12) %}
{% set grid_cols_md = grid_cols_md|default(12) %}
{% set grid_cols_sm = grid_cols_sm|default(12) %}
{% set gap = gap|default(0) %}
{% set gap_2xl = gap_2xl|default(4) %}
{% set gap_xl = gap_xl|default(4) %}
{% set gap_lg = gap_lg|default(4) %}
{% set gap_md = gap_md|default(2) %}
{% set gap_sm = gap_sm|default(0) %}
{% set grid_classes = ['grid', 'gap-4' , gap ? 'gap-' ~ gap, gap_2xl ? '2xl:gap-' ~ gap_2xl, gap_xl ? 'xl:gap-' ~ gap_xl, gap_lg ? 'lg:gap-' ~ gap_lg, gap_md ? 'md:gap-' ~ gap_md, gap_sm ? 'sm:gap-' ~ gap_sm, grid_cols ? 'grid-cols-' ~ grid_cols, grid_cols_2xl ? '2xl:grid-cols-' ~ grid_cols_2xl, grid_cols_xl ? 'xl:grid-cols-' ~ grid_cols_xl, grid_cols_lg ? 'lg:grid-cols-' ~ grid_cols_lg, grid_cols_md ? 'md:grid-cols-' ~ grid_cols_md, grid_cols_sm ? 'sm:grid-cols-' ~ grid_cols_sm] %}
{% set grid_classes_attributes = create_attribute().addClass(grid_classes) %}

{% set col_span = col_span|default([12, 12, 12, 12]) %}
{% set col_span_2xl = col_span_2xl|default([3, 3, 3, 3]) %}
{% set col_span_xl = col_span_xl|default([3, 3, 3, 3]) %}
{% set col_span_lg = col_span_lg|default([3, 3, 3, 3]) %}
{% set col_span_md = col_span_md|default([6, 6, 6, 6]) %}
{% set col_span_sm = col_span_sm|default([12, 12, 12, 12]) %}
{% set col_first_classes = [col_span[0] ? 'col-span-' ~ col_span[0], col_start[0] ? 'col-start-' ~ col_start[0], col_end[0] ? 'col-end-' ~ col_end[0], col_span_2xl[0] ? '2xl:col-span-' ~ col_span_2xl[0], col_start_2xl[0] ? '2xl:col-start-' ~ col_start_2xl[0], col_end_2xl[0] ? '2xl:col-end-' ~ col_end_2xl[0], col_span_xl[0] ? 'xl:col-span-' ~ col_span_xl[0], col_start_xl[0] ? 'xl:col-start-' ~ col_start_xl[0], col_end_xl[0] ? 'xl:col-end-' ~ col_end_xl[0], col_span_lg[0] ? 'lg:col-span-' ~ col_span_lg[0], col_start_lg[0] ? 'lg:col-start-' ~ col_start_lg[0], col_end_lg[0] ? 'lg:col-end-' ~ col_end_lg[0], col_span_md[0] ? 'md:col-span-' ~ col_span_md[0], col_start_md[0] ? 'md:col-start-' ~ col_start_md[0], col_end_md[0] ? 'md:col-end-' ~ col_end_md[0], col_span_sm[0] ? 'sm:col-span-' ~ col_span_sm[0], col_start_sm[0] ? 'sm:col-start-' ~ col_start_sm[0], col_end_sm[0] ? 'sm:col-end-' ~ col_end_sm[0]] %}
{% set col_first_attributes = create_attribute().addClass(col_first_classes) %}
{% set col_second_classes = [col_span[1] ? 'col-span-' ~ col_span[1], col_start[1] ? 'col-start-' ~ col_start[1], col_end[1] ? 'col-end-' ~ col_end[1], col_span_2xl[1] ? '2xl:col-span-' ~ col_span_2xl[1], col_start_2xl[1] ? '2xl:col-start-' ~ col_start_2xl[1], col_end_2xl[1] ? '2xl:col-end-' ~ col_end_2xl[1], col_span_xl[1] ? 'xl:col-span-' ~ col_span_xl[1], col_start_xl[1] ? 'xl:col-start-' ~ col_start_xl[1], col_end_xl[1] ? 'xl:col-end-' ~ col_end_xl[1], col_span_lg[1] ? 'lg:col-span-' ~ col_span_lg[1], col_start_lg[1] ? 'lg:col-start-' ~ col_start_lg[1], col_end_lg[1] ? 'lg:col-end-' ~ col_end_lg[1], col_span_md[1] ? 'md:col-span-' ~ col_span_md[1], col_start_md[1] ? 'md:col-start-' ~ col_start_md[1], col_end_md[1] ? 'md:col-end-' ~ col_end_md[1], col_span_sm[1] ? 'sm:col-span-' ~ col_span_sm[1], col_start_sm[1] ? 'sm:col-start-' ~ col_start_sm[1], col_end_sm[1] ? 'sm:col-end-' ~ col_end_sm[1]] %}
{% set col_second_attributes = create_attribute().addClass(col_second_classes) %}
{% set col_third_classes = [col_span[2] ? 'col-span-' ~ col_span[2], col_start[2] ? 'col-start-' ~ col_start[2], col_end[2] ? 'col-end-' ~ col_end[2], col_span_2xl[2] ? '2xl:col-span-' ~ col_span_2xl[2], col_start_2xl[2] ? '2xl:col-start-' ~ col_start_2xl[2], col_end_2xl[2] ? '2xl:col-end-' ~ col_end_2xl[2], col_span_xl[2] ? 'xl:col-span-' ~ col_span_xl[2], col_start_xl[2] ? 'xl:col-start-' ~ col_start_xl[2], col_end_xl[2] ? 'xl:col-end-' ~ col_end_xl[2], col_span_lg[2] ? 'lg:col-span-' ~ col_span_lg[2], col_start_lg[2] ? 'lg:col-start-' ~ col_start_lg[2], col_end_lg[2] ? 'lg:col-end-' ~ col_end_lg[2], col_span_md[2] ? 'md:col-span-' ~ col_span_md[2], col_start_md[2] ? 'md:col-start-' ~ col_start_md[2], col_end_md[2] ? 'md:col-end-' ~ col_end_md[2], col_span_sm[2] ? 'sm:col-span-' ~ col_span_sm[2], col_start_sm[2] ? 'sm:col-start-' ~ col_start_sm[2], col_end_sm[2] ? 'sm:col-end-' ~ col_end_sm[2]] %}
{% set col_third_attributes = create_attribute().addClass(col_third_classes) %}
{% set col_fourth_classes = [col_span[3] ? 'col-span-' ~ col_span[3], col_start[3] ? 'col-start-' ~ col_start[3], col_end[3] ? 'col-end-' ~ col_end[3], col_span_2xl[3] ? '2xl:col-span-' ~ col_span_2xl[3], col_start_2xl[3] ? '2xl:col-start-' ~ col_start_2xl[3], col_end_2xl[3] ? '2xl:col-end-' ~ col_end_2xl[3], col_span_xl[3] ? 'xl:col-span-' ~ col_span_xl[3], col_start_xl[3] ? 'xl:col-start-' ~ col_start_xl[3], col_end_xl[3] ? 'xl:col-end-' ~ col_end_xl[3], col_span_lg[3] ? 'lg:col-span-' ~ col_span_lg[3], col_start_lg[3] ? 'lg:col-start-' ~ col_start_lg[3], col_end_lg[3] ? 'lg:col-end-' ~ col_end_lg[3], col_span_md[3] ? 'md:col-span-' ~ col_span_md[3], col_start_md[3] ? 'md:col-start-' ~ col_start_md[3], col_end_md[3] ? 'md:col-end-' ~ col_end_md[3], col_span_sm[3] ? 'sm:col-span-' ~ col_span_sm[3], col_start_sm[3] ? 'sm:col-start-' ~ col_start_sm[3], col_end_sm[3] ? 'sm:col-end-' ~ col_end_sm[3]] %}
{% set col_fourth_attributes = create_attribute().addClass(col_fourth_classes) %}

{% set attributes = attributes.addClass(background_size, background_position, background_repeat) %}

{% if background_image %}
  {% set attributes = attributes.setAttribute('style', 'background-image: url(' ~ background_image ~ ')') %}
{% endif %}

<section {{ attributes.addClass(container_type != 'bg-breakout' ? grid_classes, container_type) }} >
{% if container_type == 'bg-breakout' %}
  <div {{ grid_classes_attributes.addClass('container', 'mx-auto') }} >
{% endif %}
  <div {{ col_first_attributes }}>
    {{ col_first }}
  </div>
  <div  {{ col_second_attributes }}>
    {{ col_second }}
  </div>
  <div  {{ col_third_attributes }}>
    {{ col_third }}
  </div>
  <div  {{ col_fourth_attributes }}>
    {{ col_fourth }}
  </div>
{% if container_type == 'bg-breakout' %}
  </div>
{% endif %}
</section>
