import{If as e,LiquidIf as i,LiquidFor as t,Liquid as o}from"@gem-sdk/system";import{getStaticLocale as a}from"../../../../../../helpers.js";let renderCombineVariants=(t,o,a)=>{let n=a?"- {{variantItem.price | money}}":"",p='origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}"',r=`{{variantItem.title}} ${n}`;return`{%- for variantItem in variants -%}
    ${e(t,i("variantItem.available == false",i("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" disabled ${o?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">            
            ${r}
          </option>`,`<option ${p} disabled>
            ${r}
          </option>`),i("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${o?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
            ${r}
          </option>`,`<option ${p}>
            ${r}
          </option>`)),i("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${o?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
          ${r}
        </option>`,`<option ${p}>
          ${r}
        </option>`))}     
    {%- endfor -%}
  `},composeSelectOptionAttrs=`
  option-data="{{option.name | escape}}"
  option-value="{{value | escape}}"
  data-gp-option-value-id="{{value.id}}"
  data-gp-option-available="{{value.available}}"
  value="{{value | escape}}"
  class="option-value-wrapper"
  key="{{value | escape}}"
`,renderDropdownOptions=(a,n)=>t("value in values",`${o(`{%- liquid
      assign option_disabled = true
      for variantItem in product.variants
        case option.position
          when 1
            if variantItem.available and variantItem.option1 == value
              assign option_disabled = false
            endif
          when 2
            if variantItem.available and variantItem.option2 == value
              assign option_disabled = false
            endif
          when 3
            if variantItem.available and variantItem.option3 == value
              assign option_disabled = false
            endif
        endcase
      endfor
    -%}`)}
    ${e(a,i("option_disabled == true",i("value == selectedValue",`<option disabled ${n?"selected":""} option-position="{{option.position}}"${composeSelectOptionAttrs}>{{value}}</option>`,`<option disabled ${composeSelectOptionAttrs}>{{value}}</option>`),i("value == selectedValue",`<option ${n?"selected":""} option-position="{{option.position}}" ${composeSelectOptionAttrs}>{{value}}</option>`,`<option ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`)),i("value == selectedValue",`<option ${n?"selected":""} ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`,`<option ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`))}`),renderBlankOption=e=>`<option value="blank" selected>${e??a("ProductVariants","please_select")}</option>`;export{renderBlankOption,renderCombineVariants,renderDropdownOptions};
