\n"):e,setAttributes(e,t){for(var l in t)e.setAttribute(l,t[l])},inputToggle(e){if(e.target.classList.contains("input-toggle")){let t=e.target.parentElement.lastElementChild;!0===e.target.checked?(t.style.height=t.scrollHeight+"px",t.classList.remove("hidden")):(t.firstChild.value="",t.style.height=null,t.classList.add("hidden"))}},addInput({parent:e,elm:t,placeholder:l,type:n,name:r,max:a}){a=a||6;let i=document.createElement("div");i.setAttribute("class","new-input");let u=document.createElement("input");u.setAttribute("type",n),u.setAttribute("placeholder",l),u.setAttribute("name",r);let s=document.createElement("button");s.setAttribute("class","remove"),s.setAttribute("type","button"),i.appendChild(u),i.appendChild(s),t.appendChild(i),t.childNodes.length>=a&&(t.nextElementSibling.disabled=!0,t.nextElementSibling.style.cssText="opacity:.3;cursor:not-allowed"),e.style.height=e.scrollHeight+"px"},removeInput({elm:e,target:t,max:l}){if(l=l||6,"remove"===t.className){--l;let r=t.parentElement.parentNode;var n=t.parentElement.getBoundingClientRect().height;t.parentElement.remove(),e.style.height=e.getBoundingClientRect().height-n+"px",r.childNodes.length<=l&&(r.nextElementSibling.disabled=!1,r.nextElementSibling.style.cssText="opacity:1;cursor:pointer;")}}};!function(e){let t=e.getElementById("output-code"),l=e.querySelector("#menu-input-field"),n=e.getElementById("submit"),r=e.querySelector(".error-box");function a(t,l){let n=e.createElement("label"),r=e.createElement("input"),a=e.createElement("span");return l=e.createTextNode(l),r.setAttribute("type","checkbox"),r.setAttribute("class",t),r.setAttribute("name","link-attr"),a.appendChild(l),n.appendChild(r),n.appendChild(a),n}function i(){let t=e.createElement("div");return t.classList.add("clearfix"),t}function u(){let t=e.createElement("div");t.classList.add("link-attr");var l=a("rel small-checkbox","NoFollow"),n=a("target small-checkbox","Open in New Tab");return t.appendChild(l),t.appendChild(n),t}function s(t){var l=e.createElement("input");return helperFn.setAttributes(l,{type:"url",name:"url"+t,placeholder:"URL",class:"url"+t}),l}function c(t){var l=e.createElement("input");return helperFn.setAttributes(l,{type:"text",name:t+"name",placeholder:"nama "+t,class:t+"name"}),l}function d(t){var l=e.createElement("button");return helperFn.setAttributes(l,{type:"button",class:"remove"+t}),l}function o(t,l){let n=e.createElement("button");return helperFn.setAttributes(n,{class:t,value:l}),n.innerText=l,n}e.addEventListener("click",function(t){if("add-main-menu"===t.target.id){let a=t.target.parentElement,m=e.createElement("div"),p=e.createElement("div");m.setAttribute("class","main-menu-outer"),p.setAttribute("class","main-menu-inner");var l=s("menu"),n=c("menu"),r=d("menu");t=o("add-submenu-level1","submenu level 1");p.appendChild(l),p.appendChild(n),p.appendChild(r),p.appendChild(i()),p.appendChild(u()),m.appendChild(p),m.appendChild(t),a.insertBefore(m,a.lastElementChild)}}),e.addEventListener("click",function(t){if("add-submenu-level1"===t.target.className){let a=t.target.parentElement,m=e.createElement("div"),p=e.createElement("div");m.setAttribute("class","submenu-level1-outer"),p.setAttribute("class","submenu-level1-inner");var l=s("submenu"),n=c("submenu"),r=d("submenu");t=o("add-submenu-level2","submenu level 2");p.appendChild(l),p.appendChild(n),p.appendChild(r),p.appendChild(i()),p.appendChild(u()),m.appendChild(p),m.appendChild(t),a.insertBefore(m,a.lastElementChild)}}),e.addEventListener("click",function(t){if("add-submenu-level2"===t.target.className){let r=t.target.parentElement,a=e.createElement("div"),i=e.createElement("div");a.setAttribute("class","submenu-level2-outer"),i.setAttribute("class","submenu-level2-inner");var l=s("subsubmenu"),n=c("subsubmenu");t=d("subsubmenu");i.appendChild(l),i.appendChild(n),i.appendChild(t),i.appendChild(u()),a.appendChild(i),r.insertBefore(a,r.lastElementChild)}}),e.addEventListener("click",function(e){let t=e.target;"removemenu"!=t.className&&"removesubmenu"!=t.className&&"removesubsubmenu"!=t.className||t.parentElement.parentElement.remove()}),n.addEventListener("click",function(){var n=e.querySelectorAll(".main-menu-outer"),a=l.querySelectorAll("input[type=url]");let i=[],u="";if(Array.from(a).forEach(function(e){""===e.value||helperFn.checkURL(e.value)?e.classList.remove("error"):(i.push("Error"),e.classList.add("error"))}),0':"",r=""!=r.value?r.value:"#",a=""!=a.value?a.value:"Menu",r.replace(/\s/g,"%20"),a=a.replace(/(<([^>]+)>)/gi,""),n=n.checked?' rel="nofollow"':"",e=e.checked?' target="_blank"':"",u+='"+a+"",0",Array.from(l).forEach(function(e){let t=e.querySelector(".submenu-level1-inner ");var l=e.querySelectorAll(".submenu-level2-outer"),n=t.lastElementChild.querySelector(".rel");e=t.lastElementChild.querySelector(".target");let r=t.querySelector(".urlsubmenu"),a=t.querySelector(".submenuname");u+=0':"\n\t",r=""!=r.value?r.value:"#",a=""!=a.value?a.value:"SubMenu",r.replace(/\s/g,"%20"),a=a.replace(/(<([^>]+)>)/gi,""),n=n.checked?' rel="nofollow"':"",e=e.checked?' target="_blank"':"",u+='"+a+"",0",Array.from(l).forEach(function(e){let t=e.querySelector(".submenu-level2-inner ");var l=t.lastElementChild.querySelector(".rel");e=t.lastElementChild.querySelector(".target");let n=t.querySelector(".urlsubsubmenu"),r=t.querySelector(".subsubmenuname");u+="\n\t\t",n=""!=n.value?n.value:"#",r=""!=r.value?r.value:"SubSubMenu",n.replace(/\s/g,"%20"),r=r.replace(/(<([^>]+)>)/gi,""),l=l.checked?' rel="nofollow"':"",e=e.checked?' target="_blank"':"",u+='"+r+""}),u+="\n\t\t\n\t"),u+=""}),u+="\n\t\n"),u+="\n"}),t.value=u}),e.addEventListener("focusin",function(e){e.target.classList.contains("error")&&e.target.classList.remove("error")})}(document);