import{h as C,m as V,r as A}from"../js/utils.671ae102.js";import{c as I}from"../js/runtime-dom.esm-bundler.dc49ee3e.js";import{o as b}from"../js/helpers.633a054c.js";import{l as P}from"../js/index.20093c86.js";import{u as N,a as O}from"../js/index.4b887428.js";import{B as H}from"../js/Select.f950b4c6.js";import{_ as D}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{a6 as M,o as Z,c as j,_ as E,$ as F,l as T,h as U}from"../js/runtime-core.esm-bundler.ce5add0b.js";import"../js/translations.e71e2202.js";import{_ as a,a as h}from"../js/default-i18n.65d58dd6.js";import"../js/Caret.cd869c5d.js";import"../js/Close.ccd53ef3.js";const q=C`
<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="https://schemas.wp.org/wp/5.8/block.json",G="aioseo/locations",J="AIOSEO Local - Locations",K="Displays locations.",Q="aioseo",W="all-in-one-seo-pack",X={categoryId:{type:"number",default:0}},Y={html:!1},ee={$schema:z,name:G,title:J,description:K,category:Q,textdomain:W,attributes:X,supports:Y},te={setup(){return{postEditorStore:N(),rootStore:O()}},components:{BaseSelect:H},data(){return{locationCategories:[],strings:{selectLocation:this.rootStore.aioseo.localBusiness.taxonomySingleLabel}}},methods:{getCategoryOptions(e){let t=this.locationCategories.find(s=>s.value===e);return t||(t=this.locationCategories.find(s=>s.value===this.postEditorStore.currentPost.localBusinessCategory)||this.locationCategories.find(s=>!!s),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})})}},oe={class:"aioseo-locations-sidebar"},ne={class:"sidebar-row"},se={class:"title"};function ae(e,t,s,c,o,m){const u=M("base-select");return Z(),j("div",oe,[E("div",ne,[E("p",se,F(o.strings.selectLocation),1),T(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 ie=D(te,[["render",ae]]),i="all-in-one-seo-pack",{name:k,title:re,description:le,category:ce,supports:ue,attributes:de}=ee,r=window.wp,pe=r.serverSideRender||r.components.ServerSideRender;var B;const $=((B=r.blockEditor)==null?void 0:B.InspectorControls)||r.editor.InspectorControls,L=r.components.PanelBody,me=r.data.withSelect,p={},R=[],ge={title:re,description:le,category:ce,supports:ue,attributes:de,icon:q,edit:me(function(e){return{categories:e("core").getEntityRecords("taxonomy",window.aioseo.localBusiness.taxonomyName)}})(function(e){var y,S,_,v,w;const t=(w=(v=(_=(S=(y=window==null?void 0:window.aioseo)==null?void 0:y.options)==null?void 0:S.localBusiness)==null?void 0:_.locations)==null?void 0:v.general)==null?void 0:w.multiple,{setAttributes:s,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,a("Loading...",i));if(n=n===null?[]:n,!t)return React.createElement("div",null,a("Please enable multiple locations before using this block.",i));if(n.length===0)return React.createElement("div",null,h(a("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){V(o,R);let d=I({name:"Blocks/Locations",data:function(){return p[o]},watch:{$data:{handler:function(x){s(x)},deep:!0}},render:()=>U(ie)});d=P(d),d.mount(l),R.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,h(a("No %1$s found",i),window.aioseo.localBusiness.taxonomyPluralLabel)):c.categoryId?React.createElement(React.Fragment,null,React.createElement($,null,React.createElement(L,{title:a("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement(pe,{block:k,attributes:{...c}})):React.createElement(React.Fragment,null,React.createElement($,null,React.createElement(L,{title:a("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement("div",null,h(a("Select a %1$s",i),window.aioseo.localBusiness.taxonomySingleLabel)))}),save:function(){return null}};A({name:k,settings:ge});
