"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../text/components/Text.liquid.js"),s=require("../../helpers.js"),a=require("@gem-sdk/system"),r=require("../common/attrs.js"),l=require("../common/styles.js"),i=require("../common/classes.js"),n=require("../settings/configs/translate.js");exports.default=c=>{let{setting:d,styles:o,builderProps:u,advanced:g,pageContext:p}=c,{labelTypo:y,numTypo:$,numTypography:f,labelTypography:m,enableLabelTextStyle:S}=o??{},{weekLabel:C,dayLabel:x,hourLabel:k,minuteLabel:v,secondLabel:I,enableWeek:b,enableDay:q,enableHour:w,enableMinute:L,enableSecond:h,redirectUrl:j,autoHideWhenTimeout:A}=d??{},P=!!j?.link,{urlData:T}=s.getInsertLinkData("",j),D=a.createStateOrContext({...d,...u}),E=a.createStyle({...l.getDateStyle(o)}),F=e=>a.createClass({...i.getDateClasses(e)}),N=a.createClass({...i.getTextFrontClasses(o)}),O=a.createStyle({...l.getTextFrontStyle(o)}),_=a.createStyle({...l.getTextBackStyle(o)}),R=e=>a.createClass({...i.getTextBackClasses(o,e)}),B=a.createAttr({...r.getAttr({uid:u?.uid||""})}),G=a.createAttr({...r.getAttrHref({uid:T.href||""})}),M=a.createStyle({...l.getWrapperStyle(o)}),V=a.createClass({...i.getWrapperClasses(g?.cssClass)}),W=a.createClass({...i.getContentClasses({isLiquid:!0,autoHideWhenTimeout:A})}),H=a.createStyle({...l.getContainStyle(o)}),J=(s,r,l)=>{let i=l&&l in n.Countdown?n.Countdown[l]?.id:void 0;return e.template`
    <div style="${E}" class="${F(r)}">
    ${t.default({styles:{typography:f,typo:$},setting:{...d,text:"00",excludeFlex:!0,isForceValue:!0},style:O,className:N,builderAttrs:{id:s},builderProps:{...u,uid:u?.uid,uidInteraction:`${u?.uid}-text`}})}
    ${a.If(!!S,e.template`
         ${t.default({styles:{typography:m,typo:y},setting:{...d,text:r,excludeFlex:!0},translateSetting:i,style:_,className:R(r),builderProps:{...u,uid:u?.uid,uidInteraction:`${u?.uid}-text`},pageContext:p})}
    `)}
    </div>
    `},U=a.createClass({...i.getLinkClasses()});return e.template`
    <gp-countdown-timer
        ${{...B}}
        ${{...G}}
        class="${V}"
        style="${M}"
        gp-data='${JSON.stringify(D).replaceAll("'","&#039;")}'>
        <div id="section-countdown" class="${W}" style="${H}">
        ${a.If(P,`<a
            href="${T.href}"
            target="${T?.target}"
            aria-label="Countdown link"
            class="${U}"
          > </a>`)}
          ${a.If(b,J("week",C,"weekLabel"))}
          ${a.If(q,J("day",x,"dayLabel"))}
          ${a.If(w,J("hour",k,"hourLabel"))}
          ${a.If(L,J("minute",v,"minuteLabel"))}
          ${a.If(h,J("second",I,"secondLabel"))}
      </div>
     </gp-countdown-timer>
    ${e.RenderIf(e.isLocalEnv,`<script ${s.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-countdown-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${s.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-countdown-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};
