import{template as s,RenderIf as t,isLocalEnv as e,baseAssetURL as o}from"@gem-sdk/core";import r from"../../button/components/Button.liquid.js";import{getSettingPreloadData as i}from"../../helpers.js";import{createStateOrContext as p,createClass as l}from"@gem-sdk/system";import{getActiveClasses as m}from"../common/classes.js";import{getInnerBorderCornerCss as n,getButtonStyle as c,getButtonStyles as d,getInnerActiveStyles as u}from"../common/styles.js";import{getButtonSetting as a}from"../common/helpers.js";let Coupon=({setting:f,builderProps:g,builderAttrs:$,style:y,styles:j,advanced:S,pageContext:b})=>{let{backgroundColorV2:v,textColor:h,enableTextStyle:k}=j??{},{defaultLabel:A,clickedLabel:E,copyContent:C}=f??{},G=p({defaultLabel:A,clickedLabel:E,copyContent:C,uid:g?.uid,enableTextStyle:k}),I=l(m(v,h)),N=n({uid:g?.uid,styles:j}),O=u(j),P=()=>t(e,`<script ${i('class="gps-link" delay',"src")}="{{ 'gp-coupon-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${i('class="gps-link" delay',"src")}="${o}/assets-v2/gp-coupon-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return s`
    <gp-coupon data-id="${g?.uid}" data-active="false" gp-setting='${JSON.stringify(G).replaceAll("'","&#039;")}' class="${I}">
    <style>${`${N}${O}`}</style>
    ${r({builderProps:{...g,uidInteraction:`${g?.uid}-interaction`},builderAttrs:$,setting:{...a({setting:f,label:A,htmlType:"button",styles:j})},style:{...c(y,j)},styles:{...d(j)},advanced:S,pageContext:b})}
    </gp-coupon>
    ${P()}
  `};export{Coupon as default};
