@lipsjs/lips 0.1.1 → 0.2.0
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 +119 -85
- package/dist/lips.js +3836 -0
- package/dist/lips.js.map +28 -0
- package/dist/lips.min.js +9 -2
- package/dist/lips.min.js.map +22 -43
- package/dist/precompile.min.js +20 -0
- package/dist/precompile.min.js.map +13 -0
- package/dist/runtime.min.js +4 -0
- package/dist/runtime.min.js.map +19 -0
- package/dist/types/events.d.ts +1 -1
- package/dist/types/ir/compiler.d.ts +153 -0
- package/dist/types/ir/expression.d.ts +120 -0
- package/dist/types/ir/facade.d.ts +94 -0
- package/dist/types/ir/index.d.ts +15 -0
- package/dist/types/ir/parser.d.ts +124 -0
- package/dist/types/ir/router.d.ts +47 -0
- package/dist/types/ir/runtime.d.ts +95 -0
- package/dist/types/ir/signal.d.ts +26 -0
- package/dist/types/ir/swap.d.ts +23 -0
- package/dist/types/lips.d.ts +16 -37
- package/dist/types/precompile.d.ts +60 -0
- package/dist/types/runtime.d.ts +16 -0
- package/dist/types/stylesheet.d.ts +24 -40
- package/dist/types/types.d.ts +49 -185
- package/package.json +29 -10
- package/dist/test.component.min.js +0 -3
- package/dist/test.component.min.js.map +0 -50
- package/dist/test.stress.min.js +0 -476
- package/dist/test.stress.min.js.map +0 -50
- package/dist/types/component.d.ts +0 -107
- package/dist/types/constants.d.ts +0 -23
- package/dist/types/dws.d.ts +0 -14
- package/dist/types/iuc/index.d.ts +0 -25
- package/dist/types/iuc/tick.d.ts +0 -38
- package/dist/types/iuc.d.ts +0 -25
- package/dist/types/metrics.d.ts +0 -50
- package/dist/types/preprocess.d.ts +0 -2
- package/dist/types/signal.d.ts +0 -30
- package/dist/types/syntax/async.d.ts +0 -16
- package/dist/types/syntax/for.d.ts +0 -25
- package/dist/types/syntax/if.d.ts +0 -14
- package/dist/types/syntax/router.d.ts +0 -40
- package/dist/types/syntax/switch.d.ts +0 -16
- package/dist/types/tick.d.ts +0 -38
- package/dist/types/tps.d.ts +0 -11
- package/dist/types/uqs.d.ts +0 -37
- package/dist/types/utils.d.ts +0 -25
package/dist/lips.min.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
var D8=Object.create;var{defineProperty:f1,getPrototypeOf:I8,getOwnPropertyNames:F8}=Object;var L8=Object.prototype.hasOwnProperty;var J1=(J,Z,X)=>{X=J!=null?D8(I8(J)):{};const H=Z||!J||!J.__esModule?f1(X,"default",{value:J,enumerable:!0}):X;for(let q of F8(J))if(!L8.call(H,q))f1(H,q,{get:()=>J[q],enumerable:!0});return H};var V8=(J,Z)=>()=>(Z||J((Z={exports:{}}).exports,Z),Z.exports);var s0=(J,Z)=>{for(var X in Z)f1(J,X,{get:Z[X],enumerable:!0,configurable:!0,set:(H)=>Z[X]=()=>H})};var o0=V8((M5,D5)=>{(function(){var J=document,Z=window,X=J.documentElement,H=J.createElement.bind(J),q=H("div"),W=H("table"),B=H("tbody"),Y=H("tr"),K=Array.isArray,G=Array.prototype,D=G.concat,O=G.filter,g=G.indexOf,d=G.map,J0=G.push,a=G.slice,q0=G.some,n=G.splice,v=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,i=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,o=/<.+>/,r=/^\w+$/;function Z0(Q,z){var w=x(z);return!Q||!w&&!F(z)&&!C(z)?[]:!w&&i.test(Q)?z.getElementsByClassName(Q.slice(1).replace(/\\/g,"")):!w&&r.test(Q)?z.getElementsByTagName(Q):z.querySelectorAll(Q)}var p=function(){function Q(z,w){if(!z)return;if($(z))return z;var j=z;if(s(z)){var V=w||J;if(j=v.test(z)&&F(V)?V.getElementById(z.slice(1).replace(/\\/g,"")):o.test(z)?r1(z):$(V)?V.find(z):s(V)?M(V).find(z):Z0(z,V),!j)return}else if(f(z))return this.ready(z);if(j.nodeType||j===Z)j=[j];this.length=j.length;for(var T=0,y=this.length;T<y;T++)this[T]=j[T]}return Q.prototype.init=function(z,w){return new Q(z,w)},Q}(),U=p.prototype,M=U.init;if(M.fn=M.prototype=U,U.length=0,U.splice=n,typeof Symbol==="function")U[Symbol.iterator]=G[Symbol.iterator];function $(Q){return Q instanceof p}function L(Q){return!!Q&&Q===Q.window}function F(Q){return!!Q&&Q.nodeType===9}function x(Q){return!!Q&&Q.nodeType===11}function C(Q){return!!Q&&Q.nodeType===1}function P(Q){return!!Q&&Q.nodeType===3}function m(Q){return typeof Q==="boolean"}function f(Q){return typeof Q==="function"}function s(Q){return typeof Q==="string"}function k(Q){return Q===void 0}function _(Q){return Q===null}function b(Q){return!isNaN(parseFloat(Q))&&isFinite(Q)}function N(Q){if(typeof Q!=="object"||Q===null)return!1;var z=Object.getPrototypeOf(Q);return z===null||z===Object.prototype}M.isWindow=L,M.isFunction=f,M.isArray=K,M.isNumeric=b,M.isPlainObject=N;function R(Q,z,w){if(w){var j=Q.length;while(j--)if(z.call(Q[j],j,Q[j])===!1)return Q}else if(N(Q)){var V=Object.keys(Q);for(var j=0,T=V.length;j<T;j++){var y=V[j];if(z.call(Q[y],y,Q[y])===!1)return Q}}else for(var j=0,T=Q.length;j<T;j++)if(z.call(Q[j],j,Q[j])===!1)return Q;return Q}M.each=R,U.each=function(Q){return R(this,Q)},U.empty=function(){return this.each(function(Q,z){while(z.firstChild)z.removeChild(z.firstChild)})};function I(){var Q=[];for(var z=0;z<arguments.length;z++)Q[z]=arguments[z];var w=m(Q[0])?Q.shift():!1,j=Q.shift(),V=Q.length;if(!j)return{};if(!V)return I(w,M,j);for(var T=0;T<V;T++){var y=Q[T];for(var l in y)if(w&&(K(y[l])||N(y[l]))){if(!j[l]||j[l].constructor!==y[l].constructor)j[l]=new y[l].constructor;I(w,j[l],y[l])}else j[l]=y[l]}return j}M.extend=I,U.extend=function(Q){return I(U,Q)};var A=/\S+/g;function S(Q){return s(Q)?Q.match(A)||[]:[]}U.toggleClass=function(Q,z){var w=S(Q),j=!k(z);return this.each(function(V,T){if(!C(T))return;R(w,function(y,l){if(j)z?T.classList.add(l):T.classList.remove(l);else T.classList.toggle(l)})})},U.addClass=function(Q){return this.toggleClass(Q,!0)},U.removeAttr=function(Q){var z=S(Q);return this.each(function(w,j){if(!C(j))return;R(z,function(V,T){j.removeAttribute(T)})})};function E(Q,z){if(!Q)return;if(s(Q)){if(arguments.length<2){if(!this[0]||!C(this[0]))return;var w=this[0].getAttribute(Q);return _(w)?void 0:w}if(k(z))return this;if(_(z))return this.removeAttr(Q);return this.each(function(V,T){if(!C(T))return;T.setAttribute(Q,z)})}for(var j in Q)this.attr(j,Q[j]);return this}U.attr=E,U.removeClass=function(Q){if(arguments.length)return this.toggleClass(Q,!1);return this.attr("class","")},U.hasClass=function(Q){return!!Q&&q0.call(this,function(z){return C(z)&&z.classList.contains(Q)})},U.get=function(Q){if(k(Q))return a.call(this);return Q=Number(Q),this[Q<0?Q+this.length:Q]},U.eq=function(Q){return M(this.get(Q))},U.first=function(){return this.eq(0)},U.last=function(){return this.eq(-1)};function h(Q){if(k(Q))return this.get().map(function(z){return C(z)||P(z)?z.textContent:""}).join("");return this.each(function(z,w){if(!C(w))return;w.textContent=Q})}U.text=h;function u(Q,z,w){if(!C(Q))return;var j=Z.getComputedStyle(Q,null);return w?j.getPropertyValue(z)||void 0:j[z]||Q.style[z]}function c(Q,z){return parseInt(u(Q,z),10)||0}function Q0(Q,z){return c(Q,"border".concat(z?"Left":"Top","Width"))+c(Q,"padding".concat(z?"Left":"Top"))+c(Q,"padding".concat(z?"Right":"Bottom"))+c(Q,"border".concat(z?"Right":"Bottom","Width"))}var t={};function e(Q){if(t[Q])return t[Q];var z=H(Q);J.body.insertBefore(z,null);var w=u(z,"display");return J.body.removeChild(z),t[Q]=w!=="none"?w:"block"}function w0(Q){return u(Q,"display")==="none"}function I0(Q,z){var w=Q&&(Q.matches||Q.webkitMatchesSelector||Q.msMatchesSelector);return!!w&&!!z&&w.call(Q,z)}function S0(Q){return s(Q)?function(z,w){return I0(w,Q)}:f(Q)?Q:$(Q)?function(z,w){return Q.is(w)}:!Q?function(){return!1}:function(z,w){return w===Q}}U.filter=function(Q){var z=S0(Q);return M(O.call(this,function(w,j){return z.call(w,j,w)}))};function A0(Q,z){return!z?Q:Q.filter(z)}U.detach=function(Q){return A0(this,Q).each(function(z,w){if(w.parentNode)w.parentNode.removeChild(w)}),this};var c5=/^\s*<(\w+)[^>]*>/,p5=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o1={"*":q,tr:B,td:Y,th:Y,thead:W,tbody:W,tfoot:W};function r1(Q){if(!s(Q))return[];if(p5.test(Q))return[H(RegExp.$1)];var z=c5.test(Q)&&RegExp.$1,w=o1[z]||o1["*"];return w.innerHTML=Q,M(w.childNodes).detach().get()}M.parseHTML=r1,U.has=function(Q){var z=s(Q)?function(w,j){return Z0(Q,j).length}:function(w,j){return j.contains(Q)};return this.filter(z)},U.not=function(Q){var z=S0(Q);return this.filter(function(w,j){return(!s(Q)||C(j))&&!z.call(j,w,j)})};function R0(Q,z,w,j){var V=[],T=f(z),y=j&&S0(j);for(var l=0,F0=Q.length;l<F0;l++)if(T){var z0=z(Q[l]);if(z0.length)J0.apply(V,z0)}else{var K0=Q[l][z];while(K0!=null){if(j&&y(-1,K0))break;V.push(K0),K0=w?K0[z]:null}}return V}function n1(Q){if(Q.multiple&&Q.options)return R0(O.call(Q.options,function(z){return z.selected&&!z.disabled&&!z.parentNode.disabled}),"value");return Q.value||""}function s5(Q){if(!arguments.length)return this[0]&&n1(this[0]);return this.each(function(z,w){var j=w.multiple&&w.options;if(j||z5.test(w.type)){var V=K(Q)?d.call(Q,String):_(Q)?[]:[String(Q)];if(j)R(w.options,function(T,y){y.selected=V.indexOf(y.value)>=0},!0);else w.checked=V.indexOf(w.value)>=0}else w.value=k(Q)||_(Q)?"":Q})}U.val=s5,U.is=function(Q){var z=S0(Q);return q0.call(this,function(w,j){return z.call(w,j,w)})},M.guid=1;function N0(Q){return Q.length>1?O.call(Q,function(z,w,j){return g.call(j,z)===w}):Q}M.unique=N0,U.add=function(Q,z){return M(N0(this.get().concat(M(Q,z).get())))},U.children=function(Q){return A0(M(N0(R0(this,function(z){return z.children}))),Q)},U.parent=function(Q){return A0(M(N0(R0(this,"parentNode"))),Q)},U.index=function(Q){var z=Q?M(Q)[0]:this[0],w=Q?this:M(z).parent().children();return g.call(w,z)},U.closest=function(Q){var z=this.filter(Q);if(z.length)return z;var w=this.parent();if(!w.length)return z;return w.closest(Q)},U.siblings=function(Q){return A0(M(N0(R0(this,function(z){return M(z).parent().children().not(z)}))),Q)},U.find=function(Q){return M(N0(R0(this,function(z){return Z0(Q,z)})))};var l5=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,o5=/^$|^module$|\/(java|ecma)script/i,r5=["type","src","nonce","noModule"];function n5(Q,z){var w=M(Q);w.filter("script").add(w.find("script")).each(function(j,V){if(o5.test(V.type)&&X.contains(V)){var T=H("script");T.text=V.textContent.replace(l5,""),R(r5,function(y,l){if(V[l])T[l]=V[l]}),z.head.insertBefore(T,null),z.head.removeChild(T)}})}function a5(Q,z,w,j,V){if(j)Q.insertBefore(z,w?Q.firstChild:null);else if(Q.nodeName==="HTML")Q.parentNode.replaceChild(z,Q);else Q.parentNode.insertBefore(z,w?Q:Q.nextSibling);if(V)n5(z,Q.ownerDocument)}function b0(Q,z,w,j,V,T,y,l){return R(Q,function(F0,z0){R(M(z0),function(K0,h0){R(M(z),function(L0,e0){var x1=w?h0:e0,g1=w?e0:h0,O0=w?K0:L0;a5(x1,!O0?g1:g1.cloneNode(!0),j,V,!O0)},l)},y)},T),z}U.after=function(){return b0(arguments,this,!1,!1,!1,!0,!0)},U.append=function(){return b0(arguments,this,!1,!1,!0)};function t5(Q){if(!arguments.length)return this[0]&&this[0].innerHTML;if(k(Q))return this;var z=/<script[\s>]/.test(Q);return this.each(function(w,j){if(!C(j))return;if(z)M(j).empty().append(Q);else j.innerHTML=Q})}U.html=t5,U.appendTo=function(Q){return b0(arguments,this,!0,!1,!0)},U.wrapInner=function(Q){return this.each(function(z,w){var j=M(w),V=j.contents();V.length?V.wrapAll(Q):j.append(Q)})},U.before=function(){return b0(arguments,this,!1,!0)},U.wrapAll=function(Q){var z=M(Q),w=z[0];while(w.children.length)w=w.firstElementChild;return this.first().before(z),this.appendTo(w)},U.wrap=function(Q){return this.each(function(z,w){var j=M(Q)[0];M(w).wrapAll(!z?j:j.cloneNode(!0))})},U.insertAfter=function(Q){return b0(arguments,this,!0,!1,!1,!1,!1,!0)},U.insertBefore=function(Q){return b0(arguments,this,!0,!0)},U.prepend=function(){return b0(arguments,this,!1,!0,!0,!0,!0)},U.prependTo=function(Q){return b0(arguments,this,!0,!0,!0,!1,!1,!0)},U.contents=function(){return M(N0(R0(this,function(Q){return Q.tagName==="IFRAME"?[Q.contentDocument]:Q.tagName==="TEMPLATE"?Q.content.childNodes:Q.childNodes})))},U.next=function(Q,z,w){return A0(M(N0(R0(this,"nextElementSibling",z,w))),Q)},U.nextAll=function(Q){return this.next(Q,!0)},U.nextUntil=function(Q,z){return this.next(z,!0,Q)},U.parents=function(Q,z){return A0(M(N0(R0(this,"parentElement",!0,z))),Q)},U.parentsUntil=function(Q,z){return this.parents(z,Q)},U.prev=function(Q,z,w){return A0(M(N0(R0(this,"previousElementSibling",z,w))),Q)},U.prevAll=function(Q){return this.prev(Q,!0)},U.prevUntil=function(Q,z){return this.prev(z,!0,Q)},U.map=function(Q){return M(D.apply([],d.call(this,function(z,w){return Q.call(z,w,z)})))},U.clone=function(){return this.map(function(Q,z){return z.cloneNode(!0)})},U.offsetParent=function(){return this.map(function(Q,z){var w=z.offsetParent;while(w&&u(w,"position")==="static")w=w.offsetParent;return w||X})},U.slice=function(Q,z){return M(a.call(this,Q,z))};var e5=/-([a-z])/g;function P1(Q){return Q.replace(e5,function(z,w){return w.toUpperCase()})}U.ready=function(Q){var z=function(){return setTimeout(Q,0,M)};if(J.readyState!=="loading")z();else J.addEventListener("DOMContentLoaded",z);return this},U.unwrap=function(){return this.parent().each(function(Q,z){if(z.tagName==="BODY")return;var w=M(z);w.replaceWith(w.children())}),this},U.offset=function(){var Q=this[0];if(!Q)return;var z=Q.getBoundingClientRect();return{top:z.top+Z.pageYOffset,left:z.left+Z.pageXOffset}},U.position=function(){var Q=this[0];if(!Q)return;var z=u(Q,"position")==="fixed",w=z?Q.getBoundingClientRect():this.offset();if(!z){var j=Q.ownerDocument,V=Q.offsetParent||j.documentElement;while((V===j.body||V===j.documentElement)&&u(V,"position")==="static")V=V.parentNode;if(V!==Q&&C(V)){var T=M(V).offset();w.top-=T.top+c(V,"borderTopWidth"),w.left-=T.left+c(V,"borderLeftWidth")}}return{top:w.top-c(Q,"marginTop"),left:w.left-c(Q,"marginLeft")}};var a1={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};U.prop=function(Q,z){if(!Q)return;if(s(Q)){if(Q=a1[Q]||Q,arguments.length<2)return this[0]&&this[0][Q];return this.each(function(j,V){V[Q]=z})}for(var w in Q)this.prop(w,Q[w]);return this},U.removeProp=function(Q){return this.each(function(z,w){delete w[a1[Q]||Q]})};var J8=/^--/;function E1(Q){return J8.test(Q)}var T1={},Z8=q.style,Q8=["webkit","moz","ms"];function W8(Q,z){if(z===void 0)z=E1(Q);if(z)return Q;if(!T1[Q]){var w=P1(Q),j="".concat(w[0].toUpperCase()).concat(w.slice(1)),V="".concat(w," ").concat(Q8.join("".concat(j," "))).concat(j).split(" ");R(V,function(T,y){if(y in Z8)return T1[Q]=y,!1})}return T1[Q]}var X8={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 t1(Q,z,w){if(w===void 0)w=E1(Q);return!w&&!X8[Q]&&b(z)?"".concat(z,"px"):z}function H8(Q,z){if(s(Q)){var w=E1(Q);if(Q=W8(Q,w),arguments.length<2)return this[0]&&u(this[0],Q,w);if(!Q)return this;return z=t1(Q,z,w),this.each(function(V,T){if(!C(T))return;if(w)T.style.setProperty(Q,z);else T.style[Q]=z})}for(var j in Q)this.css(j,Q[j]);return this}U.css=H8;function e1(Q,z){try{return Q(z)}catch(w){return z}}var q8=/^\s+|\s+$/;function J5(Q,z){var w=Q.dataset[z]||Q.dataset[P1(z)];if(q8.test(w))return w;return e1(JSON.parse,w)}function z8(Q,z,w){w=e1(JSON.stringify,w),Q.dataset[P1(z)]=w}function B8(Q,z){if(!Q){if(!this[0])return;var w={};for(var j in this[0].dataset)w[j]=J5(this[0],j);return w}if(s(Q)){if(arguments.length<2)return this[0]&&J5(this[0],Q);if(k(z))return this;return this.each(function(V,T){z8(T,Q,z)})}for(var j in Q)this.data(j,Q[j]);return this}U.data=B8;function Z5(Q,z){var w=Q.documentElement;return Math.max(Q.body["scroll".concat(z)],w["scroll".concat(z)],Q.body["offset".concat(z)],w["offset".concat(z)],w["client".concat(z)])}R([!0,!1],function(Q,z){R(["Width","Height"],function(w,j){var V="".concat(z?"outer":"inner").concat(j);U[V]=function(T){if(!this[0])return;if(L(this[0]))return z?this[0]["inner".concat(j)]:this[0].document.documentElement["client".concat(j)];if(F(this[0]))return Z5(this[0],j);return this[0]["".concat(z?"offset":"client").concat(j)]+(T&&z?c(this[0],"margin".concat(w?"Top":"Left"))+c(this[0],"margin".concat(w?"Bottom":"Right")):0)}})}),R(["Width","Height"],function(Q,z){var w=z.toLowerCase();U[w]=function(j){if(!this[0])return k(j)?void 0:this;if(!arguments.length){if(L(this[0]))return this[0].document.documentElement["client".concat(z)];if(F(this[0]))return Z5(this[0],z);return this[0].getBoundingClientRect()[w]-Q0(this[0],!Q)}var V=parseInt(j,10);return this.each(function(T,y){if(!C(y))return;var l=u(y,"boxSizing");y.style[w]=t1(w,V+(l==="border-box"?Q0(y,!Q):0))})}});var Q5="___cd";U.toggle=function(Q){return this.each(function(z,w){if(!C(w))return;var j=w0(w),V=k(Q)?j:Q;if(V){if(w.style.display=w[Q5]||"",w0(w))w.style.display=e(w.tagName)}else if(!j)w[Q5]=u(w,"display"),w.style.display="none"})},U.hide=function(){return this.toggle(!1)},U.show=function(){return this.toggle(!0)};var W5="___ce",$1=".",S1={focus:"focusin",blur:"focusout"},X5={mouseenter:"mouseover",mouseleave:"mouseout"},w8=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function A1(Q){return X5[Q]||S1[Q]||Q}function b1(Q){var z=Q.split($1);return[z[0],z.slice(1).sort()]}U.trigger=function(Q,z){if(s(Q)){var w=b1(Q),j=w[0],V=w[1],T=A1(j);if(!T)return this;var y=w8.test(T)?"MouseEvents":"HTMLEvents";Q=J.createEvent(y),Q.initEvent(T,!0,!0),Q.namespace=V.join($1),Q.___ot=j}Q.___td=z;var l=Q.___ot in S1;return this.each(function(F0,z0){if(l&&f(z0[Q.___ot]))z0["___i".concat(Q.type)]=!0,z0[Q.___ot](),z0["___i".concat(Q.type)]=!1;z0.dispatchEvent(Q)})};function H5(Q){return Q[W5]=Q[W5]||{}}function G8(Q,z,w,j,V){var T=H5(Q);T[z]=T[z]||[],T[z].push([w,j,V]),Q.addEventListener(z,V)}function q5(Q,z){return!z||!q0.call(z,function(w){return Q.indexOf(w)<0})}function t0(Q,z,w,j,V){var T=H5(Q);if(!z)for(z in T)t0(Q,z,w,j,V);else if(T[z])T[z]=T[z].filter(function(y){var l=y[0],F0=y[1],z0=y[2];if(V&&z0.guid!==V.guid||!q5(l,w)||j&&j!==F0)return!0;Q.removeEventListener(z,z0)})}U.off=function(Q,z,w){var j=this;if(k(Q))this.each(function(T,y){if(!C(y)&&!F(y)&&!L(y))return;t0(y)});else if(!s(Q))for(var V in Q)this.off(V,Q[V]);else{if(f(z))w=z,z="";R(S(Q),function(T,y){var l=b1(y),F0=l[0],z0=l[1],K0=A1(F0);j.each(function(h0,L0){if(!C(L0)&&!F(L0)&&!L(L0))return;t0(L0,K0,z0,z,w)})})}return this},U.remove=function(Q){return A0(this,Q).detach().off(),this},U.replaceWith=function(Q){return this.before(Q).remove()},U.replaceAll=function(Q){return M(Q).replaceWith(this),this};function U8(Q,z,w,j,V){var T=this;if(!s(Q)){for(var y in Q)this.on(y,z,w,Q[y],V);return this}if(!s(z))if(k(z)||_(z))z="";else if(k(w))w=z,z="";else j=w,w=z,z="";if(!f(j))j=w,w=void 0;if(!j)return this;return R(S(Q),function(l,F0){var z0=b1(F0),K0=z0[0],h0=z0[1],L0=A1(K0),e0=K0 in X5,x1=K0 in S1;if(!L0)return;T.each(function(g1,O0){if(!C(O0)&&!F(O0)&&!L(O0))return;var k1=function(B0){if(B0.target["___i".concat(B0.type)])return B0.stopImmediatePropagation();if(B0.namespace&&!q5(h0,B0.namespace.split($1)))return;if(!z&&(x1&&(B0.target!==O0||B0.___ot===L0)||e0&&B0.relatedTarget&&O0.contains(B0.relatedTarget)))return;var h1=O0;if(z){var v0=B0.target;while(!I0(v0,z)){if(v0===O0)return;if(v0=v0.parentNode,!v0)return}h1=v0}Object.defineProperty(B0,"currentTarget",{configurable:!0,get:function(){return h1}}),Object.defineProperty(B0,"delegateTarget",{configurable:!0,get:function(){return O0}}),Object.defineProperty(B0,"data",{configurable:!0,get:function(){return w}});var M8=j.call(h1,B0,B0.___td);if(V)t0(O0,L0,h0,z,k1);if(M8===!1)B0.preventDefault(),B0.stopPropagation()};k1.guid=j.guid=j.guid||M.guid++,G8(O0,L0,h0,z,k1)})}),this}U.on=U8;function Y8(Q,z,w,j){return this.on(Q,z,w,j,!0)}U.one=Y8;var K8=/\r?\n/g;function O8(Q,z){return"&".concat(encodeURIComponent(Q),"=").concat(encodeURIComponent(z.replace(K8,"\r\n")))}var j8=/file|reset|submit|button|image/i,z5=/radio|checkbox/i;if(U.serialize=function(){var Q="";return this.each(function(z,w){R(w.elements||[w],function(j,V){if(V.disabled||!V.name||V.tagName==="FIELDSET"||j8.test(V.type)||z5.test(V.type)&&!V.checked)return;var T=n1(V);if(!k(T)){var y=K(T)?T:[T];R(y,function(l,F0){Q+=O8(V.name,F0)})}})}),Q.slice(1)},typeof M5!=="undefined")D5.exports=M;else Z.cash=Z.$=M})()});var x0="i18n",P0="syn:",V0="fn:",f0="on-",j0=/^\.\.\./,Z1=/^\[(.*?)\]$/,_1=/{\s*([^{}]+)\s*}/g,B5=["@html","@text","@format"],Q1=["if","for","switch","async","router"],w5=["display","visibility","position","width","height"],G5=":n",y1=":pr",U5="m",Y5="c",K5="x",l0="*",g0=":xtag",k0=":dtag",O5=100;var v1=new Map;class W1{templateStore;constructor(J){this.templateStore=J}parse(J,Z){if(v1.has(J))return v1.get(J);let X=(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,(H,q,W)=>{return W.endsWith("<")?`<lips ${k0}="${q}" ${W}/lips>`:`<lips ${k0}="${q}" ${W}></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 ${V0}await="\$1">`).replace(/<log\(\s*(.*?)\s*\)>/g,'<log @args="$1">').replace(/\[(.*?)\]/g,(H)=>H.replace(/\s+/g,""));return X=this.matchEventHandlers(X),X=this.markExpressionAttributes(X,Z),v1.set(J,X),X}isExpression(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}matchEventHandlers(J){const Z=/on-([a-zA-Z-]+)\s*\(/g;let X=J,H;while((H=Z.exec(J))!==null){const q=H[1],W=H.index+H[0].length;let B=1,Y=W;while(Y<J.length&&B>0){if(J[Y]==="(")B++;if(J[Y]===")")B--;Y++}if(B===0){const K=J.slice(W,Y-1).trim(),G=J.slice(0,H.index),D=`${f0}${q}="${K}"`,O=J.slice(Y);X=G+D+O,J=X,Z.lastIndex=G.length+D.length}}return X}markExpressionAttributes(J,Z){const X=[];let q=J.replace(/<([a-zA-Z][a-zA-Z0-9_-]*)((?:[^>'"]*|'[^']*'|"[^"]*")*?)(?:\/?>)/g,(W,B,Y)=>{if(!Q1.includes(B)&&(this.templateStore.has(B)||Z?.has(B)))Y+=` ${g0}="${B}"`;return X.push(Y),`<${B}##TAG_ATTRS_${X.length-1}##>`});for(let W=0;W<X.length;W++){const B=`##TAG_ATTRS_${W}##`,Y=X[W],K=this.processAttributes(Y);q=q.replace(B,K)}return q}processAttributes(J){let Z="",X=0,H=!1,q="",W=0,B=0,Y=0;while(X<J.length){const K=J[X];if((K==='"'||K==="'")&&(X===0||J[X-1]!=="\\")){if(!H)H=!0,q=K;else if(K===q)H=!1}if(!H){if(K==="(")B++;else if(K===")")B--;else if(K==="{")Y++;else if(K==="}")Y--}if(!H&&B===0&&Y===0&&(K===" "||X===J.length-1)){let G=X;if(X===J.length-1)G=X+1;const D=J.substring(W,G).trim();if(D){const O=this.processAttribute(D);Z+=" "+O}W=X+1}X++}return Z}processAttribute(J){const Z=J.indexOf("=");if(Z===-1){if(J===x0||J.startsWith("...")||J.startsWith("["))return J;return`:${J}="${!J.startsWith("!")}"`}let X=J.substring(0,Z).trim(),H=J.substring(Z+1).trim();if(X.startsWith("@"))return X=!B5.includes(X)?X.slice(1):X,`:${X}=${H}`;if(X.startsWith(":")||X.startsWith(V0)||X.startsWith(f0))return J;if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'")){const q=H.substring(1,H.length-1);if(this.isExpression(q))return`:${X}="${q}"`;return J}else return`:${X}="${H}"`}}class X1{pendingComponents=new Set;isPending=!1;callbacks=new Map;register(J,Z){this.callbacks.set(J,Z)}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((Z)=>{try{const X=this.callbacks.get(Z);if(X)X()}catch(X){console.error(`Error updating component ${Z}:`,X)}})}clear(){this.pendingComponents.clear(),this.isPending=!1}dispose(){this.pendingComponents.clear(),this.callbacks.clear(),this.isPending=!1}}class H1{subscriptions=new Map;tick=new X1;register(J,Z){this.subscriptions.set(J,Z),this.tick.register(J,Z)}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,Z)=>{this.subscriptions.set(Z,()=>{})})}proxyState(J,Z){const X=this,H=new WeakMap,q=(B)=>{if(typeof B.toJSON==="function")return B;if(B instanceof Map)B.forEach((K,G)=>B.set(G,W(K)));else if(Array.isArray(B))B.forEach((K,G)=>B[G]=W(K));else if(typeof B==="object")Object.entries(B).forEach(([K,G])=>B[K]=W(G));let Y=new Proxy(B,{get(K,G){if(G==="toJSON")return function(){const O=(g)=>{if(!g||typeof g!=="object")return g;if(H.has(g)){const d=H.get(g);if(d instanceof Map){const a={};return d.forEach((q0,n)=>a[typeof n==="object"?JSON.stringify(n):String(n)]=O(q0)),a}if(Array.isArray(d))return d.map((a)=>O(a));const J0={};return Object.entries(d).forEach(([a,q0])=>J0[a]=O(q0)),J0}if(typeof g.toJSON==="function"&&!H.has(g))return g.toJSON();return g};return O(Y)};if(G==="reset")return function(){Y=null};const D=K[G];if(B instanceof Map&&typeof D==="function")return function(...O){const g=G.toString();if(g==="set"&&O.length>=2)O[1]=W(O[1]);const d=D.apply(K,O);return["set","delete","clear"].includes(g)&&X.queueUpdate(J),d};if(Array.isArray(B)&&typeof D==="function")return function(...O){const g=G.toString();if(["push","unshift"].includes(g))O=O.map((J0)=>W(J0));else if(g==="splice"&&O.length>2)O=[O[0],O[1],...O.slice(2).map((J0)=>W(J0))];const d=D.apply(K,O);return["push","pop","shift","unshift","splice","sort","reverse","fill"].includes(g)&&X.queueUpdate(J),d};return D},set(K,G,D){if(K[G]===D)return!0;if(D instanceof Map&&K[G]instanceof Map){const O=K[G];return O.clear(),D.forEach((g,d)=>O.set(d,W(g))),X.queueUpdate(J),!0}return K[G]=W(D),X.queueUpdate(J),!0}});return H.set(Y,B),Y},W=(B)=>{if(!B)return B;return B instanceof Map||Array.isArray(B)||typeof B==="object"?q(B):B};return q(Z)}}class q1{domObserver;observedComponents=new Map;TIMEOUT=1e4;constructor(){this.domObserver=new MutationObserver(()=>{this.observedComponents.forEach((J,Z)=>{try{const X=Z.node;if(!X){this.unwatch(Z);return}if(J.type==="attach"&&document.contains(X[0]))this.unwatch(Z),Z.emit("component:attached"),typeof Z.onAttach=="function"&&Z.onAttach.bind(Z)();else if(J.type==="detach"&&!document.contains(X[0]))this.unwatch(Z),Z.emit("component:detached"),typeof Z.onDetach=="function"&&Z.onDetach.bind(Z)()}catch(X){console.log("DWS error --",X)}}),!this.observedComponents.size&&this.domObserver.disconnect()})}watch(J,Z="attach"){const X=J.node;if(!X)return;if(Z==="attach"&&document.contains(X[0])){J.emit("component:attached"),typeof J.onAttach=="function"&&J.onAttach.bind(J)();return}if(Z==="detach"&&!document.contains(X[0])){J.emit("component:detached"),typeof J.onDetach=="function"&&J.onDetach.bind(J)();return}this.unwatch(J);const H=setTimeout(()=>{this.unwatch(J),J.emit(`component:${Z}ment-timeout`)},this.TIMEOUT);this.observedComponents.set(J,{timeout:H,type:Z}),this.observedComponents.size===1&&this.domObserver.observe(document.body,{childList:!0,subtree:!0}),Z==="attach"&&J.once("component:attached",()=>this.watch(J,"detach"))}unwatch(J){const Z=this.observedComponents.get(J);if(Z)clearTimeout(Z.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()}}var z1=function(J,Z){if(!Z)return J;return J.replace(/{(\w+)}/g,(X,H)=>{return Z[H]!==void 0?Z[H].toString():`{${H}}`})},j5=(J,Z,X,H,q)=>{switch(J){case"plural":{if(typeof X==="string"){console.warn("Plural format value cannot be a string");return}if(H.count===void 0){console.warn("Plural format requires <count> parameter or use * by default.");let Y=X["*"];if(typeof Y==="object")Y=Y[q||"*"];return z1(Y,H)}if(typeof H.count==="string")H.count=Number(H.count);let W="*";if(H.count.toString()in X)W=H.count.toString();let B=X[W]||X["*"];if(typeof B==="object")B=B[q||"*"];return z1(B,H)}case"condition":{if(typeof X==="string"){console.warn("Condition format value cannot be a string");return}let W;for(let B in X)try{if(new Function("params",`with( params ){ return ${B}; }`)(H||{})){W=X[B];break}}catch(Y){console.warn(`Invalid <${Z}(${B})> condition expression`)}if(W===void 0)return;if(typeof W==="object")W=W[q||"*"];return z1(W,H)}case"variable":default:{const W=typeof X==="object"?X[q||"*"]:X;if(typeof W==="object"){console.warn(`Invalid <${Z}> variable variant definition`);return}return z1(W,H)}}};class B1{currentLang=window.navigator.language;DICTIONARIES={};set lang(J){if(this.currentLang===J)return;this.currentLang=J}get lang(){return this.currentLang}setDictionary(J,Z){this.DICTIONARIES[J]=Z}translate(J,Z){if(Z&&this.currentLang===Z)return{text:J,lang:this.currentLang};Z=Z||this.currentLang;const[X,H]=Z.split("-");if(this.DICTIONARIES[X]&&J in this.DICTIONARIES[X]){if(typeof this.DICTIONARIES[X][J]==="object"){const q=this.DICTIONARIES[X][J];J=q[H||"*"]||q["*"]}else if(typeof this.DICTIONARIES[X][J]==="string")J=this.DICTIONARIES[X][J]}return{text:J,lang:Z}}format(J,Z,X){X=X||this.currentLang;const[H,q]=X.split("-");if(!this.DICTIONARIES[H]){console.warn(`Undefined <${X}> format dictionary`);return}if(!this.DICTIONARIES[H][J]){console.warn(`Undefined <${X}[${J}]> format reference`);return}const W=this.DICTIONARIES[H][J];if(typeof W==="string"){console.warn(`Invalid <${X}[${J}]> format reference. Expected object`);return}if(typeof W!=="object"||W===null||Array.isArray(W)){console.warn(`Invalid <${X}[${J}]> format value`);return}return j5(W.type,J,W.value,Z,q)}}var _5=J1(o0(),1);var w1="comm",G1="rule",U1="decl";var I5="@import";var F5="@namespace",L5="@keyframes";var V5="@layer";function Y1(J){return J.trim()}function u0(J,Z,X){return J.replace(Z,X)}function N5(J,Z,X){return J.indexOf(Z,X)}function E0(J,Z){return J.charCodeAt(Z)|0}function T0(J,Z,X){return J.slice(Z,X)}function U0(J){return J.length}function K1(J){return J.length}function m0(J,Z){return Z.push(J),J}var u1=Math.abs,r0=String.fromCharCode;function j1(J,Z,X,H,q,W,B,Y){return{value:J,root:Z,parent:X,type:H,props:q,children:W,line:O1,column:d0,length:B,return:"",siblings:Y}}function R5(){return H0}function P5(){if(H0=M0>0?E0(c0,--M0):0,d0--,H0===10)d0=1,O1--;return H0}function D0(){if(H0=M0<C5?E0(c0,M0++):0,d0++,H0===10)d0=1,O1++;return H0}function $0(){return E0(c0,M0)}function n0(){return M0}function M1(J,Z){return T0(c0,J,Z)}function i0(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 E5(J){return O1=d0=1,C5=U0(c0=J),M0=0,[]}function T5(J){return c0="",J}function D1(J){return Y1(M1(M0-1,m1(J===91?J+2:J===40?J+1:J)))}function $5(J){while(H0=$0())if(H0<33)D0();else break;return i0(J)>2||i0(H0)>3?"":" "}function S5(J,Z){while(--Z&&D0())if(H0<48||H0>102||H0>57&&H0<65||H0>70&&H0<97)break;return M1(J,n0()+(Z<6&&$0()==32&&D0()==32))}function m1(J){while(D0())switch(H0){case J:return M0;case 34:case 39:if(J!==34&&J!==39)m1(H0);break;case 40:if(J===41)m1(J);break;case 92:D0();break}return M0}function A5(J,Z){while(D0())if(J+H0===57)break;else if(J+H0===84&&$0()===47)break;return"/*"+M1(Z,M0-1)+"*"+r0(J===47?J:D0())}function b5(J){while(!i0($0()))D0();return M1(J,M0)}var O1=1,d0=1,C5=0,M0=0,H0=0,c0="";function k5(J){return T5(I1("",null,null,null,[""],J=E5(J),0,[0],J))}function I1(J,Z,X,H,q,W,B,Y,K){var G=0,D=0,O=B,g=0,d=0,J0=0,a=1,q0=1,n=1,v=0,i="",o=q,r=W,Z0=H,p=i;while(q0)switch(J0=v,v=D0()){case 40:if(J0!=108&&E0(p,O-1)==58){if(N5(p+=u0(D1(v),"&","&\f"),"&\f",u1(G?Y[G-1]:0))!=-1)n=-1;break}case 34:case 39:case 91:p+=D1(v);break;case 9:case 10:case 13:case 32:p+=$5(J0);break;case 92:p+=S5(n0()-1,7);continue;case 47:switch($0()){case 42:case 47:if(m0(C8(A5(D0(),n0()),Z,X,K),K),(i0(J0||1)==5||i0($0()||1)==5)&&U0(p)&&T0(p,-1,void 0)!==" ")p+=" ";break;default:p+="/"}break;case 123*a:Y[G++]=U0(p)*n;case 125*a:case 59:case 0:switch(v){case 0:case 125:q0=0;case 59+D:if(n==-1)p=u0(p,/\f/g,"");if(d>0&&(U0(p)-O||a===0&&J0===47))m0(d>32?g5(p+";",H,X,O-1,K):g5(u0(p," ","")+";",H,X,O-2,K),K);break;case 59:p+=";";default:if(m0(Z0=x5(p,Z,X,G,D,q,Y,i,o=[],r=[],O,W),W),v===123)if(D===0)I1(p,Z,Z0,Z0,o,W,O,Y,r);else{switch(g){case 99:if(E0(p,3)===110)break;case 108:if(E0(p,2)===97)break;default:D=0;case 100:case 109:case 115:}if(D)I1(J,Z0,Z0,H&&m0(x5(J,Z0,Z0,0,0,q,Y,i,q,o=[],O,r),r),q,r,O,Y,H?o:r);else I1(p,Z0,Z0,Z0,[""],r,0,Y,r)}}G=D=d=0,a=n=1,i=p="",O=B;break;case 58:O=1+U0(p),d=J0;default:if(a<1){if(v==123)--a;else if(v==125&&a++==0&&P5()==125)continue}switch(p+=r0(v),v*a){case 38:n=D>0?1:(p+="\f",-1);break;case 44:Y[G++]=(U0(p)-1)*n,n=1;break;case 64:if($0()===45)p+=D1(D0());g=$0(),D=O=U0(i=p+=b5(n0())),v++;break;case 45:if(J0===45&&U0(p)==2)a=0}}return W}function x5(J,Z,X,H,q,W,B,Y,K,G,D,O){var g=q-1,d=q===0?W:[""],J0=K1(d);for(var a=0,q0=0,n=0;a<H;++a)for(var v=0,i=T0(J,g+1,g=u1(q0=B[a])),o=J;v<J0;++v)if(o=Y1(q0>0?d[v]+" "+i:u0(i,/&\f/g,d[v])))K[n++]=o;return j1(J,Z,X,q===0?G1:Y,K,G,D,O)}function C8(J,Z,X,H){return j1(J,Z,X,w1,r0(R5()),T0(J,2,-2),0,H)}function g5(J,Z,X,H,q){return j1(J,Z,X,U1,T0(J,0,H),T0(J,H+1,-1),H,q)}function F1(J,Z){var X="";for(var H=0;H<J.length;H++)X+=Z(J[H],H,J,Z)||"";return X}function h5(J,Z,X,H){switch(J.type){case V5:if(J.children.length)break;case I5:case F5:case U1:return J.return=J.return||J.value;case w1:return"";case L5:return J.return=J.value+"{"+F1(J.children,H)+"}";case G1:if(!U0(J.value=J.props.join(",")))return""}return U0(X=F1(J.children,H))?J.return=J.value+"{"+X+"}":""}function f5(J){var Z=K1(J);return function(X,H,q,W){var B="";for(var Y=0;Y<Z;Y++)B+=J[Y](X,H,q,W)||"";return B}}class p0{nsp;settings;$head;constructor(J,Z){if(typeof J!=="string")throw new Error("Undefined or invalid styles attachement element(s) namespace");this.nsp=J,this.$head=_5.default("head"),this.settings=Z||{},this.settings&&this.load(this.settings)}compile(J){try{return F1(k5(J),f5([h5]))}catch(Z){throw new Error(`Style compilation failed: ${Z.message}`)}}waitForStyles(J){return new Promise((Z)=>{const X=new MutationObserver(()=>{const H=document.querySelector(J);if(H&&getComputedStyle(H).cssText)X.disconnect(),Z()});X.observe(document.documentElement,{attributes:!0,childList:!0,subtree:!0})})}async inject(J){if(!J)throw new Error("Invalid injection arguments");const Z=`rel="${this.settings.meta?"@":""}${this.nsp}"`;J=this.settings.meta?J:`[rel="${this.nsp}"] { ${J} }`;try{const X=this.compile(J);if(!X)throw new Error(`<component:${this.nsp}> sheet compilation failed`);const H=document.createElement("style");H.setAttribute("rel",`${this.settings.meta?"@":""}${this.nsp}`),H.textContent=X;let q=0;const W=this.$head.find(`style[${Z}]`);if(W.length)q=parseInt(W.attr("dindex"))+1,W.remove();return H.setAttribute("dindex",String(q)),this.settings.meta?document.head.prepend(H):document.head.appendChild(H),H}catch(X){throw new Error(`Style injection failed: ${X.message}`)}}async load(J){if(this.settings=J,typeof this.settings!=="object")throw new Error("Undefined styles settings");if(this.settings.sheet){const Z=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 Z=parseInt(J.attr("dindex"));Z===0?J.remove():J.attr("dindex",String(Z-1))}async custom(){return{}}async style(){return{}}}class L1{pending=new Map;isPending=!1;component;metrics={batchCount:0,updatesProcessed:0,lastBatchSize:0,avgBatchSize:"0.00"};constructor(J){this.component=J}queue(J){const Z=J.priority??2;if(!this.pending.has(Z))this.pending.set(Z,new Set);if(this.pending.get(Z)?.add(J),this.component.metrics.inc("dependencyUpdateCount"),!this.isPending)this.isPending=!0,this.scheduleProcessing()}apply({dep:J,deppath:Z},X="batch-updator"){try{const H=this.component.FGUD.get(J)?.get(Z);if(!H){console.warn(`[batch update]: <${Z}> dependency not found`);return}if(H.garbage){this.component.FGUD.get(J)?.delete(Z),!this.component.FGUD.get(J)?.size&&this.component.FGUD.delete(J);return}const q=this.component.FGUDMemory.get(H.nodepath);if(!q)return;const W=H.update(q.memo||{},X);if(W){if(typeof W.memo==="object")q.memo=W.memo;typeof W.cleanup==="function"&&W.cleanup()}}catch(H){console.error("Failed to update dependency --",H)}}scheduleProcessing(){Promise.resolve().then(()=>this.processQueue())}processQueue(){const J=new Map;this.pending.forEach((H,q)=>J.set(q,new Set(H))),this.pending.clear(),this.isPending=!1;const Z=(H)=>{const q=Array.from(H);this.component.metrics.trackBatch(q.length),this.metrics.batchCount++,this.metrics.lastBatchSize=q.length,this.metrics.updatesProcessed+=q.length,this.metrics.avgBatchSize=(this.metrics.updatesProcessed/this.metrics.batchCount).toFixed(2),q.forEach((W)=>this.apply(W))},X=Array.from(J.keys()).sort((H,q)=>H-q);for(let H of X){const q=J.get(H);q&&q.size&&Z(q)}if(this.pending.size>0&&!this.isPending)this.isPending=!0,this.scheduleProcessing()}getMetrics(){return{batchCount:this.metrics.batchCount,lastBatchSize:this.metrics.lastBatchSize,avgBatchSize:this.metrics.avgBatchSize,totalUpdates:this.metrics.updatesProcessed}}}class V1{options={emit:!0};__events={};__once_events={};constructor(J){if(J)this.options=J}on(J,Z){if(!Array.isArray(this.__events[J]))this.__events[J]=[];return this.__events[J].push(Z),this}once(J,Z){if(!Array.isArray(this.__once_events[J]))this.__once_events[J]=[];return this.__once_events[J].push(Z),this}off(J){return delete this.__events[J],delete this.__once_events[J],this}emit(J,...Z){if(!this.options.emit)return;const X=(q)=>{if(typeof q.toJSON==="function")return q.toJSON();if(Array.isArray(q))return q.map(X);if(typeof q==="object")for(let W in q)q[W]=X(q[W]);return q},H=Z.map(X);this.__events[J]?.forEach((q)=>q(...H)),this.__once_events[J]?.forEach((q)=>q(...H)),delete this.__once_events[J]}}var d1=J1(o0(),1);function G0(J,Z){if(J===Z)return!1;if(typeof J!=="object"||typeof Z!=="object")return!1;if(J===null||Z===null)return!0;if(J instanceof Set){if(!(Z instanceof Set))return!0;if(J.size!==Z.size)return!0;if(y5(J)&&y5(Z)){for(let B of J)if(!Z.has(B))return!0;return!1}const W=new WeakMap;for(let B of J){let Y=!1;if(typeof B!=="object"){if(Z.has(B))Y=!0}else for(let K of Z){if(typeof K!=="object")continue;if(!W.has(B))W.set(B,new WeakMap);const G=W.get(B);if(G.has(K)){if(Y=G.get(K),Y)break;continue}const D=!G0(B,K);if(G.set(K,D),D){Y=!0;break}}if(!Y)return!0}return!1}if(J instanceof Map){if(!(Z instanceof Map))return!0;if(J.size!==Z.size)return!0;if(v5(J)&&v5(Z)){for(let[B,Y]of J)if(Z.get(B)!==Y)return!0;return!1}const W=new WeakMap;for(let[B,Y]of J){if(typeof B!=="object"){if(!Z.has(B))return!0;const D=Z.get(B);if(typeof Y!=="object"){if(Y!==D)return!0;continue}if(typeof D!=="object"||G0(Y,D))return!0;continue}let K=!1,G=!1;for(let[D,O]of Z){if(typeof D!=="object")continue;if(!W.has(B))W.set(B,new WeakMap);const g=W.get(B);if(g.has(D)){const[d,J0]=g.get(D);if(d){K=!0,G=J0;break}continue}if(!G0(B,D)){if(K=!0,G=typeof Y==="object"&&typeof O==="object"?!G0(Y,O):Y===O,g.set(D,[!0,G]),G)break}else g.set(D,[!1,!1])}if(!K||!G)return!0}return!1}if(Array.isArray(J)){if(!Array.isArray(Z))return!0;if(J.length!==Z.length)return!0;for(let W=0;W<J.length;W++){const B=J[W],Y=Z[W];if(B!==Y&&(typeof B!=="object"||G0(B,Y)))return!0}return!1}const X=Object.keys(J),H=Object.keys(Z);if(X.length!==H.length)return!0;X.sort(),H.sort();const q=X.length;for(let W=0;W<q;W++)if(X[W]!==H[W])return!0;for(let W=0;W<q;W++){const B=X[W],Y=J[B],K=Z[B];if(Y===K)continue;if(Y instanceof Date){if(!(K instanceof Date)||String(Y)!==String(K))return!0;continue}if(Y instanceof RegExp){if(!(K instanceof RegExp)||Y.source!==K.source||Y.flags!==K.flags)return!0;continue}if(Y instanceof Map){if(!(K instanceof Map)||G0(Y,K))return!0;continue}if(Y instanceof Set){if(!(K instanceof Set)||G0(Y,K))return!0;continue}if(Y instanceof Function){if(!(K instanceof Function))return!0;continue}if(typeof Y==="object"){if(typeof K!=="object")return!0;if(Y===J){if(K!==Z)return!0}else if(G0(Y,K))return!0}else return!0}return!1}function Y0(J,Z){if(J===Z)return!0;if(J==null||Z==null)return J===Z;const X=typeof J;if(X!==typeof Z)return!1;if(X!=="object"){if(X==="number"&&isNaN(J)&&isNaN(Z))return!0;return!1}if(J instanceof Date)return Z instanceof Date&&J.getTime()===Z.getTime();if(J instanceof RegExp)return Z instanceof RegExp&&J.source===Z.source&&J.flags===Z.flags;if(J instanceof Error)return Z instanceof Error&&J.name===Z.name&&J.message===Z.message&&(J.stack===Z.stack||!J.stack&&!Z.stack);if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView(J)){if(!ArrayBuffer.isView(Z))return!1;if(J.byteLength!==Z.byteLength)return!1;const Y=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),K=new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength);for(let G=0;G<Y.length;G++)if(Y[G]!==K[G])return!1;return!0}if(J instanceof Promise||J instanceof WeakMap||J instanceof WeakSet)return J===Z;if(typeof J==="function"){if(typeof Z!=="function")return!1;return J.toString()===Z.toString()&&J.name===Z.name}if(J.constructor!==Z.constructor)return!1;if(J instanceof Map||J instanceof Set||Array.isArray(J)||Object.getPrototypeOf(J)===Object.prototype)return!G0(J,Z);const q=Object.getPrototypeOf(J);if(q!==Object.getPrototypeOf(Z))return!1;const W=Object.getOwnPropertyNames(J),B=Object.getOwnPropertyNames(Z);if(W.length!==B.length)return!1;for(let Y of W){if(!Object.prototype.hasOwnProperty.call(Z,Y))return!1;if(!Y0(J[Y],Z[Y]))return!1}if(q!==null&&q!==Object.prototype){const Y=Object.getOwnPropertyNames(q),K=Object.getOwnPropertyNames(Object.getPrototypeOf(Z));if(Y.length!==K.length)return!1;for(let G of Y){if(G==="constructor")continue;if(!Y0(q[G],Object.getPrototypeOf(Z)[G]))return!1}}return!0}function y5(J){for(let Z of J)if(typeof Z==="object"&&Z!==null)return!1;return!0}function v5(J){for(let[Z,X]of J)if(typeof Z==="object"&&Z!==null||typeof X==="object"&&X!==null)return!1;return!0}function X0(J,Z=new WeakMap){if(J===null||typeof J!=="object"||J instanceof Promise)return J;if(Z.has(J))return Z.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 q=new Map;return Z.set(J,q),J.forEach((W,B)=>q.set(X0(B,Z),X0(W,Z))),q}if(J instanceof Set){const q=new Set;return Z.set(J,q),J.forEach((W)=>q.add(X0(W,Z))),q}if(Array.isArray(J)){const q=[];Z.set(J,q);for(let W=0;W<J.length;W++)q[W]=X0(J[W],Z);return q}if(ArrayBuffer.isView(J))return new J.constructor(J);const X=Object.create(Object.getPrototypeOf(J));Z.set(J,X);const H=Object.getOwnPropertySymbols(J);for(let q of H)X[q]=X0(J[q],Z);for(let q in J)if(Object.prototype.hasOwnProperty.call(J,q))X[q]=X0(J[q],Z);return X}function u5(J,Z){if(!J||typeof J!=="object")throw new TypeError("Original argument must be an object");if(!Z||typeof Z!=="object")throw new TypeError("ToSet argument must be an object");if(!Object.keys(Z).length)return{...J};function X(q,W,B){const Y=W.split(/\.|\[|\]/).filter(Boolean);let K=q;for(let G=0;G<Y.length;G++){const D=Y[G],O=!isNaN(Number(D)),g=G===Y.length-1,d=!isNaN(Number(Y[G+1]));if(g){K[D]=B;continue}if(!(D in K))K[D]=d?[]:{};else if(d&&!Array.isArray(K[D]))K[D]=[];else if(!d&&Array.isArray(K[D]))K[D]={};K=K[D]}}const H=X0(J);try{for(let[q,W]of Object.entries(Z)){if(typeof q!=="string")throw new TypeError(`Invalid path: ${q}`);if(!/^[a-zA-Z0-9_\-\[\].]+$/.test(q))throw new Error(`Invalid path format: ${q}`);X(H,q,W)}}catch(q){throw new Error(`Failed to assign value: ${q.message}`)}return H}function N1(J){return JSON.parse(JSON.stringify(J))}d1.default.fn.extend({attrs:function(){const J={},Z=this[0];return Z&&Z.nodeType!==Node.TEXT_NODE&&d1.default.each(Z.attributes,function(){J[this.name]=this.value}),J}});class C1{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((Z,X)=>Z+X,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,Z){if(!this.debug)return;if(typeof this.stats[J]!=="undefined")this.stats[J]=Z}add(J,Z){if(!this.debug)return;if(typeof this.stats[J]==="number")this.stats[J]+=Z}reset(){return this.renderTimes=[],this.measurementCount=0,this.stats=X0(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)},Z={"Component Count":this.stats.componentCount,"Component Updates":this.stats.componentUpdateCount},X={"Partial Count":this.stats.partialCount,"Partial Updates":this.stats.partialUpdateCount},H={"DOM Operations":this.stats.domOperations,"DOM Inserts":this.stats.domInsertsCount,"DOM Updates":this.stats.domUpdatesCount,"DOM Removals":this.stats.domRemovalsCount},q={"i18n Tracked":this.stats.i18nTrackCount,"i18n Updates":this.stats.i18nUpdateCount},W={"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(Z),console.table(X),console.table(H),console.table(q),console.table(W),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 X0(this.stats)}dispose(){if(!this.debug)return;this.autoSaveInterval&&clearInterval(this.autoSaveInterval)}}var W0=J1(o0(),1);var R8=function(J,Z){if(J.isDisposed)return;Z.add(J),J.dependencies.add(Z)},d5=function(J){for(let Z of J.dependencies)Z.delete(J);J.dependencies.clear()};function _0(J,Z={maxSize:100}){const X=new Set,H=[{value:J,timestamp:Date.now()}];let q=0;const W=()=>{const G=R1[R1.length-1];return G&&R8(G,X),H[q].value},B=()=>{const G=[...X];if(m5)for(let D of G)m5.add(D);else for(let D of G)D.execute()};return[W,(G,D)=>{if(Object.is(H[q].value,G))return;if(q<H.length-1)H.splice(q+1);if(H.push({value:G,timestamp:Date.now(),metadata:D}),H.length>Z.maxSize)H.shift(),q=Math.max(0,q-1);else q++;B()},{undo(){if(q>0)q--,B()},redo(){if(q<H.length-1)q++,B()},jumpTo(G){if(G>=0&&G<H.length&&G!==q)q=G,B()},getHistory(){return[...H]},getCurrentIndex(){return q},canUndo(){return q>0},canRedo(){return q<H.length-1},clear(){const G=H[0];H.length=0,H.push(G),q=0,B()}}]}function a0(J){let Z=!1;const X=()=>{if(Z)throw new Error("Circular dependency detected");if(H.isDisposed)return;Z=!0,d5(H),R1.push(H);try{J()}finally{Z=!1,R1.pop()}},H={execute:X,dependencies:new Set,isDisposed:!1};return X(),{dispose:()=>{H.isDisposed=!0,d5(H)}}}var R1=[],m5=null;class y0 extends V1{declaration;$=null;input;state;static;context;__name__;__path__;__lang__;__template__;__previous;__macros=new Map;__i18nDeps=new Map;FGUD=new Map;FGUDMemory=new Map;PCC=new Map;VER=[];prepath="0";debug=!1;isRendered=!1;__setInput;__setState;__getState;UQS;ICE;lips;metrics;stylesheet;__inpath__="";__inpathCounter__=0;__renderDepth__=0;__boundaries__;constructor(J,Z,{input:X,state:H,context:q,_static:W,handler:B,stylesheet:Y,macros:K,declaration:G},D){super();if(this.lips=D.lips,D?.debug)this.debug=D.debug||this.lips.debug;if(D?.prepath)this.prepath=D.prepath;if(this.__name__=J,this.__lang__=this.lips.i18n.lang,this.__path__=this.__inpath__=`${this.prepath}:${this.__name__}`,this.__boundaries__=D.boundaries,this.declaration=G||{name:J},this.input=X||{},this.static=W||{},this.context={},this.state=this.lips.IUC.proxyState(this.__path__,H||{}),K&&this.setMacros(K),B&&this.setHandler(B),Y&&this.setStylesheet(Y),this.__template__=this.lips.preprocessor.parse(Z,this.__macros),this.metrics=new C1(this.debug),this.metrics.inc("componentCount"),this.UQS=new L1(this),typeof this.onCreate=="function"&&this.onCreate.bind(this)(),this.emit("component:create"),this.input&&Object.keys(this.input).length&&typeof this.onInput=="function")this.onInput.bind(this)(),this.emit("component:input");this.__previous={state:X0(this.state),input:X0(this.input),context:X0(this.context)};const[O,g]=_0(this.input),[d,J0]=_0(this.state),[a,q0]=_0(this.context);this.__setInput=g,this.__setState=J0,this.__getState=d,this.lips.IUC.register(this.__path__,()=>{G0(this.__previous?.state,this.state)&&this.__setState({...this.__getState(),...this.state})}),Array.isArray(q)&&q.length&&this.lips.useContext(q,(n)=>{if(!G0(this.context,n))return;q0(n),this.context=n,typeof this.onContext=="function"&&this.onContext.bind(this)(),this.emit("component:context")}),this.lips.useTranslator("*",(n)=>{if(n===this.__lang__)return;this.__updateI18nDepNodes__(),this.__lang__=n}),this.ICE=a0(()=>{const n=d(),v=this.input=O(),i=this.context=a();if(!this.isRendered){if(this.metrics.reset(),!this.__template__.length||G?.syntax&&typeof this.onSelfRender=="function"){const o=this.onSelfRender.bind(this)(this.input);if(!this.__boundaries__?.start||!this.__boundaries__?.end)throw new Error(`Undefined <${this.__name__} syntax component boundaries`);this.$=o||W0.default()}else{const{$log:o}=this.render("",void 0,void 0,this.FGUD);this.$=o}!G?.syntax&&this.$?.each((o,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.lips.watcher.watch(this)}else this.__updateDepNodes__(),typeof this.onUpdate=="function"&&this.onUpdate.bind(this)(),this.emit("component:update"),this.__previous={input:X0(v),state:X0(n),context:X0(i)};typeof this.onRender=="function"&&this.onRender.bind(this)(),this.emit("component:render")})}setContext(J,Z){this.lips.setContext(J,Z)}setInput(J,Z){if(!G0(this.input,J))return;this.__setInput(J),typeof this.onInput=="function"&&this.onInput.bind(this)(this.declaration.syntax?Z:void 0)}subInput(J,Z){if(typeof J!=="object")throw new Error("Invalid sub input data argument");return this.setInput(u5(this.input,J),this.declaration.syntax?Z:void 0),this}setMacros(J){const Z=this.lips.preprocessor.parse(J),X=W0.default(Z);if(!X.length)return;const H=this;X.each(function(){const q=W0.default(this),{argv:W,attrs:B}=H.__getAttributes__(q);if(!Object.keys(B))throw new Error("Invalid macro component definition");if(!B.literals.name)throw new Error("Undefined macro `name` attribute.");if(H.__macros.get(B.literals.name))console.warn(`Duplicate macro <${B.literals.name}> will be override`);if(!q.contents()?.length)throw new Error("Invalid macro component definition. Template content expected.");H.__macros.set(B.literals.name,{argv:W,$node:q})})}setHandler(J){Object.entries(J).map(([Z,X])=>this[Z]=X?.bind(this))}setStylesheet(J){const Z={sheet:J,meta:this.__name__==="__ROOT__"};this.stylesheet=new p0(this.__name__,Z)}get node(){if(!this.isRendered)throw new Error("node() is expected to be call after component get rendered");return this.$}get boundaries(){return this.__boundaries__}render(J,Z,X={},H,q){if(Z&&!Z.length)return console.warn("Undefined node element to render"),{$log:Z,dependencies:H||new Map};const W=this,B=H||new Map,Y=[];this.metrics.startRender();let K=W0.default();function G(){return X0(X)}function D(U,M=!1){const $=O(U,M);return W.__inpathCounter__++,W.__inpath__?`${W.__inpath__}/${$}`:`${J?J+"/":""}${$}`}function O(U,M=!1){let $="";switch(U){case"component":$=M?K5:Y5;break;case"macro":$=U5;break}return $+W.__inpathCounter__}function g(U){return U===null||typeof U==="object"&&typeof U.mesh==="function"&&typeof U.fill==="function"&&typeof U.update==="function"&&typeof U.cleanup==="function"}function d(U){return U!==null&&typeof U==="object"&&typeof U.default&&typeof U.default==="string"}function J0(U){const M=U.attr(":args"),$=D("log");if(!M)return;const L=G();if(W.__evaluate__(`console.log(${M})`,L),W.__isReactive__(M,L))W.__extractExpressionDeps__(M,L).forEach((x)=>W.__trackDep__(B,x,L,{nodetype:"log",nodepath:$,target:"argument",$fragment:null,update:(C)=>W.__evaluate__(`console.log(${M})`,C),syntax:!0}))}function a(U){const M=D("var"),{attrs:$}=W.__getAttributes__(U);if(!$)return;Object.entries($.literals).forEach(([L,F])=>{if(X[L]&&X[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);X[L]={value:F,type:"let"}}),Object.entries($.expressions).forEach(([L,F])=>{if(X[L]&&X[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);if(X[L]={value:W.__evaluate__(F,X),type:"let"},W.__isReactive__(F,X)){const x=W.__extractExpressionDeps__(F,X),C=(P,m)=>{if(P[L]&&P[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);if($.map.beforeSpreadAttrs.includes(L))return;const f=W.__evaluate__(F,P);if(Y0(P[L].value,f))return;return P[L]={value:f,type:"let"},W.__updateVarDepNodes__(L,M,P),N1({memo:P})};x.forEach((P)=>W.__trackDep__(B,P,G(),{nodetype:"let",nodepath:M,deppath:`${M}.${L}`,target:"attr",$fragment:null,update:C,syntax:!0}))}}),W.metrics.inc("elementCount")}function q0(U){const{attrs:M}=W.__getAttributes__(U);if(!M)return;Object.entries(M.literals).forEach(([$,L])=>{if(X[$]&&X[$].type==="const")throw new Error(`<const ${$}=[value]/> variable already defined`);if(!L)return;X[$]={value:L,type:"const"}}),Object.entries(M.expressions).forEach(([$,L])=>{if(X[$]&&X[$].type==="const")throw new Error(`<const ${$}=[value]/> variable already defined`);if(!L)return;X[$]={value:W.__evaluate__(L,X),type:"const"}}),W.metrics.inc("elementCount")}function n(U,M,$){const{attrs:L}=W.__getAttributes__(U),F=D("element"),x=W.__getBoundaries__(F),C={};let P=G(),m=W0.default(x.start),f;const s=(k)=>{const _={},b={};return L.literals&&Object.entries(L.literals).forEach(([N,R])=>{b[N]=R,_[N]={type:"arg",value:R}}),L.expressions&&Object.entries(L.expressions).forEach(([N,R])=>{if(!f)return;if(j0.test(N))W.__evaluateSpreadAttr__(N,{memo:k,get keystore(){return C[N]},set keystore(I){if(!C[N])C[N]=[];C[N]=I},each:(I,A)=>{if(b[I]=A,!f?.argv.includes(I))return;_[I]={type:"arg",value:A}}});else{const I=R?W.__evaluate__(R,k):!0;if(b[N]=I,!f.argv.includes(N))return;_[N]={type:"arg",value:I}}}),L.expressions&&Object.entries(L.expressions).forEach(([N,R])=>{if(!f)return;if(j0.test(N)&&W.__isReactive__(N,k)){const I=W.__extractExpressionDeps__(N,k),A=(S,E)=>{if(!f)return;const h={};let u=[];if(W.__evaluateSpreadAttr__(N,{memo:S,get keystore(){return C[N]},set keystore(c){if(!C[N])C[N]=[];C[N]=c},each:(c,Q0)=>{if(L.map.afterSpreadAttrs.includes(c))return;if(!f?.argv.includes(c))return;if(Y0(Q0,S[c]?.value))return;_[c]=h[c]={value:Q0,type:"arg"},b[c]=Q0,u.push(c)},nullify:(c)=>{c.forEach((Q0)=>{h[Q0]={value:void 0,type:"arg"},delete b[Q0]}),u=c}}),u.length)f.argv.length&&W.__updateArgumentsDepNodes__(F,b),f.update(u,h,S,x)};I.forEach((S)=>W.__trackDep__(B,S,k,{nodetype:"dynamic",nodepath:F,deppath:`${F}.${N}`,target:"spread-attr",$fragment:null,boundaries:x,update:A}))}else if(f.argv.includes(N)&&W.__isReactive__(R,k)){const I=W.__extractExpressionDeps__(R,k),A=(S,E)=>{if(!f)return;if(L.map.beforeSpreadAttrs.includes(N))return;const h=R?W.__evaluate__(R,S):!0,u={type:"arg",value:h};if(_[N]=u,f.argv.length)b[N]=h,W.__updateArgumentsDepNodes__(F,b);f.update([N],{[N]:u},S,x)};I.forEach((S)=>W.__trackDep__(B,S,k,{nodetype:"dynamic",nodepath:F,deppath:`${F}.${N}`,target:"attr",$fragment:null,boundaries:x,update:A}))}}),{argvalues:_,__arguments__:b}};if(g($)){f=$;const{argvalues:k,__arguments__:_}=s(P);P.__arguments__=_;const b=f.mesh(k);if(b&&b.length)m=m.add(b)}else if(typeof $==="string")if(W.__macros.has($))m=m.add(i(U,$));else if(W.lips.has($))m=m.add(v(U,{name:$}));else m=m.add(o(U,$));if(W.__isReactive__(M,P)){const k=(b,N)=>{const R=W.__evaluate__(M,b);let I;if(f)f.cleanup(x),f=null;else W.__emptyBoundaries__(x,F);if(g(R)){f=R;const{argvalues:A,__arguments__:S}=s(b);f.argv.length&&W.__updateArgumentsDepNodes__(F,S),I=f.mesh(A,b),I?.length&&f.fill(I,x)}else if(d(R))I=v(U,{template:R},b),W.__fillBoundaries__(I,x);else if(typeof R==="string"&&W.__macros.has(R))I=i(U,R,b),W.__fillBoundaries__(I,x);else if(typeof R==="string"&&W.lips.has(R))I=v(U,{name:R},b),W.__fillBoundaries__(I,x);else if(typeof R==="string")I=o(U,R,b),W.__fillBoundaries__(I,x)};W.__extractExpressionDeps__(M,P).forEach((b)=>W.__trackDep__(B,b,P,{nodetype:"dynamic",nodepath:F,deppath:`${F}.dtag`,target:"dtag",$fragment:null,boundaries:x,update:k}))}return m=m.add(x.end),m}function v(U,M,$){let L,F;if(M?.template)L=M.template,F=O("component",L.declaration?.syntax);else{if(F=M?.name||U.attr(g0)||U.prop("tagName")?.toLowerCase(),!F)throw new Error("Invalid component");if(F===W.__name__)throw new Error("Render component within itself is forbidden");L=W.lips.import(F)}if(!L||!F)throw new Error(`<${F}> template not found`);const x=D("component",L.declaration?.syntax),C=`${x}#${F}`,P=W.__getBoundaries__(x),{argv:m,functions:f,attrs:s,events:k}=W.__getAttributes__(U),_={},b={};let N={},R=W0.default(P.start),I=W.PCC.get(C),A=$||G();s.literals&&Object.entries(s.literals).forEach(([E,h])=>{if(E=="key")return;N[E]=h}),f&&Object.entries(f).forEach(([E,h])=>{N[E]=W.__evaluateFunction__(h,[],A),L.declaration?.syntax?_[P0+V0+E]=h:_[V0+E]=h}),s.expressions&&Object.entries(s.expressions).forEach(([E,h])=>{if(E=="key")return;if(j0.test(E))W.__evaluateSpreadAttr__(E,{memo:A,get keystore(){return b[E]},set keystore(u){if(!b[E])b[E]=[];b[E]=u},each:(u,c)=>N[u]=c});else N[E]=h?W.__evaluate__(h,A):!0;L.declaration?.syntax?_[P0+E]=h:_[E]=h});const S=U.contents();if(S.length){if(N={...N,...W.__meshwire__({$node:U,fragmentPath:x,fragmentBoundaries:P,meshPath:null,scope:A,argv:m,xmlns:q,useAttributes:!0,declaration:L.declaration},_)},L.declaration){if(L.declaration.tags){let E;Object.entries(L.declaration?.tags).forEach(([h,{type:u,many:c,alts:Q0}])=>{switch(u){case"nexted":{let t=U.next(h);if(!t.length&&Array.isArray(Q0)&&E?.length&&E.is(Q0.join(",")))t=E.next(h);if(!t.length)return;if(c){N[h]=[];let e=0,w0=!1;while(!w0){if(N[h].push(W.__meshwire__({$node:t,meshPath:`${h}[${e}]`,fragmentPath:x,fragmentBoundaries:P,scope:A,argv:m,xmlns:q,useAttributes:!0,declaration:L.declaration},_)),!t.next(h).length){w0=!0;break}t=E=t.next(h),e++}}else N[h]=W.__meshwire__({$node:t,meshPath:h,fragmentPath:x,fragmentBoundaries:P,scope:A,argv:m,xmlns:q,useAttributes:!0,declaration:L.declaration},_)}break;case"child":{const t=U.children(h);if(c)N[h]=[],t.each(function(e){const w0=W0.default(this),{argv:I0}=W.__getAttributes__(w0);N[h].push(W.__meshwire__({$node:w0,meshPath:`${h}[${e}]`,fragmentPath:x,fragmentBoundaries:P,scope:A,argv:I0,xmlns:q,useAttributes:!0,declaration:L.declaration},_))});else if(U.children(h).first().length){const e=U.children(h).first(),{argv:w0}=W.__getAttributes__(e);N[h]=W.__meshwire__({$node:e,meshPath:h,fragmentPath:x,fragmentBoundaries:P,scope:A,argv:w0,xmlns:q,useAttributes:!0,declaration:L.declaration},_)}}break}})}else if(L.declaration.contents)N.__contents__=S}}if(I)I.setInput(X0(N)),R=R.add(I.node);else{const{declaration:E,state:h,_static:u,handler:c,context:Q0,default:t,stylesheet:e}=L;I=new y0(F,t||"",{state:X0(h),input:X0(N),context:Q0,_static:X0(u),handler:c,stylesheet:e,declaration:E},{debug:W.debug,lips:W.lips,prepath:x,boundaries:P}),R=R.add(I.node),!L.declaration?.syntax&&W.PCC.set(C,I)}return R=R.add(P.end),Object.entries(k).forEach(([E,h])=>{W.__attachEvent__({nodepath:x,element:I,_event:E,instruction:h,scope:A,get __dependencies__(){return B}})}),_&&Object.entries(_).forEach(([E,h])=>{let u=!1,c=!1;if(E.startsWith(P0))u=!0,E=E.replace(P0,"");if(E.startsWith(V0))c=!0,E=E.replace(V0,"");if(j0.test(E)){if(W.__isReactive__(E,A)){const Q0=(e)=>{const w0={};W.__evaluateSpreadAttr__(E,{memo:e,get keystore(){return b[E]},set keystore(I0){if(!b[E])b[E]=[];b[E]=I0},each:(I0,S0)=>{if(s.map.afterSpreadAttrs.includes(I0))return;w0[I0]=S0},nullify:(I0)=>I0.forEach((S0)=>w0[S0]=void 0)}),I?.subInput(w0,e)};W.__extractExpressionDeps__(E,A).forEach((e)=>W.__trackDep__(B,e,A,{nodetype:"component",nodepath:x,deppath:`${x}.${E}`,target:"spread-attr",$fragment:null,boundaries:P,update:Q0,syntax:u}))}}else if(W.__isReactive__(h,A)){const Q0=(e)=>{if(s.map.beforeSpreadAttrs.includes(E))return;const w0=c?W.__evaluateFunction__(h,[],e):h?W.__evaluate__(h,e):!0;I?.subInput({[E]:w0},e)};W.__extractExpressionDeps__(h,A).forEach((e)=>W.__trackDep__(B,e,A,{nodetype:"component",nodepath:x,deppath:`${x}.${E}`,target:"attr",$fragment:null,boundaries:P,update:Q0,syntax:u}))}}),W.metrics.inc("componentCount"),R}function i(U,M,$){if(M=M||U.attr(g0),!M)throw new Error("Invalid macro rendering call");const L=W.__macros.get(M);if(!L)throw new Error("Macro component not found");const F=D("macro"),x=W.__getBoundaries__(F),{attrs:C}=W.__getAttributes__(U),P={},m=$||G(),f={},s={};C.literals&&Object.entries(C.literals).forEach(([I,A])=>{f[I]=A,s[I]={value:A,type:"arg"}});const k={};C.expressions&&Object.entries(C.expressions).forEach(([I,A])=>{if(j0.test(I))W.__evaluateSpreadAttr__(I,{memo:m,get keystore(){return k[I]},set keystore(S){if(!k[I])k[I]=[];k[I]=S},each:(S,E)=>{if(f[S]=E,L.argv.includes(S))s[S]={value:E,type:"arg"}}}),P[I]=A;else{const S=A?W.__evaluate__(A,m):!0;if(f[I]=S,L.argv.includes(I))s[I]={value:S,type:"arg"},P[I]=A}L.argv.forEach((S)=>{if(s[S]!==void 0)return;s[S]={value:!1,type:"arg"}})}),s.__arguments__=f;let _=W0.default(x.start);const b={$node:L.$node,meshPath:null,fragmentPath:F,fragmentBoundaries:x,argv:L.argv,scope:m,xmlns:q,useAttributes:!0},N=W.__meshwire__(b,P),R=N.renderer.mesh(s,m);return _=_.add(R),P&&Object.entries(P).forEach(([I,A])=>{let S=!1;if(new RegExp(`^${P0}`).test(I))S=!0,I=I.replace(P0,"");if(j0.test(I)){if(!W.__isReactive__(I,m))return;const E=W.__extractExpressionDeps__(I,m),h=(u)=>{const c={};let Q0=[];if(W.__evaluateSpreadAttr__(I,{memo:u,get keystore(){return k[I]},set keystore(t){if(!k[I])k[I]=[];k[I]=t},each:(t,e)=>{if(C.map.afterSpreadAttrs.includes(t))return;if(Y0(e,u[t]?.value))return;c[t]={value:e,type:"arg"},f[t]=e,Q0.push(t)},nullify:(t)=>{t.forEach((e)=>{c[e]={value:void 0,type:"arg"},delete f[e]}),Q0=t}}),Q0.length)W.__updateArgumentsDepNodes__(F,f),N.renderer.update(Q0,c,u);return N1({memo:{...u,...c}})};E.forEach((u)=>W.__trackDep__(B,u,{...m,...s},{nodetype:"macro",nodepath:F,deppath:`${F}.${I}`,target:"spread-attr",$fragment:null,boundaries:x,update:h,syntax:S}))}else if(W.__isReactive__(A,m)){const E=W.__extractExpressionDeps__(A,m),h=(u)=>{if(C.map.beforeSpreadAttrs.includes(I))return;const c=A?W.__evaluate__(A,u):!0;return f[I]=c,W.__updateArgumentsDepNodes__(F,f),N.renderer.update([I],{[I]:{value:c,type:"arg"}},u),N1({memo:u})};E.forEach((u)=>W.__trackDep__(B,u,{...m,...s},{nodetype:"macro",nodepath:F,deppath:`${F}.${I}`,target:"attr",$fragment:null,boundaries:x,update:h,syntax:S}))}}),_=_.add(x.end),W.metrics.inc("elementCount"),_}function o(U,M,$){if(!U.length||!U.prop("tagName")&&!M)return U;M=M||U.prop("tagName").toLowerCase();const L=U.is("svg")||q,F=L?W0.default(document.createElementNS("http://www.w3.org/2000/svg",M)):W0.default(`<${M}/>`),x=U.contents(),C=D("element"),P=$||G();x.length&&F.append(W.__withPath__(C,()=>W.render(C+G5,x,P,B,L).$log));const{attrs:m,events:f}=W.__getAttributes__(U);m.literals&&Object.entries(m.literals).forEach(([k,_])=>{if(k===x0)return;const b=U.is(`[${x0}]`)&&["title","placeholder"].includes(k);F.attr(k,b?W.lips.i18n.translate(_).text:_);const N=(R)=>{F.attr(k,b?W.lips.i18n.translate(_).text:_),b&&W.__trackTranslationDep__(R,{nodetype:"element",nodepath:C,deppath:`${C}.${k}`,target:"attr",$fragment:F,update:N})};b&&W.__trackTranslationDep__(P,{nodetype:"element",nodepath:C,deppath:`${C}.${k}`,target:"attr",$fragment:F,update:N})});const s=(k,_=!1)=>{k&&Object.entries(k).forEach(([b,N])=>{switch(b){case"@html":{const R=(I)=>{F.html(W.__evaluate__(N,I))};if(R(P),_&&W.__isReactive__(N,P))W.__extractExpressionDeps__(N,P).forEach((A)=>W.__trackDep__(B,A,P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:R}))}break;case"@text":{const R=U.is(`[${x0}]`),I=(A)=>{F.text(W.__evaluate__(N,A,{translate:R})),R&&W.__trackTranslationDep__(A,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:I})};if(I(P),_&&W.__isReactive__(N,P))W.__extractExpressionDeps__(N,P).forEach((S)=>W.__trackDep__(B,S,P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:I}));R&&W.__trackTranslationDep__(P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:I})}break;case"@format":{const[R,I]=N.split(",").map((S)=>S.trim());if(!R)throw new Error("Invalid @format reference");if(!I)throw new Error("Invalid @format parameters");const A=(S)=>{const E=W.__evaluate__(`!${I.trim()}`,S);if(typeof E!=="object")throw new Error("Invalid @format parameters");const h=W.lips.i18n.format(R,E);h!==void 0&&F.text(h),W.__trackTranslationDep__(S,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:A})};A(P),W.__extractExpressionDeps__(I,P).forEach((S)=>W.__trackDep__(B,S,P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"meta-attr",$fragment:F,update:A}))}break;case"style":if(_&&W.__isReactive__(N,P)){const R=(A)=>{const S=W.__evaluate__(N,A);if(typeof S==="object"){let E="";Object.entries(S).forEach(([h,u])=>E+=`${h}:${u};`),E.length&&F.attr("style",E)}else F.attr("style",S)};R(P),W.__extractExpressionDeps__(N,P).forEach((A)=>W.__trackDep__(B,A,P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"attr",$fragment:F,update:R}))}else F.attr("style",N);break;default:{const R=U.is(`[${x0}]`)&&["title","placeholder"].includes(b),I=(A)=>{const S=N&&W.__isReactive__(N,P)?W.__evaluate__(N,A,{translate:R}):N!==void 0?N:!0;if(S===void 0||S===!1)F.removeAttr(b);else F.attr(b,S),R&&W.__trackTranslationDep__(A,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"attr",$fragment:F,update:I})};if(I(P),_&&W.__isReactive__(N,P))W.__extractExpressionDeps__(N,P).forEach((S)=>W.__trackDep__(B,S,P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"attr",$fragment:F,update:I}));R&&W.__trackTranslationDep__(P,{nodetype:"element",nodepath:C,deppath:`${C}.${b}`,target:"attr",$fragment:F,update:I})}}})};return m.expressions&&Object.keys(m.expressions).forEach((k)=>{if(!j0.test(k))return;let _=[];const b=(N,R,I=!1)=>{const A={};W.__evaluateSpreadAttr__(k,{memo:N,get keystore(){return _},set keystore(S){_=S},each:(S,E)=>{if(!I&&m.map.afterSpreadAttrs.includes(S))return;A[S]=E},nullify:(S)=>S.forEach((E)=>F.removeAttr(E))}),Object.keys(A).length&&s(A)};if(delete m.expressions[k],b(P,"",!0),k&&W.__isReactive__(k,P))W.__extractExpressionDeps__(k,P).forEach((R)=>W.__trackDep__(B,R,P,{nodetype:"element",nodepath:C,deppath:`${C}.${k}`,target:"spread-attr",$fragment:F,update:b}))}),s(m.expressions,!0),f&&Object.entries(f).forEach(([k,_])=>{Y.push({nodepath:C,element:F,_event:k,instruction:_,scope:P,get __dependencies__(){return B}})}),W.metrics.inc("elementCount"),W.metrics.inc("domInsertsCount"),F}function r(U){const M=U.text(),$=G(),L=D("element"),F=U.parent().is(`[${x0}]`),x=W0.default(document.createTextNode(W.__interpolate__(M,$,F))),C=(P)=>{const m=W.__interpolate__(M,P,F);if(!x[0])return;x[0].textContent=m,F&&W.__trackTranslationDep__(P,{nodetype:"text",nodepath:L,target:"value",$fragment:x,update:C})};if(M&&W.__isReactive__(M,$))W.__extractTextDeps__(M,$).forEach((m)=>W.__trackDep__(B,m,$,{nodetype:"text",nodepath:L,deppath:`${L}.${m}`,target:"value",$fragment:x,update:C}));return F&&W.__trackTranslationDep__($,{nodetype:"text",nodepath:L,target:"value",$fragment:x,update:C}),W.metrics.inc("elementCount"),W.metrics.inc("domInsertsCount"),x}function Z0(U){if(!U.attr(k0)||U.prop("tagName")!=="LIPS")throw new Error("Invalid dynamic tag name");const M=U.attr(k0),$=W.__evaluate__(M,X);if(d($))return v(U,{template:$});else return n(U,M,$)}function p(U){if(U.get(0)?.nodeType===Node.COMMENT_NODE)return U;if(U.get(0)?.nodeType===Node.TEXT_NODE)return r(U);if(U.is("let"))return a(U);else if(U.is("const"))return q0(U);else if(U.is("lips")&&U.attr(k0))return Z0(U);else if(U.is("log"))return J0(U);else if(W.__macros.has(U.attr(g0)))return i(U);else if(U.is(Q1.join(","))||W.lips.has(U.attr(g0)))return v(U);else if(U.is("else-if, else"))return;return o(U)}try{this.__renderDepth__++,Z=!Z&&W0.default(this.__template__).length>1?W0.default("<template>").html(this.__template__).contents():Z||W0.default(this.__template__),Z.each(function(){const U=p(W0.default(this));if(U)K=K.add(U)}),Y.forEach(this.__attachEvent__.bind(this)),W.metrics.inc("renderCount")}catch(U){console.error("Rendering Failed --",U),W.metrics.trackError(U)}finally{if(this.__renderDepth__--,this.metrics.endRender(),this.metrics.trackMemory(),this.__renderDepth__===0)this.__inpath__="",this.__inpathCounter__=0}return{$log:K,dependencies:B,events:Y}}destroy(){this.ICE.dispose(),this.stylesheet?.clear(),this.metrics.dispose(),this.lips.IUC.unregister(this.__path__),this.lips.watcher.unwatch(this),this.VER.forEach(this.__detachEvent__.bind(this)),this.VER=[];for(let J in this.PCC){const Z=this.PCC.get(J);Z?.destroy(),Z?.delete(J)}if(this.$?.remove(),this.PCC?.clear(),this.FGUD?.clear(),this.FGUDMemory?.clear(),this.__macros.clear(),this.__i18nDeps.clear(),this.__previous=null,this.state=null,this.input=null,this.context=null,this.$)this.$.each((J,Z)=>{W0.default(Z).off()}),this.$=null;typeof this.onDestroy==="function"&&this.onDestroy.bind(this)(),this.emit("component:destroy")}__meshwire__(J,Z){const X=this,{$node:H,meshPath:q,fragmentPath:W,fragmentBoundaries:B,argv:Y,xmlns:K,declaration:G,useAttributes:D}=J;let O;const g=new Map,d=W+y1,J0=(v,i,o)=>{if(O=H.contents(),!O?.length)return null;i=i||J.scope;const r=d+(o||""),{$log:Z0,dependencies:p,events:U}=X.__withPath__(r,()=>{return X.render(r,O,{...i,...v},void 0,K)}),M=o||l0;return!g.has(M)&&g.set(M,new Set),g.get(M)?.add(r),p?.forEach(($,L)=>{!X.FGUD?.has(L)&&X.FGUD.set(L,new Map),$.forEach((F,x)=>{if(F.garbage)return;F.partial?.length?F.partial.push(r):F.partial=[r],X.FGUD.get(L)?.set(x,F)})}),X.metrics.inc("partialCount"),Z0},a=(v,i,o,r,Z0)=>{if(!g.get(Z0||l0)?.size)return;o=o||J.scope,r=r||B,X.metrics.startRender();const p=Array.from(g.get(Z0||l0)||[]);v.forEach((U)=>{const M=X.FGUD.get(U);if(!M)return;M.forEach(($)=>{const L=p.find((C)=>{return $.partial?.find((P)=>C==P||X.__hasSamePathParent__(P,C))});if(!$.partial||!L)return;const F=$.deppath||$.nodepath,x=this.FGUDMemory.get($.nodepath);if($.garbage||r?.start&&!document.contains(r.start)){M.delete(F),X.__unbindMemo__($);return}if(!x){console.warn(`unexpected occurence: <${F}> has no memo`);return}if(x.memo?.[U]&&i?.[U]&&!Y0(x.memo[U],i[U]))x.memo={...o,...x.memo,...i};X.UQS.queue({dep:U,deppath:F,priority:$.priority}),X.metrics.inc("dependencyUpdateCount")}),!M.size&&X.FGUD.delete(U)}),X.metrics.inc("partialUpdateCount"),X.metrics.endRender()},q0=(v,i)=>{if(g.delete(typeof i==="string"&&i||l0),v=v||B,X.__emptyBoundaries__(v,d+(i||"")),i)v.start.remove(),v.end.remove()},n={renderer:{path:q,argv:Y,mesh:J0,update:a,cleanup:q0,fill(v,i){X.__fillBoundaries__(v,i||B)},demarcate(v,i){const o=X.__getBoundaries__(d+(i||""));let r=W0.default(o.start);return r=r.add(v),r=r.add(o.end),{$partial:r,boundaries:o}}}};if(D&&q){const{attrs:v}=X.__getAttributes__(H);v.literals&&Object.entries(v.literals).forEach(([i,o])=>n[i]=o),v.expressions&&Object.entries(v.expressions).forEach(([i,o])=>{if(j0.test(i)){let r=[];X.__evaluateSpreadAttr__(i,{memo:J.scope,get keystore(){return r},set keystore(Z0){r=Z0},each:(Z0,p)=>n[Z0]=p}),Z[`${G?.syntax?P0:""}${q}.${i}`]=o}else n[i]=o?X.__evaluate__(o,J.scope):!0,Z[`${G?.syntax?P0:""}${q}.${i}`]=o})}return n}__getBoundaries__(J){return this.metrics.inc("domOperations"),this.metrics.inc("domInsertsCount"),{start:document.createComment(`s:${J}`),end:document.createComment(`e:${J}`)}}__emptyBoundaries__(J,Z){this.FGUD.forEach((q,W)=>{q.forEach((B,Y)=>{if(!this.__hasSamePathParent__(Y,Z))return;this.__unbindMemo__(B),B.garbage=!0}),!q.size&&this.FGUD.delete(W)});const X=[];let H=J.start.nextSibling;while(H&&H!==J.end)X.push(H),H=H.nextSibling;W0.default(X).remove()}__fillBoundaries__(J,Z){if(!document.contains(Z.start)||!document.contains(Z.end)){console.warn("Dynamic element boundaries not found");return}J.length&&W0.default(Z.start).after(J)}__getAttributes__(J){const Z=J.attrs(),X={},H={},q={literals:{},expressions:{},map:{explicitAttrs:[],spreadAttrs:[],beforeSpreadAttrs:[],afterSpreadAttrs:[],metaAttrs:[]}},W=Object.keys(Z).find((K)=>j0.test(K));let B=[],Y=!1;return Z&&Object.entries(Z).forEach(([K,G])=>{if([g0,k0].includes(K))return;if(K.startsWith(":")||K.startsWith(V0)||K.startsWith(f0)||j0.test(K)||Z1.test(K))if(Z1.test(K)){const[D,O]=K.match(Z1)||[];B=O.split(",")}else if(K.startsWith(f0))X[K.replace(f0,"")]=G;else if(K.startsWith(V0))H[K.replace(V0,"")]=G;else{if(K.startsWith(":"))K=K.slice(1,K.length);if(W)if(j0.test(K))q.map.spreadAttrs.push(K),Y=!0;else q.map.explicitAttrs.push(K),!Y?q.map.beforeSpreadAttrs.push(K):q.map.afterSpreadAttrs.push(K);q.expressions[K]=G||""}else if(q.literals[K]=G,W)q.map.explicitAttrs.push(K),!Y?q.map.beforeSpreadAttrs.push(K):q.map.afterSpreadAttrs.push(K)}),{argv:B,events:X,functions:H,attrs:q}}__withPath__(J,Z){const X=this.__inpath__;this.__inpath__=J;const H=Z();return this.__inpath__=X,H}__getPathParent__(J){const Z=J.split("/");if(Z.length>1)Z.pop();return Z.join("/")}__hasSamePathParent__(J,Z){return J.startsWith(Z)&&!J.replace(Z,"").startsWith(".")||J.startsWith(`${Z+y1}`)}__evaluate__(J,Z,X){J=typeof J==="string"?J.trim():J;try{const H=(q)=>{const W=this.state.toJSON(),B=(K,...G)=>{try{return K(...G)}catch(D){!X?.mute&&console.error("Eval error --",D);return}};let Y=`return ${q};`;if(Z){let K={},G;for(let O in Z){if(O==="__arguments__")continue;K[O]=Z[O].value}if(typeof Z.__arguments__==="object")G=Z.__arguments__;Y=`with( scope ){ ${Y} }`;const D=new Function("self","input","state","static","context","scope","arguments",Y);return B(D,this,this.input,W,this.static,this.context,K||{},G)}else{const K=new Function("self","input","state","static","context",Y);return B(K,this,this.input,W,this.static,this.context)}};if(/{\s*([^{}]+)\s*}/.test(J)){if(J.startsWith("!{")&&J.endsWith("}"))return H(J.slice(1));return J.replace(_1,(q,W)=>H(W))}return H(J)}catch(H){!X?.mute&&console.error("Expression evaluation error --",H);return}}__evaluateFunction__(J,Z,X){if(/(\s*\w+|\s*\([^)]*\)|\s*)\s*=>\s*(\s*\{[^}]*\}|\s*[^\n;"]+)/g.test(J))return this.__evaluate__(J,X)(...Z);else{let[H,...q]=J.split(/\s*,\s*/),W;const B=this.__evaluate__(H,X,{mute:!0});if(typeof B==="function")W=B;else{if(typeof this[H]!=="function")throw new Error(`Undefined <${H}> handler method`);W=this[H].bind(this)}if(typeof W!=="function")throw new Error(`Expected <${H}> to be a function or handler method`);let Y=q.map((K)=>this.__evaluate__(K,X));if(Z.length)Y=[...Y,...Z];return W(...Y)}}__evaluateSpreadAttr__(J,Z){const X=this.__evaluate__(J.replace(j0,""),Z.memo);if(!X){if(!Z.keystore.length)throw new Error(`Undefined spread operator ${J}`);typeof Z.nullify==="function"&&Z.nullify(Z.keystore);return}if(typeof X!=="object"||Array.isArray(X))throw new Error(`Invalid spread operator ${J}`);if(Z.keystore=Object.keys(X)||[],typeof Z.each==="function")for(let H in X)Z.each(H,X[H])}__interpolate__(J,Z,X){if(J=J.replace(_1,(H,q)=>this.__evaluate__(q,Z)),X)J=this.lips.i18n.translate(J).text;return J}__attachEvent__(J){const{element:Z,nodepath:X,_event:H,instruction:q,scope:W,__dependencies__:B}=J;let Y=W;if(Z.on(H,(...K)=>this.__evaluateFunction__(q,K,Y)),this.VER.push(J),this.metrics.inc("domUpdatesCount"),this.metrics.inc("domRemovalsCount"),this.__isReactive__(q,W))this.__extractExpressionDeps__(q,W).forEach((G)=>this.__trackDep__(B,G,W||{},{nodetype:"event",nodepath:X,deppath:`${X}.${H}`,target:"event-handler",$fragment:!(Z instanceof y0)?Z:null,boundaries:Z instanceof y0?Z.__boundaries__:void 0,update:(D)=>{Y=D}}))}__detachEvent__({element:J,nodepath:Z,_event:X,instruction:H,scope:q,__dependencies__:W}){if(J.off(X),this.__isReactive__(H,q)){const B=this.__extractExpressionDeps__(H,q),Y=`${Z}.${X}`;B.forEach((K)=>{W.get(K)?.delete(Y),this.FGUD.get(K)?.delete(Y)})}this.metrics.inc("domOperations"),this.metrics.inc("domRemovalsCount")}__extractTextDeps__(J,Z){const X=new Set;return(J.match(/{\s*([^{}]+)\s*}/g)||[]).forEach((q)=>{const W=q.replace(/[{}]/g,"").trim();this.__extractExpressionDeps__(W,Z).forEach((Y)=>X.add(Y))}),Array.from(X)}__extractExpressionDeps__(J,Z){const X=/\b(state|input|context|arguments)(?:\.[a-zA-Z_]\w*)+(?=\[|\.|$|\s|;|,|\))/g,H=/\b(self)(?:\.[a-zA-Z_]\w*)+(?=\()/g,q=/\b(arguments)((?:\.[a-zA-Z_]\w*)+)?(?=\[|\.|$|\s|;|,|\))/g;let W=[...Array.from(J.matchAll(X)),...Array.from(J.matchAll(H)),...Array.from(J.matchAll(q))];if(Z&&Object.keys(Z).length){const B=new RegExp(`\\b(?<!\\.)(${Object.keys(Z).join("|")})`,"g"),Y=new RegExp(`(?:(?<=\\.\\.\\.))(${Object.keys(Z).join("|")})\\b`,"g");W=[...W,...Array.from(J.matchAll(B)),...Array.from(J.matchAll(Y))]}return[...new Set(W.map((B)=>B[0]))]}__isReactive__(J,Z){if(/(self|state|input|context|arguments)(\.[\w.]+)?/.test(J))return!0;if(Z&&Object.keys(Z).length&&new RegExp(Object.keys(Z).join("|")).test(J))return!0;return!1}__bindMemo__(J,Z){const X=Z.deppath||Z.nodepath,H=this.FGUDMemory.get(Z.nodepath);if(H)H.tracks.set(X,Z.priority||2),H.memo=J,this.FGUDMemory.set(Z.nodepath,H);else{const q=new Map;q.set(X,Z.priority),this.FGUDMemory.set(Z.nodepath,{tracks:q,memo:J})}}__unbindMemo__(J){const Z=J.deppath||J.nodepath,X=this.FGUDMemory.get(J.nodepath);if(!X||!X.tracks.get(Z))return;X.tracks.delete(Z),!X.tracks.size&&this.FGUDMemory.delete(J.nodepath)}__trackDep__(J,Z,X,H){if(X&&X[Z]&&X[Z].type==="let")H.haslet=!0;if(H.priority===void 0)if(H.target==="attr"&&Z.split(".").find((W)=>w5.includes(W)))H.priority=0;else if(H.syntax)H.priority=1;else if(["event"].includes(H.nodetype))H.priority=3;else H.priority=2;const q=H.deppath||H.nodepath;H.level=q.split(/\//g).length,H.priority=H.level*O5+H.priority,!J.has(Z)&&J.set(Z,new Map),J.get(Z)?.set(q,H),this.__bindMemo__(X,H),this.metrics.inc("dependencyTrackCount")}__trackTranslationDep__(J,Z){this.__i18nDeps.set(Z.deppath||Z.nodepath,Z),this.__bindMemo__(J,Z),this.metrics.inc("i18nTrackCount")}__valueDep__(J,Z){return Z.reduce((X,H)=>X?.[H],J)}__shouldUpdate__(J,Z){if(J==="self")return!0;const X={state:this.state,input:this.input,context:this.context},H=this.__valueDep__(this.__previous[J],Z),q=this.__valueDep__(X[J],Z);return!Y0(H,q)}__updateDepNodes__(){if(!this.FGUD?.size)return;this.metrics.inc("componentUpdateCount"),this.metrics.startRender(),this.FGUD.forEach((J,Z)=>{const[X,...H]=Z.split(".");if(!this.__shouldUpdate__(X,H))return;J.forEach((q)=>{try{const W=q.deppath||q.nodepath;if(q.garbage||q.boundaries?.start&&!document.contains(q.boundaries.start)||q.$fragment!==null&&!q.$fragment.closest("body").length){J.delete(W),this.__unbindMemo__(q);return}this.UQS.queue({dep:Z,deppath:W,priority:q.priority}),this.metrics.inc("dependencyUpdateCount")}catch(W){console.error("failed to update dependency nodes --",W);return}}),!J.size&&this.FGUD?.delete(Z)}),this.metrics.endRender()}__updateVarDepNodes__(J,Z,X){if(!this.FGUD?.size)return;this.metrics.inc("partialUpdateCount"),this.metrics.startRender(),this.FGUD.get(J)?.forEach((H,q)=>{if(!H.haslet||!this.__hasSamePathParent__(q,this.__getPathParent__(Z)))return;const W=H.deppath||H.nodepath,B=this.FGUDMemory.get(H.nodepath);if(!B){console.warn(`unexpected occurence: <${W}> has no memo`);return}B.memo={...B.memo,...X},this.UQS.queue({dep:J,deppath:W,priority:H.priority}),this.metrics.inc("dependencyUpdateCount")}),this.metrics.endRender()}__updateArgumentsDepNodes__(J,Z){if(!this.FGUD?.size)return;this.metrics.inc("partialUpdateCount"),this.metrics.startRender();const X="arguments";this.FGUD.get(X)?.forEach((H,q)=>{if(!this.__hasSamePathParent__(q,J))return;const W=H.deppath||H.nodepath,B=this.FGUDMemory.get(H.nodepath);if(!B){console.warn(`unexpected occurence: <${W}> has no memo`);return}B.memo.__arguments__=Z,this.UQS.queue({dep:X,deppath:W,priority:H.priority}),this.metrics.inc("dependencyUpdateCount")}),this.metrics.endRender()}__updateI18nDepNodes__(){if(!this.__i18nDeps?.size)return;this.metrics.inc("i18nUpdateCount"),this.metrics.startRender(),this.__i18nDeps?.forEach((J,Z)=>{if(!J.$fragment.closest("body").length){this.__i18nDeps.delete(Z);return}const X=this.FGUDMemory.get(J.nodepath);if(!X){console.warn(`unexpected occurence: <${J.deppath||J.nodepath}> has no memo`);return}J.update(X.memo,"i18n-partial-updator"),this.metrics.inc("dependencyUpdateCount")}),this.metrics.endRender()}appendTo(J){return(typeof J=="string"?W0.default(J):J).append(this.node),this.metrics.inc("domOperations"),this}prependTo(J){return typeof J=="string"?W0.default(J):J.prepend(this.node),this.metrics.inc("domOperations"),this}replaceWith(J){return(typeof J=="string"?W0.default(J):J).replaceWith(this.node),this.metrics.inc("domOperations"),this}}var i1={};s0(i1,{handler:()=>{{return T8}},declaration:()=>{{return P8}},_static:()=>{{return E8}}});var P8={name:"if",syntax:!0,tags:{"else-if":{type:"nexted",many:!0,optional:!0},else:{type:"nexted",alts:["else-if"],optional:!0}}},E8={initialized:!1,prevRenderer:null},T8={onInput(J){this.static.initialized&&this.processor(this.input,J)},onSelfRender(){const J=this.processor(this.input,void 0,!0);return this.static.initialized=!0,J},processor(J,Z,X=!1){if(!J.renderer)return;if(J.by){this.static.prevRenderer?.cleanup();const H=J.renderer.mesh({},Z);if(this.static.prevRenderer=J.renderer,!H?.length)return;if(X)return H;J.renderer.fill(H)}else{this.static.prevRenderer?.cleanup();let H=!1,q;if(Array.isArray(J["else-if"])&&J["else-if"].length)for(let W of J["else-if"]){if(!W.by)continue;if(q=W.renderer.mesh({},Z),this.static.prevRenderer=W.renderer,!q?.length)return;if(X)return q;q?.length&&W.renderer.fill(q),H=!0;break}if(!H&&J.else){const W=J.else.renderer.mesh({},Z);if(this.static.prevRenderer=J.else.renderer,!W?.length)return;if(X)return W;J.else.renderer.fill(W)}}}};var c1={};s0(c1,{handler:()=>{{return A8}},declaration:()=>{{return $8}},_static:()=>{{return S8}}});var C0=J1(o0(),1);var $8={name:"for",syntax:!0},S8={lastIn:null,argvlist:null,initialized:!1,prevRenderer:null,processingBatch:!1},A8={onInput(J){this.static.initialized&&this.processor(this.input,J)},onSelfRender(){const J=this.processor(this.input,void 0,!0);return this.static.initialized=!0,J},processor(J,Z,X=!1){if(this.static.processingBatch)return;if(!J.renderer)throw new Error("Undefined mesh renderer");let{in:H,from:q,to:W}=J;if(H===void 0&&q===void 0)throw new Error("Invalid <for> arguments");this.static.processingBatch=!0;try{if(q!==void 0)return this.asFromTo(J.renderer,q,W,Z,X);else if(Array.isArray(H))return this.asArray(J.renderer,H,Z,X);else if(H instanceof Map)return this.asMap(J.renderer,H,Z,X);else if(typeof H=="object")return this.asObject(J.renderer,H,Z,X)}finally{this.static.processingBatch=!1}},addItem(J,Z,X,H){if(!this.static.argvlist)this.static.argvlist=[];const q=`[${H}]`,W=J.mesh(X,Z,q);if(!W)return;const{boundaries:B,$partial:Y}=J.demarcate(W,q);return this.static.prevRenderer=J,this.static.argvlist.push({argvalues:X,boundaries:B}),Y},updateItem(J,Z,X,H){if(!this.static.argvlist?.[H])return;this.static.argvlist[H].argvalues=X,J.update(Object.keys(X),X,Z,this.static.argvlist[H].boundaries,`[${H}]`)},removeItem(J,Z){if(!this.static.argvlist?.[Z])return;J.cleanup(this.static.argvlist[Z].boundaries,`[${Z}]`),this.static.argvlist.splice(Z,1)},asFromTo(J,Z,X,H,q){if(Z=parseFloat(String(Z)),X==null)throw new Error("Expected <from> <to> attributes of the for loop to be defined");X=parseFloat(String(X));const W=Z<X,B=Math.abs(X-Z)+1;if(Array.isArray(this.static.argvlist)){const[K]=J.argv;if(K){let G=Z;if(this.static.argvlist.length===B){for(let O=0;O<this.static.argvlist.length;O++)this.static.argvlist[O].argvalues[K].value!==G&&this.updateItem(J,H,{[K]:{value:G,type:"arg"}},O),G=W?G+1:G-1;return}const D=Math.min(this.static.argvlist.length,B);for(let O=0;O<D;O++)this.updateItem(J,H,{[K]:{value:O,type:"arg"}},O);if(B>this.static.argvlist.length)for(let O=this.static.argvlist.length;O<B;O++){const g={[K]:{value:O,type:"arg"}};this.boundaries&&C0.default(this.boundaries.end).before(this.addItem(J,H,g,O))}else if(B<this.static.argvlist.length)for(let O=this.static.argvlist.length-1;O>=B;O--)this.removeItem(J,O)}return}this.static.prevRenderer?.cleanup(),this.static.argvlist=[];let Y=C0.default();for(let K=Z;W?K<=X:K>=X;W?K++:K--){const G={},[D]=J.argv;if(D)G[D]={value:K,type:"arg"};Y=Y.add(this.addItem(J,H,G,K))}if(!Y?.length)return;if(q)return Y;J.fill(Y)},asArray(J,Z,X,H){if(this.static.argvlist&&this.static.lastIn&&Z===this.static.lastIn)return;if(!Z.length){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute array value will not update")}if(this.static.lastIn=Z,Array.isArray(this.static.argvlist)){const[B,Y]=J.argv;if(B){if(this.static.argvlist.length===Z.length){for(let G=0;G<this.static.argvlist.length;G++)!Y0(this.static.argvlist[G].argvalues[B].value,Z[G])&&this.updateItem(J,X,{[B]:{value:Z[G],type:"arg"},[Y]:{value:G,type:"arg"}},G);return}const K=Math.min(this.static.argvlist.length,Z.length);for(let G=0;G<K;G++)this.updateItem(J,X,{[B]:{value:Z[G],type:"arg"},[Y]:{value:G,type:"arg"}},G);if(Z.length>this.static.argvlist.length)for(let G=this.static.argvlist.length;G<Z.length;G++){const D={[B]:{value:Z[G],type:"arg"},[Y]:{value:G,type:"arg"}};this.boundaries&&C0.default(this.boundaries.end).before(this.addItem(J,X,D,G))}else if(Z.length<this.static.argvlist.length)for(let G=this.static.argvlist.length-1;G>=Z.length;G--)this.removeItem(J,G)}return}this.static.prevRenderer?.cleanup(),this.static.argvlist=[];let q=C0.default(),W=0;for(let B of Z){const Y={},[K,G]=J.argv;if(K)Y[K]={value:B,type:"arg"};if(G)Y[G]={value:W,type:"arg"};q=q.add(this.addItem(J,X,Y,W)),W++}if(!q?.length)return;if(H)return q;J.fill(q)},asMap(J,Z,X,H){if(this.static.argvlist&&this.static.lastIn&&Z===this.static.lastIn)return;if(!Z.size){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute map value will not update")}if(this.static.lastIn=Z,Array.isArray(this.static.argvlist)){const[B,Y,K]=J.argv,G=Array.from(Z.entries());if(B){if(this.static.argvlist.length===G.length){for(let O=0;O<this.static.argvlist.length;O++)!Y0(this.static.argvlist[O].argvalues[B].value,G[O][0])||!Y0(this.static.argvlist[O].argvalues[Y].value,G[O][1])&&this.updateItem(J,X,{[B]:{value:G[O][0],type:"arg"},[Y]:{value:G[O][1],type:"arg"},[K]:{value:O,type:"arg"}},O);return}const D=Math.min(this.static.argvlist.length,G.length);for(let O=0;O<D;O++)this.updateItem(J,X,{[B]:{value:G[O][0],type:"arg"},[Y]:{value:G[O][1],type:"arg"},[K]:{value:O,type:"arg"}},O);if(G.length>this.static.argvlist.length)for(let O=this.static.argvlist.length;O<G.length;O++){const g={[B]:{value:G[O][0],type:"arg"},[Y]:{value:G[O][1],type:"arg"},[K]:{value:O,type:"arg"}};this.boundaries&&C0.default(this.boundaries.end).before(this.addItem(J,X,g,O))}else if(G.length<this.static.argvlist.length)for(let O=this.static.argvlist.length-1;O>=G.length;O--)this.removeItem(J,O)}return}this.static.prevRenderer?.cleanup(),this.static.argvlist=[];let q=C0.default(),W=0;for(let[B,Y]of Z){const K={},[G,D,O]=J.argv;if(G)K[G]={value:B,type:"arg"};if(D)K[D]={value:Y,type:"arg"};if(O)K[O]={value:W,type:"arg"};q=q.add(this.addItem(J,X,K,W)),W++}if(!q?.length)return;if(H)return q;J.fill(q)},asObject(J,Z,X,H){if(this.static.argvlist&&this.static.lastIn&&Z===this.static.lastIn)return;if(!Object.keys(Z).length){if(!this.static.lastIn)console.warn("For loop with empty initial rendering <in> attribute object value will not update")}if(this.static.lastIn=Z,Array.isArray(this.static.argvlist)){const[B,Y,K]=J.argv,G=Object.entries(Z);if(B){if(this.static.argvlist.length===G.length){for(let O=0;O<this.static.argvlist.length;O++)!Y0(this.static.argvlist[O].argvalues[B].value,G[O][0])||!Y0(this.static.argvlist[O].argvalues[Y].value,G[O][1])&&this.updateItem(J,X,{[B]:{value:G[O][0],type:"arg"},[Y]:{value:G[O][1],type:"arg"},[K]:{value:O,type:"arg"}},O);return}const D=Math.min(this.static.argvlist.length,G.length);for(let O=0;O<D;O++)this.updateItem(J,X,{[B]:{value:G[O][0],type:"arg"},[Y]:{value:G[O][1],type:"arg"},[K]:{value:O,type:"arg"}},O);if(G.length>this.static.argvlist.length){let O=C0.default();for(let g=this.static.argvlist.length;g<G.length;g++){const d={[B]:{value:G[g][0],type:"arg"},[Y]:{value:G[g][1],type:"arg"},[K]:{value:g,type:"arg"}},J0=this.addItem(J,X,d,g);O=O.add(J0)}this.boundaries&&C0.default(this.boundaries.end).before(O)}else if(G.length<this.static.argvlist.length)for(let O=this.static.argvlist.length-1;O>=G.length;O--)this.removeItem(J,O)}return}this.static.prevRenderer?.cleanup(),this.static.argvlist=[];let q=C0.default(),W=0;for(let B in Z){const Y={},[K,G,D]=J.argv;if(K)Y[K]={value:B,type:"arg"};if(G)Y[G]={value:Z[B],type:"arg"};if(D)Y[D]={value:W,type:"arg"};q=q.add(this.addItem(J,X,Y,W)),W++}if(!q?.length)return;if(H)return q;J.fill(q)},onDestroy(){this.static.prevRenderer?.cleanup(void 0,!0),this.static.prevRenderer=null,this.static.argvlist=null,this.static.lastIn=null}};var p1={};s0(p1,{handler:()=>{{return g8}},declaration:()=>{{return b8}},_static:()=>{{return x8}}});var b8={name:"async",syntax:!0,tags:{then:{type:"child"},catch:{type:"child",optional:!0},loading:{type:"child",optional:!0}}},x8={initialized:!1,finalized:!1,prevRenderer:null},g8={onInput(J){this.static.initialized&&this.processor(this.input,J)},onSelfRender(){const J=this.processor(this.input,void 0,!0);return this.static.initialized=!0,J},processor(J,Z,X=!1){if(!J.await)throw new Error("Undefined async <await> attribute");if(!(J.await instanceof Promise))throw new Error("Expected async <await> attribute value to be a function");if(this.static.finalized=!1,J.loading){this.static.prevRenderer?.cleanup();const H=J.loading.renderer.mesh({},Z);if(this.static.prevRenderer=J.loading.renderer,this.execute(J,Z,!0),this.static.finalized)return;if(!H?.length)return;if(X)return H;J.loading.renderer.fill(H)}else this.execute(J,Z)},execute(J,Z,X=!1){J.await.then((H)=>{if(this.static.prevRenderer?.cleanup(),!J.then)return;const[q]=J.then.renderer.argv,W={[q]:{value:H,type:"arg"}},B=J.then.renderer.mesh(W,Z);if(this.static.prevRenderer=J.then.renderer,!B?.length)return;if(!X)return B;J.then.renderer.fill(B)}).catch((H)=>{if(this.static.prevRenderer?.cleanup(),!J.catch)return;const[q]=J.catch.renderer.argv,W={[q]:{value:H,type:"arg"}},B=J.catch.renderer.mesh(W,Z);if(this.static.prevRenderer=J.catch.renderer,!B?.length)return;if(!X)return B;J.catch.renderer.fill(B)}).finally(()=>this.static.finalized=!0)}};var s1={};s0(s1,{handler:()=>{{return f8}},declaration:()=>{{return k8}},_static:()=>{{return h8}}});var k8={name:"switch",syntax:!0,tags:{case:{type:"child",many:!0},default:{type:"child"}}},h8={initialized:!1,prevRenderer:null},f8={onInput(J){this.static.initialized&&this.processor(this.input,J)},onSelfRender(){const J=this.processor(this.input,void 0,!0);return this.static.initialized=!0,J},processor(J,Z,X=!1){let H=[];this.static.prevRenderer?.cleanup();for(let q of J.case)if(q.is==J.by||Array.isArray(q.is)&&q.is.includes(J.by)){Array.isArray(q.is)?H=[...new Set([...H,...q.is])]:H.push(q.is);const W=q.renderer.mesh({},Z);if(this.static.prevRenderer=q.renderer,!W?.length)return;if(X)return W;q.renderer.fill(W)}if(H.includes(J.by))return;if(J.default){const q=J.default.renderer.mesh({},Z);if(this.static.prevRenderer=J.default.renderer,!q?.length)return;if(X)return q;J.default.renderer.fill(q)}else this.static.prevRenderer=null}};var l1={};s0(l1,{state:()=>{{return _8}},handler:()=>{{return m8}},default:()=>{{return d8}},context:()=>{{return v8}},_static:()=>{{return y8}}});var u8=function(J){const Z={};return J.split("&").map((H)=>{const[q,W]=H.split("=");Z[q]=W}),Z},_8={page:null,params:{},query:{}},y8={global:!1,routes:[],defaultPath:null,currentPath:null,currentRoute:null},v8=["navigate"],m8={onInput(){this.processor(this.input)},processor(J){if(!J.routes)return;if(J.global)this.static.global=J.global;if(this.static.routes=J.routes.map(({path:Z,template:X,default:H})=>{if(H)this.static.defaultPath=Z;const q=Z.match(/:[^\/]*(\/|$)/gi)||[],W=Z.replaceAll("/","\\/").replaceAll(/:[^\/]*(\/|$)/gi,"([^\\/]+)(?:\\/|$)");return{path:Z,template:X,default:H,pathVars:q,pathRegex:new RegExp(`${W}\$`,"i")}}),J.global){const Z=window.location.pathname;this.static.defaultPath=this.static.defaultPath&&Z=="/"&&Z!==this.static.defaultPath?this.static.defaultPath:Z?Z+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,Z){!Z&&this.static.global&&history.pushState({path:J},"",J);const X=J.split("?");J=X[0];const H=X[1]?u8(X[1]):{};let q=null;if(this.static.currentRoute)q={path:this.static.currentRoute.path,params:this.state.params},this.emit("before",{fromState:q,toState:{path:J,query:H}});const W=this.match(J);if(!W){this.static.currentRoute=null,this.state.params={},this.state.query={},this.emit("not-found",J);return}const{route:B,params:Y}=W;this.emit("after",{fromState:q,toState:{path:B.path,params:Y,query:H}}),this.static.currentPath=J,this.static.currentRoute=B,this.state.params=Y,this.state.query=H,this.state.page=B.template},match(J){const Z={};let X=!1;for(let H of this.static.routes){const{pathVars:q,pathRegex:W}=H,B=J.match(W);if(B!==null&&B.index===0){for(let Y=0;Y+1<B.length&&Y<q.length;Y++)Z[q[Y].replaceAll(/[\/:]/g,"")]=B[Y+1];X=H;break}}return X?{route:X,params:Z}:!1}},d8="<{state.page} params=state.params query=state.query/>";class i5{debug=!1;stylesheets=[];config={};store=new Map;__root;preprocessor;i18n=new B1;watcher;IUC;__setLang;__getLang;__setContext;__getContext;constructor(J){if(this.config=J,this.config?.debug)this.debug=this.config.debug;this.preprocessor=new W1(this.store),this.watcher=new q1,this.IUC=new H1;const[Z,X]=_0(this.i18n.lang),[H,q]=_0(J?.context||{});this.__setLang=X,this.__getLang=Z,this.__setContext=q,this.__getContext=H,this.register("if",i1),this.register("for",c1),this.register("async",p1),this.register("switch",s1),this.register("router",l1)}register(J,Z){return this.store.set(J,Z),this}unregister(J){return this.store.delete(J),this}has(J){return this.store.has(J)}import(J){if(!this.has(J))throw new Error(`<${J}> component not found`);const Z=this.store.get(J);if(!Z?.declaration?.syntax&&!Z?.default)throw new Error(`Invalid <${J}> component`);return Z}render(J,Z,X){const{default:H,...q}=Z,W={debug:this.debug,prepath:"0",lips:this},B=new y0(J,H||"",{...q,input:X},W);return window.addEventListener("beforeunload",()=>{return this.dispose(),B.destroy(),null}),window.addEventListener("pagehide",(Y)=>{!Y.persisted&&this.dispose()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState!=="hidden")return;this.IUC.prepareForPotentialUnload()}),B}root(J,Z){if(this.__root=this.render("__ROOT__",J),this.__root.appendTo(Z),this.config?.stylesheets)this.stylesheets=this.config.stylesheets.map((X)=>new p0("root",{sheet:X,meta:!0}));return this.__root}setLanguage(J){this.i18n.lang=J,this.__setLang(J)}getLanguage(){return this.__getLang()}setContext(J,Z){const X=this.__getContext();if(typeof J==="string"){const H={...X,[J]:Z};G0(X,H)&&this.__setContext(H)}else if(!Array.isArray(J)){const H={...X,...J};G0(X,H)&&this.__setContext(H)}else throw new Error("Invalid context data")}getContext(){return this.__getContext()}useContext(J,Z){if(!J.length)return;a0(()=>{const X=this.__getContext();if(!X)return;const H=Object.fromEntries(J.map((q)=>[q,X[q]]));H&&typeof Z==="function"&&Object.keys(H).length&&Z(H)})}useTranslator(J,Z){a0(()=>{const X=this.__getLang();if(!X)return;(J==="*"||Array.isArray(J)&&J.includes(X))&&typeof Z==="function"&&Z(X)})}dispose(){this.watcher?.dispose(),this.__root?.destroy(),this.stylesheets.forEach((J)=>J.clear())}}export{i5 as default};
|
|
1
|
+
var JJ="comm",XJ="rule",$J="decl";var xJ="@import";var gJ="@namespace",kJ="@keyframes";var fJ="@layer";var jJ=Math.abs,a=String.fromCharCode;function QJ(J){return J.trim()}function l(J,X,$){return J.replace(X,$)}function bJ(J,X,$){return J.indexOf(X,$)}function b(J,X){return J.charCodeAt(X)|0}function u(J,X,$){return J.slice(X,$)}function T(J){return J.length}function ZJ(J){return J.length}function c(J,X){return X.push(J),J}var YJ=1,o=1,uJ=0,w=0,I=0,r="";function FJ(J,X,$,Q,Y,Z,V,F){return{value:J,root:X,parent:$,type:Q,props:Y,children:Z,line:YJ,column:o,length:V,return:"",siblings:F}}function vJ(){return I}function mJ(){if(I=w>0?b(r,--w):0,o--,I===10)o=1,YJ--;return I}function y(){if(I=w<uJ?b(r,w++):0,o++,I===10)o=1,YJ++;return I}function v(){return b(r,w)}function n(){return w}function WJ(J,X){return u(r,J,X)}function s(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 hJ(J){return YJ=o=1,uJ=T(r=J),w=0,[]}function pJ(J){return r="",J}function VJ(J){return QJ(WJ(w-1,EJ(J===91?J+2:J===40?J+1:J)))}function dJ(J){while(I=v())if(I<33)y();else break;return s(J)>2||s(I)>3?"":" "}function iJ(J,X){while(--X&&y())if(I<48||I>102||I>57&&I<65||I>70&&I<97)break;return WJ(J,n()+(X<6&&v()==32&&y()==32))}function EJ(J){while(y())switch(I){case J:return w;case 34:case 39:if(J!==34&&J!==39)EJ(I);break;case 40:if(J===41)EJ(J);break;case 92:y();break}return w}function lJ(J,X){while(y())if(J+I===57)break;else if(J+I===84&&v()===47)break;return"/*"+WJ(X,w-1)+"*"+a(J===47?J:y())}function cJ(J){while(!s(v()))y();return WJ(J,w)}function rJ(J){return pJ(qJ("",null,null,null,[""],J=hJ(J),0,[0],J))}function qJ(J,X,$,Q,Y,Z,V,F,D){var W=0,q=0,K=V,G=0,U=0,M=0,H=1,O=1,z=1,P=0,B="",_=Y,j=Z,R=Q,L=B;while(O)switch(M=P,P=y()){case 40:if(M!=108&&b(L,K-1)==58){if(bJ(L+=l(VJ(P),"&","&\f"),"&\f",jJ(W?F[W-1]:0))!=-1)z=-1;break}case 34:case 39:case 91:L+=VJ(P);break;case 9:case 10:case 13:case 32:L+=dJ(M);break;case 92:L+=iJ(n()-1,7);continue;case 47:switch(v()){case 42:case 47:if(c(TX(lJ(y(),n()),X,$,D),D),(s(M||1)==5||s(v()||1)==5)&&T(L)&&u(L,-1,void 0)!==" ")L+=" ";break;default:L+="/"}break;case 123*H:F[W++]=T(L)*z;case 125*H:case 59:case 0:switch(P){case 0:case 125:O=0;case 59+q:if(z==-1)L=l(L,/\f/g,"");if(U>0&&(T(L)-K||H===0&&M===47))c(U>32?sJ(L+";",Q,$,K-1,D):sJ(l(L," ","")+";",Q,$,K-2,D),D);break;case 59:L+=";";default:if(c(R=oJ(L,X,$,W,q,Y,F,B,_=[],j=[],K,Z),Z),P===123)if(q===0)qJ(L,X,R,R,_,Z,K,F,j);else{switch(G){case 99:if(b(L,3)===110)break;case 108:if(b(L,2)===97)break;default:q=0;case 100:case 109:case 115:}if(q)qJ(J,R,R,Q&&c(oJ(J,R,R,0,0,Y,F,B,Y,_=[],K,j),j),Y,j,K,F,Q?_:j);else qJ(L,R,R,R,[""],j,0,F,j)}}W=q=U=0,H=z=1,B=L="",K=V;break;case 58:K=1+T(L),U=M;default:if(H<1){if(P==123)--H;else if(P==125&&H++==0&&mJ()==125)continue}switch(L+=a(P),P*H){case 38:z=q>0?1:(L+="\f",-1);break;case 44:F[W++]=(T(L)-1)*z,z=1;break;case 64:if(v()===45)L+=VJ(y());G=v(),q=K=T(B=L+=cJ(n())),P++;break;case 45:if(M===45&&T(L)==2)H=0}}return Z}function oJ(J,X,$,Q,Y,Z,V,F,D,W,q,K){var G=Y-1,U=Y===0?Z:[""],M=ZJ(U);for(var H=0,O=0,z=0;H<Q;++H)for(var P=0,B=u(J,G+1,G=jJ(O=V[H])),_=J;P<M;++P)if(_=QJ(O>0?U[P]+" "+B:l(B,/&\f/g,U[P])))D[z++]=_;return FJ(J,X,$,Y===0?XJ:F,D,W,q,K)}function TX(J,X,$,Q){return FJ(J,X,$,JJ,a(vJ()),u(J,2,-2),0,Q)}function sJ(J,X,$,Q,Y){return FJ(J,X,$,$J,u(J,0,Q),u(J,Q+1,-1),Q,Y)}function DJ(J,X){var $="";for(var Q=0;Q<J.length;Q++)$+=X(J[Q],Q,J,X)||"";return $}function aJ(J,X,$,Q){switch(J.type){case fJ:if(J.children.length)break;case xJ:case gJ:case $J:return J.return=J.return||J.value;case JJ:return"";case kJ:return J.return=J.value+"{"+DJ(J.children,Q)+"}";case XJ:if(!T(J.value=J.props.join(",")))return""}return T($=DJ(J.children,Q))?J.return=J.value+"{"+$+"}":""}function nJ(J){var X=ZJ(J);return function($,Q,Y,Z){var V="";for(var F=0;F<X;F++)V+=J[F]($,Q,Y,Z)||"";return V}}var AX=["===","!==","...","=>","==","!=","<=",">=","&&","||","??","?.","++","--","+=","-=","*=","/=","%=","+","-","*","/","%","<",">","!","?",":",".",",","(",")","[","]","{","}","="];function SX(J,X){let $=[],Q=0,Y=(V)=>/[A-Za-z_$]/.test(V),Z=(V)=>/[A-Za-z0-9_$]/.test(V);while(Q<J.length){let V=J[Q];if(/\s/.test(V)){Q++;continue}if(/[0-9]/.test(V)||V==="."&&/[0-9]/.test(J[Q+1])){let D=Q;while(Q<J.length&&/[0-9]/.test(J[Q]))Q++;if(J[Q]==="."){Q++;while(Q<J.length&&/[0-9]/.test(J[Q]))Q++}if(J[Q]==="e"||J[Q]==="E"){if(Q++,J[Q]==="+"||J[Q]==="-")Q++;while(Q<J.length&&/[0-9]/.test(J[Q]))Q++}$.push({t:"num",value:J.slice(D,Q),start:D,end:Q});continue}if(V==="'"||V==='"'){let D=Q;Q++;let W="",q=!1;while(Q<J.length){let K=J[Q];if(K==="\\"){let G=J[Q+1],U={n:`
|
|
2
|
+
`,t:"\t",r:"\r",b:"\b",f:"\f",v:"\v","0":"\x00"};if(G==="u"){let M=J.slice(Q+2,Q+6);W+=String.fromCharCode(parseInt(M,16)||0),Q+=6}else W+=U[G]??G,Q+=2;continue}if(K===V){q=!0,Q++;break}W+=K,Q++}if(!q)X.push({code:"LIPS-E001",message:"Unterminated string literal",loc:{offset:D,length:Q-D}});$.push({t:"str",value:W,start:D,end:Q});continue}if(Y(V)){let D=Q;while(Q<J.length&&Z(J[Q]))Q++;$.push({t:"id",value:J.slice(D,Q),start:D,end:Q});continue}let F=AX.find((D)=>J.startsWith(D,Q));if(F==="?."&&/[0-9]/.test(J[Q+2]??""))F="?";if(F){$.push({t:"punct",value:F,start:Q,end:Q+F.length}),Q+=F.length;continue}X.push({code:"LIPS-E002",message:`Unexpected character '${V}'`,loc:{offset:Q,length:1}}),Q++}return $.push({t:"eof",value:"",start:J.length,end:J.length}),$}class JX{tokens;diagnostics;pos=0;constructor(J,X){this.tokens=J;this.diagnostics=X}peek(J=0){return this.tokens[Math.min(this.pos+J,this.tokens.length-1)]}next(){return this.tokens[this.pos++]??this.tokens[this.tokens.length-1]}at(J){let X=this.peek();return X.t==="punct"&&X.value===J}eat(J){if(this.at(J))return this.pos++,!0;return!1}error(J,X,$=this.peek()){return this.diagnostics.push({code:J,message:X,loc:{offset:$.start,length:Math.max(1,$.end-$.start)}}),{t:"error"}}expect(J,X){if(!this.eat(J))this.error(X,`Expected '${J}'`)}parse(){let J=this.assign();if(this.peek().t!=="eof")this.error("LIPS-E003",`Unexpected token '${this.peek().value}' after expression`);return J}isArrowAhead(){let J=this.peek();if(J.t==="id"){let X=this.peek(1);return X.t==="punct"&&X.value==="=>"}if(J.t==="punct"&&J.value==="("){let X=0,$=0;while(!0){let Q=this.peek($);if(Q.t==="eof")return!1;if(Q.t==="punct"&&Q.value==="(")X++;if(Q.t==="punct"&&Q.value===")"){if(X--,X===0){let Y=this.peek($+1);return Y.t==="punct"&&Y.value==="=>"}}$++}}return!1}assign(){if(this.isArrowAhead()){let $=[];if(this.peek().t==="id")$.push(this.next().value);else{this.expect("(","LIPS-E004");while(!this.at(")")&&this.peek().t!=="eof"){let Q=this.next();if(Q.t!=="id")return this.error("LIPS-E005","Invalid arrow parameter",Q);if($.push(Q.value),!this.eat(","))break}this.expect(")","LIPS-E004")}return this.expect("=>","LIPS-E004"),{t:"arrow",params:$,body:this.assign()}}let J=this.conditional(),X=this.peek();if(X.t==="punct"&&["=","+=","-=","*=","/=","%="].includes(X.value)){if(J.t!=="id"&&J.t!=="member")return this.error("LIPS-E006","Invalid assignment target",X);return this.next(),{t:"assign",op:X.value,target:J,value:this.assign()}}return J}conditional(){let J=this.nullish();if(this.eat("?")){let X=this.assign();return this.expect(":","LIPS-E007"),{t:"cond",test:J,cons:X,alt:this.assign()}}return J}nullish(){let J=this.or();while(this.at("??"))this.next(),J={t:"logic",op:"??",l:J,r:this.or()};return J}or(){let J=this.and();while(this.at("||"))this.next(),J={t:"logic",op:"||",l:J,r:this.and()};return J}and(){let J=this.equality();while(this.at("&&"))this.next(),J={t:"logic",op:"&&",l:J,r:this.equality()};return J}equality(){let J=this.relational();while(["===","!==","==","!="].some((X)=>this.at(X)))J={t:"bin",op:this.next().value,l:J,r:this.relational()};return J}relational(){let J=this.additive();while(["<=",">=","<",">"].some((X)=>this.at(X)))J={t:"bin",op:this.next().value,l:J,r:this.additive()};return J}additive(){let J=this.multiplicative();while(this.at("+")||this.at("-"))J={t:"bin",op:this.next().value,l:J,r:this.multiplicative()};return J}multiplicative(){let J=this.unary();while(this.at("*")||this.at("/")||this.at("%"))J={t:"bin",op:this.next().value,l:J,r:this.unary()};return J}unary(){if(this.at("!")||this.at("-")||this.at("+"))return{t:"unary",op:this.next().value,arg:this.unary()};if(this.at("++")||this.at("--")){let J=this.next().value,X=this.unary();if(X.t!=="id"&&X.t!=="member")return this.error("LIPS-E006","Invalid update target");return{t:"update",op:J,arg:X,prefix:!0}}return this.postfix()}postfix(){let J=this.callMember();if(this.at("++")||this.at("--")){let X=this.next().value;if(J.t!=="id"&&J.t!=="member")return this.error("LIPS-E006","Invalid update target");J={t:"update",op:X,arg:J,prefix:!1}}return J}callMember(){let J=this.primary();while(!0)if(this.eat(".")){let X=this.next();if(X.t!=="id")return this.error("LIPS-E008","Expected property name",X);J={t:"member",obj:J,prop:X.value,computed:!1,optional:!1}}else if(this.eat("?."))if(this.at("("))J={t:"call",callee:J,args:this.argList(),optional:!0};else if(this.eat("[")){let X=this.assign();this.expect("]","LIPS-E009"),J={t:"member",obj:J,prop:X,computed:!0,optional:!0}}else{let X=this.next();if(X.t!=="id")return this.error("LIPS-E008","Expected property name",X);J={t:"member",obj:J,prop:X.value,computed:!1,optional:!0}}else if(this.eat("[")){let X=this.assign();this.expect("]","LIPS-E009"),J={t:"member",obj:J,prop:X,computed:!0,optional:!1}}else if(this.at("("))J={t:"call",callee:J,args:this.argList(),optional:!1};else break;return J}argList(){this.expect("(","LIPS-E010");let J=[];while(!this.at(")")&&this.peek().t!=="eof")if(J.push(this.assign()),!this.eat(","))break;return this.expect(")","LIPS-E010"),J}primary(){let J=this.peek();if(J.t==="num")return this.next(),{t:"lit",v:parseFloat(J.value)};if(J.t==="str")return this.next(),{t:"lit",v:J.value};if(J.t==="id")switch(this.next(),J.value){case"true":return{t:"lit",v:!0};case"false":return{t:"lit",v:!1};case"null":return{t:"lit",v:null};case"undefined":return{t:"lit",v:void 0};case"NaN":return{t:"lit",v:NaN};case"Infinity":return{t:"lit",v:1/0};default:return{t:"id",name:J.value}}if(this.eat("(")){let X=this.assign();return this.expect(")","LIPS-E010"),X}if(this.eat("[")){let X=[];while(!this.at("]")&&this.peek().t!=="eof"){let $=this.eat("...");if(X.push({spread:$||void 0,value:this.assign()}),!this.eat(","))break}return this.expect("]","LIPS-E009"),{t:"arr",items:X}}if(this.eat("{")){let X=[];while(!this.at("}")&&this.peek().t!=="eof"){if(this.eat("..."))X.push({spread:!0,value:this.assign()});else{let $=this.next();if($.t!=="id"&&$.t!=="str"&&$.t!=="num")return this.error("LIPS-E011","Invalid object key",$);if(this.eat(":"))X.push({key:String($.value),value:this.assign()});else if($.t==="id")X.push({key:$.value,value:{t:"id",name:$.value}});else return this.error("LIPS-E011","Invalid shorthand property",$)}if(!this.eat(","))break}return this.expect("}","LIPS-E011"),{t:"obj",props:X}}return this.next(),this.error("LIPS-E012",J.t==="eof"?"Unexpected end of expression":`Unexpected token '${J.value}'`,J)}}function p(J){let X=[],$=SX(J,X);return{ast:new JX($,X).parse(),diagnostics:X}}var XX={static:"__static",arguments:"__args__"};function C(J){switch(J.t){case"lit":if(typeof J.v==="string")return JSON.stringify(J.v);if(J.v===void 0)return"undefined";if(Number.isNaN(J.v))return"NaN";return String(J.v);case"id":return XX[J.name]??J.name;case"member":{let X=C(J.obj);if(J.computed)return`(${X})${J.optional?"?.":""}[${C(J.prop)}]`;return`(${X})${J.optional?"?.":"."}${J.prop}`}case"call":return`(${C(J.callee)})${J.optional?"?.":""}(${J.args.map(C).join(",")})`;case"unary":return`(${J.op}(${C(J.arg)}))`;case"update":return J.prefix?`(${J.op}${RJ(J.arg)})`:`(${RJ(J.arg)}${J.op})`;case"bin":return`((${C(J.l)})${J.op}(${C(J.r)}))`;case"logic":return`((${C(J.l)})${J.op}(${C(J.r)}))`;case"cond":return`((${C(J.test)})?(${C(J.cons)}):(${C(J.alt)}))`;case"assign":return`(${RJ(J.target)}${J.op}(${C(J.value)}))`;case"arrow":return`((${J.params.join(",")})=>(${C(J.body)}))`;case"arr":return`[${J.items.map((X)=>(X.spread?"...":"")+C(X.value)).join(",")}]`;case"obj":return`({${J.props.map((X)=>X.spread?`...${C(X.value)}`:`${JSON.stringify(X.key)}:${C(X.value)}`).join(",")}})`;case"error":return"undefined"}}function RJ(J){if(J.t==="id")return XX[J.name]??J.name;if(J.t==="member"){let X=C(J.obj);return J.computed?`${X}[${C(J.prop)}]`:`${X}.${J.prop}`}return C(J)}var tJ=new Map,NX=["state","input","context","__static","self"];function _J(J,X=[]){let $=`${X.join(",")}\x00${J}`,Q=tJ.get($);if(Q)return Q;let{ast:Y,diagnostics:Z}=p(J);if(Z.length)console.warn(`[lips-ir] expression diagnostics for "${J}":`,Z);let V=`return (${C(Y)});`,F=[...NX,"__args__",...X],D=Function(...F,V),W={source:J,run(q){let K=q.scope||{};return D(q.state,q.input,q.context,q.static,q.self,q.arguments,...X.map((G)=>K[G]))}};return tJ.set($,W),W}var eJ={Math,JSON,Object,Array,String,Number,Boolean,Date,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,console};function TJ(J,X){let $=X.scope||{},Q=(F,D)=>{for(let W of D)if(F in W)return W[F];if(F in $)return $[F];switch(F){case"state":return X.state;case"input":return X.input;case"context":return X.context;case"static":return X.static;case"self":return X.self;case"arguments":return X.arguments}if(F in eJ)return eJ[F];return},Y=(F,D,W)=>{for(let q of W)if(F in q)return q[F]=D,D;return $[F]=D,D},Z=(F,D)=>{switch(F.t){case"lit":return F.v;case"id":return Q(F.name,D);case"member":{let W=Z(F.obj,D);if(F.optional&&W==null)return;let q=F.computed?Z(F.prop,D):F.prop;return W?.[q]}case"call":{if(F.callee.t==="member"){let q=Z(F.callee.obj,D);if((F.callee.optional||F.optional)&&q==null)return;let K=F.callee.computed?Z(F.callee.prop,D):F.callee.prop,G=q?.[K];if(F.optional&&G==null)return;return G.apply(q,F.args.map((U)=>Z(U,D)))}let W=Z(F.callee,D);if(F.optional&&W==null)return;return W(...F.args.map((q)=>Z(q,D)))}case"unary":{let W=Z(F.arg,D);switch(F.op){case"!":return!W;case"-":return-W;case"+":return+W}}case"update":{let W=Z(F.arg,D),q=F.op==="++"?W+1:W-1;return V(F.arg,q,D),F.prefix?q:W}case"bin":{let W=Z(F.l,D),q=Z(F.r,D);switch(F.op){case"+":return W+q;case"-":return W-q;case"*":return W*q;case"/":return W/q;case"%":return W%q;case"<":return W<q;case">":return W>q;case"<=":return W<=q;case">=":return W>=q;case"==":return W==q;case"!=":return W!=q;case"===":return W===q;case"!==":return W!==q}return}case"logic":{let W=Z(F.l,D);switch(F.op){case"&&":return W?Z(F.r,D):W;case"||":return W?W:Z(F.r,D);case"??":return W!=null?W:Z(F.r,D)}}case"cond":return Z(F.test,D)?Z(F.cons,D):Z(F.alt,D);case"assign":{let W=Z(F.value,D);if(F.op!=="="){let q=Z(F.target,D);switch(F.op){case"+=":W=q+W;break;case"-=":W=q-W;break;case"*=":W=q*W;break;case"/=":W=q/W;break;case"%=":W=q%W;break}}return V(F.target,W,D)}case"arrow":return(...W)=>{let q={};return F.params.forEach((K,G)=>q[K]=W[G]),Z(F.body,[q,...D])};case"arr":{let W=[];for(let q of F.items){let K=Z(q.value,D);q.spread?W.push(...K):W.push(K)}return W}case"obj":{let W={};for(let q of F.props)if(q.spread)Object.assign(W,Z(q.value,D));else W[q.key]=Z(q.value,D);return W}case"error":return}},V=(F,D,W)=>{if(F.t==="id")return Y(F.name,D,W);if(F.t==="member"){let q=Z(F.obj,W),K=F.computed?Z(F.prop,W):F.prop;if(q!=null)q[K]=D;return D}return D};return Z(J,[])}var k=null;function S(J){let X=new Set,$=()=>{for(let V of[...X])!V.disposed&&V.run()};return[()=>{if(k&&!k.disposed)X.add(k),k.deps.add(X);return J},(V)=>{if(Object.is(V,J))return;J=V,$()},()=>$()]}function E(J){let X={deps:new Set,disposed:!1,run(){if(X.disposed)return;for(let Q of X.deps)Q.delete(X);X.deps.clear();let $=k;k=X;try{J()}finally{k=$}}};return X.run(),{dispose(){X.disposed=!0;for(let $ of X.deps)$.delete(X);X.deps.clear()}}}function x(J){let X=k;k=null;try{return J()}finally{k=X}}var $X=Symbol("lips.reactive");function g(J,X=!1){if(J[$X])return J;let $=new Map,Q=X?new WeakMap:null,Y=(D,W)=>{let q=$.get(D);if(!q)q=S(W),$.set(D,q);return q},Z=(D)=>D!==null&&typeof D==="object"&&(Array.isArray(D)||Object.getPrototypeOf(D)===Object.prototype),V=new Set(["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"]),F=(D,W)=>{if(!X||!Z(D))return D;let q=Q.get(D);if(q)return q;let K=!1,G=new Proxy(D,{get(U,M){let H=U[M];if(Array.isArray(U)&&typeof M==="string"&&V.has(M)&&typeof H==="function")return(...O)=>{K=!0;try{return H.apply(U,O)}finally{K=!1,W()}};return Z(H)?F(H,W):H},set(U,M,H){return U[M]=H,!K&&W(),!0},deleteProperty(U,M){return delete U[M],!K&&W(),!0}});return Q.set(D,G),G};return new Proxy(J,{get(D,W){if(W===$X)return!0;if(typeof W==="string"){let q=Y(W,D[W]);return F(q[0](),q[2])}return D[W]},set(D,W,q){return D[W]=q,typeof W==="string"&&Y(W,q)[1](q),!0},has(D,W){return W in D},deleteProperty(D,W){return delete D[W],typeof W==="string"&&$.get(W)?.[1](void 0),!0}})}var d=(J,X)=>J==null?J:("e"in J)?{$:X[J.e]}:J,AJ=(J,X)=>({...J,e:X[J.e]});function KJ(J,X){switch(J.t){case"macro":return{t:J.t,name:J.name,args:J.args,vars:Object.fromEntries(Object.entries(J.vars).map(([$,Q])=>[$,d(Q,X)])),block:h(J.block,X)};case"if":return{t:J.t,branches:J.branches.map(($)=>({when:$.when==null?null:X[$.when],block:h($.block,X)}))};case"for":return{t:J.t,args:J.args,of:J.of===void 0?void 0:X[J.of],from:d(J.from,X),to:d(J.to,X),by:d(J.by,X),block:h(J.block,X)};case"switch":return{t:J.t,on:X[J.on],cases:J.cases.map(($)=>({is:$.is===null?null:d($.is,X),block:h($.block,X)}))};case"async":return{t:J.t,awaitE:X[J.awaitE],then:J.then&&{args:J.then.args,block:h(J.then.block,X)},catch:J.catch&&{args:J.catch.args,block:h(J.catch.block,X)},loading:J.loading&&h(J.loading,X)};case"let":return{t:J.t,const:J.const,vars:Object.fromEntries(Object.entries(J.vars).map(([$,Q])=>[$,d(Q,X)]))};case"log":return{t:J.t,e:X[J.e]};case"comp":case"dynamic":return{t:J.t,name:J.t==="comp"?J.name:void 0,tag:J.t==="dynamic"?X[J.tag]:void 0,inputs:Object.fromEntries(Object.entries(J.inputs).map(([$,Q])=>[$,d(Q,X)])),spreads:J.spreads.map(($)=>X[$]),events:J.events.map(($)=>({name:$.name,e:X[$.e]})),contents:J.contents&&{args:J.contents.args,block:h(J.contents.block,X)}}}}var h=(J,X)=>({html:J.html,scope:J.scope,binds:J.binds.map(($)=>AJ($,X)),blocks:J.blocks.map(($)=>KJ($,X))}),QX=(J,X,$,Q)=>J.t===$.t&&JSON.stringify(KJ(J,X))===JSON.stringify(KJ($,Q)),ZX=(J,X,$,Q)=>JSON.stringify(J.map((Y)=>AJ(Y,X)))===JSON.stringify($.map((Y)=>AJ(Y,Q))),YX=(J,X,$,Q)=>{let Y=(Z,V)=>JSON.stringify(Z.blocks.filter((F)=>F.t==="let").map((F)=>KJ(F,V)));return Y(J,X)===Y($,Q)};var DX=Symbol("lips.slot"),wX=(J)=>!!J&&typeof J==="object"&&J[DX]===!0;function KX(J){let X=!1,$=!1,Q=(Y)=>typeof J.onError==="function"?J.onError(Y):console.error("[lips:ir]",Y);return{onError:Q,ready(){$=!0},notifyUpdate(){if(!$||X)return;X=!0,queueMicrotask(()=>{X=!1;try{typeof J.onUpdate==="function"&&J.onUpdate(),typeof J.onRender==="function"&&J.onRender()}catch(Y){Q(Y)}})}}}var GJ=[];function UX(){for(let J=GJ.length-1;J>=0;J--){let X=GJ[J],$=X.node();if($&&$.isConnected)GJ.splice(J,1),X.fn()}}var FX=new Map;function yX(J){let X=FX.get(J);if(!X)X=p(J).ast,FX.set(J,X);return X}var WX=new WeakMap;function xX(J){let X=WX.get(J);if(!X)X=document.createElement("template"),X.innerHTML=J.html,WX.set(J,X);return X}var t=(J)=>J.join(",");function VX(J,X){let $=J;for(let Q of X)$=$.childNodes[Q];return $}function N(J){let X=[],$=J.start;while($){if(X.push($),$===J.end)break;$=$.nextSibling}return X}function f(J,X){let $=J.parentNode;if(!$)return;let Q=J;for(let Y of X)$.insertBefore(Y,Q.nextSibling),Q=Y}function GX(J,X,$,Q){for(let Z of N(X))if(Z.nodeType===1&&!Z.hasAttribute("rel"))Z.setAttribute("rel",$);let Y=J.createStylesheet?.($,Q);return Y?()=>Y.clear():void 0}function gX(J){for(let X of J.bindHandles)X.dispose();for(let X of J.childHandles)X.dispose()}function A(J){if(!J)return;gX(J);for(let X of N(J))X.remove()}function qX(J){let X=[],$=0,Q=0;for(let Y=0;Y<J.length;Y++){let Z=J[Y];if(Z==="'"||Z==='"'||Z==="`"){Y++;while(Y<J.length&&J[Y]!==Z){if(J[Y]==="\\")Y++;Y++}continue}if(Z==="("||Z==="["||Z==="{")$++;else if(Z===")"||Z==="]"||Z==="}")$--;else if(Z===","&&$===0)X.push(J.slice(Q,Y)),Q=Y+1}return X.push(J.slice(Q)),X.map((Y)=>Y.trim()).filter(Boolean)}var UJ=(J,X,$)=>{$===!1||$==null?J.removeAttribute(X):J.setAttribute(X,$===!0?"":String($))},i=(J,X,$)=>Object.defineProperty(J,X,{get:$,enumerable:!0,configurable:!0});class zJ{ir;options;hooks;constructor(J,X,$){this.ir=J;this.options=X;this.hooks=$}guarded(J){let X=!0;return E(()=>{try{J()}catch($){this.hooks?this.hooks.onError($):console.error("[lips:ir]",$)}X?X=!1:this.hooks?.notifyUpdate()})}runner(J,X){return this.srcRunner(this.ir.exprs[J],X)}srcRunner(J,X){if(this.options.mode==="interpreted"){let Q=yX(J);return(Y)=>TJ(Q,Y)}let $=_J(J,X);return(Q)=>$.run(Q)}renderBlock(J,X){let $=xX(J).content.cloneNode(!0),Q=new Map,Y=J.binds.map((K)=>{let G=VX($,K.p);return Q.set(t(K.p),G),G}),Z=J.blocks.map((K)=>{let G=VX($,K.p);return Q.set(t(K.p),G),G}),V=document.createComment("^"),F=document.createComment("$");$.insertBefore(V,$.firstChild),$.appendChild(F);let D=Object.create(X.scope??null),W={...X,scope:D},q={start:V,end:F,block:J,exprs:this.ir.exprs,penv:X,benv:W,pathNodes:Q,bindHandles:[],childHandles:[]};return J.blocks.forEach((K,G)=>{if(K.t!=="let")return;let U=[];for(let[M,H]of Object.entries(K.vars))if("lit"in H){let[O]=S(H.lit);i(D,M,O)}else{let[O,z]=S(void 0);i(D,M,O);let P=this.runner(H.e,J.scope);U.push(E(()=>z(P(W))).dispose)}q.childHandles[G]={child:K,exprs:this.ir.exprs,anchor:Z[G],dispose:()=>U.forEach((M)=>M())}}),q.bindHandles=J.binds.map((K,G)=>this.bindOne(K,Y[G],W,J.scope)),J.blocks.forEach((K,G)=>{if(K.t==="let")return;q.childHandles[G]={child:K,exprs:this.ir.exprs,anchor:Z[G],dispose:this.execBlock(K,Z[G],W,J.scope)}}),q}bindOne(J,X,$,Q,Y){switch(J.t){case"text":{let Z=Y??document.createTextNode("");!Y&&f(X,[Z]);let V=this.runner(J.e,Q),F=J.i18n?this.options.i18n:void 0,D=this.guarded(()=>{let W=V($),q=W==null?"":String(W);Z.data=F?F.translate(q):q});return{bind:J,node:X,textNode:Z,dispose:D.dispose}}case"attr":{let Z=this.runner(J.e,Q),V=J.i18n?this.options.i18n:void 0,F=this.guarded(()=>{let D=Z($);UJ(X,J.name,V&&D!=null?V.translate(String(D)):D)});return{bind:J,node:X,dispose:F.dispose}}case"prop":{let Z=this.runner(J.e,Q);if(J.name==="format"){let F=J.ref||"",D=this.guarded(()=>{let W=Z($),q=this.options.i18n?.format(F,W);X.textContent=q==null?"":String(q)});return{bind:J,node:X,dispose:D.dispose}}let V=this.guarded(()=>{let F=Z($);J.name==="html"?X.innerHTML=F==null?"":String(F):X.textContent=F==null?"":String(F)});return{bind:J,node:X,dispose:V.dispose}}case"event":{let Z=this.eventDispatcher(this.ir.exprs[J.e],Q,$);return X.addEventListener(J.name,Z),{bind:J,node:X,dispose:()=>X.removeEventListener(J.name,Z)}}case"spread":{let Z=this.runner(J.e,Q),V=new Set,F=this.guarded(()=>{let D=Z($)||{},W=new Set(Object.keys(D));for(let q of V)!W.has(q)&&X.removeAttribute(q);for(let q of W)UJ(X,q,D[q]);V=W});return{bind:J,node:X,dispose:F.dispose}}}}swapBlock(J,X,$,Q){if(J.block.html!==X.html||JSON.stringify(J.block.scope)!==JSON.stringify(X.scope)||!YX(J.block,J.exprs,X,this.ir.exprs))return this.rebuild(J,X,$,Q);if(!ZX(J.block.binds,J.exprs,X.binds,this.ir.exprs)){let Y=X.binds.map((F)=>J.pathNodes.get(t(F.p)));if(Y.some((F)=>!F))return this.rebuild(J,X,$,Q);let Z=new Map;J.bindHandles.forEach((F)=>F.textNode&&Z.set(t(F.bind.p),F.textNode)),J.bindHandles.forEach((F)=>F.dispose());let V=new Set;J.bindHandles=X.binds.map((F,D)=>{let W=t(F.p),q=F.t==="text"?Z.get(W):void 0;return q&&V.add(W),this.bindOne(F,Y[D],J.benv,X.scope,q)}),Z.forEach((F,D)=>!V.has(D)&&F.remove()),$.push({kind:"binds",path:Q})}for(let Y=0;Y<X.blocks.length;Y++){let Z=X.blocks[Y],V=J.childHandles[Y];if(Z.t==="let")continue;if(V&&QX(V.child,V.exprs,Z,this.ir.exprs))continue;V?.dispose(),J.childHandles[Y]={child:Z,exprs:this.ir.exprs,anchor:V.anchor,dispose:this.execBlock(Z,V.anchor,J.benv,X.scope)},$.push({kind:"block",path:`${Q}/${Y}`})}return J.block=X,J.exprs=this.ir.exprs,J}rebuild(J,X,$,Q){let Y=this.renderBlock(X,J.penv);return f(J.end,N(Y)),A(J),$.push({kind:"skeleton",path:Q}),Y}execBlock(J,X,$,Q){let Y=[];switch(J.t){case"if":{let Z=J.branches.map((W)=>W.when!=null?this.runner(W.when,Q):null),V=null,F=-2,D=E(()=>{let W=-1;for(let q=0;q<J.branches.length;q++){let K=Z[q];if(!K||K($)){W=q;break}}if(W===F)return;F=W,x(()=>{if(A(V),V=null,W>=0)V=this.renderBlock(J.branches[W].block,$),f(X,N(V))})});Y.push(()=>{D.dispose(),A(V)});break}case"switch":{let Z=this.runner(J.on,Q),V=J.cases.map((q)=>q.is&&("e"in q.is)?this.runner(q.is.e,Q):null),F=null,D=-2,W=E(()=>{let q=Z($),K=-1,G=-1;for(let U=0;U<J.cases.length;U++){let M=J.cases[U];if(M.is===null){G=U;continue}let H="lit"in M.is?M.is.lit:V[U]($);if(Array.isArray(H)?H.includes(q):H===q){K=U;break}}if(K===-1)K=G;if(K===D)return;D=K,x(()=>{if(A(F),F=null,K>=0)F=this.renderBlock(J.cases[K].block,$),f(X,N(F))})});Y.push(()=>{W.dispose(),A(F)});break}case"macro":{let Z=Object.create($.scope??null),V=g({});for(let[D,W]of Object.entries(J.vars)){if("lit"in W){if(V[D]=W.lit,J.args.includes(D)){let[U]=S(W.lit);i(Z,D,U)}continue}let q=this.runner(W.e,Q),[K,G]=S(void 0);if(J.args.includes(D))i(Z,D,K);Y.push(E(()=>{let U=q($);G(U),V[D]=U}).dispose)}let F=this.renderBlock(J.block,{...$,arguments:V,scope:Z});f(X,N(F)),Y.push(()=>A(F));break}case"for":this.execFor(J,X,$,Q,Y);break;case"async":{let Z=this.runner(J.awaitE,Q),V=null,F=0,D=(q,K)=>{if(A(V),V=null,!q)return;let G="block"in q,U=Object.create($.scope??null);if(G&&q.args[0]!==void 0){let[M]=S(K);i(U,q.args[0],M)}V=this.renderBlock(G?q.block:q,{...$,scope:U}),f(X,N(V))},W=E(()=>{let q=Z($),K=++F;x(()=>{J.loading?D(J.loading):D(void 0),Promise.resolve(q).then((G)=>K===F&&x(()=>D(J.then,G)),(G)=>K===F&&x(()=>D(J.catch,G)))})});Y.push(()=>{F++,W.dispose(),A(V)});break}case"log":{let Z=qX(this.ir.exprs[J.e]).map((V)=>this.srcRunner(V,Q));Y.push(E(()=>console.log(...Z.map((V)=>V($)))).dispose);break}case"comp":{let Z=this.options.components?.[J.name];Z?this.execComponent(Z,J,X,$,Q,Y):this.execElement(J,X,$,Q,Y);break}case"dynamic":{let Z=this.runner(J.tag,Q),V=[],F=Symbol("init"),D=E(()=>{let W=Z($);if(W===F)return;F=W,x(()=>{for(let K of V)K();if(V=[],W==null)return;if(wX(W)){let K={};for(let[U,M]of Object.entries(J.inputs))K[U]="lit"in M?M.lit:this.runner(M.e,Q)($);let G=W.render(K);f(X,N(G)),V.push(()=>A(G));return}let q=typeof W==="string"?this.options.components?.[W]:W&&typeof W==="object"?W.ir?W:this.options.resolveTemplate?.(W):void 0;if(q)this.execComponent(q,J,X,$,Q,V);else if(typeof W==="string")this.execElement({...J,name:W},X,$,Q,V)})});Y.push(()=>{D.dispose();for(let W of V)W()});break}}return()=>Y.forEach((Z)=>Z())}execFor(J,X,$,Q,Y){let Z=J.of!==void 0?this.runner(J.of,Q):null,V=J.by&&"e"in J.by?this.runner(J.by.e,Q):null,F=J.by&&"lit"in J.by?String(J.by.lit).split("."):null,D=(U,M)=>U===void 0?void 0:("lit"in U)?U.lit:this.runner(U.e,Q)(M),W=[],q=new Map,K=()=>{if(Z===null){let H=Number(D(J.from,$)??0),O=Number(D(J.to,$)??H),z=H<=O,P=[];for(let B=H;z?B<=O:B>=O;z?B++:B--)P.push({key:B,values:[B]});return P}let U=Z($),M=(H,O,z)=>{if(V){let P=V($);return typeof P==="function"?P(H,z):O}if(F)return F.reduce((P,B)=>P?.[B],H);return O};if(Array.isArray(U))return U.map((H,O)=>({key:M(H,O,O),values:[H,O]}));if(U instanceof Map)return[...U.entries()].map(([H,O],z)=>({key:H,values:[H,O,z]}));if(U&&typeof U==="object")return Object.entries(U).map(([H,O],z)=>({key:H,values:[H,O,z]}));return[]},G=E(()=>{let U=K();x(()=>{let M=new Set,H=[];for(let z of U){let P=z.key;if(M.has(P))console.warn(`<for> duplicate key '${String(P)}' — falling back to positional identity`),P=`#dup:${H.length}`;M.add(P);let B=q.get(P);if(B)B.sigs.forEach(([_,j,R],L)=>{let m=z.values[L];Object.is(_(),m)&&typeof m==="object"&&m!==null?R():j(m)}),H.push(B);else{let _=Object.create($.scope??null),j=z.values.map((m)=>S(m));J.args.forEach((m,yJ)=>j[yJ]&&i(_,m,j[yJ][0]));let R=this.renderBlock(J.block,{...$,scope:_}),L={key:P,sigs:j,inst:R};q.set(P,L),H.push(L)}}for(let z of W)if(!H.includes(z))q.delete(z.key),A(z.inst);let O=X;for(let z of H){if(O.nextSibling!==z.inst.start)f(O,N(z.inst));O=z.inst.end}W=H})});Y.push(()=>{G.dispose();for(let U of W)A(U.inst);W=[],q.clear()})}execComponent(J,X,$,Q,Y,Z){let V=g({});for(let[z,P]of Object.entries(X.inputs))if("lit"in P)V[z]=P.lit;else{let B=this.runner(P.e,Y);Z.push(E(()=>V[z]=B(Q)).dispose)}for(let z of X.spreads){let P=this.runner(z,Y);Z.push(E(()=>{let B=P(Q)||{};x(()=>Object.entries(B).forEach(([_,j])=>V[_]=j))}).dispose)}if(X.contents){let z=this,P=X.contents,B=Q;V.renderer={[DX]:!0,args:P.args,render(_){let j=Object.create(B.scope??null);return P.args.forEach((R)=>{let[L]=S(_?.[R]);i(j,R,L)}),z.renderBlock(P.block,{...B,scope:j})}}}let F=g({...J.state||{}},J.deep??!1),D=new Map,W={...this.options.expose||{},state:F,input:V,static:J.statics,context:Q.context,emit(z,...P){D.get(z)?.forEach((B)=>B(...P))},on(z,P){return D.set(z,[...D.get(z)||[],P]),W},off(z){return D.delete(z),W}};J.handlers&&Object.entries(J.handlers).forEach(([z,P])=>W[z]=P.bind(W)),X.events?.forEach((z)=>{let P=this.eventDispatcher(this.ir.exprs[z.e],Y,Q);W.on(z.name,P)});let q=KX(W);try{typeof W.onCreate==="function"&&W.onCreate()}catch(z){q.onError(z)}try{Object.keys(V).length&&typeof W.onInput==="function"&&W.onInput()}catch(z){q.onError(z)}let K={state:F,input:V,context:Q.context,static:J.statics,self:W,scope:void 0},U=new zJ(J.ir,this.options,q).renderBlock(J.ir.root,K),M=J.stylesheet?GX(this.options,U,J.nsp||"lips",J.stylesheet):void 0;f($,N(U)),q.ready();try{typeof W.onMount==="function"&&W.onMount(),typeof W.onRender==="function"&&W.onRender()}catch(z){q.onError(z)}let H;if(J.context?.length&&typeof W.onContext==="function"&&this.options.watchContext)H=this.options.watchContext(J.context,()=>{try{W.onContext()}catch(z){q.onError(z)}});let O=!1;if(typeof W.onAttach==="function"||typeof W.onDetach==="function")GJ.push({node:()=>U.start,fn:()=>{O=!0;try{typeof W.onAttach==="function"&&W.onAttach()}catch(z){q.onError(z)}}}),U.start.isConnected&&UX();Z.push(()=>{H?.(),M?.(),A(U);try{O&&typeof W.onDetach==="function"&&W.onDetach(),typeof W.onDestroy==="function"&&W.onDestroy()}catch(z){q.onError(z)}})}execElement(J,X,$,Q,Y){let Z=document.createElement(J.name);for(let[V,F]of Object.entries(J.inputs))if("lit"in F)UJ(Z,V,F.lit);else{let D=this.runner(F.e,Q);Y.push(E(()=>UJ(Z,V,D($))).dispose)}for(let V of J.events){let F=this.eventDispatcher(this.ir.exprs[V.e],Q,$);Z.addEventListener(V.name,F),Y.push(()=>Z.removeEventListener(V.name,F))}if(J.contents){let V=this.renderBlock(J.contents.block,$);Z.append(...N(V)),Y.push(()=>A(V))}f(X,[Z]),Y.push(()=>Z.remove())}eventDispatcher(J,X,$){let Q=qX(J);return(...Y)=>x(()=>{let Z=(D)=>{let W;try{W=this.srcRunner(D,X)($)}catch(q){W=void 0}if(typeof W!=="function"&&$.self&&typeof $.self[D]==="function")W=$.self[D];return W};if(!Q.length)return;let V=Z(Q[0]);if(typeof V!=="function")return;let F=Q.slice(1).map((D)=>this.srcRunner(D,X)($));V(...F,...Y)})}}function HJ(J,X={},$={}){let Q=g(X.state||{},X.deep??!1),Y=X.input?g(X.input,X.deep??!1):void 0,Z={state:Q,input:Y,static:X.static,...X.expose||{}};X.handlers&&Object.entries(X.handlers).forEach(([U,M])=>Z[U]=M.bind(Z));let V={state:Q,input:Y,context:X.context,static:X.static,self:Z,scope:void 0},F=KX(Z);try{typeof Z.onCreate==="function"&&Z.onCreate()}catch(U){F.onError(U)}try{Y&&Object.keys(Y).length&&typeof Z.onInput==="function"&&Z.onInput()}catch(U){F.onError(U)}let D=new zJ(J,$,F),W=D.renderBlock(J.root,V);F.ready();let q=X.stylesheet?GX($,W,X.nsp||"lips",X.stylesheet):void 0;try{typeof Z.onMount==="function"&&Z.onMount(),typeof Z.onRender==="function"&&Z.onRender()}catch(U){F.onError(U)}let K=!1,G=()=>{if(K)return;K=!0;try{typeof Z.onAttach==="function"&&Z.onAttach()}catch(U){F.onError(U)}};return{state:Q,self:Z,get nodes(){return N(W)},mount(U){if(U.append(...N(W)),W.start.isConnected)G(),UX()},swap(U){let M=[];return D=new zJ(U,$,F),W=D.swapBlock(W,U.root,M,"root"),{changes:M}},dispose(){q?.(),A(W);try{K&&typeof Z.onDetach==="function"&&Z.onDetach(),typeof Z.onDestroy==="function"&&Z.onDestroy()}catch(U){F.onError(U)}}}}class MJ{options={emit:!0};__events={};__once_events={};constructor(J){if(J)this.options=J}on(J,X){if(!Array.isArray(this.__events[J]))this.__events[J]=[];return this.__events[J].push(X),this}once(J,X){if(!Array.isArray(this.__once_events[J]))this.__once_events[J]=[];return this.__once_events[J].push(X),this}off(J,X){if(X){if(Array.isArray(this.__events[J]))this.__events[J]=this.__events[J].filter(($)=>$!==X),!this.__events[J].length&&delete this.__events[J];if(Array.isArray(this.__once_events[J]))this.__once_events[J]=this.__once_events[J].filter(($)=>$!==X),!this.__once_events[J].length&&delete this.__once_events[J]}else delete this.__events[J],delete this.__once_events[J];return this}emit(J,...X){if(!this.options.emit)return;let $=(Y)=>{if(!Y||typeof Y!=="object")return Y;if(typeof Y.toJSON==="function")return Y.toJSON();if(Array.isArray(Y))return Y.map($);if(Y.constructor===Object||Y.constructor===void 0){let Z={};for(let V in Y)Z[V]=$(Y[V]);return Z}return Y},Q=X.map($);this.__events[J]?.forEach((Y)=>Y(...Q)),this.__once_events[J]?.forEach((Y)=>Y(...Q)),delete this.__once_events[J]}}var SJ=null;function zX(J){SJ=J}class PJ{nsp;settings;constructor(J,X){if(typeof J!=="string"||!J)throw Error("Undefined or invalid stylesheet namespace");this.nsp=J,this.settings=X||{},this.settings.sheet&&this.load(this.settings)}get rel(){return`${this.settings.meta?"@":""}${this.nsp}`}get styleElement(){return document.head.querySelector(`style[rel="${this.rel}"]`)}load(J){if(this.settings=J,!J.sheet)return;if(!SJ){console.warn(`[lips] <${this.nsp}> stylesheet skipped — this build has no CSS preprocessor. `+'Use "@lipsjs/lips" (not "@lipsjs/lips/runtime") for source stylesheets.');return}let X=this.styleElement;if(X)return X.setAttribute("dindex",String(Number(X.getAttribute("dindex")||0)+1)),X;let $=J.meta?J.sheet:`[rel="${this.nsp}"] { ${J.sheet} }`,Q;try{Q=SJ($)}catch(Z){throw Error(`Style compilation failed: ${Z.message}`)}if(!Q)throw Error(`<${this.nsp}> stylesheet compilation produced no output`);let Y=document.createElement("style");return Y.setAttribute("rel",this.rel),Y.setAttribute("dindex","0"),Y.textContent=Q,J.meta?document.head.prepend(Y):document.head.appendChild(Y),Y}clear(){let J=this.styleElement;if(!J)return;let X=Number(J.getAttribute("dindex")||0);X<=0?J.remove():J.setAttribute("dindex",String(X-1))}}function LJ(J,X){if(typeof J!=="string")return"";if(!X)return J;return J.replace(/{(\w+)}/g,($,Q)=>{return X[Q]!==void 0?X[Q].toString():`{${Q}}`})}var HX=(J,X,$,Q,Y)=>{switch(J){case"plural":{if(typeof $==="string"){console.warn("Plural format value cannot be a string");return}if(Q.count===void 0){console.warn("Plural format requires <count> parameter or use * by default.");let F=$["*"];if(typeof F==="object")F=F[Y||"*"];return LJ(F,Q)}if(typeof Q.count==="string")Q.count=Number(Q.count);let Z="*";if(Q.count.toString()in $)Z=Q.count.toString();let V=$[Z]||$["*"];if(typeof V==="object")V=V[Y||"*"];return LJ(V,Q)}case"condition":{if(typeof $==="string"){console.warn("Condition format value cannot be a string");return}let Z;for(let V in $)try{if(Function("params",`with( params ){ return ${V}; }`)(Q||{})){Z=$[V];break}}catch(F){console.warn(`Invalid <${X}(${V})> condition expression`)}if(Z===void 0)return;if(typeof Z==="object")Z=Z[Y||"*"];return LJ(Z,Q)}case"variable":default:{let Z=typeof $==="object"?$[Y||"*"]:$;if(typeof Z==="object"){console.warn(`Invalid <${X}> variable variant definition`);return}return LJ(Z,Q)}}};class OJ{currentLang=window.navigator.language;DICTIONARIES={};set lang(J){if(this.currentLang===J)return;this.currentLang=J}get lang(){return this.currentLang}setDictionary(J,X){this.DICTIONARIES[J]=X}translate(J,X){if(X&&this.currentLang===X)return{text:J,lang:this.currentLang};X=X||this.currentLang;let[$,Q]=X.split("-");if(this.DICTIONARIES[$]&&J in this.DICTIONARIES[$]){if(typeof this.DICTIONARIES[$][J]==="object"){let Y=this.DICTIONARIES[$][J];J=Y[Q||"*"]||Y["*"]}else if(typeof this.DICTIONARIES[$][J]==="string")J=this.DICTIONARIES[$][J]}return{text:J,lang:X}}format(J,X,$){$=$||this.currentLang;let[Q,Y]=$.split("-");if(!this.DICTIONARIES[Q]){console.warn(`Undefined <${$}> format dictionary`);return}if(!this.DICTIONARIES[Q][J]){console.warn(`Undefined <${$}[${J}]> format reference`);return}let Z=this.DICTIONARIES[Q][J];if(typeof Z==="string"){console.warn(`Invalid <${$}[${J}]> format reference. Expected object`);return}if(typeof Z!=="object"||Z===null||Array.isArray(Z)){console.warn(`Invalid <${$}[${J}]> format value`);return}return HX(Z.type,J,Z.value,X,Y)}}var BJ=null;function MX(J){BJ=J}var PX={};function LX(J,X){PX[J]=X}var kX=new Set(["state","input","static","context","emit","on","once","off","node","destroy","appendTo","prependTo","replaceWith","render","swap"]);function OX(J){if(!J)return;for(let X of Object.keys(J))if(kX.has(X))throw Error(`Handler <${X}> is a reserved component member name`);return J}class BX extends MJ{lips;template;state;instance;contextWatcher;destroyed=!1;constructor(J,X,$,Q,Y,Z){super();this.lips=J;this.template=$;let V=OX($.handler);this.state=g({...$.state||{}},!0);let F=Q?g({...Q},!0):void 0;if(this.instance=HJ(Y,{state:this.state,input:F,context:J.getContext(),static:$._static,handlers:V,deep:!0,stylesheet:$.stylesheet,nsp:X,expose:{emit:(D,...W)=>this.emit(D,...W),context:J.getContext()}},Z),$.context?.length&&typeof V?.onContext==="function")this.contextWatcher=J.watchContext($.context,()=>{try{V.onContext.call(this.instance.self)}catch(D){console.error("[lips:ir]",D)}});this.emit("component:mount")}get node(){return this.instance.nodes}appendTo(J){let X=typeof J==="string"?document.querySelector(J):J;return X&&this.instance.mount(X),this}swap(J){return this.instance.swap(J)}destroy(){if(this.destroyed)return;this.destroyed=!0,this.contextWatcher?.(),this.instance.dispose(),this.emit("component:destroy")}}class NJ{config;debug;store=new Map;irCache=new WeakMap;defCache=new WeakMap;context;__root;i18n=new OJ;getLang;setLang;componentsProxy;constructor(J){this.config=J;this.debug=!!J?.debug,this.context=g({...J?.context||{}},!0);let[X,$]=S(this.i18n.lang);this.getLang=X,this.setLang=$,BJ&&Object.entries(PX).forEach(([Y,Z])=>this.register(Y,Z));let Q=this;this.componentsProxy=new Proxy({},{get(Y,Z){let V=Q.store.get(Z);return V?Q.defFor(Z,V):void 0},has(Y,Z){return Q.store.has(Z)}})}register(J,X){return this.store.set(J,X),this}unregister(J){return this.store.delete(J),this}has(J){return this.store.has(J)}compile(J){if(J.ir)return J.ir;let X=this.irCache.get(J);if(!X){if(!BJ)throw Error("This build has no template compiler — templates must be precompiled to `ir` "+'(import from "@lipsjs/lips" instead of "@lipsjs/lips/runtime")');let $=BJ(J.default||"",{macros:J.macros});$.diagnostics.length&&console.warn("[lips:ir] template diagnostics —",$.diagnostics),X=$.ir,this.irCache.set(J,X)}return X}defFor(J,X){let $=this.defCache.get(X);if(!$)$={ir:this.compile(X),state:X.state,statics:X._static,context:X.context,stylesheet:X.stylesheet,nsp:J,handlers:OX(X.handler),deep:!0},this.defCache.set(X,$);return $}render(J,X,$){return new BX(this,J,X,$,this.compile(X),{mode:this.config?.mode,components:this.componentsProxy,watchContext:(Q,Y)=>this.watchContext(Q,Y),resolveTemplate:(Q)=>Q&&(typeof Q.default==="string"||Q.ir)?this.defFor(Q.name||"dynamic",Q):void 0,expose:{setContext:(Q,Y)=>this.setContext(Q,Y)},createStylesheet:(Q,Y)=>{let Z=new PJ(Q,{sheet:Y});return{clear:()=>Z.clear()}},i18n:{translate:(Q)=>{return this.getLang(),this.i18n.translate(Q).text},format:(Q,Y)=>{return this.getLang(),this.i18n.format(Q,Y)??""}}})}root(J,X){return this.__root=this.render("__ROOT__",J),this.__root.appendTo(X),this.__root}setLanguage(J){this.i18n.lang=J,this.setLang(J)}getLanguage(){return this.getLang()}useTranslator(J,X){let $=!0,{dispose:Q}=E(()=>{let Y=this.getLang();if($){$=!1;return}(J==="*"||Array.isArray(J)&&J.includes(Y))&&X(Y)});return Q}getContext(){return this.context}setContext(J,X){typeof J==="string"?this.context[J]=X:Object.entries(J).forEach(([$,Q])=>this.context[$]=Q)}watchContext(J,X){let $=!0,{dispose:Q}=E(()=>{J.forEach((Y)=>this.context[Y]),$?$=!1:X()});return Q}useContext(J,X){return this.watchContext(J,()=>X(Object.fromEntries(J.map(($)=>[$,this.context[$]]))))}dispose(){this.__root?.destroy()}}var fX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bX=new Set(["pre","textarea"]),CX=new Set(["if","else-if","switch","log"]),uX={"&":"&","<":"<",">":">",""":'"',"'":"'"," ":" "};function CJ(J){return J.replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g,(X)=>uX[X])}class wJ{src;pos=0;lineStarts=null;diagnostics=[];constructor(J){this.src=J}locate(J){if(!this.lineStarts){this.lineStarts=[0];for(let Q=0;Q<this.src.length;Q++)if(this.src[Q]===`
|
|
3
|
+
`)this.lineStarts.push(Q+1)}let X=0,$=this.lineStarts.length-1;while(X<$){let Q=X+$+1>>1;this.lineStarts[Q]<=J?X=Q:$=Q-1}return{line:X+1,col:J-this.lineStarts[X]+1}}report(J,X,$,Q,Y=1,Z){let{line:V,col:F}=this.locate(Q);this.diagnostics.push({code:J,severity:X,message:$,hint:Z,loc:{line:V,col:F,offset:Q,length:Y}})}eof(){return this.pos>=this.src.length}peek(J=0){return this.src[this.pos+J]}startsWith(J){return this.src.startsWith(J,this.pos)}skipSpace(){while(!this.eof()&&/\s/.test(this.src[this.pos]))this.pos++}scanBalanced(J,X){let $=this.pos,Q=0;while(!this.eof()){let Y=this.src[this.pos];if(Y==="'"||Y==='"'||Y==="`"){this.pos++;while(!this.eof()&&this.src[this.pos]!==Y){if(this.src[this.pos]==="\\")this.pos++;this.pos++}this.pos++;continue}if(Q===0&&Y===J){let Z=this.src.slice($,this.pos);return this.pos++,{content:Z,loc:{offset:$,length:Z.length}}}if(Y==="("||Y==="["||Y==="{")Q++;else if(Y===")"||Y==="]"||Y==="}"){if(Q===0&&Y!==J){this.report(X,"error",`Unbalanced '${Y}'`,this.pos),this.pos++;continue}Q--}this.pos++}return this.report(X,"error",`Unterminated — expected '${J}'`,$,this.pos-$),null}parse(){let J=[];while(!this.eof())if(J.push(...this.parseNodes([])),this.startsWith("</")){let X=this.pos;this.pos+=2;while(!this.eof()&&this.peek()!==">")this.pos++;!this.eof()&&this.pos++,this.report("LIPS-P005","error",`Stray closing tag ${this.src.slice(X,this.pos)}`,X,this.pos-X)}return{root:{t:"fragment",children:J,loc:{offset:0,length:this.src.length}},diagnostics:this.diagnostics}}parseNodes(J){let X=[];while(!this.eof()){if(this.startsWith("</"))break;let $=this.pos;if(this.peek()==="<"&&this.peek(1)!==void 0){let Q=this.parseTag(J);Q&&X.push(Q)}else{let Q=this.parseText(J);Q&&X.push(Q)}if(this.pos===$)this.pos++}return X}parseText(J){let X=this.pos,$=[],Q="";while(!this.eof()&&this.peek()!=="<"){if(this.peek()==="{"){this.pos++;let F=this.scanBalanced("}","LIPS-P007");if(F)Q&&$.push(Q),Q="",$.push({expr:F.content.trim(),loc:F.loc});continue}Q+=this.peek(),this.pos++}Q&&$.push(Q);let Y={offset:X,length:this.pos-X};if($.some((F)=>typeof F!=="string"))return{t:"interp",parts:$.map((F)=>typeof F==="string"?CJ(F):F),loc:Y};let Z=$.length?$[0]:"",V=J.some((F)=>bX.has(F));if(!Z||!V&&!Z.trim())return null;return{t:"text",value:CJ(Z),loc:Y}}parseTag(J){let X=this.pos;if(this.startsWith("<!--")){let Z=this.src.indexOf("-->",this.pos+4);if(Z===-1)return this.report("LIPS-P003","error","Unterminated comment",X,this.src.length-X),this.pos=this.src.length,null;let V=this.src.slice(this.pos+4,Z);return this.pos=Z+3,{t:"comment",value:V,loc:{offset:X,length:this.pos-X}}}if(this.startsWith("<>")){this.pos+=2;let Z=[];while(!0)if(Z.push(...this.parseNodes([...J,"#fragment"])),this.closeStatus("#fragment",X,J)!=="stray")break;return{t:"fragment",children:Z,loc:{offset:X,length:this.pos-X}}}if(this.startsWith("<{")){this.pos+=2;let Z=this.scanBalanced("}","LIPS-P008");if(!Z)return null;let V={t:"element",tag:"#dynamic",dynamicTag:{expr:Z.content.trim(),loc:Z.loc},attrs:[],children:[],selfClosed:!1,loc:{offset:X,length:0}};return this.finishTag(V,J,X),V}this.pos++;let $=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let Q=this.src.slice($,this.pos);if(!Q||!/^[A-Za-z]/.test(Q))return this.report("LIPS-P002","error","Invalid tag name",X,this.pos-X+1),{t:"text",value:"<",loc:{offset:X,length:1}};let Y={t:"element",tag:Q.toLowerCase(),attrs:[],children:[],selfClosed:!1,loc:{offset:X,length:0}};if(this.peek()==="(")if(CX.has(Y.tag)){this.pos++;let Z=this.scanBalanced(")","LIPS-P012");Z&&(Y.head={expr:Z.content.trim(),loc:Z.loc})}else this.report("LIPS-P011","error",`Head expression is not allowed on <${Y.tag}>`,this.pos,1,`Only ${[...CX].map((Z)=>`<${Z}(…)>`).join(", ")} take a head`);return this.finishTag(Y,J,X),Y}finishTag(J,X,$){if(this.parseAttrs(J),J.selfClosed||fX.has(J.tag)){J.selfClosed=!0,J.loc={offset:$,length:this.pos-$};return}let Q=J.tag==="#dynamic"?"#dynamic":J.tag;J.children=[];while(!0)if(J.children.push(...this.parseNodes([...X,Q])),this.closeStatus(Q,$,X)!=="stray")break;J.loc={offset:$,length:this.pos-$}}closeStatus(J,X,$){if(this.eof())return this.report("LIPS-P006","error",`Unclosed <${J==="#fragment"?"":J}> — reached end of template`,X,1,`Add </${J==="#fragment"||J==="#dynamic"?"":J}>`),"eof";if(!this.startsWith("</"))return"closed";let Q=this.pos;if(this.pos+=2,this.peek()===">"){if(this.pos++,J!=="#fragment"&&J!=="#dynamic")this.report("LIPS-P004","warning",`Generic '</>' closes <${J}>`,Q,3,`Prefer </${J}>`);return"closed"}let Y=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let Z=this.src.slice(Y,this.pos).toLowerCase();if(this.skipSpace(),this.peek()===">"?this.pos++:this.report("LIPS-P001","error","Malformed closing tag",Q,this.pos-Q),Z===J)return"closed";if($.includes(Z))return this.report("LIPS-P004","warning",`</${Z}> auto-closes <${J}>`,Q,this.pos-Q,`Add the missing </${J}> before </${Z}>`),this.pos=Q,"ancestor";return this.report("LIPS-P005","error",`Stray closing tag </${Z}> — <${J}> is open`,Q,this.pos-Q),"stray"}parseAttrs(J){while(!0){if(this.skipSpace(),this.eof()){this.report("LIPS-P001","error","Unexpected end of template inside tag",J.loc.offset);return}if(this.startsWith("/>")){this.pos+=2,J.selfClosed=!0;return}if(this.peek()===">"){this.pos++;return}let X=this.pos;if(this.startsWith("...")){this.pos+=3;let Z=this.readUnquotedValue();J.attrs.push({k:"spread",source:Z,loc:{offset:X,length:this.pos-X}});continue}if(this.peek()==="["){this.pos++;let Z=this.scanBalanced("]","LIPS-P009");if(Z){let V=Z.content.split(",").map((F)=>F.trim()).filter(Boolean);J.attrs.push({k:"args",names:V,loc:{offset:X,length:this.pos-X}})}continue}let $=!1;if(this.peek()==="!")$=!0,this.pos++;let Q=this.pos;while(!this.eof()&&/[^\s=/>()]/.test(this.peek()))this.pos++;let Y=this.src.slice(Q,this.pos);if(!Y){this.report("LIPS-P009","error",`Invalid attribute syntax at '${this.peek()}'`,this.pos),this.pos++;continue}if(this.peek()==="("){this.pos++;let Z=this.scanBalanced(")","LIPS-P010"),V=Z?Z.content.trim():"",F={offset:X,length:this.pos-X};Y.startsWith("on-")?J.attrs.push({k:"event",name:Y.slice(3),source:V,loc:F}):J.attrs.push({k:"fn",name:Y,source:V,loc:F});continue}if(this.peek()==="="){this.pos++,this.parseAttrValue(J,Y,X);continue}J.attrs.push({k:"bool",name:Y,value:!$,loc:{offset:X,length:this.pos-X}})}}parseAttrValue(J,X,$){let Q=this.peek();if(Q==='"'||Q==="'"){this.pos++;let Z=this.pos,V=[],F="";while(!this.eof()&&this.peek()!==Q){if(this.peek()==="{"){this.pos++;let W=this.scanBalanced("}","LIPS-P007");if(W)F&&V.push(F),F="",V.push({expr:W.content.trim(),loc:W.loc});continue}F+=this.peek(),this.pos++}F&&V.push(F),this.eof()?this.report("LIPS-P010","error",`Unterminated value for '${X}'`,Z,this.pos-Z):this.pos++;let D={offset:$,length:this.pos-$};V.some((W)=>typeof W!=="string")?J.attrs.push({k:"interp",name:X,parts:V.map((W)=>typeof W==="string"?CJ(W):W),loc:D}):J.attrs.push({k:"literal",name:X,value:CJ(V[0]??""),loc:D});return}if(Q==="{"){this.pos++;let Z=this.scanBalanced("}","LIPS-P007");J.attrs.push({k:"expr",name:X,source:Z?Z.content.trim():"",loc:{offset:$,length:this.pos-$}});return}let Y=this.readUnquotedValue();Y?J.attrs.push({k:"expr",name:X,source:Y,loc:{offset:$,length:this.pos-$}}):this.report("LIPS-P010","error",`Missing value for attribute '${X}'`,$)}readUnquotedValue(){let J=this.pos,X=0;while(!this.eof()){let $=this.peek();if($==="'"||$==='"'||$==="`"){this.pos++;while(!this.eof()&&this.peek()!==$){if(this.peek()==="\\")this.pos++;this.pos++}this.pos++;continue}if(X===0){if(/\s/.test($)||$===">")break;if($==="/"&&this.peek(1)===">")break}if($==="("||$==="["||$==="{")X++;else if($===")"||$==="]"||$==="}")X--;this.pos++}return this.src.slice(J,this.pos).trim()}}function e(J){return new wJ(J||"").parse()}function IX(J){let X=vX(J||""),$=(J||"").slice(0,X).trimEnd(),Q=(J||"").slice(X),Y=new wJ(Q).parse(),Z=$?$.split(`
|
|
4
|
+
`).length+(/\n\s*\n$/.test(J.slice(0,X))?1:0):0;return Y.diagnostics.forEach((V)=>{V.loc.line+=$?J.slice(0,X).split(`
|
|
5
|
+
`).length-1:0,V.loc.offset+=X}),{script:$,...Y}}function vX(J){let X=0,$=!0;for(let Q=0;Q<J.length;Q++){let Y=J[Q];if(Y==="'"||Y==='"'||Y==="`"){let Z=Y;Q++;while(Q<J.length&&J[Q]!==Z){if(J[Q]==="\\")Q++;Q++}$=!1;continue}if(Y==="/"&&J[Q+1]==="/"){while(Q<J.length&&J[Q]!==`
|
|
6
|
+
`)Q++;$=!0;continue}if(Y==="/"&&J[Q+1]==="*"){let Z=J.indexOf("*/",Q+2);Q=Z===-1?J.length:Z+1;continue}if(Y===`
|
|
7
|
+
`){$=!0;continue}if($&&X===0&&Y==="<"&&/[A-Za-z{>!]/.test(J[Q+1]||""))return Q;if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X=Math.max(0,X-1);if(!/\s/.test(Y))$=!1}return 0}var mX="<!--$-->",hX=new Set(["if","else-if","else","for","switch","async","let","const","log"]),pX=new Set(["case","default","then","catch","loading"]),dX=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","marker","mask","path","pattern","polygon","polyline","radialgradient","rect","stop","symbol","text","tspan","use"]),iX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),lX=(J)=>J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),cX=(J)=>J.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<"),jX=(J)=>J!==""&&!isNaN(Number(J));class EX{src;macros;exprs=[];exprIndex=new Map;lineStarts=null;macroStack=[];diagnostics=[];constructor(J,X=new Map){this.src=J;this.macros=X}locate(J){if(!this.lineStarts){this.lineStarts=[0];for(let Q=0;Q<this.src.length;Q++)if(this.src[Q]===`
|
|
8
|
+
`)this.lineStarts.push(Q+1)}let X=0,$=this.lineStarts.length-1;while(X<$){let Q=X+$+1>>1;this.lineStarts[Q]<=J?X=Q:$=Q-1}return{line:X+1,col:J-this.lineStarts[X]+1}}report(J,X,$,Q,Y=1,Z){let{line:V,col:F}=this.locate(Q);this.diagnostics.push({code:J,severity:X,message:$,hint:Z,loc:{line:V,col:F,offset:Q,length:Y}})}expr(J,X){let $=this.exprIndex.get(J);if($!==void 0)return $;let{diagnostics:Q}=p(J);for(let Z of Q){let V=(X?.offset??0)+Z.loc.offset;this.report(Z.code,"error",Z.message,V,Z.loc.length)}let Y=this.exprs.length;return this.exprs.push(J),this.exprIndex.set(J,Y),Y}synth(J){let X=this.exprIndex.get(J);if(X!==void 0)return X;let $=this.exprs.length;return this.exprs.push(J),this.exprIndex.set(J,$),$}concat(J){J.filter(($)=>typeof $!=="string").forEach(($)=>{let{diagnostics:Q}=p($.expr);for(let Y of Q)this.report(Y.code,"error",Y.message,$.loc.offset+Y.loc.offset,Y.loc.length)});let X=J.map(($)=>typeof $==="string"?JSON.stringify($):`((${$.expr})??"")`).join("+");return this.synth(X)}compInput(J){switch(J.k){case"literal":return{lit:J.value};case"bool":return{lit:J.value};case"expr":return{e:this.expr(J.source,J.loc)};case"interp":return{e:this.concat(J.parts)}}}compile(J){return{v:1,exprs:this.exprs,root:this.block(J,[])}}block(J,X){let $={html:"",scope:[...X],binds:[],blocks:[]},Q=[],Y=(Z,V,F=!1)=>{let D=0,W=!1,q=()=>{return Q.push(mX),W=!1,[...V,D++]};for(let K=0;K<Z.length;K++){let G=Z[K];switch(G.t){case"text":{if(F){$.binds.push({t:"text",p:q(),e:this.synth(JSON.stringify(G.value)),i18n:1});break}if(Q.push(lX(G.value)),!W)D++;W=!0;break}case"comment":{Q.push(`<!--${G.value.replace(/--/g,"- -")}-->`),W=!1,D++;break}case"interp":{let U={t:"text",p:q(),e:this.concat(G.parts)};if(F)U.i18n=1;$.binds.push(U);break}case"fragment":{Z=[...Z.slice(0,K),...G.children,...Z.slice(K+1)],K--;break}case"element":{if(hX.has(G.tag)){if(this.controlBlock(G,Z,K,q(),$,X),G.tag==="if"){let U=K+1;while(U<Z.length){let M=Z[U];if(M.t==="element"&&(M.tag==="else-if"||M.tag==="else"))U++;else break}Z=[...Z.slice(0,K+1),...Z.slice(U)]}break}if(pX.has(G.tag)){this.report("LIPS-C002","error",`<${G.tag}> is only valid inside its parent construct`,G.loc.offset,G.loc.length);break}if(G.tag==="#dynamic"){$.blocks.push(this.compLike(G,q(),X,"dynamic"));break}if(this.macros.has(G.tag)){let U=this.macroCall(G,q(),X);U&&$.blocks.push(U);break}if(!dX.has(G.tag)){$.blocks.push(this.compLike(G,q(),X,"comp"));break}this.emitElement(G,V,D++,Q,$,Y),W=!1;break}}}};return Y(J,[]),$.html=Q.join(""),$}emitElement(J,X,$,Q,Y,Z){let V=[...X,$],F=`<${J.tag}`,D=J.attrs.some((q)=>q.k==="bool"&&q.name==="i18n"&&q.value),W=(q)=>D&&(q==="title"||q==="placeholder");for(let q of J.attrs)switch(q.k){case"literal":if(q.name==="@format"){Y.binds.push(this.formatBind(V,q));break}if(q.name.startsWith("@")){Y.binds.push({t:"prop",p:V,name:q.name.slice(1),e:this.synth(JSON.stringify(q.value))});break}if(W(q.name)){Y.binds.push({t:"attr",p:V,name:q.name,e:this.synth(JSON.stringify(q.value)),i18n:1});break}F+=` ${q.name}="${cX(q.value)}"`;break;case"bool":q.name!=="i18n"&&q.value&&(F+=` ${q.name}`);break;case"expr":{if(q.name==="@format"){Y.binds.push(this.formatBind(V,q));break}if(q.name.startsWith("@")){Y.binds.push({t:"prop",p:V,name:q.name.slice(1),e:this.expr(q.source,q.loc)});break}let K={t:"attr",p:V,name:q.name,e:this.expr(q.source,q.loc)};if(W(q.name))K.i18n=1;Y.binds.push(K);break}case"interp":{if(q.name==="@format"){Y.binds.push(this.formatBind(V,q));break}let K={t:"attr",p:V,name:q.name,e:this.concat(q.parts)};if(W(q.name))K.i18n=1;Y.binds.push(K);break}case"event":Y.binds.push({t:"event",p:V,name:q.name,e:this.synth(q.source)});break;case"spread":Y.binds.push({t:"spread",p:V,e:this.expr(q.source,q.loc)});break;case"fn":this.report("LIPS-C007","warning",`Callable attribute '${q.name}(…)' has no meaning on <${J.tag}>`,q.loc.offset,q.loc.length);break;case"args":this.report("LIPS-C008","warning",`Iterator arguments are not applicable to <${J.tag}>`,q.loc.offset,q.loc.length);break}if(iX.has(J.tag)){Q.push(F+">");return}Q.push(F+">"),J.children.length&&Z(J.children,V,D),Q.push(`</${J.tag}>`)}formatBind(J,X){let $=X.k==="literal"?X.value:X.k==="expr"?X.source:X.parts.map((V)=>typeof V==="string"?V:`{${V.expr}}`).join(""),Q=$.indexOf(",");if(Q===-1)return this.report("LIPS-C012","error",'@format expects "reference, { params }"',X.loc.offset,X.loc.length),{t:"prop",p:J,name:"format",e:this.synth("({})"),ref:$.trim()};let Y=$.slice(0,Q).trim(),Z=$.slice(Q+1).trim();return{t:"prop",p:J,name:"format",e:this.expr(Z,X.loc),ref:Y}}attrsOf(J){let X=new Map,$=[];for(let Q of J.attrs)if(Q.k==="args")$.push(...Q.names);else if("name"in Q)X.set(Q.name,Q);return{byName:X,args:$}}controlBlock(J,X,$,Q,Y,Z){switch(J.tag){case"if":{let V=[{when:J.head?this.expr(J.head.expr,J.head.loc):this.missingHead(J),block:this.block(J.children,Z)}];for(let F=$+1;F<X.length;F++){let D=X[F];if(D.t!=="element")break;if(D.tag==="else-if")V.push({when:D.head?this.expr(D.head.expr,D.head.loc):this.missingHead(D),block:this.block(D.children,Z)});else if(D.tag==="else"){V.push({when:null,block:this.block(D.children,Z)});break}else break}Y.blocks.push({t:"if",p:Q,branches:V});break}case"else-if":case"else":this.report("LIPS-C001","error",`<${J.tag}> without a preceding <if>`,J.loc.offset,J.loc.length);break;case"for":{let{byName:V,args:F}=this.attrsOf(J),D=V.get("in"),W=V.get("from"),q=V.get("to"),K=V.get("by");if(!D&&!W){this.report("LIPS-C004","error","<for> requires 'in' or 'from'/'to'",J.loc.offset,J.loc.length);break}let G={t:"for",p:Q,args:F,block:this.block(J.children,[...Z,...F])};if(D&&D.k==="expr")G.of=this.expr(D.source,D.loc);if(W)G.from=this.numInput(W);if(q)G.to=this.numInput(q);if(K&&(K.k==="literal"||K.k==="expr"))G.by=K.k==="literal"?{lit:K.value}:{e:this.expr(K.source,K.loc)};Y.blocks.push(G);break}case"switch":{let V=J.head?this.expr(J.head.expr,J.head.loc):this.missingHead(J),F=[];for(let D of J.children){if(D.t!=="element")continue;if(D.tag==="case"){let{byName:W}=this.attrsOf(D),q=W.get("is");if(!q||q.k!=="literal"&&q.k!=="expr"){this.report("LIPS-C004","error","<case> requires an 'is' attribute",D.loc.offset,D.loc.length);continue}F.push({is:q.k==="literal"?{lit:q.value}:{e:this.expr(q.source,q.loc)},block:this.block(D.children,Z)})}else if(D.tag==="default")F.push({is:null,block:this.block(D.children,Z)});else this.report("LIPS-C003","error","Only <case>/<default> are valid inside <switch>",D.loc.offset,D.loc.length)}Y.blocks.push({t:"switch",p:Q,on:V,cases:F});break}case"async":{let V=J.attrs.find((D)=>D.k==="fn"&&D.name==="await");if(!V){this.report("LIPS-C004","error","<async> requires await(…)",J.loc.offset,J.loc.length);break}let F={t:"async",p:Q,awaitE:this.expr(V.source,V.loc)};for(let D of J.children){if(D.t!=="element")continue;let{args:W}=this.attrsOf(D);if(D.tag==="then")F.then={args:W,block:this.block(D.children,[...Z,...W])};else if(D.tag==="catch")F.catch={args:W,block:this.block(D.children,[...Z,...W])};else if(D.tag==="loading")F.loading=this.block(D.children,Z);else this.report("LIPS-C003","error","Only <then>/<catch>/<loading> are valid inside <async>",D.loc.offset,D.loc.length)}Y.blocks.push(F);break}case"let":case"const":{let V={};for(let F of J.attrs)if(F.k==="literal"||F.k==="expr"||F.k==="interp"||F.k==="bool")V[F.name]=this.compInput(F),!Y.scope.includes(F.name)&&Y.scope.push(F.name),!Z.includes(F.name)&&Z.push(F.name);Y.blocks.push({t:"let",p:Q,const:J.tag==="const",vars:V});break}case"log":Y.blocks.push({t:"log",p:Q,e:J.head?this.synth(J.head.expr):this.missingHead(J)});break}}missingHead(J){return this.report("LIPS-C004","error",`<${J.tag}> requires a head expression: <${J.tag}( … )>`,J.loc.offset,J.loc.length),this.synth("undefined")}numInput(J){if(J.k==="literal")return{lit:jX(J.value)?Number(J.value):J.value};if(J.k==="expr")return jX(J.source)?{lit:Number(J.source)}:{e:this.expr(J.source,J.loc)};return{lit:void 0}}macroCall(J,X,$){let Q=this.macros.get(J.tag);if(this.macroStack.includes(Q.name))return this.report("LIPS-C009","error",`Recursive macro <${Q.name}> (${[...this.macroStack,Q.name].join(" → ")})`,J.loc.offset,J.loc.length),null;let Y={};for(let V of J.attrs)if(V.k==="literal"||V.k==="expr"||V.k==="interp"||V.k==="bool")Y[V.name]=this.compInput(V);for(let V of Q.argv)if(!(V in Y))Y[V]={lit:void 0};this.macroStack.push(Q.name);let Z=this.block(Q.children,[...$,...Q.argv]);return this.macroStack.pop(),{t:"macro",p:X,name:Q.name,vars:Y,args:Q.argv,block:Z}}compLike(J,X,$,Q){let Y={},Z=[],V=[],F=[];for(let W of J.attrs)switch(W.k){case"literal":case"bool":case"expr":case"interp":Y[W.name]=this.compInput(W);break;case"event":V.push({name:W.name,e:this.synth(W.source)});break;case"spread":Z.push(this.expr(W.source,W.loc));break;case"args":F=[...F,...W.names];break;case"fn":Y[W.name]={e:this.expr(W.source,W.loc)};break}let D=J.children.length?{args:F,block:this.block(J.children,[...$,...F])}:void 0;return Q==="comp"?{t:"comp",p:X,name:J.tag,inputs:Y,spreads:Z,events:V,contents:D}:{t:"dynamic",p:X,tag:this.expr(J.dynamicTag.expr,J.dynamicTag.loc),inputs:Y,spreads:Z,events:V,contents:D}}}function oX(J,X){let $=new Map;if(!J?.trim())return $;let Q=e(J);X.push(...Q.diagnostics);for(let Y of Q.root.children){if(Y.t!=="element")continue;if(Y.tag!=="macro"){X.push({code:"LIPS-C010",severity:"warning",message:`Only <macro> definitions are allowed in the macros source — ignoring <${Y.tag}>`,loc:{line:1,col:1,offset:Y.loc.offset,length:Y.loc.length}});continue}let Z="",V=[];for(let F of Y.attrs)if(F.k==="args")V.push(...F.names);else if(F.k==="literal"&&F.name==="name")Z=F.value;if(!Z){X.push({code:"LIPS-C011",severity:"error",message:"<macro> requires a name attribute",loc:{line:1,col:1,offset:Y.loc.offset,length:Y.loc.length}});continue}$.set(Z.toLowerCase(),{name:Z,argv:V,children:Y.children})}return $}function IJ(J,X){let $=[],Q=oX(X?.macros||"",$),Y=e(J),Z=new EX(J,Q);return{ir:Z.compile(Y.root.children),diagnostics:[...$,...Y.diagnostics,...Z.diagnostics]}}function sX(J){try{return decodeURIComponent(J)}catch(X){return J}}var rX=(J)=>Object.fromEntries(new URLSearchParams(J)),RX={state:{page:null,params:{},query:{}},handler:{onCreate(){this.__routes=[],this.__defaultPath=null,this.__currentRoute=null,this.__global=!1},onInput(){this.processor(this.input)},processor(J){if(!J?.routes)return;if(J.global)this.__global=!0;if(this.__routes=J.routes.map(({path:X,template:$,default:Q})=>{if(Q)this.__defaultPath=X;let Y=X.match(/:[^\/]*(\/|$)/gi)||[],Z=X.replaceAll("/","\\/").replaceAll(/:[^\/]*(\/|$)/gi,"([^\\/]+)(?:\\/|$)");return{path:X,template:$,default:Q,pathVars:Y,pathRegex:new RegExp(`${Z}$`,"i")}}),J.global){let X=window.location.pathname;this.__defaultPath=this.__defaultPath&&X==="/"&&X!==this.__defaultPath?this.__defaultPath:X?X+window.location.search:this.__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));typeof this.setContext==="function"&&this.setContext("navigate",this.navigate.bind(this)),this.__defaultPath&&this.navigate(this.__defaultPath)},navigate(J,X){!X&&this.__global&&history.pushState({path:J},"",J);let $=String(J).split("?");J=$[0];let Q=$[1]?rX($[1]):{},Y=null;if(this.__currentRoute)Y={path:this.__currentRoute.path,params:this.state.params},this.emit("before",{fromState:Y,toState:{path:J,query:Q}});let Z=this.match(J);if(!Z){this.__currentRoute=null,this.state.params={},this.state.query={},this.state.page=null,this.emit("not-found",J);return}let{route:V,params:F}=Z;this.emit("after",{fromState:Y,toState:{path:V.path,params:F,query:Q}}),this.__currentRoute=V,this.state.params=F,this.state.query=Q,this.state.page=V.template},match(J){let X={};for(let $ of this.__routes){let Q=J.match($.pathRegex);if(Q===null||Q.index!==0)continue;for(let Y=0;Y+1<Q.length&&Y<$.pathVars.length;Y++)X[$.pathVars[Y].replaceAll(/[\/:]/g,"")]=sX(Q[Y+1]);return{route:$,params:X}}return!1}},default:"<{state.page} params=state.params query=state.query/>"};MX(IJ);zX((J)=>DJ(rJ(J),nJ([aJ])));LX("router",RX);var n0=NJ;export{x as untrack,S as signal,HJ as renderIR,g as reactive,e as parseTemplate,IX as parseSFC,E as effect,n0 as default,IJ as compileTemplate};
|
|
2
9
|
|
|
3
|
-
//# debugId=
|
|
10
|
+
//# debugId=AC7DB6590A68444964756E2164756E21
|