UNPKG

taggedjs

Version:

tagged template reactive html

1 lines 53.6 kB
var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function n(t){return t.renderCount=t.renderCount||0,t.global={}}t.d(e,{W9:()=>qe,cg:()=>A,m0:()=>I,rS:()=>Bn,Y2:()=>o,ei:()=>Ye,B7:()=>xt,TU:()=>Tt,XF:()=>Qe,PC:()=>Xe,Ot:()=>je,Mj:()=>Le,tD:()=>J,j8:()=>yn,Gf:()=>Lo,xe:()=>ir,YO:()=>pn,um:()=>bn,E2:()=>Ke,OH:()=>en,TB:()=>Kt,Ii:()=>de,m3:()=>Te,yV:()=>hn,zV:()=>yt,pf:()=>Ft,ze:()=>tn,WJ:()=>Ct,Ng:()=>fe,HG:()=>tr,aZ:()=>ee,Ey:()=>te,O:()=>re,F3:()=>mn,Ie:()=>E,ts:()=>xe,B4:()=>_t,Az:()=>H,Xi:()=>rr,sV:()=>mr,Ah:()=>n,Gk:()=>Sn,j_:()=>ke,zC:()=>$n,cF:()=>Sr,Hc:()=>vr,jU:()=>R,PB:()=>N,uq:()=>U,qy:()=>sr,cy:()=>K,Tn:()=>Y,Gv:()=>Q,yL:()=>q,D8:()=>G,Ze:()=>z,_4:()=>X,mn:()=>Z,z:()=>Ge,sA:()=>ln,TG:()=>Se,MG:()=>cn,PL:()=>Mn,CG:()=>pr,nI:()=>$o,Fs:()=>br,PZ:()=>ue,r5:()=>Ze,uc:()=>ro,pG:()=>Nn,QB:()=>eo,Ll:()=>kt,vP:()=>Pe,wk:()=>Re,xP:()=>Fe,bc:()=>$e,B1:()=>dr,RX:()=>Cr,ag:()=>nn,Tc:()=>_n,Hf:()=>lr,zc:()=>Zt,_A:()=>kn,Ag:()=>$t,Pc:()=>me,NU:()=>r,wB:()=>De,id:()=>He,MC:()=>Ne,SZ:()=>Ue});class o{get(t){return"todo"}}const r=":tagvar",s=":";function c(t){if(t.startsWith("class."))return"class";const e=function(t){switch(t){case"autoselect":return"autoselect";case"autofocus":return"autofocus"}return!1}(t);return!1!==e?e:!!t.startsWith("style.")&&"style"}const u=new RegExp(r+"(\\d+)"+s,"g");function a(t){return t.search&&t.startsWith(r)?t.search(u):-1}const i=/(:tagvar\d+:)/,l="ondoubleclick",p=/([:_a-zA-Z0-9\-.]+)\s*(?:=\s*"([^"]*)"|=\s*(\S+))?/g,f=/<\/?([a-zA-Z0-9-]+)((?:\s+[a-zA-Z_:*][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)+\s*|\s*)\/?>/g;function d(t){const e=[],n=[],o=[];let c=null,u=-1,a=0;const l=new RegExp(f,"g");for(t=function(t){return t.replace(g,(function(t){return t.replace(/\[l t\]/g,"[l&nbsp;t]").replace(/\[g t\]/g,"[g&nbsp;t]").replace(/</g,"[l t]").replace(/>/g,"[g t]")}))}(t);a<t.length;){const f=l.exec(t);if(!f)break;const[d,g,m]=f,y=d.startsWith("</"),w=d.endsWith("/>");if(a<f.index){const e=t.slice(a,f.index);if(e.trim()){const t=b(e);for(let e of t)e.startsWith(r)&&e.search(i)>=0&&-1===e.search(C)&&(e=r+ ++u+s),h(c,n,e)}}if(a=f.index+d.length,y){c=o.pop()||null;continue}const x=[];let T;for(;null!==(T=p.exec(m));)u=v(T,u,e,x);const S={nn:g};x.length&&(S.at=x),c?(c.ch||(c.ch=[]),c.ch.push(S)):n.push(S),w||(o.push(c),c=S)}if(a<t.length){const e=t.slice(a);if(e.trim()){const t=b(e);for(const e of t)e.startsWith(r)&&++u,h(c,n,e)}}return n}const g=new RegExp("(\x3c!--[\\s\\S]*?--\x3e)","g");function h(t,e,n){!function(t,e,n){t?(t.ch||(t.ch=[]),t.ch.push(n)):e.push(n)}(t,e,{nn:"text",tc:m(n)})}function m(t){return t.replace(/(\[l t\]!--[\s\S]*?--\[g t\])/g,(function(t){return t.replace(/\[l t\]/g,"<").replace(/\[g t\]/g,">").replace(/\[l&nbsp;t\]/g,"[l t]").replace(/\[g&nbsp;t\]/g,"[g t]")}))}function b(t){return t.split(i).filter(y)}function y(t){return""!==t}function v(t,e,n,o){const a=t[1]||t[3]||t[5];let i=t[2]||t[4]||t[6];if(void 0===a)return e;const p=""!==t[2],f=void 0===i&&p,d=a.toLowerCase(),g=d.startsWith("on")?function(t){if(t.startsWith("on"))return t.length===l.length&&t===l?"dblclick":t.slice(2,t.length);return t}(d):d;if(f){if(a.slice(0,r.length)===r){const t=r+ ++e+s;return n.push(["at",t]),o.push([t]),e}if(t[0].startsWith(a)&&t[0].slice(a.length,t[0].length).search(/\s+$/)>=0)return o.push([g]),e;const c=t[3];if(c.search(C)>=0){i=c;const t=[g,i];return o.push(t),e}i=r+ ++e+s}p||(i=t[2]);const h=i.split(x).filter((t=>t.length>0));h.length>1&&(i=h,h.forEach((t=>{t.search(u)>=0&&++e})));const m=[g,i],b=c(d);return b&&m.push(b),"style"===g?(o.unshift(m),e):(o.push(m),e)}const w=new RegExp(r+"(\\d+)"+s,"gi"),x=new RegExp("("+r+"\\d+"+s+")","gi"),T=r.slice(0,r.length-1),C=new RegExp(T+"&#x72;(\\d+)"+s,"gi"),S=T+"&#x72;$1"+s;function k(t,e){const n=function(t,e){const n=t;return function(t,e){const n=[];for(let o=0;o<t.length;++o){const c=t[o].replace(w,S);o<e.length?n.push(c+r+o+s):n.push(c)}return function(t,e,n){const o=n.length-e.length;if(o>0)for(let n=o;n>0;--n)t.push(r+(e.length+n-1)+s)}(n,t,e),n}(n,e)}(t,e).join("");return d(n)}const E="";var I,A;!function(t){t.string="string",t.number="number",t.boolean="boolean",t[void 0]="undefined"}(I||(I={})),function(t){t.function="function",t.date="date",t.unknown="unknown",t.object="object"}(A||(A={}));const J={tag:"html",dom:"dom",templater:"templater",tagComponent:"tagComponent",tagArray:"tagArray",host:"host",subscribe:"subscribe",signal:"signal",renderOnce:"renderOnce",stateRender:"stateRender",version:Date.now()},V="ch";function O(t,e,n=[],o=[]){const r=t;for(let t=0;t<r.length;t++){const s=[...o,t],c=r[t];if(c.at){const t=c.at;c.at=M(t,e)}if(c.ch){const t=c.ch,o=[...s,V];c.ch=O(t,e,n,o)}t=P(c,e,r,t)}return r}function P(t,e,n,o){if("text"!==t.nn)return o;const c=t;let a,i=c.tc;if(typeof i!==I.string)return o;for(;null!==(a=u.exec(i));){const t=a[1],c=parseInt(t,10);if(!isNaN(c)&&c<e){const t=r+c+s,e=i.slice(a.index+t.length);n.splice(o,1,{nn:"text",v:c}),i=e,u.lastIndex=0}}return c.tc=i,o}function M(t,e){const n=[];for(const o of t){const[t,s,c]=o;if(t.startsWith(r)){const o=parseInt(t.replace(r,""),10);if(!isNaN(o)&&o<e){n.push([{tagJsVar:o}]);continue}}if(typeof s===I.string&&s.startsWith(r)){const o=parseInt(s.replace(r,""),10);if(!isNaN(o)&&o<e){n.push([t,{tagJsVar:o},c]);continue}}n.push(o)}return n}function j(t){return t.length}const L={};function H(t,e){const n=function(t){const e=t.map(j);return e.push(t.length),Number(e.join(""))}(t),o=L[n],r=o&&function(t,e,n){if(n&&n.strings.length===t.length&&n.strings.every(((e,n)=>e===t[n]))&&n.values.length===e.length)return!0;return!1}(t,e,o);if(r)return o.domMetaMap;const s=O(k(t,e),e.length),c={interpolation:void 0,string:void 0,strings:t,values:e,domMetaMap:s};return L[n]=c,s}function N(t,e,n){Ro.push([R,[t,e,n]])}function U(t,e,n){t.setAttribute(e,"")}function R(t,e,n){void 0!==n&&!1!==n&&null!==n?t.setAttribute(e,n):t.removeAttribute(e)}function D(t,e,n,o){switch(o){case"autofocus":return void Ro.push([F,[n]]);case"autoselect":return void Ro.push([$,[n]]);case"style":{const o=t.split(".");return void Ro.push([W,[n,o,e]])}case"class":return void function(t,e,n){const o=t.split(".");if(o.shift(),e){for(const t of o)Ro.push([B,[n,t]]);return}for(const t of o)Ro.push([_,[n,t]])}(t,e,n)}throw new Error(`Invalid special attribute of ${o}. ${t}`)}function W(t,e,n){const o=e[1];t.style[o]=n,t.style.setProperty(o,n)}function B(t,e){t.classList.add(e)}function _(t,e){t.classList.remove(e)}function $(t){t.select()}function F(t){t.focus()}function G(t){switch(t){case I.string:case I.number:case I.boolean:return!0}return!1}function z(t){if(!t)return!1;switch(t.tagJsType){case J.dom:case J.tag:case J.templater:return!0}return!1}function Z(t){const e=t?.tagJsType;return e===J.tagComponent||e===J.stateRender}function X(t){return Q(t)&&typeof t.subscribe===A.function}function q(t){return t&&Y(t.then)}function Y(t){return typeof t===A.function}function Q(t){return typeof t===A.object&&null!==t}function K(t){return Array.isArray(t)}function tt(t,e){const n=function(t,e,n=[]){const o=t.context;n.push({support:t,renderCount:o.renderCount,provider:e});const r=e.children;for(let t=r.length-1;t>=0;--t){const o=r[t],s=o.context;n.push({support:o,renderCount:s.renderCount,provider:e})}return n}(t,e);return n}function et(t){return t.support}function nt(t,e){return ot(t,e)}function ot(t,e){if(null===t||typeof t!==A.object)return t;if(e<0)return t;if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);const n=K(t)?[]:Object.create(Object.getPrototypeOf(t));if(K(t))for(let o=0;o<t.length;o++)n[o]=ot(t[o],e-1);else for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=ot(t[o],e-1));return n}function rt(t,e,n){return st(t,e,n)}function st(t,e,n){return!(t!==e&&(o=t,r=e,!Y(o)||!Y(r)||o.toString()!==r.toString()))||(n<0||typeof t===A.object&&typeof e===A.object&&(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():K(t)&&K(e)?function(t,e,n){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!st(t[o],e[o],n-1))return!1;return!0}(t,e,n-1):!K(t)&&!K(e)&&function(t,e,n){const o=Object.keys(t),r=Object.keys(e);if(0===o.length&&0===r.length)return!0;if(o.length!==r.length)return!1;for(const s of o){if(!r.includes(s)||!st(t[s],e[s],n-1))return!1}return!0}(t,e,n-1)));var o,r}function ct(){return kt.stateConfig.support}function ut(t){return kt.stateConfig.support=t}function at(t){let e=t;for(;e.ownerSupport&&!Z(e.templater);)e=e.ownerSupport;return e.context.global.newest||e}function it(...t){return t}function lt(t){const e=kt.stateConfig;return e.states[e.statesIndex]=t,++e.statesIndex,t(it)}function pt(t){const e=kt.stateConfig,n=e.statesIndex,o=at(e.prevSupport).states[n];let r=[];o((function(...t){return r=t,t}));return e.states[e.statesIndex]=t,++e.statesIndex,t((function(...t){return r}))}function ft(t){const e=kt.stateConfig;e.handlers.handler=bt,e.handlers.statesHandler=lt,e.rearray=[],e.stateArray=[],e.states=[],e.statesIndex=0,ut(t)}function dt(t,e,n){const o=kt.stateConfig;o.rearray=n,o.stateArray=[],o.states=[],o.statesIndex=0,o.handlers.handler=mt,o.handlers.statesHandler=pt,o.prevSupport=e,ut(t)}class gt{}function ht(t){const e=t.callback;if(!e)return t.defaultValue;const[n]=function(t){const[e]=t(gt),[n]=t(e);return[e,n]}(e);return n}function mt(){const t=kt.stateConfig,e=t.rearray[t.stateArray.length];return t.stateArray.push(e),e.defaultValue}function bt(t){const e=kt.stateConfig;let n=t;if(typeof t===A.function&&(n=t()),typeof n===A.function){const t=n;n=function(...e){return t(...e)},n.original=t}const o={get:function(){return ht(o)},defaultValue:n};return e.stateArray.push(o),n}function yt(t){const e=new xt;return e.subscribeWith=e=>{const n=[],o=[],r=(r,s)=>{n[s]=!0,o[s]=r;if(n.length===t.length){for(const t of n)if(!t)return;e(o,c)}},s=[...t],c=s.shift().subscribe((t=>r(t,0))),u=s.map(((t,e)=>t.subscribe((t=>r(t,e+1)))));return c.subscriptions=u,c},e}function vt(t,e,n){const o=xt.globalSubCount$;xt.globalSubCount$.next(o.value+1);const r=function(){r.unsubscribe()};return r.callback=e,r.subscriptions=[],r.unsubscribe=function(){return function(t,e,n){!function(t,e){const n=t.findIndex((t=>t.callback===e));-1!==n&&t.splice(n,1)}(e,n);const o=xt.globalSubCount$;xt.globalSubCount$.next(o.value-1),t.unsubscribe=()=>t;const r=t.subscriptions;for(const t of r)t.unsubscribe();return t}(r,n,e)},r.add=t=>(r.subscriptions.push(t),r),r.next=t=>{e(t,r)},r}function wt(t,e,n){const o=[...e],r=o.shift(),s=t=>{if(o.length)return wt(t,o,n);n(t)};let c=s;const u=r(t,{setHandler:t=>c=t,next:s});c(u)}class xt{value;onSubscription;methods=[];isSubject=!0;subscribers=[];subscribeWith;constructor(t,e){this.value=t,this.onSubscription=e}subscribe(t){const e=vt(0,t,this.subscribers),n=this.subscribeWith;if(n){if(this.methods.length){const n=t;t=t=>{wt(t,this.methods,(t=>n(t,e)))}}return n(t)}return this.subscribers.push(e),this.onSubscription&&this.onSubscription(e),e}next(t){this.value=t,this.emit()}set=this.next.bind(this);emit(){const t=this.value,e=this.subscribers;for(const n of e)n.callback(t,n)}toPromise(){return new Promise((t=>{this.subscribe(((e,n)=>{n.unsubscribe(),t(e)}))}))}toCallback(t){const e=this.subscribe(((n,o)=>{const r=o?.unsubscribe;r?r():setTimeout((()=>e.unsubscribe()),0),t(n)}));return this}pipe(...t){const e=new xt(this.value);return e.setMethods(t),e.subscribeWith=t=>this.subscribe(t),e.next=t=>this.next(t),e}setMethods(t){this.methods=t}static all(t){return yt(t.map((t=>{if(X(t))return t;return new xt(t,(e=>(e.next(t),e)))})))}static globalSubCount$=new xt(0)}class Tt extends xt{value;onSubscription;_value;constructor(t,e){super(t,e),this.value=t,this.onSubscription=e,this._value=t,Ct(this)}next(t){this._value=t,this.emit()}emit(){const t=this._value,e=this.subscribers;for(const n of e)n.callback(t,n)}}function Ct(t){Object.defineProperty(t,"value",{set(e){t._value=e,t.emit()},get:()=>t._value})}const St=new xt(void 0,(function(t){ct()||t.next()})),kt={stateConfig:{stateArray:[],version:Date.now(),handlers:{handler:bt,statesHandler:lt}},tagClosed$:St};function Et(t,e){return It(t.states,e.states)}function It(t,e){for(let n=0;n<t.length;++n){Ot(t[n],e[n])}}let At;function Jt(...t){return At=t,t}function Vt(){return At}function Ot(t,e){t(Jt,1),e(Vt,2)}function Pt(t,e,n,o){for(let n=t.length-1;n>=0;--n){const o=t[n].get(),r=e[n].callback;r&&r(o)}for(let t=o.length-1;t>=0;--t){jt.length=0,Mt=0;(0,o[t])(Lt),n[t](Ht)}}let Mt=0;const jt=[];function Lt(...t){return jt.push(t),t}function Ht(...t){return jt[Mt++]}function Nt(t,e,n,o,r){const s=n[e],c=t[s.valueIndex];if(c===s.value)return;s.tagJsVar.processUpdate(c,o,s,r,t),s.value=c}function Ut(t,e){const n=t.context.global.contexts;!function(t,e){const n=e.templater,o=e.templater.tag,r=n.values||o.values,s=t.templater.tag;s.values=r}(t,e),++Bo.locks,function(t,e){const n=t.templater.tag.values;let o=0;const r=n.length,s={added:0,removed:0};for(;o<r;)Nt(n,o,e,t,s),++o}(t,n),--Bo.locks,$o()}function Rt(t){return t.map(Dt)}function Dt(t,e){const n=t,o=t?.tagJsType;if(o)switch(o){case J.signal:case J.subscribe:case J.stateRender:return;case J.dom:case J.tag:case J.templater:return Rt(n.values)}return K(t)?Rt(n):nt(t,e)}function Wt(t){return Dt(t,Zn)}function Bt(t){return Dt(t,Xn)}function _t(t,e,n){const o={templater:t,context:e,castedProps:n,appSupport:void 0},r=e.global;return r.blocked=[],r.destroy$=new xt,o}function $t(t,e,n,o){e.appSupport=n;const r=t.props;return r&&(e.propsConfig=function(t,e,n){const o=t.templater;if(o.tagJsType!==J.stateRender){switch(o.propWatch){case Bn.IMMUTABLE:return t.propsConfig={latest:e,castProps:n};case Bn.SHALLOW:return t.propsConfig={latest:e.map(Wt),castProps:n}}return t.propsConfig={latest:e.map(Bt),castProps:n}}}(e,r,o)),e}function Ft(t,e,n,o,r){const s={templater:t,context:o,castedProps:r,appSupport:void 0};return s.ownerSupport=e,s.appSupport=n,s}function Gt(t,e,n,o,r){const s=_t(t,o,r);return s.ownerSupport=e,$t(t,s,n,r)}function zt(t,e,o,r){const s=Z(e);if(t.tagJsVar=e,s)return void 0===t.global&&n(t),function(t,e,o,r){const s=e.global;if(!s.newest)return void t.processInit(t,e,o,r,void 0,e.placeholder);const c=Gt(t,o,o.appSupport,e);!function(t,e,o){const r=o.global,s=r.newest,c=s.templater.wrapper;let u=e.templater.wrapper,a=!1;const i=e.templater.tagJsType,l=J.stateRender===i||J.renderOnce===i;if(l)a=e.templater.tagJsType===J.renderOnce||dn(s,e);else if(c&&u){const t=s.templater.tag?._innerHTML;t&&(u=e.outerHTML);a=c.original===u.original}const p=e.templater;if(!a)return void function(t,e,o){const r=t.global,s=r.oldest;re(s,r),n(t),e.processInit(e,t,o,{added:0,removed:0},void 0,t.placeholder)}(o,p,t);const f=l||function(t,e){const n=e.props,o=t.propsConfig,r=o.latest,s=$n(n,r,t.templater.propWatch);return s}(s,p);if(!f){return void function(t,e,n,o,r){const s=t.props,c=Qn(e,n,o,s,r),u=e.propsConfig;u.castProps=c;const a=n.propsConfig;a.latest=u.latest}(p,e,s,t,p.propWatch===Bn.DEEP?Xn:Zn)}if(o.locked)return void r.blocked.push(e);ro(e),++o.renderCount}(o,c,e)}(e,t,o,r),!0;const c=t.global;if(c){const n=c.newest;if(n)return typeof e===A.function||function(t,e,n,o){let r=n.templater||n;const s=t.templater.tag;s&&s._innerHTML&&(r=n.outerHTML||n._innerHTML.outerHTML);const c=Gt(r,o,o.appSupport,e);Ut(t.context.global.oldest,c)}(n,t,e,o),!0}return e.processInit(e,t,o,r,void 0,t.placeholder),!0}function Zt(t,e,n,o){t!==n.value&&xe(n,t,e,o)}function Xt(t,e){const n=e.providers;if(n)for(const t of n)for(let n=t.children.length-1;n>=0;--n){t.children[n].context.global===e&&t.children.splice(n,1)}e.destroy$&&e.destroy$.next(),t.context.renderCount=0}function qt(t,e){for(const n of t){const t=n.lastArray;if(t){qt(t,e);continue}const o=n.value;if(o?.tagJsType===J.subscribe){o.delete(n,e);continue}const r=n.global;if(!r)continue;const s=r.newest,c=r.subscriptions;c&&c.forEach(Qt),Z(s.templater)&&Xt(s,r);qt(r.contexts,s)}}function Yt(t,e=[],n=[]){for(const o of t){const t=o.global;if(!t)continue;const r=t.newest;if(r){e.push(r);const o=t.subscriptions;o&&n.push(...o)}const s=t.contexts;s&&Yt(s,e,n)}return{tags:e,subs:n}}function Qt(t){t.unsubscribe()}function Kt(t,e){return!K(t)&&(te(e),9)}function te(t){ee(t,t.lastArray)}function ee(t,e){for(let t=0;t<e.length;++t)ce(e[t]);delete t.lastArray}function ne(t,e){!function(t,e){for(const n of t){if(n.locked)continue;if(n.withinOwnerElement){const t=n.tagJsVar;if(t&&"host"===t.tagJsType){const e=n.supportOwner;t.delete(n,e)}continue}const t=n.lastArray;if(t){ee(n,t);continue}const o=n.simpleValueElm;if(o){delete n.simpleValueElm,Fo(o);continue}const r=n.global;if(void 0===r)continue;if(!0===r.deleted)continue;r.deleted=!0;r.oldest&&ne(r,e)}}(t.contexts,e),function(t){const e=t.htmlDomMeta;for(let t=e.length-1;t>=0;--t){oe(e[t]),e.splice(t,1)}}(t)}function oe(t){const e=t.marker;e&&Fo(e);const n=t.domElement;n&&Fo(n)}function re(t,e){const n=t.context;e.deleted=!0,n.renderCount=0;const o=[];return qt(e.contexts,t),e.destroy$&&Xt(t,e),ne(e,o),o}function se(t,e,n,o){const r=t.length-1,s=e-o,c=s<0||r<s,u=n[e];if(c)return ce(u),1;const a=function(t,e,n,o,r){const s=e&&t!==e.arrayValue;if(s)return ce(n),o.splice(r,1),2;return 0}(u.value.arrayValue,t[e],u,n,e);return a}function ce(t){!function(t,e){if(t){return void re(t.oldest,t)}const n=e.simpleValueElm;delete e.simpleValueElm,Fo(n)}(t.global,t)}function ue(t,e,n,o,r,s){return e.tagJsVar.processInit(t,e,n,o,r,s)}function ae(t,e,n,o,r,s){const c=e.context;c.locked=!0,ue(t,n,e,o,r,s),delete c.locked,n.value=t}function ie(t){switch(t){case void 0:case!1:case null:return E}return t}function le(t){return{tagJsType:"simple",value:t,processInit:pe,delete:fe,checkValueChange:de,processUpdate:Zt}}function pe(t,e,n,o,r,s){const c=ie(t);s=e.placeholder;const u=e.paint=[Yo,[s,c,function(t){e.simpleValueElm=t,delete e.paint}]];No.push(u)}function fe(t){const e=t.simpleValueElm;delete t.simpleValueElm,Fo(e)}function de(t,e){return null!=t&&typeof t===A.object?(fe(e),6):(function(t,e){const n=ie(t);if(e.paint)return void(e.paint[1][1]=n);const o=e.simpleValueElm;Ro.push([_o,[n,o]])}(t,e),-1)}function ge(t){return{tagJsType:"array",value:t,processInit:he,processUpdate:Zt,checkValueChange:Kt,delete:te}}function he(t,e,n,o,r){ye(e,t,n,o,r)}function me(t){const e=t?.tagJsType;return e?t:function(t){if(K(t))return ge(t);return le(t)}(t)}function be(t,e,n,o,r,s){const c=document.createTextNode(E),u={value:t,tagJsVar:me(t),withinOwnerElement:!1,placeholder:c,valueIndex:o.length,valueIndexSetBy:"createAndProcessContextItem"};return s||No.push([zo,[r,c]]),ae(t,e,u,n,s,r),s&&Do.push([Zo,[s,c]]),u}function ye(t,e,n,o,r){const s=void 0===t.lastArray;s&&(t.lastArray=[]);const c=t.lastArray;let u=t.placeholder,a=0;const i=[];if(!s){for(let t=0;t<c.length;++t){const n=c[t],o=se(e,t,c,a);0!==o?2!==o?a+=o:t-=1:i.push(n)}t.lastArray=i}const l=e.length;for(let s=0;s<l;++s){u=ve(e,s,t.lastArray,n,u,o,r).placeholder}}function ve(t,e,n,o,r,s,c){const u=t[e],a=n[e];if(a)return function(t,e,n,o,r,s,c,u){const a=n.length>r;if(a)return Zt(t,o,e,c),e;const i=be(t,o,c,n,s,u);return n.push(i),i}(u,a,n,o,e,r,s,c);const i=be(u,o,s,n,r,c);return n.push(i),i}function we(t,e,n,o,r){const s=t&&t.tagJsType;if(e.tagJsVar=me(t),s){if(s===J.renderOnce)return;zt(e,t,n,r)}else{if(K(t))return ye(e,t,n,r),void(e.tagJsVar=ge(t));typeof t!==A.function?o&&function(t,e){e.value=t,e.tagJsVar=le(t);const n=e.placeholder,o=ie(t),r=e.paint=[Yo,[n,o,function(t){e.simpleValueElm=t,delete e.paint}]];No.push(r)}(t,e):e.value=t}}function xe(t,e,n,o){const r=t.tagJsVar.checkValueChange(e,t,o,n);-1!==r&&we(e,t,n,r,o)}function Te(t,e,n,o){const r=Ce(J.subscribe,t,e,n,o);if(r)return r;const s=n.subContext;return s&&s.hasEmitted?(s.callback=t.callback,s.valuesHandler(s.lastValues),-1):-1}function Ce(t,e,n,o,r){if(!e||!e.tagJsType||e.tagJsType!==t){return o.tagJsVar.delete(o,n),we(e,o,n,99,r),99}}function Se(t,e,n,o,r){return e.hasEmitted=!0,e.contextItem=be(t,n,o,[],r)}function ke(t,e){let n;return t&&(n=e=document.createTextNode(E),Do.push([Zo,[t,e]])),{appendMarker:n,insertBefore:e}}function Ee(t,e,n,o,r,s,c){const{appendMarker:u,insertBefore:a}=ke(s,c),i=function(t,e,n,o,r){const s=at(e);let c=function(t){Se(t,l,e,n,o),Ae(i),c=function(t){xe(l.contextItem,t,e,{added:0,removed:0}),Ae(i)}};function u(t,e){l.lastValues[e]=t,a(l.lastValues)}function a(t){if(Et(s.context.global.newest,s),l.callback){const e=l.callback(...t);c(e)}else c(t[0])}let i=!0;const l={lastValues:[],valueHandler:u,valuesHandler:a,callback:r,subscriptions:[]};return t.forEach(((t,e)=>{i=!0,l.subscriptions.push(t.subscribe((t=>u(t,e)))),i=!1})),l}(t,n,o,a,r);return i.appendMarker=u,e.subContext=i,e.tagJsVar.processUpdate=Te,i}function Ie(t,e){return t.subContext.subscriptions.forEach((t=>t.unsubscribe())),tr(t,e)}function Ae(t){t||kt.stateConfig.support||$o()}function Je(t,e,n,o,r,s){return Ee(t.Observables,e,n,o,t.callback,r,s)}function Ve(t,e,n,o,r,s){const c=t.Observables,u=Ee(c,e,n,o,t.callback,r,s);if(!u.hasEmitted){const e=c[0]?.value;u.valueHandler(e||t.withDefault,0)}return u}function Oe(t,e,n,o,r){Ee([t],e,n,o,void 0,r)}function Pe(t){return ct()?Re((()=>Me(t))):Me(t)}function Me(t){let e=t;const n=new Set,o=t=>{n.forEach((e=>e(t)))};return{tagJsType:J.signal,processInit:Oe,processUpdate:(t,e,n,o)=>Ce(J.signal,t,e,n,o),get value(){return e},set value(t){e!==t&&(e=t,o(t))},delete:Ie,emit:o,subscribe(t){t(e),n.add(t);const o=()=>n.delete(t);return o.unsubscribe=o,o}}}class je extends xt{value;constructor(t){super(t),this.value=t}subscribe(t){const e=super.subscribe(t);return t(this.value,e),e}}class Le extends xt{value;constructor(t){super(t),this.value=t,this._value=t,Ct(this)}subscribe(t){const e=super.subscribe(t);return t(this._value,e),e}}function He(t){return(e,n)=>{n.setHandler((()=>{})),t(e,n.next)}}function Ne(t){return(e,n)=>{n.setHandler((()=>{}));t(e).then((t=>n.next(t)))}}const Ue=t=>(e,n)=>{n.setHandler((()=>{}));const o=t(e).subscribe((t=>{o.unsubscribe(),n.next(t)}))};function Re(t){return kt.stateConfig.handlers.handler(t)}const De=(t,e)=>Be(t,e),We=t=>t;const Be=(t,e,{init:n,before:o,final:r=We}={})=>{const s=Re({pastResult:void 0,values:void 0}),c=s.values;if(void 0===c){if(o&&!o(t))return s.values=t,s.pastResult;const u=(n||e)(t,c);return s.pastResult=r(u),s.values=t,s.pastResult}if(t.every(((t,e)=>t===c[e])))return s.pastResult;if(o&&!o(t))return s.values=t,s.pastResult;const u=e(t,c);return s.pastResult=r(u),c.length=0,c.push(...t),s.pastResult};function _e(t,e){return Object.defineProperty(e,"noInit",{get(){const e=t();return e.setup.init=()=>{},e}}),Object.defineProperty(e,"asSubject",{get(){const e=t(),n=Re((()=>ct())),o=Re((()=>new je(void 0))),r=Re((()=>({stateArray:kt.stateConfig.stateArray,states:kt.stateConfig.states}))),s=(t,s)=>(Be(t,((t,e)=>{const c=ct(),u=s(t,e);if(c!==n){const t=r.stateArray,e=n.context.global.oldest;Pt(t,e.state,r.states,e.states)}o.next(u)}),e.setup),o);return s.setup=e.setup,_e((()=>s),s),s}}),Object.defineProperty(e,"truthy",{get(){const e=t();return e.setup.before=t=>t.every((t=>t)),e}}),e}function $e(t){return ct()?Re((()=>new xt(t))):new xt(t)}function Fe(t){return kt.stateConfig.handlers.statesHandler(t)}function Ge(t){const e=Pe([]),n=Pe(0),o=Pe(0);let r=[],s=0;return o.value=n.value,t(((...t)=>(r=t,e.value))),De(r,(()=>{++s,e.value=r,t((()=>r))})),Fe(((r,c)=>{if(s)return t(((...t)=>(c&&1!==c||(e.value=t),e.value))),o.value=n.value,void++n.value;t((()=>e.value))})),++s,e.value}function ze(){return{stateDiff:0,provider:void 0}}_e((()=>function(t){const e=(e,n)=>Be(e,n,t);return e.setup=t,_e((()=>e),e),e}({})),De),$e._value=t=>{const e=Re((function(){return{stateArray:kt.stateConfig.stateArray,states:kt.stateConfig.states}})),n=ct();return Re((function(){return new je(t).pipe((t=>(Pt(n.state,e.stateArray,n.states,e.states),t)))}))},$e.all=function(t){const e=Re((()=>({stateArray:kt.stateConfig.stateArray,states:kt.stateConfig.states}))),n=ct();return xt.all(t).pipe((t=>(Pt(n.state,e.stateArray,n.states,e.states),t)))};const Ze={create:t=>{const e=Re(ze);if(e.stateDiff){let t=e.stateDiff;for(;t--;)Re(void 0);return Re(void 0)}const n=Re((()=>{const n=kt.stateConfig,o=n.stateArray.length,r=t.prototype?new t:t(),s=n.support,c=n.stateArray.length-o,u={constructMethod:t,instance:r,stateDiff:c,owner:s,children:[]};e.provider=u;const a=s.context.global;return(a.providers=a.providers||[]).push(u),e.stateDiff=c,r})),o=t,r=o.compareTo=o.toString();return e.provider.constructMethod.compareTo=r,n},inject:function(t){return Re((function(){const e=t,n=e.compareTo=e.compareTo||t.toString(),o=ct(),r=[];let s={ownerSupport:o.ownerSupport};for(;s.ownerSupport;){const t=s.ownerSupport.context.global.providers;if(!t){s=s.ownerSupport;continue}const e=t.find((t=>{r.push(t);if(t.constructMethod.compareTo===n)return!0}));if(e){const t=o.context.global;return(t.providers=t.providers||[]).push(e),e.children.push(o),e.instance}s=s.ownerSupport}const c=`Could not inject provider: ${t.name} ${t}`;throw console.warn(`${c}. Available providers`,r),new Error(c)}))}};class Xe extends Error{details;constructor(t,e,n={}){super(t),this.name=Xe.name,this.details={...n,errorCode:e}}}class qe extends Xe{constructor(t,e){super(t,"array-no-key-error",e),this.name=qe.name}}class Ye extends Xe{constructor(t,e){super(t,"state-mismatch-error",e),this.name=Ye.name}}class Qe extends Xe{constructor(t,e){super(t,"sync-callback-error",e),this.name=Qe.name}}function Ke(t){const e=ct();if(!e)throw nn;return tn(e,kt.stateConfig,t)}function tn(t,e,n){const o=e.states;return function(...e){return t.context.renderCount>0?function(t,e,n,...o){const r=t.context.global.newest,s=n(...o);return ro(r),q(s)&&s.finally((()=>{ro(r)})),s}(t,o,n,...e):n(...e)}}const en=()=>{const t=ct();if(!t)throw nn;const e=kt.stateConfig;return function(n){return tn(t,e,n)}},nn=new Qe("callback() was called outside of synchronous rendering. Use `callback = callbackMaker()` to create a callback that could be called out of sync with rendering");function on(t){++Bo.locks,t.forEach(rn),--Bo.locks,$o()}function rn(t){const e=t.context.global;e&&ro(e.newest)}function sn(t,e,n,o,{resolvePromise:r,resolveValue:s}){if(q(t)){return e.context.locked=!0,t.then(function(t,e){return n=>{if(!0===t.context.global.deleted)return e(n);const o=t.context,r=t.context.global;delete o.locked,Et(t,r.newest);return on(ao(t)),e(n)}}(e,r))}return s(t)}function cn(t){Re((()=>{const e=t(),n=ct();return sn(e,n,n.context.global,0,{resolvePromise:un,resolveValue:an})}))}function un(t){return t}function an(t){return t}function ln(t){Re((function(){ct().context.global.destroy$.toCallback(t)}))}function pn(t=[]){return ct()?Re((()=>fn(Me(t)))):fn(Me(t))}function fn(t){const e=["push","pop","splice","shift","unshift"],n=["map","reduce","forEach","every"],o=new Proxy(t,{get(r,s){return isNaN(s)?"length"===s?t.value.length:e.includes(s)?o[c=s]=(...e)=>{const n=t.value[c](...e);return t.emit(t.value),n}:n.includes(s)?t.value[s].bind(t.value):t[s]:t.value[s];var c},set:(e,n,o)=>isNaN(n)?"length"===n?(t.value.length=o,t.emit(t.value),!0):(t[n]=o,!0):(t.value[n]=o,t.emit(t.value),!0)});return o}function dn(t,e){const n=gn(t,e);return!(n||!e.templater.tag?._innerHTML||!gn(t.outerHTML,e))||n}function gn(t,e){const n=t.templater,o=e.templater,r=n?.tag||t,s=o.tag;if(n?.tagJsType===J.stateRender)return n.dom===o.dom;switch(r.tagJsType){case J.dom:return s?.tagJsType===J.dom&&function(t,e){const n=t.dom,o=e.dom;return n===o}(r,s);case J.tag:{const n=function(t,e,n,o){const r=t.strings,s=e.strings;if(r.length!==s.length)return!1;if(!r.every(((t,e)=>s[e].length===t.length)))return!1;const c=n.templater.values||t.values,u=o.templater.values||e.values;return function(t,e){const n=t.length===e.length;if(!n)return!1;const o=e.every((function(e,n){const o=t[n];if(typeof e===A.function&&typeof o===A.function){return!!(e.toString()===o.toString())}return!0}));if(o)return!0;return!1}(c,u)}(r,s,t,e);return n}}throw new Error(`unknown tagJsType of ${r.tagJsType}`)}function hn(t,e,o){const r=e.global,s=r?.newest;if(z(t)){return dn(t,s)?(zt(e,t,s,o),-1):(re(s,r),n(e),7)}const c=t?.tagJsType;if(c){return!0===zt(e,t,r.newest.ownerSupport,o)?-1:88}return mn(e),8}function mn(t){const e=t.global,n=e?.newest;re(n,e),delete t.global,t.renderCount=0}function bn(t,e,n,o){const r=t.context.global;r.oldest=t,r.newest=t,++Bo.locks;const s=function(t,e,n,o){const r=function(t){const e=t.templater,n=e.tag;if(n.tagJsType===J.dom)return n.dom;const o=n.strings;return H(o,n.values)}(t),s=t.templater.tag,c=s.values,u=[],a=t.context.global;a.contexts=u;const i=Po(r,c,t,e,u,0,n,o);return i}(t,e,n,o);return r.htmlDomMeta=s.dom,--Bo.locks,s}function yn(t,e,n){const o={value:t,valueIndex:e.length,valueIndexSetBy:"addOneContext",tagJsVar:me(t),withinOwnerElement:n};return e.push(o),o}function vn(t,e,n){const o=e.global.newest,r=e.placeholder;return o.ownerSupport=t,bn(o,n,void 0,r),o}function wn(t){const e={tagJsType:J.templater,processInit:Cn,checkValueChange:hn};return e.tag=t,t.templater=e,e}function xn(t,e,n){const o=Ft(t,e,e.appSupport,n);return n.global.contexts=[],o}function Tn(t,e,n,o,r,s){const c=xn(t,n,e);c.ownerSupport=n;const u=bn(c,o,r,r?void 0:s);for(const t of u.dom)t.marker&&(r?Do.push([Zo,[r,t.marker]]):No.push([zo,[s,t.marker]])),t.domElement&&(r?Do.push([Zo,[r,t.domElement]]):No.push([zo,[s,t.domElement]]));return c}function Cn(t,e,n,o,r,s){return r?Tn(t,e,n,o,r,s):vn(n,e,o)}function Sn(t,e){const n={tagJsType:J.templater,processInit:Cn,processUpdate:Zt,checkValueChange:hn,delete:mn,propWatch:t,props:e,key:function(t){return n.arrayValue=t,n}};return n}const kn=[];function En(t){const e=t.context;return oo(t.templater)?so(t):no(t,t,e)}function In(t,e,n){return t.map((function(t){return function(t,e,n,o){if(z(t)||!t)return t;if(!e)return t;return An(t,e,n,o)}(t,e.ownerSupport,e,n)}))}function An(t,e,n,o,r){if(!t)return t;if(t.tagJsType)return t;if(typeof t===A.function)return o<=1?function(t,e,n){const o=t.mem;if(o)return t;const r=function(...t){return function(t,e,n,o){const r=o.context.global,s=r?.newest||o,c=void 0===ct(),u=t.apply(e,n),a=function(){const t=s.context;return t.global&&!0!==t.locked?(En(s),u):u};if(c)return a();return kt.tagClosed$.toCallback(a),u}(r.mem,e,t,n)};return r.original=t,r.mem=t,Object.assign(r,t),r}(t,r,e):t;if(o===Xn)return t;return Vn(t)?t:K(t)?function(t,e,n,o){for(let r=t.length-1;r>=0;--r){const s=t[r];if(t[r]=An(s,n,e,o+1,t),typeof s===A.function){if(s.mem)continue;Jn(o+1,r,s,t,e)}}return t}(t,n,e,o):function(t,e,n,o){const r=Object.keys(t);for(const s of r){const r=t[s],c=An(r,n,e,o+1,t);if(t[s]===c)continue;const u=Object.getOwnPropertyDescriptor(t,s);if(!(u?.get||u?.set)&&(t[s]=c,typeof c===A.function)){if(r.mem)continue;Jn(o+1,s,r,t,e)}}return t}(t,n,e,o)}function Jn(t,e,n,o,r){if(t>0){const t=r.context.global;o[e].subscription=t.destroy$.toCallback((function(){o[e]=n}))}}function Vn(t){return typeof t!==A.object||!t||t.tagJsType}function On(t,e,n,o){const r=e.original,s=t.tagJsType===J.stateRender,c=kt.stateConfig;let u;return ut(n),s?u=t():(u=r(...o),typeof u===A.function&&(u=u())),u.templater=t,t.tag=u,n.state=c.stateArray,n.states=c.states,n}function Pn(t,e,n){const o=t.propWatch===Bn.DEEP?Xn:Zn,r=t.props,s=e.propsConfig;let c=s.castProps;const u=n?.propsConfig,a=u?.castProps;a&&(s.castProps=a,c=Qn(e,n,n.ownerSupport,r,o));return c||In(r,e,0)}function Mn(t,e,n){const o=Sn(Bn.DEEP);o.tagJsType=t.tagJsType;const r=xn(o,n,e);function s(){return o.tag=t(),r}return o.wrapper=s,s.tagJsType=t.tagJsType,s.original=t.original||t,r}function jn(t,e){const n=t.rearray;n.length&&n.length!==t.stateArray.length&&function(t,e,n){const o=`Saved states between renders are inconsistent. Expected ${t.length} states got ${n.stateArray.length}.`,r=e.templater?.wrapper;let s=r;(r?.original||r?.original)&&(s=r.original);const c={oldStates:n.stateArray,newStates:n.rearray,tagFunction:s,templater:e.templater},u=new Ye(o,c);throw console.error(Ln,c),u}(n,e,t)}const Ln="State tracking requires same number of state calls on every render. This error typically occurs when a state call is only reachable behind a condition. Also, wrapping tags that have state, with tag(), often helps when tag is only reachable by a condition.";function Hn(t,e){const n=t.context;++n.renderCount;const o=kt.stateConfig;t.state=o.stateArray,t.states=o.states,n.global.newest=t,jn(o,t),delete o.prevSupport,delete o.support,delete o.stateArray,delete o.states,kt.tagClosed$.next(e)}function Nn(t,e,n,o){!function(t,e){const n=e?.state;if(n)return void dt(t,e,n);ft(t)}(t,e);const r=t.templater;let s;if(r.tagJsType===J.stateRender){const e=r;s=Gt(r,o,t.appSupport,n),On(r,e,s)}else{s=(0,r.wrapper)(t,n,e)}return Hn(s,o),s.ownerSupport=t.ownerSupport,s}function Un(t,e,o,r,s,c){n(e);const u=Mn(t,e,o);return Nn(u,void 0,e),Tn(u.templater,e,o,r,s,c)}function Rn(t,e,n,o,r){const s=Gt(t,n,n.appSupport,e),c=s.propsConfig;if(c){const e=t.tagJsType!==J.tagComponent?[]:Pn(t,s);c.castProps=e}return function(t,e,n){const o=bn(t,e,n,void 0);for(const t of o.dom)t.domElement&&Do.push([Zo,[n,t.domElement]]),t.marker&&Do.push([Zo,[n,t.marker]]);return t}(Nn(s,e.global.newest,e),o,r)}function Dn(t,e,o,r,s){if(n(e),s){return Rn(t,e,o,r,s)}const c=function(t,e,n,o){const r=Gt(t,n,n.appSupport,e),s=r.propsConfig;if(s){const e=t.tagJsType!==J.tagComponent?[]:Pn(t,r);s.castProps=e}const c=Nn(r,e.global.newest,e);return bn(c,o,void 0,e.placeholder),c}(t,e,o,r);return c}let Wn=0;var Bn;function _n(t,e=Bn.SHALLOW){const n=function(...o){const r=Sn(e,o);r.tagJsType=J.tagComponent,r.processInit=Dn;const s=function(t,e){return function(n,o,r){const s=Pn(t,n,r),c=n.ownerSupport,u=Gt(t,c,n.appSupport,o,s);return On(t,e,u,s)}}(r,n);return s.original=t,r.wrapper=s,r},o=t;return n.original=t,o.tags=kn,o.setUse=kt,o.ValueTypes=J,o.tagIndex=Wn++,kn.push(n),n}function $n(t,e,n){if(uo(t,e))return 11;switch(n){case Bn.NONE:return 1;case Bn.SHALLOW:return zn(t,e);case Bn.IMMUTABLE:return Gn(t,e)}return function(t,e){let n=t,o=e;n=[...t],o=[...e||[]];if(!n.every(((t,e)=>function(t,e,n,o){const r=o[e];if(typeof t===A.object){const e={...t},n={...r||{}},o=Object.entries(e).every((([t,o])=>Fn(o,n[t],(()=>{delete e[t],delete n[t]}))));return o}return Fn(t,r,(function(){n.splice(e,1),o.splice(e,1)}))}(t,e,n,o))))return 7;return!1}(t,e)}function Fn(t,e,n){if(typeof t!==A.function)return!!rt(t,e,Xn)&&4;if(typeof e!==A.function)return!1;const o=e?.original;o&&(e=o);t.original&&(t=t.original);return t.toString()===e.toString()?(n(),5):(n(),6)}function Gn(t,e){const n=t.length;for(let o=0;o<n;++o){if(t[o]!==e[o])return 2}return!1}function zn(t,e){const n=t.length;for(let o=0;o<n;++o){const n=t[o],r=e[o];if(K(n)&&K(r)){if(n===r)continue;return 3}if(typeof n!==A.function||typeof r!==A.function)if(typeof n!==A.object){if(n!==r)return 3.3}else if(typeof e===A.object){const t=Object.entries(n);for(const e of t){if(!qn(e,r))return 3.1}}}return!1}!function(t){t.DEEP="deep",t.SHALLOW="shallow",t.NONE="none",t.IMMUTABLE="immutable"}(Bn||(Bn={})),_n.renderOnce=function(){throw new Error("Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `")},_n.use=function(){throw new Error("Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `")},_n.deepPropWatch=_n,_n.route=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},_n.app=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},_n.immutableProps=function(t){return _n(t,Bn.IMMUTABLE)},_n.watchProps=function(t){return _n(t,Bn.SHALLOW)},Object.defineProperty(_n,"renderOnce",{set(t){t.tagJsType=J.renderOnce,t.processInit=Un,t.processUpdate=Zt,t.delete=mn,t.checkValueChange=function(){return-1}}}),Object.defineProperty(_n,"use",{set(t){t.original={setUse:kt,tags:kn},t.tagJsType=J.stateRender,t.processInit=Dn,t.processUpdate=Zt,t.checkValueChange=hn,t.delete=mn}});const Zn=3,Xn=10;function qn([t,e],n){const o=n[t];return typeof e===A.function&&typeof o===A.function||o===e}function Yn(t,e,n,o,r,s){return null==t||s>r?e:typeof t===A.function?e.mem?(t.mem=e.mem,e):(t.mem=e,t):Vn(e)?e:K(e)?function(t,e,n,o,r,s){for(let c=t.length-1;c>=0;--c){const u=t[c],a=e[c];t[c]=Yn(a,u,n,o,s,r+1)}return t}(e,t,n,o,s,r):function(t,e,n,o,r,s){const c=Object.keys(t);for(const u of c){const c=t[u],a=Yn(e[u],c,n,o,s,r+1);if(c===a)continue;const i=Object.getOwnPropertyDescriptor(t,u)?.set;i||(t[u]=a)}return t}(e,t,n,o,s,r)}function Qn(t,e,n,o,r,s=-1){const c=e.context.global;if(!c||!c.newest){const e=In(o,t,s);o.push(...e);return t.propsConfig.castProps=e,o}const u=(e=c.newest||e).propsConfig.castProps,a=[];for(let e=0;e<o.length;++e){const c=o[e],i=Yn(u[e],c,t,n,r,s+1);a.push(i)}return t.propsConfig.castProps=a,a}function Kn(t){const e=t.context,o=e.global,{subs:r,tags:s}=Yt(o.contexts);to(o);for(const t of s){const e=t.context.global;if(!0===e.deleted)return;to(e)}o.subscriptions&&r.forEach(Qt),n(e)}function to(t){t.deleted=!0,ne(t,[])}function eo(t,e,n){const o=Nn(t,e,n),r=!e||dn(e,o);if(r){if(e){const t=e.templater.tag;if(t&&n.renderCount>0){const n=e?.templater,o=n?.tag;!function(t,e,n){if(t.tagJsType===J.dom){const o=n?.dom;return void(o!==t.dom&&Kn(e))}if(n){const o=n.strings;if(o){const n=o?.length;n!==t.strings.length&&Kn(e)}}}(t,e,o)}}}else{!function(t,e){const n=t.context.global;let o=-1;const r=n.providers=n.providers||[],s=r.length-1;for(;o++<s;){const t=r[o];let s=-1;const c=t.children.length-1;for(;s++<c;)if(n===t.children[s].context.global)return t.children.splice(s,1),void t.children.push(e)}}(e,o),Kn(e);const t=o.context.global;t.oldest=o,t.newest=o}return o.ownerSupport=t.ownerSupport,{support:o,wasLikeTags:r}}function no(t,e,n){const o=eo(e,t,n),r=n.global;return o.wasLikeTags?(Ut(r.oldest,o.support),o.support):vn(e,n,{added:0,removed:0})}function oo(t){return J.templater===t.tagJsType}function ro(t){const e=t.context,n=e.global,o=oo(t.templater);if(e.locked)return n.blocked.push(t),t;if(o){return so(t)}e.locked=!0,n.blocked.length&&(t=n.blocked.pop(),n.blocked=[]);const r=no(n.newest,t,e);return delete e.locked,r}function so(t){return ro(at(t).context.global.newest)}function co(t,e){const n=function(t,e){const n=t.props,o=e.propsConfig,r=o.latest;if(uo(n,r))return!0;switch(t.propWatch){case Bn.IMMUTABLE:return Gn(n,r);case Bn.SHALLOW:return zn(n,r)}return!rt(n,r,Xn)}(t,e);return!!n}function uo(t,e){return t.length!==e.length}function ao(t,e=[]){const n=t.context,o=oo(t.templater),r=t.ownerSupport;if(n.locked)return e.push(t),e;if(o)return ao(r,e);const s=t,c=Z(s.templater),u=t.templater.tagJsType,a=r&&u!==J.stateRender&&(!c||co(s.templater,s)),i=function(t){const e=t.context.global.providers;if(!e)return[];const n=[];for(const t of e){const e=tt(t.owner,t);n.push(...e.map(et))}return n}(s);return e.push(...i),a?(ao(r,e),c&&e.push(s),e):(e.push(s),e)}function io(t,e){const n=e.context.global,o=function(t,e){if(!0!==n.deleted)return function(t,e,n,o){const r=at(e),s=r.context;s.locked=!0;const c=t.apply(n,o);delete s.locked;return function(t,e){e.context.global;return function(t,e,n){return on(ao(t)),sn(e,t,0,0,{resolvePromise:fo,resolveValue:go})}(e,t)}(c,r)}(o.tagFunction,o.support,t,e)};return o.tagFunction=t,o.support=e,o}const lo="no-data-ever",po="promise-no-data-ever";function fo(){return po}function go(){return lo}function ho(t,e,n,o,r,s,c){if(c)return D(t,e,n,c);o(n,t,e)}function mo(t,e,n,o){const r=t.appElement;"blur"===e&&(e="focusout");const s="_"+e,c=t.context.global.events;if(!c[e]){const t=function(t){t.originalStopPropagation=t.stopPropagation,bo(t,s,t.target)};c[e]=t,r.addEventListener(e,t)}n[s]=o,n[e]=o}function bo(t,e,n){const o=n[e];if(o){let e=!1;if(t.stopPropagation=function(){e=!0,t.originalStopPropagation.call(t)},o(t),t.defaultPrevented||e)return}const r=n.parentNode;r&&bo(t,e,r)}function yo(t,e,n,o){const r=function(...e){return r.tagFunction(t,e)};r.tagFunction=e,r.support=n,mo(n.appSupport,o,t,r)}function vo(t){return null==t||!1===t}function wo(t,e){t.removeAttribute(e)}function xo(t,e,n,o,r){if(n.isNameOnly)return function(t,e,n,o,r,s,c,u){if(n){if(vo(e))return void o.removeAttribute(n);if(typeof n===A.object)if(typeof e===A.object)for(const t in n)t in e||Ro.push([wo,[o,t]]);else for(const t in n)Ro.push([wo,[o,t]])}Eo(t,e,o,r,s,c,u)}(r,t,n.value,n.element,e,n.howToSet,[],{added:0,removed:0}),void(n.value=t);const s=n.element;!function(t,e,n,o,r,s,c,u){if(Y(t))return function(t,e,n,o,r,s,c,u){const a=t.templater.wrapper;if((a?.tagJsType||a?.original?.tagJsType)!==J.renderOnce)return Ao(c,e,t,o,n);return Io(e,n,o,r,s,t,u)}(r,t,o,e,c,s,n,u);Io(t,o,e,c,s,r,u)}(t,n.attrName,n,s,e,n.howToSet,n.isSpecial,{added:0,removed:0}),n.value=t}function To(t,e,n,o,r,s,c,u,i){const l=o.length;function p(o){const s=function(t,e,n){return t.reduce(((t,o)=>{if(a(o)>=0){const o=n++,r=e[o];return t.push(r),t}return t.push(o),t}),[])}(e,o,l).join("");r(n,t,s)}e.forEach((e=>{if(a(e)>=0){const r=o.length,s=me(e),c={isAttr:!0,element:n,attrName:t,withinOwnerElement:!0,tagJsVar:s,valueIndex:o.length,valueIndexSetBy:"createDynamicArrayAttribute"};s.processUpdate=function(t,e,n,o,r){p(r)};const a=u[r];c.value=a,o.push(c)}})),p(u)}function Co(t,e,n,o,r,s,c,u,a){const i=me(e),l={isAttr:!0,element:n,attrName:t,withinOwnerElement:!0,tagJsVar:i,valueIndex:a,valueIndexSetBy:"createDynamicAttribute"};o.push(l),i.processUpdate=xo,function(t,e,n,o,r,s,c,u){n.element=o,n.howToSet=r,typeof e===A.function?Ao(n,e,s,t,o):(n.attrName=t,n.isSpecial=u,ho(t,e,o,r,0,0,u))}(t,e,l,n,r,s,0,u),l.value=e}function So(t){return Q(t)&&"tagJsVar"in t?t.tagJsVar:-1}function ko(t,e,n,o,r,s,c,u,a){const i=So(e);if(i>=0){const e=t[i],c=yn(e,s,!0);if(c.valueIndex=i,c.valueIndexSetBy="processAttribute",c.isAttr=!0,c.element=n,c.isNameOnly=!0,e.tagJsType)return c.tagJsVar=e,c.stateOwner=at(o),c.supportOwner=o,function(t,e,n){return void e.processInit(t,e,n)}(n,e,c);c.howToSet=r;return c.tagJsVar.processUpdate=xo,void Eo(t,e,n,o,r,s,u)}if(Array.isArray(a))return To(e,a,n,s,r,0,0,t);const l=So(a);if(l>=0){return Co(e,t[l],n,s,r,o,0,c,l)}return ho(e,a,n,r,0,0,c)}function Eo(t,e,n,o,r,s,u){if(!vo(e))if(typeof e!==A.object)0!==e.length&&r(n,e,E);else for(const a in e){const i=e[a];ko(t,a,n,o,r,s,c(a),u,i)}}function Io(t,e,n,o,r,s,c){if(!1===o){switch(t){case void 0:case!1:case null:return void Ro.push([Jo,[e,n]])}if(Y(t))return yo(e,t,s,n);r(e,n,t)}else D(n,t,e,o)}function Ao(t,e,n,o,r){e=io(e,n);return t.tagJsVar.processUpdate=xo,yo(r,e,n,o)}function Jo(t,e){t.removeAttribute(e)}function Vo(t,e,n,o,r,s,c){const u=document.createTextNode(E),a=yn(t,e,r>0);a.placeholder=u,s?Do.push([Zo,[s,u]]):No.push([zo,[c,u]]),ae(t,n,a,o,s,c)}const Oo=function(){};function Po(t,e,n,o,r,s,c,u){const a=[];c&&void 0===u&&(u=document.createTextNode(E),Do.push([Zo,[c,u]]),c=void 0);for(let i=0;i<t.length;++i){const l=t[i],p=l.v;if(!isNaN(p)){Vo(e[r.length],r,n,o,s,c,u);continue}const f={};if(a.push(f),"text"===l.nn){jo(f,l,c,u);continue}const d=Mo(f,l,e,n,r,o,c,u);l.ch&&(f.ch=Po(l.ch,e,n,o,r,s+1,d,u).dom)}return{dom:a,contexts:r}}function Mo(t,e,n,o,r,s,c,u){const a=t.domElement=document.createElement(e.nn);if(e.at)for(const t of e.at){const e=t[0],c=t[1],u=t[2]||!1;ko(n,e,a,o,t.length>1?R:U,r,u,s,c)}return c?Do.push([Zo,[c,a]]):No.push([zo,[u,a]]),a}function jo(t,e,n,o){const r=t,s=r.tc=e.tc;n?Do.push([Ko,[n,s,function(t){r.domElement=t}]]):No.push([Qo,[o,s,function(t){r.domElement=t}]])}function Lo(t){Ho.length&&(Ho[Ho.length-1].paintRemoves.push(...Uo),Uo=[]),Ho.push({promise:t,paintRemoves:Uo}),Uo=[]}let Ho=[],No=[],Uo=[],Ro=[],Do=[],Wo=[];const Bo={locks:0,removeLocks:0};function _o(t,e){e.textContent=t}function $o(){if(!(Bo.locks>0))return function(){(function(){if(Ho.length){const t=Ho.map((t=>t.promise.then((()=>{const e=t.paintRemoves;for(const t of e)t[0](...t[1])}))));Ho=[];const e=Uo;return Promise.all(t).then((()=>{for(const t of e)t[0](...t[1])}))}for(const t of Uo)t[0](...t[1])})(),Uo=[];for(const t of Ro)t[0](...t[1]);for(const t of Do)t[0](...t[1]);for(const t of No)t[0](...t[1])}(),void function(){No=[],Ro=[],Do=[];const t=Wo;Wo=[];for(const e of t)e[0](...e[1])}()}function Fo(t){Uo.push([Go,[t]])}function Go(t,e){t.parentNode.removeChild(t)}function zo(t,e){t.parentNode.insertBefore(e,t)}function Zo(t,e){t.appendChild(e)}const Xo="object"==typeof document&&document.createElement("div");function qo(t){return Xo.innerHTML=t,document.createTextNode(Xo.innerHTML)}function Yo(t,e,n=Oo){const o=qo(e);zo(t,o),n(o)}function Qo(t,e,n=Oo){Xo.innerHTML=e;const o=document.createTextNode(Xo.textContent);zo(t,o),n(o)}function Ko(t,e,n){Xo.innerHTML=e;const o=document.createTextNode(Xo.textContent);Zo(t,o),n(o)}function tr(t,e){const n=t.subContext;n.deleted=!0,delete t.subContext;const o=n.appendMarker;if(o&&(Fo(o),delete n.appendMarker),delete t.delete,!n.hasEmitted)return;const r=n.contextItem;return r.tagJsVar.delete(r,e),76}function er(t,e,o,r,s,c){const u=t;let a=u.templater;a||(a=wn(u));const i=n(e);return s?Tn(a,e,o,r,s,c):(i.newest=xn(a,o,e),vn(o,e,r))}function nr(t,e,n,o,r,s){er(t.outerHTML,e,n,o,r,s);e.tagJsVar.processUpdate=function(t,e,n,o){xe(n,t?.outerHTML||t,e,o)},t.checkValueChange=or}function or(t,e,n){return hn(t,e,n)}function rr(t,e){const n={values:e,ownerSupport:ct(),dom:t,tagJsType:J.dom,processInit:er,processUpdate:Zt,checkValueChange:hn,delete:mn,key:function(t){return n.arrayValue=t,n},setHTML:function(t){return t.outerHTML=n,n._innerHTML=t,t.oldProcessInit=t.processInit,t.processInit=nr,n},acceptInnerHTML:function(t){return t.owner=n,n},html:{dom:function(t,e){return n.children={dom:t,values:e},n}}};return Object.defineProperty(n,"innerHTML",{set:t=>n.setHTML(t)}),n}function sr(t,...e){const n=function(t,e){const n={values:e,ownerSupport:ct(),tagJsType:J.tag,processInit:er,processUpdate:Zt,checkValueChange:hn,delete:mn,strings:t,key:t=>(n.arrayValue=t,n),setHTML:function(t){return t.outerHTML=n,n._innerHTML=t,t.oldProcessInit=t.processInit,t.processInit=nr,n},acceptInnerHTML:function(t){return t.owner=n,n},html:function(t,e){return n.children={strings:t,values:e},n}};return Object.defineProperty(n,"innerHTML",{set:t=>n.setHTML(t)}),n}(t,e),o=Sn(Bn.NONE);return o.tag=n,n.templater=o,n}function cr(t,e){t.domElement&&e.appendChild(t.domElement),t.marker&&e.appendChild(t.marker)}function ur(t,e,n){const o=e.global,r=_t(t,e);return $t(t,r,r),r.appElement=n,o.oldest=o.oldest||r,o.newest=r,r}function ar(t,e,n,o,r,s,c){const u=document.createTextNode(E);kn.push(n.wrapper||{original:n});const a=function(t,e,n,o,r){o.placeholder=e;const s=o.global,c=s.oldest,u=s.newest===c,a=Gt(t,s.newest,s.newest.appSupport,o);u||dt(a,s.newest,c.state);if(t.tagJsType===J.stateRender)return function(t,e,n,o,r){const s=t.wrapper||{original:t};if(!e){const e=ur(t,o,r);return Hn(e),e}return On(t,s,n),Hn(n),n}(t,r,a,o,n);const i=t.wrapper,l=i(a,o);return Hn(a),l}(n,u,r,s,c);if(e.isApp=!0,c&&(o.tag=a.templater.tag),!r)throw new Error(`Cannot tagElement, element received is type ${typeof r} and not type Element`);r.destroy=function(){const t=e.events;for(const e in t){const n=t[e];r.removeEventListener(e,n)}e.events={},++Bo.locks;const n=re(a,e);return--Bo.locks,$o(),n},++Bo.locks;const i=function(t,e,n,o,r,s){console.debug("🏷️ Building element into tag...",{element:e,app:r,support:t});const c=bn(t,{added:0,removed:0},e,void 0);n.oldest=t,n.newest=t;let u=o.setUse;if(o.tagJsType!==J.stateRender){const t=r.original;u=t.setUse,t.isApp=!0}e.setUse=u,e.ValueTypes=J,ir.push({element:e,support:t});const a=document.createDocumentFragment();a.appendChild(s);for(const t of c.dom)cr(t,a);return console.debug("🏷️ Element Tag DOM built ✅"),a}(a,r,e,n,t,u);return--Bo.locks,$o(),r.appendChild(i),{support:a,tags:kn,ValueTypes:J}}sr.dom=function(t,...e){return rr(t,e)},"object"==typeof document&&(document.taggedJs&&console.warn("🏷️🏷️ Multiple versions of taggedjs are loaded. May cause issues."),document.taggedJs=!0);const ir=[];function lr(t,e,o){const r=ir.findIndex((t=>t.element===e));if(r>=0){const t=ir[r].support;re(t,t.context.global),ir.splice(r,1),console.warn("Found and destroyed app element already rendered to element",{element:e})}let s=()=>a(o);s.propWatch=Bn.NONE,s.tagJsType=J.stateRender,s.processUpdate=Zt,s.props=[o],s.isApp=!0;const c=function(t,e){const o={value:t,valueIndex:0,valueIndexSetBy:"getNewSubject",withinOwnerElement:!1,renderCount:0,global:void 0,tagJsVar:{tagJsType:"templater",checkValueChange:hn,delete:mn,processInit:function(){console.debug("do nothing app function")},processUpdate:Zt}},r=n(o);return r.events={},ur(t,o,e),o}(s,e),u=c.global;ft(u.newest);let a=t(o);const i=typeof a==A.function;return i||(Z(a)?(u.newest.propsConfig={latest:[o],castProps:[o]},s.propWatch=a.propWatch,s.tagJsType=a.tagJsType,s.wrapper=a.wrapper,s=a):(s.tag=a,a=t)),ar(t,u,s,a,e,c,i)}function pr(t){if(!t)return Oo;const e=ct();if(!e)throw new Error("output must be used in render sync fashion");return(...n)=>{const o=e.ownerSupport;return fr(n,t,o)}}function fr(t,e,n){const o=n.context.global.newest;It(o.states,n.states);const r=e(...t);return It(n.states,o.states),Wo.push([()=>{o.context.global&&(++Bo.locks,En(o),--Bo.locks,$o())},[]]),r}function dr(t,e){const n=ct(),o=n?at(n).states:[];return{tagJsType:J.subscribe,processInit:Je,processUpdate:Te,delete:Ie,callback:e,states:o,Observables:[t]}}function gr(t,e,n,o){const r=t.owner._innerHTML;r.processInit=r.oldProcessInit;const s=n.subContext?.contextItem;xe(s,r,e,o)}function hr(t,e,n,o,r,s){e.subContext={},t.processUpdate=gr,function(t,e,n,o,r,s){const{appendMarker:c,insertBefore:u}=ke(s,r),a=n.subContext;a.appendMarker=c;const i=t.owner,l=i._innerHTML;l.processInit=l.oldProcessInit,Se(l,a,e,o,u)}(t,n,e,o,s,r)}function m