From 2c15d8b1e20bde3151b2da2dd62a216fd73b519e Mon Sep 17 00:00:00 2001
From: Denis <76569844+DenisPower1@users.noreply.github.com>
Date: Tue, 7 Dec 2021 08:38:55 -0800
Subject: [PATCH 1/5] v1.2.6
---
inter.js | 346 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 295 insertions(+), 51 deletions(-)
diff --git a/inter.js b/inter.js
index 337abfc..9d01dc7 100644
--- a/inter.js
+++ b/inter.js
@@ -1,6 +1,6 @@
/**
* Inter.
- * Version: 1.2.5
+ * Version: 1.2.6
* 2021 - by Denis Power.
* https://github.com/DenisPower1/inter
* A Javascript framework to build interactive frontend applications.
@@ -14,16 +14,12 @@
-(function(){
-
- // Some helpers functions.
-function isJson(v){
+(function(){
- return Object.prototype.toString.call(v)=="[object Json]";
-}
+ // Some helpers functions.
function isPlainObject(v){
@@ -97,6 +93,13 @@ function isTag(supposed){
}
+function hasRef(text){
+
+ const pattern=/{\s*.*\s*}/.test(text);
+
+ return pattern;
+
+ }
function isDefined(v){
@@ -288,6 +291,59 @@ Object.type=(obj)=>{
}
+Para ajudar o analisador a registrar
+
+/**
+ * Adding the getTextNodes to the Node.prototype.
+ * It will be a read-only property used to get
+ * all textNodes of the target, it is used to help to
+ * register the reference in the main element's textNodes
+ * when the main element has also elementNodes.
+ *
+ *
+ * { greating }, Inter!
+ *
+ *
+ *
+ *
+ * toHTML({
+ * in:"test",
+ * data:{
+ * greating:"Bonjour"
+ * }
+ * })
+ *
+ * Prior to Inter v1.2.6 the parser could not register the reference in main element's textNode,
+ * when there wer also elementNodes in it.
+ *
+ */
+
+
+Object.defineProperty(Node.prototype,"getTextNodes",{
+
+ get(){
+
+ const textNodes=new Set();
+
+ if(this.hasChildNodes()){
+
+ for(let child of this.childNodes){
+
+ if(child.nodeType==3 && hasRef(child.textContent)){
+
+ textNodes.add(child)
+
+ }
+
+ }
+
+ }
+
+ return array.create(textNodes)
+
+ }
+
+} )
const _global=globalThis ? globalThis : window;
@@ -300,6 +356,10 @@ return lowerCase.call(tag.nodeName)=="a" || lowerCase.call(tag.nodeName)=="butto
}
+
+
+
+
function getRoutingTag(){
const tS=toString(this);
@@ -312,14 +372,21 @@ function getRoutingTag(){
}
+
+
+
+
+
const children=this.getElementsByTagName("*");
for(let child of children){
if(isButtonOrAnchor(child) && hasAttr(child, "setPath")){
child.setpath=getAttr(child,"setPath");
child.removeAttribute("setPath");
+
child.onclick=function(ev){
+
ev.preventDefault();
const routeTo=this.setpath;
@@ -333,13 +400,19 @@ function getRoutingTag(){
`)
}
}
+
+ _dom.observeClickEvent(child);
}
- if(isButtonOrAnchor(child) && hasAttr(child,"useHash")){
+ else if(isButtonOrAnchor(child) && hasAttr(child,"useHash")){
child.setpath=getAttr(child,"useHash");
child.removeAttribute("useHash");
+
child.onclick=function(ev){
- ev.preventDefault();
+
+
+ ev.preventDefault();
+
const routeTo=this.usehash;
if(validPath.test(routeTo)){
url.useHash(routeTo);
@@ -351,12 +424,20 @@ function getRoutingTag(){
}
- }
+
+ }
+
+
}
}
-}
+
+ }
+
+
+
+
@@ -404,6 +485,17 @@ reConstroy(key, pro,value){
for(let r of references){
const match=new RegExp(`{\(\:?\\s+)\*\(\:?${r})\(\:?\\s+)\*}`,"g");
plainText=plainText.replace(match, refs[r]);
+
+ if(!hasRef(plainText)){
+
+ //If there's no more reference to parse
+ // We should break the loop to evoid unnecessary
+ //computation.
+
+ break;
+
+ }
+
}
target.textContent=plainText;
}
@@ -472,7 +564,7 @@ let _status="development"
const app={
get version(){
- return "1.2.5"
+ return "1.2.6"
},
@@ -841,17 +933,35 @@ Object.defineProperty(data,"query", {
Object.freeze(data)
-Object.defineProperty(INTER, Symbol.hasInstance,{
- value: function(){
- return false;
+Object.defineProperties(INTER,{
+
+ [Symbol.hasInstance]:{
+
+
+ get(){
+
+ return false;
+
+ }
+
},
- enumerable:false,
- configurable:false,
- writable:false,
+
+ [Symbol.toStringTag]:{
+
+ get(){
+
+ return "Inter";
+
+ }
+
+ }
+
})
+
+
function whileLoading(obj){
if(new.target!==void 0){
SyntaxErr(`
@@ -992,8 +1102,9 @@ function isaNodeElement(supposedElement){
*
*/
- const pattern=/^\[object HTML+(:?[A-Z]+)+Element\]$/i;
+ const pattern=/^\[object HTML+(:?[A-Z]+)+Element\]$/i;
return pattern.test(supposedElement);
+
}
function hasOnlyAChild(parent){
@@ -1369,18 +1480,18 @@ if(!isDefined(pathname)){
if(pathname=="/"){
window.history.pushState(null, null,`/#${pathname}`);
event.fire("URLCHANGED");
- getRoutingTag.call(document.body);
+
return false;
}
if(pathname!="/" && atualUrl=="/"){
window.history.pushState(null, null, `/#${pathname}`);
event.fire("URLCHANGED");
- getRoutingTag.call(document.body);
+
return false;
}else{
window.history.replaceState(null, null,`/#${pathname}`);
event.fire("URLCHANGED");
- getRoutingTag.call(document.body);
+
}
}
@@ -1402,7 +1513,7 @@ if(!isDefined(pathname)){
if(pathname=="/"){
window.history.pushState(null, null, pathname);
event.fire("URLCHANGED");
- getRoutingTag.call(document.body);
+
return false;
}
if(pathname!="/" && atualUrl=="/"){
@@ -1413,7 +1524,7 @@ if(pathname!="/" && atualUrl=="/"){
else{
window.history.replaceState(null, null, pathname);
event.fire("URLCHANGED");
- getRoutingTag.call(document.body);
+
}
}
@@ -1434,23 +1545,48 @@ function InputHandler(){
let container=null;
var allNodes=document.getElementsByTagName("*");
+
+
for(let i=0; i and .
`)
}else{
if(!hasAttr(allNodes[i], "in")){
SyntaxErr(`
- in attribute required.
+ in attribute is required.
`)
}
const attr=allNodes[i].getAttribute("handleValue");
const storeHandlers=array.create(null);
- const findTheOne=getId(getAttr(allNodes[i], "in")).getElementsByTagName("*");
+ let findTheOne=getId(getAttr(allNodes[i], "in"));
+
+ if(findTheOne.getTextNodes.length>0){
+
+ for(let textNode of findTheOne.getTextNodes){
+
+ const match=new RegExp(`{\(\:?\\s+)\*\(\:?${attr})\(\:?\\s+)\*}`,"g");
+
+ if(match.test(textNode.textContent)){
+
+ const replacer=textNode.textContent.replace(match,"")
+ storeHandlers.push({target:textNode, text:textNode.textContent, input:allNodes[i]})
+ textNode.textContent=replacer;
+
+
+ }
+
+ }
+
+ }
+
+ findTheOne=findTheOne.getElementsByTagName("*")
+
for(let m=0; m0){
+
+ HTMLRegistry.create(IN)
+
+ for(let textNode of getId(IN).getTextNodes){
+
+
+
+
+ for(let key of Object.keys(data)){
+ const match=new RegExp(`{\(\:?\\s+)\*\(\:?${key})\(\:?\\s+)\*}`,"g");
+ if(match.test(textNode.textContent)){
+
+
+
+
+ HTMLRegistry.add(IN,{target:textNode, text:textNode.textContent})
+
+
+
+ }
+
+
+
+}
+
+ }
+
+
+ }
+
for(let all=0; all0){
+
- const text=getId(IN).textContent;
- const theKeys=Object.getOwnPropertyNames(data);
- theKeys.forEach(key=>{
- const match=new RegExp(`{\(\:?\\s+)\*\(\:?${key})\(\:?\\s+)\*}`,"g");
-
- if(match.test(text)){
+
+ for(let textNode of getId(IN).getTextNodes){
+
+
+
+
+ for(let key of Object.keys(data)){
+ const match=new RegExp(`{\(\:?\\s+)\*\(\:?${key})\(\:?\\s+)\*}`,"g");
+ if(match.test(textNode.textContent)){
+
+
- empty.push({target:getId(IN), text:text, position:null});
- newREF.set(IN, empty);
+
+ whatToChange.push({target:textNode, text:textNode.textContent})
+
+
+
}
- })
- }else{
+
+
+
+}
+
+ }
+
+ if(getId(IN).children.length==0){
+
+ newREF.set(IN, whatToChange)
+
+
+ }
+
+ }
for(let el=0; el
Date: Tue, 7 Dec 2021 08:40:32 -0800
Subject: [PATCH 2/5] Update package.json
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 3204276..86dc312 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "inter",
- "version": "1.2.5",
+ "version": "1.2.6",
"description": "The javascript framework to build highly interactive front-end web applications.",
"author": "Denis Power",
"license": "MIT",
From d30138b45649b22cc854653fe85cea94c990de06 Mon Sep 17 00:00:00 2001
From: Denis <76569844+DenisPower1@users.noreply.github.com>
Date: Tue, 7 Dec 2021 08:41:00 -0800
Subject: [PATCH 3/5] v1.2.6
---
package.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/package.json b/package.json
index 86dc312..f40f10b 100644
--- a/package.json
+++ b/package.json
@@ -10,5 +10,6 @@
"devDependencies":{
"nodejs":">=14.18.0",
"interfy":"=>2.1.0"
+
}
}
From 3afd2700f18f4317be8e619a15e1b025c2398c61 Mon Sep 17 00:00:00 2001
From: Denis <76569844+DenisPower1@users.noreply.github.com>
Date: Tue, 7 Dec 2021 08:44:45 -0800
Subject: [PATCH 4/5] v1.2.6
---
inter.min.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/inter.min.js b/inter.min.js
index a4bde92..bb5803c 100644
--- a/inter.min.js
+++ b/inter.min.js
@@ -9,4 +9,5 @@
*/
-!function(){function e(e){return"[object Object]"==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)}function n(e){return"number"==typeof Number(e)}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e||"boolean"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e?typeof e:Object.type(e)}function s(e){return e in this}function a(e){return!(null==e)}function i(e){return 1==e||0==e}function l(e){const t=e.tagName;return"input"==_.call(t)||"textarea"==_.call(t)}const c={get status(){return O.app.status}};function u(e){if("production"==c.status)return!1;throw new SyntaxError(e)}function d(e){if("production"!=c.status&&"development"==c.status)throw new TypeError(e)}function h(e){if(document instanceof Document){const t=document.getElementById(e);if(null!=t)return t;u(`\n There is not an element by id "${e}" on the document.\n `)}}function f(e){"production"!=c.status&&console.warn(e)}function p(e){return document instanceof Document?document.createTextNode(e):void 0}function g(e,t){return null!=e&&(Pe(e)?e.hasAttribute(t):void 0)}function m(e){return document instanceof Document?document.createElement(e):void 0}function y(e,t,n){return null==e?void 0:e.setAttribute(t,n)}function b(e,t){return null==e?void 0:e.getAttribute(t)}function w(e){return 1==e}Object.destroyAll=(e=>{const t=Object.keys(e);for(let n of t)delete e[n]}),Object.type=(t=>e(t)?"object":Array.isArray(t)?"array":null==t?"null":void 0);const O=globalThis||window,x=/^\/(:?[\s\S]+)|\/$/;function j(e){return"a"==_.call(e.nodeName)||"button"==_.call(e.nodeName)}function E(){var e;if("[object Window]"==(e=this,Object.prototype.toString.apply(e,void 0)))return;const t=this.getElementsByTagName("*");for(let e of t)j(e)&&g(e,"setPath")&&(e.setpath=b(e,"setPath"),e.removeAttribute("setPath"),e.onclick=function(e){e.preventDefault();const t=this.setpath;x.test(t)?G.setPath(t):u("\n A valid pathName must start with /.\n ")}),j(e)&&g(e,"useHash")&&(e.setpath=b(e,"useHash"),e.removeAttribute("useHash"),e.onclick=function(e){e.preventDefault();const t=this.usehash;x.test(t)?G.useHash(t):u("\n A valid pathName must start with /.\n ")})}function T(e,t){return!Object.is(e,t)}const C=Symbol("StrictRed"),N={[C]:Object.create(null),create(e){return this[C][e]=A.create(null)},set(e,t){this[C][e].push(t)},get(e){return this[C][e]},has(e){return e in this[C]},reConstroy(e,t,n){let r=this.get(e);for(let e of r){const{text:r,target:o,refs:a}=e;s.call(a,t)&&(a[t]=n);let i=r,l=Object.getOwnPropertyNames(a);for(let e of l){const t=new RegExp(`{(:?\\s+)*(:?${e})(:?\\s+)*}`,"g");i=i.replace(t,a[e])}o.textContent=i}}};function R(){}R.prototype.create=(e=>null==e?[]:[...e]),R.prototype.shareItens=((e,t)=>{for(let n of e)t.push(n)}),R.prototype.destroy=(e=>{let t=e.length;for(;t--;)e.pop()});var A=new R;const $={handleMemory:new Set,addCont(e){this.handleMemory.add(e)},has(e){return this.handleMemory.has(e)}};let P="development";const S={get version(){return"1.2.5"},set status(e){if("production"!=P&&"development"!=e){if("production"!=e)throw new Error(`\n "${e}" is an invalid value for the app.status property.\n `);console.log("The app is now in production, every error will be\n hidden.\n "),P=e}},get status(){return P}};Object.preventExtensions(S),Object.defineProperty(window,"onload",{set(e){this.addEventListener("load",t=>{"development"==S.status&&console.log("You're using Inter in development mode, when you deploy your app turn on the production mode."),z(),r(e)&&e(t)})}}),window.onload=(()=>{z()});class I{constructor(){}addHTML(t){if(e(t)){const{in:e,elements:n}=t,o=h(e);n.forEach(e=>{const{tag:t,text:n,children:s=[],attrs:a={},events:i={}}=e;if(null==t)return!1;let l=m(t);Object.entries(a).forEach(e=>{const[t,n]=e;y(l,t,n)}),Object.entries(i).forEach(e=>{const[t,n]=e;l[t]=n,o.appendChild(l)}),null!=n&&0==s.length&&(r(n)?null!=n()&&l.appendChild(p(n())):l.appendChild(p(n))),s.length>0&&De(l,s),o.appendChild(l)})}else u("\n The argument passed in the method AddHTML must be a plain object.\n ")}}var L=new Proxy({url:function(e){return a(e)||u("The argument in validate.url() method must not be null or undefined."),/^(?:http:\/\/|https:\/\/)+(:?[A-Z]{2,8}\.)*(:?[a-z]+)+\.+(:?[a-z]{2,8})+(:?[\s\S])*$/i.test(e)},email:function(e){return a(e)||u("The argument in validate.email() method must not be null or undefined."),/^(?:[A-Z]+)+(:?[0-9]+)*@+(:?[A-Z]+)\.[A-Z]+$/i.test(e)}},{set:(e,t,n,r)=>"url"==t||"email"==t?(d("\n You must not overwrite built-in methods\n "),!1):Reflect.set(e,t,n,r),deleteProperty:(e,t)=>"url"==t||"email"==t?(d("\n You must not delete built-in methods\n "),!1):Reflect.deleteProperty(e,t)});Object.defineProperties(I.prototype,{toString:{value:()=>"[Object Inter]",toLocaleString:{value:()=>"[Object Inter]"}}});const H=new I,k=new Proxy(H,{set:(...e)=>(u("You can not set any property in Inter object,\n this is a fatal action.\n "),!1),deleteProperty:(...e)=>(u("Fatal error: do not try to delete any property of Inter object"),!1),getPrototypeOf:e=>null,setPrototypeOf:(...e)=>!1}),_=String.prototype.toLowerCase;const D=new function(){this.query=function(n){if(e(n)){const{in:r,setting:o}=n,{applyTo:a,value:i,query:l}=o;e(o)||u("\n Setting must be an object.\n "),t(r)&&t(a)||u("\n The in=>target and the applyTo=>reciever properties must be array.\n ");let c=r.filter(e=>{s.call(e,l)||console.log(`It's was not found a property called "${l}" in target object, in data.query()`);const t=e[l];if(_.call(t).includes(_.call(i)))return e});if(A.destroy(a),""===i)return!1;A.shareItens(c,a)}else u("\nThe argument in data.query() must be an object.\n")}};Object.defineProperty(D,"query",{enumerable:!0,value:D.query}),Object.freeze(D),Object.defineProperty(H,Symbol.hasInstance,{value:function(){return!1},enumerable:!1,configurable:!1,writable:!1});const Y={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)}};function B(e){return/^\[object HTML+(:?[A-Z]+)+Element\]$/i.test(e)}te(k,"renderIf",r=>{const o=A.create(null);new Set;if(e(r)){const{in:l,watch:c,conditions:d}=r;function i(){const e=h(l);o.length>0&&(o.forEach((t,n)=>{const{el:r,index:o}=t;e.removeChild(r)}),A.destroy(o)),t(d)||u("\n conditions must be an array.\n "),[...d].forEach((t,r)=>{const{render:i}=t;if(!a(i.call(t))&&s.call(o,String(t.index))){const n=e.children[t.index];e.removeChild(n),delete o[String(t.index)]}if(B(i.call(t))){const r=t.index,s=e.children[r];if(n(r)){let n=e.children[r];if(function(e){return 1==e.children.length}(e)&&!a(t.replace)&&0==r){const t=e.children[0];return e.insertBefore(i()[0],t),o.push({el:e.children[r],index:r}),!1}if(a(s)&&w(t.replace))return e.replaceChild(i()[0],s),o.push({el:e.children[r],index:r}),!1;if(a(n))e.insertBefore(i()[0],n),o.push({el:e.children[r],index:r});else{e.children.length-1+1==r?(e.appendChild(i()[0]),o.push({el:e.children[r],index:r})):u(`Invalid index, it's impossible to render the element at index "${r}"!\n `)}}else u("\n The index in Inter.renderIf() must be a number.\n ")}})}e(c)||u("You must define the watch proprety and it's value must be an object."),me(c,i)}else u("\n \n The argument of Inter.renderIf() method must be a function must be\n an object.\n\n ");i()});const U=new class{constructor(){}typing(t){if(e(t)){const{in:e,setting:o,done:s}=t;var n=h(e);Array.from(o).forEach(e=>{const{text:t,speed:o}=e;let a=[...t][Symbol.iterator](),i=setInterval(()=>{let e=a.next().value;if(void 0!==e)Y.has(n)?(n.textContent=`${Y.get(n)}${e}`,Y.addRef(n,`${Y.get(n)}${e}`)):(n.textContent=e,Y.addRef(n,e));else if(clearInterval(i),r(s))return s()},Number(o))})}}cleaning(t){if(e(t)){const{in:e,speed:n,done:o}=t,s=h(e),i=[...s.textContent];let l=setInterval(()=>{i.pop(),s.textContent=function(e){let t=[...e];return t.pop(),t.reduce((e,t)=>e.concat(t),"")}(s.textContent),a(i[0])||(clearInterval(l),Y.has(s)&&delete Y.refHandler[s],r(o)&&o())},Number(n))}else u("\n The value passed as argument in the method cleaning must be an object.\n ")}};var M=new Proxy(U,{deleteProperty:(...e)=>(u("\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});function V(e){return 0==e.length}function q(){}q.prototype.useHash=(e=>{x.test(e)||u("\n pathName must starts with /.\n ");const t=window.location.pathname;return a(e)||u("You must define the path of the url."),"/"==e?(window.history.pushState(null,null,`/#${e}`),Q.fire("URLCHANGED"),E.call(document.body),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,`/#${e}`),Q.fire("URLCHANGED"),E.call(document.body),!1):(window.history.replaceState(null,null,`/#${e}`),Q.fire("URLCHANGED"),void E.call(document.body))}),q.prototype.setPath=(e=>{const t=window.location.pathname;return x.test(e)||u("\n Pathname must starts with /.\n "),a(e)||u("\n setPath's parameter must not be a null or undefined value.\n "),"/"==e?(window.history.pushState(null,null,e),Q.fire("URLCHANGED"),E.call(document.body),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,e),Q.fire("URLCHANGED"),!1):(window.history.replaceState(null,null,e),Q.fire("URLCHANGED"),void E.call(document.body))});const G=Object.freeze(new q),W={handler:Object.create(null),justRegistered(e){return e in this.handler}};function z(){let e=null;var t=document.getElementsByTagName("*");for(let n=0;n{let t=W.handler[a];for(let n of t){const{target:t,text:o}=n,s=new RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(s.test(o)){let n=o.replace(s,e.target.value);t.textContent=n}}})}else u("\n Really? handleValue must be only setted in value that recieve value.\n ");Q.fire(`handler${e}`)}function F(){}const Z=String.prototype.toUpperCase;F.prototype.request=function(t){"file:"==window.location.protocol&&d('\n \n You can not use the backend.request() method\n in an "file:" protocol, use a "http:" or "https:" protocol instead.\n\n ');const s={_set(e,t){this[e]=t},okay:null,error:null};e(t)||u(`\n \n The argument of backend.request()\n must be an object and not: ${o(t)}\n\n \n `);const{type:i,path:l,events:c={},headers:h={},body:p,security:g={},timeout:m,withCridentials:y}=t,b={get status(){return O.status},get statusText(){return O.statusText},isObj(){try{return JSON.parse(O.responseText),!0}catch(e){return!1}},get headers(){return O.getAllResponseHeaders()}},v={ontimeout:!0,onabort:!0,onprogress:!0};let O=new XMLHttpRequest;function x(){a(m)&&(n(m)?O.timeout=m:f(`\n \n \n The timeout property's value must be a number,\n and you defined ${o(m)} as its value.\n \n `)),w(y)&&(O.withCredentials=!0);const t=Z.call(i);re(g)||!a(g)?O.open(t,l,!0):e(g)&&g.username&&g.password&&O.open(t,l,!0,g.username,g.password),Object.entries(h).forEach(e=>{const[t,n]=e;O.setRequestHeader(t,n)}),Object.entries(c).forEach(e=>{const[t,n]=e;_.call(t)in v||d(`\n \n "${t}" is an unrecognised backend.request() event.\n `),r(n)&&_.call(t)in v&&(O[t]=function(e){if("onprogress"==t){const t=Math.round(100*e.loaded/e.total);n(t)}else n()})}),O.onload=function(){let e=null;try{if(e=JSON.parse(this.responseText),200!==this.status)return r(s.error)&&s.error.call(b,e),!1;r(s.okay)&&s.okay.call(b,e)}catch(t){if(e=this.responseText,200!==this.status)return r(s.error)&&s.error.call(b,e),!1;r(s.okay)&&s.okay.call(b,e)}},O.onerror=function(){r(s.error)&&s.error.call(b,this.statusText)},"GET"==t?O.send(null):a(p)&&O.send(p)}return{okay(e){r(e)?(s._set("okay",e),x()):u("\n The argument of okay response method must be a function.\n ")},error(e){r(e)?(s._set("error",e),x()):u("\n The argument of error response method must be a function.\n ")},response(e,t){arguments.length<2&&u("\n backend.request().response() must have two arguments.\n "),r(e)&&r(t)?(s._set("okay",e),s._set("error",t),x()):u("\n The arguments of backend.request().response() must be functions.\n ")}}};const J=Object.freeze(new F),X={protectedListener:Object.create(null),ref:Object.create(null),add:function(e,t){this.ref[e]=t}},K=new Proxy({},{set(e,t,n,r){t in X.ref&&X.ref[t](n)}});const Q=Object.freeze(new function(){this.fire=((e,t)=>(a(e)||u("\n You must define the event name.\n "),a(t)?!!this.hasListener(e)&&(K[e]=t,!0):!!this.hasListener(e)&&(K[e]=void 0,!0))),this.listen=((e,t)=>(null==e&&u("The first argument of event.listen() must be defined(the event's name)."),r(t)||u("\n The second argument of event.listen() must be a function.\n "),!s.call(X.ref,e)&&(X.add(e,t),!0))),this.removeListener=(e=>{if(a(e)){if(!s.call(X.ref,e))return f(`\n Ops, you are trying to delete a listener that does not exist!\n Listener: [${e}].\n `),!1;if(!s.call(X.protectedListener,e))return delete X.ref[e];u(`\n The listener of "${e}" is protected, you can not remove it.\n `)}else u("\n You must define the event's name that you want to remove its listener.\n ")}),this.protectListener=(e=>s.call(X.protectedListener,e)?(f(`The listener of "${e}" is already protected. `),!1):(X.protectedListener[e]=!0,!0)),this.hasListener=(e=>!!s.call(X.ref,e))}),ee=new Proxy(Object.create(null),{set:(e,t,n,r)=>t in ee?"Inter here":Reflect.set(e,t,n,r)});function te(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0})}const ne={handler:{},add(e,t){return this.handler[e].push(t)},create(e){return!(e in this.handler)&&(this.handler[e]=A.create(null))}};function re(e){return 0==Object.keys(e).length}function oe(){}function se(e){return e.getElementsByTagName("*").length>0}oe.prototype.each=((e,t,n,r)=>{if(se(e)){const r=e.childNodes;for(let e=0;e0&&s.length>0)for(let e=s.length-1;e>-1;e--)pe(s[e],o[e])?o[e].parentNode.replaceChild(s[e],o[e]):a(o[e])&&a(s[e])&&ge(o[e],s[e])&&o[e].parentNode.replaceChild(s[e],o[e]);else{if(function(e,t){const n=e.getElementsByTagName("*").length,r=t.getElementsByTagName("*").length;return 0==n&&r>0||n>0&&0==r}(e,r))return t.replaceChild(e,r),!1;ge(e,r)&&t.replaceChild(e,r)}}function pe(e,t){return!(e.nodeName==t.nodeName)}function ge(e,t){let n=!1;const r=e.attributes,o=t.attributes;if(T(t.render,!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(!g(e,r)){n=!0;break}if(g(e,r)){if(b(e,r)!==o){n=!0;break}}}if(!n&&e.textContent&&t.textContent){if(Re(e)&&Re(t))return!1;n=e.textContent!==t.textContent}return n}function me(t,n,r){const s=Symbol("reactive");if(s in t)return!1;const a=Object.assign({},t),i=Object.keys(t);for(let o of i)r&&"defineProps"==o&&(t._defineProps=t[o],a._defineProps=t[o],delete t[o],delete a[o],f(`\n "defineProps" is a reserved property in the objects that are the values\n of data array in Inter.for(). So Inter redefined it to "${o="_defineProps"}".\n \n `)),Object.defineProperty(t,[o],{set(e){a[o]=e,n()},get:()=>a[o]}),e(t[o])&&me(t[o],n,!0);!r||"defineProps"in t||(Object.defineProperty(t,"defineProps",{set(r){e(r)||u(`\n \n The value of "defineProps" must be an object, and you defined\n "${o(r)}" as its value.\n\n Must be:\n\n [The object].defineProps={\n\n prop:value\n\n }\n \n\n `);for(let[e,o]of Object.entries(r))e in this||(a[e]=o,Object.defineProperty(t,[e],{set(t){a[e]=t,n()},get:()=>a[e]}),n())}}),Object.defineProperty(t,s,{value:!0,configurable:!1,writable:!1}))}te(k,"for",n=>{let{in:o,do:s,data:i,react:l}=n,c=null;if(t(i)){!function n(){c=new Proxy(i,{set:(t,n,r,o)=>(t[n]=r,e(r)&&me(r,p,!0),p(),!0)}),Object.defineProperty(c,"otherArray",{set(r){if(t(r)){i=r,p();for(let t of r)e(t)&&me(t,p,!0);n()}else u(`\n "${r}" is not an array.\n `)},get:()=>null,configurable:!0}),Object.defineProperty(c,"addValues",{value(n,r){if(t(n)||u("\n \n The first argument of [ ARRAY REACTOR ].addValues()\n must be an array.\n \n "),V(n))return f("\n \n The first argument of [ ARRAY REACTOR ].addValues()\n is an empty array.\n\n "),!1;if(!a(r)||r>i.length-1){for(let t of n)e(t)&&me(t,p,!0),i.push(t);p()}else if(0==r||r<0){for(let t=n.length-1;t>-1;t--)e(n[t])&&me(n[t],p,!0),i.unshift(n[t]);p()}else{for(let t of n)e(t)&&me(t,p,!0),i.splice(r,0,t);p()}},configurable:!0}),Object.defineProperty(c,"concat",{value:n=>{if(t(n)){for(let e of n)c.push(e);return[...i]}return c.push(n),e(n)&&me(n,p,!0),[...i]},configurable:!0}),a(l)&&(window[l]=c)}()}if(t(i)||d("data in Inter.for() must be an array."),r(s)){const t=h(o);for(let t of i)e(t)&&me(t,p,!0);function p(){if(i.lengthi.length;--n)t.removeChild(e[e.length-1])}if(!he.has(o))return i.forEach((e,n)=>{var r=s.call(c,e,n);B(r)||u(`\n You are not return the template()\n function in do() method(Inter.for). It is happening where the target id is "${o}".\n\n `);for(let e of r)t.appendChild(e)}),he.add(o),!1;he.has(o)&&i.forEach((e,n)=>{let r=s.call(c,e,n);if(a(t.children[n]))for(let e of r)fe(e,t,n);if(!a(t.children[n])&&i.length>t.children.length)for(v of r)t.appendChild(v)})}}else d("do in Inter.for() must be a function");p()});const ye={store:Object.create(null),set(e,t){this.store[e]=t},hasNotFound(){return"*"in this.store},get(){return this.store["*"]()}};let be=!1;let ve=new class{constructor(){}each(e){const{in:t,do:n}=e;let r=A.create(null),o=h(t).getElementsByTagName("*");for(let e of o)l(e)&&r.push(e);for(let e=0;e{const n=this[Oe][t];for(let t of n)e(t.clonedInput)})}else u("\n send's argument must be a function.\n ")}};function Re(e){return e.children.length>0}function Ae(){this[Symbol("store_Symbol")]=Object.create(null),this[Symbol("protect")]=new Set}Object.freeze(Ne),Ae.prototype.set=function(e,t){const n=Object.getOwnPropertySymbols(this)[0];if(arguments.length<2&&u("\n storage.set() must have two arguments!\n "),this[Object.getOwnPropertySymbols(this)[1]].has(e)&&u(`\n \n The info named "${e}" is protect\n and you can not overwritten it.\n\n `),!(e in this[n]))return this[n][e]=t;this[n][e]=t,f(`\n there's already an element named "${e}" on the storage, and it's value\n was overwritten.\n `)},Ae.prototype.get=function(e,t){const n=Object.getOwnPropertySymbols(this)[0];if(arguments.length<2&&u("\n storage.get() must have two arguments!\n "),r(t)||u("\n The second argument in storage.get() must be a function.\n "),s.call(this[n],e)){return t(this[n][e])}f("\n You are trying to get an element that is not actually registered in the storage.\n ")},Ae.prototype.has=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(a(e))return s.call(this[t],e);u("\n You must define the element to check its existence in the storage.\n ")},Ae.prototype.delete=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(a(e)||u("You must define the key you want to delete from storage."),s.call(this[t],e)){this[Object.getOwnPropertySymbols(this)[1]].has(e)&&u(`\n \n The info named "${e}" is protect\n and you can not delete it from the storage.\n\n `),delete this[t][key]}else u("\n You're trying to delete a key that is not in the storage.\n ")},Ae.prototype.protect=function(e){if(null==e&&u("\n \n You must define the info name to protect\n in storage.protect(infoName)\n\n "),this.has(e)){this[Object.getOwnPropertySymbols(this)[1]].add(e)}else u(`\n \n The info named ${e} is not on the storage yet,\n so register it first and then protect it.\n \n `)};const $e=Object.freeze(new Ae);function Pe(e){return 1==e.nodeType}function Se(){}Se.prototype.previous=((e,t)=>{if(Pe(e),r(t)){const n=A.create(null),r=e.parentNode.children;for(child of r){if(e.isSameNode(child)){n.push(child),t([...n]),A.destroy(n);break}n.push(child)}}else;}),Se.prototype.next=((e,t)=>{if(Pe(e)||u('\nThe first argument in "interface.next()" must be a valid HTML element.\n'),r(t)){let n=!1;const r=A.create(null),o=e.parentNode.children;for(let t of o)(e.isSameNode(t)||n)&&(r.push(t),n||(n=!0));t([...r]),A.destroy(r)}else u('\nThe second argument in "interface.next()" must be a function.\n')});const Ie=Object.freeze(new Se);function Le(t,n,o,a){Object.entries(n).reduce((e,n)=>{const[o,s]=n;null==s||o.startsWith("on")?o.startsWith("on")&&r(s)&&(t[o]=function(e){s.call(a,e)}):y(t,o,s)},{}),Object.entries(a).reduce((e,n)=>{const[o]=n;Object.defineProperty(a,o,{set(e){null==e?o.startsWith("on")?t[o]=void 0:t.removeAttribute(o):o.startsWith("on")?(r(e)||u(`\n The value of "${e}" event, must be a function.\n `),t[o]=function(t){e.call(a,t)}):y(t,o,e)},get(){if(!o.startsWith("on"))return b(t,o);u(`\n "${o}" seems to be an event listener, \n and you can not get the value of an event.\n `)}})},{});const i=Object.create(null);Object.defineProperty(i,[o],{value:new Proxy(n,{set(e,n,o,a){if(s.call(e,n)){if(null==o)return n.startsWith("on")?t[n]=void 0:t.removeAttribute(n),!1;if("value"!=n&&!n.startsWith("on"))return y(t,n,o),Reflect.set(e,n,o,a),!1;"value"==n?(t.value=o,Reflect.set(e,n,o,a)):n.startsWith("on")&&(r(o)||u(`\n Oh, the value of "${n}" event, must be a function.\n `),t[n]=function(t){o.call(e,t)})}},get(e,n,r){if(!n.startsWith("on"))return t[n];u(`"${n}" seems to be an event listener, and you can\n not get the value of an event`)}})}),e(O.managers)||(O.managers=Object.create(null)),O.managers[o]=i[o]}Q.protectListener("URLCHANGED"),Q.protectListener("handler");const He={call:void 0,load(e){this.call=e},fire(){this.call()}};function ke(e,t){const n=e.children,r=A.create(null),o=A.create(null);if(w(t)){if("file:"==window.location.protocol)u('\n You can not use container rendering with external template in\n a "file:" protocol. Use "http:" or "https:" protocols instead.\n ');else{const t=e.getElementsByTagName("inter-container"),n=t.length;let r=0;He.load(()=>{if(r{const n=e.attributes;/