import{isLocalEnv as t,baseAssetURL as s,template as a}from"@gem-sdk/core";import{createClass as i,createStateOrContext as e,Liquid as o,LiquidFor as n,If as l}from"@gem-sdk/system";import{getSettingPreloadData as r}from"../../../helpers.js";import{getButtonClasses as d}from"./common/classes.js";import{getButtonStyles as p}from"./common/styles.js";let m=({setting:m,advanced:c,styles:u,builderProps:y,className:g=""})=>{let _=i({...!!g&&{[g]:!0},...d({styles:u,uid:y?.uid})}),f=p({styles:u,uid:y?.uid}),$=e({setting:{label:m?.label},totalVariant:"{{total_combinations}}"});return a`
    ${o("{%- assign total_combinations = 1 -%}")}
    ${n("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
    ${o(`
      {%- liquid
        assign inventory_quantity = variant.inventory_quantity | default: 0
        assign supported_payment_methods = shop.enabled_payment_types
      -%}
    `)}
    <gp-product-dynamic data-id="${y?.uid}" data-translate-label='${m?.label}' class="${c?.cssClass}" gp-data='${JSON.stringify($).replaceAll("'","&#039;")}
    '>
    <div class="${_}">
        {{ form | payment_button }}
    </div>
    {% style %}
      ${f}
    {% endstyle %}
    </gp-product-dynamic>
    ${l(t,`<script ${r('class="gps-link" delay',"src")}="{{ 'gp-product-dynamic-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${r('class="gps-link" delay',"src")}="${s}/assets-v2/gp-product-dynamic-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};export{m as default};
