diff --git a/inter.min.js b/inter.min.js index 8d84bc6..2669a70 100644 --- a/inter.min.js +++ b/inter.min.js @@ -1,9 +1,11 @@ /** * Inter. - * Version: 1.1.2 + * Version: 1.1.3 * 2021 - by Denis Power. * https://github.com/DenisPower1/inter * A Javascript framework to build interactive frontend applications. + * + */ -!function(){function e(e){return"[object Object]"==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)}function n(e){return"function"==r(e)}function r(e){return typeof e}function o(e){return e in this}function s(e){return void 0!==e&&null!=e}function l(e){return 1==e||0==e}function a(e){const t=e.tagName;return"input"==he.call(t)||"textarea"==he.call(t)}function i(e){if("production"==te.status||"development"!=te.status)return!1;throw new SyntaxError(e)}function c(e){if("production"!=te.status&&"development"==te.status)throw new TypeError(e)}function u(e){const t=document.getElementById(e);if(void 0!=t)return t;i(`\n There is not an element by id ${e} in document.\n `)}function d(e){"production"!=te.status&&"development"==te.status&&console.warn(e)}function h(e){return document.createTextNode(e)}function f(e,t){if(D(e))return e.hasAttribute(t)}function p(e){return document.createElement(e)}function g(e,t,n){return void 0==e?void 0:e.setAttribute(t,n)}function m(e,t){return void 0==e?void 0:e.getAttribute(t)}function y(e){return 1==e}function b(e){return"a"==he.call(e.nodeName)||"button"==he.call(e.nodeName)}function v(e){const t=p(e.nodeName);for(let n of e.children){const e=n.cloneNode(!0);if(Object.entries(n).forEach(t=>{const[n,r]=t,o=n.replace("_","");e[o]=r,n.startsWith("_")&&(e[n]=r)}),M(n)){let t=-1;for(let r of n.children){t++;const n=r.cloneNode(!0);Object.entries(r).forEach(e=>{const[t,r]=e,o=t.replace("_","");n[o]=r}),e.replaceChild(n,e.children[t])}}t.appendChild(e)}return t}function x(e,t){return!Object.is(e,t)}function w(){}function O(){try{let e=new Map;return e.set("Libray","Inter"),e.set("Creator","Denis"),e.clear(),!0}catch(e){return!1}}function j(e,t){if(function(e,t){const n=he.call(e.nodeName),r=he.call(t.nodeName);return o.call({video:!0,audio:!0,input:!0,textarea:!0},n)&&!x(n,r)}(e,t)){const n=ae(e,t),r=e.attributes,o=t.attributes;for(let s=0;n>s;s++){const n=r[s],l=o[s];f(e,l.name)?x(l.value,n.value)&&("value"!=l.name?g(t,l.name,n.value):t.value=n.value):t.removeAttribute(l.name)}}else{const r=e.attributes,o=t.attributes;if(n=t,Object.is(e.textContent,n.textContent))if(r.length!=o.length)t.parentNode.replaceChild(e,t);else for(let n of r){if(!f(t,n.name)){t.parentNode.replaceChild(e,t);break}if(f(t,n.name)&&x(m(t,n.name),n.value)){t.parentNode.replaceChild(e,t);break}}else t.parentNode.replaceChild(e,t)}var n}function C(e){return void 0!=e&&1==e.nodeType}function E(t){if(void 0!==new.target&&i("\n You must not create an instance for whileLoading() function. \n "),e(t)){const{elements:e}=t;let r=null;[...e].forEach(e=>{const{tag:t,attrs:o={},events:l={},children:a}=e;s(a)&&!N(a)||i("\n Oh, you must define the children array, and it must not be empty.\n ");const c=p(t);Object.entries(o).forEach(e=>{const[t,n]=e;g(c,t,n)}),Object.entries(l).forEach(e=>{const[t,n]=e;c[t]=n}),a.forEach(e=>{const{tag:t,events:r={},attrs:o={},text:l}=e,a=p(t);Object.entries(r).forEach(e=>{const[t,n]=e;a[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;g(a,t,n)}),s(l)&&(n(l)?a.appendChild(h(l())):a.appendChild(h(l))),c.appendChild(a)}),r=c,document.body.appendChild(c)}),document.onreadystatechange=function(){"complete"==this.readyState&&this.body.removeChild(r)}}else i("\n The value passed as argument in the method \n whileLoading() must be any object.\n \n ")}function N(e){return 0==e.length}function T(r){const{elements:o}=r;t(o)||i('\n The property "elements" must be an array.\n ');let l=oe.create(null);return o.forEach(t=>{e(t)||i('\n The itens of array "elements" must be objects with at least\n "tag" property. \n ');const{tag:r,text:o,attrs:a={},events:c={},children:u=[],handlers:d={},styles:f={}}=t,m=p(r);Object.entries(a).forEach(e=>{const[t,r]=e;n(a[t])?s(a[t]())&&g(m,t,a[t]()):s(r)&&g(m,t,r)}),Object.entries(c).forEach(e=>{const[t,n]=e;m[t]=n,m.rerender=!0}),Object.values(d).forEach(e=>{if(n(e))return m.rerender=!0,d[e].call(m)}),Object.entries(f).forEach(e=>{const[t,r]=e;n(r)?s(r())&&(m.style[t]=r()):s(r)&&(m.style[t]=r)}),N(u)||u.forEach((e,t)=>{const{tag:r,text:o,attrs:l={},events:a={},render:i,handlers:c={},styles:u={},children:d=[]}=e,f=p(r);x(i,!0)&&x(i,!1)||(f.render=i,f.index=t),Object.entries(l).forEach(e=>{const[t,r]=e;n(r)?s(r())&&g(f,t,r()):s(r)&&g(f,t,r)}),Object.entries(a).forEach(e=>{const[t,n]=e;f[t]=n,f[`_${t}`]=n,f.rerender=!0}),Object.values(c).forEach(e=>{if(n(e))return f.rerender=!0,c[e].call(f)}),Object.entries(u).forEach(e=>{const[t,r]=e;f.style[t]=n(r)?r():r}),s(o)&&(n(o)?f.appendChild(h(o())):f.appendChild(h(o))),Array.from(d).forEach((e,t)=>{const{tag:r,text:o,render:l,attrs:a={},events:i={},handlers:c={},styles:u={}}=e,d=p(r);x(l,!0)&&x(l,!1)||(d.render=l,d.index=t),Object.entries(a).forEach(e=>{const[t,r]=e;n(r)?s(r())&&g(d,t,r()):s(r)&&g(d,t,r)}),Object.entries(i).forEach(e=>{const[t,n]=e;d[t]=n,d[`_${t}`]=n,d.rerender=!0}),Object.values(c).forEach(e=>{n(e)&&(d.rerender=!0,e())}),Object.entries(u).forEach(e=>{const[t,r]=e;d.style[t]=n(r)?r():r}),s(o)&&(n(o)?d.appendChild(h(o())):d.appendChild(h(o))),"null"!=he.call(d.tagName)&&"undefined"!=he.call(d.tagName)&&f.appendChild(d)}),"null"!=he.call(f.tagName)&&"undefined"!=he.call(f.tagName)&&m.appendChild(f)}),s(o)&&(n(o)?m.appendChild(h(o())):m.appendChild(h(o))),"null"!=he.call(m.tagName)&&"undefined"!=he.call(m.tagName)&&l.push(m)}),l}function R(){}function P(){let e=null;var t=document.getElementsByTagName("*");for(let n=0;n{let t=ve.handler[l];for(let n of t){const{target:t,text:o}=n,s=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(s.test(o)){let n=o.replace(s,e.target.value);t.textContent=n}}})}else i("\n Really? handleValue must be only setted in value that recieve value.\n ");Ce.fire(`handler${e}`)}function $(){}function A(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0})}function S(e){return 0==Object.keys(e).length}function k(){}function I(e){return e.getElementsByTagName("*").length>0}function L(t){if(e(t)){let{in:o,data:l,handleValue:a,react:i}=t;const c=Object.assign(Object.create(null),l);Object.getOwnPropertyNames(l).forEach(e=>{Object.defineProperty(l,e,{get:()=>c[e]}),n(l[e])&&(c[e]=l[e].call(l))}),se.hasRefContainer(o)?(Object.destroyAll(Ne.handler),Object.destroyAll(Pe.handle),Object.destroyAll(Ae.storage),Object.destroyAll(Se.storage),Object.destroyAll(re[ne])):se.refContainer(o);const d=u(o).getElementsByTagName("*"),h=0!=d.length;Ce.listen(`handler${o}`,()=>{const t=Object.create(null);e(a)&&(Object.entries(a).forEach(e=>{const[n,r]=e;t[n]=r}),Object.entries(a).forEach((e,n)=>{const[r,s]=e;let l=ve.handler[o];for(let e of l){const{target:n,text:o,input:l}=e,a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(a.test(o)){const e=o.replace(a,s);n.textContent=e}let i=new Proxy(t,{get:()=>l.value,set(e,t,s,l){const a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g"),i=o.replace(a,s);n.textContent=i}});window[r]=i}}))});const f=u(o).getElementsByTagName("*");var r=Object.keys(l);0==f.length&&(Ne.create(o),Ne.add(o,{target:u(o),text:u(o).textContent}));for(let e=0;e{const{text:l,target:a,attrName:i,attrValue:c}=e,u=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");if(s(l))u.test(l)&&re.has(o)&&re.reConstroy(o,t,n);else if(u.test(c)){const e=c.replace(u,n);e==c||("value"!=i?g(a,i,e):a.value=e)}});else{const s={refName:t,refValue:n,refContainer:o};Reflect.set(e,t,n,r),function(e){const{refName:t,refValue:n,refContainer:r}=e,o=u(r).getElementsByTagName("*"),s=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");for(let e of o)if(M(e)){const o=e.childNodes;for(let e of o)if(s.test(e.textContent)){Ne.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);re.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}}else if(s.test(e.textContent)){Ne.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);re.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}for(let e of o){const t=e.attributes;for(let o=0;oPe.has(t)?Pe.get(t).value:Reflect.get(e,t,n),deleteProperty(e,t,n){$e.has(t)&&(Reflect.deleteProperty(e,t,n),$e.delete(t),Ne.handler[o].forEach((e,n)=>{const{target:r,text:l,attrName:a,attrValue:i}=e,c=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");s(a)&&c.test(i)&&Ne.handler[o].splice(n,1),s(l)&&c.test(l)&&Ne.handler[o].splice(n,1)}))}}),enumerable:!0,configurable:!0,writable:!0}),window[i]=e[i]}if(!S(l)&&s(l)){if(!Se.has(o)){const e=u(o).getElementsByTagName("*"),t=0==d.length;let n=oe.create(null),r=oe.create(null);if(t){const e=u(o).textContent;Object.getOwnPropertyNames(l).forEach(t=>{RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g").test(e)&&(n.push({target:u(o),text:e,position:null}),Se.set(o,n))})}else for(let t=0;t{let[t,n]=e;const r=Se.get(o),l=Ae.get(o);re.create(o);let a=re.get(o);oe.shareItens(r,a);for(let e=0;e-1;e--){if(M(l[e])){const t=l[e].children,n=o[e].children;if(t.length==n.length){for(let e=n.length-1;e>-1;e--)Y(n[e],t[e])&&n[e].parentNode.replaceChild(t[e],n[e]);continue}o[e].parentNode.replaceChild(l[e],o[e])}else Y(o[e],l[e]);s(o[e])&&s(l[e])&&!M(l[e])&&Y(o[e],l[e])&&(M(l[e])||o[e].parentNode.replaceChild(l[e],o[e]))}}else{const r=t.children[n];Y(r,e)&&t.replaceChild(e,r)}}function Y(e,t){let n=!1;const r=e.attributes,o=t.attributes;if(x(t.rerender,!0)||(n=!0),!n)if(r.length!==o.length)n=!0;else for(let t of o){const r=t.name,o=t.value;if(!f(e,r)){n=!0;break}if(f(e,r)&&m(e,r)!==o){n=!0;break}}return n||e.textContent&&t.textContent&&(n=e.textContent!==t.textContent),n}function B(e,t){const n=Object.assign({},e);Object.keys(e).reduce((r,o)=>{Object.defineProperty(e,[o],{set(e){n[o]=e,t()},get:()=>n[o]})},[])}function _(){return!!window.location.hash}function U(t){if(e(t)){const{routes:e}=t,r=Object.create(null);if(Object.entries(e).forEach(e=>{const[t,o]=e;if(ee.test(t)||"*"==t||i("\n Route name must start with /.\n "),n(o)||i("\n Route action must be a function.\n "),t.includes("/*")){const e=t.replaceAll("*","(:?[\\s\\S]+)");r[e]=o}else"*"!==t&&(r[t]=o)}),n(e["*"])&&Ie.set("*",e["*"]),_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(Ie.hasNotFound()?Ie.get():d('\n You should always create a notfound route with "*" property.\n '))}else{let e=!1;const t=window.location.pathname;Object.keys(r).some(n=>{/(?:)/.compile(n).test(t)&&(e=!0,r[n]())}),e||(Ie.hasNotFound()?Ie.get():d('\n You should always create a notfound route with "*" property.\n '))}Ce.listen("URLCHANGED",()=>{if(_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(Ie.hasNotFound()?Ie.get():d('\n You should always create a notfound route with "*" property.\n '))}else{const e=window.location.pathname;let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(Ie.hasNotFound())return Ie.get();d('\n You should always create a notfound route with "*" property.\n ')}}}),window.onpopstate=(()=>{if(_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(Ie.hasNotFound())return Ie.get();d('\n You should always create a notfound route with "*" property.\n ')}}else{const e=window.location.pathname;let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(Ie.hasNotFound()?Ie.get():d('\n You should always create a notfound route with "*" property.\n '))}})}else i("\nThe argument of ROUTER() must be an object.\n");(function(){const e=this.getElementsByTagName("*");for(let t of e)b(t)&&f(t,"setPath")&&(t.onclick=(e=>{e.preventDefault();const n=m(t,"setPath");ee.test(n)?ye.setPath(n):i("\n A valid pathName must start with /.\n ")})),b(t)&&f(t,"useHash")&&(t.onclick=(e=>{e.preventDefault();const n=m(t,"useHash");ee.test(n)?ye.useHash(n):i("\n A valid pathName must start with /.\n ")}))}).call(document.body)}function V(e){const t=oe.create(null),n=u(e).getElementsByTagName("*");for(let r=0;r0}function q(){this[Symbol()]=Object.create(null)}function D(e){return 1==e.nodeType}function W(){}function G(e,t,r,s){Object.entries(t).reduce((t,r)=>{const[o,l]=r;void 0==l||o.startsWith("on")?o.startsWith("on")&&n(l)&&(e[o]=function(e){l.call(s,e)}):g(e,o,l)},{}),Object.entries(s).reduce((t,r)=>{const[o]=r;Object.defineProperty(s,o,{set(t){void 0==t?o.startsWith("on")?e[o]=void 0:e.removeAttribute(o):o.startsWith("on")?(n(t)||i(`\n The value of "${t}" event, must be a function.\n `),e[o]=function(e){t.call(s,e)}):g(e,o,t)},get(){if(!o.startsWith("on"))return m(e,o);i(`\n "${o}" seems to be an event listener, \n and you can not get the value of an event.\n `)}})},{});const l=Object.create(null);Object.defineProperty(l,[r],{value:new Proxy(t,{set(t,r,s,l){if(o.call(t,r)){if(void 0==s)return r.startsWith("on")?e[r]=void 0:e.removeAttribute(r),!1;if("value"!=r&&!r.startsWith("on"))return g(e,r,s),Reflect.set(t,r,s,l),!1;"value"==r?(e.value=s,Reflect.set(t,r,s,l)):r.startsWith("on")&&(n(s)||i(`\n Oh, the value of "${r}" event, must be a function.\n `),e[r]=function(e){s.call(t,e)})}},get(t,n,r){if(!n.startsWith("on"))return e[n];i(`"${n}" seems to be an event listener, and you can\n not get the value of an event`)}})}),window[r]=l[r]}function z(t){if(e(t)){const{in:n,data:r}=t,o=u(n);e(r)?function(e,t){const n=Object.getOwnPropertyNames(t),r=e.getElementsByTagName("*");for(let e of r)if(1==e.attributes.length){const r=e.attributes[0].name;for(let o of n)if(RegExp(`{...${o}}`).test(r)){const n=Object.assign({},t[o]);e.removeAttribute(r),G(e,n,o,t[o]);break}}}(o,r):i("\ndata in toATTR() must be an object.\n")}else i('\n The argument in "toATTR()" function must be an object.\n ')}function F(e,t){return x(e.index,t.index)}function Z(t){if(void 0!==new.target&&i('\n "reativeTemplate" is not a construtor, do not invoke it with "new" keyword.\n '),e(t)){const{react:e,in:n,render:r}=t,o=u(n),s=new Proxy(e,{set(...e){Reflect.set(...e);const t=r.call(s);for(let e=0;ec;c++){const e=s[c],u=void 0==r.children[c]?r.children[r.children.length-1]:r.children[c],d=e.render;if(M(o.children[c]))for(let t=0;t{if(void 0!==u)return void 0==u.children[t]?u.children[u.children.length-1]:u.children[t]},o=e.children[t],s=o.render;x(s,!0)?x(s,!1)||void 0===n()||F(o,n())||i.push({el:n(),parent:void 0==u?r.children[r.children.length-1]:u}):(void 0==n()||F(o,n()))&&(l.push({id:t,el:o,parent:void 0==u?r.children[r.children.length-1]:u}),a=!0)}x(d,!0)?x(d,!1)||void 0===u||F(u,e)||(t.push({el:u,id:c}),a=!0):(void 0==u||F(e,u))&&(n.push({id:c,el:e}),a=!0)}for(let e of t){const{el:t}=e;r.removeChild(t)}for(let e of i){const{el:t,parent:n}=e;n.removeChild(t)}for(let e of l){const{el:t,id:n,parent:r}=e;if(void 0==r.children[n])r.appendChild(t);else{const e=r.children[n];r.insertBefore(t,e)}}for(let e of n){const{id:t,el:n}=e;void 0==r.children[t]?r.appendChild(n):r.insertBefore(n,r.children[t])}}(),a){let e=o.children.length;for(let t=0;e>t;t++){const n=o.children[t];if(x(n.render,!1)){if(M(n))for(let e of n.children)x(e.render,!1)||n.removeChild(e)}else o.removeChild(n),t--,e--}}else{const e=l.children.length;for(let t=0;e>t;t++){const e=l.children[t];if(void 0==e)continue;const n=void 0!==e?e.render:void 0;if(e.children.length>0)for(let t of e.children)x(t.render,!1)||e.removeChild(t);void 0!=n&&0==n&&(l.removeChild(e),t--)}}ie.change(a?o:l,r)}function K(r){if(void 0!==new.target&&i('\n "renderContainer" is not a constructor, do not call it\n with the "new" keyword.\n '),e(r)){const{in:e,data:c,react:h}=r,p=function(e){const t=e.children,n=oe.create(null),r=oe.create(null);let o=-1;for(let e of t)if(o++,f(e,"_istrue")){f(e,"_default")&&i("\n A container can not have two reative attributes.\n ");const t=m(e,"_istrue");e.istrue=!0;const s={ifTrue:e,cond:t.trim(),index:o},l=e.nextElementSibling;C(l)&&f(l,"_default")&&(f(l,"_istrue")&&i("\n A container can not have two reative attributes.\n "),l.default=!0,s.default=l,l.removeAttribute("_default"),r.push(l)),e.removeAttribute("_istrue"),r.push(e),n.push(s)}for(let t of r)e.removeChild(t);return n}(u(e)),g=Object.assign({},c),y=Object.assign({},c),b=Object.getOwnPropertyNames(c);for(let e of b)Object.defineProperty(g,[e],{set(t){y[e]=t,a()},get:()=>y[e]});const v=oe.create(null);let w=!1;function a(){for(let t of p){const{cond:r,ifTrue:a,default:i,index:c}=t,h=u(e),f=h.children;if(o.call(g,r)){const e=n(g[r])?g[r]():g[r];if(l(e)||d(`\n The values of properties in data object, in renderContainer(), must be\n only boolean(true/false), and in property "${r}" you defined\n "${e}" as its value.\n `),!x(e,!0)&&s(i)){if(void 0==f[c]){h.appendChild(a);continue}if(f[c].isSameNode(a));else{if(f[c].default){h.replaceChild(a,i);continue}h.insertBefore(a,f[c])}}else{if(!x(e,!1)&&s(i)){if(void 0==f[c]){h.appendChild(i);continue}if(f[c].isSameNode(i));else{if(f[c].istrue){h.replaceChild(i,a);continue}h.insertBefore(i,f[c])}}if(!x(e,!0)&&!s(i)){if(void 0==f[c]){h.appendChild(a);continue}f[c].isSameNode(a)||h.insertBefore(a,f[c])}}x(e,!1)||s(i)||null!==a.parentNode&&h.removeChild(a)}}}Object.defineProperty(g,"register",{set(e){if(t(e)||i(`\n The value in ${h}.register must be an array.\n `),w&&i("\n You can only register the properties once.\n "),N(e))i("\n The array is empty.\n ");else{for(let t of e)o.call(c,t)?(v.push(t),w=!0):d(`\n There is not a property called "${t}"\n in ${h}\n `);Object.defineProperty(this,"setRegistered",{enumerable:!1,configurable:!1,set(e){if(l(e))for(let t of v)Q[h][t]=e;else i("\n The setRegistered property only accepts\n boolean value, true or false.\n ")}}),Object.seal(this)}}}),Q[h]=g}else i('\n The argument in "renderContainer" must be a n object.\n ');a()}Object.destroyAll=(e=>{const t=Object.keys(e);for(let n of t)delete e[n]});const Q=globalThis||function(){return window||self||global||void 0},ee=/^\/(:?[\s\S]+)|\/$/;var te={status:"development"};const ne=Symbol(),re={[ne]:Object.create(null),create(e){return this[ne][e]=oe.create(null)},set(e,t){this[ne][e].push(t)},get(e){return this[ne][e]},has(e){return e in this[ne]},reConstroy(e,t,n){let r=this.get(e);for(let e of r){const{text:r,target:s,refs:l}=e;o.call(l,t)&&(l[t]=n);let a=r,i=Object.getOwnPropertyNames(l);for(let e of i){const t=RegExp(`{(:?\\s+)*(:?${e})(:?\\s+)*}`,"g");a=a.replace(t,l[e])}s.textContent=a}}};w.prototype.create=(e=>null==e?[]:[...e]),w.prototype.shareItens=((e,t)=>{for(let n of e)t.push(n)}),w.prototype.destroy=(e=>{let t=e.length;for(;t--;)e.pop()});var oe=new w;const se={handleMemomory:oe.create(null),refContainer(e){this.handleMemomory.push(e)},hasRefContainer(e){let t=null;return this.handleMemomory.some(n=>t=e==n),t}},le=new Proxy(te,{set(e,t,n,r){if("status"==t&&"production"==n&&(console.log("You're using Inter in production mode."),Reflect.set(e,t,n,r)),"status"!=t||"development"!=n)return!1;console.log("You're using Inter in development mode. When you deploy your app turn on production mode."),Reflect.set(e,t,n,r)}}),ae=(e,t)=>{const n=e.attributes.length,r=t.attributes.length;return n>r?n:r},ie={applyChange:(e,t)=>(function(e,t){const n=t.children,r=e.children;for(let t=e.children.length-1;t>-1;t--){const e=r[t],o=n[t];if(J(e,o)&&C(e)&&C(o))o.parentNode.replaceChild(e,o);else if(M(e))for(let t=e.children.length-1;t>-1;t--)j(e.children[t],o.children[t]);else!J(e,o)&&C(e)&&C(o)&&j(e,o)}})(e,t),has:e=>has(e),change(e,t){M(e)&&M(t)&&this.applyChange(e,t)}};Object.defineProperty(window,"onload",{set(e){"inputHandler"!=e?window.addEventListener("load",t=>{"development"==le.status&&console.log("You're using Inter in development mode, when you deploy your app turn on production mode."),P(),n(e)&&e(t)}):window.addEventListener("load",P())},get(){}}),window.onload=(()=>{P()});var ce=new Proxy({url:function(e){return/^(?:http:\/\/|https:\/\/)+(:?[A-Z]{2,8}\.)*(:?[a-z]+)+\.+(:?[a-z]{2,8})+(:?[\s\S])*$/i.test(e)},email:function(e){return/^(?:[A-Z]+)+(:?[0-9]+)*@+(:?[A-Z]+)\.[A-Z]+$/i.test(e)}},{set:(e,t,n,r)=>"url"==t||"email"==t?(c("\n You must not overwrite built-in methods\n "),!1):Reflect.set(e,t,n,r),deleteProperty:(e,t)=>"url"==t||"email"==t?(c("\n You must not delete built-in methods\n "),!1):Reflect.deleteProperty(e,t)});const ue=new class{constructor(){}addHTML(t){if(e(t)){const{in:e,elements:n}=t,r=u(e);n.forEach(e=>{const{tag:t,text:n,children:o=[],attrs:l={},events:a={}}=e;let i=p(t);Object.entries(l).forEach(e=>{const[t,n]=e;g(i,t,n)}),Object.entries(a).forEach(e=>{const[t,n]=e;i[t]=n}),s(n)&&i.appendChild(h(n)),N(o)||o.forEach(e=>{const{tag:t,text:n,events:r={},attrs:o={}}=e,l=p(t);Object.entries(r).forEach(e=>{const[t,n]=e;l[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;g(l,t,n)}),s(n)&&l.appendChild(h(n)),i.appendChild(l)}),r.appendChild(i)})}else i("\n The argument passed in the method AddHTML must be a plain object.\n ")}},de=new Proxy(ue,{set:(...e)=>(i("You can not set any propriety in object Inter,\n this is a fatal action.\n "),!1),deleteProperty:(...e)=>(i("Fatal error: do not try to delete any propriety of Inter object"),!1),getPrototypeOf:e=>null,setPrototypeOf:(...e)=>!1}),he=String.prototype.toLowerCase,fe=new function(){this.query=function(n){if(e(n)){const{in:r,setting:s}=n,{applyTo:l,value:a,query:c}=s;e(s)||i("\n Setting must be an object.\n "),t(r)&&t(l)||i("\n The in=>target and the applyTo=>reciever properties must be array.\n ");let u=r.filter(e=>{o.call(e,c)||console.log(`There was not found a property called ${c} in target object.`);const t=e[c];if(he.call(t).includes(he.call(a)))return e});if(oe.destroy(l),""===a)return!1;oe.shareItens(u,l)}else i("\nThe argument in data.query() must be an object.\n")}};Object.defineProperty(fe,"query",{enumerable:!0,value:fe.query}),Object.freeze(fe),Object.defineProperty(ue,Symbol.hasInstance,{value:function(){return!1},enumerable:!1,configurable:!1,writable:!1});const pe={refHandler:Object.create(null),has:function(e){return e in this.refHandler},get:function(e){return this.refHandler[e]},addRef:function(e,t){return this.refHandler[e]=t},freeAll(){return Object.destroyAll(this.refHandler)}};A(de,"renderIf",n=>{const l=oe.create(null);if(e(n)){const{in:c,watch:d,conditions:h}=n;if(e(d)){const e=Object.create(null);!function(e,t){const n=Object.getOwnPropertyNames(e);for(let r of n)t[r]=e[r]}(d,e),Object.keys(d).forEach(t=>{Object.defineProperty(d,t,{set(n){e[t]=n,a()},get:()=>e[t]})})}function a(){const e=u(c);var n;l.length>0&&(l.forEach(t=>{const n=e.children[t];s(n)&&e.removeChild(n)}),oe.destroy(l)),t(h)||i("\n conditions must be an array.\n "),[...h].forEach((t,a)=>{const{render:u}=t;if(!s(u.call(t))&&o.call(l,t.index+"")){const n=e.children[t.index];e.removeChild(n),delete l[t.index+""]}if(n=u.call(t),/^\[object HTML+(:?[A-Z]+)+Element\]$/i.test(n)){const n=t.index,o=e.children[n];if("number"!=r(+n))i("\n The index in Inter.renderIf() must be a number.\n ");else{let r=e.children[n];if(1==e.children.length&&!s(t.replace)&&0==n){const t=e.children[0];return e.insertBefore(u()[a],t),l.push(n),!1}if(s(o)&&y(t.replace))return e.replaceChild(u()[0],o),l.push(n),!1;if(s(r))e.insertBefore(u()[0],r),l.push(n);else{const t=e.children.length-1;t+1==n?(e.appendChild(u()[a]),l.push(n)):i(`The last rendered children in element by id ${c} is at index ${t} and \n to render a children at index ${n}.\n `)}}}})}}a()});const ge=new class{constructor(){}typing(t){if(e(t)){const{in:e,setting:o,done:s}=t;var r=u(e);Array.from(o).forEach(e=>{const{text:t,speed:o}=e;let l=[...t][Symbol.iterator](),a=setInterval(()=>{let e=l.next().value;if(void 0!==e)pe.has(r)?(r.textContent=`${pe.get(r)}${e}`,pe.addRef(r,`${pe.get(r)}${e}`)):(r.textContent=e,pe.addRef(r,e));else if(clearInterval(a),n(s))return s()},+o)})}}cleaning(t){if(e(t)){const{in:e,speed:r,done:o}=t,l=u(e),a=[...l.textContent];let i=setInterval(()=>{a.pop(),l.textContent=function(e){let t=[...l.textContent];return t.pop(),t.reduce((e,t)=>e.concat(t),"")}(),s(a[0])||(clearInterval(i),pe.has(l)&&delete pe.refHandler[l],n(o)&&o())},+r)}else i("\n The value passed as argument in the method cleaning must be an object.\n ")}};var me=new Proxy(ge,{deleteProperty:(...e)=>(i("\n You can not delety any property in\n simulate object\n \n "),!1),defineProperty:(...e)=>!1,set:(...e)=>!0,getPrototypeOf:e=>null,setPrototypeOf:(e,t)=>!1});R.prototype.useHash=(e=>{ee.test(e)||i("\n pathName must starts with /.\n ");const t=window.location.pathname;return s(e)||d("You must define the path of the url."),"/"==e?(window.history.pushState(null,null,`/#${e}`),Ce.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,`/#${e}`),Ce.fire("URLCHANGED"),!1):(window.history.replaceState(null,null,`/#${e}`),void Ce.fire("URLCHANGED"))}),R.prototype.setPath=(e=>{const t=window.location.pathname;return ee.test(e)||i("\n Pathname must starts with /.\n "),s(e)||i("\n setPath's parameter must not be a null or undefined value.\n "),"/"==e?(window.history.pushState(null,null,e),Ce.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,e),Ce.fire("ULRCHANGED"),!1):(window.history.replaceState(null,null,e),void Ce.fire("URLCHANGED"))});const ye=Object.freeze(new R);let be=new Proxy(function(t){const{in:n}=t;if(e(t))return{only:()=>u([n]).value,done(e,t){u(n).oninput=(n=>{L({in:e,data:{[t]:n.target.value}})})}};i("\ngetValue()'s argument must be only an object.\n")},{construct(...e){i("\n You've create an instance for getValue, it's forbidden.\n ")}});const ve={handler:Object.create(null),justRegistered(e){return e in this.handler}},xe=String.prototype.toUpperCase;$.prototype.request=function(t){function r(){y(f)&&(p.withCredentials=!0);const t=xe.call(l);S(h)||!s(h)?p.open(t,a,!0):e(h)&&p.open(t,a,!0,h.username,h.password),Object.entries(u).forEach(e=>{const[t,n]=e;p.setRequestHeader(t,n)}),Object.entries(c).forEach(e=>{const[t,r]=e;"onerror"!=t&&"onload"!=t||i(`\n You can not listen for "${t}" event in backend.request(), it's ilegal.\n `),n(r)&&(p[t]=r.call(p))}),p.onload=function(){let e=null;try{JSON.parse(e),e=JSON.parse(this.responseText),n(o.okay)&&o.okay.call(p,e)}catch(t){e=this.responseText,n(o.okay)&&o.okay.call(p,e)}},p.onerror=function(){n(o.error)&&o.error.call(p)},"GET"==t||"DELETE"==t?p.send(null):s(d)&&p.send(d)}const o={_set(e,t){this[e]=t},okay:null,error:null};e(t);const{type:l,path:a,events:c={},headers:u={},body:d,security:h={},withCridentials:f}=t;let p=new XMLHttpRequest;return{okay(e){n(e)?(o._set("okay",e),r()):i("\n The argument in okay respons method must be a function.\n ")},error(e){n(e)?(o._set("error",e),r()):i("\n The argument in error response method must be a function.\n ")},response(e,t){ -2>arguments.length&&i("\n backend.request().response() must have two arguments.\n "),n(e)&&n(t)?(o._set("okay",e),o._set("error",t),r()):i("\n The arguments in backend.request().response() must be functions.\n ")}}};const we=new $,Oe={protectedListener:Object.create(null),ref:Object.create(null),add:function(e,t){return this.ref[e]=t}},je=new Proxy({},{set(e,t,n,r){const o=Object.keys(Oe.ref);for(let e=0;e{s(e)||i("\n You must define the event's name\n "),s(t)?je[e]=t:je[e]="fired"}),this.listen=((e,t)=>{n(t)||i("\n The second argument of event.listen() must be a function.\n "),o.call(Oe.ref,e)||Oe.add(e,t)}),this.removeListener=(e=>{if(s(e)||i("\n You must define the event's name you want to remove the listener\n "),o.call(Oe.ref,e)||d("\n Ops, you are trying to delete a listener that does not exist\n "),!o.call(Oe.protectedListener,e))return delete Oe.ref[e];i(`\n The listener of "${e}" is protected, you can not remove it.\n `)}),this.protectListener=(e=>{o.call(Oe.protectedListener,e)?d(`The listener of "${e}" is already protected. `):Oe.protectedListener[e]=!0}),this.hasListener=(e=>!!o.call(Oe.ref,e))}),Ee=new Proxy(Object.create(null),{set:(e,t,n,r)=>t in Ee?"Inter here":Reflect.set(e,t,n,r)}),Ne={handler:{},add(e,t){return this.handler[e].push(t)},create(e){return!(e in this.handler)&&(this.handler[e]=oe.create(null))}};k.prototype.each=((e,t,n,r)=>{if(I(e)){const r=e.childNodes;for(let e=0;e{let{in:o,do:l,data:a,react:d}=r,h=null;if(t(a)&&function n(){h=new Proxy(a,{set:(t,n,r,o)=>(t[n]=r,e(r)&&B(r,f),f(),!0)}),Object.defineProperty(h,"otherArray",{set(r){if(t(r)){a=r,f();for(let t of r)e(t)&&B(t,f);n()}else i(`\n "${r}" is not an array.\n `)},get:()=>null,configurable:!0}),Object.defineProperty(h,"concat",{value:n=>{if(t(n)){for(let e of n)h.push(e);return f(),[...a]}return h.push(n),e(n)&&B(n,f),[...a]},configurable:!0}),s(d)&&(window[d]=h)}(),t(a)||c("data in Inter.for() must be an array."),n(l)){const t=u(o);for(let t of a)e(t)&&B(t,f);function f(){if(a.lengtha.length;--n)t.removeChild(e[e.length-1])}if(!ke.has(o))return[...a].forEach((e,n)=>{var r=l.call(h,e,n);for(let e of r)t.appendChild(e)}),ke.set(o),!1;ke.has(o)&&a.forEach((e,n)=>{let r=l.call(h,e,n);if(s(t.children[n]))for(let e of r)H(e,t,n);if(!s(t.children[n])&&a.length>t.children.length)for(let e of r)t.appendChild(e)})}}else c("do in Inter.for() must be a function");f()});const Ie={store:Object.create(null),set(e,t){this.store[e]=t},hasNotFound(){return"*"in this.store},get(){return this.store["*"]()}};let Le=new class{constructor(){}each(e){const{in:t,do:n}=e;let r=oe.create(null),o=u(t).getElementsByTagName("*");for(let e of o)a(e)&&r.push(e);for(let e=0;earguments.length)d("\n input.sateSate() must have two arguments, first is the name of the state \n and second the input state container.\n ");else{const n=V(t);for(let e=0;earguments.length)i("resetState must have two arguments.");else{const n=V(t);for(let e=0;e{const n=this[He][t];for(let t of n)e(t.clonedInput)}):i("\n send's argument must be a function.\n ")}};Object.freeze(Me),q.prototype.set=function(e,t){const n=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&i("\n storage.set() must have two arguments!\n "),!(e in this[n]))return this[n][e]=t;this[n][e]=t,d(`\n there's already an element called "${e}" in storage, and its value\n was overwritten.\n `)},q.prototype.get=function(e,t){const r=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&i("\n storage.get() must have two arguments!\n "),n(t)||i("\n The second argument in storage.get() must be a function.\n "),o.call(this[r],e))return t(this[r][e]);d("\n You are trying to get an element that is not actually registered in the storage.\n ")},q.prototype.has=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e))return o.call(this[t],e);i("\n You must define the element to check its existence in the storage.\n ")},q.prototype.delete=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e)||i("You must define the key you want to delete from storage."),o.call(this[t],e))return delete this[t][e];i("\n You're trying to delete a key that is not in the storage.\n ")};const qe=Object.freeze(new q);W.prototype.previous=((e,t)=>{if(D(e),n(t)){const n=oe.create(null),r=e.parentNode.children;for(child of r){if(e.isSameNode(child)){n.push(child),t([...n]),oe.destroy(n);break}n.push(child)}}}),W.prototype.next=((e,t)=>{if(D(e)||i('\nThe first argument in "interface.next()" must be a valid HTML element.\n'),n(t)){let n=!1;const r=oe.create(null),o=e.parentNode.children;for(let t of o)(e.isSameNode(t)||n)&&(r.push(t),n||(n=!0));t([...r]),oe.destroy(r)}else i('\nThe second argument in "interface.next()" must be a function.\n')});const De=Object.freeze(new W);Ce.protectListener("URLCHANGED"),Ce.protectListener("handler"),Q.renderContainer=K,Q.interface=De,Q.storage=qe,Q.input=Me,Q.form=Le,Q.toHTML=L,Q.validate=ce,Q.Inter=de,Q.simulate=me,Q.ROUTER=U,Q.supportInter=O,Q.url=ye,Q.data=fe,Q.getValue=be,Q.backend=we,Q.event=Ce,Q.whileLoading=E,Q.app=le,Q.template=T,Q.toATTR=z,Q.reativeTemplate=Z,"undefined"!=typeof module&&"object"==typeof module.exports&&(exports.renderContainer=K,exports.whileLoading=E,exports.reativeTemplate=Z,exports.toATTR=z,exports.validate=ce,exports.Inter=de,exports.backend=we,exports.simulate=me,exports.supportInter=O,exports.data=fe,exports.url=ye,exports.input=Me,exports.getValue=be,exports.toHTML=L,exports.app=le,exports.event=Ce,exports.template=T,exports.app=le,exports.getValue=be,exports.ROUTER=U,exports.form=Le,exports.interface=De,exports.input=Me,exports.storage=qe)}(); + !function(){function e(e){return"[object Object]"==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)}function n(e){return"function"==r(e)}function r(e){return typeof e}function o(e){return e in this}function s(e){return void 0!==e&&null!=e}function l(e){return 1==e||0==e}function a(e){const t=e.tagName;return"input"==he.call(t)||"textarea"==he.call(t)}function i(e){if("production"==te.status||"development"!=te.status)return!1;throw new SyntaxError(e)}function c(e){if("production"!=te.status&&"development"==te.status)throw new TypeError(e)}function u(e){if(document instanceof Document){const t=document.getElementById(e);if(void 0!=t)return t;i(`\n There is not an element by id ${e} in document.\n `)}}function d(e){"production"!=te.status&&"development"==te.status&&console.warn(e)}function h(e){return document instanceof Document?document.createTextNode(e):void 0}function f(e,t){return void 0!=e&&(M(e)?e.hasAttribute(t):void 0)}function p(e){return document instanceof Document?document.createElement(e):void 0}function g(e,t,n){return void 0==e?void 0:e.setAttribute(t,n)}function m(e,t){return void 0==e?void 0:e.getAttribute(t)}function y(e){return 1==e}function b(e){return"a"==he.call(e.nodeName)||"button"==he.call(e.nodeName)}function v(e){const t=p(e.nodeName);for(let n of e.children){const e=n.cloneNode(!0);if(Object.entries(n).forEach(t=>{const[n,r]=t,o=n.replace("_","");e[o]=r,n.startsWith("_")&&(e[n]=r)}),V(n)){let t=-1;for(let r of n.children){t++;const n=r.cloneNode(!0);Object.entries(r).forEach(e=>{const[t,r]=e,o=t.replace("_","");n[o]=r}),e.replaceChild(n,e.children[t])}}t.appendChild(e)}return t}function x(e,t){return!Object.is(e,t)}function w(){}function O(){try{let e=new Map;return e.set("Libray","Inter"),e.set("Creator","Denis"),e.clear(),!0}catch(e){return!1}}function j(e,t){if(function(e,t){const n=he.call(e.nodeName),r=he.call(t.nodeName);return o.call({video:!0,audio:!0,input:!0,textarea:!0},n)&&!x(n,r)}(e,t)){const n=ae(e,t),r=e.attributes,o=t.attributes;for(let s=0;n>s;s++){const n=r[s],l=o[s];f(e,l.name)?x(l.value,n.value)&&("value"!=l.name?g(t,l.name,n.value):t.value=n.value):t.removeAttribute(l.name)}}else{const r=e.attributes,o=t.attributes;if(n=t,Object.is(e.textContent,n.textContent))if(r.length!=o.length)t.parentNode.replaceChild(e,t);else for(let n of r){if(!f(t,n.name)){t.parentNode.replaceChild(e,t);break}if(f(t,n.name)&&x(m(t,n.name),n.value)){t.parentNode.replaceChild(e,t);break}}else t.parentNode.replaceChild(e,t)}var n}function C(e){return void 0!=e&&1==e.nodeType}function E(t){if(void 0!==new.target&&i("\n You must not create an instance for whileLoading() function. \n "),e(t)){const{elements:e}=t;let r=null;[...e].forEach(e=>{const{tag:t,attrs:o={},events:l={},children:a}=e;s(a)&&!N(a)||i("\n Oh, you must define the children array, and it must not be empty.\n ");const c=p(t);Object.entries(o).forEach(e=>{const[t,n]=e;g(c,t,n)}),Object.entries(l).forEach(e=>{const[t,n]=e;c[t]=n}),a.forEach(e=>{const{tag:t,events:r={},attrs:o={},text:l}=e,a=p(t);Object.entries(r).forEach(e=>{const[t,n]=e;a[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;g(a,t,n)}),s(l)&&(n(l)?a.appendChild(h(l())):a.appendChild(h(l))),c.appendChild(a)}),r=c,document.body.appendChild(c)}),document.onreadystatechange=function(){"complete"==this.readyState&&this.body.removeChild(r)}}else i("\n The value passed as argument in the method \n whileLoading() must be any object.\n \n ")}function N(e){return 0==e.length}function T(r){const{elements:o}=r;t(o)||i('\n The property "elements" must be an array.\n ');let l=oe.create(null);return o.forEach(t=>{e(t)||i('\n The itens of array "elements" must be objects with at least\n "tag" property. \n ');const{tag:r,text:o,attrs:a={},events:c={},children:u=[],handlers:d={},styles:f={}}=t,m=p(r);Object.entries(a).forEach(e=>{const[t,r]=e;n(a[t])?s(a[t]())&&g(m,t,a[t]()):s(r)&&g(m,t,r)}),Object.entries(c).forEach(e=>{const[t,n]=e;m[t]=n,m.rerender=!0}),Object.values(d).forEach(e=>{if(n(e))return m.rerender=!0,d[e].call(m)}),Object.entries(f).forEach(e=>{const[t,r]=e;n(r)?s(r())&&(m.style[t]=r()):s(r)&&(m.style[t]=r)}),N(u)||u.forEach((e,t)=>{const{tag:r,text:o,attrs:l={},events:a={},render:i,handlers:c={},styles:u={},children:d=[]}=e,f=p(r);x(i,!0)&&x(i,!1)||(f.render=i,f.index=t),Object.entries(l).forEach(e=>{const[t,r]=e;n(r)?s(r())&&g(f,t,r()):s(r)&&g(f,t,r)}),Object.entries(a).forEach(e=>{const[t,n]=e;f[t]=n,f[`_${t}`]=n,f.rerender=!0}),Object.values(c).forEach(e=>{n(e)&&(f.rerender=!0,e.call(f))}),Object.entries(u).forEach(e=>{const[t,r]=e;f.style[t]=n(r)?r():r}),s(o)&&(n(o)?f.appendChild(h(o())):f.appendChild(h(o))),Array.from(d).forEach((e,t)=>{const{tag:r,text:o,render:l,attrs:a={},events:i={},handlers:c={},styles:u={}}=e,d=p(r);x(l,!0)&&x(l,!1)||(d.render=l,d.index=t),Object.entries(a).forEach(e=>{const[t,r]=e;n(r)?s(r())&&g(d,t,r()):s(r)&&g(d,t,r)}),Object.entries(i).forEach(e=>{const[t,n]=e;d[t]=n,d[`_${t}`]=n,d.rerender=!0}),Object.values(c).forEach(e=>{n(e)&&(d.rerender=!0,e.call(d))}),Object.entries(u).forEach(e=>{const[t,r]=e;d.style[t]=n(r)?r():r}),s(o)&&(n(o)?d.appendChild(h(o())):d.appendChild(h(o))),"null"!=he.call(d.tagName)&&"undefined"!=he.call(d.tagName)&&f.appendChild(d)}),"null"!=he.call(f.tagName)&&"undefined"!=he.call(f.tagName)&&m.appendChild(f)}),s(o)&&(n(o)?m.appendChild(h(o())):m.appendChild(h(o))),"null"!=he.call(m.tagName)&&"undefined"!=he.call(m.tagName)&&l.push(m)}),l}function R(){}function P(){let e=null;var t=document.getElementsByTagName("*");for(let n=0;n{let t=ve.handler[l];for(let n of t){const{target:t,text:o}=n,s=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(s.test(o)){let n=o.replace(s,e.target.value);t.textContent=n}}})}else i("\n Really? handleValue must be only setted in value that recieve value.\n ");Ce.fire(`handler${e}`)}function $(){}function A(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0})}function I(e){return 0==Object.keys(e).length}function S(){}function k(e){return e.getElementsByTagName("*").length>0}function L(t){if(e(t)){let{in:o,data:l,handleValue:a,react:i}=t;const c=Object.assign(Object.create(null),l);Object.getOwnPropertyNames(l).forEach(e=>{Object.defineProperty(l,e,{get:()=>c[e]}),n(l[e])&&(c[e]=l[e].call(l))}),se.hasRefContainer(o)?(Object.destroyAll(Ne.handler),Object.destroyAll(Pe.handle),Object.destroyAll(Ae.storage),Object.destroyAll(Ie.storage),Object.destroyAll(re[ne])):se.refContainer(o);const d=u(o).getElementsByTagName("*"),h=0!=d.length;Ce.listen(`handler${o}`,()=>{const t=Object.create(null);e(a)&&(Object.entries(a).forEach(e=>{const[n,r]=e;t[n]=r}),Object.entries(a).forEach((e,n)=>{const[r,s]=e;let l=ve.handler[o];for(let e of l){const{target:n,text:o,input:l}=e,a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(a.test(o)){const e=o.replace(a,s);n.textContent=e}let i=new Proxy(t,{get:()=>l.value,set(e,t,s,l){const a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g"),i=o.replace(a,s);n.textContent=i}});window[r]=i}}))});const f=u(o).getElementsByTagName("*");var r=Object.keys(l);0==f.length&&(Ne.create(o),Ne.add(o,{target:u(o),text:u(o).textContent}));for(let e=0;e{const{text:l,target:a,attrName:i,attrValue:c}=e,u=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");if(s(l))u.test(l)&&re.has(o)&&re.reConstroy(o,t,n);else if(u.test(c)){const e=c.replace(u,n);e==c||("value"!=i?g(a,i,e):a.value=e)}});else{const s={refName:t,refValue:n,refContainer:o};Reflect.set(e,t,n,r),function(e){const{refName:t,refValue:n,refContainer:r}=e,o=u(r).getElementsByTagName("*"),s=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");for(let e of o)if(V(e)){const o=e.childNodes;for(let e of o)if(s.test(e.textContent)){Ne.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);re.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}}else if(s.test(e.textContent)){Ne.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);re.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}for(let e of o){const t=e.attributes;for(let o=0;oPe.has(t)?Pe.get(t).value:Reflect.get(e,t,n),deleteProperty(e,t,n){$e.has(t)&&(Reflect.deleteProperty(e,t,n),$e.delete(t),Ne.handler[o].forEach((e,n)=>{const{target:r,text:l,attrName:a,attrValue:i}=e,c=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");s(a)&&c.test(i)&&Ne.handler[o].splice(n,1),s(l)&&c.test(l)&&Ne.handler[o].splice(n,1)}))}}),enumerable:!0,configurable:!0,writable:!0}),window[i]=e[i]}if(!I(l)&&s(l)){if(!Ie.has(o)){const e=u(o).getElementsByTagName("*"),t=0==d.length;let n=oe.create(null),r=oe.create(null);if(t){const e=u(o).textContent;Object.getOwnPropertyNames(l).forEach(t=>{RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g").test(e)&&(n.push({target:u(o),text:e,position:null}),Ie.set(o,n))})}else for(let t=0;t{let[t,n]=e;const r=Ie.get(o),l=Ae.get(o);re.create(o);let a=re.get(o);oe.shareItens(r,a);for(let e=0;e-1;e--){if(V(l[e])){const t=l[e].children,n=o[e].children;if(t.length==n.length){for(let e=n.length-1;e>-1;e--)Y(n[e],t[e])&&n[e].parentNode.replaceChild(t[e],n[e]);continue}o[e].parentNode.replaceChild(l[e],o[e])}else Y(o[e],l[e]);s(o[e])&&s(l[e])&&!V(l[e])&&Y(o[e],l[e])&&(V(l[e])||o[e].parentNode.replaceChild(l[e],o[e]))}}else{const r=t.children[n];Y(r,e)&&t.replaceChild(e,r)}}function Y(e,t){let n=!1;const r=e.attributes,o=t.attributes;if(x(t.rerender,!0)||(n=!0),!n)if(r.length!==o.length)n=!0;else for(let t of o){const r=t.name,o=t.value;if(!f(e,r)){n=!0;break}if(f(e,r)&&m(e,r)!==o){n=!0;break}}return n||e.textContent&&t.textContent&&(n=e.textContent!==t.textContent),n}function B(e,t){const n=Object.assign({},e);Object.keys(e).reduce((r,o)=>{Object.defineProperty(e,[o],{set(e){n[o]=e,t()},get:()=>n[o]})},[])}function _(){return!!window.location.hash}function D(t){if(e(t)){const{routes:e}=t,r=Object.create(null);if(Object.entries(e).forEach(e=>{const[t,o]=e;if(ee.test(t)||"*"==t||i("\n Route name must start with /.\n "),n(o)||i("\n Route action must be a function.\n "),t.includes("/*")){const e=t.replaceAll("*","(:?[\\s\\S]+)");r[e]=o}else"*"!==t&&(r[t]=o)}),n(e["*"])&&ke.set("*",e["*"]),_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():d('\n You should always create a notfound route with "*" property.\n '))}else{let e=!1;const t=window.location.pathname;Object.keys(r).some(n=>{/(?:)/.compile(n).test(t)&&(e=!0,r[n]())}),e||(ke.hasNotFound()?ke.get():d('\n You should always create a notfound route with "*" property.\n '))}Ce.listen("URLCHANGED",()=>{if(_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():d('\n You should always create a notfound route with "*" property.\n '))}else{const e=window.location.pathname;let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(ke.hasNotFound())return ke.get();d('\n You should always create a notfound route with "*" property.\n ')}}}),window.onpopstate=(()=>{if(_()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(ke.hasNotFound())return ke.get();d('\n You should always create a notfound route with "*" property.\n ')}}else{const e=window.location.pathname;let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():d('\n You should always create a notfound route with "*" property.\n '))}})}else i("\nThe argument of ROUTER() must be an object.\n");(function(){const e=this.getElementsByTagName("*");for(let t of e)b(t)&&f(t,"setPath")&&(t.onclick=(e=>{e.preventDefault();const n=m(t,"setPath");ee.test(n)?ye.setPath(n):i("\n A valid pathName must start with /.\n ")})),b(t)&&f(t,"useHash")&&(t.onclick=(e=>{e.preventDefault();const n=m(t,"useHash");ee.test(n)?ye.useHash(n):i("\n A valid pathName must start with /.\n ")}))}).call(document.body)}function U(e){const t=oe.create(null),n=u(e).getElementsByTagName("*");for(let r=0;r0}function q(){this[Symbol()]=Object.create(null)}function M(e){return 1==e.nodeType}function W(){}function z(e,t,r,s){Object.entries(t).reduce((t,r)=>{const[o,l]=r;void 0==l||o.startsWith("on")?o.startsWith("on")&&n(l)&&(e[o]=function(e){l.call(s,e)}):g(e,o,l)},{}),Object.entries(s).reduce((t,r)=>{const[o]=r;Object.defineProperty(s,o,{set(t){void 0==t?o.startsWith("on")?e[o]=void 0:e.removeAttribute(o):o.startsWith("on")?(n(t)||i(`\n The value of "${t}" event, must be a function.\n `),e[o]=function(e){t.call(s,e)}):g(e,o,t)},get(){if(!o.startsWith("on"))return m(e,o);i(`\n "${o}" seems to be an event listener, \n and you can not get the value of an event.\n `)}})},{});const l=Object.create(null);Object.defineProperty(l,[r],{value:new Proxy(t,{set(t,r,s,l){if(o.call(t,r)){if(void 0==s)return r.startsWith("on")?e[r]=void 0:e.removeAttribute(r),!1;if("value"!=r&&!r.startsWith("on"))return g(e,r,s),Reflect.set(t,r,s,l),!1;"value"==r?(e.value=s,Reflect.set(t,r,s,l)):r.startsWith("on")&&(n(s)||i(`\n Oh, the value of "${r}" event, must be a function.\n `),e[r]=function(e){s.call(t,e)})}},get(t,n,r){if(!n.startsWith("on"))return e[n];i(`"${n}" seems to be an event listener, and you can\n not get the value of an event`)}})}),window[r]=l[r]}function G(t){if(e(t)){const{in:n,data:r}=t,o=u(n);e(r)?function(e,t){const n=Object.getOwnPropertyNames(t),r=e.getElementsByTagName("*");for(let e of r)if(1==e.attributes.length){const r=e.attributes[0].name;for(let o of n)if(RegExp(`{...${o}}`).test(r)){const n=Object.assign({},t[o]);e.removeAttribute(r),z(e,n,o,t[o]);break}}}(o,r):i("\ndata in toATTR() must be an object.\n")}else i('\n The argument in "toATTR()" function must be an object.\n ')}function F(e,t){return x(e.index,t.index)}function Z(t){if(void 0!==new.target&&i('\n "reativeTemplate" is not a construtor, do not invoke it with "new" keyword.\n '),e(t)){const{react:e,in:n,render:r}=t,o=u(n),s=new Proxy(e,{set(...e){Reflect.set(...e);const t=r.call(s);for(let e=0;ec;c++){const e=s[c],u=void 0==r.children[c]?r.children[r.children.length-1]:r.children[c],d=e.render;if(V(o.children[c]))for(let t=0;t{if(void 0!==u)return void 0==u.children[t]?u.children[u.children.length-1]:u.children[t]},o=e.children[t],s=o.render;x(s,!0)?x(s,!1)||void 0===n()||F(o,n())||i.push({el:n(),parent:void 0==u?r.children[r.children.length-1]:u}):(void 0==n()||F(o,n()))&&(l.push({id:t,el:o,parent:void 0==u?r.children[r.children.length-1]:u}),a=!0)}x(d,!0)?x(d,!1)||void 0===u||F(u,e)||(t.push({el:u,id:c}),a=!0):(void 0==u||F(e,u))&&(n.push({id:c,el:e}),a=!0)}for(let e of t){const{el:t}=e;r.removeChild(t)}for(let e of i){const{el:t,parent:n}=e;n.removeChild(t)}for(let e of l){const{el:t,id:n,parent:r}=e;if(void 0==r.children[n])r.appendChild(t);else{const e=r.children[n];r.insertBefore(t,e)}}for(let e of n){const{id:t,el:n}=e;void 0==r.children[t]?r.appendChild(n):r.insertBefore(n,r.children[t])}}(),a){let e=o.children.length;for(let t=0;e>t;t++){const n=o.children[t];if(x(n.render,!1)){if(V(n))for(let e of n.children)x(e.render,!1)||n.removeChild(e)}else o.removeChild(n),t--,e--}}else{const e=l.children.length;for(let t=0;e>t;t++){const e=l.children[t];if(void 0==e)continue;const n=void 0!==e?e.render:void 0;if(e.children.length>0)for(let t of e.children)x(t.render,!1)||e.removeChild(t);void 0!=n&&0==n&&(l.removeChild(e),t--)}}ie.change(a?o:l,r)}function K(r){if(void 0!==new.target&&i('\n "renderContainer" is not a constructor, do not call it\n with the "new" keyword.\n '),e(r)){const{in:e,data:c,react:h}=r,p=function(e){const t=e.children,n=oe.create(null),r=oe.create(null);let o=-1;for(let e of t)if(o++,f(e,"_istrue")){f(e,"_default")&&i("\n A container can not have two reative attributes.\n ");const t=m(e,"_istrue");e.istrue=!0;const s={ifTrue:e,cond:t.trim(),index:o},l=e.nextElementSibling;C(l)&&f(l,"_default")&&(f(l,"_istrue")&&i("\n A container can not have two reative attributes.\n "),l.default=!0,s.default=l,l.removeAttribute("_default"),r.push(l)),e.removeAttribute("_istrue"),r.push(e),n.push(s)}for(let t of r)e.removeChild(t);return n}(u(e)),g=Object.assign({},c),y=Object.assign({},c),b=Object.getOwnPropertyNames(c);for(let e of b)Object.defineProperty(g,[e],{set(t){y[e]=t,a()},get:()=>y[e]});const v=oe.create(null);let w=!1;function a(){for(let t of p){const{cond:r,ifTrue:a,default:i,index:c}=t,h=u(e),f=h.children;if(o.call(g,r)){const e=n(g[r])?g[r]():g[r];if(l(e)||d(`\n The values of properties in data object, in renderContainer(), must be\n only boolean(true/false), and in property "${r}" you defined\n "${e}" as its value.\n `),!x(e,!0)&&s(i)){if(void 0==f[c]){h.appendChild(a);continue}if(f[c].isSameNode(a));else{if(f[c].default){h.replaceChild(a,i);continue}h.insertBefore(a,f[c])}}else{if(!x(e,!1)&&s(i)){if(void 0==f[c]){h.appendChild(i);continue}if(f[c].isSameNode(i));else{if(f[c].istrue){h.replaceChild(i,a);continue}h.insertBefore(i,f[c])}}if(!x(e,!0)&&!s(i)){if(void 0==f[c]){h.appendChild(a);continue}f[c].isSameNode(a)||h.insertBefore(a,f[c])}}x(e,!1)||s(i)||null!==a.parentNode&&h.removeChild(a)}}}Object.defineProperty(g,"register",{set(e){if(t(e)||i(`\n The value in ${h}.register must be an array.\n `),w&&i("\n You can only register the properties once.\n "),N(e))i("\n The array is empty.\n ");else{for(let t of e)o.call(c,t)?(v.push(t),w=!0):d(`\n There is not a property called "${t}"\n in ${h}\n `);Object.defineProperty(this,"setRegistered",{enumerable:!1,configurable:!1,set(e){if(l(e))for(let t of v)Q[h][t]=e;else i("\n The setRegistered property only accepts\n boolean value, true or false.\n ")}}),Object.seal(this)}}}),Q[h]=g}else i('\n The argument in "renderContainer" must be a n object.\n ');a()}Object.destroyAll=(e=>{const t=Object.keys(e);for(let n of t)delete e[n]});const Q=globalThis||function(){return window||self||global||void 0},ee=/^\/(:?[\s\S]+)|\/$/;var te={status:"development"};const ne=Symbol(),re={[ne]:Object.create(null),create(e){return this[ne][e]=oe.create(null)},set(e,t){this[ne][e].push(t)},get(e){return this[ne][e]},has(e){return e in this[ne]},reConstroy(e,t,n){let r=this.get(e);for(let e of r){const{text:r,target:s,refs:l}=e;o.call(l,t)&&(l[t]=n);let a=r,i=Object.getOwnPropertyNames(l);for(let e of i){const t=RegExp(`{(:?\\s+)*(:?${e})(:?\\s+)*}`,"g");a=a.replace(t,l[e])}s.textContent=a}}};w.prototype.create=(e=>null==e?[]:[...e]),w.prototype.shareItens=((e,t)=>{for(let n of e)t.push(n)}),w.prototype.destroy=(e=>{let t=e.length;for(;t--;)e.pop()});var oe=new w;const se={handleMemomory:oe.create(null),refContainer(e){this.handleMemomory.push(e)},hasRefContainer(e){let t=null;return this.handleMemomory.some(n=>t=e==n),t}},le=new Proxy(te,{set(e,t,n,r){if("status"==t&&"production"==n&&(console.log("You're using Inter in production mode."),Reflect.set(e,t,n,r)),"status"!=t||"development"!=n)return!1;console.log("You're using Inter in development mode. When you deploy your app turn on production mode."),Reflect.set(e,t,n,r)}}),ae=(e,t)=>{const n=e.attributes.length,r=t.attributes.length;return n>r?n:r},ie={applyChange:(e,t)=>(function(e,t){const n=t.children,r=e.children;for(let t=e.children.length-1;t>-1;t--){const e=r[t],o=n[t];if(J(e,o)&&C(e)&&C(o))o.parentNode.replaceChild(e,o);else if(V(e))for(let t=e.children.length-1;t>-1;t--)j(e.children[t],o.children[t]);else!J(e,o)&&C(e)&&C(o)&&j(e,o)}})(e,t),has:e=>has(e),change(e,t){V(e)&&V(t)&&this.applyChange(e,t)}};Object.defineProperty(window,"onload",{set(e){"inputHandler"!=e?window.addEventListener("load",t=>{"development"==le.status&&console.log("You're using Inter in development mode, when you deploy your app turn on production mode."),P(),n(e)&&e(t)}):window.addEventListener("load",P())},get(){}}),window.onload=(()=>{P()});var ce=new Proxy({url:function(e){return/^(?:http:\/\/|https:\/\/)+(:?[A-Z]{2,8}\.)*(:?[a-z]+)+\.+(:?[a-z]{2,8})+(:?[\s\S])*$/i.test(e)},email:function(e){return/^(?:[A-Z]+)+(:?[0-9]+)*@+(:?[A-Z]+)\.[A-Z]+$/i.test(e)}},{set:(e,t,n,r)=>"url"==t||"email"==t?(c("\n You must not overwrite built-in methods\n "),!1):Reflect.set(e,t,n,r),deleteProperty:(e,t)=>"url"==t||"email"==t?(c("\n You must not delete built-in methods\n "),!1):Reflect.deleteProperty(e,t)});const ue=new class{constructor(){}addHTML(t){if(e(t)){const{in:e,elements:n}=t,r=u(e);n.forEach(e=>{const{tag:t,text:n,children:o=[],attrs:l={},events:a={}}=e;let i=p(t);Object.entries(l).forEach(e=>{const[t,n]=e;g(i,t,n)}),Object.entries(a).forEach(e=>{const[t,n]=e;i[t]=n}),s(n)&&i.appendChild(h(n)),N(o)||o.forEach(e=>{const{tag:t,text:n,events:r={},attrs:o={}}=e,l=p(t);Object.entries(r).forEach(e=>{const[t,n]=e;l[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;g(l,t,n)}),s(n)&&l.appendChild(h(n)),i.appendChild(l)}),r.appendChild(i)})}else i("\n The argument passed in the method AddHTML must be a plain object.\n ")}},de=new Proxy(ue,{set:(...e)=>(i("You can not set any property in Inter object,\n this is a fatal action.\n "),!1),deleteProperty:(...e)=>(i("Fatal error: do not try to delete any property of Inter object"),!1),getPrototypeOf:e=>null,setPrototypeOf:(...e)=>!1}),he=String.prototype.toLowerCase,fe=new function(){this.query=function(n){if(e(n)){const{in:r,setting:s}=n,{applyTo:l,value:a,query:c}=s;e(s)||i("\n Setting must be an object.\n "),t(r)&&t(l)||i("\n The in=>target and the applyTo=>reciever properties must be array.\n ");let u=r.filter(e=>{o.call(e,c)||console.log(`It's was not found a property called "${c}" in target object, in data.query()`);const t=e[c];if(he.call(t).includes(he.call(a)))return e});if(oe.destroy(l),""===a)return!1;oe.shareItens(u,l)}else i("\nThe argument in data.query() must be an object.\n")}};Object.defineProperty(fe,"query",{enumerable:!0,value:fe.query}),Object.freeze(fe),Object.defineProperty(ue,Symbol.hasInstance,{value:function(){return!1},enumerable:!1,configurable:!1,writable:!1});const pe={refHandler:Object.create(null),has:function(e){return e in this.refHandler},get:function(e){return this.refHandler[e]},addRef:function(e,t){return this.refHandler[e]=t},freeAll(){return Object.destroyAll(this.refHandler)}};A(de,"renderIf",n=>{const l=oe.create(null);if(e(n)){const{in:c,watch:d,conditions:h}=n;if(e(d)){const e=Object.create(null);!function(e,t){const n=Object.getOwnPropertyNames(e);for(let r of n)t[r]=e[r]}(d,e),Object.keys(d).forEach(t=>{Object.defineProperty(d,t,{set(n){e[t]=n,a()},get:()=>e[t]})})}function a(){const e=u(c);var n;l.length>0&&(l.forEach(t=>{const n=e.children[t];s(n)&&e.removeChild(n)}),oe.destroy(l)),t(h)||i("\n conditions must be an array.\n "),[...h].forEach((t,a)=>{const{render:c}=t;if(!s(c.call(t))&&o.call(l,t.index+"")){const n=e.children[t.index];e.removeChild(n),delete l[t.index+""]}if(n=c.call(t),/^\[object HTML+(:?[A-Z]+)+Element\]$/i.test(n)){const n=t.index,o=e.children[n];if("number"!=r(+n))i("\n The index in Inter.renderIf() must be a number.\n ");else{let r=e.children[n];if(1==e.children.length&&!s(t.replace)&&0==n){const t=e.children[0];return e.insertBefore(c()[a],t),l.push(n),!1}if(s(o)&&y(t.replace))return e.replaceChild(c()[0],o),l.push(n),!1;s(r)?(e.insertBefore(c()[0],r),l.push(n)):e.children.length-1+1==n?(e.appendChild(c()[a]),l.push(n)):i(`Invalid index, it's impossible to render the element at index "${n}"!\n `)}}})}}a()});const ge=new class{constructor(){}typing(t){if(e(t)){const{in:e,setting:o,done:s}=t;var r=u(e);Array.from(o).forEach(e=>{const{text:t,speed:o}=e;let l=[...t][Symbol.iterator](),a=setInterval(()=>{let e=l.next().value;if(void 0!==e)pe.has(r)?(r.textContent=`${pe.get(r)}${e}`,pe.addRef(r,`${pe.get(r)}${e}`)):(r.textContent=e,pe.addRef(r,e));else if(clearInterval(a),n(s))return s()},+o)})}}cleaning(t){if(e(t)){const{in:e,speed:r,done:o}=t,l=u(e),a=[...l.textContent];let i=setInterval(()=>{a.pop(),l.textContent=function(e){let t=[...l.textContent];return t.pop(),t.reduce((e,t)=>e.concat(t),"")}(),s(a[0])||(clearInterval(i),pe.has(l)&&delete pe.refHandler[l],n(o)&&o())},+r)}else i("\n The value passed as argument in the method cleaning must be an object.\n ")}};var me=new Proxy(ge,{deleteProperty:(...e)=>(i("\n You can not delety any property in\n simulate object\n \n "),!1),defineProperty:(...e)=>!1,set:(...e)=>!0,getPrototypeOf:e=>null,setPrototypeOf:(e,t)=>!1});R.prototype.useHash=(e=>{ee.test(e)||i("\n pathName must starts with /.\n ");const t=window.location.pathname;return s(e)||d("You must define the path of the url."),"/"==e?(window.history.pushState(null,null,`/#${e}`),Ce.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,`/#${e}`),Ce.fire("URLCHANGED"),!1):(window.history.replaceState(null,null,`/#${e}`),void Ce.fire("URLCHANGED"))}),R.prototype.setPath=(e=>{const t=window.location.pathname;return ee.test(e)||i("\n Pathname must starts with /.\n "),s(e)||i("\n setPath's parameter must not be a null or undefined value.\n "),"/"==e?(window.history.pushState(null,null,e),Ce.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,e),Ce.fire("ULRCHANGED"),!1):(window.history.replaceState(null,null,e),void Ce.fire("URLCHANGED"))});const ye=Object.freeze(new R);let be=new Proxy(function(t){const{in:n}=t;if(e(t))return{only:()=>u([n]).value,done(e,t){u(n).oninput=(n=>{L({in:e,data:{[t]:n.target.value}})})}};i("\ngetValue()'s argument must be only an object.\n")},{construct(...e){i("\n You've create an instance for getValue, it's forbidden.\n ")}});const ve={handler:Object.create(null),justRegistered(e){return e in this.handler}},xe=String.prototype.toUpperCase;$.prototype.request=function(t){function r(){y(f)&&(p.withCredentials=!0);const t=xe.call(l);I(h)||!s(h)?p.open(t,a,!0):e(h)&&p.open(t,a,!0,h.username,h.password),Object.entries(u).forEach(e=>{const[t,n]=e;p.setRequestHeader(t,n)}),Object.entries(c).forEach(e=>{const[t,r]=e;"onerror"!=t&&"onload"!=t||i(`\n You can not listen for "${t}" event in backend.request(), it's ilegal.\n `),n(r)&&(p[t]=r.call(p))}),p.onload=function(){let e=null;try{JSON.parse(e),e=JSON.parse(this.responseText),n(o.okay)&&o.okay.call(p,e)}catch(t){e=this.responseText,n(o.okay)&&o.okay.call(p,e)}},p.onerror=function(){n(o.error)&&o.error.call(p)},"GET"==t||"DELETE"==t?p.send(null):s(d)&&p.send(d)}const o={_set(e,t){this[e]=t},okay:null,error:null};e(t);const{type:l,path:a,events:c={},headers:u={},body:d,security:h={},withCridentials:f}=t;let p=new XMLHttpRequest;return{okay(e){n(e)?(o._set("okay",e),r()):i("\n The argument in okay respons method must be a function.\n ")},error(e){n(e)?(o._set("error",e),r()):i("\n The argument in error response method must be a function.\n ")},response(e,t){ +2>arguments.length&&i("\n backend.request().response() must have two arguments.\n "),n(e)&&n(t)?(o._set("okay",e),o._set("error",t),r()):i("\n The arguments in backend.request().response() must be functions.\n ")}}};const we=Object.freeze(new $),Oe={protectedListener:Object.create(null),ref:Object.create(null),add:function(e,t){return this.ref[e]=t}},je=new Proxy({},{set(e,t,n,r){const o=Object.keys(Oe.ref);for(let e=0;e{s(e)||i("\n You must define the event's name\n "),s(t)?je[e]=t:je[e]="fired"}),this.listen=((e,t)=>{n(t)||i("\n The second argument of event.listen() must be a function.\n "),o.call(Oe.ref,e)||Oe.add(e,t)}),this.removeListener=(e=>{if(s(e)||i("\n You must define the event's name you want to remove the listener\n "),o.call(Oe.ref,e)||d("\n Ops, you are trying to delete a listener that does not exist\n "),!o.call(Oe.protectedListener,e))return delete Oe.ref[e];i(`\n The listener of "${e}" is protected, you can not remove it.\n `)}),this.protectListener=(e=>{o.call(Oe.protectedListener,e)?d(`The listener of "${e}" is already protected. `):Oe.protectedListener[e]=!0}),this.hasListener=(e=>!!o.call(Oe.ref,e))}),Ee=new Proxy(Object.create(null),{set:(e,t,n,r)=>t in Ee?"Inter here":Reflect.set(e,t,n,r)}),Ne={handler:{},add(e,t){return this.handler[e].push(t)},create(e){return!(e in this.handler)&&(this.handler[e]=oe.create(null))}};S.prototype.each=((e,t,n,r)=>{if(k(e)){const r=e.childNodes;for(let e=0;e{let{in:o,do:l,data:a,react:d}=r,h=null;if(t(a)&&function n(){h=new Proxy(a,{set:(t,n,r,o)=>(t[n]=r,e(r)&&B(r,f),f(),!0)}),Object.defineProperty(h,"otherArray",{set(r){if(t(r)){a=r,f();for(let t of r)e(t)&&B(t,f);n()}else i(`\n "${r}" is not an array.\n `)},get:()=>null,configurable:!0}),Object.defineProperty(h,"concat",{value:n=>{if(t(n)){for(let e of n)h.push(e);return f(),[...a]}return h.push(n),e(n)&&B(n,f),[...a]},configurable:!0}),s(d)&&(window[d]=h)}(),t(a)||c("data in Inter.for() must be an array."),n(l)){const t=u(o);for(let t of a)e(t)&&B(t,f);function f(){if(a.lengtha.length;--n)t.removeChild(e[e.length-1])}if(!Se.has(o))return[...a].forEach((e,n)=>{var r=l.call(h,e,n);for(let e of r)t.appendChild(e)}),Se.set(o),!1;Se.has(o)&&a.forEach((e,n)=>{let r=l.call(h,e,n);if(s(t.children[n]))for(let e of r)H(e,t,n);if(!s(t.children[n])&&a.length>t.children.length)for(let e of r)t.appendChild(e)})}}else c("do in Inter.for() must be a function");f()});const ke={store:Object.create(null),set(e,t){this.store[e]=t},hasNotFound(){return"*"in this.store},get(){return this.store["*"]()}};let Le=new class{constructor(){}each(e){const{in:t,do:n}=e;let r=oe.create(null),o=u(t).getElementsByTagName("*");for(let e of o)a(e)&&r.push(e);for(let e=0;earguments.length)d("\n input.sateSate() must have two arguments, first is the name of the state \n and second the input state container.\n ");else{const n=U(t);for(let e=0;earguments.length)i("resetState must have two arguments.");else{const n=U(t);for(let e=0;e{const n=this[He][t];for(let t of n)e(t.clonedInput)}):i("\n send's argument must be a function.\n ")}};Object.freeze(Ve),q.prototype.set=function(e,t){const n=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&i("\n storage.set() must have two arguments!\n "),!(e in this[n]))return this[n][e]=t;this[n][e]=t,d(`\n there's already an element called "${e}" in storage, and its value\n was overwritten.\n `)},q.prototype.get=function(e,t){const r=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&i("\n storage.get() must have two arguments!\n "),n(t)||i("\n The second argument in storage.get() must be a function.\n "),o.call(this[r],e))return t(this[r][e]);d("\n You are trying to get an element that is not actually registered in the storage.\n ")},q.prototype.has=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e))return o.call(this[t],e);i("\n You must define the element to check its existence in the storage.\n ")},q.prototype.delete=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e)||i("You must define the key you want to delete from storage."),o.call(this[t],e))return delete this[t][e];i("\n You're trying to delete a key that is not in the storage.\n ")};const qe=Object.freeze(new q);W.prototype.previous=((e,t)=>{if(M(e),n(t)){const n=oe.create(null),r=e.parentNode.children;for(child of r){if(e.isSameNode(child)){n.push(child),t([...n]),oe.destroy(n);break}n.push(child)}}}),W.prototype.next=((e,t)=>{if(M(e)||i('\nThe first argument in "interface.next()" must be a valid HTML element.\n'),n(t)){let n=!1;const r=oe.create(null),o=e.parentNode.children;for(let t of o)(e.isSameNode(t)||n)&&(r.push(t),n||(n=!0));t([...r]),oe.destroy(r)}else i('\nThe second argument in "interface.next()" must be a function.\n')});const Me=Object.freeze(new W);Ce.protectListener("URLCHANGED"),Ce.protectListener("handler"),Q.renderContainer=K,Q.interface=Me,Q.storage=qe,Q.input=Ve,Q.form=Le,Q.toHTML=L,Q.validate=ce,Q.Inter=de,Q.simulate=me,Q.ROUTER=D,Q.supportInter=O,Q.url=ye,Q.data=fe,Q.getValue=be,Q.backend=we,Q.event=Ce,Q.whileLoading=E,Q.app=le,Q.template=T,Q.toATTR=G,Q.reativeTemplate=Z,"undefined"!=typeof module&&"object"==typeof module.exports&&(exports.renderContainer=K,exports.whileLoading=E,exports.reativeTemplate=Z,exports.toATTR=G,exports.validate=ce,exports.Inter=de,exports.backend=we,exports.simulate=me,exports.supportInter=O,exports.data=fe,exports.url=ye,exports.input=Ve,exports.getValue=be,exports.toHTML=L,exports.app=le,exports.event=Ce,exports.template=T,exports.app=le,exports.getValue=be,exports.ROUTER=D,exports.form=Le,exports.interface=Me,exports.input=Ve,exports.storage=qe)}();