'use client';
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{formatTime as s}from"../common/helpers.js";import o from"../../text/components/Text.js";import{useEditorMode as i}from"@gem-sdk/core";import{createClass as l,createAttr as r,createStyle as m,If as n}from"@gem-sdk/system";import{getAttr as a}from"../common/attrs.js";import{getTextExpireClasses as d,getWrapperClasses as c,getContentClasses as p,getTextFrontClasses as u,getLinkClasses as h,getTextBackClasses as y,getDateClasses as f}from"../common/classes.js";import{getWrapperStyle as g,getContainStyle as x,getDateStyle as j,getTextFrontStyle as N,getTextBackStyle as k}from"../common/styles.js";import v from"../hooks/useCountDownTimer.js";let C=C=>{let{setting:T,styles:b,builderProps:w,advanced:E}=C,{labelTypo:F,numTypo:q,labelTypography:D,numTypography:H,enableLabelTextStyle:L}=b??{},{weekLabel:W,dayLabel:z,hourLabel:A,minuteLabel:B,secondLabel:G,enableWeek:I,enableDay:J,enableHour:K,enableMinute:M,enableSecond:O,redirectUrl:P,autoHideWhenTimeout:Q}=T??{},R=i(),{week:S,day:U,hour:V,minute:X,second:Y,timeLeft:Z,ref:$}=v(T,w),_=!!P?.link&&"edit"!==R,ee=l({...d()});if(T?.autoHideWhenTimeout&&Z<=0)return"edit"!==R?null:e("div",{className:ee,children:e("span",{children:"Countdown is run out of time (this only visible in the editor)"})});let et=r({...a({uid:w?.uid||""})}),es=m({...g(b)}),eo=l({...c(E?.cssClass)}),ei=l({...p({isLiquid:!1,autoHideWhenTimeout:Q})}),el=m({...x(b)}),er=m({...j(b)}),em=e=>l({...f(e)}),en=l({...u(b)}),ea=m({...N(b)}),ed=m({...k(b)}),ec=e=>l({...y(b,e)}),ep=l({...h()}),eu=(i,l)=>{let r=s(i);return t("div",{style:er,className:em(l),children:[e(o,{styles:{typography:H,typo:q},setting:{htmlTag:"div",text:r,excludeFlex:!0},className:en,style:ea,disableEdit:!0}),n(!!L,e(o,{styles:{typography:D,typo:F},setting:{text:l,htmlTag:"p",excludeFlex:!0},style:ed,className:ec(l),disableEdit:!0}))]})};return e("div",{ref:$,...et,className:eo,style:es,children:t("div",{className:ei,style:el,children:[n(_,e("a",{href:P?.link,target:P?.target,"aria-label":"Countdown link",className:ep,children:" "})),n(I,eu(S,W)),n(J,eu(U,z)),n(K,eu(V,A)),n(M,eu(X,B)),n(O,eu(Y,G))]})})};export{C as default};
