import"./assets/bootstrap-DiRCdOSa.js";import{i as e,h as t}from"./assets/password-BXfI06Ub.js";import"./assets/theme-switcher--vV5z1WW.js";const s=e=>{const t=document.getElementById("phpmyfaq-setup-form").getElementsByTagName("input"),s=document.getElementById("dbdatafull"),n=document.getElementById("sql_port"),l=document.getElementById("dbsqlite"),a=e.target;if("sqlite3"===a.value||"pdo_sqlite"===a.value)for(let d=0;d<t.length;d++)t[d].removeAttribute("required");else document.getElementById("sql_server")?.setAttribute("required","required"),document.getElementById("sql_port")?.setAttribute("required","required"),document.getElementById("sql_user")?.setAttribute("required","required"),document.getElementById("faqpassword")?.setAttribute("required","required"),document.getElementById("sql_db")?.setAttribute("required","required");switch(a.value){case"mysqli":case"pdo_mysql":n.value="3306",l.className="d-none",s.className="d-block";break;case"pgsql":case"pdo_pgsql":n.value="5432",l.className="d-none",s.className="d-block";break;case"sqlsrv":case"pdo_sqlsrv":n.value="1433",l.className="d-none",s.className="d-block";break;case"sqlite3":case"pdo_sqlite":l.className="d-block",s.className="d-none";break;default:l.className="d-none",s.className="d-block"}},n=()=>{const t=document.getElementById("elasticsearch-server-wrapper"),s=document.createElement("input");s.className="form-control mt-1",s.type="text",s.name="elasticsearch_server[]",s.placeholder="127.0.0.1:9200",e(t,s)};document.addEventListener("DOMContentLoaded",()=>{t();const e=document.getElementById("sql_type");e&&e.addEventListener("change",s);const l=document.getElementById("pmf-add-elasticsearch-host");l&&l.addEventListener("click",n);let a=0;const d=document.getElementById("nextBtn"),c=document.getElementById("prevBtn");function m(e){const t=document.getElementsByClassName("step");t.length>0&&(t[e].style.display="block");const s=document.getElementById("prevBtn"),n=document.getElementById("nextBtn");s&&n&&(s.style.display=0===e?"none":"inline",e===t.length-1?n.innerHTML="Submit":n.innerHTML="Next",(e=>{const t=document.getElementsByClassName("stepIndicator");for(let s=0;s<t.length;s++)t[s].className=t[s].className.replace(" active","");t[e].className+=" active"})(e))}d&&d.addEventListener("click",e=>{e.preventDefault(),r(1)}),c&&c.addEventListener("click",e=>{e.preventDefault(),r(-1)}),m(a);const r=e=>{const t=document.getElementsByClassName("step"),s=document.getElementById("prevBtn"),n=document.getElementById("nextBtn"),l=document.getElementById("installingBtn");return!(1===e&&!o())&&(t[a].style.display="none",a+=e,a>=t.length?(s.classList.add("d-none"),n.classList.add("d-none"),l.classList.remove("d-none"),document.getElementById("phpmyfaq-setup-form").submit(),!1):void m(a))},o=()=>{let e=!0;const t=document.getElementsByClassName("step")[a].querySelectorAll("input,select");for(let s=0;s<t.length;s++)""===t[s].value&&t[s].hasAttribute("required")&&(t[s].className+=" is-invalid",e=!1);return e&&(document.getElementsByClassName("stepIndicator")[a].className+=" finish"),e}});
//# sourceMappingURL=setup.js.map
