const p=(l,i,o,u)=>{var n;if(!(l!=null&&l[i]&&((n=l[i].fields)!=null&&n.Elements)))return[null,o];let r;i==="targetGroupSectorList"?(l[i].fields.Elements.forEach(e=>{if(!e.fields){console.error('"fields" are not defined');return}e.fields.Title||console.error('"Title" is not defined (field: "targetGroupSectorList")',e),e.fields.Value||console.error('"Value" is not defined (field: "targetGroupSectorList")',e),e.fields.Image||console.error('"Image" is not defined (field: "targetGroupSectorList")',e)}),r=l[i].fields.Elements.map(e=>({title:e.fields.Title.value||e.fields.Value.value,name:e.fields.Title.value||e.fields.Value.value,value:e.fields.Value.value,image:e.fields.Image?e.fields.Image.value:void 0,newsletter:e.fields.Newsletter?e.fields.Newsletter.id:""}))):r=l[i].fields.Elements.map(e=>({title:e.fields.Title.value||e.fields.Value.value,name:e.fields.Title.value||e.fields.Value.value,value:e.fields.Value.value}));const s=l[i].fields["Default Option"];let a,f;return s?(f=s.fields.Value.value,a=r.find(e=>e.value===f)):a=null,u&&r.sort((e,d)=>e.name<d.name?-1:e.name>d.name?1:0),[a,r,f]},V=(l,i,o,u)=>{var n,e,d;if(!(l!=null&&l[i]&&((n=l[i])!=null&&n.Elements)))return[null,o];let r;i==="TargetGroupSectorList"?(l[i].Elements.forEach(t=>{if(!t){console.error('"fields" are not defined');return}t.Title||console.error('"Title" is not defined (field: "TargetGroupSectorList")',t),t.Value||console.error('"Value" is not defined (field: "TargetGroupSectorList")',t)}),r=(e=l[i].Elements)==null?void 0:e.map(t=>({title:t.Title||t.Value,name:t.Title||t.Value,value:t.Value,newsletter:t.Newsletter||""}))):r=(d=l[i].Elements)==null?void 0:d.map(t=>({title:t.Title||t.Value,name:t.Title||t.Value,value:t.Value}));const s=l[i].Default_Option;let a,f;return s?(f=s.Value,a=r.find(t=>t.value===f)):a=null,u&&r.sort((t,c)=>t.name<c.name?-1:t.name>c.name?1:0),[a,r,f]},v=l=>{let i=[];return l!=null&&l.value&&(l.value.indexOf("{0}")!==-1?i=l.value.split("{0}"):i.push(l.value)),i},g=(l,i,o)=>{var s;const u=l[i];let r="";return((s=u==null?void 0:u.value)==null?void 0:s.indexOf("{0}"))!==-1?r=v(u)[0]+o+v(u)[1]:u!=null&&u.value&&(r=u.value),r};export{g as a,V as b,p as g};