-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinter.min.js
12 lines (11 loc) · 34.9 KB
/
inter.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/**
* Interjs
* Version - 2.2.4
* MIT LICENSED BY - Denis Power
* Repo - /~https://github.com/interjs/inter
* 2021 - 2024
* GENERATED BY INTER BUILDER
*
*/
!function(){function e(e){q(`The "${e}" event was not created because\n its handler is not a function, in the tempate function.`)}function t(e){q(`"${e}" doesn't seem to be a valid dom event.`)}function n(e){q(`"${e}" doesn't seem to be a valid style name.`)}function o(e){B(`"${J(e)}" is an invalid tag name,\n in the template function.`)}function r(){B('The "events", "attrs" and "styles" options in the template function\n must be plain Javascript objects, and you didn\'t define\n one or more of those options as plain Javascript object.')}function i(e){const t=`You shoud not use "${e}" as an attribute name, it seems to be a dom event,\n use it as property of the "events" object, like:\n\n {\n tag: "button", text: "Some text", events: { ${e}: () => { //Some code here } }\n }\n `;H(e.startsWith("on")?t:'You should not use the style attribute(in attrs object) to create styles for the element,\n use the "styles" object instead, like:\n\n {\n tag: "p", text: "Some text", styles: { color: "green" }\n }\n')}function s(e,t){q(`"${t}" is an invalid value for the "${e}" style.`)}function a(e){B(`The value of "setProps" must be a plain Javascript object, and you\n defined "${J(e)}" as its value`)}function c(){M("Inter failed to define the reactivity,\n because the Array of the each option is not configurable.")}function l(e){B(`"${J(e)}" is not a valid value for the "each" option in renderList.\n The values that are accepted in "each" option, are:\n Array.\n Plain js object.\n Number.\n Map.\n Set.`)}function f(){B('The template function is not being returned inside the "do" method in\n renderList(reactive listing), just return the template function.')}function u(){B('The arguments of "okay", "error" and "response" methods must be\n functions.')}function d(e){H(`"${e}" is a reserved reference name, use other name.`)}function h(e){H(`"${e}" was not defined as a conditional property.`)}function p(e){M(`The value of a conditional property must be boolean(true/false),\n and the value of "${e}" property is not boolean.`)}function m(e,t,n){0!=t.trim().length?q(`\n \n The conditional rendering parser found\n an element with the "_ifNot" attribute and the value\n of this attribute is not a conditional property.\n \n {\n element: ${e.nodeName.toLowerCase()},\n _ifNot: ${t},\n data: { ${Object.keys(n)} }\n }\n \n `):b("_ifNot")}function b(e){q(`The conditional rendering parser found an ${e} attribute that does not\n have a value assigned to it. Assign a value to the ${e} attribute.\n `)}function g(e){q(`a/an "${O(e)}" element has the "_elseIf" attribute,\n but it does not come after an element with the "_if" or a valid "_elseIf" attribute.`)}function y(e,t,n){0!=e.trim().length?q(`\n The conditional rendering parser found\n an element which has the "_if" attribute and the value\n of this attribute is not a conditional property.\n \n {\n element: ${t.nodeName.toLowerCase()},\n _if: ${e},\n data: { ${Object.keys(n)} }\n }\n \n `):b("_if")}function v(e){return w(e)&&e.element&&e[Symbol.for("template")]}function j(e){return Object.isFrozen(e)||Object.isSealed(e)||!Object.isExtensible(e)}function w(e){return"[object Object]"==Object.prototype.toString.apply(e,void 0)}function O(e){return e.nodeName.toLowerCase()}function x(e){return e instanceof Set}function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function T(e){return e instanceof Map}function C(e){return void 0!=e}function S(e){return Object.is(e,!0)}function I(e){return Object.is(e,!1)}function $(e){return"function"==typeof e}function k(e){return 0==Object.keys(e).length}function N(e){return e instanceof HTMLElement}function P(e){return e in HTMLElement.prototype}function R(e){return e in document.createElement("p").style}function E(e){return document.createTextNode(e)}function _(e){return"string"==typeof e}function L(e,t,n){return w(e)&&w(t)&&w(n)}function z(e){"string"!=typeof e&&B("The value of the id attribute must be a string.");const t=document.getElementById(e);if(void 0!=t)return t;M(`There's not an element on the document with id "${e}".`)}function J(e){return void 0===e||"symbol"==typeof e||"bigint"==typeof e||"boolean"==typeof e||"function"==typeof e||"number"==typeof e||"string"==typeof e?typeof e:function(e){return C(e)&&Object.prototype.toString.call(e).startsWith("[object")?Object.prototype.toString.call(e).replace("[object","").replace("]","").replace(/\s/g,"").toLowerCase():"null"}(e)}function B(e){throw Error(`Inter syntaxError : ${e}`)}function M(e){throw Error(`Inter error: ${e}`)}function H(e){console.warn(`Inter warning: ${e}`)}function q(e){console.error(`Inter parser error: ${e}`)}function W(e){return Array.isArray(e)}function Y(e){return 1==e||0==e}function D(e){return e instanceof Array||w(e)||e instanceof Map||e instanceof Set||"number"==typeof e}function F(e){this.source=function(e){const t={values:[],type:void 0};if(W(e))t.values=e,t.type="array";else if(w(e))t.values=Object.entries(e),t.type="object";else if(e instanceof Map)e.forEach((e,n)=>{t.values.push([n,e])}),t.type="object";else if(e instanceof Set)t.values=Array.from(e),t.type="set";else if("number"==typeof e){for(let n=0;e>n;n++)t.values.push(n);t.type="number"}return t}(e),this.break=!1}function U(e){return e="string"==typeof e?e.trim():e,new Set([0,!1,null,void 0,""]).has(e)}function X(e){return/{\s*.*\s*}/.test(e)}function G(e){const t=new Set;return e.replace(/{\s*(:?[\w-\s]+)\s*}/g,e=>{const n=e.replace("{","").replace("}","").trim();t.add(n)}),Array.from(t)}function K(e,t){return RegExp(`{\\s*${t}\\s*}`).test(e)}function Q(e,t,n){function o(e){function r(e){for(const o in t)if(e.textContent.trim().length>0&&K(e.textContent,o)){const t={target:e,text:e.textContent};n.add(t);break}}if(1==e.nodeType)for(const t of e.childNodes)t.hasChildNodes()&&1==t.nodeType?o(t):r(t);else 3==e.nodeType&&r(e)}function r(e){const o={target:e,attrs:Object.create(null),refs:t};for(const r of e.attributes)for(const i in t)if(K(r.value,i)){Me.has(r.name)?(n.specialAttrs.add({target:e,attr:{[r.name]:r.value}}),e.removeAttribute(r.name)):o.attrs[r.name]=r.value;break}var r;r=o.attrs,Object.keys(r).length>0&&n.add(o,!0)}const i=e.getElementsByTagName("*"),s=function(e){const t=new Set;if(e.hasChildNodes())for(const n of e.childNodes)3==n.nodeType&&n.textContent.trim().length>0&&X(n.textContent)&&t.add(n);return Array.from(t)}(e);if(s.length>0)for(const e of s)o(e);for(const e of i)o(e),r(e);n.updateRefs()}function V(e){return null==e}function Z(e){return e.replace("{...","").replace("}","")}function ee(e,t){return A(e,t)}function te(e){return/{(:?\.){3}(:?\S+)}/.test(e)}function ne(e,t){const n=new Set(["value","currentTime"]),o=e=>!n.has(e),r=e=>e.startsWith("on")&&P(e),i=e=>!o(e),s=new Map;for(const[n,a]of Object.entries(t))!o(n)||r(n)||V(a)?i(n)&&!V(a)?re(e,n,a):r(n)&&!V(a)&&ie(e,n,a,t):oe(e,n,a),se(t,n,a,e,s);Object.defineProperty(t,"setAttrs",{set(e){w(e)||function(e){B(`\n "${J(e)}" is an invalid value for the "setAttrs" property.\n The "setAttrs" property only accepts a plain Javascript object as its\n value.\n `)}(e);for(const[t,n]of Object.entries(e))A(this,t)?this[t]=n:H(` \n The "${t}" property was not defined in the manager object.\n `)}}),function(e,t){Object.defineProperty(e,"observe",{value:e=>0===t.size&&($(e)||B(`The argument of the observe method must be a function,\n and you defined ${J(e)} as its argument.`),t.set("observeCallBack",e),!0)})}(t,s)}function oe(e,t,n){V(n)||n===(()=>e.getAttribute(t))?V(n)&&(()=>e.hasAttribute(t))()&&e.removeAttribute(t):e.setAttribute(t,n)}function re(e,t,n){C(n)?e[t]=n:V(n)&&(e[t]="")}function ie(e,t,n,o){C(n)&&!$(n)?function(e,t){B(`\n "${J(t)}" is an invalid\n handler for the "${e}" event, you must\n define only a function as the handler of a dom event.\n `)}(t,n):V(n)?e[t]=void 0:e[t]=(e=>n.call(o,e))}function se(e,t,n,o,r){const i=new Set(["value","currentTime","checked"]),s=()=>!i.has(t),a=()=>t.startsWith("on")&&P(t),c=()=>!s();let l=n;Object.defineProperty(e,t,{set(e){a()?ie(o,t,e,this):s()?oe(o,t,e):c()&&re(o,t,e),l=e;const n=r.get("observeCallBack");r.has("observeCallBack")&&n(t,e)},get:()=>c()?o[t]:a()?(function(e){H(`\n you are trying to get the value of "${e}",\n it's an event, and you can not get the value of an event.\n `)}(t),!1):l})}function ae(e){const t=[];return e.childNodes.forEach(e=>{(1==e.nodeType||3==e.nodeType&&0==!e.textContent.trim().length)&&t.push(e)}),t}function ce(e){H(`"${e}" is a reserved property, you can not use it as a conditional property.`)}function le(e){const t=e.getAttribute("_if"),n=e.getAttribute("_elseIf"),o=e.getAttribute("_ifNot"),r=!!e.hasAttribute("_else")||void 0;return He.set([t,n,o,r]),He.getSize()>1}function fe(e){const t=e.hasAttribute("_if"),n=e.hasAttribute("_elseIf"),o=e.hasAttribute("_ifNot"),r=e.hasAttribute("_else");return!(t||n||o||r)}function ue(n,o){Object.entries(n).forEach(n=>{const[r,i]=n;P(r)?$(i)?o[r]=i:e(r):t(r)})}function de(e,t){Object.entries(e).forEach(e=>{let[n,o]=e,r=!1;const s=new Set(["value","currentTime","checked"]);(n.startsWith("on")&&P(n)||"style"==n)&&(i(n),r=!0);const a=e=>{C(e)&&!I(e)&&(s.has(n)?t[n]=e:t.setAttribute(n,e)),t.template.attrs[n]=e};r||($(o)?a(o=o()):a(o))})}function he(e,t){Object.entries(e).forEach(e=>{const[o,r]=e;if(R(o)){const e=$(r)?r():r;C(e)&&(t.style[o]=e,t.template.styles[o]=e,t.style[o]||s(o,e))}else n(o)})}function pe(e,t,n){if(C(e)&&0==t.length){const t=$(e)?E(e()):E(e);C(t)&&n.appendChild(t)}else C(e)&&t.length>0?(q("The template parser found an element \n with both the text property and the children property,\n and in this case Inter ignores the text property."),be(n,t)):t.length>0&&be(n,t)}function me(e,t,n){let{tag:i,text:s,attrs:a={},events:c={},styles:l={},children:f=[]}=e;i=$(i)?i():i,s=$(s)?s():s,A(e,"renderIf")&&!t&&q("You can not conditionally render the main\n container in the template function."),_(i)||o(i),L(a,l,c)||r();const u=document.createElement(i);return u.template=Object.assign(e,{target:u,tag:i,text:s}),t&&(u.index=n),de(a,u),ue(c,u),he(l,u),pe(s,f,u),u}function be(e,t){let n=-1;for(const i of t){let{tag:t,text:s,attrs:a={},events:c={},styles:l={},children:f=[],renderIf:u}=i;if(n++,i.index=n,t=$(t)?t():t,s=$(s)?s():s,U(u)&&A(i,"renderIf"))continue;_(t)||o(t),L(a,l,c)||r();const d=document.createElement(t);d.index=n,d.template=Object.assign(i,{target:d,tag:t,text:s}),de(a,d),ue(c,d),he(l,d),pe(s,f,d),e.appendChild(d)}}function ge(e,t,n,o){w(e)?function(e,t,n){function o(o){let r=e[o];e[o]=void 0,Object.defineProperty(e,o,{set(o){if(r=o,e[i]){const n=e[i].index;t(n)}else t();const s=w(n);ge(o,t,null,s?n:null)},get:()=>r,configurable:!0})}const r=new Set(["setProps","defineProps","deleteProps"]);const i=Symbol.for("index");w(n)&&(e[i]=n);if(ve(e))return!0;if(j(e))return H("Inter failed to define reactivity\n in a plain Javascript object, because it is not configurable."),!1;for(const i of Object.keys(e))r.has(i)&&H(`"${i}" is a reserved property, do not create a property with this name.`),o(i),ge(e[i],t,null,n);(function(t){for(const{name:n,setHandler:o}of t)Object.defineProperty(e,n,{set:o})})([{name:"defineProps",setHandler:function(i){w(i)||function(e){B(`The value of "defineProps" must be a plain Javascript object, and you\n defined "${J(e)}" as its value`)}(i);const s=w(n)?n.index:void 0;for(const[a,c]of Object.entries(i))a in this||r.has(a)||(e[a]=c,o(a),ge(e[a],t,null,n)),t(s)}},{name:"setProps",setHandler:function(t){w(t)||a(t);for(const[n,o]of Object.entries(t))r.has(n)||(e[n]=o)}},{name:"deleteProps",setHandler:function(o){W(o)||function(e){B(`The value of "deleteProps" must be an Array object, and you\n defined "${J(e)}" as its value`)}(o);const i=w(n)?n.index:void 0;for(const t of o)"string"==typeof t&&A(e,t)&&(r.has(t)||delete e[t]);t(i)}}]),ye(e)}(e,t,o):W(e)?function(e,t,n){if(ve(e))return!1;const o=["push","unshift","pop","shift","splice","sort","reverse"];for(const r of o)Object.defineProperty(e,r,{value(e,o,...i){"pop"==r?this.mutationInfo={method:"pop",renderingSystem:t}:"shift"==r?this.mutationInfo={method:"shift",renderingSystem:t}:"push"==r?this.mutationInfo={method:"push",itemsLength:arguments.length,renderingSystem:t}:"unshift"==r?this.mutationInfo={method:"unshift",itemsLength:arguments.length,renderingSystem:t}:"splice"==r&&(this.mutationInfo={method:"splice",start:e,deleteCount:o,itemsLength:C(i)?i.length:0,renderingSystem:t});const s=Array.prototype[r].apply(this,arguments);if(t(),this.mutationInfo=void 0,"push"===r||"unshift"===r)for(const e of arguments)ge(e,t,null,n);else if("splice"===r&&C(i))for(const e of i)ge(e,t,null,n);return s}});(function(e,t,n){for(const o of e)ge(o,t,null,n)})(e,t,n),ye(e),function(e){Object.defineProperty(e,"map",{value(e){const t=[];t.reactor=this;let n=-1;for(const o of this){const r=e(o,++n,this);t.push(r)}return t}})}(e)}(e,t,o):T(e)?Te(e,t):x(e)&&Ce(e,t,!1,null,o)}function ye(e){if(ve(e))return!1;const t=Symbol.for("reactive");Object.defineProperty(e,t,{get:()=>!0})}function ve(e){return A(e,Symbol.for("reactive"))}function je(e){w(e)?function(e,t,n){Object.keys(e).some((e,o)=>{e==t&&we(n,o)})}(...arguments):x(e)?function(e,t,n){Array.from(e).some((e,o)=>{e==t&&we(n,o)})}(...arguments):function(e,t,n){let o=-1;e.forEach(()=>{o++;const e=arguments[1];e==t&&we(n,o)})}(...arguments)}function we(e,t){const n=e.children[t];N(n)&&e.removeChild(n)}function Oe(e,t){const n=Symbol.for("observe");"function"==typeof e[n]&&e[n](C(t)?t:e)}function xe(e,t){Object.defineProperty(e,"setProps",{set(n){w(n)||a();for(const[o,r]of Object.entries(n))w(e)?this[o]=r:T(e)&&e.set(o,r),ge(r,t);w(e)&&t()}})}function Ae(e,t,n){j(e)&&c(),xe(e,t);const o=new Set(["observe"]),r=new Set(["setEach","setProps"]);return ye(e),new Proxy(e,{set(n,i,s,a){return!o.has(i)&&(Reflect.set(...arguments),function(e){return!r.has(e)}(i)&&(t(),Oe(e,a),"number"!=typeof s&&D(s)&&ge(s,t)),!0)},get(){return Reflect.get(...arguments)},deleteProperty(o,r,i){if(r in o)return je(o,r,n),Reflect.deleteProperty(...arguments),t(),Oe(e,i),!0;H(`You are trying to delete the "${r}" property in the list\n reactor, but that property does not exist in the list reactor.`)}})}function Te(e,t,n,o){if(ve(e))return!1;const r=["set","delete","clear"];for(const i of r)Object.defineProperty(e,i,{value(){"delete"==i&&n&&je(this,arguments[0],o);const e=Map.prototype[i].apply(this,arguments);if(n&&Oe(this),t(),"set"==i){ge(arguments[1],t)}return e}});!function(e,t){e.forEach(e=>{ge(e,t)})}(e,t),ye(e),n&&xe(e,t)}function Ce(e,t,n,o,r){if(ve(e))return!1;const i=["add","clear","delete"];for(const r of i)Object.defineProperty(e,r,{value(){"delete"==r&&n&&je(this,arguments[0],o);const e=Set.prototype[r].apply(this,arguments);return t(),n&&Oe(this),"add"===r&&ge(arguments[0],t),e}});!function(e,t,n){e.forEach(e=>{ge(e,t,0,n)})}(e,t,r),ye(e)}function Se(e){return"function"==typeof e&&(e=e()),e}function Ie(e,t,n,o){function r(e){function r(e,o){for(let r=o-1;r>-1;r--){const o=t.children[e],s=n[r],a=me(s,!0,s.index);o?t.insertBefore(a,o):t.appendChild(a),i.unshift(s)}}const i=[];if("splice"==e&&0==a&&c>0)r(s,c),o.splice(s,a,...i);else if("splice"==e&&a>0){for(let e=0;a>e;e++){const e=t.children[s];e&&t.removeChild(e)}r(s,c),o.splice(s,a,i)}else"unshift"==e&&(r(0,c),o.unshift(...i))}if(void 0==e.mutationInfo)return;const{mutationInfo:{method:i,start:s,deleteCount:a,itemsLength:c}}=e,l=t.children[t.children.length-1],f=t.children[0];if("pop"==i&&l)t.removeChild(l),o.pop();else if("shift"==i&&f)t.removeChild(f),o.shift();else if("push"==i)!function(){let e=c;for(;e>0;e--){const r=n[n.length-e];t.appendChild(me(r,!0,r.index)),o.push(r)}}();else if("unshift"==i)r(i);else if("splice"==i)if("number"==typeof s&&"number"==typeof a&&0==c)!function(){let e=s;for(;n.length<t.children.length;e++){const e=t.children[s];e&&t.removeChild(e)}o.splice(s,a)}();else if(c>0)r(i);else if(void 0==a){_e(t,{source:{values:n}})}}function $e(e,t){Object.assign(e,t)}function ke(e,t){return e.length>t.length?e:t}function Ne(e,t,n){function o(t){e.hasAttribute(t)?e.removeAttribute(t):c.has(t)&&("checked"===t?e.checked=!1:e[t]="")}const r=Object.keys(t),s=Object.keys(n),a=ke(r,s),c=new Set(["value","currentTime","checked"]);for(let l=0;a.length>l;l++){const a=r[l],f=s[l],u=Se(t[a]),d=Se(n[f]);a in n?!C(d)||I(d)?o(f):C(d)&&!I(d)&&(f.startsWith("on")&&P(f)||"style"==f?i(f):f===a&&d===u||(c.has(f)?e[f]=d:e.setAttribute(f,d))):o(a),t[a]=d}}function Pe(e,t,o){const r=Object.keys(t),i=Object.keys(o),a=ke(r,i);for(let c=0;a.length>c;c++){const a=r[c],l=i[c],f=Se(t[a]),u=Se(o[l]);if(a in o&&C(u))C(u)&&u!==f&&(R(l)?(e.style[l]=u,e.style[l]||s(l,u)):n(l));else{const t=e.style[a],n=e.getAttribute("style");C(t)&&0!==t.trim().length&&(e.style[a]=null),n&&0==n.trim().length&&e.removeAttribute("style")}t[a]=u}}function Re(n,o,r){const i=Object.keys(o),s=Object.keys(r),a=ke(i,s);for(let o=0;a.length>o;o++){const a=i[o],c=s[o];a in r&&C(r[a])||(n[a]=void 0),$(r[c])||!P(c)?C(r[c])&&(P(c)?n[c]=r[c]:t(c)):(n[a]=void 0,e(c))}}function Ee(e,t,n){for(let o=0;o<e.children.length;o++){const r=e.children[o];if(r.index>t){e.insertBefore(n,r);break}}}function _e(e,t){if(e.children.length>t.source.values.length){let n=e.children.length-t.source.values.length;for(;n--;){const t=e.children.length-1,n=e.children[t];e.removeChild(n)}}}function Le(e,t,n,o,r){e.open(t,n,!0,o,r)}function ze(e,t,n){Object.entries(t).forEach(([t,o])=>{n.has(t)?"onprogress"!==t?e[t]=(()=>{o()}):e.onprogress=(t=>{const n={abort:()=>e.abort(),progress:100*t.loaded/t.total};o(n)}):H(`There's not any event named "${t}" in Ajax request.`)})}function Je(e,t){const n={};var o,r;return e.replace(/(:?[\S]+):/g,e=>{e=e.replace(":",""),t.getResponseHeader(e)&&((o=n)[r=e]=void 0,Object.defineProperty(o,r,{get:()=>t.getResponseHeader(r)}))}),Object.freeze(n)}function Be(){void 0===new.target&&M("Backend is a constructor, call it with the new keyword.")}F.prototype.each=function(e){let t=-1;for(const n of this.source.values)if(e(n,++t,this.source.type),this.break)break};const Me=new Set(["currentTime","value"]),He={store:new Set,set(e){for(const t of e)C(t)&&this.store.add(t)},getSize(){const e=this.store.size;return this.store.clear(),e}};Be.prototype={get[Symbol.toStringTag](){return"Ajax"},request(e){function t(){const e=new XMLHttpRequest,t=n.toUpperCase(),f=new Set(["onprogress","ontimeout","onabort"]),u={get status(){return e.status},get statusText(){return e.statusText},get headers(){return Je(e.getAllResponseHeaders(),e)},get data(){return function(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}}(e.responseText)},get[Symbol.toStringTag](){return"AjaxResponse"},isObj:()=>(function(e){try{return w(JSON.parse(e))}catch(e){return!1}})(e.responseText)};w(l)&&Object.keys(l).length>=2&&(l.username&&l.password?(Le(e,t,o,l.username,l.password),h=!0):H('Invalid "security" object, security object must have the username and passoword \n properties.')),h||(Le(e,t,o),h=!0),w(c)||function(e){B(`the "headers" property must be an object, and\n you defined it as : ${J(e)}.`)}(c),w(r)||function(e){B(`the "events" property must be an object, and\n you defined it as : ${J(e)}.`)}(r),k(c)||function(e,t){Object.entries(e).forEach(([e,n])=>{t.setRequestHeader(e,n)})}(c,e),k(r)||ze(e,r,f),e.onreadystatechange=function(){4==this.readyState&&(this.status>=200&&300>this.status?d.has("okay")&&d.get("okay")(u):d.has("error")&&d.get("error")(u))},Y(s)&&(e.withCredentials=s),"number"!=typeof i&&(e.timeout=i),e.send(function(e){return C(e)?e instanceof FormData||"string"==typeof e?e:JSON.stringify(e):null}(a))}w(e)||B(`The argument of [Backend instance].request method\n must be a plain javascript object, and you defined "${J(e)}"\n as its argument.`);const{type:n,path:o,events:r={},timeout:i,withCredentials:s,body:a=null,headers:c={},security:l}=e,f=new Set(["connect","trace"]);C(n)&&"string"==typeof n||B('You must define the type(method) of request, in Ajax with the "type" option and\n it must be a string.'),C(o)&&"string"==typeof o||B('You must define the path where the request will be sent, with the "path" option and \n it must be a string.'),f.has(o.toLowerCase())&&function(e){M(`"${e}" is an unsupported request type in Ajax.`)}(n);const d=new Map;let h=!1;return{okay(e){$(e)||u(),d.set("okay",e),t()},error(e){$(e)||u(),d.set("error",e),t()},response(e,n){const o=arguments.length;2>o&&function(e){B(`The response method must have two arguments and you only\n defined ${e} argument.`)}(o),$(e)||$(n)||u(),d.set("okay",e),d.set("error",n),t()}}}},Object.freeze(Be.prototype),window.Ref=function(e){if(void 0!=new.target)B("Do not call the Ref function with the new keyword.");else{if(w(e)){const{in:n,data:o}=e;"string"!=typeof n&&B("The value of the 'in' property on the Ref function must be a string."),w(o)||B("The value of the 'data' property on the Ref function must be a plain Javascript object. ");const r=new Set(["setRefs","observe"]);for(const e in o)r.has(e)?(d(e),delete o[e]):$(o[e])&&(o[e]=o[e].call(o));const i=Object.assign({},o),s={attrs:new Set,texts:new Set,specialAttrs:new Set,observed:new Map,refs:i,hadIteratedOverSpecialAttrs:!1,add(e,t){t?this.attrs.add(e):this.texts.add(e)},updateSpecialAttrs(){for(const e of this.specialAttrs){const{target:t}=e;let[n,o]=Object.entries(e.attr)[0];const i=G(o);for(const e of i)if(!r.has(e)&&e in this.refs){const t=RegExp(`{\\s*(:?${e})\\s*}`,"g");if(!X(o=o.replace(t,this.refs[e])))break}t[n]=o}},updateAttrRef(){for(const e of this.attrs){const{target:t,attrs:n}=e;for(let[e,o]of Object.entries(n)){const n=G(o);for(const e of n)if(!r.has(e)&&e in this.refs){const t=RegExp(`{\\s*(:?${e})\\s*}`,"g");if(!X(o=o.replace(t,this.refs[e])))break}t.getAttribute(e)!==o&&t.setAttribute(e,o)}}},updateTextRef(){if(this.texts.size>0)for(const e of this.texts){let{target:t,text:n}=e;const o=G(n);for(const e of o)if(!r.has(e)&&e in this.refs){const t=RegExp(`{\\s*(:?${e})\\s*}`,"g");if(!X(n=n.replace(t,this.refs[e])))break}t.textContent!==n&&(t.textContent=n)}},updateRefs(){this.texts.size>0&&this.updateTextRef(),this.attrs.size>0&&this.updateAttrRef(),this.specialAttrs.size>0&&this.updateSpecialAttrs()}};function t(e,t,n){1!=s.observed.size||r.has(e)||s.observed.get("callBack")(e,t,n)}Q(z(n),i,s);const a=new Proxy(i,{set(e,o,r,a){if(o in e&&e[o]==r)return!1;const c=e[o];if($(r)&&(r=r.call(a)),Reflect.set(...arguments),t(o,r,c),o in a)return s.updateRefs(),!0;Q(z(n),i,s)},get:(...e)=>Reflect.get(...e)});return Object.defineProperties(a,{setRefs:{set(e){if(w(e)){let o=!1;for(const[n,s]of Object.entries(e)){if(r.has(n)){d(n);continue}if(A(this,n)||(o=!0),A(this,n)&&this[n]==s)continue;const e=i[n];$(s)?i[n]=s.call(this):i[n]=s,t(n,s,e)}o&&Q(z(n),i,s)}else B(`"${J(e)}" is not a valid value for the "setRefs" property.\n The value of the setRefs property must be a plain Javascript object.`)},enumerable:!1},observe:{value:e=>($(e)||B("The argument of [Reference reactor].observe() must be a function."),0===s.observed.size&&(s.observed.set("callBack",e),!0)),enumerable:!1,writable:!1}}),a}B("The argument of the Ref function must be a plain Javascript object.")}},window.renderIf=function(e){if(w(e)||B("The argument of renderIf must be a plain Javascript object."),void 0===new.target){const{in:t,data:n}=e,o=new Set(["setConds","observe"]),r=z(t),i=[];"string"!=typeof t&&B('The value of the "in" property in the renderIf function\n must be a string.'),w(n)||B('The value of the "data" property in the renderIf function \n must be a plain Javascript object.');for(let[e,t]of Object.entries(n))o.has(e)?ce(e):(Y(t=$(t)?t.call(n):t)||p(e),n[e]=t);return function e(t){let o=-1;const r={target:void 0,if:void 0,else:void 0,ifNot:void 0,elseIfs:new Set,index:void 0,lastRendered:{target:void 0,prop:void 0},conditionalProps:new Set,rootElement:t,set setOptions(e){for(const[t,n]of Object.entries(e))this[t]=n,"if"==t&&C(n)&&this.conditionalProps.add(n)},canCache(){return void 0!=this.if},addElseIf(e){const{elseIf:t}=e;this.conditionalProps.has(t)?function(e){M(`\n Two elements in the conditional group can not have the same conditional property.\n Property: "${e}"\n `)}(t):(this.elseIfs.add(e),this.conditionalProps.add(t))},deleteData(){this.setOptions={target:void 0,if:void 0,else:void 0,ifNot:void 0,index:void 0},this.elseIfs.clear(),this.conditionalProps.clear()},getOptions(){const e=Object.assign({},this);return e.elseIfs=Array.from(this.elseIfs),e.conditionalProps=Array.from(this.conditionalProps),this.deleteData(),e}},s=()=>{const e=r.elseIfs.size,t=r.getOptions();e?i.unshift(t):i.push(t)},a=ae(t),c=a.length;for(const t of a){o++,t.index=o;const i=c-1==o;if(3!=t.nodeType)if(fe(t)||t.parentNode.removeChild(t),t.children.length>0&&e(t),le(t))q(`The conditional rendering parser found a/an "${O(t)}"\n element which has more than one conditional atribute, it's forbidden.`);else if(fe(t)&&r.canCache())s();else{if(t.hasAttribute("_ifNot")){const e=t.getAttribute("_ifNot");if(A(n,e)){t.removeAttribute("_ifNot"),r.canCache()&&s(),r.setOptions={ifNot:e,target:t,index:o},s();continue}m(t,e,n)}else if(t.hasAttribute("_else"))r.if?(r.else=t,t.removeAttribute("_else"),s()):q('The parser found an element with the "_else" attribute,\n but there is not an element with the "_if" or a valid "_elseIf" attribute before it.');else if(t.hasAttribute("_elseIf")){const e=t.getAttribute("_elseIf");t.removeAttribute("_elseIf"),r.if?A(n,e)?r.addElseIf({target:t,index:o,elseIf:e}):0!=(l=e).trim().length?q(`The conditional rendering parser found an element which has the "_elseIf"\n conditional property whose the value is: "${l}",\n but you did not define any conditional property with that name.\n \n `):b("_elseIf"):g(t)}else if(t.hasAttribute("_if")){r.canCache()&&s();const e=t.getAttribute("_if");if(t.removeAttribute("_if"),!A(n,e)){y(e,t,n);continue}r.setOptions={if:e,target:t,index:o}}i&&r.canCache()&&s()}else r.canCache()&&s()}var l}(r),function(e,t){function n(e,t){if(!I(l[t])&&e.length>=2)for(const n of e){const e=S(l[n]);e&&n!==t&&(l[n]=!1)}}function o(e,t){function n(){return null!=t.lastRendered.target.parentNode}let o=!1;for(const{target:r,elseIf:s}of e){const e=t.lastRendered;if(e.target&&S(l[e.prop])){o=!0;break}e.target&&I(l[e.prop])&&n()&&(t.rootElement.removeChild(e.target),t.lastRendered={prop:void 0,target:void 0}),S(l[s])&&(i(t.rootElement,r),t.lastRendered={prop:s,target:r},o=!0,e.target&&!C(e.prop)&&n()&&t.rootElement.removeChild(e.target))}return o}function r(t,r){for(const s of e){const{target:e,if:a,elseIfs:c,else:l,ifNot:f,rootElement:u}=s,d=s.conditionalProps,h=new Set(d).has(r);if(C(r)&&h&&n(d,r),f)I(t[f])&&null==e.parentNode?u.textContent.trim().length>0?i(u,e):u.appendChild(e):e.parentNode==u&&S(t[f])&&u.removeChild(e);else if(I(t[a]))if(e.parentNode!=u||l){if(l||c.length>0){const t=o(c,s);null!=e.parentNode&&u.removeChild(e),t&&l&&null!=l.parentNode?l.parentNode.removeChild(l):!t&&l&&null==l.parentNode&&(i(u,l),s.lastRendered={target:l,prop:void 0})}}else u.removeChild(e),o(c,s);else if(S(t[a])&&null==e.parentNode){l&&null!=l.parentNode?(u.removeChild(l),i(u,e)):i(u,e);const{target:t}=s.lastRendered;N(t)&&null!=t.parentNode&&!t.isSameNode(e)&&t.parentNode.removeChild(t),s.lastRendered={target:e,prop:a}}}}function i(e,t){const n=ae(e),o=n[n.length-1];if(t&&null==t.parentNode)if(o&&o.index>t.index){for(const o of n)if(o.index>t.index){e.insertBefore(t,o);break}}else e.appendChild(t)}function s(e,t){if(1==c.size){const n=c.get("callBack");n(e,t)}}const a=new Set(["setConds","observe"]),c=new Map,l=Object.assign({},t);r(l);const f=new Proxy(l,{set:(e,n,o)=>!(n in e&&e[n]==o||(n in t||a.has(n)?Y(o)||a.has(n)?(Reflect.set(e,n,o),a.has(n)||(r(l,n),s(n,o)),0):(p(n),1):(h(n),1))),deleteProperty:()=>!1});return Object.defineProperties(f,{observe:{value:e=>($(e)||B("The argument of [renderIf reactor].observe()\n must be a function."),0==c.size&&(c.set("callBack",e),!0)),enumerable:!1,writable:!1},setConds:{set(e){w(e)||B(`The value of [renderIf reactor].setConds must be\n a plain Javascript object, and you defined ${J(e)}\n as its value.`);for(let[n,o]of Object.entries(e))a.has(n)?ce(n):(Y(o=$(o)?o.call(t):o)||p(n),A(this,n)?this[n]!=o&&(l[n]=o,s(n,o)):h(n));r(l)},enumerable:!1}}),f}(i,n)}M("renderIf is not a constructor, do not call it with\n the new keyword.")},window.renderList=function(e){function t(e,t,n){return W(e)?(function(e){if(ve(e))return!1;const t=[{name:"addItems",handler:function(e,t){if(C(t)&&"number"!=typeof t&&B("The second argument of [LIST REACTOR].addItems must be a number."),W(e)||B("The first argument of [LIST REACTOR ].addItems must be an Array."),!C(t)||t>this.length-1)for(const t of e)this.push(t);else if(0==t||0>t)for(let t=e.length-1;t>-1;t--)this.unshift(e[t]);else for(let n=e.length-1;n>-1;n--)this.splice(t,0,e[n])}}];for(const{name:n,handler:o}of t)Object.defineProperty(e,n,{value:o})}(e),function(e,t){j(e)&&c();const n=new Set(["addItems","setEach"]);return new Proxy(e,{set(o,r,i,s){return n.has(r)?(Reflect.set(...arguments),!0):(Reflect.set(...arguments),Oe(e,s),t(),"number"!=typeof i&&D(i)&&ge(i,t),!0)},get:(e,t)=>e[t]})}(e,t)):w(e)?Ae(e,t,n):x(e)?(Ce(e,t,!0,n),e):T(e)?(Te(e,t,!0,n),e):void 0}function n(e){D(e)||l(e);const t=Symbol.for("observe");e[t]=s[t],s=e,ve(e)||o(),r(),Oe(s),"number"!=typeof s&&new F(s).each((e,t,n)=>{"object"==n?ge(e[1],r):"array"!=n&&"set"!=n||ge(e,r)})}function o(){if(ve(s))return!1;Object.defineProperties(s,{setEach:{set:n},observe:{value(e){const t=Symbol.for("observe");return"function"!=typeof this[t]&&($(e)?(Object.defineProperty(this,t,{value:e,configurable:!1}),!0):void B("The argument of the observe method must be a function."))}}}),h=t(s,r,d),W(s)&&function(e,t,n,o,r){function i(e,i,s,a){const c=o.call(r,e,i,r),l=me(c.element),u=t.children[s];v(c)||f(),l&&C(s)?t.insertBefore(l,u):t.appendChild(l),C(a)&&(i=a),n(i,!0)}const s=[{name:"unshift",handler:function(){const t=Array.prototype.unshift.apply(e,arguments);if(arguments.length>1){let e=arguments.length;for(let t=e-1;t>-1;t--)i(arguments[--e],0,0,e)}else 1==arguments.length&&i(...arguments,0,0);return n(),Oe(e),t}},{name:"shift",handler:function(){const o=Array.prototype.shift.apply(e,void 0),r=t.children[0];return r&&(t.removeChild(r),n(),Oe(e)),o}},{name:"push",handler:function(){const t=Array.prototype.push.apply(e,arguments);if(1==arguments.length)i(...arguments,e.length-1);else if(arguments.length>1){let t=arguments.length;for(const n of arguments)i(n,e.length-t--)}return n(),Oe(e),t}},{name:"pop",handler:function(){const o=Array.prototype.pop.apply(e,arguments),r=t.children,i=r[r.length-1];return i&&(t.removeChild(i),n(),Oe(e)),o}},{name:"splice",handler:function(o,r,...s){function a(){const e=r;for(let n=0;e>n;n++){const e=t.children[o];e&&t.removeChild(e)}}function c(){for(let e=s.length-1;e>-1;e--)i(s[e],e,o)}const l=Array.prototype.splice.apply(e,arguments);return r>0&&s.length>0&&(a(),c()),0==s.length?a():0==r&&s.length>0&&c(),n(),Oe(e),l}}];if(j(e))return!1;if(ve(e))return!1;for(const{name:t,handler:n}of s)Object.defineProperty(e,t,{value:n})}(s,d,r,a,h),ye(s)}function r(e,t){const n=new F(s);_e(d,n),n.each((o,i,s)=>{let c,l;if("array"==s){C(e)&&(o=h[e],i=e,n.break=!0);const t=Symbol.for("index"),r=()=>S(u)&&(w(o)||W(o)||x(o))&&!A(o,t);l={index:i,sourceLength:h.length},r()?o[t]=l:(w(o)||W(o)||x(o))&&A(o,t)&&(()=>o[t].sourceLength!==l.sourceLength)()&&$e(o[t],l)}if((p||t)&&ge("object"!==s?o:o[1],r,0,S(u)?l:null),!t)if(v(c="array"===s?a.call(h,o,i,h):"object"===s?a.call(h,o[0],o[1],h):"number"===s?a(o):a.call(h,o,h))){const e=d.children[i];N(e)?e.template?function(e,t,n){const o={
children:!0,continue:!0};(function(e,t,n){const{attrs:o={},events:r={},styles:i={},children:s}=e,{attrs:a={},events:c={},styles:l={},children:f,target:u}=t;let d;W(s)&&(d=s.reactor),void 0!=d&&Ie(d,u,s,f);const h=u.parentNode,p=Se(e.text),m=Se(t.text),b=Se(e.tag),g=Se(t.tag);if(b!==g){const o=me(e);h.replaceChild(o,u),n.children=!1,$e(t,e),t.target=o}else if(v=f,W(y=s)&&!W(v)||!W(y)&&W(v)){const o=me(e);h.replaceChild(o,u),n.children=!1,$e(t,e),t.target=o}else if(function(e,t){return W(e)&&W(t)}(s,f)&&s.length!==f.length){const o=me(e);h.replaceChild(o,u),n.children=!1,$e(t,e),t.target=o}else C(s)||C(f)||p!==m&&(u.textContent=p,$e(t,e));var y,v;Ne(u,a,o),Re(u,c,r),Pe(u,l,i)})(e,t,o),o.children&&e.children&&e.children.length>0&&function e(t,n,o){const r=Array.from(t),i=Array.from(n);for(let t=0;t<r.length;t++){const n=r[t],a=i[t];let c=!1;const{children:l=[],events:f={},attrs:u={},styles:d={},renderIf:h}=n,{children:p=[],events:m={},attrs:b={},styles:g={},target:y,index:v}=a;let j;const w=Se(n.text),O=Se(a.text),x=Se(n.tag),T=Se(a.tag);function s(){const e=me(n,!0,v);Object.assign(a,n),a.target=e,j&&j.index>v?Ee(o,v,e):o.appendChild(e)}if(o&&(j=o.children[o.children.length-1]),l.length!==p.length){const{reactor:e}=l;if(void 0!=e)Ie(e,y,l,p);else if(y&&null!=y.parentNode){const e=me(n,!0,v);o.replaceChild(e,y),Object.assign(a,n),a.target=e;continue}}if(x===T)U(h)&&A(n,"renderIf")?y&&null!=y.parentNode&&o.removeChild(y):U(h)||(y&&null==y.parentNode?s():y||s()),l.length==p.length&&0!==l.length&&(c=!0,e(l,p,y)),O!==w&&y&&!c&&(y.textContent=w,a.text=w),a.tag=x,y&&(Ne(y,b,u),Pe(y,g,d),Re(y,m,f));else{const e=me(n,!0,v);Object.assign(a,n),y&&null!=y.parentNode&&(o.replaceChild(e,y),a.target=e)}}}(e.children,t.children,n)}(c.element,e.template,e):(H("Avoid manipulating what Inter manipulates."),d.replaceChild(me(c.element),e)):d.appendChild(me(c.element))}else f()})}void 0!==new.target&&B('renderList is not a constructor, do not call\n it with the "new" keyword.'),w(e)||B("The options(the argument of renderList) must be a plain Javascript object.");let{in:i,each:s,do:a,optimize:u}=e;const d=z(i);(function(e){return"string"==typeof e})(i)||B("The 'in' option in renderList must be a string."),D(s)||l(s),$(a)||B("The value of the 'do' option in renderList must be only a function."),C(u)&&!S(u)&&B("The value of the 'optimize' option in renderList must be only true"),C(u)&&!W(s)&&B("The 'optimize' option can only be enabled when the each's value is an Array.");let h,p=!0;return"number"!=typeof s&&o(),r(),p=!1,h},window.template=function(e){if(w(e))return{[Symbol.for("template")]:!0,element:e};B(`The argument of the template function must be a plain Javascript object,\n but you defined "${J(e)}" as its argument.\n \n `)},window.toAttrs=function(e){if(void 0!==new.target)B('the "toAttrs" function is not a constructor, do not call it with the\n new keyword.');else{if(w(e)){const{in:t,data:n}=e;return function(e,t){const n=e.getElementsByTagName("*");for(const e of n)if(1==e.attributes.length){const{name:n}=e.attributes[0];if(/{(:?[\s\S]+)}/.test(n)&&te(n)){const o=Z(n);e.removeAttribute(n),ee(t,o)?ne(e,t[o]):q(`\n The attribute manager parser found an attribute manager\n named "${o}", but you did not define it in the "data" object.\n `)}}}(z(t),n),n}B(`"${J(e)}" is an invalid argument for\n "toAttrs" function, the argument must be a plain Javascript object.`)}},window.Backend=Be,console.log("The global version 2.2.4 of Inter was loaded successfully.")}();