import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";import{filterPageContext as n}from"../../../helpers.js";let ProductListItem=o=>{let{pageContext:a,children:r}=o,{productItemClass:i,gpProductClass:c}=e(o);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 | default: 0 }},  "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(n(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>
          ${r}
        {%- endform -%}
      </gp-product>
  `};export{ProductListItem as default};
