import{h as H,r as q,m as N}from"../js/utils.4c41c8aa.js";import{aq as k,f as c,i as b,j as n,U as i,a0 as u,M as w,R as f,ae as h,an as A,h as R}from"../js/vendor-vue-ui.de3ab35f.js";import{b as P,u as z,a as Z,ap as B,l as W}from"../js/app-core.ae890a3f.js";import{l as U}from"../js/index.faac30d2.js";import{B as G}from"../js/Input.8918dec2.js";import{B as J}from"../js/Select.32af2da8.js";import{B as x}from"../js/Toggle.26ac9b1a.js";import{_ as K}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{_ as s,a as _}from"../js/vendor-other.7b559694.js";import"../js/vendor-lodash.8e35bd59.js";import"../js/Index.52399193.js";import"../js/Close.098d4b76.js";import"../js/Pencil.405b16d2.js";import"../js/Trash.d35f8063.js";import"../js/Caret.a017b70a.js";const Q=H` `,X="aioseo/businessinfo",Y="AIOSEO Local - Business Info",ee="Displays the business info.",oe="aioseo",te={locationId:{type:"number",default:0},showLabels:{type:"boolean",default:!0},addressLabel:{type:"string",default:null},vatIdLabel:{type:"string",default:null},taxIdLabel:{type:"string",default:null},phoneLabel:{type:"string",default:null},faxLabel:{type:"string",default:null},emailLabel:{type:"string",default:null},showIcons:{type:"boolean",default:!0},showName:{type:"boolean",default:!0},showAddress:{type:"boolean",default:!0},showPhone:{type:"boolean",default:!0},showFax:{type:"boolean",default:!0},showCountryCode:{type:"boolean",default:!0},showEmail:{type:"boolean",default:!0},showVat:{type:"boolean",default:!0},showTax:{type:"boolean",default:!0},dataObject:{type:"string",default:null},updated:{type:"string",default:null}},se={html:!1},ae={name:X,title:Y,description:ee,category:oe,attributes:te,supports:se},d="all-in-one-seo-pack",le={setup(){return{postEditorStore:z(),rootStore:P()}},components:{BaseInput:G,BaseSelect:J,BaseToggle:x},data(){return{locationsList:[],strings:{selectLocation:this.rootStore.aioseo.localBusiness.postTypeSingleLabel,showLabels:s("Show labels",d),showIcons:s("Show icons",d),businessInfo:s("Business Info",d),showName:s("Name",d),address:s("Address",d),phoneNumber:s("Phone Number",d),faxNumber:s("Fax Number",d),emailAddress:s("Email Address",d),showVat:s("Show VAT ID",d),showTax:s("Show Tax ID",d),countryCode:s("Phone/Fax Country Code",d),labels:s("Labels",d),addressLabel:s("Address",d),vatIdLabel:s("Vat ID",d),taxIdLabel:s("Tax ID",d),phoneLabel:s("Phone",d),faxLabel:s("Fax",d),emailLabel:s("Email",d)}}},methods:{getLocationOptions(e){let o=this.locationsList.find(g=>g.value===e);return!o&&!this.isLocationPostType()&&(o=this.locationsList.find(g=>!!g),o&&(this.$root.$data.locationId=o.value)),o},isLocationPostType(){return this.postEditorStore.currentPost.postType===this.rootStore.aioseo.localBusiness.postTypeName}},created(){this.$root.$data.locations&&this.$root.$data.locations.forEach(e=>{this.locationsList.push({value:e.id,label:e.title.rendered})})}},ne={class:"aioseo-business-info-sidebar"},re={key:0,class:"sidebar-row"},ie={class:"title"},de={class:"sidebar-row"},ue={class:"sidebar-row"},pe={class:"sidebar-row"},me={class:"title"},ce={class:"sidebar-row"},be={class:"sidebar-row"},fe={class:"sidebar-row"},he={class:"sidebar-row"},we={key:1,class:"sidebar-row"},$e={class:"sidebar-row"},Le={class:"sidebar-row"},ge={class:"sidebar-row"},ye={key:2},Ve={class:"sidebar-row"},ve={class:"title"},Ie={class:"labels"},Se={key:0,class:"sidebar-row"},Be={key:1,class:"sidebar-row"},Ee={key:2,class:"sidebar-row"},Te={key:3,class:"sidebar-row"},ke={key:4,class:"sidebar-row"},Pe={key:5,class:"sidebar-row"};function Ne(e,o,g,y,a,I){const l=k("base-select"),r=k("base-toggle"),$=k("base-input");return c(),b("div",ne,[a.locationsList.length&&!I.isLocationPostType()?(c(),b("div",re,[n("p",ie,i(a.strings.selectLocation),1),u(l,{size:"medium",options:a.locationsList,modelValue:I.getLocationOptions(e.$root.$data.locationId),"onUpdate:modelValue":o[0]||(o[0]=t=>e.$root.$data.locationId=t.value),"track-by":"value"},null,8,["options","modelValue"])])):w("",!0),n("div",de,[u(r,{modelValue:e.$root.$data.showLabels,"onUpdate:modelValue":o[1]||(o[1]=t=>e.$root.$data.showLabels=t)},{default:f(()=>[h(i(a.strings.showLabels),1)]),_:1},8,["modelValue"])]),n("div",ue,[u(r,{modelValue:e.$root.$data.showIcons,"onUpdate:modelValue":o[2]||(o[2]=t=>e.$root.$data.showIcons=t)},{default:f(()=>[h(i(a.strings.showIcons),1)]),_:1},8,["modelValue"])]),n("div",pe,[n("p",me,i(a.strings.businessInfo),1)]),n("div",ce,[u(r,{modelValue:e.$root.$data.showName,"onUpdate:modelValue":o[3]||(o[3]=t=>e.$root.$data.showName=t)},{default:f(()=>[h(i(a.strings.showName),1)]),_:1},8,["modelValue"])]),n("div",be,[u(r,{modelValue:e.$root.$data.showAddress,"onUpdate:modelValue":o[4]||(o[4]=t=>e.$root.$data.showAddress=t)},{default:f(()=>[h(i(a.strings.address),1)]),_:1},8,["modelValue"])]),n("div",fe,[u(r,{modelValue:e.$root.$data.showPhone,"onUpdate:modelValue":o[5]||(o[5]=t=>e.$root.$data.showPhone=t)},{default:f(()=>[h(i(a.strings.phoneNumber),1)]),_:1},8,["modelValue"])]),n("div",he,[u(r,{modelValue:e.$root.$data.showFax,"onUpdate:modelValue":o[6]||(o[6]=t=>e.$root.$data.showFax=t)},{default:f(()=>[h(i(a.strings.faxNumber),1)]),_:1},8,["modelValue"])]),e.$root.$data.showPhone||e.$root.$data.showFax?(c(),b("div",we,[u(r,{modelValue:e.$root.$data.showCountryCode,"onUpdate:modelValue":o[7]||(o[7]=t=>e.$root.$data.showCountryCode=t)},{default:f(()=>[h(i(a.strings.countryCode),1)]),_:1},8,["modelValue"])])):w("",!0),n("div",$e,[u(r,{modelValue:e.$root.$data.showEmail,"onUpdate:modelValue":o[8]||(o[8]=t=>e.$root.$data.showEmail=t)},{default:f(()=>[h(i(a.strings.emailAddress),1)]),_:1},8,["modelValue"])]),n("div",Le,[u(r,{modelValue:e.$root.$data.showVat,"onUpdate:modelValue":o[9]||(o[9]=t=>e.$root.$data.showVat=t)},{default:f(()=>[h(i(a.strings.showVat),1)]),_:1},8,["modelValue"])]),n("div",ge,[u(r,{modelValue:e.$root.$data.showTax,"onUpdate:modelValue":o[10]||(o[10]=t=>e.$root.$data.showTax=t)},{default:f(()=>[h(i(a.strings.showTax),1)]),_:1},8,["modelValue"])]),e.$root.$data.showLabels?(c(),b("div",ye,[n("div",Ve,[n("p",ve,i(a.strings.labels),1)]),n("div",Ie,[e.$root.$data.showAddress?(c(),b("div",Se,[n("label",null,i(a.strings.addressLabel),1),u($,{size:"small",modelValue:e.$root.$data.addressLabel,"onUpdate:modelValue":o[11]||(o[11]=t=>e.$root.$data.addressLabel=t)},null,8,["modelValue"])])):w("",!0),e.$root.$data.showVat?(c(),b("div",Be,[n("label",null,i(a.strings.vatIdLabel),1),u($,{size:"small",modelValue:e.$root.$data.vatIdLabel,"onUpdate:modelValue":o[12]||(o[12]=t=>e.$root.$data.vatIdLabel=t)},null,8,["modelValue"])])):w("",!0),e.$root.$data.showTax?(c(),b("div",Ee,[n("label",null,i(a.strings.taxIdLabel),1),u($,{size:"small",modelValue:e.$root.$data.taxIdLabel,"onUpdate:modelValue":o[13]||(o[13]=t=>e.$root.$data.taxIdLabel=t)},null,8,["modelValue"])])):w("",!0),e.$root.$data.showPhone?(c(),b("div",Te,[n("label",null,i(a.strings.phoneLabel),1),u($,{size:"small",modelValue:e.$root.$data.phoneLabel,"onUpdate:modelValue":o[14]||(o[14]=t=>e.$root.$data.phoneLabel=t)},null,8,["modelValue"])])):w("",!0),e.$root.$data.showFax?(c(),b("div",ke,[n("label",null,i(a.strings.faxLabel),1),u($,{size:"small",modelValue:e.$root.$data.faxLabel,"onUpdate:modelValue":o[15]||(o[15]=t=>e.$root.$data.faxLabel=t)},null,8,["modelValue"])])):w("",!0),e.$root.$data.showEmail?(c(),b("div",Pe,[n("label",null,i(a.strings.emailLabel),1),u($,{size:"small",modelValue:e.$root.$data.emailLabel,"onUpdate:modelValue":o[16]||(o[16]=t=>e.$root.$data.emailLabel=t)},null,8,["modelValue"])])):w("",!0)])])):w("",!0)])}const Ae=K(le,[["render",Ne]]),p="all-in-one-seo-pack",{name:M,title:Re,description:Ue,category:_e,supports:Ce,attributes:Oe}=ae,V=window.wp,De=V.serverSideRender||V.components.ServerSideRender,C=V.blockEditor?.InspectorControls||V.editor.InspectorControls,O=V.components.PanelBody,Fe=V.data.withSelect,E={},D=[],F=[],ze={title:Re,description:Ue,category:_e,supports:Ce,attributes:Oe,icon:Q,edit:Fe(function(e){const o=P();return{locations:e("core").getEntityRecords("postType",o.aioseo.localBusiness.postTypeName,{per_page:100})}})(function(e){const o=P(),g=Z(),y=z(),a=g.options.localBusiness?.locations.general.multiple,{setAttributes:I,attributes:l,clientId:r,isSelected:$,toggleSelection:t}=e;let{locations:v}=e;const S="aioseo-"+r;if(l.addressLabel=l.addressLabel||s("Address",p),l.vatIdLabel=l.vatIdLabel||s("VAT ID",p),l.taxIdLabel=l.taxIdLabel||s("Tax ID",p),l.phoneLabel=l.phoneLabel||s("Phone",p),l.faxLabel=l.faxLabel||s("Fax",p),l.emailLabel=l.emailLabel||s("Email",p),l.updated=l.updated||Date.now(),l.dataObject=y.currentPost.postType===o.aioseo.localBusiness.postTypeName?JSON.stringify(y.currentPost.local_seo.locations.business):null,V.data.useSelect(L=>L("core/edit-post").getActiveGeneralSidebarName())==="edit-post/block"&&(typeof t!="function"||t(!0)),a&&v===null)return React.createElement("div",null,s("Loading...",p));if(v=v===null?[]:v,!a&&l.locationId)return React.createElement("div",null,s("Please enable multiple locations before using this block.",p));if(a&&v.length===0)return React.createElement("div",null,_(s("No %1$s found",p),o.aioseo.localBusiness.postTypePluralLabel));l.locationId=!l.locationId&&y.currentPost.postType===o.aioseo.localBusiness.postTypeName?y.currentPost.id:l.locationId;const T={id:S,parent:document.querySelector(".block-editor"),subtree:!0,done:function(L){N(r,D);let m=A({name:"Blocks/BusinessInfo",data:function(){return E[r]},watch:{$data:{handler:function(j){I(j)},deep:!0}},render:()=>R(Ae)});m=U(m),W(m),m.mount(L),D.push({id:r,app:m})}};return $&&(E[r]={},Object.keys(l).forEach(L=>{E[r][L]=l[L]}),E[r].locations=v,B(T)),y.currentPost.postType===o.aioseo.localBusiness.postTypeName&&B({id:S+"-watcher",parent:document.querySelector(".block-editor"),subtree:!0,done:function(L){N(r,F);let m=A({name:"Blocks/BusinessInfoWatcher",data:function(){return y.currentPost.local_seo.locations.business},watch:{$data:{handler:function(){I({updated:Date.now()})},deep:!0}},render:()=>R("div")});m=U(m),m.mount(L),F.push({id:r,app:m})}}),a&&!l.locationId?React.createElement(React.Fragment,null,React.createElement(C,null,React.createElement(O,{title:s("Block Settings",p),initialOpen:!0,onToggle:B(T)},React.createElement("div",{id:S}))),React.createElement("div",null,_(s("Select a %1$s",p),o.aioseo.localBusiness.postTypeSingleLabel))):React.createElement(React.Fragment,null,React.createElement(C,null,React.createElement(O,{title:s("Block Settings",p),initialOpen:!0,onToggle:B(T)},React.createElement("div",{id:S}))),React.createElement(De,{block:M,attributes:{...l}}))}),save:function(){return null}};q({name:M,settings:ze});