"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../common/helpers.js");exports.default=({setting:s,advanced:a})=>{let{widgetType:o,showAllReviews:i,showRatingWidgetAllReviews:r,version:d,appBlockId:l,align:c}=s??{},g=e=>{switch(o){case"reviews_widget":return{id:"looxReviews","data-product-id":e,...i?{"data-loox-aggregate":"true"}:{}};case"rating_widget":return{class:"loox-rating","data-id":e,"data-fetch":"","data-rating":"{{ product.metafields.loox.avg_rating }}","data-raters":"{{ product.metafields.loox.num_reviews }}"};case"carousel_widget":return{id:"looxCarousel","data-show-more":"true"}}};return"v2"===d?t.getLiquidForAppBlock(l,c,a?.cssClass):e.template`
    <script defer strategy="lazyOnload" src="${"//loox.io/widget/loox.js?shop={{ request.host }}"}"></script>
    <div
      class="${a?.cssClass}"
      style="${{...e.makeStyleResponsive("ta",s?.align)}}"
    >
      {% if '${o}' == "rating_widget"  %}
        {% if '${r}' == 'true' %}
          {% if shop.metafields.loox["global_stats"]  %}
            {% assign looxstats = shop.metafields.loox["global_stats"] | split: ',' %}
            <a href="#looxReviews">
              <div class="loox-rating" data-rating="{{ looxstats[0] }}" data-raters="{{ looxstats[1] }}"></div>
            </a>
          {% endif %}
        {% else %}
          <a href="#looxReviews">
            <div ${{...g("{{ product.id }}")}}></div>
          </a>
        {% endif %}
      {% else %}
        <div ${{...g("{{ product.id }}")}}></div>
      {% endif %}
    </div>
  `};
