@lipsjs/lips 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,12 +21,14 @@ Lips is a modern, runtime-based UI framework that brings fine-grained reactivity
21
21
  <html>
22
22
  <head>
23
23
  <title>My Lips App</title>
24
- <script src="https://cdn.jsdelivr.net/npm/@fabrice8/lips/dist/lips.min.js"></script>
25
24
  </head>
26
25
  <body>
27
26
  <div id="app"></div>
28
27
 
29
- <script>
28
+ <script type="module">
29
+ // Import from CDN directly in the module script
30
+ import Lips from 'https://cdn.jsdelivr.net/npm/@lipsjs/lips'
31
+
30
32
  const lips = new Lips();
31
33
 
32
34
  // <counter/> component
@@ -60,7 +62,7 @@ npm install @lipsjs/lips
60
62
  ### Via CDN
61
63
 
62
64
  ```html
63
- <script src="https://cdn.jsdelivr.net/npm/@lipsjs/lips/dist/lips.min.js"></script>
65
+ <script src="https://cdn.jsdelivr.net/npm/@lipsjs/lips"></script>
64
66
  ```
65
67
 
66
68
  ## 📖 Documentation
package/dist/lips.min.js CHANGED
@@ -1,3 +1,3 @@
1
- var e5=Object.create;var{defineProperty:E1,getPrototypeOf:JJ,getOwnPropertyNames:ZJ}=Object;var QJ=Object.prototype.hasOwnProperty;var $1=(J,Q,W)=>{W=J!=null?e5(JJ(J)):{};const q=Q||!J||!J.__esModule?E1(W,"default",{value:J,enumerable:!0}):W;for(let Y of ZJ(J))if(!QJ.call(q,Y))E1(q,Y,{get:()=>J[Y],enumerable:!0});return q};var WJ=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var u0=(J,Q)=>{for(var W in Q)E1(J,W,{get:Q[W],enumerable:!0,configurable:!0,set:(q)=>Q[W]=()=>q})};var e0=WJ((t1,a1)=>{(function(){var J=document,Q=window,W=J.documentElement,q=J.createElement.bind(J),Y=q("div"),B=q("table"),w=q("tbody"),X=q("tr"),M=Array.isArray,D=Array.prototype,j=D.concat,$=D.filter,x=D.indexOf,A=D.map,u=D.push,i=D.slice,e=D.some,l=D.splice,c=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,d=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,k=/<.+>/,y=/^\w+$/;function R(Z,H){var z=r(H);return!Z||!z&&!S(H)&&!P(H)?[]:!z&&d.test(Z)?H.getElementsByClassName(Z.slice(1).replace(/\\/g,"")):!z&&y.test(Z)?H.getElementsByTagName(Z):H.querySelectorAll(Z)}var K=function(){function Z(H,z){if(!H)return;if(L(H))return H;var U=H;if(E(H)){var F=z||J;if(U=c.test(H)&&S(F)?F.getElementById(H.slice(1).replace(/\\/g,"")):k.test(H)?y1(H):L(F)?F.find(H):E(F)?O(F).find(H):R(H,F),!U)return}else if(N(H))return this.ready(H);if(U.nodeType||U===Q)U=[U];this.length=U.length;for(var C=0,f=this.length;C<f;C++)this[C]=U[C]}return Z.prototype.init=function(H,z){return new Z(H,z)},Z}(),G=K.prototype,O=G.init;if(O.fn=O.prototype=G,G.length=0,G.splice=l,typeof Symbol==="function")G[Symbol.iterator]=D[Symbol.iterator];function L(Z){return Z instanceof K}function V(Z){return!!Z&&Z===Z.window}function S(Z){return!!Z&&Z.nodeType===9}function r(Z){return!!Z&&Z.nodeType===11}function P(Z){return!!Z&&Z.nodeType===1}function b(Z){return!!Z&&Z.nodeType===3}function v(Z){return typeof Z==="boolean"}function N(Z){return typeof Z==="function"}function E(Z){return typeof Z==="string"}function _(Z){return Z===void 0}function T(Z){return Z===null}function I(Z){return!isNaN(parseFloat(Z))&&isFinite(Z)}function g(Z){if(typeof Z!=="object"||Z===null)return!1;var H=Object.getPrototypeOf(Z);return H===null||H===Object.prototype}O.isWindow=V,O.isFunction=N,O.isArray=M,O.isNumeric=I,O.isPlainObject=g;function h(Z,H,z){if(z){var U=Z.length;while(U--)if(H.call(Z[U],U,Z[U])===!1)return Z}else if(g(Z)){var F=Object.keys(Z);for(var U=0,C=F.length;U<C;U++){var f=F[U];if(H.call(Z[f],f,Z[f])===!1)return Z}}else for(var U=0,C=Z.length;U<C;U++)if(H.call(Z[U],U,Z[U])===!1)return Z;return Z}O.each=h,G.each=function(Z){return h(this,Z)},G.empty=function(){return this.each(function(Z,H){while(H.firstChild)H.removeChild(H.firstChild)})};function o(){var Z=[];for(var H=0;H<arguments.length;H++)Z[H]=arguments[H];var z=v(Z[0])?Z.shift():!1,U=Z.shift(),F=Z.length;if(!U)return{};if(!F)return o(z,O,U);for(var C=0;C<F;C++){var f=Z[C];for(var m in f)if(z&&(M(f[m])||g(f[m]))){if(!U[m]||U[m].constructor!==f[m].constructor)U[m]=new f[m].constructor;o(z,U[m],f[m])}else U[m]=f[m]}return U}O.extend=o,G.extend=function(Z){return o(G,Z)};var s=/\S+/g;function p(Z){return E(Z)?Z.match(s)||[]:[]}G.toggleClass=function(Z,H){var z=p(Z),U=!_(H);return this.each(function(F,C){if(!P(C))return;h(z,function(f,m){if(U)H?C.classList.add(m):C.classList.remove(m);else C.classList.toggle(m)})})},G.addClass=function(Z){return this.toggleClass(Z,!0)},G.removeAttr=function(Z){var H=p(Z);return this.each(function(z,U){if(!P(U))return;h(H,function(F,C){U.removeAttribute(C)})})};function D0(Z,H){if(!Z)return;if(E(Z)){if(arguments.length<2){if(!this[0]||!P(this[0]))return;var z=this[0].getAttribute(Z);return T(z)?void 0:z}if(_(H))return this;if(T(H))return this.removeAttr(Z);return this.each(function(F,C){if(!P(C))return;C.setAttribute(Z,H)})}for(var U in Z)this.attr(U,Z[U]);return this}G.attr=D0,G.removeClass=function(Z){if(arguments.length)return this.toggleClass(Z,!1);return this.attr("class","")},G.hasClass=function(Z){return!!Z&&e.call(this,function(H){return P(H)&&H.classList.contains(Z)})},G.get=function(Z){if(_(Z))return i.call(this);return Z=Number(Z),this[Z<0?Z+this.length:Z]},G.eq=function(Z){return O(this.get(Z))},G.first=function(){return this.eq(0)},G.last=function(){return this.eq(-1)};function J0(Z){if(_(Z))return this.get().map(function(H){return P(H)||b(H)?H.textContent:""}).join("");return this.each(function(H,z){if(!P(z))return;z.textContent=Z})}G.text=J0;function n(Z,H,z){if(!P(Z))return;var U=Q.getComputedStyle(Z,null);return z?U.getPropertyValue(H)||void 0:U[H]||Z.style[H]}function q0(Z,H){return parseInt(n(Z,H),10)||0}function m0(Z,H){return q0(Z,"border".concat(H?"Left":"Top","Width"))+q0(Z,"padding".concat(H?"Left":"Top"))+q0(Z,"padding".concat(H?"Right":"Bottom"))+q0(Z,"border".concat(H?"Right":"Bottom","Width"))}var $0={};function C0(Z){if($0[Z])return $0[Z];var H=q(Z);J.body.insertBefore(H,null);var z=n(H,"display");return J.body.removeChild(H),$0[Z]=z!=="none"?z:"block"}function K0(Z){return n(Z,"display")==="none"}function _0(Z,H){var z=Z&&(Z.matches||Z.webkitMatchesSelector||Z.msMatchesSelector);return!!z&&!!H&&z.call(Z,H)}function T0(Z){return E(Z)?function(H,z){return _0(z,Z)}:N(Z)?Z:L(Z)?function(H,z){return Z.is(z)}:!Z?function(){return!1}:function(H,z){return z===Z}}G.filter=function(Z){var H=T0(Z);return O($.call(this,function(z,U){return H.call(z,U,z)}))};function P0(Z,H){return!H?Z:Z.filter(H)}G.detach=function(Z){return P0(this,Z).each(function(H,z){if(z.parentNode)z.parentNode.removeChild(z)}),this};var E5=/^\s*<(\w+)[^>]*>/,$5=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,k1={"*":Y,tr:w,td:X,th:X,thead:B,tbody:B,tfoot:B};function y1(Z){if(!E(Z))return[];if($5.test(Z))return[q(RegExp.$1)];var H=E5.test(Z)&&RegExp.$1,z=k1[H]||k1["*"];return z.innerHTML=Z,O(z.childNodes).detach().get()}O.parseHTML=y1,G.has=function(Z){var H=E(Z)?function(z,U){return R(Z,U).length}:function(z,U){return U.contains(Z)};return this.filter(H)},G.not=function(Z){var H=T0(Z);return this.filter(function(z,U){return(!E(Z)||P(U))&&!H.call(U,z,U)})};function I0(Z,H,z,U){var F=[],C=N(H),f=U&&T0(U);for(var m=0,U0=Z.length;m<U0;m++)if(C){var W0=H(Z[m]);if(W0.length)u.apply(F,W0)}else{var Y0=Z[m][H];while(Y0!=null){if(U&&f(-1,Y0))break;F.push(Y0),Y0=z?Y0[H]:null}}return F}function v1(Z){if(Z.multiple&&Z.options)return I0($.call(Z.options,function(H){return H.selected&&!H.disabled&&!H.parentNode.disabled}),"value");return Z.value||""}function T5(Z){if(!arguments.length)return this[0]&&v1(this[0]);return this.each(function(H,z){var U=z.multiple&&z.options;if(U||n1.test(z.type)){var F=M(Z)?A.call(Z,String):T(Z)?[]:[String(Z)];if(U)h(z.options,function(C,f){f.selected=F.indexOf(f.value)>=0},!0);else z.checked=F.indexOf(z.value)>=0}else z.value=_(Z)||T(Z)?"":Z})}G.val=T5,G.is=function(Z){var H=T0(Z);return e.call(this,function(z,U){return H.call(z,U,z)})},O.guid=1;function j0(Z){return Z.length>1?$.call(Z,function(H,z,U){return x.call(U,H)===z}):Z}O.unique=j0,G.add=function(Z,H){return O(j0(this.get().concat(O(Z,H).get())))},G.children=function(Z){return P0(O(j0(I0(this,function(H){return H.children}))),Z)},G.parent=function(Z){return P0(O(j0(I0(this,"parentNode"))),Z)},G.index=function(Z){var H=Z?O(Z)[0]:this[0],z=Z?this:O(H).parent().children();return x.call(z,H)},G.closest=function(Z){var H=this.filter(Z);if(H.length)return H;var z=this.parent();if(!z.length)return H;return z.closest(Z)},G.siblings=function(Z){return P0(O(j0(I0(this,function(H){return O(H).parent().children().not(H)}))),Z)},G.find=function(Z){return O(j0(I0(this,function(H){return R(Z,H)})))};var R5=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,A5=/^$|^module$|\/(java|ecma)script/i,_5=["type","src","nonce","noModule"];function b5(Z,H){var z=O(Z);z.filter("script").add(z.find("script")).each(function(U,F){if(A5.test(F.type)&&W.contains(F)){var C=q("script");C.text=F.textContent.replace(R5,""),h(_5,function(f,m){if(F[m])C[m]=F[m]}),H.head.insertBefore(C,null),H.head.removeChild(C)}})}function x5(Z,H,z,U,F){if(U)Z.insertBefore(H,z?Z.firstChild:null);else if(Z.nodeName==="HTML")Z.parentNode.replaceChild(H,Z);else Z.parentNode.insertBefore(H,z?Z:Z.nextSibling);if(F)b5(H,Z.ownerDocument)}function S0(Z,H,z,U,F,C,f,m){return h(Z,function(U0,W0){h(O(W0),function(Y0,R0){h(O(H),function(O0,o0){var N1=z?R0:o0,C1=z?o0:R0,B0=z?Y0:O0;x5(N1,!B0?C1:C1.cloneNode(!0),U,F,!B0)},m)},f)},C),H}G.after=function(){return S0(arguments,this,!1,!1,!1,!0,!0)},G.append=function(){return S0(arguments,this,!1,!1,!0)};function h5(Z){if(!arguments.length)return this[0]&&this[0].innerHTML;if(_(Z))return this;var H=/<script[\s>]/.test(Z);return this.each(function(z,U){if(!P(U))return;if(H)O(U).empty().append(Z);else U.innerHTML=Z})}G.html=h5,G.appendTo=function(Z){return S0(arguments,this,!0,!1,!0)},G.wrapInner=function(Z){return this.each(function(H,z){var U=O(z),F=U.contents();F.length?F.wrapAll(Z):U.append(Z)})},G.before=function(){return S0(arguments,this,!1,!0)},G.wrapAll=function(Z){var H=O(Z),z=H[0];while(z.children.length)z=z.firstElementChild;return this.first().before(H),this.appendTo(z)},G.wrap=function(Z){return this.each(function(H,z){var U=O(Z)[0];O(z).wrapAll(!H?U:U.cloneNode(!0))})},G.insertAfter=function(Z){return S0(arguments,this,!0,!1,!1,!1,!1,!0)},G.insertBefore=function(Z){return S0(arguments,this,!0,!0)},G.prepend=function(){return S0(arguments,this,!1,!0,!0,!0,!0)},G.prependTo=function(Z){return S0(arguments,this,!0,!0,!0,!1,!1,!0)},G.contents=function(){return O(j0(I0(this,function(Z){return Z.tagName==="IFRAME"?[Z.contentDocument]:Z.tagName==="TEMPLATE"?Z.content.childNodes:Z.childNodes})))},G.next=function(Z,H,z){return P0(O(j0(I0(this,"nextElementSibling",H,z))),Z)},G.nextAll=function(Z){return this.next(Z,!0)},G.nextUntil=function(Z,H){return this.next(H,!0,Z)},G.parents=function(Z,H){return P0(O(j0(I0(this,"parentElement",!0,H))),Z)},G.parentsUntil=function(Z,H){return this.parents(H,Z)},G.prev=function(Z,H,z){return P0(O(j0(I0(this,"previousElementSibling",H,z))),Z)},G.prevAll=function(Z){return this.prev(Z,!0)},G.prevUntil=function(Z,H){return this.prev(H,!0,Z)},G.map=function(Z){return O(j.apply([],A.call(this,function(H,z){return Z.call(H,z,H)})))},G.clone=function(){return this.map(function(Z,H){return H.cloneNode(!0)})},G.offsetParent=function(){return this.map(function(Z,H){var z=H.offsetParent;while(z&&n(z,"position")==="static")z=z.offsetParent;return z||W})},G.slice=function(Z,H){return O(i.call(this,Z,H))};var f5=/-([a-z])/g;function M1(Z){return Z.replace(f5,function(H,z){return z.toUpperCase()})}G.ready=function(Z){var H=function(){return setTimeout(Z,0,O)};if(J.readyState!=="loading")H();else J.addEventListener("DOMContentLoaded",H);return this},G.unwrap=function(){return this.parent().each(function(Z,H){if(H.tagName==="BODY")return;var z=O(H);z.replaceWith(z.children())}),this},G.offset=function(){var Z=this[0];if(!Z)return;var H=Z.getBoundingClientRect();return{top:H.top+Q.pageYOffset,left:H.left+Q.pageXOffset}},G.position=function(){var Z=this[0];if(!Z)return;var H=n(Z,"position")==="fixed",z=H?Z.getBoundingClientRect():this.offset();if(!H){var U=Z.ownerDocument,F=Z.offsetParent||U.documentElement;while((F===U.body||F===U.documentElement)&&n(F,"position")==="static")F=F.parentNode;if(F!==Z&&P(F)){var C=O(F).offset();z.top-=C.top+q0(F,"borderTopWidth"),z.left-=C.left+q0(F,"borderLeftWidth")}}return{top:z.top-q0(Z,"marginTop"),left:z.left-q0(Z,"marginLeft")}};var m1={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};G.prop=function(Z,H){if(!Z)return;if(E(Z)){if(Z=m1[Z]||Z,arguments.length<2)return this[0]&&this[0][Z];return this.each(function(U,F){F[Z]=H})}for(var z in Z)this.prop(z,Z[z]);return this},G.removeProp=function(Z){return this.each(function(H,z){delete z[m1[Z]||Z]})};var g5=/^--/;function D1(Z){return g5.test(Z)}var j1={},k5=Y.style,y5=["webkit","moz","ms"];function v5(Z,H){if(H===void 0)H=D1(Z);if(H)return Z;if(!j1[Z]){var z=M1(Z),U="".concat(z[0].toUpperCase()).concat(z.slice(1)),F="".concat(z," ").concat(y5.join("".concat(U," "))).concat(U).split(" ");h(F,function(C,f){if(f in k5)return j1[Z]=f,!1})}return j1[Z]}var m5={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function u1(Z,H,z){if(z===void 0)z=D1(Z);return!z&&!m5[Z]&&I(H)?"".concat(H,"px"):H}function u5(Z,H){if(E(Z)){var z=D1(Z);if(Z=v5(Z,z),arguments.length<2)return this[0]&&n(this[0],Z,z);if(!Z)return this;return H=u1(Z,H,z),this.each(function(F,C){if(!P(C))return;if(z)C.style.setProperty(Z,H);else C.style[Z]=H})}for(var U in Z)this.css(U,Z[U]);return this}G.css=u5;function d1(Z,H){try{return Z(H)}catch(z){return H}}var d5=/^\s+|\s+$/;function i1(Z,H){var z=Z.dataset[H]||Z.dataset[M1(H)];if(d5.test(z))return z;return d1(JSON.parse,z)}function i5(Z,H,z){z=d1(JSON.stringify,z),Z.dataset[M1(H)]=z}function c5(Z,H){if(!Z){if(!this[0])return;var z={};for(var U in this[0].dataset)z[U]=i1(this[0],U);return z}if(E(Z)){if(arguments.length<2)return this[0]&&i1(this[0],Z);if(_(H))return this;return this.each(function(F,C){i5(C,Z,H)})}for(var U in Z)this.data(U,Z[U]);return this}G.data=c5;function c1(Z,H){var z=Z.documentElement;return Math.max(Z.body["scroll".concat(H)],z["scroll".concat(H)],Z.body["offset".concat(H)],z["offset".concat(H)],z["client".concat(H)])}h([!0,!1],function(Z,H){h(["Width","Height"],function(z,U){var F="".concat(H?"outer":"inner").concat(U);G[F]=function(C){if(!this[0])return;if(V(this[0]))return H?this[0]["inner".concat(U)]:this[0].document.documentElement["client".concat(U)];if(S(this[0]))return c1(this[0],U);return this[0]["".concat(H?"offset":"client").concat(U)]+(C&&H?q0(this[0],"margin".concat(z?"Top":"Left"))+q0(this[0],"margin".concat(z?"Bottom":"Right")):0)}})}),h(["Width","Height"],function(Z,H){var z=H.toLowerCase();G[z]=function(U){if(!this[0])return _(U)?void 0:this;if(!arguments.length){if(V(this[0]))return this[0].document.documentElement["client".concat(H)];if(S(this[0]))return c1(this[0],H);return this[0].getBoundingClientRect()[z]-m0(this[0],!Z)}var F=parseInt(U,10);return this.each(function(C,f){if(!P(f))return;var m=n(f,"boxSizing");f.style[z]=u1(z,F+(m==="border-box"?m0(f,!Z):0))})}});var p1="___cd";G.toggle=function(Z){return this.each(function(H,z){if(!P(z))return;var U=K0(z),F=_(Z)?U:Z;if(F){if(z.style.display=z[p1]||"",K0(z))z.style.display=C0(z.tagName)}else if(!U)z[p1]=n(z,"display"),z.style.display="none"})},G.hide=function(){return this.toggle(!1)},G.show=function(){return this.toggle(!0)};var o1="___ce",I1=".",F1={focus:"focusin",blur:"focusout"},s1={mouseenter:"mouseover",mouseleave:"mouseout"},p5=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function L1(Z){return s1[Z]||F1[Z]||Z}function V1(Z){var H=Z.split(I1);return[H[0],H.slice(1).sort()]}G.trigger=function(Z,H){if(E(Z)){var z=V1(Z),U=z[0],F=z[1],C=L1(U);if(!C)return this;var f=p5.test(C)?"MouseEvents":"HTMLEvents";Z=J.createEvent(f),Z.initEvent(C,!0,!0),Z.namespace=F.join(I1),Z.___ot=U}Z.___td=H;var m=Z.___ot in F1;return this.each(function(U0,W0){if(m&&N(W0[Z.___ot]))W0["___i".concat(Z.type)]=!0,W0[Z.___ot](),W0["___i".concat(Z.type)]=!1;W0.dispatchEvent(Z)})};function l1(Z){return Z[o1]=Z[o1]||{}}function o5(Z,H,z,U,F){var C=l1(Z);C[H]=C[H]||[],C[H].push([z,U,F]),Z.addEventListener(H,F)}function r1(Z,H){return!H||!e.call(H,function(z){return Z.indexOf(z)<0})}function p0(Z,H,z,U,F){var C=l1(Z);if(!H)for(H in C)p0(Z,H,z,U,F);else if(C[H])C[H]=C[H].filter(function(f){var m=f[0],U0=f[1],W0=f[2];if(F&&W0.guid!==F.guid||!r1(m,z)||U&&U!==U0)return!0;Z.removeEventListener(H,W0)})}G.off=function(Z,H,z){var U=this;if(_(Z))this.each(function(C,f){if(!P(f)&&!S(f)&&!V(f))return;p0(f)});else if(!E(Z))for(var F in Z)this.off(F,Z[F]);else{if(N(H))z=H,H="";h(p(Z),function(C,f){var m=V1(f),U0=m[0],W0=m[1],Y0=L1(U0);U.each(function(R0,O0){if(!P(O0)&&!S(O0)&&!V(O0))return;p0(O0,Y0,W0,H,z)})})}return this},G.remove=function(Z){return P0(this,Z).detach().off(),this},G.replaceWith=function(Z){return this.before(Z).remove()},G.replaceAll=function(Z){return O(Z).replaceWith(this),this};function s5(Z,H,z,U,F){var C=this;if(!E(Z)){for(var f in Z)this.on(f,H,z,Z[f],F);return this}if(!E(H))if(_(H)||T(H))H="";else if(_(z))z=H,H="";else U=z,z=H,H="";if(!N(U))U=z,z=void 0;if(!U)return this;return h(p(Z),function(m,U0){var W0=V1(U0),Y0=W0[0],R0=W0[1],O0=L1(Y0),o0=Y0 in s1,N1=Y0 in F1;if(!O0)return;C.each(function(C1,B0){if(!P(B0)&&!S(B0)&&!V(B0))return;var P1=function(X0){if(X0.target["___i".concat(X0.type)])return X0.stopImmediatePropagation();if(X0.namespace&&!r1(R0,X0.namespace.split(I1)))return;if(!H&&(N1&&(X0.target!==B0||X0.___ot===O0)||o0&&X0.relatedTarget&&B0.contains(X0.relatedTarget)))return;var S1=B0;if(H){var b0=X0.target;while(!_0(b0,H)){if(b0===B0)return;if(b0=b0.parentNode,!b0)return}S1=b0}Object.defineProperty(X0,"currentTarget",{configurable:!0,get:function(){return S1}}),Object.defineProperty(X0,"delegateTarget",{configurable:!0,get:function(){return B0}}),Object.defineProperty(X0,"data",{configurable:!0,get:function(){return z}});var a5=U.call(S1,X0,X0.___td);if(F)p0(B0,O0,R0,H,P1);if(a5===!1)X0.preventDefault(),X0.stopPropagation()};P1.guid=U.guid=U.guid||O.guid++,o5(B0,O0,R0,H,P1)})}),this}G.on=s5;function l5(Z,H,z,U){return this.on(Z,H,z,U,!0)}G.one=l5;var r5=/\r?\n/g;function n5(Z,H){return"&".concat(encodeURIComponent(Z),"=").concat(encodeURIComponent(H.replace(r5,"\r\n")))}var t5=/file|reset|submit|button|image/i,n1=/radio|checkbox/i;if(G.serialize=function(){var Z="";return this.each(function(H,z){h(z.elements||[z],function(U,F){if(F.disabled||!F.name||F.tagName==="FIELDSET"||t5.test(F.type)||n1.test(F.type)&&!F.checked)return;var C=v1(F);if(!_(C)){var f=M(C)?C:[C];h(f,function(m,U0){Z+=n5(F.name,U0)})}})}),Z.slice(1)},typeof t1!=="undefined")a1.exports=O;else Q.cash=Q.$=O})()});class s0{default=window.navigator.language;LANGUAGE_DICTIONARIES={};setLang(J){if(this.default!==J)return this.default=J,!0;return!1}setDictionary(J,Q){this.LANGUAGE_DICTIONARIES[J]=Q}translate(J,Q){if(Q&&this.default==Q)return{text:J,lang:this.default};Q=Q||this.default;const[W,q]=Q.split("-");if(this.LANGUAGE_DICTIONARIES[W]&&J in this.LANGUAGE_DICTIONARIES[W]){if(typeof this.LANGUAGE_DICTIONARIES[W][J]==="object"){const Y=this.LANGUAGE_DICTIONARIES[W][J];J=Y[q||"*"]||Y["*"]}else if(typeof this.LANGUAGE_DICTIONARIES[W][J]==="string")J=this.LANGUAGE_DICTIONARIES[W][J]}return{text:J,lang:Q}}format(J,Q,W){const{text:q}=this.translate(J,W);return q.replace(/{(\w+)}/g,(Y,B)=>Q[B]||"")}}class l0{pendingComponents=new Set;isPending=!1;callbacks=new Map;register(J,Q){this.callbacks.set(J,Q)}unregister(J){this.callbacks.delete(J)}queue(J){if(!this.callbacks.has(J))return;if(this.pendingComponents.add(J),!this.isPending)this.isPending=!0,this.schedule()}schedule(){Promise.resolve().then(()=>this.process())}process(){const J=Array.from(this.pendingComponents);this.pendingComponents.clear(),this.isPending=!1,J.forEach((Q)=>{try{const W=this.callbacks.get(Q);if(W)W()}catch(W){console.error(`Error updating component ${Q}:`,W)}})}clear(){this.pendingComponents.clear(),this.isPending=!1}dispose(){this.pendingComponents.clear(),this.callbacks.clear(),this.isPending=!1}}class r0{subscriptions=new Map;tick=new l0;register(J,Q){this.subscriptions.set(J,Q),this.tick.register(J,Q)}unregister(J){this.subscriptions.delete(J),this.tick.unregister(J)}queueUpdate(J){this.tick.queue(J)}dispose(){this.subscriptions.clear(),this.tick.dispose()}prepareForPotentialUnload(){this.tick.clear(),this.subscriptions.forEach((J,Q)=>{this.subscriptions.set(Q,()=>{})})}proxyState(J,Q){const W=this,q=new WeakMap,Y=(w)=>{if(w instanceof Map)w.forEach((M,D)=>w.set(D,B(M)));else if(Array.isArray(w))w.forEach((M,D)=>w[D]=B(M));else if(typeof w==="object")Object.entries(w).forEach(([M,D])=>w[M]=B(D));let X=new Proxy(w,{get(M,D){if(D==="toJSON")return function(){const $=(x)=>{if(!x||typeof x!=="object")return x;if(q.has(x)){const A=q.get(x);if(A instanceof Map){const i={};return A.forEach((e,l)=>i[typeof l==="object"?JSON.stringify(l):String(l)]=$(e)),i}if(Array.isArray(A))return A.map((i)=>$(i));const u={};return Object.entries(A).forEach(([i,e])=>u[i]=$(e)),u}if(typeof x.toJSON==="function"&&!q.has(x))return x.toJSON();return x};return $(X)};if(D==="reset")return function(){X=null};const j=M[D];if(w instanceof Map&&typeof j==="function")return function(...$){const x=D.toString();if(x==="set"&&$.length>=2)$[1]=B($[1]);const A=j.apply(M,$);return["set","delete","clear"].includes(x)&&W.queueUpdate(J),A};if(Array.isArray(w)&&typeof j==="function")return function(...$){const x=D.toString();if(["push","unshift"].includes(x))$=$.map((u)=>B(u));else if(x==="splice"&&$.length>2)$=[$[0],$[1],...$.slice(2).map((u)=>B(u))];const A=j.apply(M,$);return["push","pop","shift","unshift","splice","sort","reverse","fill"].includes(x)&&W.queueUpdate(J),A};return j},set(M,D,j){if(M[D]===j)return!0;if(j instanceof Map&&M[D]instanceof Map){const $=M[D];return $.clear(),j.forEach((x,A)=>$.set(A,B(x))),W.queueUpdate(J),!0}return M[D]=B(j),W.queueUpdate(J),!0}});return q.set(X,w),X},B=(w)=>{if(!w)return w;return w instanceof Map||Array.isArray(w)||typeof w==="object"?Y(w):w};return Y(Q)}}class n0{domObserver;observedComponents=new Map;TIMEOUT=1e4;constructor(){this.domObserver=new MutationObserver(()=>{this.observedComponents.forEach((J,Q)=>{try{const W=Q.node;if(!W){this.unwatch(Q);return}if(J.type==="attach"&&document.contains(W[0]))this.unwatch(Q),Q.emit("component:attached",Q),typeof Q.onAttach=="function"&&Q.onAttach.bind(Q)();else if(J.type==="detach"&&!document.contains(W[0]))this.unwatch(Q),Q.emit("component:detached",Q),typeof Q.onDetach=="function"&&Q.onDetach.bind(Q)()}catch(W){console.log("DWS error --",W)}}),!this.observedComponents.size&&this.domObserver.disconnect()})}watch(J,Q="attach"){const W=J.node;if(!W)return;if(Q==="attach"&&document.contains(W[0])){J.emit("component:attached",J),typeof J.onAttach=="function"&&J.onAttach.bind(J)();return}if(Q==="detach"&&!document.contains(W[0])){J.emit("component:detached",J),typeof J.onDetach=="function"&&J.onDetach.bind(J)();return}this.unwatch(J);const q=setTimeout(()=>{this.unwatch(J),J.emit(`component:${Q}ment-timeout`,J)},this.TIMEOUT);this.observedComponents.set(J,{timeout:q,type:Q}),this.observedComponents.size===1&&this.domObserver.observe(document.body,{childList:!0,subtree:!0}),Q==="attach"&&J.once("component:attached",()=>this.watch(J,"detach"))}unwatch(J){const Q=this.observedComponents.get(J);if(Q)clearTimeout(Q.timeout),this.observedComponents.delete(J);!this.observedComponents.size&&this.domObserver.disconnect()}dispose(){this.domObserver.disconnect(),this.observedComponents.forEach((J)=>clearTimeout(J.timeout)),this.observedComponents.clear()}}class t0{pending=new Set;isPending=!1;component;metrics={batchCount:0,updatesProcessed:0,lastBatchSize:0,avgBatchSize:"0.00"};constructor(J){this.component=J}queue(J){if(this.pending.add(J),this.component.metrics.inc("dependencyUpdateCount"),!this.isPending)this.isPending=!0,this.scheduleProcessing()}scheduleProcessing(){Promise.resolve().then(()=>this.processQueue())}processQueue(){const J=Array.from(this.pending);if(this.metrics.batchCount++,this.metrics.lastBatchSize=J.length,this.metrics.updatesProcessed+=J.length,this.metrics.avgBatchSize=(this.metrics.updatesProcessed/this.metrics.batchCount).toFixed(2),this.pending.clear(),this.component.metrics.trackBatch(J.length),this.applyUpdates(J),this.isPending=!1,this.pending.size>0)this.isPending=!0,this.scheduleProcessing()}applyUpdates(J){J.forEach(({dep:Q,dependent:W})=>{try{const q=W.update(W.memo,"batch-updator");if(q)typeof q.memo==="object"&&this.component.FGUD.get(Q)?.set(W.path,{...W,memo:q.memo}),typeof q.cleanup==="function"&&q.cleanup()}catch(q){console.error("Failed to update dependency --",q)}})}getMetrics(){return{batchCount:this.metrics.batchCount,lastBatchSize:this.metrics.lastBatchSize,avgBatchSize:this.metrics.avgBatchSize,totalUpdates:this.metrics.updatesProcessed}}}class a0{options={emit:!0};__events={};__once_events={};constructor(J){if(J)this.options=J}on(J,Q){if(!Array.isArray(this.__events[J]))this.__events[J]=[];return this.__events[J].push(Q),this}once(J,Q){if(!Array.isArray(this.__once_events[J]))this.__once_events[J]=[];return this.__once_events[J].push(Q),this}off(J){return delete this.__events[J],delete this.__once_events[J],this}emit(J,...Q){if(!this.options.emit)return;const W=Q.map((q)=>typeof q.toJSON==="function"?q.toJSON():q);this.__events[J]?.forEach((q)=>q(...W)),this.__once_events[J]?.forEach((q)=>q(...W)),delete this.__once_events[J]}}var T1=$1(e0(),1);function H0(J,Q){if(J===Q)return!1;if(typeof J!=="object"||typeof Q!=="object")return!1;if(J===null||Q===null)return!0;if(J instanceof Set){if(!(Q instanceof Set))return!0;if(J.size!==Q.size)return!0;if(e1(J)&&e1(Q)){for(let w of J)if(!Q.has(w))return!0;return!1}const B=new WeakMap;for(let w of J){let X=!1;if(typeof w!=="object"){if(Q.has(w))X=!0}else for(let M of Q){if(typeof M!=="object")continue;if(!B.has(w))B.set(w,new WeakMap);const D=B.get(w);if(D.has(M)){if(X=D.get(M),X)break;continue}const j=!H0(w,M);if(D.set(M,j),j){X=!0;break}}if(!X)return!0}return!1}if(J instanceof Map){if(!(Q instanceof Map))return!0;if(J.size!==Q.size)return!0;if(J5(J)&&J5(Q)){for(let[w,X]of J)if(Q.get(w)!==X)return!0;return!1}const B=new WeakMap;for(let[w,X]of J){if(typeof w!=="object"){if(!Q.has(w))return!0;const j=Q.get(w);if(typeof X!=="object"){if(X!==j)return!0;continue}if(typeof j!=="object"||H0(X,j))return!0;continue}let M=!1,D=!1;for(let[j,$]of Q){if(typeof j!=="object")continue;if(!B.has(w))B.set(w,new WeakMap);const x=B.get(w);if(x.has(j)){const[A,u]=x.get(j);if(A){M=!0,D=u;break}continue}if(!H0(w,j)){if(M=!0,D=typeof X==="object"&&typeof $==="object"?!H0(X,$):X===$,x.set(j,[!0,D]),D)break}else x.set(j,[!1,!1])}if(!M||!D)return!0}return!1}if(Array.isArray(J)){if(!Array.isArray(Q))return!0;if(J.length!==Q.length)return!0;for(let B=0;B<J.length;B++){const w=J[B],X=Q[B];if(w!==X&&(typeof w!=="object"||H0(w,X)))return!0}return!1}const W=Object.keys(J),q=Object.keys(Q);if(W.length!==q.length)return!0;W.sort(),q.sort();const Y=W.length;for(let B=0;B<Y;B++)if(W[B]!==q[B])return!0;for(let B=0;B<Y;B++){const w=W[B],X=J[w],M=Q[w];if(X===M)continue;if(X instanceof Date){if(!(M instanceof Date)||String(X)!==String(M))return!0;continue}if(X instanceof RegExp){if(!(M instanceof RegExp)||X.source!==M.source||X.flags!==M.flags)return!0;continue}if(X instanceof Map){if(!(M instanceof Map)||H0(X,M))return!0;continue}if(X instanceof Set){if(!(M instanceof Set)||H0(X,M))return!0;continue}if(X instanceof Function){if(!(M instanceof Function))return!0;continue}if(typeof X==="object"){if(typeof M!=="object")return!0;if(X===J){if(M!==Q)return!0}else if(H0(X,M))return!0}else return!0}return!1}function E0(J,Q){if(J===Q)return!0;if(J==null||Q==null)return J===Q;const W=typeof J;if(W!==typeof Q)return!1;if(W!=="object"){if(W==="number"&&isNaN(J)&&isNaN(Q))return!0;return!1}if(J instanceof Date)return Q instanceof Date&&J.getTime()===Q.getTime();if(J instanceof RegExp)return Q instanceof RegExp&&J.source===Q.source&&J.flags===Q.flags;if(J instanceof Error)return Q instanceof Error&&J.name===Q.name&&J.message===Q.message&&(J.stack===Q.stack||!J.stack&&!Q.stack);if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView(J)){if(!ArrayBuffer.isView(Q))return!1;if(J.byteLength!==Q.byteLength)return!1;const X=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),M=new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);for(let D=0;D<X.length;D++)if(X[D]!==M[D])return!1;return!0}if(J instanceof Promise||J instanceof WeakMap||J instanceof WeakSet)return J===Q;if(typeof J==="function"){if(typeof Q!=="function")return!1;return J.toString()===Q.toString()&&J.name===Q.name}if(J.constructor!==Q.constructor)return!1;if(J instanceof Map||J instanceof Set||Array.isArray(J)||Object.getPrototypeOf(J)===Object.prototype)return!H0(J,Q);const Y=Object.getPrototypeOf(J);if(Y!==Object.getPrototypeOf(Q))return!1;const B=Object.getOwnPropertyNames(J),w=Object.getOwnPropertyNames(Q);if(B.length!==w.length)return!1;for(let X of B){if(!Object.prototype.hasOwnProperty.call(Q,X))return!1;if(!E0(J[X],Q[X]))return!1}if(Y!==null&&Y!==Object.prototype){const X=Object.getOwnPropertyNames(Y),M=Object.getOwnPropertyNames(Object.getPrototypeOf(Q));if(X.length!==M.length)return!1;for(let D of X){if(D==="constructor")continue;if(!E0(Y[D],Object.getPrototypeOf(Q)[D]))return!1}}return!0}function e1(J){for(let Q of J)if(typeof Q==="object"&&Q!==null)return!1;return!0}function J5(J){for(let[Q,W]of J)if(typeof Q==="object"&&Q!==null||typeof W==="object"&&W!==null)return!1;return!0}function Z0(J,Q=new WeakMap){if(J===null||typeof J!=="object"||J instanceof Promise)return J;if(Q.has(J))return Q.get(J);if(J instanceof Date)return new Date(J.getTime());if(J instanceof RegExp)return new RegExp(J.source,J.flags);if(J instanceof Map){const Y=new Map;return Q.set(J,Y),J.forEach((B,w)=>Y.set(Z0(w,Q),Z0(B,Q))),Y}if(J instanceof Set){const Y=new Set;return Q.set(J,Y),J.forEach((B)=>Y.add(Z0(B,Q))),Y}if(Array.isArray(J)){const Y=[];Q.set(J,Y);for(let B=0;B<J.length;B++)Y[B]=Z0(J[B],Q);return Y}if(ArrayBuffer.isView(J))return new J.constructor(J);const W=Object.create(Object.getPrototypeOf(J));Q.set(J,W);const q=Object.getOwnPropertySymbols(J);for(let Y of q)W[Y]=Z0(J[Y],Q);for(let Y in J)if(Object.prototype.hasOwnProperty.call(J,Y))W[Y]=Z0(J[Y],Q);return W}function Q5(J,Q){if(!J||typeof J!=="object")throw new TypeError("Original argument must be an object");if(!Q||typeof Q!=="object")throw new TypeError("ToSet argument must be an object");if(!Object.keys(Q).length)return{...J};function W(Y,B,w){const X=B.split(/\.|\[|\]/).filter(Boolean);let M=Y;for(let D=0;D<X.length;D++){const j=X[D],$=!isNaN(Number(j)),x=D===X.length-1,A=!isNaN(Number(X[D+1]));if(x){M[j]=w;continue}if(!(j in M))M[j]=A?[]:{};else if(A&&!Array.isArray(M[j]))M[j]=[];else if(!A&&Array.isArray(M[j]))M[j]={};M=M[j]}}const q=Z0(J);try{for(let[Y,B]of Object.entries(Q)){if(typeof Y!=="string")throw new TypeError(`Invalid path: ${Y}`);if(!/^[a-zA-Z0-9_\-\[\].]+$/.test(Y))throw new Error(`Invalid path format: ${Y}`);W(q,Y,B)}}catch(Y){throw new Error(`Failed to assign value: ${Y.message}`)}return q}var F0="syn:",M0="fn:",A0="on-",a=/^\.\.\./,J1=/^\[(.*?)\]$/,Z5=["@html","@text"];T1.default.fn.extend({attrs:function(){const J={},Q=this[0];return Q&&Q.nodeType!==Node.TEXT_NODE&&T1.default.each(Q.attributes,function(){J[this.name]=this.value}),J}});class Z1{debug;initialStats={renderCount:0,elementCount:0,renderTime:0,avgRenderTime:0,maxRenderTime:0,componentCount:0,componentUpdateCount:0,partialCount:0,partialUpdateCount:0,memoryUsage:void 0,domOperations:0,domInsertsCount:0,domUpdatesCount:0,domRemovalsCount:0,dependencyTrackCount:0,dependencyUpdateCount:0,batchSize:0,batchCount:0,errorCount:0};stats=this.reset();renderStartTime=0;renderTimes=[];measurementCount=0;maxMeasurements=100;loggingInterval=10;autoSaveInterval;constructor(J=!1){if(this.debug=J,this.debug)this.autoSaveInterval=window.setInterval(()=>this.storeMetrics(),5000)}storeMetrics(){try{const J=JSON.parse(localStorage.getItem("lipsPerformanceMetrics")||"[]");J.push({timestamp:Date.now(),metrics:{...this.stats}}),J.length>100&&J.shift(),localStorage.setItem("lipsPerformanceMetrics",JSON.stringify(J))}catch(J){}}startRender(){if(!this.debug)return;this.renderStartTime=performance.now()}endRender(){if(!this.debug||this.renderStartTime===0)return;const J=performance.now()-this.renderStartTime;this.stats.renderTime=J,this.stats.maxRenderTime=Math.max(this.stats.maxRenderTime,J),this.renderTimes.push(J),this.renderTimes.length>this.maxMeasurements&&this.renderTimes.shift(),this.stats.avgRenderTime=this.renderTimes.reduce((Q,W)=>Q+W,0)/this.renderTimes.length,this.renderStartTime=0,this.measurementCount++}inc(J){if(!this.debug)return;if(typeof this.stats[J]==="number")this.stats[J]++}dec(J){if(!this.debug)return;if(typeof this.stats[J]==="number"&&this.stats[J]>0)this.stats[J]--}record(J,Q){if(!this.debug)return;if(typeof this.stats[J]!=="undefined")this.stats[J]=Q}add(J,Q){if(!this.debug)return;if(typeof this.stats[J]==="number")this.stats[J]+=Q}reset(){return this.renderTimes=[],this.measurementCount=0,this.stats=Z0(this.initialStats)}log(){if(!this.debug)return;if(this.loggingInterval>1&&this.measurementCount%this.loggingInterval!==0)return;const J={"Render Count":this.stats.renderCount,"Element Count":this.stats.elementCount,"Avg Render Time (ms)":this.stats.avgRenderTime.toFixed(2),"Max Render Time (ms)":this.stats.maxRenderTime.toFixed(2)},Q={"Component Count":this.stats.componentCount,"Component Updates":this.stats.componentUpdateCount},W={"Partial Count":this.stats.partialCount,"Partial Updates":this.stats.partialUpdateCount},q={"DOM Operations":this.stats.domOperations,"DOM Inserts":this.stats.domInsertsCount,"DOM Updates":this.stats.domUpdatesCount,"DOM Removals":this.stats.domRemovalsCount},Y={"Dependencies Tracked":this.stats.dependencyTrackCount,"Dependency Updates":this.stats.dependencyUpdateCount},B={"Batch Count":this.stats.batchCount,"Avg Batch Size":this.stats.batchCount>0?(this.stats.batchSize/this.stats.batchCount).toFixed(2):"0"};console.group("Lips Framework Performance Metrics"),console.table(J),console.table(Q),console.table(W),console.table(q),console.table(Y),console.table(B),this.stats.memoryUsage&&console.log(`Memory Usage: ${this.stats.memoryUsage.toFixed(2)} MB`),this.stats.errorCount>0&&console.warn(`Errors encountered: ${this.stats.errorCount}`),console.groupEnd(),window.localStorage&&this.measurementCount%10===0&&this.storeMetrics()}trackMemory(){if(!this.debug||!window.performance?.memory)return;this.stats.memoryUsage=window.performance.memory.usedJSHeapSize/1048576}trackBatch(J){if(!this.debug)return;this.stats.batchCount++,this.stats.batchSize+=J}trackError(J){if(!this.debug)return;this.stats.errorCount++,console.error("Lips Framework Error:",J)}setLoggingInterval(J){if(!this.debug)return;this.loggingInterval=J}getSnapshot(){return Z0(this.stats)}dispose(){if(!this.debug)return;this.autoSaveInterval&&clearInterval(this.autoSaveInterval)}}var t=$1(e0(),1);var N5=$1(e0(),1);var Q1="comm",W1="rule",X1="decl";var W5="@import";var X5="@namespace",H5="@keyframes";var q5="@layer";function H1(J){return J.trim()}function x0(J,Q,W){return J.replace(Q,W)}function z5(J,Q,W){return J.indexOf(Q,W)}function L0(J,Q){return J.charCodeAt(Q)|0}function V0(J,Q,W){return J.slice(Q,W)}function z0(J){return J.length}function q1(J){return J.length}function h0(J,Q){return Q.push(J),J}var R1=Math.abs,d0=String.fromCharCode;function Y1(J,Q,W,q,Y,B,w,X){return{value:J,root:Q,parent:W,type:q,props:Y,children:B,line:z1,column:f0,length:w,return:"",siblings:X}}function B5(){return Q0}function G5(){if(Q0=G0>0?L0(k0,--G0):0,f0--,Q0===10)f0=1,z1--;return Q0}function w0(){if(Q0=G0<Y5?L0(k0,G0++):0,f0++,Q0===10)f0=1,z1++;return Q0}function N0(){return L0(k0,G0)}function i0(){return G0}function B1(J,Q){return V0(k0,J,Q)}function g0(J){switch(J){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function w5(J){return z1=f0=1,Y5=z0(k0=J),G0=0,[]}function K5(J){return k0="",J}function G1(J){return H1(B1(G0-1,A1(J===91?J+2:J===40?J+1:J)))}function U5(J){while(Q0=N0())if(Q0<33)w0();else break;return g0(J)>2||g0(Q0)>3?"":" "}function O5(J,Q){while(--Q&&w0())if(Q0<48||Q0>102||Q0>57&&Q0<65||Q0>70&&Q0<97)break;return B1(J,i0()+(Q<6&&N0()==32&&w0()==32))}function A1(J){while(w0())switch(Q0){case J:return G0;case 34:case 39:if(J!==34&&J!==39)A1(Q0);break;case 40:if(J===41)A1(J);break;case 92:w0();break}return G0}function M5(J,Q){while(w0())if(J+Q0===57)break;else if(J+Q0===84&&N0()===47)break;return"/*"+B1(Q,G0-1)+"*"+d0(J===47?J:w0())}function D5(J){while(!g0(N0()))w0();return B1(J,G0)}var z1=1,f0=1,Y5=0,G0=0,Q0=0,k0="";function F5(J){return K5(w1("",null,null,null,[""],J=w5(J),0,[0],J))}function w1(J,Q,W,q,Y,B,w,X,M){var D=0,j=0,$=w,x=0,A=0,u=0,i=1,e=1,l=1,c=0,d="",k=Y,y=B,R=q,K=d;while(e)switch(u=c,c=w0()){case 40:if(u!=108&&L0(K,$-1)==58){if(z5(K+=x0(G1(c),"&","&\f"),"&\f",R1(D?X[D-1]:0))!=-1)l=-1;break}case 34:case 39:case 91:K+=G1(c);break;case 9:case 10:case 13:case 32:K+=U5(u);break;case 92:K+=O5(i0()-1,7);continue;case 47:switch(N0()){case 42:case 47:if(h0(HJ(M5(w0(),i0()),Q,W,M),M),(g0(u||1)==5||g0(N0()||1)==5)&&z0(K)&&V0(K,-1,void 0)!==" ")K+=" ";break;default:K+="/"}break;case 123*i:X[D++]=z0(K)*l;case 125*i:case 59:case 0:switch(c){case 0:case 125:e=0;case 59+j:if(l==-1)K=x0(K,/\f/g,"");if(A>0&&(z0(K)-$||i===0&&u===47))h0(A>32?I5(K+";",q,W,$-1,M):I5(x0(K," ","")+";",q,W,$-2,M),M);break;case 59:K+=";";default:if(h0(R=j5(K,Q,W,D,j,Y,X,d,k=[],y=[],$,B),B),c===123)if(j===0)w1(K,Q,R,R,k,B,$,X,y);else{switch(x){case 99:if(L0(K,3)===110)break;case 108:if(L0(K,2)===97)break;default:j=0;case 100:case 109:case 115:}if(j)w1(J,R,R,q&&h0(j5(J,R,R,0,0,Y,X,d,Y,k=[],$,y),y),Y,y,$,X,q?k:y);else w1(K,R,R,R,[""],y,0,X,y)}}D=j=A=0,i=l=1,d=K="",$=w;break;case 58:$=1+z0(K),A=u;default:if(i<1){if(c==123)--i;else if(c==125&&i++==0&&G5()==125)continue}switch(K+=d0(c),c*i){case 38:l=j>0?1:(K+="\f",-1);break;case 44:X[D++]=(z0(K)-1)*l,l=1;break;case 64:if(N0()===45)K+=G1(w0());x=N0(),j=$=z0(d=K+=D5(i0())),c++;break;case 45:if(u===45&&z0(K)==2)i=0}}return B}function j5(J,Q,W,q,Y,B,w,X,M,D,j,$){var x=Y-1,A=Y===0?B:[""],u=q1(A);for(var i=0,e=0,l=0;i<q;++i)for(var c=0,d=V0(J,x+1,x=R1(e=w[i])),k=J;c<u;++c)if(k=H1(e>0?A[c]+" "+d:x0(d,/&\f/g,A[c])))M[l++]=k;return Y1(J,Q,W,Y===0?W1:X,M,D,j,$)}function HJ(J,Q,W,q){return Y1(J,Q,W,Q1,d0(B5()),V0(J,2,-2),0,q)}function I5(J,Q,W,q,Y){return Y1(J,Q,W,X1,V0(J,0,q),V0(J,q+1,-1),q,Y)}function K1(J,Q){var W="";for(var q=0;q<J.length;q++)W+=Q(J[q],q,J,Q)||"";return W}function L5(J,Q,W,q){switch(J.type){case q5:if(J.children.length)break;case W5:case X5:case X1:return J.return=J.return||J.value;case Q1:return"";case H5:return J.return=J.value+"{"+K1(J.children,q)+"}";case W1:if(!z0(J.value=J.props.join(",")))return""}return z0(W=K1(J.children,q))?J.return=J.value+"{"+W+"}":""}function V5(J){var Q=q1(J);return function(W,q,Y,B){var w="";for(var X=0;X<Q;X++)w+=J[X](W,q,Y,B)||"";return w}}class y0{nsp;settings;$head;constructor(J,Q){if(typeof J!=="string")throw new Error("Undefined or invalid styles attachement element(s) namespace");this.nsp=J,this.$head=N5.default("head"),this.settings=Q||{},this.settings&&this.load(this.settings)}compile(J){try{return K1(F5(J),V5([L5]))}catch(Q){throw new Error(`Style compilation failed: ${Q.message}`)}}waitForStyles(J){return new Promise((Q)=>{const W=new MutationObserver(()=>{const q=document.querySelector(J);if(q&&getComputedStyle(q).cssText)W.disconnect(),Q()});W.observe(document.documentElement,{attributes:!0,childList:!0,subtree:!0})})}async inject(J){if(!J)throw new Error("Invalid injection arguments");const Q=`rel="${this.settings.meta?"@":""}${this.nsp}"`;J=this.settings.meta?J:`[rel="${this.nsp}"] { ${J} }`;try{const W=this.compile(J);if(!W)throw new Error(`<component:${this.nsp}> sheet compilation failed`);const q=document.createElement("style");q.setAttribute("rel",`${this.settings.meta?"@":""}${this.nsp}`),q.textContent=W;let Y=0;const B=this.$head.find(`style[${Q}]`);if(B.length)Y=parseInt(B.attr("dindex"))+1,B.remove();return q.setAttribute("dindex",String(Y)),this.settings.meta?document.head.prepend(q):document.head.appendChild(q),q}catch(W){throw new Error(`Style injection failed: ${W.message}`)}}async load(J){if(this.settings=J,typeof this.settings!=="object")throw new Error("Undefined styles settings");if(this.settings.sheet){const Q=await this.inject(this.settings.sheet);await this.waitForStyles(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`)}}get(){}async clear(){const J=this.$head.find(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`);if(!J.length)return;const Q=parseInt(J.attr("dindex"));Q===0?J.remove():J.attr("dindex",String(Q-1))}async custom(){return{}}async style(){return{}}}var qJ=function(J){const Q=/on-([a-zA-Z-]+)\s*\(/g;let W=J,q;while((q=Q.exec(J))!==null){const Y=q[1],B=q.index+q[0].length;let w=1,X=B;while(X<J.length&&w>0){if(J[X]==="(")w++;if(J[X]===")")w--;X++}if(w===0){const M=J.slice(B,X-1).trim(),D=J.slice(0,q.index),j=`${A0}${Y}="${M}"`,$=J.slice(X);W=D+j+$,J=W,Q.lastIndex=D.length+j.length}}return W},zJ=function(J){const Q=[];let q=J.replace(/<([a-zA-Z][a-zA-Z0-9_-]*)((?:[^>'"]*|'[^']*'|"[^"]*")*?)(?:\/?>)/g,(Y,B,w)=>{return Q.push(w),`<${B}##TAG_ATTRS_${Q.length-1}##>`});for(let Y=0;Y<Q.length;Y++){const B=`##TAG_ATTRS_${Y}##`,w=Q[Y],X=YJ(w);q=q.replace(B,X)}return q},YJ=function(J){let Q="",W=0,q=!1,Y="",B=0,w=0,X=0;while(W<J.length){const M=J[W];if((M==='"'||M==="'")&&(W===0||J[W-1]!=="\\")){if(!q)q=!0,Y=M;else if(M===Y)q=!1}if(!q){if(M==="(")w++;else if(M===")")w--;else if(M==="{")X++;else if(M==="}")X--}if(!q&&w===0&&X===0&&(M===" "||W===J.length-1)){let D=W;if(W===J.length-1)D=W+1;const j=J.substring(B,D).trim();if(j){const $=BJ(j);Q+=" "+$}B=W+1}W++}return Q},BJ=function(J){const Q=J.indexOf("=");if(Q===-1){if(J.startsWith("...")||J.startsWith("["))return J;return`:${J}="${!J.startsWith("!")}"`}let W=J.substring(0,Q).trim(),q=J.substring(Q+1).trim();if(W.startsWith("@"))return W=!Z5.includes(W)?W.slice(1):W,`:${W}=${q}`;if(W.startsWith(M0)||W.startsWith(A0))return J;if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'")){const Y=q.substring(1,q.length-1);if(GJ(Y))return`:${W}="${Y}"`;return J}else return`:${W}="${q}"`};function GJ(J){if(/\bstate\.|\binput\.|\bself\.|\bcontext\./.test(J))return!0;if(/[\+\*\/\%\(\)\{\}\[\]]|\?\s*:/.test(J))return!0;if(/\b[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_]/.test(J))return!0;if(J.includes("{")&&J.includes("}"))return!0;return!1}function _1(J){let Q=(J||"").trim().replace(/>\s*</g,"><").replace(/\s{2,}/g," ").replace(/[\r\n\t]/g,"").replace(/<([a-zA-Z0-9_-]+)([^>]*?)\s*\/>/g,"<$1$2></$1>").replace(/<\{([^}]+)\}\s*(.*?)(\/)>/g,(W,q,Y)=>{return Y.endsWith("<")?`<lips dtag="${q}" ${Y}/lips>`:`<lips dtag="${q}" ${Y}></lips>`}).replace(/(<>)([\s\S]*?)(<\/>)/g,'<lips fragment="true">$2</lips>').replace(/<if\(\s*(.*?)\s*\)>/g,'<if @by="$1">').replace(/<else-if\(\s*(.*?)\s*\)>/g,'<else-if @by="$1">').replace(/<switch\(\s*(.*?)\s*\)>/g,'<switch @by="$1">').replace(/<async await\(\s*(.*?)\s*\)>/g,`<async ${M0}await="\$1">`).replace(/<log\(\s*(.*?)\s*\)>/g,'<log @args="$1">').replace(/\[(.*?)\]/g,(W)=>W.replace(/\s+/g,""));return Q=qJ(Q),Q=zJ(Q),Q}var wJ=function(J,Q){if(J.isDisposed)return;Q.add(J),J.dependencies.add(Q)},P5=function(J){for(let Q of J.dependencies)Q.delete(J);J.dependencies.clear()};function v0(J,Q={maxSize:100}){const W=new Set,q=[{value:J,timestamp:Date.now()}];let Y=0;const B=()=>{const D=U1[U1.length-1];return D&&wJ(D,W),q[Y].value},w=()=>{const D=[...W];if(C5)for(let j of D)C5.add(j);else for(let j of D)j.execute()};return[B,(D,j)=>{if(Object.is(q[Y].value,D))return;if(Y<q.length-1)q.splice(Y+1);if(q.push({value:D,timestamp:Date.now(),metadata:j}),q.length>Q.maxSize)q.shift(),Y=Math.max(0,Y-1);else Y++;w()},{undo(){if(Y>0)Y--,w()},redo(){if(Y<q.length-1)Y++,w()},jumpTo(D){if(D>=0&&D<q.length&&D!==Y)Y=D,w()},getHistory(){return[...q]},getCurrentIndex(){return Y},canUndo(){return Y>0},canRedo(){return Y<q.length-1},clear(){const D=q[0];q.length=0,q.push(D),Y=0,w()}}]}function O1(J){let Q=!1;const W=()=>{if(Q)throw new Error("Circular dependency detected");if(q.isDisposed)return;Q=!0,P5(q),U1.push(q);try{J()}finally{Q=!1,U1.pop()}},q={execute:W,dependencies:new Set,isDisposed:!1};return W(),{dispose:()=>{q.isDisposed=!0,P5(q)}}}var U1=[],C5=null;class c0 extends a0{declaration;$=null;input;state;static;context;__name__;__path__;__template__;__previous;__macros=new Map;__translations=new Map;__renderCache=new Map;FGUD=new Map;PCC=new Map;VER=[];prepath="0";debug=!1;isRendered=!1;__setInput;__setState;__getState;UQS;ICE;lips;metrics;stylesheet;__path="";__pathCounter=0;__renderDepth=0;constructor(J,Q,{input:W,state:q,context:Y,_static:B,handler:w,stylesheet:X,macros:M,declaration:D},j){super();if(this.lips=j.lips,j?.debug)this.debug=j.debug||this.lips.debug;if(j?.prepath)this.prepath=j.prepath;if(this.__name__=J,this.__path__=`${this.prepath}/${this.__name__}`,this.__template__=_1(Q),console.log(this.__template__),this.declaration=D||{name:J},this.input=W||{},this.static=B||{},this.context={},this.state=this.lips.IUC.proxyState(this.__path__,q||{}),M&&this.setMacros(M),w&&this.setHandler(w),X&&this.setStylesheet(X),this.metrics=new Z1(this.debug),this.metrics.inc("componentCount"),this.UQS=new t0(this),typeof this.onCreate=="function"&&this.onCreate.bind(this)(),this.emit("component:create",this),this.input&&Object.keys(this.input).length&&typeof this.onInput=="function")this.onInput.bind(this)(this.input),this.emit("component:input",this);this.__previous={input:Z0(this.input),state:Z0(this.state),context:Z0(this.context)};const[$,x]=v0(this.input),[A,u]=v0(this.state),[i,e]=v0(this.context);this.__setInput=x,this.__setState=u,this.__getState=A,this.lips.IUC.register(this.__path__,()=>{H0(this.__previous?.state,this.state)&&this.__setState({...this.__getState(),...this.state})}),Array.isArray(Y)&&Y.length&&this.lips.useContext(Y,(l)=>{if(!H0(this.context,l))return;e(l),this.context=l,typeof this.onContext=="function"&&this.onContext.bind(this)(),this.emit("component:context",this)}),this.ICE=O1(()=>{const l=$(),c=A(),d=this.context=i();if(!this.isRendered){this.metrics.reset();const{$log:k}=this.render("",void 0,void 0,this.FGUD);this.$=k,!D?.syntax&&this.$?.each((y,R)=>typeof R.setAttribute=="function"&&R.setAttribute("rel",this.__name__)),this.isRendered=!0,typeof this.onMount=="function"&&this.onMount.bind(this)(),this.emit("component:mount",this),this.lips.watcher.watch(this)}else this.__updateDepNodes__({state:c,input:l,context:d},this.__previous),typeof this.onUpdate=="function"&&this.onUpdate.bind(this)(),this.emit("component:update",this),this.__previous={input:Z0(l),state:Z0(c),context:Z0(d)},this.input=l;this.metrics.log(),typeof this.onRender=="function"&&this.onRender.bind(this)(),this.emit("component:render",this)})}setContext(J,Q){this.lips.setContext(J,Q)}setInput(J){if(!H0(this.input,J))return;this.__setInput(J),typeof this.onInput=="function"&&this.onInput.bind(this)(J)}subInput(J){if(typeof J!=="object")throw new Error("Invalid sub input data argument");return this.setInput(Q5(this.input,J)),this}setMacros(J){const Q=_1(J),W=t.default(Q);if(!W.length)return;const q=this;W.each(function(){const Y=t.default(this),{argv:B,attrs:w}=q.__getAttributes__(Y);if(!Object.keys(w))throw new Error("Invalid macro component definition");if(!w.literals.name)throw new Error("Undefined macro `name` attribute.");if(q.__macros.get(w.literals.name))console.warn(`Duplicate macro <${w.literals.name}> will be override`);if(!Y.contents()?.length)throw new Error("Invalid macro component definition. Template content expected.");q.__macros.set(w.literals.name,{argv:B,$node:Y})})}setHandler(J){Object.entries(J).map(([Q,W])=>this[Q]=W.bind(this))}setStylesheet(J){const Q={sheet:J,meta:this.__name__==="__ROOT__"};this.stylesheet=new y0(this.__name__,Q)}get node(){if(!this.$)throw new Error("node() is expected to be call after component get rendered");return this.$}render(J,Q,W={},q,Y){const B=q||new Map,w=[];if(Q&&!Q.length)return console.warn("Undefined node element to render"),{$log:Q,dependencies:B};this.metrics.startRender();const X=this;let M=t.default();function D(K){const G=j(K);return X.__pathCounter++,X.__path?`${X.__path}/${G}`:`${J?J+"/":"#"}${G}`}function j(K){return(K==="component"?"c":"")+X.__pathCounter}function $(K){return K!==null&&typeof K==="object"&&typeof K.mesh==="function"&&typeof K.update==="function"}function x(K){return K!==null&&typeof K==="object"&&typeof K.default&&typeof K.default==="string"}function A(K){if(!K.attr(":dtag")||K.prop("tagName")!=="LIPS")throw new Error("Invalid dynamic tag name");const G=K.attr(":dtag"),O=X.__evaluate__(G,W);if($(O)||O===null)return l(K,G,O);else if(x(O))return c(K,{template:O});else return c(K,{name:O})}function u(K){const G=K.attr(":args"),O=D("log");if(!G)return;if(X.__evaluate__(`console.log(${G})`,W),X.__isReactive__(G,W))X.__extractExpressionDeps__(G,W).forEach((V)=>X.__trackDep__(B,V,{$fragment:null,path:O,update:(S)=>X.__evaluate__(`console.log(${G})`,S),memo:W,batch:!0}))}function i(K){const G=D("var"),{attrs:O}=X.__getAttributes__(K);if(!O)return;Object.entries(O.literals).forEach(([L,V])=>{if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);W[L]={value:V,type:"let"}}),Object.entries(O.expressions).forEach(([L,V])=>{if(a.test(L)){const S=(P,b)=>{const v=X.__evaluate__(L.replace(a,""),b||W);if(typeof v!=="object")throw new Error(`Invalid spread operator ${L}`);for(let N in v){if(W[N]&&W[N].type==="const")throw new Error(`Cannot override <const ${N}=[value]/> variable`);if(W[N]={value:v[N],type:"let"},b)b[N]=W[N],X.__updateVarDepNodes__(N,G,b)}if(P)return{memo:b}};X.__extractExpressionDeps__(L,W).forEach((P)=>X.__trackDep__(B,P,{$fragment:null,path:`${G}.${L}`,update:(b)=>S(!0,b),memo:W,batch:!0})),S()}else if(V){if(X.__isReactive__(V,W)){const S=X.__extractExpressionDeps__(V,W),r=(P,b)=>{if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);return P[L]=W[L]={value:X.__evaluate__(V,P),type:"let"},X.__updateVarDepNodes__(L,G,P),{memo:P}};S.forEach((P)=>X.__trackDep__(B,P,{$fragment:null,path:`${G}.${L}`,update:r,memo:W,batch:!0}))}if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);W[L]={value:X.__evaluate__(V,W),type:"let"}}}),X.metrics.inc("elementCount")}function e(K){const{attrs:G}=X.__getAttributes__(K);if(!G)return;Object.entries(G.literals).forEach(([O,L])=>{if(W[O]&&W[O].type==="const")throw new Error(`<const ${O}=[value]/> variable already defined`);if(!L)return;W[O]={value:L,type:"const"}}),Object.entries(G.expressions).forEach(([O,L])=>{if(a.test(O)){const V=X.__evaluate__(O.replace(a,""),W);if(typeof V!=="object")throw new Error(`Invalid spread operator ${O}`);for(let S in V){if(W[S]&&W[S].type==="const")throw new Error(`<const ${S}=[value]/> by spread operator ${O}. [${S}] variable already defined`);W[S]={value:V[S],type:"const"}}}else{if(W[O]&&W[O].type==="const")throw new Error(`<const ${O}=[value]/> variable already defined`);if(!L)return;W[O]={value:X.__evaluate__(L,W),type:"const"}}}),X.metrics.inc("elementCount")}function l(K,G,O){const{attrs:L}=X.__getAttributes__(K),V=D("element"),S=X.__getBoundaries__(V);let r=t.default(S.start),P={},b=O;if(b){L.literals&&Object.entries(L.literals).forEach(([N,E])=>P[N]={type:"arg",value:E}),L.expressions&&Object.entries(L.expressions).forEach(([N,E])=>{if(!b)return;if(a.test(N)){const _=X.__evaluate__(N.replace(a,""),W);if(typeof _!=="object")throw new Error(`Invalid spread operator ${N}`);for(let T in _){if(T!=="#"&&!b.argv.includes(T))continue;P[T]={type:"arg",value:_[T]}}}else{if(N!=="#"&&!b.argv.includes(N))return;P[N]={type:"arg",value:E?X.__evaluate__(E,W):!0}}});const v=b.mesh(P);if(v&&v.length)r=r.add(v);L.expressions&&Object.entries(L.expressions).forEach(([N,E])=>{if(!b)return;if(a.test(N)&&X.__isReactive__(N,W)){const _=X.__extractExpressionDeps__(N,W),T=(I,g)=>{if(!b)return;const h={},o=X.__evaluate__(N.replace(a,""),I);if(typeof o!=="object")throw new Error(`Invalid spread operator ${N}`);const s=[];for(let p in o){if(p!=="#"&&!b.argv.includes(p))continue;P[p]=h[p]={type:"arg",value:o[p]},(!I[p]||!E0(o[p],I[p].value))&&s.push(p)}s.length&&b.update(s,h,S)};_.forEach((I)=>X.__trackDep__(B,I,{$fragment:null,boundaries:S,path:`${V}.${N}`,update:T,memo:W,batch:!0}))}else if((N==="#"||b.argv.includes(N))&&X.__isReactive__(E,W)){const _=X.__extractExpressionDeps__(E,W),T=(I,g)=>{if(!b)return;const h=P[N]={type:"arg",value:E?X.__evaluate__(E,I):!0};b.update([N],{[N]:h},S)};_.forEach((I)=>X.__trackDep__(B,I,{$fragment:null,boundaries:S,path:`${V}.${N}`,update:T,memo:W,batch:!0}))}})}if(X.__isReactive__(G,W)){const v=(E,_)=>{const T=X.__evaluate__(G,E);let I;if(x(T))I=c(K,{template:T});else if($(T))P="#"in P?{...E,...P["#"].value}:{...E,...P},b=T,I=b?b.mesh(P):null;if(!document.contains(S.start)||!document.contains(S.end))throw new Error("Dynamic element boundaries not found");const g=[];let h=S.start.nextSibling;while(h&&h!==S.end)g.push(h),h=h.nextSibling;t.default(g).remove(),I&&t.default(S.start).after(I)};X.__extractExpressionDeps__(G,W).forEach((E)=>X.__trackDep__(B,E,{$fragment:null,boundaries:S,path:V,update:v,batch:!0,memo:{...W,...P}}))}return r=r.add(S.end),r}function c(K,G){let O,L;if(G?.template)O=G.template,L=j("component");else{if(L=G?.name||K.prop("tagName")?.toLowerCase(),!L)throw new Error("Invalid component");if(L===X.__name__)throw new Error("Render component within itself is forbidden");O=X.lips.import(L)}if(!O||!L)throw new Error(`<${L}> template not found`);const V=D("component"),S=X.__getBoundaries__(V),{argv:r,attrs:P,events:b}=X.__getAttributes__(K),v={};let N={},E=t.default(S.start),_=X.PCC.get(V);P.literals&&Object.entries(P.literals).forEach(([I,g])=>{if(I=="key")return;N[I]=g}),P.functions&&Object.entries(P.functions).forEach(([I,g])=>{N[I]=X.__evaluateFunction__(g,[],W),O.declaration?.syntax?v[F0+M0+I]=g:v[M0+I]=g}),P.expressions&&Object.entries(P.expressions).forEach(([I,g])=>{if(I=="key")return;if(a.test(I)){const h=X.__evaluate__(I.replace(a,""),W);if(typeof h!=="object")throw new Error(`Invalid spread operator ${I}`);for(let o in h)N[o]=h[o]}else N[I]=g?X.__evaluate__(g,W):!0;O.declaration?.syntax?v[F0+I]=g:v[I]=g});const T=K.contents();if(T.length){if(N={...N,...X.__meshwire__({$node:K,fragmentPath:V,fragmentBoundaries:S,meshPath:null,argv:r,scope:W,xmlns:Y,useAttributes:!0,declaration:O.declaration},v)},O.declaration){if(O.declaration.tags)Object.entries(O.declaration?.tags).forEach(([I,{type:g,many:h}])=>{switch(g){case"nexted":{let o=K.next(I);if(!o.length)return;if(h){N[I]=[];let s=0,p=!1;while(!p){if(N[I].push(X.__meshwire__({$node:o,meshPath:`${I}[${s}]`,fragmentPath:V,fragmentBoundaries:S,argv:r,scope:W,xmlns:Y,useAttributes:!0,declaration:O.declaration},v)),!o.next(I).length){p=!0;break}o=o.next(I),s++}}else N[I]=X.__meshwire__({$node:o,meshPath:I,fragmentPath:V,fragmentBoundaries:S,argv:r,scope:W,xmlns:Y,useAttributes:!0,declaration:O.declaration},v)}break;case"child":{const o=K.children(I);if(h)N[I]=[],o.each(function(s){const p=t.default(this),{argv:D0}=X.__getAttributes__(p);N[I].push(X.__meshwire__({$node:p,meshPath:`${I}[${s}]`,fragmentPath:V,fragmentBoundaries:S,argv:D0,scope:W,xmlns:Y,useAttributes:!0,declaration:O.declaration},v))});else if(K.children(I).first().length){const s=K.children(I).first(),{argv:p}=X.__getAttributes__(s);N[I]=X.__meshwire__({$node:s,meshPath:I,fragmentPath:V,fragmentBoundaries:S,argv:p,scope:W,xmlns:Y,useAttributes:!0,declaration:O.declaration},v)}}break}});else if(O.declaration.contents)N.__contents__=T}}if(_)_.setInput(Z0(N)),E=E.add(_.node);else{const{declaration:I,state:g,_static:h,handler:o,context:s,default:p,stylesheet:D0}=O;_=new c0(L,p||"",{state:Z0(g),input:Z0(N),context:s,_static:Z0(h),handler:o,stylesheet:D0,declaration:I},{debug:X.debug,lips:X.lips,prepath:V}),E=E.add(_.node),X.PCC.set(V,_),Object.entries(b).forEach(([J0,n])=>!!_&&X.__attachEvent__(_,J0,n,W)),v&&Object.entries(v).forEach(([J0,n])=>{let q0=!1,m0=!1;if(J0.startsWith(F0))q0=!0,J0=J0.replace(F0,"");if(J0.startsWith(M0))m0=!0,J0=J0.replace(M0,"");if(a.test(J0)){const $0=(C0)=>{const K0={},_0=X.__evaluate__(J0.replace(a,""),C0);if(typeof _0!=="object")throw new Error(`Invalid spread operator ${J0}`);for(let T0 in _0)K0[T0]=_0[T0];_?.subInput(K0)};if(X.__isReactive__(J0,W))X.__extractExpressionDeps__(n,W).forEach((K0)=>X.__trackDep__(B,K0,{$fragment:null,boundaries:S,path:`${V}.${J0}`,update:$0,syntax:q0,memo:W,batch:!0}))}else{const $0=(C0)=>{const K0=m0?X.__evaluateFunction__(n,[],C0):n?X.__evaluate__(n,C0):!0;_?.subInput({[J0]:K0})};if(X.__isReactive__(n,W))X.__extractExpressionDeps__(n,W).forEach((K0)=>X.__trackDep__(B,K0,{$fragment:null,boundaries:S,path:`${V}.${J0}`,update:$0,syntax:q0,memo:W,batch:!0}))}}),E=E.add(S.end)}return X.metrics.inc("componentCount"),E}function d(K){const G=K.prop("tagName")?.toLowerCase();if(!G)throw new Error("Invalid macro rendering call");const O=X.__macros.get(G);if(!O)throw new Error("Macro component not found");const L=D("macro"),V=X.__getBoundaries__(L),{attrs:S}=X.__getAttributes__(K),r={};let P={},b={},v=t.default(V.start);if(S.literals&&Object.entries(S.literals).forEach(([T,I])=>P[T]={value:I,type:"arg"}),S.expressions&&Object.entries(S.expressions).forEach(([T,I])=>{if(a.test(T)){const g=X.__evaluate__(T.replace(a,""),W);if(typeof g!=="object")throw new Error(`Invalid spread operator ${T}`);for(let h in g)if(b[h]=g[h],O.argv.includes(h))P[h]={value:g[h],type:"arg"};r[T]=I}else{const g=I?X.__evaluate__(I,W):!0;if(b[T]=g,O.argv.includes(T))P[T]={value:g,type:"arg"};if(O.argv.includes(T))r[T]=I}O.argv.forEach((g)=>{if(P[g]!==void 0)return;P[g]={value:!1,type:"arg"}})}),O.argv.includes("__"))P.__={value:b,type:"arg"};const N={$node:O.$node,meshPath:null,fragmentPath:L,fragmentBoundaries:V,argv:O.argv,scope:W,xmlns:Y,useAttributes:!0},E=X.__meshwire__(N,r),_=E.renderer.mesh(P);return v=v.add(_),r&&Object.entries(r).forEach(([T,I])=>{let g=!1;if(new RegExp(`^${F0}`).test(T))g=!0,T=T.replace(F0,"");if(a.test(T)){if(!X.__isReactive__(T,W))return;const h=X.__extractExpressionDeps__(T,W),o=(s)=>{const p={},D0=X.__evaluate__(T.replace(a,""),s);if(typeof D0!=="object")throw new Error(`Invalid spread operator ${T}`);const J0=[];for(let n in D0)p[n]={value:D0[n],type:"arg"},(!s[n]||!E0(D0[n],s[n].value))&&J0.push(n);return J0.length&&E.renderer.update(J0,p),{memo:{...s,...p}}};h.forEach((s)=>X.__trackDep__(B,s,{$fragment:null,boundaries:V,path:`${L}.${T}`,update:o,syntax:g,memo:{...W,...P},batch:!0}))}else if(X.__isReactive__(I,W)){const h=X.__extractExpressionDeps__(I,W),o=(s)=>{const p=s[T]={value:I?X.__evaluate__(I,s):!0,type:"arg"};return E.renderer.update([T],{[T]:p}),{memo:s}};h.forEach((s)=>X.__trackDep__(B,s,{$fragment:null,boundaries:V,path:`${L}.${T}`,update:o,syntax:g,memo:{...W,...P},batch:!0}))}}),v=v.add(V.end),X.metrics.inc("elementCount"),v}function k(K){if(!K.length||!K.prop("tagName"))return K;const G=K.is("svg")||Y,O=G?t.default(document.createElementNS("http://www.w3.org/2000/svg",K.prop("tagName").toLowerCase())):t.default(`<${K.prop("tagName").toLowerCase()}/>`),L=K.contents(),V=D("element");L.length&&O.append(X.__withPath__(V,()=>X.render(V+".n",L,W,B,G).$log));const{attrs:S,events:r}=X.__getAttributes__(K);S.literals&&Object.entries(S.literals).forEach(([b,v])=>O.attr(b,v));const P=(b,v=!1)=>{b&&Object.entries(b).forEach(([N,E])=>{switch(N){case"@html":{const _=(T)=>{O.html(X.__evaluate__(E,T))};if(_(W),v&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((I)=>X.__trackDep__(B,I,{$fragment:O,path:`${V}.${N}`,update:_,memo:W,batch:!0}))}break;case"@text":{const _=(T)=>{let I=X.__evaluate__(E,T);if(!K.is("[no-translate]")){const{text:g}=X.lips.i18n.translate(I);I=g}O.text(I)};if(_(W),v&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((I)=>X.__trackDep__(B,I,{$fragment:O,path:`${V}.${N}`,update:_,memo:W,batch:!0}))}break;case"style":{const _=(T)=>{const I=X.__evaluate__(E,T);if(typeof I==="object"){let g="";Object.entries(I).forEach(([h,o])=>g+=`${h}:${o};`),g.length&&O.attr("style",g)}else O.attr("style",I)};if(_(W),v&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((I)=>X.__trackDep__(B,I,{$fragment:O,path:`${V}.${N}`,update:_,memo:W,batch:!0}))}break;default:{const _=(T)=>{const I=E?X.__evaluate__(E,T):E!==void 0?E:!0;I===void 0||I===!1?O.removeAttr(N):O.attr(N,I)};if(_(W),v&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((I)=>X.__trackDep__(B,I,{$fragment:O,path:`${V}.${N}`,update:_,memo:W,batch:!0}))}}})};return S.expressions&&Object.keys(S.expressions).forEach((b)=>{if(!a.test(b))return;const v=(N)=>{const E={},_=X.__evaluate__(b.replace(a,""),N);if(typeof _!=="object")throw new Error(`Invalid spread operator ${b}`);for(let T in _)E[T]=_[T];P(E)};if(delete S.expressions[b],v(W),b&&X.__isReactive__(b,W))X.__extractExpressionDeps__(b,W).forEach((E)=>X.__trackDep__(B,E,{$fragment:O,path:`${V}.${b}`,update:v,memo:W,batch:!0}))}),P(S.expressions,!0),r&&Object.entries(r).forEach(([b,v])=>{w.push({_event:b,$fragment:O,instruction:v,scope:W})}),X.metrics.inc("elementCount"),X.metrics.inc("domInsertsCount"),O}function y(K){const G=K.text(),O=D("element"),L=!K.parent().is("[no-translate]"),V=t.default(document.createTextNode(X.__interpolate__(G,L,W)));if(G&&X.__isReactive__(G,W)){const S=X.__extractTextDeps__(G,W),r=(P)=>{const b=X.__interpolate__(G,L,P);if(!V[0])return;V[0].textContent=b};S.forEach((P)=>X.__trackDep__(B,P,{path:O,$fragment:V,update:r,memo:W,translate:L,batch:S.length>1}))}return X.metrics.inc("elementCount"),X.metrics.inc("domInsertsCount"),V}function R(K){if(K.get(0)?.nodeType===Node.COMMENT_NODE)return K;if(K.get(0)?.nodeType===Node.TEXT_NODE)return y(K);if(K.is("let"))return i(K);else if(K.is("const"))return e(K);else if(K.is("lips")&&K.attr(":dtag"))return A(K);else if(K.is("log"))return u(K);else if(X.__macros.has(K.prop("tagName")?.toLowerCase()))return d(K);else if(K.is("if, for, switch, async")||X.lips.has(K.prop("tagName")?.toLowerCase()))return c(K);else if(K.is("else-if, else"))return;return k(K)}try{this.__renderDepth++,Q=Q||t.default(this.__template__),Q.each(function(){const K=R(t.default(this));if(K)M=M.add(K)}),w.forEach(({$fragment:K,_event:G,instruction:O,scope:L})=>{this.__attachEvent__(K,G,O,L)}),X.metrics.inc("renderCount")}catch(K){console.error("Rendering Failed --",K),X.metrics.trackError(K)}finally{if(this.__renderDepth--,this.metrics.endRender(),this.metrics.trackMemory(),this.__renderDepth===0)this.__path="",this.__pathCounter=0}return{$log:M,dependencies:B,events:w}}destroy(){this.ICE.dispose(),this.stylesheet?.clear(),this.metrics.dispose(),this.lips.IUC.unregister(this.__path__),this.lips.watcher.unwatch(this),this.VER.forEach(({element:J,_event:Q})=>this.__detachEvent__(J,Q)),this.VER=[];for(let J in this.PCC){const Q=this.PCC.get(J);Q?.destroy(),Q?.delete(J)}if(this.$?.remove(),this.PCC?.clear(),this.FGUD?.clear(),this.state.reset(),this.__macros.clear(),this.__previous=null,this.state=null,this.input=null,this.context=null,this.$)this.$.each((J,Q)=>{t.default(Q).off()}),this.$=null;typeof this.onDestroy==="function"&&this.onDestroy.bind(this)(),this.emit("component:destroy",this)}__meshwire__(J,Q){const W=this,{$node:q,meshPath:Y,fragmentPath:B,fragmentBoundaries:w,argv:X,scope:M,xmlns:D,declaration:j,useAttributes:$}=J;let x,A=[];const u=[],i=(d,k,y)=>{const R=`${B}.${Y||"r"}${y!==void 0?`[${y}]`:""}`,{$log:K,dependencies:G,events:O}=W.render(R,d,{...M,...k},void 0,D);if(u.push(R),G?.forEach((L,V)=>{if(!W.FGUD?.has(V))W.FGUD.set(V,new Map);L.forEach((S,r)=>{S.partial?.length?S.partial.push(R):S.partial=[R],W.FGUD.get(V)?.set(r,S)})}),W.metrics.inc("partialCount"),y!==void 0){const L=W.__getBoundaries__(R);A[y]={argvalues:k,boundaries:L};let V=t.default(L.start);return V=V.add(K),V=V.add(L.end),V}return K},e=(d,k,y)=>{if(W.metrics.startRender(),d.forEach((R)=>{const K=W.FGUD.get(R);if(!K)return;K.forEach((G)=>{const O=u.find((L)=>G.partial?.find((V)=>L==V));if(!G.partial||!O)return;if(y!==void 0&&!O.endsWith(`r[${y}]`))return;if(w?.start&&!document.contains(w.start)){console.warn(`${Y} -- partial boundaries missing in the DOM`),K.delete(G.path);return}if(G.memo?.[R]&&k?.[R]&&E0(G.memo[R],k[R]))return;if(G.memo={...M,...G.memo,...k},G.batch)W.UQS.queue({dep:R,dependent:G});else{const L=G.update(G.memo,"mesh-partial-updator");if(L)typeof L.memo==="object"&&K.set(G.path,{...G,memo:L.memo}),typeof L.cleanup==="function"&&L.cleanup()}W.metrics.inc("dependencyUpdateCount")}),!K.size&&W.FGUD.delete(R)}),y!==void 0&&A[y])A[y].argvalues=k;W.metrics.inc("partialUpdateCount"),W.metrics.endRender()},l=(d)=>{if(!A[d])return;const k=A[d].boundaries;if(delete A[d],!document.contains(k.start)||!document.contains(k.end)){console.warn(`Partial mesh item<${d}> boundaries missing`);return}const y=[];let R=k.start.nextSibling;while(R&&R!==k.end)y.push(R),R=R.nextSibling;t.default(y).remove(),k.start.remove(),k.end.remove()},c={renderer:{path:Y,argv:X,mesh(d,k=!1){if(x=q.contents(),!x?.length)return null;if(j?.iterator){const y=d?.["#"].value;if(!Array.isArray(d?.["#"].value))throw new Error("Invalid iterator argvalues");if(!y.length)return null;let R=t.default();return y.forEach((K,G)=>{if(!x?.length)return null;R=R.add(i(x,K,G))}),R}else return i(x,d)},update(d,k,y){if(!u.length)return;if(y=y||w,j?.iterator){const R=k?.["#"].value;if(!Array.isArray(R))return;if(Array.isArray(A)){if(A.length===R.length){for(let G=0;G<R.length;G++)!E0(A[G].argvalues,R[G])&&e(Object.keys(R[G]),R[G],G);return}const K=Math.min(A.length,R.length);for(let G=0;G<K;G++)e(Object.keys(R[G]),R[G],G);if(R.length>A.length){if(!x?.length)return;for(let G=A.length;G<R.length;G++){const O=i(x,R[G],G);t.default(y.end).before(O)}}else if(R.length<A.length)for(let G=R.length;G<A.length;G++)l(G)}}else e(d,k)}}};if($&&Y){const{attrs:d}=W.__getAttributes__(q);d.literals&&Object.entries(d.literals).forEach(([k,y])=>c[k]=y),d.expressions&&Object.entries(d.expressions).forEach(([k,y])=>{if(a.test(k)){const R=W.__evaluate__(k.replace(a,""),M);if(typeof R!=="object")throw new Error(`Invalid spread operator ${k}`);for(let K in R)c[K]=R[K];Q[`${j?.syntax?F0:""}${Y}.${k}`]=y}else c[k]=y?W.__evaluate__(y,M):!0,Q[`${j?.syntax?F0:""}${Y}.${k}`]=y})}return c}__getBoundaries__(J){return this.metrics.inc("domOperations"),this.metrics.inc("domInsertsCount"),{start:document.createComment(`s:${this.prepath}.${J}`),end:document.createComment(`e:${this.prepath}.${J}`)}}__getAttributes__(J){const Q=J.attrs(),W={},q={literals:{},functions:{},expressions:{}};let Y=[];return Q&&Object.entries(Q).forEach(([B,w])=>{if(B==":dtag")return;if(B.startsWith(":")||B.startsWith(M0)||B.startsWith(A0)||a.test(B)||J1.test(B))if(J1.test(B)){const[X,M]=B.match(J1)||[];Y=M.split(",")}else if(B.startsWith(A0))W[B.replace(A0,"")]=w;else if(B.startsWith(M0))q.functions[B.replace(M0,"")]=w;else{if(B.startsWith(":"))B=B.slice(1,B.length);q.expressions[B]=w||""}else q.literals[B]=w}),{argv:Y,events:W,attrs:q}}__withPath__(J,Q){const W=this.__path;this.__path=J;const q=Q();return this.__path=W,q}__getPathParent__(J){const Q=J.split("/");return Q.pop(),Q.join("/")}__hasSamePathParent__(J,Q){return J.startsWith(Q)}__evaluate__(J,Q){try{J=J.trim();const W=(q)=>{const Y=this.state.toJSON();if(Q){const B={};for(let M in Q)B[M]=Q[M].value;const w=`with( scope ){ return ${q}; }`;return new Function("self","input","state","static","context","scope",w)(this,this.input,Y,this.static,this.context,B||{})}else{const B=`return ${q}`;return new Function("self","input","state","static","context",B)(this,this.input,Y,this.static,this.context)}};if(/{\s*([^{}]+)\s*}/.test(J))return J.replace(/{\s*([^{}]+)\s*}/g,(q,Y)=>W(Y));return W(J)}catch(W){return J}}__evaluateFunction__(J,Q,W){if(/(\s*\w+|\s*\([^)]*\)|\s*)\s*=>\s*(\s*\{[^}]*\}|\s*[^\n;"]+)/g.test(J))return this.__evaluate__(J,W)(...Q);else{let[q,...Y]=J.split(/\s*,\s*/),B;if(q=this.__evaluate__(q,W),typeof q==="function")B=q;else{if(typeof this[q]!=="function")throw new Error(`Undefined <${q}> handler method`);B=this[q].bind(this)}if(typeof B!=="function")throw new Error(`Expected <${q}> to be a function or handler method`);let w=Y.map((X)=>this.__evaluate__(X,W));if(Q.length)w=[...w,...Q];return B(...w)}}__interpolate__(J,Q,W){return J.replace(/{\s*([^{}]+)\s*}/g,(q,Y)=>this.__evaluate__(Y,W))}__attachEvent__(J,Q,W,q){J.on(Q,(...Y)=>this.__evaluateFunction__(W,Y,q)),this.VER.push({element:J,_event:Q}),this.metrics.inc("domUpdatesCount"),this.metrics.inc("domRemovalsCount")}__detachEvent__(J,Q){J.off(Q),this.metrics.inc("domOperations"),this.metrics.inc("domRemovalsCount")}__extractTextDeps__(J,Q){const W=new Set;return(J.match(/{\s*([^{}]+)\s*}/g)||[]).forEach((Y)=>{const B=Y.replace(/[{}]/g,"").trim();this.__extractExpressionDeps__(B,Q).forEach((X)=>W.add(X))}),Array.from(W)}__extractExpressionDeps__(J,Q){const W=/\b(state|input|context)(?:\.[a-zA-Z_]\w*)+(?=\[|\.|$|\s|;|,|\))/g,q=/\b(self)(?:\.[a-zA-Z_]\w*)+(?=\()/g;let Y=[...Array.from(J.matchAll(W)),...Array.from(J.matchAll(q))];if(Q&&Object.keys(Q).length){const B=new RegExp(`\\b(${Object.keys(Q).join("|")})`,"g");Y=[...Y,...Array.from(J.matchAll(B))]}return[...new Set(Y.map((B)=>B[0]))]}__isReactive__(J,Q){if(/(state|input|context|self)\.[\w.]+/.test(J))return!0;if(Q&&Object.keys(Q).length&&new RegExp(Object.keys(Q).join("|")).test(J))return!0;return!1}__trackDep__(J,Q,W){if(W.memo&&W.memo[Q]&&W.memo[Q].type==="let")W.haslet=!0;!J.has(Q)&&J.set(Q,new Map),J.get(Q)?.set(W.path,W),this.metrics.inc("dependencyTrackCount")}__trackTranslationDep__(J,Q,W){if(W.memo&&W.memo[Q]&&W.memo[Q].type==="let")W.haslet=!0;!J.has(Q)&&J.set(Q,new Map),J.get(Q)?.set(W.path,W),this.metrics.inc("dependencyTrackCount")}__valueDep__(J,Q){return Q.reduce((W,q)=>W?.[q],J)}__shouldUpdate__(J,Q,W,q){if(J==="self")return!0;const Y=this.__valueDep__(q[J],Q),B=this.__valueDep__(W[J],Q);return!E0(Y,B)}__updateDepNodes__(J,Q){if(!this.FGUD?.size)return;this.metrics.inc("componentUpdateCount"),this.metrics.startRender(),this.FGUD.forEach((W,q)=>{const[Y,...B]=q.split(".");if(!this.__shouldUpdate__(Y,B,J,Q))return;W.forEach((w)=>{const{path:X,batch:M,$fragment:D,boundaries:j,update:$,memo:x,syntax:A}=w;try{if(!A&&(j?.start&&!document.contains(j.start))||D!==null&&!D.closest("body").length){W.delete(X);return}if(M)this.UQS.queue({dep:q,dependent:w});else{const u=$(x,"main-updator");if(u)typeof u.memo==="object"&&W.set(X,{...w,memo:u.memo}),typeof u.cleanup==="function"&&u.cleanup()}this.metrics.inc("dependencyUpdateCount")}catch(u){console.error("failed to update dependency nodes --",u);return}}),!W.size&&this.FGUD?.delete(q)}),this.metrics.endRender()}__updateVarDepNodes__(J,Q,W){if(!this.FGUD?.size)return;this.metrics.inc("partialUpdateCount"),this.metrics.startRender(),this.FGUD.get(J)?.forEach((Y,B)=>{if(!Y.haslet||!this.__hasSamePathParent__(B,this.__getPathParent__(Q)))return;if(Y.memo={...Y.memo,...W},Y.batch)this.UQS.queue({dep:J,dependent:Y});else{const w=Y.update(Y.memo,"var-partial-updator");typeof w?.cleanup==="function"&&w.cleanup()}}),this.metrics.endRender()}appendTo(J){return(typeof J=="string"?t.default(J):J).append(this.node),this.metrics.inc("domOperations"),this}prependTo(J){return typeof J=="string"?t.default(J):J.prepend(this.node),this.metrics.inc("domOperations"),this}replaceWith(J){return(typeof J=="string"?t.default(J):J).replaceWith(this.node),this.metrics.inc("domOperations"),this}}var b1={};u0(b1,{state:()=>{{return UJ}},handler:()=>{{return OJ}},default:()=>{{return MJ}},declaration:()=>{{return KJ}}});var KJ={name:"if",syntax:!0,tags:{"else-if":{type:"nexted",many:!0,optional:!0},else:{type:"nexted",optional:!0}}},UJ={renderer:null},OJ={onInput(){if(!this.input.renderer)return;if(this.input.by)this.state.renderer=this.input.renderer;else{let J=!1;if(Array.isArray(this.input["else-if"])&&this.input["else-if"].length)this.input["else-if"].forEach((Q)=>{if(J||!Q.by)return;this.state.renderer=Q.renderer,J=!0});if(!J)this.state.renderer=this.input.else?this.input.else.renderer:null}}},MJ="<{state.renderer}/>";var x1={};u0(x1,{state:()=>{{return jJ}},handler:()=>{{return FJ}},default:()=>{{return LJ}},declaration:()=>{{return DJ}},_static:()=>{{return IJ}}});var DJ={name:"for",syntax:!0,iterator:!0},jJ={argvlist:null},IJ={lastInput:null,processingBatch:!1},FJ={onInput(){if(this.static.processingBatch)return;if(!this.input.renderer)throw new Error("Undefined mesh renderer");let{in:J,from:Q,to:W}=this.input;if(J===void 0&&Q===void 0)throw new Error("Invalid <for> arguments");this.static.processingBatch=!0;try{if(Q!==void 0){if(Q=parseFloat(String(Q)),W==null)throw new Error("Expected <from> <to> attributes of the for loop to be defined");if(W=parseFloat(String(W)),Q===W)throw new Error("<from> and <to> attribute cannot have the same value");const q=Q<W,Y=Math.abs(W-Q)+1;if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===Y){const[w]=this.input.renderer.argv;if(w){let X=Q,M=!0;for(let D=0;D<this.state.argvlist.length;D++){if(this.state.argvlist[D][w].value!==X){M=!1;break}X=q?X+1:X-1}if(M)return;X=Q;for(let D=0;D<this.state.argvlist.length;D++)this.state.argvlist[D][w].value=X,X=q?X+1:X-1;return}}const B=[];for(let w=Q;q?w<=W:w>=W;q?w++:w--){const X={},[M]=this.input.renderer.argv;if(M)X[M]={value:w,type:"arg"};B.push(X)}this.state.argvlist=B}else if(Array.isArray(J)){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!J.length){console.warn("empty for loop <in> attribute Array value"),this.state.argvlist=[];return}if(this.static.lastInput=J,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===J.length){const[B,w]=this.input.renderer.argv;for(let X=0;X<J.length;X++){const M=this.state.argvlist[X];if(B)M[B].value=J[X]}return}const q=[];let Y=0;for(let B of J){const w={},[X,M]=this.input.renderer.argv;if(X)w[X]={value:B,type:"arg"};if(M)w[M]={value:Y,type:"arg"};q.push(w),Y++}this.state.argvlist=q}else if(J instanceof Map){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!J.size){console.warn("empty for loop <in> attribute Map value"),this.state.argvlist=[];return}if(this.static.lastInput=J,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===J.size){const[B,w,X]=this.input.renderer.argv;let M=0;for(let[D,j]of J){const $=this.state.argvlist[M];if(B)$[B].value=D;if(w)$[w].value=j;M++}return}const q=[];let Y=0;for(let[B,w]of J){const X={},[M,D,j]=this.input.renderer.argv;if(M)X[M]={value:B,type:"arg"};if(D)X[D]={value:w,type:"arg"};if(j)X[j]={value:Y,type:"arg"};q.push(X),Y++}this.state.argvlist=q}else if(typeof J=="object"){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!Object.keys(J).length){console.warn("empty for loop <in> attribute Object value"),this.state.argvlist=[];return}this.static.lastInput=J;const q=Object.keys(J);if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===q.length){const[w,X,M]=this.input.renderer.argv;for(let D=0;D<q.length;D++){const j=q[D],$=this.state.argvlist[D];if(w)$[w].value=j;if(X)$[X].value=J[j]}return}const Y=[];let B=0;for(let w in J){const X={},[M,D,j]=this.input.renderer.argv;if(M)X[M]={value:w,type:"arg"};if(D)X[D]={value:J[w],type:"arg"};if(j)X[j]={value:B,type:"arg"};Y.push(X),B++}this.state.argvlist=Y}}finally{this.static.processingBatch=!1}},updateItems(J){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!Array.isArray(J)||!this.state.argvlist)return;this.static.processingBatch=!0;try{const[Q]=this.input.renderer?.argv;if(!Q)return;for(let{index:W,value:q}of J)if(W>=0&&W<this.state.argvlist.length)this.state.argvlist[W][Q].value=q}finally{this.static.processingBatch=!1}},updateProperty(J,Q){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!this.state.argvlist)return;this.static.processingBatch=!0;try{for(let W=0;W<this.state.argvlist.length;W++){const q=this.state.argvlist[W];if(q[J])q[J].value=typeof Q==="function"?Q(q[J].value,W):Q}}finally{this.static.processingBatch=!1}}},LJ="<{input.renderer} #=state.argvlist/>";var h1={};u0(h1,{state:()=>{{return NJ}},handler:()=>{{return CJ}},default:()=>{{return PJ}},declaration:()=>{{return VJ}}});var VJ={name:"async",syntax:!0,tags:{then:{type:"child"},catch:{type:"child",optional:!0},loading:{type:"child",optional:!0}}},NJ={renderer:null,props:{}},CJ={onInput(){if(!this.input.await)throw new Error("Undefined async <await> attribute");if(!(this.input.await instanceof Promise))throw new Error("Expected async <await> attribute value to be a function");if(this.input.loading)this.state.renderer=this.input.loading.renderer,this.state.props={};this.input.await.then((J)=>{if(!this.input.then)return;this.state.renderer=this.input.then.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:J,type:"arg"}}}).catch((J)=>{if(!this.input.catch)return;this.state.renderer=this.input.catch.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:J,type:"arg"}}})}},PJ="<{state.renderer} #=state.props/>";var f1={};u0(f1,{state:()=>{{return EJ}},handler:()=>{{return $J}},default:()=>{{return TJ}},declaration:()=>{{return SJ}}});var SJ={name:"switch",syntax:!0,tags:{case:{type:"child",many:!0},default:{type:"child"}}},EJ={renderer:null},$J={onInput(){let J=[];for(let Q of this.input.case)if(Q.is==this.input.by||Array.isArray(Q.is)&&Q.is.includes(this.input.by))Array.isArray(Q.is)?J=[...new Set([...J,...Q.is])]:J.push(Q.is),this.state.renderer=Q.renderer;if(!J.includes(this.input.by))this.state.renderer=this.input.default?this.input.default.renderer:null}},TJ="<{state.renderer}/>";var g1={};u0(g1,{state:()=>{{return RJ}},handler:()=>{{return xJ}},default:()=>{{return hJ}},context:()=>{{return _J}},_static:()=>{{return AJ}}});var bJ=function(J){const Q={};return J.split("&").map((q)=>{const[Y,B]=q.split("=");Q[Y]=B}),Q},RJ={page:null,params:{},query:{}},AJ={global:!1,routes:[],defaultPath:null,currentPath:null,currentRoute:null},_J=["navigate"],xJ={onInput(){if(!this.input.routes)return;if(this.input.global)this.static.global=this.input.global;if(this.static.routes=this.input.routes.map(({path:J,template:Q,default:W})=>{if(W)this.static.defaultPath=J;const q=J.match(/:[^\/]*(\/|$)/gi)||[],Y=J.replaceAll("/","\\/").replaceAll(/:[^\/]*(\/|$)/gi,"([^\\/]+)(?:\\/|$)");return{path:J,template:Q,default:W,pathVars:q,pathRegex:new RegExp(`${Y}\$`,"i")}}),this.input.global){const J=window.location.pathname;this.static.defaultPath=this.static.defaultPath&&J=="/"&&J!==this.static.defaultPath?this.static.defaultPath:J?J+window.location.search:this.static.routes[0].path}},onAttach(){if(this.input.global)window.navigate=this.navigate.bind(this),window.addEventListener("popstate",(J)=>J.state&&this.navigate(J.state.path,!0));this.setContext("navigate",this.navigate.bind(this)),this.static.defaultPath&&this.navigate(this.static.defaultPath)},navigate(J,Q){!Q&&this.static.global&&history.pushState({path:J},"",J);const W=J.split("?");J=W[0];const q=W[1]?bJ(W[1]):{};let Y=null;if(this.static.currentRoute)Y={path:this.static.currentRoute.path,params:this.state.params},this.emit("before",{fromState:Y,toState:{path:J,query:q}});const B=this.match(J);if(!B){this.static.currentRoute=null,this.state.params={},this.state.query={},this.emit("not-found",J);return}const{route:w,params:X}=B;this.emit("after",{fromState:Y,toState:{path:w.path,params:X,query:q}}),this.static.currentPath=J,this.static.currentRoute=w,this.state.params=X,this.state.query=q,this.state.page=w.template},match(J){const Q={};let W=!1;for(let q of this.static.routes){const{pathVars:Y,pathRegex:B}=q,w=J.match(B);if(w!==null&&w.index===0){for(let X=0;X+1<w.length&&X<Y.length;X++)Q[Y[X].replaceAll(/[\/:]/g,"")]=w[X+1];W=q;break}}return W?{route:W,params:Q}:!1}},hJ="<{state.page} params=state.params query=state.query/>";class S5{debug=!1;stylesheets=[];config={};store={};__root;i18n=new s0;watcher;IUC;__setContext;__getContext;constructor(J){if(this.config=J,this.config?.debug)this.debug=this.config.debug;this.watcher=new n0,this.IUC=new r0;const[Q,W]=v0(J?.context||{});this.__setContext=W,this.__getContext=Q,this.register("if",b1),this.register("for",x1),this.register("async",h1),this.register("switch",f1),this.register("router",g1)}register(J,Q){return this.store[J]=Q,this}unregister(J){return delete this.store[J],this}has(J){return J in this.store}import(J){if(!this.has(J))throw new Error(`<${J}> component not found`);if(!this.store[J].declaration?.syntax&&!this.store[J].default)throw new Error(`Invalid <${J}> component`);return this.store[J]}render(J,Q,W){const{default:q,...Y}=Q,B={debug:this.debug,prepath:"0",lips:this},w=new c0(J,q||"",{...Y,input:W},B);return window.addEventListener("beforeunload",()=>{return this.dispose(),w.destroy(),null}),window.addEventListener("pagehide",(X)=>{!X.persisted&&this.dispose()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState!=="hidden")return;this.IUC.prepareForPotentialUnload()}),w}root(J,Q){if(this.__root=this.render("__ROOT__",J),this.__root.appendTo(Q),this.config?.stylesheets)this.stylesheets=this.config.stylesheets.map((W)=>new y0("root",{sheet:W,meta:!0}));return this.__root}language(J){this.i18n.setLang(J)&&this.__root?.rerender()}setContext(J,Q){const W=this.__getContext();if(typeof J==="string"){const q={...W,[J]:Q};H0(W,q)&&this.__setContext(q)}else if(!Array.isArray(J)){const q={...W,...J};H0(W,q)&&this.__setContext(q)}else throw new Error("Invalid context data")}getContext(){return this.__getContext()}useContext(J,Q){if(!J.length)return;O1(()=>{const W=this.__getContext();if(!W)return;const q=Object.fromEntries(J.map((Y)=>[Y,W[Y]]));q&&typeof Q==="function"&&Object.keys(q).length&&Q(q)})}dispose(){this.watcher?.dispose(),this.__root?.destroy(),this.stylesheets.forEach((J)=>J.clear())}}export{S5 as default};
1
+ var W8=Object.create;var{defineProperty:R0,getPrototypeOf:X8,getOwnPropertyNames:H8}=Object;var z8=Object.prototype.hasOwnProperty;var T0=(J,Q,W)=>{W=J!=null?W8(X8(J)):{};const z=Q||!J||!J.__esModule?R0(W,"default",{value:J,enumerable:!0}):W;for(let Y of H8(J))if(!z8.call(z,Y))R0(z,Y,{get:()=>J[Y],enumerable:!0});return z};var Y8=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var d1=(J,Q)=>{for(var W in Q)R0(J,W,{get:Q[W],enumerable:!0,configurable:!0,set:(z)=>Q[W]=()=>z})};var Q0=Y8((Z5,Q5)=>{(function(){var J=document,Q=window,W=J.documentElement,z=J.createElement.bind(J),Y=z("div"),q=z("table"),G=z("tbody"),X=z("tr"),D=Array.isArray,M=Array.prototype,j=M.concat,R=M.filter,h=M.indexOf,_=M.map,m=M.push,p=M.slice,a=M.some,i=M.splice,s=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,Z1=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,d=/<.+>/,y=/^\w+$/;function g(Z,H){var B=u(H);return!Z||!B&&!C(H)&&!P(H)?[]:!B&&Z1.test(Z)?H.getElementsByClassName(Z.slice(1).replace(/\\/g,"")):!B&&y.test(Z)?H.getElementsByTagName(Z):H.querySelectorAll(Z)}var K=function(){function Z(H,B){if(!H)return;if(S(H))return H;var O=H;if(E(H)){var I=B||J;if(O=s.test(H)&&C(I)?I.getElementById(H.slice(1).replace(/\\/g,"")):d.test(H)?u0(H):S(I)?I.find(H):E(I)?w(I).find(H):g(H,I),!O)return}else if(V(H))return this.ready(H);if(O.nodeType||O===Q)O=[O];this.length=O.length;for(var $=0,k=this.length;$<k;$++)this[$]=O[$]}return Z.prototype.init=function(H,B){return new Z(H,B)},Z}(),U=K.prototype,w=U.init;if(w.fn=w.prototype=U,U.length=0,U.splice=i,typeof Symbol==="function")U[Symbol.iterator]=M[Symbol.iterator];function S(Z){return Z instanceof K}function F(Z){return!!Z&&Z===Z.window}function C(Z){return!!Z&&Z.nodeType===9}function u(Z){return!!Z&&Z.nodeType===11}function P(Z){return!!Z&&Z.nodeType===1}function x(Z){return!!Z&&Z.nodeType===3}function f(Z){return typeof Z==="boolean"}function V(Z){return typeof Z==="function"}function E(Z){return typeof Z==="string"}function T(Z){return Z===void 0}function N(Z){return Z===null}function L(Z){return!isNaN(parseFloat(Z))&&isFinite(Z)}function A(Z){if(typeof Z!=="object"||Z===null)return!1;var H=Object.getPrototypeOf(Z);return H===null||H===Object.prototype}w.isWindow=F,w.isFunction=V,w.isArray=D,w.isNumeric=L,w.isPlainObject=A;function b(Z,H,B){if(B){var O=Z.length;while(O--)if(H.call(Z[O],O,Z[O])===!1)return Z}else if(A(Z)){var I=Object.keys(Z);for(var O=0,$=I.length;O<$;O++){var k=I[O];if(H.call(Z[k],k,Z[k])===!1)return Z}}else for(var O=0,$=Z.length;O<$;O++)if(H.call(Z[O],O,Z[O])===!1)return Z;return Z}w.each=b,U.each=function(Z){return b(this,Z)},U.empty=function(){return this.each(function(Z,H){while(H.firstChild)H.removeChild(H.firstChild)})};function c(){var Z=[];for(var H=0;H<arguments.length;H++)Z[H]=arguments[H];var B=f(Z[0])?Z.shift():!1,O=Z.shift(),I=Z.length;if(!O)return{};if(!I)return c(B,w,O);for(var $=0;$<I;$++){var k=Z[$];for(var v in k)if(B&&(D(k[v])||A(k[v]))){if(!O[v]||O[v].constructor!==k[v].constructor)O[v]=new k[v].constructor;c(B,O[v],k[v])}else O[v]=k[v]}return O}w.extend=c,U.extend=function(Z){return c(U,Z)};var l=/\S+/g;function o(Z){return E(Z)?Z.match(l)||[]:[]}U.toggleClass=function(Z,H){var B=o(Z),O=!T(H);return this.each(function(I,$){if(!P($))return;b(B,function(k,v){if(O)H?$.classList.add(v):$.classList.remove(v);else $.classList.toggle(v)})})},U.addClass=function(Z){return this.toggleClass(Z,!0)},U.removeAttr=function(Z){var H=o(Z);return this.each(function(B,O){if(!P(O))return;b(H,function(I,$){O.removeAttribute($)})})};function D1(Z,H){if(!Z)return;if(E(Z)){if(arguments.length<2){if(!this[0]||!P(this[0]))return;var B=this[0].getAttribute(Z);return N(B)?void 0:B}if(T(H))return this;if(N(H))return this.removeAttr(Z);return this.each(function(I,$){if(!P($))return;$.setAttribute(Z,H)})}for(var O in Z)this.attr(O,Z[O]);return this}U.attr=D1,U.removeClass=function(Z){if(arguments.length)return this.toggleClass(Z,!1);return this.attr("class","")},U.hasClass=function(Z){return!!Z&&a.call(this,function(H){return P(H)&&H.classList.contains(Z)})},U.get=function(Z){if(T(Z))return p.call(this);return Z=Number(Z),this[Z<0?Z+this.length:Z]},U.eq=function(Z){return w(this.get(Z))},U.first=function(){return this.eq(0)},U.last=function(){return this.eq(-1)};function e(Z){if(T(Z))return this.get().map(function(H){return P(H)||x(H)?H.textContent:""}).join("");return this.each(function(H,B){if(!P(B))return;B.textContent=Z})}U.text=e;function r(Z,H,B){if(!P(Z))return;var O=Q.getComputedStyle(Z,null);return B?O.getPropertyValue(H)||void 0:O[H]||Z.style[H]}function z1(Z,H){return parseInt(r(Z,H),10)||0}function u1(Z,H){return z1(Z,"border".concat(H?"Left":"Top","Width"))+z1(Z,"padding".concat(H?"Left":"Top"))+z1(Z,"padding".concat(H?"Right":"Bottom"))+z1(Z,"border".concat(H?"Right":"Bottom","Width"))}var R1={};function N1(Z){if(R1[Z])return R1[Z];var H=z(Z);J.body.insertBefore(H,null);var B=r(H,"display");return J.body.removeChild(H),R1[Z]=B!=="none"?B:"block"}function K1(Z){return r(Z,"display")==="none"}function x1(Z,H){var B=Z&&(Z.matches||Z.webkitMatchesSelector||Z.msMatchesSelector);return!!B&&!!H&&B.call(Z,H)}function T1(Z){return E(Z)?function(H,B){return x1(B,Z)}:V(Z)?Z:S(Z)?function(H,B){return Z.is(B)}:!Z?function(){return!1}:function(H,B){return B===Z}}U.filter=function(Z){var H=T1(Z);return w(R.call(this,function(B,O){return H.call(B,O,B)}))};function S1(Z,H){return!H?Z:Z.filter(H)}U.detach=function(Z){return S1(this,Z).each(function(H,B){if(B.parentNode)B.parentNode.removeChild(B)}),this};var A5=/^\s*<(\w+)[^>]*>/,b5=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,m0={"*":Y,tr:G,td:X,th:X,thead:q,tbody:q,tfoot:q};function u0(Z){if(!E(Z))return[];if(b5.test(Z))return[z(RegExp.$1)];var H=A5.test(Z)&&RegExp.$1,B=m0[H]||m0["*"];return B.innerHTML=Z,w(B.childNodes).detach().get()}w.parseHTML=u0,U.has=function(Z){var H=E(Z)?function(B,O){return g(Z,O).length}:function(B,O){return O.contains(Z)};return this.filter(H)},U.not=function(Z){var H=T1(Z);return this.filter(function(B,O){return(!E(Z)||P(O))&&!H.call(O,B,O)})};function L1(Z,H,B,O){var I=[],$=V(H),k=O&&T1(O);for(var v=0,U1=Z.length;v<U1;v++)if($){var W1=H(Z[v]);if(W1.length)m.apply(I,W1)}else{var q1=Z[v][H];while(q1!=null){if(O&&k(-1,q1))break;I.push(q1),q1=B?q1[H]:null}}return I}function d0(Z){if(Z.multiple&&Z.options)return L1(R.call(Z.options,function(H){return H.selected&&!H.disabled&&!H.parentNode.disabled}),"value");return Z.value||""}function _5(Z){if(!arguments.length)return this[0]&&d0(this[0]);return this.each(function(H,B){var O=B.multiple&&B.options;if(O||e0.test(B.type)){var I=D(Z)?_.call(Z,String):N(Z)?[]:[String(Z)];if(O)b(B.options,function($,k){k.selected=I.indexOf(k.value)>=0},!0);else B.checked=I.indexOf(B.value)>=0}else B.value=T(Z)||N(Z)?"":Z})}U.val=_5,U.is=function(Z){var H=T1(Z);return a.call(this,function(B,O){return H.call(B,O,B)})},w.guid=1;function j1(Z){return Z.length>1?R.call(Z,function(H,B,O){return h.call(O,H)===B}):Z}w.unique=j1,U.add=function(Z,H){return w(j1(this.get().concat(w(Z,H).get())))},U.children=function(Z){return S1(w(j1(L1(this,function(H){return H.children}))),Z)},U.parent=function(Z){return S1(w(j1(L1(this,"parentNode"))),Z)},U.index=function(Z){var H=Z?w(Z)[0]:this[0],B=Z?this:w(H).parent().children();return h.call(B,H)},U.closest=function(Z){var H=this.filter(Z);if(H.length)return H;var B=this.parent();if(!B.length)return H;return B.closest(Z)},U.siblings=function(Z){return S1(w(j1(L1(this,function(H){return w(H).parent().children().not(H)}))),Z)},U.find=function(Z){return w(j1(L1(this,function(H){return g(Z,H)})))};var x5=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,h5=/^$|^module$|\/(java|ecma)script/i,k5=["type","src","nonce","noModule"];function g5(Z,H){var B=w(Z);B.filter("script").add(B.find("script")).each(function(O,I){if(h5.test(I.type)&&W.contains(I)){var $=z("script");$.text=I.textContent.replace(x5,""),b(k5,function(k,v){if(I[v])$[v]=I[v]}),H.head.insertBefore($,null),H.head.removeChild($)}})}function f5(Z,H,B,O,I){if(O)Z.insertBefore(H,B?Z.firstChild:null);else if(Z.nodeName==="HTML")Z.parentNode.replaceChild(H,Z);else Z.parentNode.insertBefore(H,B?Z:Z.nextSibling);if(I)g5(H,Z.ownerDocument)}function P1(Z,H,B,O,I,$,k,v){return b(Z,function(U1,W1){b(w(W1),function(q1,A1){b(w(H),function(O1,l1){var S0=B?A1:l1,P0=B?l1:A1,B1=B?q1:O1;f5(S0,!B1?P0:P0.cloneNode(!0),O,I,!B1)},v)},k)},$),H}U.after=function(){return P1(arguments,this,!1,!1,!1,!0,!0)},U.append=function(){return P1(arguments,this,!1,!1,!0)};function y5(Z){if(!arguments.length)return this[0]&&this[0].innerHTML;if(T(Z))return this;var H=/<script[\s>]/.test(Z);return this.each(function(B,O){if(!P(O))return;if(H)w(O).empty().append(Z);else O.innerHTML=Z})}U.html=y5,U.appendTo=function(Z){return P1(arguments,this,!0,!1,!0)},U.wrapInner=function(Z){return this.each(function(H,B){var O=w(B),I=O.contents();I.length?I.wrapAll(Z):O.append(Z)})},U.before=function(){return P1(arguments,this,!1,!0)},U.wrapAll=function(Z){var H=w(Z),B=H[0];while(B.children.length)B=B.firstElementChild;return this.first().before(H),this.appendTo(B)},U.wrap=function(Z){return this.each(function(H,B){var O=w(Z)[0];w(B).wrapAll(!H?O:O.cloneNode(!0))})},U.insertAfter=function(Z){return P1(arguments,this,!0,!1,!1,!1,!1,!0)},U.insertBefore=function(Z){return P1(arguments,this,!0,!0)},U.prepend=function(){return P1(arguments,this,!1,!0,!0,!0,!0)},U.prependTo=function(Z){return P1(arguments,this,!0,!0,!0,!1,!1,!0)},U.contents=function(){return w(j1(L1(this,function(Z){return Z.tagName==="IFRAME"?[Z.contentDocument]:Z.tagName==="TEMPLATE"?Z.content.childNodes:Z.childNodes})))},U.next=function(Z,H,B){return S1(w(j1(L1(this,"nextElementSibling",H,B))),Z)},U.nextAll=function(Z){return this.next(Z,!0)},U.nextUntil=function(Z,H){return this.next(H,!0,Z)},U.parents=function(Z,H){return S1(w(j1(L1(this,"parentElement",!0,H))),Z)},U.parentsUntil=function(Z,H){return this.parents(H,Z)},U.prev=function(Z,H,B){return S1(w(j1(L1(this,"previousElementSibling",H,B))),Z)},U.prevAll=function(Z){return this.prev(Z,!0)},U.prevUntil=function(Z,H){return this.prev(H,!0,Z)},U.map=function(Z){return w(j.apply([],_.call(this,function(H,B){return Z.call(H,B,H)})))},U.clone=function(){return this.map(function(Z,H){return H.cloneNode(!0)})},U.offsetParent=function(){return this.map(function(Z,H){var B=H.offsetParent;while(B&&r(B,"position")==="static")B=B.offsetParent;return B||W})},U.slice=function(Z,H){return w(p.call(this,Z,H))};var v5=/-([a-z])/g;function j0(Z){return Z.replace(v5,function(H,B){return B.toUpperCase()})}U.ready=function(Z){var H=function(){return setTimeout(Z,0,w)};if(J.readyState!=="loading")H();else J.addEventListener("DOMContentLoaded",H);return this},U.unwrap=function(){return this.parent().each(function(Z,H){if(H.tagName==="BODY")return;var B=w(H);B.replaceWith(B.children())}),this},U.offset=function(){var Z=this[0];if(!Z)return;var H=Z.getBoundingClientRect();return{top:H.top+Q.pageYOffset,left:H.left+Q.pageXOffset}},U.position=function(){var Z=this[0];if(!Z)return;var H=r(Z,"position")==="fixed",B=H?Z.getBoundingClientRect():this.offset();if(!H){var O=Z.ownerDocument,I=Z.offsetParent||O.documentElement;while((I===O.body||I===O.documentElement)&&r(I,"position")==="static")I=I.parentNode;if(I!==Z&&P(I)){var $=w(I).offset();B.top-=$.top+z1(I,"borderTopWidth"),B.left-=$.left+z1(I,"borderLeftWidth")}}return{top:B.top-z1(Z,"marginTop"),left:B.left-z1(Z,"marginLeft")}};var i0={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};U.prop=function(Z,H){if(!Z)return;if(E(Z)){if(Z=i0[Z]||Z,arguments.length<2)return this[0]&&this[0][Z];return this.each(function(O,I){I[Z]=H})}for(var B in Z)this.prop(B,Z[B]);return this},U.removeProp=function(Z){return this.each(function(H,B){delete B[i0[Z]||Z]})};var m5=/^--/;function L0(Z){return m5.test(Z)}var I0={},u5=Y.style,d5=["webkit","moz","ms"];function i5(Z,H){if(H===void 0)H=L0(Z);if(H)return Z;if(!I0[Z]){var B=j0(Z),O="".concat(B[0].toUpperCase()).concat(B.slice(1)),I="".concat(B," ").concat(d5.join("".concat(O," "))).concat(O).split(" ");b(I,function($,k){if(k in u5)return I0[Z]=k,!1})}return I0[Z]}var c5={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function c0(Z,H,B){if(B===void 0)B=L0(Z);return!B&&!c5[Z]&&L(H)?"".concat(H,"px"):H}function p5(Z,H){if(E(Z)){var B=L0(Z);if(Z=i5(Z,B),arguments.length<2)return this[0]&&r(this[0],Z,B);if(!Z)return this;return H=c0(Z,H,B),this.each(function(I,$){if(!P($))return;if(B)$.style.setProperty(Z,H);else $.style[Z]=H})}for(var O in Z)this.css(O,Z[O]);return this}U.css=p5;function p0(Z,H){try{return Z(H)}catch(B){return H}}var o5=/^\s+|\s+$/;function o0(Z,H){var B=Z.dataset[H]||Z.dataset[j0(H)];if(o5.test(B))return B;return p0(JSON.parse,B)}function s5(Z,H,B){B=p0(JSON.stringify,B),Z.dataset[j0(H)]=B}function l5(Z,H){if(!Z){if(!this[0])return;var B={};for(var O in this[0].dataset)B[O]=o0(this[0],O);return B}if(E(Z)){if(arguments.length<2)return this[0]&&o0(this[0],Z);if(T(H))return this;return this.each(function(I,$){s5($,Z,H)})}for(var O in Z)this.data(O,Z[O]);return this}U.data=l5;function s0(Z,H){var B=Z.documentElement;return Math.max(Z.body["scroll".concat(H)],B["scroll".concat(H)],Z.body["offset".concat(H)],B["offset".concat(H)],B["client".concat(H)])}b([!0,!1],function(Z,H){b(["Width","Height"],function(B,O){var I="".concat(H?"outer":"inner").concat(O);U[I]=function($){if(!this[0])return;if(F(this[0]))return H?this[0]["inner".concat(O)]:this[0].document.documentElement["client".concat(O)];if(C(this[0]))return s0(this[0],O);return this[0]["".concat(H?"offset":"client").concat(O)]+($&&H?z1(this[0],"margin".concat(B?"Top":"Left"))+z1(this[0],"margin".concat(B?"Bottom":"Right")):0)}})}),b(["Width","Height"],function(Z,H){var B=H.toLowerCase();U[B]=function(O){if(!this[0])return T(O)?void 0:this;if(!arguments.length){if(F(this[0]))return this[0].document.documentElement["client".concat(H)];if(C(this[0]))return s0(this[0],H);return this[0].getBoundingClientRect()[B]-u1(this[0],!Z)}var I=parseInt(O,10);return this.each(function($,k){if(!P(k))return;var v=r(k,"boxSizing");k.style[B]=c0(B,I+(v==="border-box"?u1(k,!Z):0))})}});var l0="___cd";U.toggle=function(Z){return this.each(function(H,B){if(!P(B))return;var O=K1(B),I=T(Z)?O:Z;if(I){if(B.style.display=B[l0]||"",K1(B))B.style.display=N1(B.tagName)}else if(!O)B[l0]=r(B,"display"),B.style.display="none"})},U.hide=function(){return this.toggle(!1)},U.show=function(){return this.toggle(!0)};var r0="___ce",F0=".",V0={focus:"focusin",blur:"focusout"},n0={mouseenter:"mouseover",mouseleave:"mouseout"},r5=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function C0(Z){return n0[Z]||V0[Z]||Z}function N0(Z){var H=Z.split(F0);return[H[0],H.slice(1).sort()]}U.trigger=function(Z,H){if(E(Z)){var B=N0(Z),O=B[0],I=B[1],$=C0(O);if(!$)return this;var k=r5.test($)?"MouseEvents":"HTMLEvents";Z=J.createEvent(k),Z.initEvent($,!0,!0),Z.namespace=I.join(F0),Z.___ot=O}Z.___td=H;var v=Z.___ot in V0;return this.each(function(U1,W1){if(v&&V(W1[Z.___ot]))W1["___i".concat(Z.type)]=!0,W1[Z.___ot](),W1["___i".concat(Z.type)]=!1;W1.dispatchEvent(Z)})};function t0(Z){return Z[r0]=Z[r0]||{}}function n5(Z,H,B,O,I){var $=t0(Z);$[H]=$[H]||[],$[H].push([B,O,I]),Z.addEventListener(H,I)}function a0(Z,H){return!H||!a.call(H,function(B){return Z.indexOf(B)<0})}function s1(Z,H,B,O,I){var $=t0(Z);if(!H)for(H in $)s1(Z,H,B,O,I);else if($[H])$[H]=$[H].filter(function(k){var v=k[0],U1=k[1],W1=k[2];if(I&&W1.guid!==I.guid||!a0(v,B)||O&&O!==U1)return!0;Z.removeEventListener(H,W1)})}U.off=function(Z,H,B){var O=this;if(T(Z))this.each(function($,k){if(!P(k)&&!C(k)&&!F(k))return;s1(k)});else if(!E(Z))for(var I in Z)this.off(I,Z[I]);else{if(V(H))B=H,H="";b(o(Z),function($,k){var v=N0(k),U1=v[0],W1=v[1],q1=C0(U1);O.each(function(A1,O1){if(!P(O1)&&!C(O1)&&!F(O1))return;s1(O1,q1,W1,H,B)})})}return this},U.remove=function(Z){return S1(this,Z).detach().off(),this},U.replaceWith=function(Z){return this.before(Z).remove()},U.replaceAll=function(Z){return w(Z).replaceWith(this),this};function t5(Z,H,B,O,I){var $=this;if(!E(Z)){for(var k in Z)this.on(k,H,B,Z[k],I);return this}if(!E(H))if(T(H)||N(H))H="";else if(T(B))B=H,H="";else O=B,B=H,H="";if(!V(O))O=B,B=void 0;if(!O)return this;return b(o(Z),function(v,U1){var W1=N0(U1),q1=W1[0],A1=W1[1],O1=C0(q1),l1=q1 in n0,S0=q1 in V0;if(!O1)return;$.each(function(P0,B1){if(!P(B1)&&!C(B1)&&!F(B1))return;var E0=function(X1){if(X1.target["___i".concat(X1.type)])return X1.stopImmediatePropagation();if(X1.namespace&&!a0(A1,X1.namespace.split(F0)))return;if(!H&&(S0&&(X1.target!==B1||X1.___ot===O1)||l1&&X1.relatedTarget&&B1.contains(X1.relatedTarget)))return;var $0=B1;if(H){var h1=X1.target;while(!x1(h1,H)){if(h1===B1)return;if(h1=h1.parentNode,!h1)return}$0=h1}Object.defineProperty(X1,"currentTarget",{configurable:!0,get:function(){return $0}}),Object.defineProperty(X1,"delegateTarget",{configurable:!0,get:function(){return B1}}),Object.defineProperty(X1,"data",{configurable:!0,get:function(){return B}});var Q8=O.call($0,X1,X1.___td);if(I)s1(B1,O1,A1,H,E0);if(Q8===!1)X1.preventDefault(),X1.stopPropagation()};E0.guid=O.guid=O.guid||w.guid++,n5(B1,O1,A1,H,E0)})}),this}U.on=t5;function a5(Z,H,B,O){return this.on(Z,H,B,O,!0)}U.one=a5;var e5=/\r?\n/g;function J8(Z,H){return"&".concat(encodeURIComponent(Z),"=").concat(encodeURIComponent(H.replace(e5,"\r\n")))}var Z8=/file|reset|submit|button|image/i,e0=/radio|checkbox/i;if(U.serialize=function(){var Z="";return this.each(function(H,B){b(B.elements||[B],function(O,I){if(I.disabled||!I.name||I.tagName==="FIELDSET"||Z8.test(I.type)||e0.test(I.type)&&!I.checked)return;var $=d0(I);if(!T($)){var k=D($)?$:[$];b(k,function(v,U1){Z+=J8(I.name,U1)})}})}),Z.slice(1)},typeof Z5!=="undefined")Q5.exports=w;else Q.cash=Q.$=w})()});var r1=function(J,Q){if(!Q)return J;return J.replace(/{(\w+)}/g,(W,z)=>{return Q[z]!==void 0?Q[z].toString():`{${z}}`})},J5=(J,Q,W,z,Y)=>{switch(J){case"plural":{if(typeof W==="string"){console.warn("Plural format value cannot be a string");return}if(z.count===void 0){console.warn("Plural format requires <count> parameter or use * by default.");let X=W["*"];if(typeof X==="object")X=X[Y||"*"];return r1(X,z)}if(typeof z.count==="string")z.count=Number(z.count);let q="*";if(z.count.toString()in W)q=z.count.toString();let G=W[q]||W["*"];if(typeof G==="object")G=G[Y||"*"];return r1(G,z)}case"condition":{if(typeof W==="string"){console.warn("Condition format value cannot be a string");return}let q;for(let G in W)try{if(new Function("params",`with( params ){ return ${G}; }`)(z||{})){q=W[G];break}}catch(X){console.warn(`Invalid <${Q}(${G})> condition expression`)}if(q===void 0)return;if(typeof q==="object")q=q[Y||"*"];return r1(q,z)}case"variable":default:{const q=typeof W==="object"?W[Y||"*"]:W;if(typeof q==="object"){console.warn(`Invalid <${Q}> variable variant definition`);return}return r1(q,z)}}};class n1{currentLang=window.navigator.language;DICTIONARIES={};set lang(J){if(this.currentLang===J)return;this.currentLang=J}get lang(){return this.currentLang}setDictionary(J,Q){this.DICTIONARIES[J]=Q}translate(J,Q){if(Q&&this.currentLang===Q)return{text:J,lang:this.currentLang};Q=Q||this.currentLang;const[W,z]=Q.split("-");if(this.DICTIONARIES[W]&&J in this.DICTIONARIES[W]){if(typeof this.DICTIONARIES[W][J]==="object"){const Y=this.DICTIONARIES[W][J];J=Y[z||"*"]||Y["*"]}else if(typeof this.DICTIONARIES[W][J]==="string")J=this.DICTIONARIES[W][J]}return{text:J,lang:Q}}format(J,Q,W){W=W||this.currentLang;const[z,Y]=W.split("-");if(!this.DICTIONARIES[z]){console.warn(`Undefined <${W}> format dictionary`);return}if(!this.DICTIONARIES[z][J]){console.warn(`Undefined <${W}[${J}]> format reference`);return}const q=this.DICTIONARIES[z][J];if(typeof q==="string"){console.warn(`Invalid <${W}[${J}]> format reference. Expected object`);return}if(typeof q!=="object"||q===null||Array.isArray(q)){console.warn(`Invalid <${W}[${J}]> format value`);return}return J5(q.type,J,q.value,Q,Y)}}class t1{pendingComponents=new Set;isPending=!1;callbacks=new Map;register(J,Q){this.callbacks.set(J,Q)}unregister(J){this.callbacks.delete(J)}queue(J){if(!this.callbacks.has(J))return;if(this.pendingComponents.add(J),!this.isPending)this.isPending=!0,this.schedule()}schedule(){Promise.resolve().then(()=>this.process())}process(){const J=Array.from(this.pendingComponents);this.pendingComponents.clear(),this.isPending=!1,J.forEach((Q)=>{try{const W=this.callbacks.get(Q);if(W)W()}catch(W){console.error(`Error updating component ${Q}:`,W)}})}clear(){this.pendingComponents.clear(),this.isPending=!1}dispose(){this.pendingComponents.clear(),this.callbacks.clear(),this.isPending=!1}}class a1{subscriptions=new Map;tick=new t1;register(J,Q){this.subscriptions.set(J,Q),this.tick.register(J,Q)}unregister(J){this.subscriptions.delete(J),this.tick.unregister(J)}queueUpdate(J){this.tick.queue(J)}dispose(){this.subscriptions.clear(),this.tick.dispose()}prepareForPotentialUnload(){this.tick.clear(),this.subscriptions.forEach((J,Q)=>{this.subscriptions.set(Q,()=>{})})}proxyState(J,Q){const W=this,z=new WeakMap,Y=(G)=>{if(G instanceof Map)G.forEach((D,M)=>G.set(M,q(D)));else if(Array.isArray(G))G.forEach((D,M)=>G[M]=q(D));else if(typeof G==="object")Object.entries(G).forEach(([D,M])=>G[D]=q(M));let X=new Proxy(G,{get(D,M){if(M==="toJSON")return function(){const R=(h)=>{if(!h||typeof h!=="object")return h;if(z.has(h)){const _=z.get(h);if(_ instanceof Map){const p={};return _.forEach((a,i)=>p[typeof i==="object"?JSON.stringify(i):String(i)]=R(a)),p}if(Array.isArray(_))return _.map((p)=>R(p));const m={};return Object.entries(_).forEach(([p,a])=>m[p]=R(a)),m}if(typeof h.toJSON==="function"&&!z.has(h))return h.toJSON();return h};return R(X)};if(M==="reset")return function(){X=null};const j=D[M];if(G instanceof Map&&typeof j==="function")return function(...R){const h=M.toString();if(h==="set"&&R.length>=2)R[1]=q(R[1]);const _=j.apply(D,R);return["set","delete","clear"].includes(h)&&W.queueUpdate(J),_};if(Array.isArray(G)&&typeof j==="function")return function(...R){const h=M.toString();if(["push","unshift"].includes(h))R=R.map((m)=>q(m));else if(h==="splice"&&R.length>2)R=[R[0],R[1],...R.slice(2).map((m)=>q(m))];const _=j.apply(D,R);return["push","pop","shift","unshift","splice","sort","reverse","fill"].includes(h)&&W.queueUpdate(J),_};return j},set(D,M,j){if(D[M]===j)return!0;if(j instanceof Map&&D[M]instanceof Map){const R=D[M];return R.clear(),j.forEach((h,_)=>R.set(_,q(h))),W.queueUpdate(J),!0}return D[M]=q(j),W.queueUpdate(J),!0}});return z.set(X,G),X},q=(G)=>{if(!G)return G;return G instanceof Map||Array.isArray(G)||typeof G==="object"?Y(G):G};return Y(Q)}}class e1{domObserver;observedComponents=new Map;TIMEOUT=1e4;constructor(){this.domObserver=new MutationObserver(()=>{this.observedComponents.forEach((J,Q)=>{try{const W=Q.node;if(!W){this.unwatch(Q);return}if(J.type==="attach"&&document.contains(W[0]))this.unwatch(Q),Q.emit("component:attached",Q),typeof Q.onAttach=="function"&&Q.onAttach.bind(Q)();else if(J.type==="detach"&&!document.contains(W[0]))this.unwatch(Q),Q.emit("component:detached",Q),typeof Q.onDetach=="function"&&Q.onDetach.bind(Q)()}catch(W){console.log("DWS error --",W)}}),!this.observedComponents.size&&this.domObserver.disconnect()})}watch(J,Q="attach"){const W=J.node;if(!W)return;if(Q==="attach"&&document.contains(W[0])){J.emit("component:attached",J),typeof J.onAttach=="function"&&J.onAttach.bind(J)();return}if(Q==="detach"&&!document.contains(W[0])){J.emit("component:detached",J),typeof J.onDetach=="function"&&J.onDetach.bind(J)();return}this.unwatch(J);const z=setTimeout(()=>{this.unwatch(J),J.emit(`component:${Q}ment-timeout`,J)},this.TIMEOUT);this.observedComponents.set(J,{timeout:z,type:Q}),this.observedComponents.size===1&&this.domObserver.observe(document.body,{childList:!0,subtree:!0}),Q==="attach"&&J.once("component:attached",()=>this.watch(J,"detach"))}unwatch(J){const Q=this.observedComponents.get(J);if(Q)clearTimeout(Q.timeout),this.observedComponents.delete(J);!this.observedComponents.size&&this.domObserver.disconnect()}dispose(){this.domObserver.disconnect(),this.observedComponents.forEach((J)=>clearTimeout(J.timeout)),this.observedComponents.clear()}}class J0{pending=new Set;isPending=!1;component;metrics={batchCount:0,updatesProcessed:0,lastBatchSize:0,avgBatchSize:"0.00"};constructor(J){this.component=J}queue(J){if(this.pending.add(J),this.component.metrics.inc("dependencyUpdateCount"),!this.isPending)this.isPending=!0,this.scheduleProcessing()}scheduleProcessing(){Promise.resolve().then(()=>this.processQueue())}processQueue(){const J=Array.from(this.pending);if(this.metrics.batchCount++,this.metrics.lastBatchSize=J.length,this.metrics.updatesProcessed+=J.length,this.metrics.avgBatchSize=(this.metrics.updatesProcessed/this.metrics.batchCount).toFixed(2),this.pending.clear(),this.component.metrics.trackBatch(J.length),this.applyUpdates(J),this.isPending=!1,this.pending.size>0)this.isPending=!0,this.scheduleProcessing()}applyUpdates(J){J.forEach(({dep:Q,dependent:W})=>{try{const z=W.update(W.memo,"batch-updator");if(z)typeof z.memo==="object"&&this.component.FGUD.get(Q)?.set(W.path,{...W,memo:z.memo}),typeof z.cleanup==="function"&&z.cleanup()}catch(z){console.error("Failed to update dependency --",z)}})}getMetrics(){return{batchCount:this.metrics.batchCount,lastBatchSize:this.metrics.lastBatchSize,avgBatchSize:this.metrics.avgBatchSize,totalUpdates:this.metrics.updatesProcessed}}}class Z0{options={emit:!0};__events={};__once_events={};constructor(J){if(J)this.options=J}on(J,Q){if(!Array.isArray(this.__events[J]))this.__events[J]=[];return this.__events[J].push(Q),this}once(J,Q){if(!Array.isArray(this.__once_events[J]))this.__once_events[J]=[];return this.__once_events[J].push(Q),this}off(J){return delete this.__events[J],delete this.__once_events[J],this}emit(J,...Q){if(!this.options.emit)return;const W=Q.map((z)=>typeof z.toJSON==="function"?z.toJSON():z);this.__events[J]?.forEach((z)=>z(...W)),this.__once_events[J]?.forEach((z)=>z(...W)),delete this.__once_events[J]}}var A0=T0(Q0(),1);function H1(J,Q){if(J===Q)return!1;if(typeof J!=="object"||typeof Q!=="object")return!1;if(J===null||Q===null)return!0;if(J instanceof Set){if(!(Q instanceof Set))return!0;if(J.size!==Q.size)return!0;if(W5(J)&&W5(Q)){for(let G of J)if(!Q.has(G))return!0;return!1}const q=new WeakMap;for(let G of J){let X=!1;if(typeof G!=="object"){if(Q.has(G))X=!0}else for(let D of Q){if(typeof D!=="object")continue;if(!q.has(G))q.set(G,new WeakMap);const M=q.get(G);if(M.has(D)){if(X=M.get(D),X)break;continue}const j=!H1(G,D);if(M.set(D,j),j){X=!0;break}}if(!X)return!0}return!1}if(J instanceof Map){if(!(Q instanceof Map))return!0;if(J.size!==Q.size)return!0;if(X5(J)&&X5(Q)){for(let[G,X]of J)if(Q.get(G)!==X)return!0;return!1}const q=new WeakMap;for(let[G,X]of J){if(typeof G!=="object"){if(!Q.has(G))return!0;const j=Q.get(G);if(typeof X!=="object"){if(X!==j)return!0;continue}if(typeof j!=="object"||H1(X,j))return!0;continue}let D=!1,M=!1;for(let[j,R]of Q){if(typeof j!=="object")continue;if(!q.has(G))q.set(G,new WeakMap);const h=q.get(G);if(h.has(j)){const[_,m]=h.get(j);if(_){D=!0,M=m;break}continue}if(!H1(G,j)){if(D=!0,M=typeof X==="object"&&typeof R==="object"?!H1(X,R):X===R,h.set(j,[!0,M]),M)break}else h.set(j,[!1,!1])}if(!D||!M)return!0}return!1}if(Array.isArray(J)){if(!Array.isArray(Q))return!0;if(J.length!==Q.length)return!0;for(let q=0;q<J.length;q++){const G=J[q],X=Q[q];if(G!==X&&(typeof G!=="object"||H1(G,X)))return!0}return!1}const W=Object.keys(J),z=Object.keys(Q);if(W.length!==z.length)return!0;W.sort(),z.sort();const Y=W.length;for(let q=0;q<Y;q++)if(W[q]!==z[q])return!0;for(let q=0;q<Y;q++){const G=W[q],X=J[G],D=Q[G];if(X===D)continue;if(X instanceof Date){if(!(D instanceof Date)||String(X)!==String(D))return!0;continue}if(X instanceof RegExp){if(!(D instanceof RegExp)||X.source!==D.source||X.flags!==D.flags)return!0;continue}if(X instanceof Map){if(!(D instanceof Map)||H1(X,D))return!0;continue}if(X instanceof Set){if(!(D instanceof Set)||H1(X,D))return!0;continue}if(X instanceof Function){if(!(D instanceof Function))return!0;continue}if(typeof X==="object"){if(typeof D!=="object")return!0;if(X===J){if(D!==Q)return!0}else if(H1(X,D))return!0}else return!0}return!1}function E1(J,Q){if(J===Q)return!0;if(J==null||Q==null)return J===Q;const W=typeof J;if(W!==typeof Q)return!1;if(W!=="object"){if(W==="number"&&isNaN(J)&&isNaN(Q))return!0;return!1}if(J instanceof Date)return Q instanceof Date&&J.getTime()===Q.getTime();if(J instanceof RegExp)return Q instanceof RegExp&&J.source===Q.source&&J.flags===Q.flags;if(J instanceof Error)return Q instanceof Error&&J.name===Q.name&&J.message===Q.message&&(J.stack===Q.stack||!J.stack&&!Q.stack);if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView(J)){if(!ArrayBuffer.isView(Q))return!1;if(J.byteLength!==Q.byteLength)return!1;const X=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),D=new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);for(let M=0;M<X.length;M++)if(X[M]!==D[M])return!1;return!0}if(J instanceof Promise||J instanceof WeakMap||J instanceof WeakSet)return J===Q;if(typeof J==="function"){if(typeof Q!=="function")return!1;return J.toString()===Q.toString()&&J.name===Q.name}if(J.constructor!==Q.constructor)return!1;if(J instanceof Map||J instanceof Set||Array.isArray(J)||Object.getPrototypeOf(J)===Object.prototype)return!H1(J,Q);const Y=Object.getPrototypeOf(J);if(Y!==Object.getPrototypeOf(Q))return!1;const q=Object.getOwnPropertyNames(J),G=Object.getOwnPropertyNames(Q);if(q.length!==G.length)return!1;for(let X of q){if(!Object.prototype.hasOwnProperty.call(Q,X))return!1;if(!E1(J[X],Q[X]))return!1}if(Y!==null&&Y!==Object.prototype){const X=Object.getOwnPropertyNames(Y),D=Object.getOwnPropertyNames(Object.getPrototypeOf(Q));if(X.length!==D.length)return!1;for(let M of X){if(M==="constructor")continue;if(!E1(Y[M],Object.getPrototypeOf(Q)[M]))return!1}}return!0}function W5(J){for(let Q of J)if(typeof Q==="object"&&Q!==null)return!1;return!0}function X5(J){for(let[Q,W]of J)if(typeof Q==="object"&&Q!==null||typeof W==="object"&&W!==null)return!1;return!0}function J1(J,Q=new WeakMap){if(J===null||typeof J!=="object"||J instanceof Promise)return J;if(Q.has(J))return Q.get(J);if(J instanceof Date)return new Date(J.getTime());if(J instanceof RegExp)return new RegExp(J.source,J.flags);if(J instanceof Map){const Y=new Map;return Q.set(J,Y),J.forEach((q,G)=>Y.set(J1(G,Q),J1(q,Q))),Y}if(J instanceof Set){const Y=new Set;return Q.set(J,Y),J.forEach((q)=>Y.add(J1(q,Q))),Y}if(Array.isArray(J)){const Y=[];Q.set(J,Y);for(let q=0;q<J.length;q++)Y[q]=J1(J[q],Q);return Y}if(ArrayBuffer.isView(J))return new J.constructor(J);const W=Object.create(Object.getPrototypeOf(J));Q.set(J,W);const z=Object.getOwnPropertySymbols(J);for(let Y of z)W[Y]=J1(J[Y],Q);for(let Y in J)if(Object.prototype.hasOwnProperty.call(J,Y))W[Y]=J1(J[Y],Q);return W}function z5(J,Q){if(!J||typeof J!=="object")throw new TypeError("Original argument must be an object");if(!Q||typeof Q!=="object")throw new TypeError("ToSet argument must be an object");if(!Object.keys(Q).length)return{...J};function W(Y,q,G){const X=q.split(/\.|\[|\]/).filter(Boolean);let D=Y;for(let M=0;M<X.length;M++){const j=X[M],R=!isNaN(Number(j)),h=M===X.length-1,_=!isNaN(Number(X[M+1]));if(h){D[j]=G;continue}if(!(j in D))D[j]=_?[]:{};else if(_&&!Array.isArray(D[j]))D[j]=[];else if(!_&&Array.isArray(D[j]))D[j]={};D=D[j]}}const z=J1(J);try{for(let[Y,q]of Object.entries(Q)){if(typeof Y!=="string")throw new TypeError(`Invalid path: ${Y}`);if(!/^[a-zA-Z0-9_\-\[\].]+$/.test(Y))throw new Error(`Invalid path format: ${Y}`);W(z,Y,q)}}catch(Y){throw new Error(`Failed to assign value: ${Y.message}`)}return z}var $1="i18n",I1="syn:",M1="fn:",b1="on-",t=/^\.\.\./,W0=/^\[(.*?)\]$/,b0=/{\s*([^{}]+)\s*}/g,H5=["@html","@text","@format"];A0.default.fn.extend({attrs:function(){const J={},Q=this[0];return Q&&Q.nodeType!==Node.TEXT_NODE&&A0.default.each(Q.attributes,function(){J[this.name]=this.value}),J}});class X0{debug;initialStats={renderCount:0,elementCount:0,renderTime:0,avgRenderTime:0,maxRenderTime:0,componentCount:0,componentUpdateCount:0,partialCount:0,partialUpdateCount:0,memoryUsage:void 0,domOperations:0,domInsertsCount:0,domUpdatesCount:0,domRemovalsCount:0,i18nTrackCount:0,i18nUpdateCount:0,dependencyTrackCount:0,dependencyUpdateCount:0,batchSize:0,batchCount:0,errorCount:0};stats=this.reset();renderStartTime=0;renderTimes=[];measurementCount=0;maxMeasurements=100;loggingInterval=10;autoSaveInterval;constructor(J=!1){if(this.debug=J,this.debug)this.autoSaveInterval=window.setInterval(()=>this.storeMetrics(),5000)}storeMetrics(){try{const J=JSON.parse(localStorage.getItem("lipsPerformanceMetrics")||"[]");J.push({timestamp:Date.now(),metrics:{...this.stats}}),J.length>100&&J.shift(),localStorage.setItem("lipsPerformanceMetrics",JSON.stringify(J))}catch(J){}}startRender(){if(!this.debug)return;this.renderStartTime=performance.now()}endRender(){if(!this.debug||this.renderStartTime===0)return;const J=performance.now()-this.renderStartTime;this.stats.renderTime=J,this.stats.maxRenderTime=Math.max(this.stats.maxRenderTime,J),this.renderTimes.push(J),this.renderTimes.length>this.maxMeasurements&&this.renderTimes.shift(),this.stats.avgRenderTime=this.renderTimes.reduce((Q,W)=>Q+W,0)/this.renderTimes.length,this.renderStartTime=0,this.measurementCount++}inc(J){if(!this.debug)return;if(typeof this.stats[J]==="number")this.stats[J]++}dec(J){if(!this.debug)return;if(typeof this.stats[J]==="number"&&this.stats[J]>0)this.stats[J]--}record(J,Q){if(!this.debug)return;if(typeof this.stats[J]!=="undefined")this.stats[J]=Q}add(J,Q){if(!this.debug)return;if(typeof this.stats[J]==="number")this.stats[J]+=Q}reset(){return this.renderTimes=[],this.measurementCount=0,this.stats=J1(this.initialStats)}log(){if(!this.debug)return;if(this.loggingInterval>1&&this.measurementCount%this.loggingInterval!==0)return;const J={"Render Count":this.stats.renderCount,"Element Count":this.stats.elementCount,"Avg Render Time (ms)":this.stats.avgRenderTime.toFixed(2),"Max Render Time (ms)":this.stats.maxRenderTime.toFixed(2)},Q={"Component Count":this.stats.componentCount,"Component Updates":this.stats.componentUpdateCount},W={"Partial Count":this.stats.partialCount,"Partial Updates":this.stats.partialUpdateCount},z={"DOM Operations":this.stats.domOperations,"DOM Inserts":this.stats.domInsertsCount,"DOM Updates":this.stats.domUpdatesCount,"DOM Removals":this.stats.domRemovalsCount},Y={"i18n Tracked":this.stats.i18nTrackCount,"i18n Updates":this.stats.i18nUpdateCount},q={"Dependencies Tracked":this.stats.dependencyTrackCount,"Dependency Updates":this.stats.dependencyUpdateCount},G={"Batch Count":this.stats.batchCount,"Avg Batch Size":this.stats.batchCount>0?(this.stats.batchSize/this.stats.batchCount).toFixed(2):"0"};console.group("Lips Framework Performance Metrics"),console.table(J),console.table(Q),console.table(W),console.table(z),console.table(Y),console.table(q),console.table(G),this.stats.memoryUsage&&console.log(`Memory Usage: ${this.stats.memoryUsage.toFixed(2)} MB`),this.stats.errorCount>0&&console.warn(`Errors encountered: ${this.stats.errorCount}`),console.groupEnd(),window.localStorage&&this.measurementCount%10===0&&this.storeMetrics()}trackMemory(){if(!this.debug||!window.performance?.memory)return;this.stats.memoryUsage=window.performance.memory.usedJSHeapSize/1048576}trackBatch(J){if(!this.debug)return;this.stats.batchCount++,this.stats.batchSize+=J}trackError(J){if(!this.debug)return;this.stats.errorCount++,console.error("Lips Framework Error:",J)}setLoggingInterval(J){if(!this.debug)return;this.loggingInterval=J}getSnapshot(){return J1(this.stats)}dispose(){if(!this.debug)return;this.autoSaveInterval&&clearInterval(this.autoSaveInterval)}}var n=T0(Q0(),1);var E5=T0(Q0(),1);var H0="comm",z0="rule",Y0="decl";var Y5="@import";var q5="@namespace",B5="@keyframes";var w5="@layer";function q0(J){return J.trim()}function k1(J,Q,W){return J.replace(Q,W)}function G5(J,Q,W){return J.indexOf(Q,W)}function F1(J,Q){return J.charCodeAt(Q)|0}function V1(J,Q,W){return J.slice(Q,W)}function Y1(J){return J.length}function B0(J){return J.length}function g1(J,Q){return Q.push(J),J}var _0=Math.abs,i1=String.fromCharCode;function G0(J,Q,W,z,Y,q,G,X){return{value:J,root:Q,parent:W,type:z,props:Y,children:q,line:w0,column:f1,length:G,return:"",siblings:X}}function U5(){return Q1}function O5(){if(Q1=w1>0?F1(v1,--w1):0,f1--,Q1===10)f1=1,w0--;return Q1}function G1(){if(Q1=w1<K5?F1(v1,w1++):0,f1++,Q1===10)f1=1,w0++;return Q1}function C1(){return F1(v1,w1)}function c1(){return w1}function K0(J,Q){return V1(v1,J,Q)}function y1(J){switch(J){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function M5(J){return w0=f1=1,K5=Y1(v1=J),w1=0,[]}function D5(J){return v1="",J}function U0(J){return q0(K0(w1-1,x0(J===91?J+2:J===40?J+1:J)))}function j5(J){while(Q1=C1())if(Q1<33)G1();else break;return y1(J)>2||y1(Q1)>3?"":" "}function L5(J,Q){while(--Q&&G1())if(Q1<48||Q1>102||Q1>57&&Q1<65||Q1>70&&Q1<97)break;return K0(J,c1()+(Q<6&&C1()==32&&G1()==32))}function x0(J){while(G1())switch(Q1){case J:return w1;case 34:case 39:if(J!==34&&J!==39)x0(Q1);break;case 40:if(J===41)x0(J);break;case 92:G1();break}return w1}function I5(J,Q){while(G1())if(J+Q1===57)break;else if(J+Q1===84&&C1()===47)break;return"/*"+K0(Q,w1-1)+"*"+i1(J===47?J:G1())}function F5(J){while(!y1(C1()))G1();return K0(J,w1)}var w0=1,f1=1,K5=0,w1=0,Q1=0,v1="";function N5(J){return D5(O0("",null,null,null,[""],J=M5(J),0,[0],J))}function O0(J,Q,W,z,Y,q,G,X,D){var M=0,j=0,R=G,h=0,_=0,m=0,p=1,a=1,i=1,s=0,Z1="",d=Y,y=q,g=z,K=Z1;while(a)switch(m=s,s=G1()){case 40:if(m!=108&&F1(K,R-1)==58){if(G5(K+=k1(U0(s),"&","&\f"),"&\f",_0(M?X[M-1]:0))!=-1)i=-1;break}case 34:case 39:case 91:K+=U0(s);break;case 9:case 10:case 13:case 32:K+=j5(m);break;case 92:K+=L5(c1()-1,7);continue;case 47:switch(C1()){case 42:case 47:if(g1(B8(I5(G1(),c1()),Q,W,D),D),(y1(m||1)==5||y1(C1()||1)==5)&&Y1(K)&&V1(K,-1,void 0)!==" ")K+=" ";break;default:K+="/"}break;case 123*p:X[M++]=Y1(K)*i;case 125*p:case 59:case 0:switch(s){case 0:case 125:a=0;case 59+j:if(i==-1)K=k1(K,/\f/g,"");if(_>0&&(Y1(K)-R||p===0&&m===47))g1(_>32?C5(K+";",z,W,R-1,D):C5(k1(K," ","")+";",z,W,R-2,D),D);break;case 59:K+=";";default:if(g1(g=V5(K,Q,W,M,j,Y,X,Z1,d=[],y=[],R,q),q),s===123)if(j===0)O0(K,Q,g,g,d,q,R,X,y);else{switch(h){case 99:if(F1(K,3)===110)break;case 108:if(F1(K,2)===97)break;default:j=0;case 100:case 109:case 115:}if(j)O0(J,g,g,z&&g1(V5(J,g,g,0,0,Y,X,Z1,Y,d=[],R,y),y),Y,y,R,X,z?d:y);else O0(K,g,g,g,[""],y,0,X,y)}}M=j=_=0,p=i=1,Z1=K="",R=G;break;case 58:R=1+Y1(K),_=m;default:if(p<1){if(s==123)--p;else if(s==125&&p++==0&&O5()==125)continue}switch(K+=i1(s),s*p){case 38:i=j>0?1:(K+="\f",-1);break;case 44:X[M++]=(Y1(K)-1)*i,i=1;break;case 64:if(C1()===45)K+=U0(G1());h=C1(),j=R=Y1(Z1=K+=F5(c1())),s++;break;case 45:if(m===45&&Y1(K)==2)p=0}}return q}function V5(J,Q,W,z,Y,q,G,X,D,M,j,R){var h=Y-1,_=Y===0?q:[""],m=B0(_);for(var p=0,a=0,i=0;p<z;++p)for(var s=0,Z1=V1(J,h+1,h=_0(a=G[p])),d=J;s<m;++s)if(d=q0(a>0?_[s]+" "+Z1:k1(Z1,/&\f/g,_[s])))D[i++]=d;return G0(J,Q,W,Y===0?z0:X,D,M,j,R)}function B8(J,Q,W,z){return G0(J,Q,W,H0,i1(U5()),V1(J,2,-2),0,z)}function C5(J,Q,W,z,Y){return G0(J,Q,W,Y0,V1(J,0,z),V1(J,z+1,-1),z,Y)}function M0(J,Q){var W="";for(var z=0;z<J.length;z++)W+=Q(J[z],z,J,Q)||"";return W}function S5(J,Q,W,z){switch(J.type){case w5:if(J.children.length)break;case Y5:case q5:case Y0:return J.return=J.return||J.value;case H0:return"";case B5:return J.return=J.value+"{"+M0(J.children,z)+"}";case z0:if(!Y1(J.value=J.props.join(",")))return""}return Y1(W=M0(J.children,z))?J.return=J.value+"{"+W+"}":""}function P5(J){var Q=B0(J);return function(W,z,Y,q){var G="";for(var X=0;X<Q;X++)G+=J[X](W,z,Y,q)||"";return G}}class m1{nsp;settings;$head;constructor(J,Q){if(typeof J!=="string")throw new Error("Undefined or invalid styles attachement element(s) namespace");this.nsp=J,this.$head=E5.default("head"),this.settings=Q||{},this.settings&&this.load(this.settings)}compile(J){try{return M0(N5(J),P5([S5]))}catch(Q){throw new Error(`Style compilation failed: ${Q.message}`)}}waitForStyles(J){return new Promise((Q)=>{const W=new MutationObserver(()=>{const z=document.querySelector(J);if(z&&getComputedStyle(z).cssText)W.disconnect(),Q()});W.observe(document.documentElement,{attributes:!0,childList:!0,subtree:!0})})}async inject(J){if(!J)throw new Error("Invalid injection arguments");const Q=`rel="${this.settings.meta?"@":""}${this.nsp}"`;J=this.settings.meta?J:`[rel="${this.nsp}"] { ${J} }`;try{const W=this.compile(J);if(!W)throw new Error(`<component:${this.nsp}> sheet compilation failed`);const z=document.createElement("style");z.setAttribute("rel",`${this.settings.meta?"@":""}${this.nsp}`),z.textContent=W;let Y=0;const q=this.$head.find(`style[${Q}]`);if(q.length)Y=parseInt(q.attr("dindex"))+1,q.remove();return z.setAttribute("dindex",String(Y)),this.settings.meta?document.head.prepend(z):document.head.appendChild(z),z}catch(W){throw new Error(`Style injection failed: ${W.message}`)}}async load(J){if(this.settings=J,typeof this.settings!=="object")throw new Error("Undefined styles settings");if(this.settings.sheet){const Q=await this.inject(this.settings.sheet);await this.waitForStyles(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`)}}get(){}async clear(){const J=this.$head.find(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`);if(!J.length)return;const Q=parseInt(J.attr("dindex"));Q===0?J.remove():J.attr("dindex",String(Q-1))}async custom(){return{}}async style(){return{}}}var w8=function(J){const Q=/on-([a-zA-Z-]+)\s*\(/g;let W=J,z;while((z=Q.exec(J))!==null){const Y=z[1],q=z.index+z[0].length;let G=1,X=q;while(X<J.length&&G>0){if(J[X]==="(")G++;if(J[X]===")")G--;X++}if(G===0){const D=J.slice(q,X-1).trim(),M=J.slice(0,z.index),j=`${b1}${Y}="${D}"`,R=J.slice(X);W=M+j+R,J=W,Q.lastIndex=M.length+j.length}}return W},G8=function(J){const Q=[];let z=J.replace(/<([a-zA-Z][a-zA-Z0-9_-]*)((?:[^>'"]*|'[^']*'|"[^"]*")*?)(?:\/?>)/g,(Y,q,G)=>{return Q.push(G),`<${q}##TAG_ATTRS_${Q.length-1}##>`});for(let Y=0;Y<Q.length;Y++){const q=`##TAG_ATTRS_${Y}##`,G=Q[Y],X=K8(G);z=z.replace(q,X)}return z},K8=function(J){let Q="",W=0,z=!1,Y="",q=0,G=0,X=0;while(W<J.length){const D=J[W];if((D==='"'||D==="'")&&(W===0||J[W-1]!=="\\")){if(!z)z=!0,Y=D;else if(D===Y)z=!1}if(!z){if(D==="(")G++;else if(D===")")G--;else if(D==="{")X++;else if(D==="}")X--}if(!z&&G===0&&X===0&&(D===" "||W===J.length-1)){let M=W;if(W===J.length-1)M=W+1;const j=J.substring(q,M).trim();if(j){const R=U8(j);Q+=" "+R}q=W+1}W++}return Q},U8=function(J){const Q=J.indexOf("=");if(Q===-1){if(J===$1||J.startsWith("...")||J.startsWith("["))return J;return`:${J}="${!J.startsWith("!")}"`}let W=J.substring(0,Q).trim(),z=J.substring(Q+1).trim();if(W.startsWith("@"))return W=!H5.includes(W)?W.slice(1):W,`:${W}=${z}`;if(W.startsWith(M1)||W.startsWith(b1))return J;if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")){const Y=z.substring(1,z.length-1);if(O8(Y))return`:${W}="${Y}"`;return J}else return`:${W}="${z}"`};function O8(J){if(/\bstate\.|\binput\.|\bself\.|\bcontext\./.test(J))return!0;if(/[\+\*\/\%\(\)\{\}\[\]]|\?\s*:/.test(J))return!0;if(/\b[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_]/.test(J))return!0;if(J.includes("{")&&J.includes("}"))return!0;return!1}function h0(J){let Q=(J||"").trim().replace(/>\s*</g,"><").replace(/\s{2,}/g," ").replace(/[\r\n\t]/g,"").replace(/<([a-zA-Z0-9_-]+)([^>]*?)\s*\/>/g,"<$1$2></$1>").replace(/<\{([^}]+)\}\s*(.*?)(\/)>/g,(W,z,Y)=>{return Y.endsWith("<")?`<lips dtag="${z}" ${Y}/lips>`:`<lips dtag="${z}" ${Y}></lips>`}).replace(/(<>)([\s\S]*?)(<\/>)/g,'<lips fragment="true">$2</lips>').replace(/<if\(\s*(.*?)\s*\)>/g,'<if @by="$1">').replace(/<else-if\(\s*(.*?)\s*\)>/g,'<else-if @by="$1">').replace(/<switch\(\s*(.*?)\s*\)>/g,'<switch @by="$1">').replace(/<async await\(\s*(.*?)\s*\)>/g,`<async ${M1}await="\$1">`).replace(/<log\(\s*(.*?)\s*\)>/g,'<log @args="$1">').replace(/\[(.*?)\]/g,(W)=>W.replace(/\s+/g,""));return Q=w8(Q),Q=G8(Q),Q}var M8=function(J,Q){if(J.isDisposed)return;Q.add(J),J.dependencies.add(Q)},R5=function(J){for(let Q of J.dependencies)Q.delete(J);J.dependencies.clear()};function _1(J,Q={maxSize:100}){const W=new Set,z=[{value:J,timestamp:Date.now()}];let Y=0;const q=()=>{const M=D0[D0.length-1];return M&&M8(M,W),z[Y].value},G=()=>{const M=[...W];if($5)for(let j of M)$5.add(j);else for(let j of M)j.execute()};return[q,(M,j)=>{if(Object.is(z[Y].value,M))return;if(Y<z.length-1)z.splice(Y+1);if(z.push({value:M,timestamp:Date.now(),metadata:j}),z.length>Q.maxSize)z.shift(),Y=Math.max(0,Y-1);else Y++;G()},{undo(){if(Y>0)Y--,G()},redo(){if(Y<z.length-1)Y++,G()},jumpTo(M){if(M>=0&&M<z.length&&M!==Y)Y=M,G()},getHistory(){return[...z]},getCurrentIndex(){return Y},canUndo(){return Y>0},canRedo(){return Y<z.length-1},clear(){const M=z[0];z.length=0,z.push(M),Y=0,G()}}]}function p1(J){let Q=!1;const W=()=>{if(Q)throw new Error("Circular dependency detected");if(z.isDisposed)return;Q=!0,R5(z),D0.push(z);try{J()}finally{Q=!1,D0.pop()}},z={execute:W,dependencies:new Set,isDisposed:!1};return W(),{dispose:()=>{z.isDisposed=!0,R5(z)}}}var D0=[],$5=null;class o1 extends Z0{declaration;$=null;input;state;static;context;__name__;__path__;__lang__;__template__;__previous;__macros=new Map;__i18nDeps=new Map;__renderCache=new Map;FGUD=new Map;PCC=new Map;VER=[];prepath="0";debug=!1;isRendered=!1;__setInput;__setState;__getState;UQS;ICE;lips;metrics;stylesheet;__path="";__pathCounter=0;__renderDepth=0;constructor(J,Q,{input:W,state:z,context:Y,_static:q,handler:G,stylesheet:X,macros:D,declaration:M},j){super();if(this.lips=j.lips,j?.debug)this.debug=j.debug||this.lips.debug;if(j?.prepath)this.prepath=j.prepath;if(this.__name__=J,this.__lang__=this.lips.i18n.lang,this.__path__=`${this.prepath}/${this.__name__}`,this.__template__=h0(Q),this.declaration=M||{name:J},this.input=W||{},this.static=q||{},this.context={},this.state=this.lips.IUC.proxyState(this.__path__,z||{}),D&&this.setMacros(D),G&&this.setHandler(G),X&&this.setStylesheet(X),this.metrics=new X0(this.debug),this.metrics.inc("componentCount"),this.UQS=new J0(this),typeof this.onCreate=="function"&&this.onCreate.bind(this)(),this.emit("component:create",this),this.input&&Object.keys(this.input).length&&typeof this.onInput=="function")this.onInput.bind(this)(this.input),this.emit("component:input",this);this.__previous={input:J1(this.input),state:J1(this.state),context:J1(this.context)};const[R,h]=_1(this.input),[_,m]=_1(this.state),[p,a]=_1(this.context);this.__setInput=h,this.__setState=m,this.__getState=_,this.lips.IUC.register(this.__path__,()=>{H1(this.__previous?.state,this.state)&&this.__setState({...this.__getState(),...this.state})}),Array.isArray(Y)&&Y.length&&this.lips.useContext(Y,(i)=>{if(!H1(this.context,i))return;a(i),this.context=i,typeof this.onContext=="function"&&this.onContext.bind(this)(),this.emit("component:context",this)}),this.lips.useTranslator("*",(i)=>{if(i===this.__lang__)return;this.__updateI18nDepNodes__(),this.__lang__=i}),this.ICE=p1(()=>{const i=R(),s=_(),Z1=this.context=p();if(!this.isRendered){this.metrics.reset();const{$log:d}=this.render("",void 0,void 0,this.FGUD);this.$=d,!M?.syntax&&this.$?.each((y,g)=>typeof g.setAttribute=="function"&&g.setAttribute("rel",this.__name__)),this.isRendered=!0,typeof this.onMount=="function"&&this.onMount.bind(this)(),this.emit("component:mount",this),this.lips.watcher.watch(this)}else this.__updateDepNodes__({state:s,input:i,context:Z1},this.__previous),typeof this.onUpdate=="function"&&this.onUpdate.bind(this)(),this.emit("component:update",this),this.__previous={input:J1(i),state:J1(s),context:J1(Z1)},this.input=i;this.metrics.log(),typeof this.onRender=="function"&&this.onRender.bind(this)(),this.emit("component:render",this)})}setContext(J,Q){this.lips.setContext(J,Q)}setInput(J){if(!H1(this.input,J))return;this.__setInput(J),typeof this.onInput=="function"&&this.onInput.bind(this)(J)}subInput(J){if(typeof J!=="object")throw new Error("Invalid sub input data argument");return this.setInput(z5(this.input,J)),this}setMacros(J){const Q=h0(J),W=n.default(Q);if(!W.length)return;const z=this;W.each(function(){const Y=n.default(this),{argv:q,attrs:G}=z.__getAttributes__(Y);if(!Object.keys(G))throw new Error("Invalid macro component definition");if(!G.literals.name)throw new Error("Undefined macro `name` attribute.");if(z.__macros.get(G.literals.name))console.warn(`Duplicate macro <${G.literals.name}> will be override`);if(!Y.contents()?.length)throw new Error("Invalid macro component definition. Template content expected.");z.__macros.set(G.literals.name,{argv:q,$node:Y})})}setHandler(J){Object.entries(J).map(([Q,W])=>this[Q]=W.bind(this))}setStylesheet(J){const Q={sheet:J,meta:this.__name__==="__ROOT__"};this.stylesheet=new m1(this.__name__,Q)}get node(){if(!this.$)throw new Error("node() is expected to be call after component get rendered");return this.$}render(J,Q,W={},z,Y){const q=z||new Map,G=[];if(Q&&!Q.length)return console.warn("Undefined node element to render"),{$log:Q,dependencies:q};this.metrics.startRender();const X=this;let D=n.default();function M(K){const U=j(K);return X.__pathCounter++,X.__path?`${X.__path}/${U}`:`${J?J+"/":"#"}${U}`}function j(K){return(K==="component"?"c":"")+X.__pathCounter}function R(K){return K!==null&&typeof K==="object"&&typeof K.mesh==="function"&&typeof K.update==="function"}function h(K){return K!==null&&typeof K==="object"&&typeof K.default&&typeof K.default==="string"}function _(K){if(!K.attr(":dtag")||K.prop("tagName")!=="LIPS")throw new Error("Invalid dynamic tag name");const U=K.attr(":dtag"),w=X.__evaluate__(U,W);if(R(w)||w===null)return i(K,U,w);else if(h(w))return s(K,{template:w});else return s(K,{name:w})}function m(K){const U=K.attr(":args"),w=M("log");if(!U)return;if(X.__evaluate__(`console.log(${U})`,W),X.__isReactive__(U,W))X.__extractExpressionDeps__(U,W).forEach((F)=>X.__trackDep__(q,F,{$fragment:null,path:w,update:(C)=>X.__evaluate__(`console.log(${U})`,C),memo:W,batch:!0}))}function p(K){const U=M("var"),{attrs:w}=X.__getAttributes__(K);if(!w)return;Object.entries(w.literals).forEach(([S,F])=>{if(W[S]&&W[S].type==="const")throw new Error(`Cannot override <const ${S}=[value]/> variable`);W[S]={value:F,type:"let"}}),Object.entries(w.expressions).forEach(([S,F])=>{if(t.test(S)){const C=(P,x)=>{const f=X.__evaluate__(S.replace(t,""),x||W);if(typeof f!=="object")throw new Error(`Invalid spread operator ${S}`);for(let V in f){if(W[V]&&W[V].type==="const")throw new Error(`Cannot override <const ${V}=[value]/> variable`);if(W[V]={value:f[V],type:"let"},x)x[V]=W[V],X.__updateVarDepNodes__(V,U,x)}if(P)return{memo:x}};X.__extractExpressionDeps__(S,W).forEach((P)=>X.__trackDep__(q,P,{$fragment:null,path:`${U}.${S}`,update:(x)=>C(!0,x),memo:W,batch:!0})),C()}else if(F){if(X.__isReactive__(F,W)){const C=X.__extractExpressionDeps__(F,W),u=(P,x)=>{if(W[S]&&W[S].type==="const")throw new Error(`Cannot override <const ${S}=[value]/> variable`);return P[S]=W[S]={value:X.__evaluate__(F,P),type:"let"},X.__updateVarDepNodes__(S,U,P),{memo:P}};C.forEach((P)=>X.__trackDep__(q,P,{$fragment:null,path:`${U}.${S}`,update:u,memo:W,batch:!0}))}if(W[S]&&W[S].type==="const")throw new Error(`Cannot override <const ${S}=[value]/> variable`);W[S]={value:X.__evaluate__(F,W),type:"let"}}}),X.metrics.inc("elementCount")}function a(K){const{attrs:U}=X.__getAttributes__(K);if(!U)return;Object.entries(U.literals).forEach(([w,S])=>{if(W[w]&&W[w].type==="const")throw new Error(`<const ${w}=[value]/> variable already defined`);if(!S)return;W[w]={value:S,type:"const"}}),Object.entries(U.expressions).forEach(([w,S])=>{if(t.test(w)){const F=X.__evaluate__(w.replace(t,""),W);if(typeof F!=="object")throw new Error(`Invalid spread operator ${w}`);for(let C in F){if(W[C]&&W[C].type==="const")throw new Error(`<const ${C}=[value]/> by spread operator ${w}. [${C}] variable already defined`);W[C]={value:F[C],type:"const"}}}else{if(W[w]&&W[w].type==="const")throw new Error(`<const ${w}=[value]/> variable already defined`);if(!S)return;W[w]={value:X.__evaluate__(S,W),type:"const"}}}),X.metrics.inc("elementCount")}function i(K,U,w){const{attrs:S}=X.__getAttributes__(K),F=M("element"),C=X.__getBoundaries__(F);let u=n.default(C.start),P={},x=w;if(x){S.literals&&Object.entries(S.literals).forEach(([V,E])=>P[V]={type:"arg",value:E}),S.expressions&&Object.entries(S.expressions).forEach(([V,E])=>{if(!x)return;if(t.test(V)){const T=X.__evaluate__(V.replace(t,""),W);if(typeof T!=="object")throw new Error(`Invalid spread operator ${V}`);for(let N in T){if(N!=="#"&&!x.argv.includes(N))continue;P[N]={type:"arg",value:T[N]}}}else{if(V!=="#"&&!x.argv.includes(V))return;P[V]={type:"arg",value:E?X.__evaluate__(E,W):!0}}});const f=x.mesh(P);if(f&&f.length)u=u.add(f);S.expressions&&Object.entries(S.expressions).forEach(([V,E])=>{if(!x)return;if(t.test(V)&&X.__isReactive__(V,W)){const T=X.__extractExpressionDeps__(V,W),N=(L,A)=>{if(!x)return;const b={},c=X.__evaluate__(V.replace(t,""),L);if(typeof c!=="object")throw new Error(`Invalid spread operator ${V}`);const l=[];for(let o in c){if(o!=="#"&&!x.argv.includes(o))continue;P[o]=b[o]={type:"arg",value:c[o]},(!L[o]||!E1(c[o],L[o].value))&&l.push(o)}l.length&&x.update(l,b,C)};T.forEach((L)=>X.__trackDep__(q,L,{$fragment:null,boundaries:C,path:`${F}.${V}`,update:N,memo:W,batch:!0}))}else if((V==="#"||x.argv.includes(V))&&X.__isReactive__(E,W)){const T=X.__extractExpressionDeps__(E,W),N=(L,A)=>{if(!x)return;const b=P[V]={type:"arg",value:E?X.__evaluate__(E,L):!0};x.update([V],{[V]:b},C)};T.forEach((L)=>X.__trackDep__(q,L,{$fragment:null,boundaries:C,path:`${F}.${V}`,update:N,memo:W,batch:!0}))}})}if(X.__isReactive__(U,W)){const f=(E,T)=>{const N=X.__evaluate__(U,E);let L;if(h(N))L=s(K,{template:N});else if(R(N))P="#"in P?{...E,...P["#"].value}:{...E,...P},x=N,L=x?x.mesh(P):null;if(!document.contains(C.start)||!document.contains(C.end))throw new Error("Dynamic element boundaries not found");const A=[];let b=C.start.nextSibling;while(b&&b!==C.end)A.push(b),b=b.nextSibling;n.default(A).remove(),L&&n.default(C.start).after(L)};X.__extractExpressionDeps__(U,W).forEach((E)=>X.__trackDep__(q,E,{$fragment:null,boundaries:C,path:F,update:f,batch:!0,memo:{...W,...P}}))}return u=u.add(C.end),u}function s(K,U){let w,S;if(U?.template)w=U.template,S=j("component");else{if(S=U?.name||K.prop("tagName")?.toLowerCase(),!S)throw new Error("Invalid component");if(S===X.__name__)throw new Error("Render component within itself is forbidden");w=X.lips.import(S)}if(!w||!S)throw new Error(`<${S}> template not found`);const F=M("component"),C=X.__getBoundaries__(F),{argv:u,attrs:P,events:x}=X.__getAttributes__(K),f={};let V={},E=n.default(C.start),T=X.PCC.get(F);P.literals&&Object.entries(P.literals).forEach(([L,A])=>{if(L=="key")return;V[L]=A}),P.functions&&Object.entries(P.functions).forEach(([L,A])=>{V[L]=X.__evaluateFunction__(A,[],W),w.declaration?.syntax?f[I1+M1+L]=A:f[M1+L]=A}),P.expressions&&Object.entries(P.expressions).forEach(([L,A])=>{if(L=="key")return;if(t.test(L)){const b=X.__evaluate__(L.replace(t,""),W);if(typeof b!=="object")throw new Error(`Invalid spread operator ${L}`);for(let c in b)V[c]=b[c]}else V[L]=A?X.__evaluate__(A,W):!0;w.declaration?.syntax?f[I1+L]=A:f[L]=A});const N=K.contents();if(N.length){if(V={...V,...X.__meshwire__({$node:K,fragmentPath:F,fragmentBoundaries:C,meshPath:null,argv:u,scope:W,xmlns:Y,useAttributes:!0,declaration:w.declaration},f)},w.declaration){if(w.declaration.tags)Object.entries(w.declaration?.tags).forEach(([L,{type:A,many:b}])=>{switch(A){case"nexted":{let c=K.next(L);if(!c.length)return;if(b){V[L]=[];let l=0,o=!1;while(!o){if(V[L].push(X.__meshwire__({$node:c,meshPath:`${L}[${l}]`,fragmentPath:F,fragmentBoundaries:C,argv:u,scope:W,xmlns:Y,useAttributes:!0,declaration:w.declaration},f)),!c.next(L).length){o=!0;break}c=c.next(L),l++}}else V[L]=X.__meshwire__({$node:c,meshPath:L,fragmentPath:F,fragmentBoundaries:C,argv:u,scope:W,xmlns:Y,useAttributes:!0,declaration:w.declaration},f)}break;case"child":{const c=K.children(L);if(b)V[L]=[],c.each(function(l){const o=n.default(this),{argv:D1}=X.__getAttributes__(o);V[L].push(X.__meshwire__({$node:o,meshPath:`${L}[${l}]`,fragmentPath:F,fragmentBoundaries:C,argv:D1,scope:W,xmlns:Y,useAttributes:!0,declaration:w.declaration},f))});else if(K.children(L).first().length){const l=K.children(L).first(),{argv:o}=X.__getAttributes__(l);V[L]=X.__meshwire__({$node:l,meshPath:L,fragmentPath:F,fragmentBoundaries:C,argv:o,scope:W,xmlns:Y,useAttributes:!0,declaration:w.declaration},f)}}break}});else if(w.declaration.contents)V.__contents__=N}}if(T)T.setInput(J1(V)),E=E.add(T.node);else{const{declaration:L,state:A,_static:b,handler:c,context:l,default:o,stylesheet:D1}=w;T=new o1(S,o||"",{state:J1(A),input:J1(V),context:l,_static:J1(b),handler:c,stylesheet:D1,declaration:L},{debug:X.debug,lips:X.lips,prepath:F}),E=E.add(T.node),X.PCC.set(F,T),Object.entries(x).forEach(([e,r])=>!!T&&X.__attachEvent__(T,e,r,W)),f&&Object.entries(f).forEach(([e,r])=>{let z1=!1,u1=!1;if(e.startsWith(I1))z1=!0,e=e.replace(I1,"");if(e.startsWith(M1))u1=!0,e=e.replace(M1,"");if(t.test(e)){const R1=(N1)=>{const K1={},x1=X.__evaluate__(e.replace(t,""),N1);if(typeof x1!=="object")throw new Error(`Invalid spread operator ${e}`);for(let T1 in x1)K1[T1]=x1[T1];T?.subInput(K1)};if(X.__isReactive__(e,W))X.__extractExpressionDeps__(r,W).forEach((K1)=>X.__trackDep__(q,K1,{$fragment:null,boundaries:C,path:`${F}.${e}`,update:R1,syntax:z1,memo:W,batch:!0}))}else{const R1=(N1)=>{const K1=u1?X.__evaluateFunction__(r,[],N1):r?X.__evaluate__(r,N1):!0;T?.subInput({[e]:K1})};if(X.__isReactive__(r,W))X.__extractExpressionDeps__(r,W).forEach((K1)=>X.__trackDep__(q,K1,{$fragment:null,boundaries:C,path:`${F}.${e}`,update:R1,syntax:z1,memo:W,batch:!0}))}}),E=E.add(C.end)}return X.metrics.inc("componentCount"),E}function Z1(K){const U=K.prop("tagName")?.toLowerCase();if(!U)throw new Error("Invalid macro rendering call");const w=X.__macros.get(U);if(!w)throw new Error("Macro component not found");const S=M("macro"),F=X.__getBoundaries__(S),{attrs:C}=X.__getAttributes__(K),u={};let P={},x={},f=n.default(F.start);if(C.literals&&Object.entries(C.literals).forEach(([N,L])=>P[N]={value:L,type:"arg"}),C.expressions&&Object.entries(C.expressions).forEach(([N,L])=>{if(t.test(N)){const A=X.__evaluate__(N.replace(t,""),W);if(typeof A!=="object")throw new Error(`Invalid spread operator ${N}`);for(let b in A)if(x[b]=A[b],w.argv.includes(b))P[b]={value:A[b],type:"arg"};u[N]=L}else{const A=L?X.__evaluate__(L,W):!0;if(x[N]=A,w.argv.includes(N))P[N]={value:A,type:"arg"};if(w.argv.includes(N))u[N]=L}w.argv.forEach((A)=>{if(P[A]!==void 0)return;P[A]={value:!1,type:"arg"}})}),w.argv.includes("__"))P.__={value:x,type:"arg"};const V={$node:w.$node,meshPath:null,fragmentPath:S,fragmentBoundaries:F,argv:w.argv,scope:W,xmlns:Y,useAttributes:!0},E=X.__meshwire__(V,u),T=E.renderer.mesh(P);return f=f.add(T),u&&Object.entries(u).forEach(([N,L])=>{let A=!1;if(new RegExp(`^${I1}`).test(N))A=!0,N=N.replace(I1,"");if(t.test(N)){if(!X.__isReactive__(N,W))return;const b=X.__extractExpressionDeps__(N,W),c=(l)=>{const o={},D1=X.__evaluate__(N.replace(t,""),l);if(typeof D1!=="object")throw new Error(`Invalid spread operator ${N}`);const e=[];for(let r in D1)o[r]={value:D1[r],type:"arg"},(!l[r]||!E1(D1[r],l[r].value))&&e.push(r);return e.length&&E.renderer.update(e,o),{memo:{...l,...o}}};b.forEach((l)=>X.__trackDep__(q,l,{$fragment:null,boundaries:F,path:`${S}.${N}`,update:c,syntax:A,memo:{...W,...P},batch:!0}))}else if(X.__isReactive__(L,W)){const b=X.__extractExpressionDeps__(L,W),c=(l)=>{const o=l[N]={value:L?X.__evaluate__(L,l):!0,type:"arg"};return E.renderer.update([N],{[N]:o}),{memo:l}};b.forEach((l)=>X.__trackDep__(q,l,{$fragment:null,boundaries:F,path:`${S}.${N}`,update:c,syntax:A,memo:{...W,...P},batch:!0}))}}),f=f.add(F.end),X.metrics.inc("elementCount"),f}function d(K){if(!K.length||!K.prop("tagName"))return K;const U=K.is("svg")||Y,w=U?n.default(document.createElementNS("http://www.w3.org/2000/svg",K.prop("tagName").toLowerCase())):n.default(`<${K.prop("tagName").toLowerCase()}/>`),S=K.contents(),F=M("element");S.length&&w.append(X.__withPath__(F,()=>X.render(F+".n",S,W,q,U).$log));const{attrs:C,events:u}=X.__getAttributes__(K);C.literals&&Object.entries(C.literals).forEach(([x,f])=>{if(x===$1)return;const V=K.is(`[${$1}]`)&&["title","placeholder"].includes(x);w.attr(x,V?X.lips.i18n.translate(f).text:f);const E=(T)=>{w.attr(x,V?X.lips.i18n.translate(f).text:f),V&&X.__trackTranslationDep__({path:F,$fragment:w,update:E,memo:T})};V&&X.__trackTranslationDep__({path:F,$fragment:w,update:E,memo:W})});const P=(x,f=!1)=>{x&&Object.entries(x).forEach(([V,E])=>{switch(V){case"@html":{const T=(N)=>{w.html(X.__evaluate__(E,N))};if(T(W),f&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((L)=>X.__trackDep__(q,L,{$fragment:w,path:`${F}.${V}`,update:T,memo:W,batch:!0}))}break;case"@text":{const T=K.is(`[${$1}]`),N=(L)=>{w.text(X.__evaluate__(E,L,T)),T&&X.__trackTranslationDep__({path:F,$fragment:w,update:N,memo:L})};if(N(W),f&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((A)=>X.__trackDep__(q,A,{$fragment:w,path:`${F}.${V}`,update:N,memo:W,batch:!0}));T&&X.__trackTranslationDep__({path:F,$fragment:w,update:N,memo:W})}break;case"@format":{const[T,N]=E.split(",").map((A)=>A.trim());if(!T)throw new Error("Invalid @format reference");if(!N)throw new Error("Invalid @format parameters");const L=(A)=>{const b=X.__evaluate__(`!${N.trim()}`,A);if(typeof b!=="object")throw new Error("Invalid @format parameters");const c=X.lips.i18n.format(T,b);c!==void 0&&w.text(c),X.__trackTranslationDep__({path:F,$fragment:w,update:L,memo:A})};L(W),X.__extractExpressionDeps__(N,W).forEach((A)=>X.__trackDep__(q,A,{$fragment:w,path:`${F}.${V}`,update:L,memo:W,batch:!0}))}break;case"style":{const T=(N)=>{const L=X.__evaluate__(E,N);if(typeof L==="object"){let A="";Object.entries(L).forEach(([b,c])=>A+=`${b}:${c};`),A.length&&w.attr("style",A)}else w.attr("style",L)};if(T(W),f&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((L)=>X.__trackDep__(q,L,{$fragment:w,path:`${F}.${V}`,update:T,memo:W,batch:!0}))}break;default:{const T=K.is(`[${$1}]`)&&["title","placeholder"].includes(V),N=(L)=>{const A=E?X.__evaluate__(E,L,T):E!==void 0?E:!0;if(A===void 0||A===!1)w.removeAttr(V);else w.attr(V,A),T&&X.__trackTranslationDep__({path:F,$fragment:w,update:N,memo:L})};if(N(W),f&&X.__isReactive__(E,W))X.__extractExpressionDeps__(E,W).forEach((A)=>X.__trackDep__(q,A,{$fragment:w,path:`${F}.${V}`,update:N,memo:W,batch:!0}));T&&X.__trackTranslationDep__({path:F,$fragment:w,update:N,memo:W})}}})};return C.expressions&&Object.keys(C.expressions).forEach((x)=>{if(!t.test(x))return;const f=(V)=>{const E={},T=X.__evaluate__(x.replace(t,""),V);if(typeof T!=="object")throw new Error(`Invalid spread operator ${x}`);for(let N in T)E[N]=T[N];P(E)};if(delete C.expressions[x],f(W),x&&X.__isReactive__(x,W))X.__extractExpressionDeps__(x,W).forEach((E)=>X.__trackDep__(q,E,{$fragment:w,path:`${F}.${x}`,update:f,memo:W,batch:!0}))}),P(C.expressions,!0),u&&Object.entries(u).forEach(([x,f])=>{G.push({_event:x,$fragment:w,instruction:f,scope:W})}),X.metrics.inc("elementCount"),X.metrics.inc("domInsertsCount"),w}function y(K){const U=K.text(),w=M("element"),S=K.parent().is(`[${$1}]`),F=n.default(document.createTextNode(X.__interpolate__(U,W,S))),C=(u)=>{const P=X.__interpolate__(U,u,S);if(!F[0])return;F[0].textContent=P,S&&X.__trackTranslationDep__({path:w,$fragment:F,update:C,memo:u||W})};if(U&&X.__isReactive__(U,W)){const u=X.__extractTextDeps__(U,W);u.forEach((P)=>X.__trackDep__(q,P,{path:w,$fragment:F,update:C,memo:W,batch:u.length>1}))}return S&&X.__trackTranslationDep__({path:w,$fragment:F,update:C,memo:W}),X.metrics.inc("elementCount"),X.metrics.inc("domInsertsCount"),F}function g(K){if(K.get(0)?.nodeType===Node.COMMENT_NODE)return K;if(K.get(0)?.nodeType===Node.TEXT_NODE)return y(K);if(K.is("let"))return p(K);else if(K.is("const"))return a(K);else if(K.is("lips")&&K.attr(":dtag"))return _(K);else if(K.is("log"))return m(K);else if(X.__macros.has(K.prop("tagName")?.toLowerCase()))return Z1(K);else if(K.is("if, for, switch, async")||X.lips.has(K.prop("tagName")?.toLowerCase()))return s(K);else if(K.is("else-if, else"))return;return d(K)}try{this.__renderDepth++,Q=Q||n.default(this.__template__),Q.each(function(){const K=g(n.default(this));if(K)D=D.add(K)}),G.forEach(({$fragment:K,_event:U,instruction:w,scope:S})=>{this.__attachEvent__(K,U,w,S)}),X.metrics.inc("renderCount")}catch(K){console.error("Rendering Failed --",K),X.metrics.trackError(K)}finally{if(this.__renderDepth--,this.metrics.endRender(),this.metrics.trackMemory(),this.__renderDepth===0)this.__path="",this.__pathCounter=0}return{$log:D,dependencies:q,events:G}}destroy(){this.ICE.dispose(),this.stylesheet?.clear(),this.metrics.dispose(),this.lips.IUC.unregister(this.__path__),this.lips.watcher.unwatch(this),this.VER.forEach(({element:J,_event:Q})=>this.__detachEvent__(J,Q)),this.VER=[];for(let J in this.PCC){const Q=this.PCC.get(J);Q?.destroy(),Q?.delete(J)}if(this.$?.remove(),this.PCC?.clear(),this.FGUD?.clear(),this.__macros.clear(),this.__i18nDeps.clear(),this.__previous=null,this.state=null,this.input=null,this.context=null,this.$)this.$.each((J,Q)=>{n.default(Q).off()}),this.$=null;typeof this.onDestroy==="function"&&this.onDestroy.bind(this)(),this.emit("component:destroy",this)}__meshwire__(J,Q){const W=this,{$node:z,meshPath:Y,fragmentPath:q,fragmentBoundaries:G,argv:X,scope:D,xmlns:M,declaration:j,useAttributes:R}=J;let h,_=[],m=!1;const p=[],a=(d,y,g)=>{const K=`${q}.${Y||"r"}${g!==void 0?`[${g}]`:""}`,{$log:U,dependencies:w,events:S}=W.render(K,d,{...D,...y},void 0,M);if(p.push(K),w?.forEach((F,C)=>{if(!W.FGUD?.has(C))W.FGUD.set(C,new Map);F.forEach((u,P)=>{u.partial?.length?u.partial.push(K):u.partial=[K],W.FGUD.get(C)?.set(P,u)})}),W.metrics.inc("partialCount"),g!==void 0){const F=W.__getBoundaries__(K);_[g]={argvalues:y,boundaries:F};let C=n.default(F.start);return C=C.add(U),C=C.add(F.end),C}return U},i=(d,y,g)=>{if(W.metrics.startRender(),d.forEach((K)=>{const U=W.FGUD.get(K);if(!U)return;U.forEach((w)=>{const S=p.find((F)=>w.partial?.find((C)=>F==C));if(!w.partial||!S)return;if(g!==void 0&&!S.endsWith(`r[${g}]`))return;if(G?.start&&!document.contains(G.start)){console.warn(`${Y} -- partial boundaries missing in the DOM`),U.delete(w.path);return}if(w.memo?.[K]&&y?.[K]&&E1(w.memo[K],y[K]))return;if(w.memo={...D,...w.memo,...y},w.batch)W.UQS.queue({dep:K,dependent:w});else{const F=w.update(w.memo,"mesh-partial-updator");if(F)typeof F.memo==="object"&&U.set(w.path,{...w,memo:F.memo}),typeof F.cleanup==="function"&&F.cleanup()}W.metrics.inc("dependencyUpdateCount")}),!U.size&&W.FGUD.delete(K)}),g!==void 0&&_[g])_[g].argvalues=y;W.metrics.inc("partialUpdateCount"),W.metrics.endRender()},s=(d)=>{if(!_[d])return;const y=_[d].boundaries;if(_.splice(d,1),!document.contains(y.start)||!document.contains(y.end)){console.warn(`Partial mesh item<${d}> boundaries missing`);return}const g=[];let K=y.start.nextSibling;while(K&&K!==y.end)g.push(K),K=K.nextSibling;n.default(g).remove(),y.start.remove(),y.end.remove()},Z1={renderer:{path:Y,argv:X,mesh(d,y=!1){if(h=z.contents(),!h?.length)return null;if(j?.iterator){const g=d?.["#"].value;if(!Array.isArray(d?.["#"].value))throw new Error("Invalid iterator argvalues");if(!g.length)return null;let K=n.default();return g.forEach((U,w)=>{if(!h?.length)return null;K=K.add(a(h,U,w))}),K}else return a(h,d)},update(d,y,g){if(!p.length||m)return;m=!0;try{if(g=g||G,j?.iterator){const K=y?.["#"].value;if(!Array.isArray(K))return;if(Array.isArray(_)){if(_.length===K.length){for(let w=0;w<K.length;w++)!E1(_[w].argvalues,K[w])&&i(Object.keys(K[w]),K[w],w);return}const U=Math.min(_.length,K.length);for(let w=0;w<U;w++)i(Object.keys(K[w]),K[w],w);if(K.length>_.length){if(!h?.length)return;for(let w=_.length;w<K.length;w++){const S=a(h,K[w],w);n.default(g.end).before(S)}}else if(K.length<_.length)for(let w=_.length-1;w>=K.length;w--)s(w)}}else i(d,y)}finally{setTimeout(()=>m=!1,0)}}}};if(R&&Y){const{attrs:d}=W.__getAttributes__(z);d.literals&&Object.entries(d.literals).forEach(([y,g])=>Z1[y]=g),d.expressions&&Object.entries(d.expressions).forEach(([y,g])=>{if(t.test(y)){const K=W.__evaluate__(y.replace(t,""),D);if(typeof K!=="object")throw new Error(`Invalid spread operator ${y}`);for(let U in K)Z1[U]=K[U];Q[`${j?.syntax?I1:""}${Y}.${y}`]=g}else Z1[y]=g?W.__evaluate__(g,D):!0,Q[`${j?.syntax?I1:""}${Y}.${y}`]=g})}return Z1}__getBoundaries__(J){return this.metrics.inc("domOperations"),this.metrics.inc("domInsertsCount"),{start:document.createComment(`s:${this.prepath}.${J}`),end:document.createComment(`e:${this.prepath}.${J}`)}}__getAttributes__(J){const Q=J.attrs(),W={},z={literals:{},functions:{},expressions:{}};let Y=[];return Q&&Object.entries(Q).forEach(([q,G])=>{if(q==":dtag")return;if(q.startsWith(":")||q.startsWith(M1)||q.startsWith(b1)||t.test(q)||W0.test(q))if(W0.test(q)){const[X,D]=q.match(W0)||[];Y=D.split(",")}else if(q.startsWith(b1))W[q.replace(b1,"")]=G;else if(q.startsWith(M1))z.functions[q.replace(M1,"")]=G;else{if(q.startsWith(":"))q=q.slice(1,q.length);z.expressions[q]=G||""}else z.literals[q]=G}),{argv:Y,events:W,attrs:z}}__withPath__(J,Q){const W=this.__path;this.__path=J;const z=Q();return this.__path=W,z}__getPathParent__(J){const Q=J.split("/");return Q.pop(),Q.join("/")}__hasSamePathParent__(J,Q){return J.startsWith(Q)}__evaluate__(J,Q,W){try{J=J.trim();const z=(Y)=>{const q=this.state.toJSON();if(Q){const G={};for(let M in Q)G[M]=Q[M].value;const X=`with( scope ){ return ${Y}; }`;return new Function("self","input","state","static","context","scope",X)(this,this.input,q,this.static,this.context,G||{})}else{const G=`return ${Y}`;return new Function("self","input","state","static","context",G)(this,this.input,q,this.static,this.context)}};if(/{\s*([^{}]+)\s*}/.test(J)){if(J.startsWith("!{")&&J.endsWith("}"))return z(J.slice(1));return J.replace(b0,(Y,q)=>z(q))}return z(J)}catch(z){return J}}__evaluateFunction__(J,Q,W){if(/(\s*\w+|\s*\([^)]*\)|\s*)\s*=>\s*(\s*\{[^}]*\}|\s*[^\n;"]+)/g.test(J))return this.__evaluate__(J,W)(...Q);else{let[z,...Y]=J.split(/\s*,\s*/),q;if(z=this.__evaluate__(z,W),typeof z==="function")q=z;else{if(typeof this[z]!=="function")throw new Error(`Undefined <${z}> handler method`);q=this[z].bind(this)}if(typeof q!=="function")throw new Error(`Expected <${z}> to be a function or handler method`);let G=Y.map((X)=>this.__evaluate__(X,W));if(Q.length)G=[...G,...Q];return q(...G)}}__interpolate__(J,Q,W){if(J=J.replace(b0,(z,Y)=>this.__evaluate__(Y,Q)),W)J=this.lips.i18n.translate(J).text;return J}__attachEvent__(J,Q,W,z){J.on(Q,(...Y)=>this.__evaluateFunction__(W,Y,z)),this.VER.push({element:J,_event:Q}),this.metrics.inc("domUpdatesCount"),this.metrics.inc("domRemovalsCount")}__detachEvent__(J,Q){J.off(Q),this.metrics.inc("domOperations"),this.metrics.inc("domRemovalsCount")}__extractTextDeps__(J,Q){const W=new Set;return(J.match(/{\s*([^{}]+)\s*}/g)||[]).forEach((Y)=>{const q=Y.replace(/[{}]/g,"").trim();this.__extractExpressionDeps__(q,Q).forEach((X)=>W.add(X))}),Array.from(W)}__extractExpressionDeps__(J,Q){const W=/\b(state|input|context)(?:\.[a-zA-Z_]\w*)+(?=\[|\.|$|\s|;|,|\))/g,z=/\b(self)(?:\.[a-zA-Z_]\w*)+(?=\()/g;let Y=[...Array.from(J.matchAll(W)),...Array.from(J.matchAll(z))];if(Q&&Object.keys(Q).length){const q=new RegExp(`\\b(${Object.keys(Q).join("|")})`,"g");Y=[...Y,...Array.from(J.matchAll(q))]}return[...new Set(Y.map((q)=>q[0]))]}__isReactive__(J,Q){if(/(state|input|context|self)\.[\w.]+/.test(J))return!0;if(Q&&Object.keys(Q).length&&new RegExp(Object.keys(Q).join("|")).test(J))return!0;return!1}__trackDep__(J,Q,W){if(W.memo&&W.memo[Q]&&W.memo[Q].type==="let")W.haslet=!0;!J.has(Q)&&J.set(Q,new Map),J.get(Q)?.set(W.path,W),this.metrics.inc("dependencyTrackCount")}__trackTranslationDep__(J){this.__i18nDeps.set(J.path,J),this.metrics.inc("i18nTrackCount")}__valueDep__(J,Q){return Q.reduce((W,z)=>W?.[z],J)}__shouldUpdate__(J,Q,W,z){if(J==="self")return!0;const Y=this.__valueDep__(z[J],Q),q=this.__valueDep__(W[J],Q);return!E1(Y,q)}__updateDepNodes__(J,Q){if(!this.FGUD?.size)return;this.metrics.inc("componentUpdateCount"),this.metrics.startRender(),this.FGUD.forEach((W,z)=>{const[Y,...q]=z.split(".");if(!this.__shouldUpdate__(Y,q,J,Q))return;W.forEach((G)=>{const{path:X,batch:D,$fragment:M,boundaries:j,update:R,memo:h,syntax:_}=G;try{if(!_&&(j?.start&&!document.contains(j.start))||M!==null&&!M.closest("body").length){W.delete(X);return}if(D)this.UQS.queue({dep:z,dependent:G});else{const m=R(h,"main-updator");if(m)typeof m.memo==="object"&&W.set(X,{...G,memo:m.memo}),typeof m.cleanup==="function"&&m.cleanup()}this.metrics.inc("dependencyUpdateCount")}catch(m){console.error("failed to update dependency nodes --",m);return}}),!W.size&&this.FGUD?.delete(z)}),this.metrics.endRender()}__updateVarDepNodes__(J,Q,W){if(!this.FGUD?.size)return;this.metrics.inc("partialUpdateCount"),this.metrics.startRender(),this.FGUD.get(J)?.forEach((Y,q)=>{if(!Y.haslet||!this.__hasSamePathParent__(q,this.__getPathParent__(Q)))return;if(Y.memo={...Y.memo,...W},Y.batch)this.UQS.queue({dep:J,dependent:Y});else{const G=Y.update(Y.memo,"var-partial-updator");typeof G?.cleanup==="function"&&G.cleanup()}}),this.metrics.endRender()}__updateI18nDepNodes__(){if(!this.__i18nDeps?.size)return;this.metrics.inc("i18nUpdateCount"),this.metrics.startRender(),this.__i18nDeps?.forEach((J,Q)=>{if(!J.$fragment.closest("body").length){this.__i18nDeps.delete(Q);return}J.update(J.memo,"i18n-partial-updator")}),this.metrics.endRender()}appendTo(J){return(typeof J=="string"?n.default(J):J).append(this.node),this.metrics.inc("domOperations"),this}prependTo(J){return typeof J=="string"?n.default(J):J.prepend(this.node),this.metrics.inc("domOperations"),this}replaceWith(J){return(typeof J=="string"?n.default(J):J).replaceWith(this.node),this.metrics.inc("domOperations"),this}}var k0={};d1(k0,{state:()=>{{return j8}},handler:()=>{{return L8}},default:()=>{{return I8}},declaration:()=>{{return D8}}});var D8={name:"if",syntax:!0,tags:{"else-if":{type:"nexted",many:!0,optional:!0},else:{type:"nexted",optional:!0}}},j8={renderer:null},L8={onInput(){if(!this.input.renderer)return;if(this.input.by)this.state.renderer=this.input.renderer;else{let J=!1;if(Array.isArray(this.input["else-if"])&&this.input["else-if"].length)this.input["else-if"].forEach((Q)=>{if(J||!Q.by)return;this.state.renderer=Q.renderer,J=!0});if(!J)this.state.renderer=this.input.else?this.input.else.renderer:null}}},I8="<{state.renderer}/>";var g0={};d1(g0,{state:()=>{{return V8}},handler:()=>{{return N8}},default:()=>{{return S8}},declaration:()=>{{return F8}},_static:()=>{{return C8}}});var F8={name:"for",syntax:!0,iterator:!0},V8={argvlist:null},C8={lastIn:null,processingBatch:!1},N8={onInput(){if(this.static.processingBatch)return;if(!this.input.renderer)throw new Error("Undefined mesh renderer");let{in:J,from:Q,to:W}=this.input;if(J===void 0&&Q===void 0)throw new Error("Invalid <for> arguments");this.static.processingBatch=!0;try{if(Q!==void 0){if(Q=parseFloat(String(Q)),W==null)throw new Error("Expected <from> <to> attributes of the for loop to be defined");if(W=parseFloat(String(W)),Q===W)throw new Error("<from> and <to> attribute cannot have the same value");const z=Q<W,Y=Math.abs(W-Q)+1;if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===Y){const[G]=this.input.renderer.argv;if(G){let X=Q,D=!0;for(let M=0;M<this.state.argvlist.length;M++){if(this.state.argvlist[M][G].value!==X){D=!1;break}X=z?X+1:X-1}if(D)return;X=Q;for(let M=0;M<this.state.argvlist.length;M++)this.state.argvlist[M][G].value=X,X=z?X+1:X-1;return}}const q=[];for(let G=Q;z?G<=W:G>=W;z?G++:G--){const X={},[D]=this.input.renderer.argv;if(D)X[D]={value:G,type:"arg"};q.push(X)}this.state.argvlist=q}else if(Array.isArray(J)){if(this.state.argvlist&&this.static.lastIn&&this.input.in===this.static.lastIn)return;if(!J.length){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute array value will not update");this.state.argvlist=[];return}if(this.static.lastIn=J,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===J.length){const[q,G]=this.input.renderer.argv;for(let X=0;X<J.length;X++){const D=this.state.argvlist[X];if(q)D[q].value=J[X]}return}const z=[];let Y=0;for(let q of J){const G={},[X,D]=this.input.renderer.argv;if(X)G[X]={value:q,type:"arg"};if(D)G[D]={value:Y,type:"arg"};z.push(G),Y++}this.state.argvlist=z}else if(J instanceof Map){if(this.state.argvlist&&this.static.lastIn&&this.input.in===this.static.lastIn)return;if(!J.size){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute map value will not update");this.state.argvlist=[];return}if(this.static.lastIn=J,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===J.size){const[q,G,X]=this.input.renderer.argv;let D=0;for(let[M,j]of J){const R=this.state.argvlist[D];if(q)R[q].value=M;if(G)R[G].value=j;D++}return}const z=[];let Y=0;for(let[q,G]of J){const X={},[D,M,j]=this.input.renderer.argv;if(D)X[D]={value:q,type:"arg"};if(M)X[M]={value:G,type:"arg"};if(j)X[j]={value:Y,type:"arg"};z.push(X),Y++}this.state.argvlist=z}else if(typeof J=="object"){if(this.state.argvlist&&this.static.lastIn&&this.input.in===this.static.lastIn)return;if(!Object.keys(J).length){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute object value will not update");this.state.argvlist=[];return}this.static.lastIn=J;const z=Object.keys(J);if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===z.length){const[G,X,D]=this.input.renderer.argv;for(let M=0;M<z.length;M++){const j=z[M],R=this.state.argvlist[M];if(G)R[G].value=j;if(X)R[X].value=J[j]}return}const Y=[];let q=0;for(let G in J){const X={},[D,M,j]=this.input.renderer.argv;if(D)X[D]={value:G,type:"arg"};if(M)X[M]={value:J[G],type:"arg"};if(j)X[j]={value:q,type:"arg"};Y.push(X),q++}this.state.argvlist=Y}}finally{this.static.processingBatch=!1}},updateItems(J){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!Array.isArray(J)||!this.state.argvlist)return;this.static.processingBatch=!0;try{const[Q]=this.input.renderer?.argv;if(!Q)return;for(let{index:W,value:z}of J)if(W>=0&&W<this.state.argvlist.length)this.state.argvlist[W][Q].value=z}finally{this.static.processingBatch=!1}},updateProperty(J,Q){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!this.state.argvlist)return;this.static.processingBatch=!0;try{for(let W=0;W<this.state.argvlist.length;W++){const z=this.state.argvlist[W];if(z[J])z[J].value=typeof Q==="function"?Q(z[J].value,W):Q}}finally{this.static.processingBatch=!1}}},S8="<{input.renderer} #=state.argvlist/>";var f0={};d1(f0,{state:()=>{{return E8}},handler:()=>{{return $8}},default:()=>{{return R8}},declaration:()=>{{return P8}}});var P8={name:"async",syntax:!0,tags:{then:{type:"child"},catch:{type:"child",optional:!0},loading:{type:"child",optional:!0}}},E8={renderer:null,props:{}},$8={onInput(){if(!this.input.await)throw new Error("Undefined async <await> attribute");if(!(this.input.await instanceof Promise))throw new Error("Expected async <await> attribute value to be a function");if(this.input.loading)this.state.renderer=this.input.loading.renderer,this.state.props={};this.input.await.then((J)=>{if(!this.input.then)return;this.state.renderer=this.input.then.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:J,type:"arg"}}}).catch((J)=>{if(!this.input.catch)return;this.state.renderer=this.input.catch.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:J,type:"arg"}}})}},R8="<{state.renderer} #=state.props/>";var y0={};d1(y0,{state:()=>{{return A8}},handler:()=>{{return b8}},default:()=>{{return _8}},declaration:()=>{{return T8}}});var T8={name:"switch",syntax:!0,tags:{case:{type:"child",many:!0},default:{type:"child"}}},A8={renderer:null},b8={onInput(){let J=[];for(let Q of this.input.case)if(Q.is==this.input.by||Array.isArray(Q.is)&&Q.is.includes(this.input.by))Array.isArray(Q.is)?J=[...new Set([...J,...Q.is])]:J.push(Q.is),this.state.renderer=Q.renderer;if(!J.includes(this.input.by))this.state.renderer=this.input.default?this.input.default.renderer:null}},_8="<{state.renderer}/>";var v0={};d1(v0,{state:()=>{{return x8}},handler:()=>{{return f8}},default:()=>{{return y8}},context:()=>{{return k8}},_static:()=>{{return h8}}});var g8=function(J){const Q={};return J.split("&").map((z)=>{const[Y,q]=z.split("=");Q[Y]=q}),Q},x8={page:null,params:{},query:{}},h8={global:!1,routes:[],defaultPath:null,currentPath:null,currentRoute:null},k8=["navigate"],f8={onInput(){if(!this.input.routes)return;if(this.input.global)this.static.global=this.input.global;if(this.static.routes=this.input.routes.map(({path:J,template:Q,default:W})=>{if(W)this.static.defaultPath=J;const z=J.match(/:[^\/]*(\/|$)/gi)||[],Y=J.replaceAll("/","\\/").replaceAll(/:[^\/]*(\/|$)/gi,"([^\\/]+)(?:\\/|$)");return{path:J,template:Q,default:W,pathVars:z,pathRegex:new RegExp(`${Y}\$`,"i")}}),this.input.global){const J=window.location.pathname;this.static.defaultPath=this.static.defaultPath&&J=="/"&&J!==this.static.defaultPath?this.static.defaultPath:J?J+window.location.search:this.static.routes[0].path}},onAttach(){if(this.input.global)window.navigate=this.navigate.bind(this),window.addEventListener("popstate",(J)=>J.state&&this.navigate(J.state.path,!0));this.setContext("navigate",this.navigate.bind(this)),this.static.defaultPath&&this.navigate(this.static.defaultPath)},navigate(J,Q){!Q&&this.static.global&&history.pushState({path:J},"",J);const W=J.split("?");J=W[0];const z=W[1]?g8(W[1]):{};let Y=null;if(this.static.currentRoute)Y={path:this.static.currentRoute.path,params:this.state.params},this.emit("before",{fromState:Y,toState:{path:J,query:z}});const q=this.match(J);if(!q){this.static.currentRoute=null,this.state.params={},this.state.query={},this.emit("not-found",J);return}const{route:G,params:X}=q;this.emit("after",{fromState:Y,toState:{path:G.path,params:X,query:z}}),this.static.currentPath=J,this.static.currentRoute=G,this.state.params=X,this.state.query=z,this.state.page=G.template},match(J){const Q={};let W=!1;for(let z of this.static.routes){const{pathVars:Y,pathRegex:q}=z,G=J.match(q);if(G!==null&&G.index===0){for(let X=0;X+1<G.length&&X<Y.length;X++)Q[Y[X].replaceAll(/[\/:]/g,"")]=G[X+1];W=z;break}}return W?{route:W,params:Q}:!1}},y8="<{state.page} params=state.params query=state.query/>";class T5{debug=!1;stylesheets=[];config={};store={};__root;i18n=new n1;watcher;IUC;__setLang;__getLang;__setContext;__getContext;constructor(J){if(this.config=J,this.config?.debug)this.debug=this.config.debug;this.watcher=new e1,this.IUC=new a1;const[Q,W]=_1(this.i18n.lang),[z,Y]=_1(J?.context||{});this.__setLang=W,this.__getLang=Q,this.__setContext=Y,this.__getContext=z,this.register("if",k0),this.register("for",g0),this.register("async",f0),this.register("switch",y0),this.register("router",v0)}register(J,Q){return this.store[J]=Q,this}unregister(J){return delete this.store[J],this}has(J){return J in this.store}import(J){if(!this.has(J))throw new Error(`<${J}> component not found`);if(!this.store[J].declaration?.syntax&&!this.store[J].default)throw new Error(`Invalid <${J}> component`);return this.store[J]}render(J,Q,W){const{default:z,...Y}=Q,q={debug:this.debug,prepath:"0",lips:this},G=new o1(J,z||"",{...Y,input:W},q);return window.addEventListener("beforeunload",()=>{return this.dispose(),G.destroy(),null}),window.addEventListener("pagehide",(X)=>{!X.persisted&&this.dispose()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState!=="hidden")return;this.IUC.prepareForPotentialUnload()}),G}root(J,Q){if(this.__root=this.render("__ROOT__",J),this.__root.appendTo(Q),this.config?.stylesheets)this.stylesheets=this.config.stylesheets.map((W)=>new m1("root",{sheet:W,meta:!0}));return this.__root}setLanguage(J){this.i18n.lang=J,this.__setLang(J)}getLanguage(){return this.__getLang()}setContext(J,Q){const W=this.__getContext();if(typeof J==="string"){const z={...W,[J]:Q};H1(W,z)&&this.__setContext(z)}else if(!Array.isArray(J)){const z={...W,...J};H1(W,z)&&this.__setContext(z)}else throw new Error("Invalid context data")}getContext(){return this.__getContext()}useContext(J,Q){if(!J.length)return;p1(()=>{const W=this.__getContext();if(!W)return;const z=Object.fromEntries(J.map((Y)=>[Y,W[Y]]));z&&typeof Q==="function"&&Object.keys(z).length&&Q(z)})}useTranslator(J,Q){p1(()=>{const W=this.__getLang();if(!W)return;(J==="*"||Array.isArray(J)&&J.includes(W))&&typeof Q==="function"&&Q(W)})}dispose(){this.watcher?.dispose(),this.__root?.destroy(),this.stylesheets.forEach((J)=>J.clear())}}export{T5 as default};
2
2
 
3
- //# debugId=FB8480AEEA49549764756e2164756e21
3
+ //# debugId=714C30D177FB9C2764756e2164756e21