import{If as i,LiquidIf as e,LiquidFor as a,Liquid as t}from"@gem-sdk/system";import{getStaticLocale as o}from"../../../../../../helpers.js";let n=(a,t,o)=>{let n='origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}"',p=`{{variantItem.title}} ${o?"- {{variantItem.price | money}}":""}`;return`{%- for variantItem in variants -%}
    ${i(a,e("variantItem.available == false",e("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" disabled ${t?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">            
            ${p}
          </option>`,`<option ${n} disabled>
            ${p}
          </option>`),e("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${t?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
            ${p}
          </option>`,`<option ${n}>
            ${p}
          </option>`)),e("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${t?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
          ${p}
        </option>`,`<option ${n}>
          ${p}
        </option>`))}     
    {%- endfor -%}
  `},p=`
  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}}"
`,l=(o,n)=>a("value in values",`${t(`{%- 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
    -%}`)}
    ${i(o,e("option_disabled == true",e("value == selectedValue",`<option disabled ${n?"selected":""} option-position="{{option.position}}"${p}>{{value}}</option>`,`<option disabled ${p}>{{value}}</option>`),e("value == selectedValue",`<option ${n?"selected":""} option-position="{{option.position}}" ${p}>{{value}}</option>`,`<option ${p} option-position="{{option.position}}">{{value}}</option>`)),e("value == selectedValue",`<option ${n?"selected":""} ${p} option-position="{{option.position}}">{{value}}</option>`,`<option ${p} option-position="{{option.position}}">{{value}}</option>`))}`),r=i=>`<option value="blank" selected>${i??o("ProductVariants","please_select")}</option>`;export{r as renderBlankOption,n as renderCombineVariants,l as renderDropdownOptions};
