import{b as A,I as V,an as E,f as u,Q as H,R as g,i as d,j as e,U as t,O as N,ad as L,P as O,M as m,Y as T,aj as U,a0 as Y,ae as q,a4 as D,r as c,u as I,ap as M}from"./js/vendor-vue-ui.c21c50b5.js";import{l as j}from"./js/index.e1395627.js";import{l as F}from"./js/index.695373d0.js";import{l as R}from"./js/index.0d80c2c2.js";import{a6 as w,l as W}from"./js/app-core.52885c02.js";import{_ as a}from"./js/vendor-other.ec82d685.js";import"./js/Button.7e4e5aaa.js";import"./js/_plugin-vue_export-helper.eefbdd86.js";import"./js/Input.d5d0cc38.js";import"./js/Index.df48fa2a.js";import"./js/Close.4a8424fd.js";import"./js/Pencil.886eeda5.js";import"./js/Trash.e939fb36.js";import"./js/Select.f9b41564.js";import"./js/Caret.911868b5.js";import"./js/Toggle.9189cb4d.js";import"./js/vendor-lodash.b9aaf385.js";const z={key:0,class:"aioseo-nps-survey"},K=["aria-label"],Q={key:0,class:"aioseo-nps-survey__step"},$={class:"aioseo-nps-survey__header"},G={class:"aioseo-nps-survey__question"},J={class:"aioseo-nps-survey__scores"},X=["onClick"],Z={class:"aioseo-nps-survey__labels"},ee={key:1,class:"aioseo-nps-survey__step"},se={class:"aioseo-nps-survey__header"},oe=["placeholder"],ae={key:2,class:"aioseo-nps-survey__step aioseo-nps-survey__step--thankyou"},te={class:"aioseo-nps-survey__thankyou"},ne={__name:"App",setup(ie){const s="aioseo-pro",o={heading:a("Feedback",s),question:a("How likely are you to recommend AIOSEO to a friend or colleague?",s),notSatisfied:a("Not satisfied",s),verySatisfied:a("Very satisfied",s),feedbackHeading:a("What could we do to improve?",s),feedbackHeadingPromoter:a("What do you love most about AIOSEO?",s),feedbackPlaceholder:a("Your feedback...",s),submitButton:a("Submit feedback",s),thankYou:a("Thank you for your feedback!",s),back:a("Back",s),close:a("Close",s)},p=c(!0),i=c(1),_=c(null),v=c(""),y=c(!1),f=c(!1),S=I(()=>9<=_.value?o.feedbackHeadingPromoter:o.feedbackHeading),C=r=>{_.value=r,i.value=2},x=()=>{i.value=1},k=async()=>{if(p.value=!1,!f.value)try{await w.post("/nps-survey/dismiss")}catch{}},B=async()=>{y.value=!0;try{await w.post("/nps-survey/submit").send({score:_.value,feedback:v.value}),f.value=!0}catch{}finally{y.value=!1}i.value=3,setTimeout(()=>{p.value=!1},3e3)},b=r=>{r.key==="Escape"&&p.value&&k()};return A(()=>window.addEventListener("keydown",b)),V(()=>window.removeEventListener("keydown",b)),(r,h)=>{const P=E("base-button");return u(),H(D,{name:"nps-slide-up",appear:""},{default:g(()=>[p.value?(u(),d("div",z,[e("button",{class:"aioseo-nps-survey__close",onClick:k,"aria-label":o.close}," ✕ ",8,K),i.value===1?(u(),d("div",Q,[e("div",$,t(o.heading),1),e("p",G,t(o.question),1),e("div",J,[(u(),d(N,null,L(10,l=>e("button",{key:l,class:O(["aioseo-nps-survey__score-btn",{selected:l===_.value}]),onClick:re=>C(l)},t(l),11,X)),64))]),e("div",Z,[e("span",null,t(o.notSatisfied),1),e("span",null,t(o.verySatisfied),1)])])):m("",!0),i.value===2?(u(),d("div",ee,[e("button",{class:"aioseo-nps-survey__back",onClick:x}," ← "+t(o.back),1),e("div",se,t(S.value),1),T(e("textarea",{"onUpdate:modelValue":h[0]||(h[0]=l=>v.value=l),class:"aioseo-nps-survey__textarea",placeholder:o.feedbackPlaceholder,rows:"4"},null,8,oe),[[U,v.value]]),Y(P,{type:"blue",loading:y.value,onClick:B},{default:g(()=>[q(t(o.submitButton),1)]),_:1},8,["loading"])])):m("",!0),i.value===3?(u(),d("div",ae,[e("p",te,t(o.thankYou),1)])):m("",!0)])):m("",!0)]),_:1})}}};let n=M({...ne,name:"Standalone/NpsSurvey"});n=j(n);n=F(n);n=R(n);W(n);n.mount("#aioseo-nps-survey");
