import{h as L,r as R,m as B}from"../js/utils.212758bc.js";import{b as $,u as k,at as b,y as C}from"../js/app-core.52885c02.js";import{an as V,f as x,i as A,j as _,U as I,a0 as P,ap as N,h as O}from"../js/vendor-vue-ui.c21c50b5.js";import{l as H}from"../js/index.e1395627.js";import{B as D}from"../js/Select.f9b41564.js";import{_ as M}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{_ as s,a as y}from"../js/vendor-other.ec82d685.js";import"../js/vendor-lodash.b9aaf385.js";import"../js/Caret.911868b5.js";import"../js/Close.4a8424fd.js";const U=L` `,Z="aioseo/locations",j="AIOSEO Local - Locations",F="Displays locations.",T="aioseo",q={categoryId:{type:"number",default:0}},z={html:!1},G={name:Z,title:j,description:F,category:T,attributes:q,supports:z},J={setup(){return{postEditorStore:k(),rootStore:$()}},components:{BaseSelect:D},data(){return{locationCategories:[],strings:{selectLocation:this.rootStore.aioseo.localBusiness.taxonomySingleLabel}}},methods:{getCategoryOptions(e){let t=this.locationCategories.find(a=>a.value===e);return t||(t=this.locationCategories.find(a=>a.value===this.postEditorStore.currentPost.localBusinessCategory)||this.locationCategories.find(a=>!!a),t&&(this.$root.$data.categoryId=t.value)),t}},created(){this.$root.$data.categories&&this.$root.$data.categories.forEach(e=>{this.locationCategories.push({value:e.id,label:e.name})})}},K={class:"aioseo-locations-sidebar"},Q={class:"sidebar-row"},W={class:"title"};function X(e,t,a,c,o,m){const u=V("base-select");return x(),A("div",K,[_("div",Q,[_("p",W,I(o.strings.selectLocation),1),P(u,{size:"medium",options:o.locationCategories,modelValue:m.getCategoryOptions(e.$root.$data.categoryId),"onUpdate:modelValue":t[0]||(t[0]=n=>e.$root.$data.categoryId=n.value),"track-by":"value"},null,8,["options","modelValue"])])])}const Y=M(J,[["render",X]]),i="all-in-one-seo-pack",{name:w,title:ee,description:te,category:oe,supports:ne,attributes:ae}=G,r=window.wp,se=r.serverSideRender||r.components.ServerSideRender,h=r.blockEditor?.InspectorControls||r.editor.InspectorControls,S=r.components.PanelBody,ie=r.data.withSelect,p={},v=[],re={title:ee,description:te,category:oe,supports:ne,attributes:ae,icon:U,edit:ie(function(e){return{categories:e("core").getEntityRecords("taxonomy",window.aioseo.localBusiness.taxonomyName)}})(function(e){const t=window?.aioseo?.options?.localBusiness?.locations?.general?.multiple,{setAttributes:a,attributes:c,clientId:o,isSelected:m,toggleSelection:u}=e;let{categories:n}=e;const g="aioseo-"+o;if(r.data.useSelect(l=>l("core/edit-post").getActiveGeneralSidebarName())==="edit-post/block"&&(typeof u!="function"||u(!0)),t&&n===null)return React.createElement("div",null,s("Loading...",i));if(n=n===null?[]:n,!t)return React.createElement("div",null,s("Please enable multiple locations before using this block.",i));if(n.length===0)return React.createElement("div",null,y(s("No %1$s found",i),window.aioseo.localBusiness.taxonomyPluralLabel));const f={id:g,parent:document.querySelector(".block-editor"),subtree:!0,loop:!1,done:function(l){B(o,v);let d=N({name:"Blocks/Locations",data:function(){return p[o]},watch:{$data:{handler:function(E){a(E)},deep:!0}},render:()=>O(Y)});d=H(d),d.mount(l),v.push({id:o,app:d})}};return m&&(p[o]={},Object.keys(c).forEach(l=>{p[o][l]=c[l]}),p[o].categories=n,b(f)),n!==null&&n.length===0?React.createElement("div",null,y(s("No %1$s found",i),window.aioseo.localBusiness.taxonomyPluralLabel)):c.categoryId?React.createElement(React.Fragment,null,React.createElement(h,null,React.createElement(S,{title:s("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement(se,{block:w,attributes:{...c}})):React.createElement(React.Fragment,null,React.createElement(h,null,React.createElement(S,{title:s("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement("div",null,y(s("Select a %1$s",i),window.aioseo.localBusiness.taxonomySingleLabel)))}),save:function(){return null}};C("aioseo_page_local_seo_settings")&&R({name:w,settings:re});