import{d as F,ar as O,bm as P,A as r,bn as n,bq as l,bu as d,bo as p,aa as R,by as z,a9 as s,bw as I,bp as i,bs as m,h as U,a4 as Y,br as f,bx as y}from"./preload-helper.BAt0wiQU.js";import{u as G}from"./settings-store.DAVbzJl3.js";import{b as H,g as k,e as J}from"../apps/settings/index.CwVZreOu.js";import{_ as M}from"./SectionArea.vue_vue_type_script_setup_true_lang.Dmnq8nQ0.js";import{_ as Q}from"./GeneralUnlock.vue_vue_type_style_index_0_lang.D2jU7nUl.js";import{_ as W}from"./FreeGuide.vue_vue_type_style_index_0_lang.CRRk6gUI.js";import{A as X,T as Z}from"./index.C7EHgkrV.js";import{B as ee}from"./index.BQlS3R_s.js";const te={key:0},ae={key:1},se="wwp-child-tab",me=F({__name:"ChildTabs",props:{parentData:{type:Object,required:!0},parentTab:{type:String,required:!0}},emits:["fieldData"],setup(b,{emit:T}){var h,g,w;const x=b,{parentData:C,parentTab:B}=O(x),D=G(),{isLoading:V,externalLinks:u}=P(D),S=C,v=r(window.lodash.sortBy(S.value,a=>a.sort)),L=B,c=H("tab-child"),E=r((g=(h=Object.values(v.value))==null?void 0:h[0])!=null?g:""),o=r((w=c!=null?c:E.value.key)!=null?w:""),_=r([]),K=T,N=a=>{Object.entries(a).forEach(([t,e])=>{_.value[t]=e}),K("fieldData",_.value)},$=(a,t)=>{const e=r(t.link!==void 0),q=r(!!t.external).value?"_blank":"_self",A=r(t!=null&&t.with_background?"tab-with-bg":"");return e.value?(a in u.value||(u.value[a]=t.link),y("a",{class:"tab-child-item",href:t.link,target:q},t.label)):y("span",{class:"tab-child-item "+A.value},t.label)},j=a=>{a in u.value||(J("tab-child",a),o.value=a)};return(a,t)=>(n(),l(s(Z),{activeKey:o.value,"onUpdate:activeKey":t[0]||(t[0]=e=>o.value=e),"tab-position":"left","destroy-inactive-tab-pane":!0,onChange:t[1]||(t[1]=e=>j(o.value))},{default:d(()=>[(n(!0),p(R,null,z(v.value,e=>(n(),l(s(X),{key:e.key,"force-render":!0,class:I(se),tab:$(e.key,e)},{default:d(()=>[(e==null?void 0:e.link)!=null?(n(),p("div",te,[i("h3",null,m(s(k)("redirectLoading",s(wp.i18n.__)("You are redirecting to a page. Please wait...","woocommerce-wholesale-prices"))),1)])):(n(),p("div",ae,[i("h3",null,m(e.label),1),t[2]||(t[2]=i("hr",null,null,-1)),U(M,{"parent-tab":s(L),"child-tab":e.key,"section-data":e.sections,onFieldData:N},null,8,["parent-tab","child-tab","section-data"]),t[3]||(t[3]=i("br",null,null,-1)),e.no_save!==!0?(n(),l(s(ee),{key:0,type:"primary","html-type":"submit",class:"wwp-settings-save-btn",loading:s(V)},{default:d(()=>[Y(m(s(k)("submitText",s(wp.i18n.__)("Save Changes","woocommerce-wholesale-prices"))),1)]),_:1},8,["loading"])):f("",!0),(e==null?void 0:e.show_unlock_upgrade)!=null?(n(),l(Q,{key:1})):f("",!0),(e==null?void 0:e.show_free_guide)!=null?(n(),l(W,{key:2})):f("",!0)]))]),_:2},1032,["tab"]))),128))]),_:1},8,["activeKey"]))}});export{me as _};
