"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../button/components/Button.liquid.js"),s=require("../../helpers.js"),r=require("@gem-sdk/system"),i=require("../common/classes.js"),l=require("../common/styles.js"),a=require("../common/helpers.js"),n=require("../settings/configs/translate.js");exports.default=({setting:o,builderProps:d,builderAttrs:u,style:c,styles:g,advanced:p,pageContext:y})=>{let{backgroundColorV2:S,textColor:f,enableTextStyle:m}=g??{},{defaultLabel:b,clickedLabel:v,copyContent:$}=o??{},C=s.getDynamicSourceLocales({val:v,uid:d?.uid,settingId:s.createSettingId({id:n.Coupon?.defaultLabel?.id}),pageContext:y??{}}),j=s.getDynamicSourceLocales({val:v,uid:d?.uid,settingId:s.createSettingId({id:n.Coupon?.clickedLabel?.id}),pageContext:y??{}}),q=r.createStateOrContext({defaultLabel:C,clickedLabel:j,copyContent:$,uid:d?.uid,enableTextStyle:m}),I=r.createClass(i.getActiveClasses(S,f)),L=l.getInnerBorderCornerCss({uid:d?.uid,styles:g}),A=l.getInnerActiveStyles(g);return e.template`
    <gp-coupon data-id="${d?.uid}" data-active="false" gp-setting='${JSON.stringify(q).replaceAll("'","&#039;")}' class="${I}">
    <style>${`${L}${A}`}</style>
    ${t.default({builderProps:{...d,uidInteraction:`${d?.uid}-interaction`},builderAttrs:u,setting:{...a.getButtonSetting({setting:o,label:b,htmlType:"button",styles:g})},translateSetting:n.Coupon?.defaultLabel?.id,style:{...l.getButtonStyle(c,g)},styles:{...l.getButtonStyles(g)},advanced:p,pageContext:y})}
    </gp-coupon>
    ${e.RenderIf(e.isLocalEnv,`<script ${s.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-coupon-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${s.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-coupon-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};
