import{template as t,makeStyleResponsive as s}from"@gem-sdk/core";import{getSettingPreloadData as e}from"../../helpers.js";import{getLiquidForAppBlock as i}from"../common/helpers.js";let Trustoo=({setting:d,advanced:a})=>{let{widgetType:r,align:o,version:c,appBlockId:l}=d??{},p=d?.productSetting?.productId?.replace("gid://shopify/Product/","")??"{{product.id}}",n=d?.productSetting?.productTitle??"{{product.title}}",u=d?.productSetting?.productImage??"{{product.images[0]}}",g={"review-widget":`
    {% if request.page_type == "product" %}
      <div style="display:block" id="seal-review-widget"></div>
    {% else %}
      <div style="display:block" class="custom-vstar-review-widget" data-product-id="${p}" data-product-title="${n}" data-product-image="${u}"></div>
    {% endif %}
    `,"star-rating-widget":'<div class="custom-vstar-rating-widget" data-product-id="{{product.id}}"></div>',"text-carousel":'<div id="trustoo-text-carousel" style="display:block;max-width:1200px;margin:0 auto" data-type="block"></div>',"barrage-carousel":'<div id="trustoo-barrage-carousel" style="display:block;max-width:1200px;margin:0 auto" data-type="block"></div>',"card-carousel":'<div id="trustoo-card-carousel-widget" style="display:block;max-width:1200px;margin:0 auto"></div>',"photo-carousel":'<div id="trustoo-photo-carousel" style="display:block;max-width:1200px;margin:0 auto" data-type="block"></div>'},v=()=>"v2"===c?i(l,o,a?.cssClass):t`
    <div>
      {% if '${r}' == 'starRatingInList' %}
        {% if request.page_type != 'product' %}
          <div class="custom-vstar-rating-widget" product-id="{{ product.id }}"></div>
        {% else %}
          <div class="custom-vstar-rating-widget" data-product-id="{{ product.id }}" style="width:100%"></div>
        {% endif %}
      {% else %}
        <span id="seal_shop_id" style="display: none">{{ shop.id }}</span>
        <span id="seal_product_id" style="display: none">{{ product.id }}</span>
        <span id="seal_product" style="display: none">{{ product | json | escape }}</span>
        {% assign widget = '${r}' %}
        {% case widget %}
          {% when "starRating" %}
            <div id="seal-star-rating-widget" data-star-size="16" data-font-size="14" class="vstar-star"></div>
            <script ${e('class="gps-link" delay',"src")}="https://cdn.shopify.com/extensions/da25a851-7e4c-4ab7-9a2d-0b3d699025b5/trustoo-product-ali-reviews-7/assets/star-rating-widget.min.js" defer="defer"></script>
          {% when "reviews" %}
            <div id="seal-review-widget"></div>
            <link ${e('class="gps-link" delay',"href")}="https://cdn.shopify.com/extensions/0519f63f-61ca-467d-975d-a60b2cc82088/7.3.0/assets/star-rating.css" rel="stylesheet" type="text/css" media="all">
        {% endcase %}
      {% endif %}
    </div>
  `;return c?v():t`
  <div
    class="${a?.cssClass}"
    style="${{...s("ta",o)}}"
  >
    ${r&&g?.[r]}
    <script ${e('class="gps-link" delay',"src")}="https://cdn.vstar.app/static/dist/js/swiper-reviews.min.js" defer="defer"></script>
    <link ${e('class="gps-link" delay',"href")}="https://cdn.vstar.app/static/css/swiper-reviews.min.css" rel="stylesheet" type="text/css" media="all">
  </div>
  `};export{Trustoo as default};
