var d=(t,s,n)=>new Promise((m,c)=>{var l=o=>{try{r(n.next(o))}catch(a){c(a)}},p=o=>{try{r(n.throw(o))}catch(a){c(a)}},r=o=>o.done?m(o.value):Promise.resolve(o.value).then(l,p);r((n=n.apply(t,s)).next())});import{bi as u,b6 as e,cH as b}from"./bootstrap-Bqxdt4iG.js";import{u as y}from"./useEntityForm-CMwp7TbN.js";import{a1 as x,ai as P,aj as R,a9 as I}from"../jse/index-index-BUJ_4tQs.js";const k=x({__name:"currency-form",props:{currency:{default:null},mode:{}},emits:["cancel","submit"],setup(t,{expose:s,emit:n}){const m=t,c=n,l={code:"",name:"",symbol:"",exchangeRate:1,description:""},p=[{component:"Input",componentProps:{id:"currency-form-code-input",placeholder:e("page.currencies.form.codePlaceholder"),maxlength:10},fieldName:"code",label:e("page.currencies.form.code"),rules:u().min(1,e("page.common.codeRequired")).max(10)},{component:"Input",componentProps:{placeholder:e("page.currencies.form.namePlaceholder"),maxlength:50},fieldName:"name",label:e("page.currencies.form.name"),rules:u().min(1,e("page.common.nameRequired")).max(50)},{component:"Input",componentProps:{placeholder:e("page.currencies.form.symbolPlaceholder"),maxlength:5},fieldName:"symbol",label:e("page.currencies.form.symbol"),rules:u().min(1,e("page.common.symbolRequired")).max(5)},{component:"InputNumber",componentProps:{placeholder:e("page.currencies.form.exchangeRatePlaceholder"),min:0,step:.01,style:{width:"100%"}},fieldName:"exchangeRate",label:e("page.currencies.form.exchangeRate"),rules:b().min(0,e("page.common.exchangeRatePositive"))},{component:"Input",componentProps:{placeholder:e("page.currencies.form.descriptionPlaceholder")},fieldName:"description",label:e("page.currencies.form.description")}],{Form:r,focus:o,isDirty:a,resetForm:f,submitForm:h,watchEntity:g}=y({emptyValues:l,firstInputId:"currency-form-code-input",schema:p,wrapperClass:"grid-cols-1"});return g(()=>m.currency,()=>m.mode),s({cancel:()=>{c("cancel")},focus:o,isDirty:a,resetForm:f,submit:()=>d(null,null,function*(){const i=yield h();i&&c("submit",i)})}),(i,w)=>(R(),P(I(r)))}});export{k as _};
