import{C}from"./Tooltip.ae7a1028.js";import{S as q}from"./Trash.d35f8063.js";import{_ as S}from"./_plugin-vue_export-helper.eefbdd86.js";import{aq as f,f as o,i as a,j as u,ae as g,U as n,Q as y,R as i,a0 as P,M as l,B as c,O as T,ad as b,T as h}from"./vendor-vue-ui.de3ab35f.js";import{_ as A}from"./Button.a549093d.js";import{b as L}from"./app-core.a6d808ce.js";import{m as B}from"./vendor-lodash.8e35bd59.js";import{a as D,_ as k}from"./vendor-other.7b559694.js";const w={components:{CoreTooltip:C,SvgCircleQuestionMark:q},props:{header:{type:String,required:!0},headerTooltip:{type:String,required:!1}}},x={class:"aioseo-field-group"},F={class:"header"},O={class:"header-title"},R={class:"fields"},J={key:0,class:"footer"};function M(e,s,r,v,G,t){const m=f("svg-circle-question-mark"),_=f("core-tooltip");return o(),a("section",x,[u("div",F,[u("span",O,[g(n(r.header)+" ",1),r.headerTooltip?(o(),y(_,{key:0},{tooltip:i(()=>[g(n(r.headerTooltip),1)]),default:i(()=>[P(m)]),_:1})):l("",!0)]),c(e.$slots,"header-extra")]),u("div",R,[c(e.$slots,"default")]),e.$slots.footer?(o(),a("div",J,[c(e.$slots,"footer")])):l("",!0)])}const V=S(w,[["render",M]]),N="aioseo-pro",j={setup(){return{rootStore:L()}},components:{BaseButton:A,FieldGroup:V},props:{groupProp:{type:Array,required:!0},defaults:{type:Object,required:!0},pluralName:{type:String,required:!0},singularName:{type:String,required:!0},maxGroups:{type:Number,required:!1},minGroups:{type:Number,default(){return 1}},headerTooltip:{type:String,required:!1},onAddGroup:{type:Function,required:!1},onDeleteGroup:{type:Function,required:!1}},data(){return{strings:{delete:k("Delete",N)}}},computed:{addLink(){return D(k("Add Another %1$s",N),this.singularName)},showLink(){if(!this.singularName)return!1;const e=this.maxGroups||this.rootStore.aioseo.data.vueComponentsDefaults.fieldGroupRepeater.maxGroups;return!this.groupProp.length||!e?!0:this.groupProp.length<e}},methods:{addGroup(){const e=JSON.parse(JSON.stringify(this.defaults));this.onAddGroup?this.onAddGroup(e):this.groupProp.push(e)},deleteGroup(e){this.onDeleteGroup?this.onDeleteGroup(e):this.groupProp.splice(e,1)}},beforeMount(){this.groupProp.forEach((e,s)=>{const r=JSON.parse(JSON.stringify(this.defaults));this.groupProp[s]=B(r,e)})}},E={class:"header"},Q={class:"header-title"},U={class:"fields-inner"};function $(e,s,r,v,G,t){const m=f("base-button"),_=f("field-group");return o(),y(_,{class:"aioseo-schema-field-group-repeater",header:r.pluralName,headerTooltip:r.headerTooltip},{"header-extra":i(()=>[t.showLink?(o(),a("a",{key:0,href:"#",onClick:s[0]||(s[0]=h((...p)=>t.addGroup&&t.addGroup(...p),["prevent"]))},n(t.addLink),1)):l("",!0)]),footer:i(()=>[t.showLink?(o(),a("a",{key:0,href:"#",onClick:s[1]||(s[1]=h((...p)=>t.addGroup&&t.addGroup(...p),["prevent"]))},n(t.addLink),1)):l("",!0)]),default:i(()=>[(o(!0),a(T,null,b(r.groupProp,(p,d)=>(o(),a("section",{class:"aioseo-schema-field-group-repeater-inner",key:d},[u("div",E,[u("span",Q,n(r.singularName+" "+(d+1)),1),r.groupProp.length>r.minGroups?(o(),y(m,{key:0,class:"small",type:"gray",onClick:h(z=>t.deleteGroup(d),["prevent"])},{default:i(()=>[g(n(G.strings.delete),1)]),_:1},8,["onClick"])):l("",!0)]),u("div",U,[c(e.$slots,"fields-inner",{groupIndex:d})])]))),128))]),_:3},8,["header","headerTooltip"])}const re=S(j,[["render",$]]);export{re as C,V as a};
