class UX{static contentType="application/json;charset=UTF-8";static asyncType="application/x-www-form-urlencoded; charset=UTF-8";static cacheControl="no-cache";static allowOrigin="*";static thread=0;static array=[];init={name:"UX.js",version:"1.157",copyright:"(c) 2024 flaneurette",license:"GNU",instanceid:1e5};load(e){if(!Object(e))return this.log(this.Message.initialize),!1;{let t=e.data,i=e.methods;e.events,this.parseNodes(t),Reflect.preventExtensions(t),t&&(this.nodes("renderComponents",t),this.nodes("routeComponents",t),this.parseFunctions(t,i),Reflect.has(t,"devtools")&&this.nodes("devtools",t))}}nodes(e,t,i,n=null,l=null,s=null){let d=this.nodeParentList();for(let r=0;r{let e=this.dom("","elements","*");for(let t=0;t{this.dom(t,"id").scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})})}bindScroll(e){null!==this.getAtt(e,"scroll")&&(e.setAttribute("href","javascript:void(0);"),e.addEventListener("click",()=>{window.scroll({top:0,left:0,behavior:"smooth"})}))}bindSlide(e){let t=this.getAtt(e,"slide");if(null!==t){let i=t.split(":");e.addEventListener(Reflect.get(i,0),()=>{event.deltaY>=1?"height"==Reflect.get(i,2)?this.dom(Reflect.get(i,1),"id").style.height=0:this.dom(Reflect.get(i,1),"id").style.width=0:"height"==Reflect.get(i,2)?this.dom(Reflect.get(i,1),"id").style.height=Reflect.get(i,3):this.dom(Reflect.get(i,1),"id").style.width=Reflect.get(i,3)})}}bindSwitch(e){let t=this.getAtt(e,"switch");if(null!==t){let i=t.split(":");e.addEventListener(Reflect.get(i,0),()=>{let t=Reflect.get(i,1);e.setAttribute("id",t)})}}bindActive(e){let t=this.getAtt(e,"active"),i=this.dom("","location");if(null!==t&&-1!=t.indexOf(":")){let n=t.split(":");i.match(Reflect.get(n,0))&&(e.className=Reflect.get(n,1).toString())}}bindSelect(e){let t=this.getAtt(e,"select");null!==t&&(e.className=t.toString())}bindFlex(e){let t=this.getAtt(e,"flex");if(null!==t&&-1!=t.indexOf(":")){let i=t.split(":"),n="display:flex;",l="flex-direction:"+Reflect.get(i,1)+";";("true"==Reflect.get(i,0)||"1"==Reflect.get(i,0)||"start"==Reflect.get(i,0)||"left"==Reflect.get(i,0))&&e.setAttribute("style",n+l),("end"==Reflect.get(i,0)||"right"==Reflect.get(i,0))&&e.setAttribute("style",n+"justify-content: flex-end;"+l),"center"==Reflect.get(i,0)&&e.setAttribute("style",n+"justify-content: center;"+l),"bottom"==Reflect.get(i,0)&&e.setAttribute("style",n+"align-items: baseline;"+l)}}bindAnimate(e){let t=this.getAtt(e,"animate");if(null!==t&&-1!=t.indexOf(":")){let i=t.split(":"),n=this.dom("","create","style");n.textContent="@keyframes "+Reflect.get(i,0)+"{ from { "+Reflect.get(i,5).toString()+": var(--from);} to {"+Reflect.get(i,5).toString()+":var(--to);}}",document.body.appendChild(n),e.style="position: relative; --from:"+Reflect.get(i,3)+"px; --to:"+Reflect.get(i,4)+"px; animation: "+Reflect.get(i,0)+" "+Reflect.get(i,2)+" forwards; animation-timing-function: "+Reflect.get(i,1)+";"}}bindFade(e){let t=this.getAtt(e,"fade");if(null!==t){let i=(i,n)=>{i.forEach(i=>{!0===i.isIntersecting&&(e.clientHeight,i.target.setAttribute("class",t))})},n=new IntersectionObserver(i,{threshold:1});if(e.id){let l=this.dom("","query","#"+e.id);n.observe(l)}}}bindIntoView(e){let t=this.getAtt(e,"grow");if(null!==t){let i=(i,n)=>{i.forEach(i=>{!0===i.isIntersecting&&(e.clientHeight,i.target.setAttribute("class",t))})},n=new IntersectionObserver(i,{threshold:1});if(e.id){let l=this.dom("","query","#"+e.id);n.observe(l)}}}bindCascade(e,t){let i=this.getAtt(e,"cascade");if(null!==i){let n=i.split(":"),[l,s,d,r]=n,o=e.children;for(let a=0;a{document.location=t}))}bindHamburger(e){let t=this.getAtt(e,"hamburger");if(null!==t&&-1!==t.indexOf(":")){let i=t.split(":"),n=Reflect.get(i,1),l=Reflect.get(i,2);if(null==this.dom("uxcanvas","id")){let s=this.dom("","create","canvas");e.append(s),s.setAttribute("width",n),s.setAttribute("height",n),s.setAttribute("id","uxcanvas");var d=s.getContext("2d");d.strokeStyle=Reflect.get(i,0),l||(l=0),d.lineWidth=2,d.moveTo(n,l),d.lineTo(0,l),d.stroke(),d.moveTo(n,2*l),d.lineTo(0,2*l),d.stroke(),d.moveTo(n,3*l),d.lineTo(0,3*l),d.stroke()}}}bindCSS(e){let t=this.getAtt(e,"css");null!==t&&(e.style=t)}bindToggle(e){let t=this.getAtt(e,"toggle");if(null!==t&&-1!==t.indexOf(":")){let i=this.getAtt(e,"toggle").split(":"),n=this.dom(Reflect.get(i,0),"id");n&&n.addEventListener("mouseleave",()=>{let t=e.getAttribute(":toggle");if(null!==t&&-1!==t.indexOf(":")){let i=t.split(":");Reflect.get(i,2)&&this.dom(Reflect.get(i,0),"id").classList.toggle(Reflect.get(i,2))}}),e.addEventListener("click",()=>{let t=this.getAtt(e,"toggle").split(":"),i=this.dom("","document");for(let n=0;n{this.dom(Reflect.get(i,0),"id").hidden=!1})}"out"==Reflect.get(i,1)&&e.addEventListener("mouseout",()=>{let t=e.getAttribute(":menu");if(null!==t&&-1!==t.indexOf(":")){let i=t.split(":");this.dom(Reflect.get(i,0),"id").hidden=!0}})}}bindFunctions(e,t,i,n){let l=this.getAtt(e,"click");this.dom("","elements","*");let s,d,r,o,a,h,g=0;for(let[u,c]of Object.entries(t))"id"==u&&(s=c),"count"==u&&(d=c),"countvalue"==u&&(g=c),"multiply"==u&&(r=c),"countdown"==u&&(o=c),"interval"==u&&(a=c),"clear"==u&&(h=c);if(null!==l){let b=this.dom(s,"id");b&&e.addEventListener("click",()=>{var e=Number(b.innerText);if("count++"==l&&(b.innerText=this.isInt(e+g)),"count--"==l&&(b.innerText=this.isInt(e-g)),"multiply"==l&&(b.innerText=this.isInt(e*r)),"countdown"==l){let t=setInterval(()=>{b.innerText=this.isInt(Number(b.innerText)-g),Number(b.innerText)<=h&&clearInterval(t)},a)}})}}bindMethods(e,t,i,n,l){Function(i).apply()}bindPrevent(e,t,i){null!==this.getAtt(e,"prevent")&&documentElements[j].addEventListener("submit",e=>{e.preventDefault()})}bindClose(e){let t=this.getAtt(e,":close");null!==t&&e.addEventListener("onclick",()=>{this.dom(t,"id").hidden=!0})}onImg(e,t){this.regEx("spaces"),this.regEx("punctuation");let i=e.getAttribute(":method");if(null!==i[2]){for(let n=0;n=1){let i=this.regEx("spaces"),n=this.regEx("punctuation"),l=this.dom("","document"),s=0;for(let d=0;d{o.apply()}),UX.thread++}}}bindMethods(e,t,i,n,l){let s=this.getAtt(e,"method"),d=[];if(!0==this.attributeCheck(e,"method")&&null!==s){let r=s.split(":");if(i&&Object(i)){for(let o in i){let a=i[o].toString().split("\n");for(let h=0;h{let t=this.getAtt(e,"method").split(":"),i=Object.assign({},t.splice(3,t.length));Object.keys(i).length>1&&UX.array.push(i)})}}UX.counter++,d.length>=1&&this.onImgFill(e,d)}("mouseover"==r[0]||"click"==r[0])&&e.addEventListener(r[0],()=>{this.dom("","innerHTML");if(null!==e.getAttribute(":method")&&i&&Object(i))for(let t in i){let n=i[t],l=n.toString().split("\n");for(let s=0;s0&&l.indexOf("has")){let s=this.has(Reflect.get(l,1)).toString();e.hidden=-1==i.indexOf(s)}}else if(n.search("/s/")){let d="",r=n.split("s");e.hidden=!0;for(let o=0;o{let e=i.split(":"),n=Reflect.get(e,1),l=this.dom(Reflect.get(e,0),"id");for(let s=0;se.text()).then(e=>l.setHTMLUnsafe(e)).then(()=>this.renderHTML(l,t)).then(()=>this.parseNodes(t))})}}renderComponents(e,t){let i=this.getAtt(e,"render");if(null!==i){let n=new Headers;n.append("Cache-Control",UX.cacheControl),fetch(i,n).then(e=>e.text()).then(t=>e.setHTMLUnsafe(t)).then(()=>this.renderHTML(e,t)).then(()=>this.parseNodes(t))}}renderHTML(e,t){for(let[i,n]of Object.entries(t))if(Array.isArray(n)){let l=0;for(let[s,d]of Object.entries(n)){let r=Object.entries(n[l]);e.innerHTML=e.innerHTML.replaceAll("{{"+r[0][0]+"}}",r[0][1]),l++}}else e.innerHTML=e.innerHTML.replaceAll("{{"+i+"}}",n)}fetch(e){if(Object(e)){let t=this.nodeParentList();for(let i=0;i1&&setTimeout(()=>{s.style.width=0},1e3),n++}),n=0,l=t.split(":"),s=this.dom("","query","#"+Reflect.get(l,1));i.observe({type:"resource"})}}async(e,t,i){let n=!1,l=this.nodeParentList();for(let s=0;s{t.preventDefault();let n=this.dom("","elements","*");for(let l=0;l{4==d.readyState&&200==d.status&&d.responseText&&i(d.responseText)},d.send(r)}})}http(e,t,i){let n=new XMLHttpRequest;n.open("GET",e,!0),n.withCredentials=!0,n.setRequestHeader("Access-Control-Allow-Origin",UX.allowOrigin),n.setRequestHeader("Content-Type",UX.contentType),"callback"==t?(n.onreadystatechange=()=>{4==n.readyState&&200==n.status&&i(n.responseText)},n.send()):"get"==t?(n.onreadystatechange=()=>{if(4==n.readyState&&200==n.status)return JSON.parse(n.responseText)},n.send()):"render"==t&&(n.onreadystatechange=()=>{if(4==n.readyState&&200==n.status)return n.responseText},n.send())}createElements(e,t,i){let n=this.dom("","create",t);"text"==i.type&&this.dom("","create","input"),i.name&&(n.name=i.name),i.type&&"textarea"!=i.type&&(n.type=i.type),i.value&&(n.value=i.value),i.label&&(n.innerHTML=i.label),i.placeholder&&(n.placeholder=i.placeholder),i.required&&(n.required=i.required),i.checked&&(n.checked=i.checked),e.appendChild(n)}createForm(e,t,i){if(null!==this.getAtt(e,"form")){let n=this.dom("","create","div");e.appendChild(n);let l=this.dom("","create","form");for(let s in i){let d=i[s];if("form"==d.type&&(l.name=d.name,l.action=d.action,l.method=d.method,d.enctype&&(l.enctype=d.enctype)),"textarea"!=d.type&&"submit"!=d.type)this.createElements(l,"label",d),this.createElements(l,"input",d);else if("textarea"==d.type)this.createElements(l,"label",d),this.createElements(l,"textarea",d);else if("submit"==d.type){let r=this.dom("","create","input");r.type=d.type,r.name=d.name,r.value=d.value,l.appendChild(r)}}n.appendChild(l)}}bindDevtool(e){""!==e.className&&""!==e.id?(e.setAttribute("title","CLASS: "+e.className+", ID: "+e.id),e.style="border: 1px dashed green;"):""!==e.className?(e.setAttribute("title","CLASS: "+e.className),e.style="border: 1px dashed black;"):""!==e.id&&(e.setAttribute("title","ID: "+e.id),e.style="border: 1px dashed red;")}log(e){console.log(e)}Message={initialize:"UX: Cannot initialize a non-object.",enumerate:"UX: Could not enumerate global object."}}