import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=n(o),d=()=>t`
      ${r?.map((n,o)=>{if(n)return t`
            ${e({...n,index:o})}
          `}).join("")}
    `;return t`
      <gp-product
        gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape  }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }},  "formId": "{{ product_form_id }}"}'
        gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(a)}}'
        class="${c}"

      >
        {%- form 'product', product, id: product_form_id, class: 'form contents ${i}',  data-type: 'add-to-cart-form', autocomplete: 'off' -%}
        <input type="hidden" name="id" value="{{ variant.id }}" />
        <input type="hidden" min="1" name="quantity"  value="{{ quantity }}" />
        <button type="submit" onclick="return false;" style="display:none;"></button>
          ${d()}
        {%- endform -%}
      </gp-product>
  `};export{ProductListItem as default};
