<%# locals: (ad_method:, div_id:, adsense_slot:, ea_div_id: nil, skip_ea: false, fallback_ea: false) %>

<% if ad_method&.show_ads? %>
  <div class="ad <%= ad_method.css_class %>" id="<%= div_id %>">
    <div class="ad-content">
      <% if ad_method.ga? %>
        <ins class="adsbygoogle"
             style="display:block; text-align:center;"
             data-ad-layout="in-article"
             data-ad-format="fluid"
             data-ad-client="ca-pub-2247465624637408"
             data-ad-slot="<%= adsense_slot %>"></ins>
        <script>
          (adsbygoogle = window.adsbygoogle || []).push({});
        </script>
      <% elsif ad_method.ea? & !skip_ea %>
        <div id="<%= ea_div_id %>_image<%= "_#{ad_method.variant}" if ad_method.variant %>" class="flat ethical-ads adaptive" data-ea-publisher="greasyfork" data-ea-type="image" data-ea-priority="1"></div>
        <div id="<%= ea_div_id %>_large<%= "_#{ad_method.variant}" if ad_method.variant %>" class="flat ethical-ads adaptive" data-ea-publisher="greasyfork" data-ea-type="logo-large-v1" data-ea-priority="10"></div>
      <% end %>
    </div>
  </div>

  <% if ad_method.ga? & !skip_ea && fallback_ea %>
    <%= render(partial: 'shared/ea_fallback', locals: { div_id:, ea_div_id: })%>
  <% end %>
<% end %>
