import{g as y,i as C,aH as v,H as M,a as H,r as u,j as t,M as _,_ as N,b as p,f as h,bG as b,h as a,E as L,R as T,t as K}from"./main-634.js";import{s as k}from"./bf-486-243.js";import{F as j}from"./bf-767-388.js";import{d as w,C as I}from"./bf-25-81.js";import"./bf-497-246.js";function R({labelModal:s,setLabelModal:l}){var x;const{fieldKey:n}=y(),[o,c]=C(v),e=M(o[n]),{css:i}=H(),m=e.content||((x=e==null?void 0:e.info)==null?void 0:x.content),[g,E]=u.useState(m);u.useEffect(()=>{s&&E(m)},[s]);const F=d=>{const r=h(o,S=>{S[n].content=d});c(r),b({event:"Modify HTML Content Label",type:"html_content_label",state:{fields:r,fldKey:n}})},f=()=>{e.content=g;const d=h(o,r=>{r[n]=e});c(d),l(!1),b({event:"Cancel HTML Content Label ",type:"cancel_html_content_label",state:{fields:d,fldKey:n}})};return t.jsxs(_,{md:!0,show:s,setModal:f,title:N("Edit HTML Content"),children:[t.jsx(w,{id:n,value:m,onChangeHandler:F}),t.jsxs("div",{className:"mt-2 f-right",children:[t.jsx("button",{type:"button",className:`${i(p.btn)} mr-2`,onClick:f,children:"Cancel"}),t.jsx("button",{type:"button",className:`${i(p.btn)} blue`,onClick:()=>l(!1),children:"Save"})]})]})}function A(){const{css:s}=H(),{fieldKey:l}=y(),[n,o]=C(v),[c,e]=u.useState(!1);if(!l)return null;const i=M(n[l]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s(j.fieldSection),children:[t.jsxs("div",{className:s(a.flxcb),children:[t.jsxs("div",{className:s(a.flxc),children:[t.jsx("b",{children:"Content: "}),t.jsx(I,{width:250,icnSize:17,className:s(a.ml2),children:t.jsx("div",{className:s(a.tipBody),children:N("Edit the HTML field content by clicking on edit icon")})})]}),t.jsx("span",{"data-testid":"cntnt-edt-btn",role:"button",tabIndex:-1,className:s(a.mr2,a.cp),onClick:()=>e(!0),onKeyDown:()=>e(!0),children:t.jsx(L,{size:19})})]}),t.jsx("div",{"data-testid":"cntnt",role:"button",tabIndex:-1,className:s(j.input,a.px10,a.py5,k.childPmargin0,{h:"auto",fs:"12px !important"}),onClick:()=>e(!0),onKeyDown:()=>e(!0),children:t.jsx(T,{html:K(i.content)})})]}),t.jsx(R,{labelModal:c,setLabelModal:e})]})}export{A as default};
