"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),a=require("../../../image/components/NextImage.liquid.js"),i=require("./common/productFeaturedImage.js"),t=require("./common/helpers.js"),d=require("../../../image/components/Modal3d.liquid.js"),s=require("../../../image/components/Video.liquid.js");exports.default=({...r})=>{let l=i.getFeatureImageAspectRatio(r.ftCustomAspectRadio,r.ftAspectRatio),o=r?.clickEffect!==void 0&&r?.clickEffect=="link",f=o?"a":"div",u=()=>s.default({src:"{{mediaSourceVideo}}",alt:"{{mediaVideoAlt}}",autoplay:!0,allowfullscreen:!0,controls:!0,style:{width:"100%",height:"100%"}}),n=i=>e.template`
    ${a.default({src:`{%- if variant.featured_image != null -%}
              {{ variant.featured_image.src | img_url: '1024x1024'}}
            {%- elsif variant.featured_image == null -%}
              {{ featureMedia.src | img_url: '1024x1024'}}
            {%- else -%}
              {{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}
            {%- endif -%}`,id:`{%- if variant.featured_image != null -%}
              {{variant.featured_image.id}}
           {%- elsif variant.featured_image == null -%}
              {{featureMedia.id}}
            {%- endif -%}`,width:`{%- if variant.featured_image != null -%}
                {{variant.featured_image.width}}
              {%- elsif variant.featured_image == null -%}
                {{featureMedia.width}}
              {%- endif -%}`,height:`{%- if variant.featured_image != null -%}
                {{variant.featured_image.height}}
              {%- elsif variant.featured_image == null -%}
                {{featureMedia.height}}
              {%- endif -%}`,alt:`{%- if variant.featured_image != null -%}
              {{variant.featured_image.alt}}
            {%- elsif variant.featured_image == null -%}
              {{featureMedia.alt | escape}}
            {%- endif -%}`,setting:{layout:r?.ftLayout,aspectRatio:l},priority:!0,className:`gp-w-full featured-image-only ${i}`})}`;return e.template`<div
  class="featured-image-root gp-product-images-ft gp-flex"
  style="${{...i.getStyleFeatureImageJustify(r.position),...t.getDisplayStyle(a=>!!r?.featureImageVisible&&!e.getResponsiveValueByScreen(r?.featureImageVisible,a),"flex"),...i.getStyleFeaturedImageWidth(r)}}"
>
  <${f} ${{...o?{href:"#"}:{role:"presentation"}}}
    media-type="{{product.featured_media.media_type}}"
    class="featured-image-wrapper ${e.cls("gp-relative gp-flex gp-w-full",{"gp-overflow-hidden":r?.zoomType!=="glasses"})}"
    style="${{...e.makeStyleResponsive("aspect",l)}}"
  >
  <div class="gp-flex gp-w-full gp-items-start gp-justify-center">
    <div class="featured-image gp-group gp-relative gp-w-full gp-h-full gp-overflow-hidden gp-flex gp-items-center gp-justify-center">
      {% assign hasModel3d = false %}
      {% assign hasImage = false %}
      {% assign hasVideo = false %}
      {% assign mediaSourcesModel = null %}
      {% assign mediaSourceVideo = null %}
      {% assign mediaVideoAlt = null %}

      {% for media in product.media %}
        {% if media.media_type == 'model' %}
          {% assign hasModel3d = true %}
          {% assign mediaSourcesModel = media.sources %}
        {% endif %}
      {% if media.media_type == 'video' %}
        {% assign hasVideo = true %}
        {% assign mediaSourceVideo = media.sources.last.url %}
        {% assign mediaVideoAlt = media.alt %}
      {% endif %}
      {% if media.media_type == 'external_video' %}
        {% assign hasVideo = true %}
        {% assign mediaSourceVideo = media | external_video_url %}
        {% assign mediaVideoAlt = media.alt %}
      {% endif %}
      {% if media.media_type == 'image' %}
        {% assign hasImage = true %}
      {% endif %}
    {% endfor %}

    {% if hasModel3d == true %}
      <script type="module" defer="defer" src="https://cdn.shopify.com/shopifycloud/model-viewer/v1.12/model-viewer.js"></script>
    {% endif %}

    ${`
    {% assign featureMedia = product.media.first %}
    {%- assign variant = product.selected_or_first_available_variant -%}
    {% assign shouldHidden = '' %}
    {% if featureMedia.media_type == 'model' %}
      ${d.default({src:"{{featureMedia.sources.first.url}}",alt:"{{featureMedia.preview_image.alt}}",poster:"{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}",cameraControls:!0,dataShopifyFeature:"1.12",arStatus:"not-presenting",style:{width:"100%",height:"100%"}})}
    {% endif %}
    {% if featureMedia.media_type == 'video' %}
      ${u()}
    {% endif %}
    {% if featureMedia.media_type == 'external_video' %}
      ${u()}
    {% endif %}
    {% if featureMedia.media_type != 'image' %}
      {% assign shouldHidden = 'hidden' %}
    {% endif %}
    ${n(e.cls("gp-w-full gp-transition-opacity",{"group-hover:gp-opacity-0":"other"==r.hoverEffect},"{{shouldHidden}}"))}
    ${r?.hoverEffect!=="none"?`<div class="${e.cls("zoom-element !gp-max-w-none",i.getZoomImageClass())}">
          ${n("image-zoom")}
        </div>`:""}
    ${r?.hoverEffect=="zoom"&&r?.zoomType=="glasses"?`
    <div class="${e.cls("zoom-lens-element",i.getZoomLenClass())}"
    style="opacity: 0; background-image: url('{{ product.featured_image.src | img_url: "1024x1024"}}')"></div>`:""}
    `}
    </div>
  </div>
  </${f}>
</div>`};
