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`
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
	<path d="M17.2001 7.2L19.0361 9.036L17.7641 10.308L10.0001 2.544L2.23611 10.308L0.964111 9.036L10.0001 0L14.8001 4.8V2.4H17.2001V7.2ZM10.0001 4.248L17.2001 11.436V18.6H2.80011V11.436L10.0001 4.248ZM12.4001 17.4V11.4H7.60011V17.4H12.4001Z" fill="black"/>
</svg>
`,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});
