import{c as l}from"./links.574d4fd4.js";import{r as i,a as c,g as u}from"./params.f0608262.js";import{N as m}from"./Network.db2dba80.js";import{x as p,o as d,c as f,C as _}from"./vue.runtime.esm-bundler.78401fbe.js";import{_ as h}from"./_plugin-vue_export-helper.58be9317.js";const w={setup(){return{rootStore:l()}},emits:["selected-site"],mixins:[m],props:{followSelectedSite:Boolean,showNetwork:Boolean},data(){return{site:null,network:{value:"network",label:this.$t.__("Network Admin (no site)",this.$td)}}},watch:{site(t){let e=this.rootStore.aioseo.data.network.sites.sites.find(o=>this.getUniqueSiteId(o)===t.value);t.value==="network"&&(e={blog_id:"network"}),this.$emit("selected-site",e),this.followSelectedSite&&this.querySelectedSite()}},computed:{sites(){const t=this.getSites.filter(e=>!e.parentDomain).map(e=>({value:this.getUniqueSiteId(e),label:`${e.domain}${e.path}`}));return this.showNetwork?[this.network].concat(t):t}},methods:{querySelectedSite(){i("aioseo-selected-site-value"),this.site.value!=="network"&&c("aioseo-selected-site-value",this.site.value)}},created(){const t=u();if(t["aioseo-selected-site-value"])return this.site=this.sites.find(e=>e.value===decodeURIComponent(t["aioseo-selected-site-value"])),i("aioseo-selected-site-value"),!1;this.showNetwork&&(this.site=this.network)}},k={class:"aioseo-network-site-selector"};function S(t,e,o,v,s,n){const r=p("base-select");return d(),f("div",k,[_(r,{size:"medium",modelValue:s.site,"onUpdate:modelValue":e[0]||(e[0]=a=>s.site=a),options:n.sites},null,8,["modelValue","options"])])}const b=h(w,[["render",S]]);export{b as C};
