import{_ as y}from"./app-DuUYZNNT.js";import{a as b,_ as U}from"./app-BHFzVhjx.js";import{r,J as k,ak as B,o as d,g as h,a as f,u as a,b as p,bb as S,w as _,F as L,D as M,c as w,f as C,t as D}from"./app-DA7OTM4Q.js";const I={class:"ui fields inline",style:{"padding-bottom":"0","margin-bottom":"0"}},$=["name","value"],z={class:"ui field"},F={class:"ui field"},O={__name:"TimeDurationBox",props:["v-name","v-value","v-count","v-unit","placeholder","v-min-unit","maxlength"],emits:["change"],setup(g,{emit:x}){const i=g,V=x,{duration:o,countString:l,units:N,realMaxLength:v}=function(){let n=i.vValue;n==null&&(n={count:i.vCount,unit:i.vUnit}),typeof n.count!="number"&&(n.count=-1);let t=i.vMinUnit,e=[{code:"ms",name:"毫秒"},{code:"second",name:"秒"},{code:"minute",name:"分钟"},{code:"hour",name:"小时"},{code:"day",name:"天"}],m=-1;if(t!=null&&typeof t=="string"&&t.length>0){for(let s=0;s<e.length;s++)if(e[s].code==t){m=s;break}}m>-1&&(e=e.slice(m));let u=parseInt(i.maxlength);return(isNaN(u)||u<=0)&&(u=6),{duration:r(n),countString:r(n.count>=0?n.count.toString():""),units:r(e),realMaxLength:r(u)}}(),c=function(){V("change",o.value)};return k(l,function(n){let t=n.trim();if(t.length==0){o.value.count=-1;return}let e=parseInt(t);isNaN(e)||(o.value.count=e),c()}),B(()=>{c()}),(n,t)=>(d(),h("div",I,[f("input",{type:"hidden",name:n.vName,value:JSON.stringify(a(o))},null,8,$),f("div",z,[p(y,{type:"text",modelValue:a(l),"onUpdate:modelValue":t[0]||(t[0]=e=>S(l)?l.value=e:null),maxlength:a(v),size:a(v),placeholder:g.placeholder},null,8,["modelValue","maxlength","size","placeholder"])]),f("div",F,[p(U,{modelValue:a(o).unit,"onUpdate:modelValue":t[1]||(t[1]=e=>a(o).unit=e),onChange:c},{default:_(()=>[(d(!0),h(L,null,M(a(N),e=>(d(),w(b,{value:e.code},{default:_(()=>[C(D(e.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])])]))}};export{O as _};
