"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../common/helpers.js");const LooxReviews=({setting:e,advanced:t})=>{let{widgetType:s,showAllReviews:o,showRatingWidgetAllReviews:a,version:r,appBlockId:i,align:l}=e??{},d=e=>{switch(s){case"reviews_widget":return{id:"looxReviews","data-product-id":e,...o?{"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"===r?helpers.getLiquidForAppBlock(i,l,t?.cssClass):core.template`
    <script defer strategy="lazyOnload" src="${"//loox.io/widget/loox.js?shop={{ request.host }}"}"></script>
    <div
      class="${t?.cssClass}"
      style="${{...core.makeStyleResponsive("ta",e?.align)}}"
    >
      {% if '${s}' == "rating_widget"  %}
        {% if '${a}' == '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 ${{...d("{{ product.id }}")}}></div>
          </a>
        {% endif %}
      {% else %}
        <div ${{...d("{{ product.id }}")}}></div>
      {% endif %}
    </div>
  `};exports.default=LooxReviews;
