import{i as T,aH as U,g as $,u as h,b2 as N,aX as C,r as b,a as L,H as R,j as o,_ as p,M as w,e9 as y,f as m,ba as r,bG as S,eb as z,d5 as E,ec as K}from"./main-634.js";import{t as V,F}from"./bf-676-386.js";import{F as d}from"./bf-767-388.js";import{A as q}from"./bf-710-385.js";import{I as G}from"./bf-457-387.js";import{S as X}from"./bf-982-242.js";import"./bf-638-271.js";import"./bf-247-269.js";import"./bf-25-81.js";import"./bf-534-247.js";import"./bf-299-245.js";import"./bf-497-246.js";import"./bf-641-107.js";import"./bf-400-72.js";import"./bf-438-114.js";function le(){const[l,a]=T(U),{fieldKey:t}=$(),I=h(N),j=h(C),[H,u]=b.useState(!1),[v,_]=b.useState(""),{css:c}=L(),e=R(l[t]),f=(e==null?void 0:e.undoBtn)||"",x=e.adminLbl||"",M=({target:{checked:n}})=>{n?(e.undoBtn=p("Undo"),e.undoBtnHide=!1,y(I,"undoBtn")):(delete e.undoBtn,delete e.undoPreIcn,delete e.undoSufIcn,e.undoBtnHide=!0);const s=n?"on":"off",i=m(l,A=>{A[t]=e});a(i),r(t),S({event:`Undo Button ${s}:  ${f||x||t}`,type:`undo_btn_${s}`,state:{fields:i,fldKey:t}})},P=({target:{value:n}})=>{n===""?(delete e.undoBtn,r(t)):e.undoBtn=n;const s=m(l,i=>{i[t]=e});a(s),r(t),S({event:`Undo btn text updated: ${x||e.undoBtn||t}`,type:"change_undo_btn_txt",state:{fields:s,fldKey:t}})},g=n=>{z(j,t,E[n])||y(I,n),K(n,t),_(n),u(!0)},B=n=>{if(e[n]){delete e[n];const s=m(l,i=>{i[t]=e});a(s),r(t)}};return o.jsxs("div",{children:[o.jsxs(X,{id:"undo-button-stng",title:p("Undo Button"),className:c(d.fieldSection,d.hover_tip),switching:!0,tip:V.undoBtn,tipProps:{width:250,icnSize:17},toggleAction:M,toggleChecked:!(e!=null&&e.undoBtnHide),open:!(e!=null&&e.undoBtnHide),disable:e==null?void 0:e.undoBtnHide,children:[o.jsx("div",{className:c(d.placeholder),children:o.jsx(q,{id:"undo-btn-stng",ariaLabel:"Undo Button for this Field",placeholder:"Type undo button txt here...",value:f,changeAction:P})}),o.jsxs("div",{className:c(d.iconLayoutHorizontal),children:[o.jsx(F,{label:"Leading Icon",iconSrc:e==null?void 0:e.undoPreIcn,styleRoute:"undo-btn-pre-i",setIcon:()=>g("undoPreIcn"),removeIcon:()=>B("undoPreIcn"),proProperty:"leadingIcon",position:"prefix"}),o.jsx("span",{className:c(d.iconSeparator),children:"|"}),o.jsx(F,{label:"Trailing Icon",iconSrc:e==null?void 0:e.undoSufIcn,styleRoute:"undo-btn-suf-i",setIcon:()=>g("undoSufIcn"),removeIcon:()=>B("undoSufIcn"),proProperty:"trailingIcon",position:"suffix"})]})]}),o.jsxs(w,{md:!0,autoHeight:!0,show:H,setModal:u,className:"o-v",title:p("Icons"),children:[o.jsx("div",{className:"pos-rel"}),o.jsx(G,{iconType:v,setModal:u})]})]})}export{le as default};
