import{u as f,j as l,bo as m}from"./main-343.js";function b(c,a={},i=[]){const o={form_fields:[]},u=Object.keys(a),n={form_fields:[]},p=[];u.forEach(e=>{const s=a[e].lg.map(t=>t.i);c.forEach(t=>{if(t.key===e){if(!i.includes(t.typ)){let r="";t.typ==="repeater"?r=`${t.lbl}_(Repeater)`:t.typ==="section"&&(r=`${t.lbl}_(Section)`),n[r]||(n[r]={flds:[],key:e}),n[r].flds=s}p.push(...s)}})});const y=Object.keys(n);return c.forEach(e=>{y.forEach(s=>{const t=n[s].flds,r=n[s].key;t&&t.includes(e.key)&&(o[s]||(o[s]=[]),e.newKey=`${r}.${e.key}`,o[s].push(e))}),!p.includes(e.key)&&!i.includes(e.typ)&&o.form_fields.push(e)}),o}function j({formFields:c,notAllowFieldType:a=[],shortCode:i=!1}){const o=f(m),u=b(c,o,a),n=Object.keys(u),p=e=>(e.charAt(0).toUpperCase()+e.slice(1)).replace(/_/g," "),y=e=>{const s=e.newKey?e.newKey:e.key;return i?`\${${s}}`:s};return n.map(e=>l.jsx("optgroup",{label:p(e),children:u[e].map(s=>l.jsx("option",{value:y(s),children:s.name},`ff-zhcrm-${s.key}`))},`fld-lbl-${e}`))}export{j as B};
