import{g as R,i as x,A as _,a as N,u as z,j as i,_ as w,ex as T,h as n,dZ as E,f as d,bD as $,m as l,aF as I,aV as M,aZ as B}from"./main-343.js";import{S as L,T as j,b as v}from"./bf-711-253.js";import{F as S}from"./bf-838-284.js";import{t as H}from"./bf-689-322.js";import{C as K}from"./bf-498-326.js";import{S as Z}from"./bf-603-251.js";import{E as O}from"./bf-794-390.js";function D({asteriskIsAllow:A=!0}){var q,u;const{fieldKey:a}=R(),[h,g]=x(I),s=_(h[a]),[p,k]=x(M),{css:m}=N(),b=s.valid.req||!1,f=s.adminLbl||"",y=z(B),t=(r,c,o="")=>`fields->${a}->classes->.${a}-${r}${o&&`:${o}`}->${c}`,F=r=>{const{checked:c}=r.target;c?(s.valid.reqShow=!0,E(y,"reqSmbl")):delete s.valid.reqShow;const o=d(h,C=>{C[a]=s});g(o);const e=c?"on":"off";$({event:`Asterisk Show ${e}: ${f||s.lbl||a}`,type:`asterisk_show_${e}`,state:{fields:o,fldKey:a}})},P=r=>{s.valid.reqPos=r;const c=d(h,e=>{e[a]=s});g(c);let o=p;r==="left"?o=d(p,e=>{l(e,t("lbl","position"),"relative"),l(e,t("req-smbl","position"),"absolute"),l(e,t("req-smbl","right"),"unset"),l(e,t("req-smbl","left"),"0px")}):r==="right"?o=d(p,e=>{l(e,t("lbl","position"),"relative"),l(e,t("req-smbl","position"),"absolute"),l(e,t("req-smbl","right"),"0px"),l(e,t("req-smbl","left"),"unset")}):o=d(p,e=>{l(e,t("lbl","position"),"unset"),l(e,t("req-smbl","position"),"unset"),l(e,t("req-smbl","left"),"unset"),l(e,t("req-smbl","right"),"unset")}),k(o),$({event:`Asterisk Position ${r}: ${f||s.lbl||a}`,type:"asterisk_position_change",state:{fields:c,styles:o,fldKey:a}})};return i.jsxs(L,{id:"rqrd-stng",title:w("Required"),toggleAction:T,toggleChecked:b,className:m(S.fieldSection,S.hover_tip),switching:!0,tip:H.required,tipProps:{width:200,icnSize:17},open:b,disable:!b,children:[i.jsx(O,{id:"rqrd-stng",type:"req",title:"Error Message",tipTitle:"By enabling this feature, user will see the error message when input is empty"}),A&&i.jsxs(i.Fragment,{children:[i.jsx(K,{id:"rqrd-stng-shw-strsk",className:`${m(n.mr2,n.mt2,{ml:7})} ${m(n.fw500)} `,name:"reqShow",checked:((q=s==null?void 0:s.valid)==null?void 0:q.reqShow)||!1,title:w("Show Asterisk Symbol"),onChange:F}),((u=s==null?void 0:s.valid)==null?void 0:u.reqShow)&&i.jsxs("div",{className:m(n.flxcb,n.pl3,n.px10,n.mt1),children:[i.jsx("span",{className:m(n.fs12,n.fw500),children:"Asterisk Position"}),i.jsx(Z,{className:m({w:120}),show:["icn"],tipPlace:"bottom",options:[{icn:i.jsx(j,{size:"17"}),label:"left",tip:"left"},{icn:i.jsx(j,{size:"17"}),label:"before",tip:"before"},{icn:i.jsx(v,{size:"17"}),label:"after",tip:"after"},{icn:i.jsx(v,{size:"17"}),label:"right",tip:"right"}],onChange:r=>P(r),defaultActive:s.valid.reqPos})]})]})]})}export{D as R};
