"use strict";const e="%number%",t="mark",a="CONTINUE",i=e=>`
  border-top-left-radius: ${e?.bbrr??"0px"};
  border-top-right-radius: ${e?.bblr??"0px"};
  border-bottom-left-radius: ${e?.btrr??"0px"};
  border-bottom-right-radius: ${e?.btlr??"0px"};`;exports.CONTINUE_SELLING_WHEN_OUT_OF_STOCK=a,exports.DEFAULT_FONT_SIZE=20,exports.DEFAULT_HIGHLIGHT_TAG=t,exports.DEFAULT_PROGRESS_BAR_HEIGHT=10,exports.DEFAULT_QUANTITY_TEMPLATE=e,exports.DEFAULT_RANGE_STEP=10,exports.DEFAULT_REMAINING_PERCENT=20,exports.DEFAULT_REMAINING_QUANTITY=12,exports.DEFAULT_SCARCITY_THRESHOLD=12,exports.MAX_PROGRESS_BAR_HEIGHT=20,exports.MAX_REMAINING_PERCENT=100,exports.MIN_PROGRESS_BAR_HEIGHT=5,exports.MIN_REMAINING_PERCENT=10,exports.MIN_REMAINING_QUANTITY=0,exports.NO_PRODUCT_LEFT=0,exports.OUT_OF_STOCK={SHOW:"show",HIDE:"hide"},exports.QUANTITY_SOURCE={AUTO:"auto",MANUAL:"manual"},exports.convertSizeToWidth=e=>{let t={};return e["--size"]&&(t["--w"]=e["--size"]),e["--size-tablet"]&&(t["--w-tablet"]=e["--size-tablet"]),e["--size-mobile"]&&(t["--w-mobile"]=e["--size-mobile"]),t},exports.getInlineCss=(e,t)=>{let a=i(t);if(e)return`
      [data-id="${e}"]  {
          .gp-sc-progress-bar{
            ${a}
          }
          .gp-sc-progress-bar:before{
            ${a}
          }
      }`},exports.getLiquidInitData=(e,t)=>{let{scarcityThreshold:i=0,hiddenCounterWhenOutOfStock:n,displayByDefault:r}=e??{},{displayProgressBar:s}=t??{},l=!!i&&i>0;return`{%- liquid
      assign current_variant = variant
      assign available = current_variant.available | default: false
      assign inventory_management = current_variant.inventory_management | default: null
      assign inventory_policy = current_variant.inventory_policy | default: 'deny'
      assign inventory_quantity = current_variant.inventory_quantity | default: 0
      assign scarcityThreshold = ${l}
      assign check_display = ${!!r}

      if inventory_management != null and available == false and inventory_quantity <= 0 and inventory_policy != '${a.toLowerCase()}'
        assign is_out_of_stock = true
        else
        assign is_out_of_stock = false
      endif

      if check_display == true
        assign should_display = true
      elsif ${l} and inventory_quantity >= 0 and inventory_quantity < ${i}
        assign should_display = true
      else
        assign should_display = false
      endif

      if ${!0===n} and available == false
        assign should_display = false
      endif

      if ${!0===s} and available
        assign show_progress_bar = true
      else
        assign show_progress_bar = false
      endif
    -%}
    {% capture variant_policy_list %}
      {
        {% for variant in product.variants %}
        "{{ variant.id }}":"{{ variant.inventory_policy }}",
        "{{ variant.id }}_management":"{{ variant.inventory_management }}"{% if forloop.last == false %},{% endif %}
        {% endfor %}
      }
    {% endcapture %}`},exports.getLiquidTextContent=e=>{let{templateStringDisplay:t,outOfStockMessageDisplay:i,continueSellingDisplay:n,unlimitedQuantityMessageDisplay:r}=e??{};return`{% if inventory_management == null and inventory_quantity <= 0 %}
                    ${r}
                  {% elsif available == false %}
                    ${i}
                  {% elsif available and inventory_policy == '${a.toLowerCase()}' and inventory_quantity <= 0 %}
                    ${n}
                  {% else %}
                    ${t}
                  {% endif %}`},exports.getTextDisplayData=(e,t)=>{let{templateStringDisplay:a,outOfStockMessageDisplay:i,continueSellingDisplay:n,unlimitedQuantityMessageDisplay:r}=e??{},{textColor:s}=t??{},l=s||"brand";return`
    <div class="gp-hidden gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px] gp-text-g-${l} gp-bg-g-${l}" >
      <div id="template">${a}</div>
      <div id="out-of-stock-message">${i}</div>
      <div id="continue-selling">${n}</div>
      <div id="unlimited-quantity-message">${r}</div>
    </div>`},exports.transformHighlighTag=(e,a)=>{if(!e.includes(`<${t}>`))return e;let i="gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px]",n=`<${t}>`;return n=a.includes("#")?`
      <${t} class='${i}' style='background-color: ${a}'>
    `:`
      <${t} class='${i} gp-bg-g-${a}'>
    `,e.replaceAll(`<${t}>`,n)},exports.transformNumberTag=(t,a,i)=>{if(!t.includes(e))return t;let n="";return n=a.includes("#")?`<span style='--c: ${a}'><$quantity$></span>`:`<span class='gp-text-g-${a}'><$quantity$></span>`,i&&(n=n.replace("<$quantity$>",i.toString())),t.replaceAll(e,n)};
