taggedjs 2.8.26 → 2.8.27

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.
Files changed (143) hide show
  1. package/bundle.js +1 -1
  2. package/bundle.js.map +1 -1
  3. package/js/alterProp.function.d.ts +1 -1
  4. package/js/alterProp.function.js +0 -7
  5. package/js/alterProp.function.js.map +1 -1
  6. package/js/interpolations/attributes/bindSubjectCallback.function.d.ts +3 -1
  7. package/js/interpolations/attributes/bindSubjectCallback.function.js +14 -6
  8. package/js/interpolations/attributes/bindSubjectCallback.function.js.map +1 -1
  9. package/js/interpolations/attributes/getSupportWithState.function.d.ts +2 -0
  10. package/js/interpolations/attributes/getSupportWithState.function.js +10 -0
  11. package/js/interpolations/attributes/getSupportWithState.function.js.map +1 -0
  12. package/js/interpolations/attributes/processAttribute.function.d.ts +2 -2
  13. package/js/interpolations/attributes/processAttribute.function.js +2 -7
  14. package/js/interpolations/attributes/processAttribute.function.js.map +1 -1
  15. package/js/interpolations/attributes/processNameValueAttribute.function.d.ts +1 -1
  16. package/js/interpolations/optimizers/attachDomElements.function.js +0 -13
  17. package/js/interpolations/optimizers/attachDomElements.function.js.map +1 -1
  18. package/js/interpolations/processSubscriptionUpdate.function.js +2 -2
  19. package/js/interpolations/processSubscriptionUpdate.function.js.map +1 -1
  20. package/js/interpolations/subscribeToTemplate.function.d.ts +1 -1
  21. package/js/interpolations/subscribeToTemplate.function.js +14 -8
  22. package/js/interpolations/subscribeToTemplate.function.js.map +1 -1
  23. package/js/isInstance.js.map +1 -1
  24. package/js/state/StateMemory.type.d.ts +1 -0
  25. package/js/state/callback.function.js +2 -6
  26. package/js/state/callback.function.js.map +1 -1
  27. package/js/state/callbackMaker.function.js +0 -1
  28. package/js/state/callbackMaker.function.js.map +1 -1
  29. package/js/state/callbackStateUpdate.function.d.ts +1 -6
  30. package/js/state/callbackStateUpdate.function.js +5 -31
  31. package/js/state/callbackStateUpdate.function.js.map +1 -1
  32. package/js/state/index.d.ts +1 -0
  33. package/js/state/index.js +1 -0
  34. package/js/state/index.js.map +1 -1
  35. package/js/state/letProp.function.js +10 -7
  36. package/js/state/letProp.function.js.map +1 -1
  37. package/js/state/state.utils.d.ts +1 -1
  38. package/js/state/state.utils.js +8 -3
  39. package/js/state/state.utils.js.map +1 -1
  40. package/js/state/states.function.d.ts +1 -1
  41. package/js/state/states.function.js.map +1 -1
  42. package/js/state/states.utils.d.ts +2 -1
  43. package/js/state/states.utils.js +29 -18
  44. package/js/state/states.utils.js.map +1 -1
  45. package/js/state/subject.function.js +3 -3
  46. package/js/state/subject.function.js.map +1 -1
  47. package/js/state/subscribe.function.d.ts +18 -0
  48. package/js/state/subscribe.function.js +14 -0
  49. package/js/state/subscribe.function.js.map +1 -0
  50. package/js/state/syncStates.function.d.ts +3 -1
  51. package/js/state/syncStates.function.js +18 -13
  52. package/js/state/syncStates.function.js.map +1 -1
  53. package/js/state/watch.function.js +2 -2
  54. package/js/state/watch.function.js.map +1 -1
  55. package/js/subject/ProcessInit.type.d.ts +6 -0
  56. package/js/subject/ProcessInit.type.js +2 -0
  57. package/js/subject/ProcessInit.type.js.map +1 -0
  58. package/js/subject/Subject.class.d.ts +2 -1
  59. package/js/subject/Subject.class.js.map +1 -1
  60. package/js/subject/ValueSubject.d.ts +1 -1
  61. package/js/subject/signal.function.d.ts +9 -15
  62. package/js/subject/signal.function.js +4 -0
  63. package/js/subject/signal.function.js.map +1 -1
  64. package/js/tag/Context.types.d.ts +3 -2
  65. package/js/tag/Tag.type.d.ts +3 -1
  66. package/js/tag/ValueTypes.enum.d.ts +2 -2
  67. package/js/tag/ValueTypes.enum.js +4 -2
  68. package/js/tag/ValueTypes.enum.js.map +1 -1
  69. package/js/tag/afterRender.function.js +7 -5
  70. package/js/tag/afterRender.function.js.map +1 -1
  71. package/js/tag/buildBeforeElement.function.js +3 -1
  72. package/js/tag/buildBeforeElement.function.js.map +1 -1
  73. package/js/tag/checkDestroyPrevious.function.d.ts +1 -0
  74. package/js/tag/checkDestroyPrevious.function.js +4 -1
  75. package/js/tag/checkDestroyPrevious.function.js.map +1 -1
  76. package/js/tag/checkTagValueChange.function.d.ts +2 -0
  77. package/js/tag/checkTagValueChange.function.js +6 -1
  78. package/js/tag/checkTagValueChange.function.js.map +1 -1
  79. package/js/tag/executeWrap.function.js +3 -2
  80. package/js/tag/executeWrap.function.js.map +1 -1
  81. package/js/tag/getDomTag.function.js +3 -0
  82. package/js/tag/getDomTag.function.js.map +1 -1
  83. package/js/tag/getSupport.function.d.ts +1 -0
  84. package/js/tag/getSupport.function.js +3 -3
  85. package/js/tag/getSupport.function.js.map +1 -1
  86. package/js/tag/getTemplaterResult.function.d.ts +4 -1
  87. package/js/tag/getTemplaterResult.function.js +3 -1
  88. package/js/tag/getTemplaterResult.function.js.map +1 -1
  89. package/js/tag/isLikeTags.function.js +0 -1
  90. package/js/tag/isLikeTags.function.js.map +1 -1
  91. package/js/tag/render/renderExistingTag.function.d.ts +2 -1
  92. package/js/tag/render/renderExistingTag.function.js +2 -1
  93. package/js/tag/render/renderExistingTag.function.js.map +1 -1
  94. package/js/tag/render/renderSupport.function.js.map +1 -1
  95. package/js/tag/render/renderTagOnly.function.js +3 -15
  96. package/js/tag/render/renderTagOnly.function.js.map +1 -1
  97. package/js/tag/render/renderWithSupport.function.d.ts +1 -1
  98. package/js/tag/render/renderWithSupport.function.js +1 -1
  99. package/js/tag/render/renderWithSupport.function.js.map +1 -1
  100. package/js/tag/render/softDestroySupport.function.js +10 -11
  101. package/js/tag/render/softDestroySupport.function.js.map +1 -1
  102. package/js/tag/tag.function.js +9 -2
  103. package/js/tag/tag.function.js.map +1 -1
  104. package/js/tag/tagElement.js +22 -16
  105. package/js/tag/tagElement.js.map +1 -1
  106. package/js/tag/update/compareArrayItems.function.d.ts +1 -1
  107. package/js/tag/update/compareArrayItems.function.js +0 -22
  108. package/js/tag/update/compareArrayItems.function.js.map +1 -1
  109. package/js/tag/update/processDomTagInit.function.d.ts +9 -0
  110. package/js/tag/update/processDomTagInit.function.js +23 -0
  111. package/js/tag/update/processDomTagInit.function.js.map +1 -0
  112. package/js/tag/update/processFirstSubject.utils.d.ts +2 -1
  113. package/js/tag/update/processFirstSubjectValue.function.js +3 -62
  114. package/js/tag/update/processFirstSubjectValue.function.js.map +1 -1
  115. package/js/tag/update/processNewSubjectTag.function.d.ts +2 -2
  116. package/js/tag/update/processNewSubjectTag.function.js +2 -2
  117. package/js/tag/update/processNewSubjectTag.function.js.map +1 -1
  118. package/js/tag/update/processNewValue.function.js +0 -1
  119. package/js/tag/update/processNewValue.function.js.map +1 -1
  120. package/js/tag/update/processRenderOnceInit.function.d.ts +8 -0
  121. package/js/tag/update/processRenderOnceInit.function.js +17 -0
  122. package/js/tag/update/processRenderOnceInit.function.js.map +1 -0
  123. package/js/tag/update/processSubscribe.function.d.ts +9 -0
  124. package/js/tag/update/processSubscribe.function.js +10 -0
  125. package/js/tag/update/processSubscribe.function.js.map +1 -0
  126. package/js/tag/update/processTag.function.js +2 -0
  127. package/js/tag/update/processTag.function.js.map +1 -1
  128. package/js/tag/update/processTagArray.js +3 -2
  129. package/js/tag/update/processTagArray.js.map +1 -1
  130. package/js/tag/update/processTagComponentInit.function.d.ts +7 -0
  131. package/js/tag/update/processTagComponentInit.function.js +17 -0
  132. package/js/tag/update/processTagComponentInit.function.js.map +1 -0
  133. package/js/tag/update/processTagInit.function.d.ts +4 -0
  134. package/js/tag/update/processTagInit.function.js +11 -0
  135. package/js/tag/update/processTagInit.function.js.map +1 -0
  136. package/js/tag/update/setupSubscribe.function.d.ts +18 -0
  137. package/js/tag/update/setupSubscribe.function.js +72 -0
  138. package/js/tag/update/setupSubscribe.function.js.map +1 -0
  139. package/js/tag/update/updateExistingValue.function.d.ts +5 -1
  140. package/js/tag/update/updateExistingValue.function.js +33 -2
  141. package/js/tag/update/updateExistingValue.function.js.map +1 -1
  142. package/js/tag/updateSupportBy.function.js.map +1 -1
  143. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
- var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},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:()=>Q,cg:()=>c,m0:()=>s,rS:()=>yt,Y2:()=>r,ei:()=>Y,B7:()=>C,TU:()=>S,XF:()=>K,PC:()=>q,Ot:()=>k,Mj:()=>T,tD:()=>a,j8:()=>Oe,um:()=>Pe,E2:()=>gn,OH:()=>bn,TB:()=>Gt,Ii:()=>qt,yV:()=>Fe,zV:()=>v,ze:()=>hn,WJ:()=>j,aZ:()=>Xt,O:()=>Ft,Ie:()=>o,B4:()=>dt,Az:()=>Zn,Xi:()=>kn,pc:()=>ht,Ah:()=>n,ck:()=>jn,k6:()=>bt,Gk:()=>ot,zC:()=>St,cF:()=>tr,jU:()=>Kt,PB:()=>Yt,qy:()=>Gn,cy:()=>m,Tn:()=>h,Gv:()=>b,yL:()=>g,D8:()=>l,Ze:()=>p,_4:()=>d,mn:()=>f,z:()=>G,sA:()=>yn,MG:()=>vn,PL:()=>ze,nI:()=>Rt,PZ:()=>Ye,N_:()=>Ke,r5:()=>X,uc:()=>pn,pG:()=>qe,QB:()=>cn,R6:()=>Yn,Ll:()=>L,vP:()=>u,wk:()=>P,xP:()=>Z,bc:()=>z,ag:()=>mn,Tc:()=>wt,Hf:()=>qn,_A:()=>st,Ag:()=>gt,NU:()=>Cn,hW:()=>Sn,wB:()=>B,id:()=>x,MC:()=>E,SZ:()=>A});class r{get(t){return"todo"}}const o="";var s,c;!function(t){t.string="string",t.number="number",t.boolean="boolean",t[void 0]="undefined"}(s||(s={})),function(t){t.function="function",t.date="date",t.unknown="unknown",t.object="object"}(c||(c={}));const a={tag:"html",dom:"dom",templater:"templater",tagComponent:"tagComponent",tagArray:"tagArray",subject:"subject",tagJsSubject:"tagJsSubject",renderOnce:"renderOnce",stateRender:"stateRender",version:Date.now()};function u(t){return wn()?P((()=>i(t))):i(t)}function i(t){let e=t;const n=new Set;return{get value(){return e},set value(t){e!==t&&(e=t,n.forEach((e=>e(t))))},subscribe(t){t(e),n.add(t);const r=()=>n.delete(t);return r.unsubscribe=r,r}}}function l(t){switch(t){case s.string:case s.number:case s.boolean:return!0}return!1}function p(t){if(!t)return!1;switch(t.tagJsType){case a.dom:case a.tag:case a.templater:return!0}return!1}function f(t){const e=t?.tagJsType;return e===a.tagComponent||e===a.stateRender}function d(t){return b(t)&&typeof t.subscribe===c.function}function g(t){return t&&h(t.then)}function h(t){return typeof t===c.function}function b(t){return typeof t===c.object&&null!==t}function m(t){return Array.isArray(t)}function v(t){const e=new C;return e.subscribeWith=e=>{const n=[],r=[],o=(o,s)=>{n[s]=!0,r[s]=o;if(n.length===t.length){for(const t of n)if(!t)return;e(r,c)}},s=[...t],c=s.shift().subscribe((t=>o(t,0))),a=s.map(((t,e)=>t.subscribe((t=>o(t,e+1)))));return c.subscriptions=a,c},e}function y(t,e,n){const r=C.globalSubCount$;C.globalSubCount$.next(r.value+1);const o=function(){o.unsubscribe()};return o.callback=e,o.subscriptions=[],o.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 r=C.globalSubCount$;C.globalSubCount$.next(r.value-1),t.unsubscribe=()=>t;const o=t.subscriptions;for(const t of o)t.unsubscribe();return t}(o,n,e)},o.add=t=>(o.subscriptions.push(t),o),o.next=t=>{e(t,o)},o}function w(t,e,n){const r=[...e],o=r.shift(),s=t=>{if(r.length)return w(t,r,n);n(t)};let c=s;const a=o(t,{setHandler:t=>c=t,next:s});c(a)}class C{value;onSubscription;methods=[];isSubject=!0;subscribers=[];subscribeWith;constructor(t,e){this.value=t,this.onSubscription=e}subscribe(t){const e=y(0,t,this.subscribers),n=this.subscribeWith;if(n){if(this.methods.length){const n=t;t=t=>{w(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,r)=>{const o=r?.unsubscribe;o?o():setTimeout((()=>e.unsubscribe()),0),t(n)}));return this}pipe(...t){const e=new C(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 v(t.map((t=>{if(d(t))return t;return new C(t,(e=>(e.next(t),e)))})))}static globalSubCount$=new C(0)}class S extends C{value;onSubscription;_value;constructor(t,e){super(t,e),this.value=t,this.onSubscription=e,this._value=t,j(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 j(t){Object.defineProperty(t,"value",{set(e){t._value=e,t.emit()},get:()=>t._value})}class k extends C{value;constructor(t){super(t),this.value=t}subscribe(t){const e=super.subscribe(t);return t(this.value,e),e}}class T extends C{value;constructor(t){super(t),this.value=t,this._value=t,j(this)}subscribe(t){const e=super.subscribe(t);return t(this._value,e),e}}function x(t){return(e,n)=>{n.setHandler((()=>{})),t(e,n.next)}}function E(t){return(e,n)=>{n.setHandler((()=>{}));t(e).then((t=>n.next(t)))}}const A=t=>(e,n)=>{n.setHandler((()=>{}));const r=t(e).subscribe((t=>{r.unsubscribe(),n.next(t)}))};function P(t){return L.stateConfig.handlers.handler(t)}function O(t){const e=L.stateConfig;e.states[e.statesIndex]=t;return e.support.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>(P(t),t)))}function V(t){const e=L.stateConfig,n=e.support,r=e.statesIndex,o=e.prevSupport,s=o?.states[r],c=[];s(((...t)=>(c.push(t),t)));let a=0;return n.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>{e.stateArray.push({get:()=>t,defaultValue:t});const n=c[a];return++a,n}))}function J(t,e){e.handlers.handler=M,e.handlers.statesHandler=O,e.rearray=[],e.stateArray=[],e.states=[],e.statesIndex=0,e.support=t}function W(t,e,n,r){e.rearray=n,e.stateArray=[],e.states=r,e.statesIndex=0,e.handlers.handler=R,e.handlers.statesHandler=V,e.support=t}class N{}function I(t){const e=t.callback;if(!e)return t.defaultValue;const[n]=function(t){const[e]=t(N),[n]=t(e);return[e,n]}(e);return n}function R(){const t=L.stateConfig,e=t.rearray[t.stateArray.length];return t.stateArray.push(e),e.defaultValue}function M(t){const e=L.stateConfig;let n=t;if(typeof t===c.function&&(n=t()),typeof n===c.function){const t=n;n=function(...e){return t(...e)},n.original=t}const r={get:function(){return I(r)},defaultValue:n};return e.stateArray.push(r),n}const D=new C(void 0,(function(t){wn()||t.next()})),L={stateConfig:{stateArray:[],version:Date.now(),handlers:{handler:M,statesHandler:O}},tagClosed$:D};function $(t,e){for(let n=0;n<t.states.length;++n){let r;const o=t.states[n],s=e.states[n];o(((...t)=>(r=t,t))),s((()=>r))}}function _(t,e,n,r){for(let n=t.length-1;n>=0;--n){const r=t[n].get(),o=e[n].callback;o&&o(r)}for(let t=r.length-1;t>=0;--t){const e=[],o=(...t)=>(e.push(t),t);(0,r[t])(o);let s=0;const c=(...t)=>e[s++];n[t](c)}}const B=(t,e)=>U(t,e),H=t=>t;const U=(t,e,{init:n,before:r,final:o=H}={})=>{const s=P({pastResult:void 0,values:void 0}),c=s.values;if(void 0===c){if(r&&!r(t))return s.values=t,s.pastResult;const a=(n||e)(t,c);return s.pastResult=o(a),s.values=t,s.pastResult}if(t.every(((t,e)=>t===c[e])))return s.pastResult;if(r&&!r(t))return s.values=t,s.pastResult;const a=e(t,c);return s.pastResult=o(a),c.length=0,c.push(...t),s.pastResult};function F(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=P((()=>wn())),r=P((()=>new k(void 0))),o=P((()=>({stateArray:L.stateConfig.stateArray,states:L.stateConfig.states}))),s=(t,s)=>(U(t,((t,e)=>{const c=wn(),a=s(t,e);if(c!==n){const t=o.stateArray,e=n.subject.global.oldest;_(t,e.state,o.states,e.states)}r.next(a)}),e.setup),r);return s.setup=e.setup,F((()=>s),s),s}}),Object.defineProperty(e,"truthy",{get(){const e=t();return e.setup.before=t=>t.every((t=>t)),e}}),e}function z(t){return wn()?P((()=>new C(t))):new C(t)}function Z(t){return L.stateConfig.handlers.statesHandler(t)}function G(t){const e=u([]),n=u(0),r=u(0);let o=[],s=0;return r.value=n.value,t(((...t)=>(o=t,t))),B(o,(()=>{++s,e.value=o,t((()=>o))})),Z((()=>{if(s)return t(((...t)=>(e.value=t,n!=r?e.value:t))),r.value=n.value,void++n.value;t((()=>e.value))})),++s,e.value}F((()=>function(t){const e=(e,n)=>U(e,n,t);return e.setup=t,F((()=>e),e),e}({})),B),z._value=t=>{const e=P((function(){return{stateArray:L.stateConfig.stateArray,states:L.stateConfig.states}})),n=wn();return P((function(){return new k(t).pipe((t=>(_(n.state,e.stateArray,n.states,e.states),t)))}))},z.all=function(t){const e=P((()=>({stateArray:L.stateConfig.stateArray,states:L.stateConfig.states}))),n=wn();return C.all(t).pipe((t=>(_(n.state,e.stateArray,n.states,e.states),t)))};const X={create:t=>{const e=P((()=>({stateDiff:0,provider:void 0})));if(e.stateDiff){let t=e.stateDiff;for(;t--;)P(void 0);return P(void 0)}const n=P((()=>{const n=L.stateConfig,r=n.stateArray.length,o=t.prototype?new t:t(),s=n.support,c=n.stateArray.length-r,a={constructMethod:t,instance:o,stateDiff:c,owner:s,children:[]};e.provider=a;const u=s.subject.global;return(u.providers=u.providers||[]).push(a),e.stateDiff=c,o})),r=t,o=r.compareTo=r.toString();return e.provider.constructMethod.compareTo=o,n},inject:t=>P((()=>{const e=t,n=e.compareTo=e.compareTo||t.toString(),r=wn(),o=[];let s={ownerSupport:r.ownerSupport};for(;s.ownerSupport;){const t=s.ownerSupport.subject.global.providers;if(!t){s=s.ownerSupport;continue}const e=t.find((t=>{o.push(t);if(t.constructMethod.compareTo===n)return!0}));if(e){const t=r.subject.global;return(t.providers=t.providers||[]).push(e),e.children.push(r),e.instance}s=s.ownerSupport}const c=`Could not inject provider: ${t.name} ${t}`;throw console.warn(`${c}. Available providers`,o),new Error(c)}))};class q extends Error{details;constructor(t,e,n={}){super(t),this.name=q.name,this.details={...n,errorCode:e}}}class Q extends q{constructor(t,e){super(t,"array-no-key-error",e),this.name=Q.name}}class Y extends q{constructor(t,e){super(t,"state-mismatch-error",e),this.name=Y.name}}class K extends q{constructor(t,e){super(t,"sync-callback-error",e),this.name=K.name}}function tt(t,e){return et(t,e)}function et(t,e){if(null===t||typeof t!==c.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=m(t)?[]:Object.create(Object.getPrototypeOf(t));if(m(t))for(let r=0;r<t.length;r++)n[r]=et(t[r],e-1);else for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=et(t[r],e-1));return n}function nt(t,e,n){return rt(t,e,n)}function rt(t,e,n){return!(t!==e&&(r=t,o=e,!h(r)||!h(o)||r.toString()!==o.toString()))||(n<0||typeof t===c.object&&typeof e===c.object&&(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():m(t)&&m(e)?function(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!rt(t[r],e[r],n-1))return!1;return!0}(t,e,n-1):!m(t)&&!m(e)&&function(t,e,n){const r=Object.keys(t),o=Object.keys(e);if(0===r.length&&0===o.length)return!0;if(r.length!==o.length)return!1;for(const s of r){if(!o.includes(s)||!rt(t[s],e[s],n-1))return!1}return!0}(t,e,n-1)));var r,o}function ot(t,e){const n={propWatch:t,props:e,tagJsType:a.templater,key:function(t){return n.arrayValue=t,n}};return n}const st=[];function ct(t,e,n){return t.map((t=>function(t,e,n,r){if(p(t)||!t)return t;if(!e)return t;return at(t,e,n,r)}(t,e.ownerSupport,e,n)))}function at(t,e,n,r){if(!t)return t;if(t.tagJsType)return t;if(typeof t===c.function)return function(t,e){const n=t.mem;if(n)return t;const r=function(...t){return r.toCall(...t)};return r.original=t,r.mem=t,r.toCall=function(...t){return function(t,e,n){const r=n.subject.global,o=r?.newest||n,s=void 0===wn(),c=t(...e),a=function(){const t=o.subject.global;if(!1===s){if(!0===t.locked)return c}return function(t,e){const n=t.subject,r=ln(t.templater);if(r){return fn(e,t)}const o=n.global;o.locked=!0,un(o.newest,t,e,n),delete o.locked}(o,n),c};if(s)return a();return L.tagClosed$.toCallback(a),c}(r.mem,t,e)},Object.assign(r,t),r}(t,e);if(r===Et)return t;return it(t)?t:m(t)?function(t,e,n,r){for(let o=t.length-1;o>=0;--o){const s=t[o];if(t[o]=at(s,n,e,r+1),typeof s===c.function){if(s.mem)continue;ut(r+1,o,s,t,e)}}return t}(t,n,e,r):function(t,e,n,r){const o=Object.keys(t);for(const s of o){const o=t[s],a=at(o,n,e,r+1);if(t[s]===a)continue;const u=Object.getOwnPropertyDescriptor(t,s);if(!(u?.get||u?.set)&&(t[s]=a,typeof a===c.function)){if(o.mem)continue;ut(r+1,s,o,t,e)}}return t}(t,n,e,r)}function ut(t,e,n,r,o){if(t>0){const t=o.subject.global;r[e].subscription=t.destroy$.toCallback((function(){r[e]=n}))}}function it(t){return typeof t!==c.object||!t||t.tagJsType}function lt(t,e,n,r){const o=e.original;let s;t.tagJsType===a.stateRender?s=t():(s=o(...r),typeof s===c.function&&(s=s())),s.templater=t,t.tag=s;const u=L.stateConfig;return n.state=u.stateArray,n.states=u.states,n}function pt(t){return t.map(ft)}function ft(t,e){const n=t,r=t?.tagJsType;if(r)switch(r){case a.stateRender:return;case a.dom:case a.tag:case a.templater:return pt(n.values)}return m(t)?pt(n):tt(t,e)}function dt(t,e,n){const r={templater:t,subject:e,castedProps:n,appSupport:void 0},o=e.global;return o.blocked=[],o.destroy$=new C,r}function gt(t,e,n,r){e.state=[],e.states=[],e.appSupport=n;const o=t.props;return o&&(e.propsConfig=function(t,e,n){const r=t.templater;if(r.tagJsType!==a.stateRender){switch(r.propWatch){case yt.IMMUTABLE:return t.propsConfig={latest:e,castProps:n};case yt.SHALLOW:return t.propsConfig={latest:e.map((t=>ft(t,xt))),castProps:n}}return t.propsConfig={latest:e.map((t=>ft(t,Et))),castProps:n}}}(e,o,r)),e}function ht(t,e,n,r,o){const s={templater:t,subject:r,castedProps:o,appSupport:void 0};return s.ownerSupport=e,s.appSupport=n,s}function bt(t,e,n,r,o){const s=dt(t,r,o);return s.ownerSupport=e,gt(t,s,n,o)}function mt(t,e,n){const r=t.propWatch===yt.DEEP?Et:xt,o=t.props,s=e.propsConfig;let c=s.castProps;const a=n?.propsConfig,u=a?.castProps;u&&(s.castProps=u,c=rn(e,n,n.ownerSupport,o,r));return c||ct(o,e,0)}let vt=0;var yt;function wt(t,e=yt.SHALLOW){const n=function(...r){const o=ot(e,r);o.tagJsType=a.tagComponent;const s=function(t,e){return function(n,r,o){const s=mt(t,n,o),c=n.ownerSupport,a=bt(t,c,n.appSupport,r,s);return lt(t,e,a,s)}}(o,n);return s.original=t,o.wrapper=s,o},r=t;return n.original=t,r.tags=st,r.setUse=L,r.ValueTypes=a,r.tagIndex=vt++,st.push(n),n}function Ct(){throw new Error("Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `")}function St(t,e,n){if(dn(t,e))return 11;switch(n){case yt.NONE:return 1;case yt.SHALLOW:return Tt(t,e);case yt.IMMUTABLE:return kt(t,e)}return function(t,e){let n=t,r=e;n=[...t],r=[...e||[]];if(!n.every(((t,e)=>function(t,e,n,r){const o=r[e];if(typeof t===c.object){const e={...t},n={...o||{}},r=Object.entries(e).every((([t,r])=>jt(r,n[t],(()=>{delete e[t],delete n[t]}))));return r}return jt(t,o,(()=>{n.splice(e,1),r.splice(e,1)}))}(t,e,n,r))))return 7;return!1}(t,e)}function jt(t,e,n){if(typeof t!==c.function)return!!nt(t,e,Et)&&4;if(typeof e!==c.function)return!1;const r=e?.original;r&&(e=r);t.original&&(t=t.original);return t.toString()===e.toString()?(n(),5):(n(),6)}function kt(t,e){const n=t.length;for(let r=0;r<n;++r){if(t[r]!==e[r])return 2}return!1}function Tt(t,e){const n=t.length;for(let r=0;r<n;++r){const n=t[r],o=e[r];if(m(n)&&m(o)){if(n===o)continue;return 3}if(typeof n!==c.function||typeof o!==c.function)if(typeof n!==c.object){if(n!==o)return 3.3}else if(typeof e===c.object){const t=Object.entries(n);for(const e of t){if(!At(e,o))return 3.1}}}return!1}!function(t){t.DEEP="deep",t.SHALLOW="shallow",t.NONE="none",t.IMMUTABLE="immutable"}(yt||(yt={})),wt.renderOnce=function(){throw new Error("Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `")},wt.state=Ct,wt.use=Ct,wt.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`` `")},wt.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`` `")},wt.deepPropWatch=wt,wt.immutableProps=function(t){return wt(t,yt.IMMUTABLE)},wt.watchProps=function(t){return wt(t,yt.SHALLOW)},Object.defineProperty(wt,"renderOnce",{set(t){t.tagJsType=a.renderOnce}}),Object.defineProperty(wt,"state",{set(t){t.original={setUse:L,tags:st},t.tagJsType=a.stateRender}}),Object.defineProperty(wt,"use",{set(t){t.original={setUse:L,tags:st},t.tagJsType=a.stateRender}});const xt=3,Et=10;function At([t,e],n){const r=n[t];return typeof e===c.function&&typeof r===c.function||r===e}let Pt=[],Ot=[],Vt=[],Jt=[],Wt=[],Nt=[];const It={locks:0};function Rt(){if(!(It.locks>0)){for(let t=Pt.length-1;t>=0;--t){const e=Pt[t];e.parentNode.removeChild(e)}for(const t of Ot)t();for(const[t,e]of Vt)e.textContent=t;for(const t of Jt)t.relative.appendChild(t.element);for(const{element:t,relative:e}of Wt)e.parentNode.insertBefore(t,e);Pt=[],Ot=[],Jt=[],Wt=[],Vt=[];for(const t of Nt)t();Nt=[]}}function Mt(t,e){const n=document.createTextNode(t);return Wt.push({element:n,relative:e}),n}function Dt(t){switch(t){case void 0:case!1:case null:return o}return t}function Lt(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].subject.global===e&&t.children.splice(n,1)}e.destroy$&&e.destroy$.next(),t.subject.renderCount=0}function $t(t){for(const e of t){const t=e.lastArray;if(t){$t(t.map((t=>t.context)));continue}const n=e.global;if(!n)continue;const r=n.newest,o=n.subscriptions;o&&o.forEach((t=>t.unsubscribe())),f(r.templater)&&Lt(r,n);$t(n.context)}}function _t(t,e=[],n=[]){for(const r of t){const t=r.global;if(!t)continue;const o=t.newest;if(o){e.push(o);const r=t.subscriptions;r&&n.push(...r)}const s=t.context;s&&_t(s,e,n)}return{tags:e,subs:n}}function Bt(t,e){const n=t.context,r=t.destroys;if(r)return function(t,e,n){const r=[];if(t.forEach((t=>{const e=t();e instanceof Promise&&r.push(e)})),r.length){const t=Promise.all(r).then((()=>{++It.locks,Ht(e.context,n),Ut(e),--It.locks,Rt()}));return void n.push(t)}++It.locks,Ht(e.context,n),Ut(e),--It.locks,Rt()}(r,t,e);Ht(n,e),Ut(t)}function Ht(t,e){for(const n of t){if(n.withinOwnerElement)continue;const t=n.lastArray;if(t){Xt(n,t);continue}const r=n.simpleValueElm;if(r){delete n.simpleValueElm,Pt.push(r);continue}const o=n.global;if(void 0===o)continue;if(!0===o.deleted)continue;o.deleted=!0;o.oldest&&Bt(o,e)}}function Ut(t){t.htmlDomMeta.forEach((t=>{const e=t.marker;e&&Pt.push(e);const n=t.domElement;n&&Pt.push(n)}))}function Ft(t,e){const n=t.subject;e.deleted=!0,n.renderCount=0;const r=[];return $t(e.context),e.destroy$&&Lt(t,e),Bt(e,r),r}function zt(t,e,n,r,o){const s=t.length-1,c=e-r,a=c<0||s<c,u=n[e].context;if(a)return Zt(u,o),1;const i=function(t,e,n,r,o,s){const c=e&&t!==e.arrayValue;if(c)return Zt(n,r),o.splice(s,1),2;return 0}(u.value.arrayValue,t[e],u,o,n,e);return i}function Zt(t,e){!function(t,e){if(t){Ft(t.oldest,t)}else{const t=e.simpleValueElm;delete e.simpleValueElm,Pt.push(t)}}(t.global,t),++e.removed}function Gt(t,e){if(!m(t)){return Xt(e,e.lastArray),9}return!1}function Xt(t,e){const n={added:0,removed:0};for(let t=0;t<e.length;++t)Zt(e[t],n);delete t.lastArray}function qt(t,e){if(null==t||typeof t!==c.object)return function(t,e){const n=Dt(t),r=e.simpleValueElm;Vt.push([n,r])}(t,e),-1;const n=e.simpleValueElm;return delete e.simpleValueElm,Pt.push(n),6}function Qt(t,e){const n=t.templater,r=e.templater,o=n?.tag||t,s=r.tag;if(n?.tagJsType===a.stateRender)return n.dom===r.dom;switch(o.tagJsType){case a.dom:return s?.tagJsType===a.dom&&function(t,e){const n=t.dom,r=e.dom;return n===r}(o,s);case a.tag:{const n=function(t,e,n,r){const o=t.strings,s=e.strings;if(o.length!==s.length)return!1;if(!o.every(((t,e)=>s[e].length===t.length)))return!1;const a=n.templater.values||t.values,u=r.templater.values||e.values;return function(t,e){const n=t.length===e.length;if(!n)return!1;const r=e.every(((e,n)=>{const r=t[n];if(typeof e===c.function&&typeof r===c.function){return!!(e.toString()===r.toString())}return!0}));if(r)return!0;return!1}(a,u)}(o,s,t,e);return n}}throw new Error(`unknown tagJsType of ${o.tagJsType}`)}function Yt(t,e,n){Ot.push((()=>{Kt(t,e,n)}))}function Kt(t,e,n){void 0!==n&&!1!==n&&null!==n?t.setAttribute(e,n):t.removeAttribute(e)}function te(t,e,n,r,o,s){switch(r){case"init":{const t=s.added;return void Nt.push((()=>{e({target:n,stagger:t})}))}case"destroy":{const t=++s.removed,r=o.subject.global;return r.destroys=r.destroys||[],void r.destroys.push((()=>e({target:n,stagger:t})))}case"autofocus":return void Nt.push((()=>n.focus()));case"autoselect":return void Nt.push((()=>n.select()));case"style":{const r=t.split(".");return void Ot.push((()=>n.style[r[1]]=e))}case"class":return void function(t,e,n){const r=t.split(".");if(r.shift(),e){for(const t of r)Ot.push((()=>n.classList.add(t)));return}for(const t of r)Ot.push((()=>n.classList.remove(t)))}(t,e,n)}throw new Error(`Invalid special attribute of ${r}. ${t}`)}function ee(t,e){const n=function(t,e,n=[]){const r=t.subject;n.push({support:t,renderCount:r.renderCount,provider:e});const o=e.children;for(let t=o.length-1;t>=0;--t){const r=o[t],s=r.subject;n.push({support:r,renderCount:s.renderCount,provider:e})}return n}(t,e);return n}function ne(t,e=[]){const n=t.subject.global,r=ln(t.templater),o=t.ownerSupport;if(n.locked)return e.push(t),e;if(r)return ne(o,e);const s=t,c=f(s.templater),u=t.templater.tagJsType,i=o&&u!==a.stateRender&&(!c||function(t,e,n){const r=function(t,e){const n=t.props,r=e.propsConfig,o=r.latest;if(dn(n,o))return!0;switch(t.propWatch){case yt.IMMUTABLE:return kt(n,o);case yt.SHALLOW:return Tt(n,o)}return!nt(n,o,Et)}(e,n);if(t&&r)return!0;return!1}(o,s.templater,s)),l=function(t){const e=t.subject.global.providers;if(!e)return[];const n=[];for(const t of e){const e=ee(t.owner,t);n.push(...e.map((t=>t.support)))}return n}(s);return e.push(...l),i?(ne(o,e),c&&e.push(s),e):(e.push(s),e)}function re(t){++It.locks,t.forEach(oe),--It.locks,Rt()}function oe(t){const e=t.subject.global;e&&pn(e.newest)}const se="no-data-ever",ce="promise-no-data-ever";function ae(t,e){const n=e.subject.global,r=function(t,e){if(!0!==n.deleted)return function(t,e,n,r){let o=e;for(;o.ownerSupport&&!f(o.templater);)o=o.ownerSupport;const s=o.subject,c=s.global;c.locked=!0;const a=t.apply(n,r);delete c.locked;return function(t,e){const n=e.subject.global;return function(t,e,n){return re(ne(t)),function(t,e,n){if(g(t)){return e.subject.global.locked=!0,t.then((()=>{if(!0===n.deleted)return ce;delete e.subject.global.locked;return re(ne(e)),ce}))}return se}(e,t,n)}(e,t,n)}(a,o)}(r.tagFunction,r.support,t,e)};return r.tagFunction=t,r.support=e,r}const ue=["init","destroy"];function ie(t,e,n,r,o,s,c){if(c)return te(t,e,n,c,s,o);r(n,t,e)}function le(t,e,n,r){const o=t.appElement;"blur"===e&&(e="focusout");const s="_"+e,c=t.subject.global.events;if(!c[e]){const t=function(t){t.originalStopPropagation=t.stopPropagation,pe(t,s,t.target)};c[e]=t,o.addEventListener(e,t)}n[s]=r,n[e]=r}function pe(t,e,n){const r=n[e];if(r){let e=!1;if(t.stopPropagation=function(){e=!0,t.originalStopPropagation.call(t)},r(t),t.defaultPrevented||e)return}const o=n.parentNode;o&&pe(t,e,o)}function fe(t,e,n,r){const o=function(...e){return o.tagFunction(t,e)};o.tagFunction=e,o.support=n,le(n.appSupport,r,t,o)}function de(t){if(t.startsWith("class."))return"class";const e=function(t){switch(t){case"autoselect":return"autoselect";case"autofocus":return"autofocus";case"oninit":case"init":return"oninit";case"ondestroy":case"destroy":return"destroy"}return!1}(t);return!1!==e||!!t.startsWith("style.")&&"style"}const ge={added:0,removed:0};function he(t,e,n,r){if(n.isNameOnly)return function(t,e,n,r,o,s,a,u){if(n){if(Se(e))return void r.removeAttribute(n);if(typeof n===c.object)if(typeof e===c.object)for(const t in n)t in e||Ot.push((function(){r.removeAttribute(t)}));else for(const t in n)Ot.push((function(){r.removeAttribute(t)}))}me(t,e,r,o,s,a,u)}(t,e,n.value,n.element,r,n.howToSet,[],ge),void(n.value=e);const o=n.element;ve(e,n.attrName,n,o,r,n.howToSet,n.isSpecial,ge),n.value=e}function be(t,e,n,r,o,s,a,u,i){const l=Ce(e);if(l>=0){const e=t[l],c=Oe(e,s,!0);return c.isAttr=!0,c.element=n,c.howToSet=o,c.isNameOnly=!0,c.handler=(t,e)=>he(e,t,c,r),void me(t,e,n,r,o,s,u)}const p=Ce(i);if(p>=0){const i=t[p],l={isAttr:!0,element:n,attrName:e,checkValueChange:qt,withinOwnerElement:!0};s.push(l);return d(l.value)?function(t,e,n,r,o,s,c){s&&Ot.push((function(){n.removeAttribute(t)}));const a=e.value;if(d(a)){e.handler=je;const u=function(a){ve(a,t,e,n,r,o,s,c)},i=a.subscribe(u),l=e.global;(l.subscriptions=l.subscriptions||[]).push(i)}return void ve(e.value,t,e,n,r,o,s,c)}(e,l,n,r,o,a,u):(l.handler=(t,e)=>he(e,t,l,r),function(t,e,n,r,o,s,a,u){n.attrName=t,n.element=r,n.howToSet=o,typeof e===c.function?u&&ue.includes(t)?te(t,e,r,t,s,a):we(n,e,s,t,r):(n.attrName=t,n.element=r,n.howToSet=o,n.isSpecial=u,ie(t,e,r,o,a,s,u))}(e,i,l,n,o,r,u,a),void(l.value=i))}return ie(e,i,n,o,u,r,a)}function me(t,e,n,r,s,a,u){if(!Se(e))if(typeof e!==c.object)0!==e.length&&s(n,e,o);else for(const o in e){const c=e[o];be(t,o,n,r,s,a,de(o),u,c)}}function ve(t,e,n,r,o,s,c,u){return h(t)?function(t,e,n,r,o,s,c,u){const i=t.templater.wrapper;if((i?.tagJsType||i?.original?.tagJsType)!==a.renderOnce)return we(c,e,t,r,n);return ye(e,n,r,o,s,t,u)}(o,t,r,e,c,s,n,u):ye(t,r,e,c,s,o,u)}function ye(t,e,n,r,o,s,c){if(!1===r){switch(t){case void 0:case!1:case null:return void Ot.push((function(){e.removeAttribute(n)}))}if(h(t))return fe(e,t,s,n);o(e,n,t)}else te(n,t,e,r,s,c)}function we(t,e,n,r,o){const s=t.value;return s&&s.tagFunction&&s.support?(s.tagFunction=e,s.support=n,s):fe(o,e=ae(e,n),n,r)}function Ce(t){return b(t)&&"tagJsVar"in t?t.tagJsVar:-1}function Se(t){return null==t||!1===t}const je=()=>{},ke="object"==typeof document&&document.createElement("div");function Te(t,e,n,r,s,c,a,u,i=[]){const l=[];a&&void 0===u&&(u=document.createTextNode(o),Jt.push({element:u,relative:a}),a=void 0);for(let o=0;o<t.length;++o){const p=t[o],f=p.v;if(!isNaN(f)){const t=s.length;Ae(e[t],t,s,n,i,r,c,a,u);continue}const d={};if(l.push(d),"text"===p.nn){Ee(d,p,a,u);continue}const g=xe(d,p,e,n,s,r,a,u);p.ch&&(d.ch=Te(p.ch,e,n,r,s,c+1,g,u,i).dom)}return{subs:i,dom:l,context:s}}function xe(t,e,n,r,o,s,c,a){const u=t.domElement=document.createElement(e.nn);return e.at&&e.at.forEach((t=>{const e=t[0],c=t[1],a=t[2]||!1;be(n,e,u,r,Kt,o,a,s,c)})),c?Jt.push({element:u,relative:c}):Wt.push({element:u,relative:a}),u}function Ee(t,e,n,r){const o=t,s=o.tc=e.tc;ke.innerHTML=s;const c=o.domElement=document.createTextNode(ke.innerText);n?Jt.push({element:c,relative:n}):Wt.push({element:c,relative:r})}function Ae(t,e,n,r,s,c,a,u,i){const l=document.createTextNode(o),p=Oe(t,n,a>0);if(p.placeholder=l,u?Jt.push({relative:u,element:l}):Wt.push({relative:i,element:l}),d(t))return s.push({insertBefore:l,appendTo:u,subject:t,support:r,counts:c,contextItem:p}),void(p.handler=je);p.handler=(t,e,n,r)=>_e(r,t,n);r.subject.global.locked=!0,Ye(t,p,r,c,u,i);delete r.subject.global.locked,p.value=t}function Pe(t,e,n,r){const o=t.subject.global;o.oldest=t,o.newest=t,++It.locks;const s=function(t,e,n,r){const o=function(t){const e=t.templater,n=e.tag;if(n.tagJsType===a.dom)return n.dom;const r=n.strings;return Zn(r,n.values)}(t),s=t.templater.tag,c=s.values,u=[],i=t.subject.global;i.context=u;const l=Te(o,c,t,e,u,0,n,r);return l}(t,e,n,r);return o.htmlDomMeta=s.dom,--It.locks,s}function Oe(t,e,n){const r={value:t,checkValueChange:qt,withinOwnerElement:n};return e.push(r),r}function Ve(t,e,n){const r=e.global.newest;r.ownerSupport=t,e.checkValueChange=Fe;const o=Pe(r,n,void 0,e.placeholder);for(const t of o.subs)tn(t);return r}function Je(){return{tagJsType:a.templater}}function We(t,e,n){const r=ht(t,e,e.appSupport,n);return n.global.context=[],r}function Ne(t,e,n,r){const o=t[e],s=n[e];if(o===s.value)return;(0,s.handler)(o,t,r,s),s.value=o}function Ie(t,e){const n=t.subject.global.context;!function(t,e){const n=e.templater.tag||e.templater,r=e.templater.values||n.values,o=t.templater.tag;o.values=r}(t,e),++It.locks,function(t,e){const n=t.templater.tag.values;let r=0;const o=n.length;for(;r<o;)Ne(n,r,e,t),++r}(t,n),--It.locks,Rt()}function Re(t,e,r){r.checkValueChange=Fe;const o=t;let s=o.templater;s||(s=ot(yt.DEEP),s.tag=o,o.templater=s);const c=r.global=n(r),a=c.newest=bt(s,e,e.appSupport,r);return c.oldest=a,r}function Me(t,e,n,r,o){const s=void 0===t.lastArray;s&&(t.lastArray=[]);const c=t.lastArray;let a=t.placeholder,u=0;const i=[];if(!s){for(let t=0;t<c.length;++t){const n=c[t],o=zt(e,t,c,u,r);0!==o?2!==o?u+=o:t-=1:i.push(n)}t.lastArray=i}const l=e.length;for(let s=0;s<l;++s){a=De(e,s,t.lastArray,n,a,r,o).placeholder}}function De(t,e,n,r,o,s,c){const a=t[e],u=n[e];return u?function(t,e,n,r,o,s,c,a){const u=n.length>o;if(u)return _e(e,t,r),e;const i=Le(t,s,r,c,n,a);return i}(a,u.context,n,r,e,o,s,c):Le(a,o,r,s,n,c)}function Le(t,e,n,r,o,s){const c={value:t,checkValueChange:qt,withinOwnerElement:!1};r.added=r.added+1;const u=document.createTextNode("");return c.placeholder=u,s||Wt.push({element:u,relative:e}),function(t,e,n){const r=t.tagJsType;if(r)switch(r){case a.templater:Re(t.tag,e,n);break;case a.tag:case a.dom:Re(t,e,n)}}(t,n,c),Ye(t,c,n,r,s),c.value=t,o.push({context:c,global:c.global}),s&&Jt.push({element:u,relative:s}),c}const $e={added:0,removed:0};function _e(t,e,n){if(e===t.value)return;const r=t.checkValueChange(e,t);if(-1===r)return;const o=e&&e.tagJsType;if(o){if(o===a.renderOnce)return;Ue(t,e,n)}else m(e)?Me(t,e,n,{added:0,removed:0}):typeof e!==c.function?r&&function(t,e){e.checkValueChange=qt;const n=e.placeholder,r=Dt(t);e.simpleValueElm=Mt(r,n)}(e,t):t.value=e}function Be(t,e,r){if(!e.global.newest)return void en(t,e,r,{added:0,removed:0});!function(t,e,r){const o=r.global,s=o.newest,c=s.templater.wrapper,u=e.templater.wrapper;let i=!1;const l=e.templater.tagJsType,p=a.stateRender===l||a.renderOnce===l;if(p)i=e.templater.tagJsType===a.renderOnce||Qt(s,e);else if(c&&u){i=c.original===u.original}const f=e.templater;if(!i)return void function(t,e,r){const o=t.global,s=o.oldest;Ft(s,o),n(t);const c=en(e,t,r,{added:0,removed:0})}(r,f,t);const d=p||function(t,e){return St(e.props,t.propsConfig.latest,t.templater.propWatch)}(s,f);if(!d){return void function(t,e,n,r,o){const s=t.props,c=rn(e,n,r,s,o),a=e.propsConfig;a.castProps=c;const u=n.propsConfig;u.latest=a.latest}(f,e,s,t,f.propWatch===yt.DEEP?Et:xt)}if(o.locked)return void o.blocked.push(e);pn(e),++r.renderCount}(r,bt(t,r,r.appSupport,e),e)}function He(t,e,n,r){typeof n!==c.function&&function(t,e,n,r){const o=bt(n.templater||n,r,r.appSupport,e);Ie(t.subject.global.oldest,o)}(t,e,n,r)}function Ue(t,e,r){const o=e.tagJsType;if(f(e))return void 0===t.global&&n(t),Be(e,t,r),!0;const s=t.global;if(s){const n=s.newest;if(n)return He(n,t,e,r),!0}switch(o){case a.templater:return Ve(r,t,$e),!0;case a.tag:case a.dom:return function(t,e,r){const o=t;let s=o.templater;s||(s=Je(),o.templater=s,s.tag=o),(e.global?e.global:n(e)).newest=We(s,r,e),Ve(r,e,$e)}(e,t,r),!0}return!1}function Fe(t,e){const r=e.global,o=r?.newest;if(p(t)){return!Qt(t,o)&&(Ft(o,r),n(e),7)}const s=t?.tagJsType;if(s){return!0===Ue(e,t,r.newest.ownerSupport)&&-1}return 0===o.subject.renderCount?(delete e.global,e.renderCount=0,Nt.push((()=>{Ft(o,r),Nt.shift(),Rt()})),8):(Ft(o,r),delete e.global,e.renderCount=0,8)}function ze(t,e,n){const r=ot(yt.DEEP);r.tagJsType=t.tagJsType;const o=We(r,n,e);function s(){return r.tag=t(),o}return r.wrapper=s,s.tagJsType=t.tagJsType,s.original=t.original||t,o}function Ze(t,e){const n=t.rearray;n.length&&n.length!==t.stateArray.length&&function(t,e,n){const r=`Saved states between renders are inconsistent. Expected ${t.length} states got ${n.stateArray.length}.`,o=e.templater?.wrapper;let s=o;(o?.original||o?.original)&&(s=o.original);const c={oldStates:n.stateArray,newStates:n.rearray,tagFunction:s,templater:e.templater},a=new Y(r,c);throw console.error(Ge,c),a}(n,e,t)}const Ge="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 Xe(t,e){const n=t.subject;++n.renderCount;const r=L.stateConfig;delete r.support,t.state=r.stateArray,L.tagClosed$.next(e),Ze(r,t),n.global.newest=t}function qe(t,e,n,r){const o=n.global,s=n.renderCount,c=e?.state,u=L.stateConfig;if(c){const n=e.states;u.prevSupport=e,W(t,L.stateConfig,c,n)}else J(t,u);const i=t.templater;let l;if(i.tagJsType===a.stateRender){l=lt(i,i,bt(i,r,t.appSupport,n)),l.states=t.states}else{l=(0,i.wrapper)(t,n,e),l.states=t.states}return Xe(l,r),n.renderCount>s+1?o.newest:l}function Qe(t,e,n,r,o,s){n.checkValueChange=Fe;const c=We(t,e,n);c.ownerSupport=e;const a=Pe(c,r,o,o?void 0:s);for(const t of a.dom)t.marker&&(o?Jt.push({element:t.marker,relative:o}):Wt.push({element:t.marker,relative:s})),t.domElement&&(o?Jt.push({element:t.domElement,relative:o}):Wt.push({element:t.domElement,relative:s}));let u=-1;const i=a.subs.length-1;for(;u++<i;){tn(a.subs[u])}return c}function Ye(t,e,r,o,s,c){const u=t?.tagJsType;return u?function(t,e,r,o,s,c,u){switch(++e.renderCount,t){case a.templater:return e.checkValueChange=Fe,c?Qe(r,o,e,s,c,u):Ve(o,e,s);case a.dom:case a.tag:{e.checkValueChange=Fe;const t=r;let a=t.templater;a||(a=function(t){const e=Je();return e.tag=t,t.templater=e,e}(t));const i=n(e);return c?Qe(a,o,e,s,c,u):(i.newest=We(a,o,e),e.checkValueChange=Fe,Ve(o,e,s))}case a.stateRender:case a.tagComponent:if(n(e),e.checkValueChange=Fe,c){const t=function(t,e,n,r,o){const s=bt(t,n,n.appSupport,e),c=s.propsConfig;if(c){const e=t.tagJsType!==a.tagComponent?[]:mt(t,s);c.castProps=e}const u=e.global,{support:i}=cn(s,u.newest,e,n);return function(t,e,n){let r=Jt.length;const o=Pe(t,e,n,void 0);for(const t of o.dom)t.domElement&&Jt.splice(r++,0,{element:t.domElement,relative:n}),t.marker&&Jt.splice(r++,0,{element:t.marker,relative:n});const s=o.subs;for(const t of s)tn(t)}(i,r,o),i}(r,e,o,s,c);return t}return en(r,e,o,s);case a.renderOnce:{n(e);const t=ze(r,e,o);qe(t,void 0,e,o);const a=Qe(t.templater,o,e,s,c,u);return e.checkValueChange=Fe,a}}}(u,e,t,r,o,s,c):m(t)?(Me(e,t,r,o,s),void(e.checkValueChange=Gt)):void(d(t)||function(t,e,n){const r=Dt(t),o=Mt(r,n);e.simpleValueElm=o,e.checkValueChange=qt}(t,e,e.placeholder))}function Ke(t,e,n){const r=n.subject.global,o=t===e.value;r.deleted||o||(_e(e,t,n),L.stateConfig.support||Rt())}function tn({subject:t,support:e,counts:n,contextItem:r,appendTo:o}){let s=function(t){Ye(t,r,e,{...n},c?o:void 0),c||L.stateConfig.support||Rt(),s=function(t){Ke(t,r,e)}};let c=!0;const a=t.subscribe((function(t){s(t)}));r.subject=t,c=!1;const u=e.subject.global;(u.subscriptions=u.subscriptions||[]).push(a)}function en(t,e,n,r){const o=bt(t,n,n.appSupport,e),s=o.propsConfig;if(s){const e=t.tagJsType!==a.tagComponent?[]:mt(t,o);s.castProps=e}const c=e.global,{support:u}=cn(o,c.newest,e,n);return function(t,e,n){n.checkValueChange=Fe;const r=Pe(t,e,void 0,n.placeholder).subs;for(const t of r)tn(t)}(u,r,e),u}function nn(t,e,n,r,o,s){return null==t||s>o?e:typeof t===c.function?e.mem?(t.mem=e.mem,e):(t.mem=e,t):it(e)?e:m(e)?function(t,e,n,r,o,s){for(let c=t.length-1;c>=0;--c){const a=t[c],u=e[c];t[c]=nn(u,a,n,r,s,o+1)}return t}(e,t,n,r,s,o):function(t,e,n,r,o,s){const c=Object.keys(t);for(const a of c){const c=t[a],u=nn(e[a],c,n,r,s,o+1);if(c===u)continue;const i=Object.getOwnPropertyDescriptor(t,a)?.set;i||(t[a]=u)}return t}(e,t,n,r,s,o)}function rn(t,e,n,r,o,s=-1){if(0===o)throw new Error("before here");const c=e.subject.global.newest;if(!c){const e=ct(r,t,s);r.push(...e);return t.propsConfig.castProps=e,r}const a=(e=c||e).propsConfig.castProps,u=[];for(let e=0;e<r.length;++e){const c=r[e],i=nn(a[e],c,t,n,o,s+1);u.push(i)}return t.propsConfig.castProps=u,u}function on(t){const e=t.subject.global,{subs:r,tags:o}=_t(e.context);sn(t);for(const t of o)sn(t);e.subscriptions&&r.forEach((t=>t.unsubscribe())),n(t.subject)}function sn(t){const e=t.subject,n=e.global;!0!==n.deleted&&(n.deleted=!0,e.renderCount=0,Bt(n,[]))}function cn(t,e,n,r){const o=e?.templater,s=o?.tag,c=qe(t,e,n,r),u=!e||Qt(e,c);if(u){if(e){const t=e.templater.tag;t&&n.renderCount>0&&function(t,e,n){if(t.tagJsType===a.dom){const r=n?.dom;return void(r!==t.dom&&on(e))}if(n){const r=n.strings;if(r){const n=r?.length;n!==t.strings.length&&on(e)}}}(t,e,s)}}else{!function(t,e){const n=t.subject.global;let r=-1;const o=n.providers=n.providers||[],s=o.length-1;for(;r++<s;){const t=o[r];let s=-1;const c=t.children.length-1;for(;s++<c;)if(n===t.children[s].subject.global)return t.children.splice(s,1),void t.children.push(e)}}(e,c),on(e);const t=c.subject.global;t.oldest=c,t.newest=c}const i=e?.ownerSupport;return c.ownerSupport=r||i,{support:c,wasLikeTags:u}}const an={added:0,removed:0};function un(t,e,n,r){const o=r.global,{support:s,wasLikeTags:c}=cn(e,t,r,n);return c?(Ie(o.oldest,s),s):(Ve(n,r,an),s)}function ln(t){return a.templater===t.tagJsType}function pn(t){const e=t.subject.global,n=ln(t.templater),r=t.ownerSupport;if(e.locked)return e.blocked.push(t),t;if(n){return fn(r,t)}e.locked=!0;const o=t.subject;e.blocked.length&&(t=e.blocked.pop(),e.blocked=[]);const s=un(e.newest,t,r,o);return delete e.locked,s}function fn(t,e){const n=t.subject.global;if(!n||!0===n.deleted)return e;return pn(n.newest||t)}function dn(t,e){return t.length!==e.length}function gn(t){const e=wn();if(!e)throw mn;return hn(e,L.stateConfig,t)}function hn(t,e,n){const r=e.stateArray,o=e.states;return function(...e){return t.subject.renderCount>0?function(t,e,n,...r){const o=t.subject.global.newest;$(o,t);const s=e(...r);return $(t,o),pn(o),g(s)&&s.finally((()=>{$(t,o),pn(o)})),s}(t,n,{stateArray:r,states:o},...e):n(...e)}}const bn=()=>{const t=wn();if(!t)throw mn;const e=L.stateConfig;return function(n){return hn(t,e,n)}},mn=new K("callback() was called outside of synchronous rendering. Use `callback = callbackMaker()` to create a callback that could be called out of sync with rendering");function vn(t){P(t)}function yn(t){P((function(){wn().subject.global.destroy$.toCallback(t)}))}function wn(){return L.stateConfig.support}const Cn=":tagvar",Sn=":";function jn(t,e){const n={values:e,ownerSupport:wn(),tagJsType:a.tag,strings:t,key:t=>(n.arrayValue=t,n),html:function(t,e){return n.children={strings:t,values:e},n}};return n}function kn(t,e){const n={values:e,ownerSupport:wn(),dom:t,tagJsType:a.dom,key:function(t){return n.arrayValue=t,n},html:{dom:function(t,e){return n.children={dom:t,values:e},n}}};return n}const Tn=/(:tagvar\d+:)/,xn="ondoubleclick",En=/([:_a-zA-Z0-9\-.]+)\s*(?:=\s*"([^"]*)"|=\s*(\S+))?/g,An=/<\/?([a-zA-Z0-9-]+)((?:\s+[a-zA-Z_:*][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)+\s*|\s*)\/?>/g;function Pn(t){const e=[],n=[],r=[];let o=null,s=-1,c=0;const a=new RegExp(An,"g");for(t=function(t){return t.replace(On,(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);c<t.length;){const u=a.exec(t);if(!u)break;const[i,l,p]=u,f=i.startsWith("</"),d=i.endsWith("/>");if(c<u.index){const e=t.slice(c,u.index);if(e.trim()){Nn(e).forEach((t=>{t.startsWith(Cn)&&(t=Cn+ ++s+Sn),Jn(o,n,t)}))}}if(c=u.index+i.length,f){o=r.pop()||null;continue}const g=[];let h;for(;null!==(h=En.exec(p));){const t=h[1]||h[3]||h[5];let n=h[2]||h[4]||h[6];if(void 0===t)continue;const r=""!==h[2],o=void 0===n&&r,c=t.toLowerCase(),a=c.startsWith("on")?Vn(c):c;if(o){if(t.slice(0,Cn.length)===Cn){const t=Cn+ ++s+Sn;e.push(["at",t]),g.push([t]);continue}if(h[0].startsWith(t)&&h[0].slice(t.length,h[0].length).search(/\s+$/)>=0){g.push([a]);continue}n=Cn+ ++s+Sn}r||(n=h[2]);const u=[a,n],i=de(c);i&&u.push(i),g.push(u)}const b={nn:l};g.length&&(b.at=g),o?(o.ch||(o.ch=[]),o.ch.push(b)):n.push(b),d||(r.push(o),o=b)}if(c<t.length){const e=t.slice(c);if(e.trim()){Nn(e).forEach((t=>(t.startsWith(Cn)&&++s,Jn(o,n,t))))}}return n}const On=new RegExp("(\x3c!--[\\s\\S]*?--\x3e)","g");function Vn(t){if(t.startsWith("on")){return t.length===xn.length&&t===xn?"dblclick":t.slice(2,t.length)}return t}function Jn(t,e,n){!function(t,e,n){t?(t.ch||(t.ch=[]),t.ch.push(n)):e.push(n)}(t,e,{nn:"text",tc:Wn(n)})}function Wn(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 Nn(t){return t.split(Tn).filter((t=>""!==t))}const In=/(^:tagvar\d+:|:tagvar\d+:$)/g,Rn="__safeTagVar";function Mn(t,e){return function(t,e){const n=t.map(((t,n)=>n<e.length?t+Cn+n+Sn:t));return function(t,e,n){const r=n.length-e.length;if(r>0)for(let n=r;n>0;--n)t.push(Cn+(e.length+n-1)+Sn)}(n,t,e),n}(t.map((t=>t.replace(In,((t,e)=>Rn+e)))),e)}const Dn=new RegExp(Cn+"(\\d+)"+Sn,"g"),Ln="ch";function $n(t,e,n=[],r=[]){const o=t;for(let t=0;t<o.length;t++){const s=[...r,t],c=o[t];if(c.at){const t=c.at;c.at=Bn(t,e)}if(c.ch){const t=c.ch,r=[...s,Ln];c.ch=$n(t,e,n,r)}t=_n(c,e,o,t)}return o}function _n(t,e,n,r){if("text"!==t.nn)return r;const o=t;let c,a=o.tc;if(typeof a!==s.string)return r;for(;null!==(c=Dn.exec(a));){const t=c[1],o=parseInt(t,10);if(!isNaN(o)&&o<e){const t=Cn+o+Sn,e=a.slice(c.index+t.length);n.splice(r,1,{nn:"text",v:o}),a=e,Dn.lastIndex=0}}return o.tc=a,r}function Bn(t,e){return t.map((t=>{const[n,r,o]=t;if(n.startsWith(Cn)){const t=parseInt(n.replace(Cn,""),10);if(!isNaN(t)&&t<e)return[{tagJsVar:t}]}if(typeof r===s.string&&r.startsWith(Cn)){const t=parseInt(r.replace(Cn,""),10);if(!isNaN(t)&&t<e)return[n,{tagJsVar:t},o]}return t}))}const Hn="__safeTagVar";const Un=/__safeTagVar(\d+)/g;function Fn(t){if(t.at&&(t.at=t.at?t.at.map((t=>{if(1===t.length)return t;const[,e]=t;if(typeof e===s.string&&e.startsWith(Hn)){const n=parseInt(e.replace(Hn,""),10);t[1]=Cn+n+Sn}return t})):[]),t.ch){const e=t.ch;for(let t=0;t<e.length;t++){const n=e[t];if("text"===n.nn){if(typeof n.tc!==s.string)return;n.tc=n.tc.replace(Un,((t,e)=>Cn+e+Sn))}Fn(n)}0===e.length&&delete t.ch}}const zn={};function Zn(t,e){const n=function(t){const e=t.map((t=>t.length));return e.push(t.length),Number(e.join(""))}(t),r=zn[n],o=r&&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,r);if(o)return r.domMetaMap;const s=function(t,e){return Mn(t,e),Pn(Mn(t,e).join(""))}(t,e),c=$n(s,e.length);c.forEach(Fn);const a={interpolation:void 0,string:void 0,strings:t,values:e,domMetaMap:c};return zn[n]=a,c}function Gn(t,...e){const n=jn(t,e),r=ot(yt.NONE);return r.tag=n,n.templater=r,n}Gn.dom=function(t,...e){return kn(t,e)};const Xn=[];function qn(t,e,r){const o=Xn.findIndex((t=>t.element===e));if(o>=0){const t=Xn[o].support;Ft(t,t.subject.global),Xn.splice(o,1),console.warn("Found and destroyed app element already rendered to element",{element:e})}let s=()=>l(r);s.propWatch=yt.NONE,s.tagJsType=a.stateRender,s.props=[r],s.isApp=!0;const u=function(t,e){const r={value:t,checkValueChange:Fe,withinOwnerElement:!1,renderCount:0,global:void 0},o=n(r);return o.events={},Qn(t,r,e),r}(s,e),i=u.global;J(i.newest,L.stateConfig);let l=t(r);const p=typeof l==c.function;p||(f(l)?(i.newest.propsConfig={latest:[r],castProps:[r]},s.propWatch=l.propWatch,s.tagJsType=l.tagJsType,s.wrapper=l.wrapper,s=l):(s.tag=l,l=t));const d=document.createTextNode("");st.push(s.wrapper||{original:s});const g=Yn(s,d,e,u,p);if(i.isApp=!0,p&&(l.tag=g.templater.tag),!e)throw new Error(`Cannot tagElement, element received is type ${typeof e} and not type Element`);e.destroy=function(){const t=i.events;for(const n in t){const r=t[n];e.removeEventListener(n,r)}i.events={},++It.locks;const n=Ft(g,i);return--It.locks,Rt(),n},++It.locks;const h=function(t,e,n,r,o,s){const c=Pe(t,{added:0,removed:0},e,void 0);n.oldest=t,n.newest=t;let u=r.setUse;if(r.tagJsType!==a.stateRender){const t=o.original;u=t.setUse,t.isApp=!0}e.setUse=u,e.ValueTypes=a,Xn.push({element:e,support:t});const i=document.createDocumentFragment();i.appendChild(s);for(const t of c.dom)Kn(t,i);for(const t of c.subs)tn(t);return i}(g,e,i,s,t,d);return--It.locks,Rt(),e.appendChild(h),{support:g,tags:st,ValueTypes:a}}function Qn(t,e,n){const r=e.global,o=dt(t,e);return gt(t,o,o),o.appElement=n,r.oldest=r.oldest||o,r.newest=o,o}function Yn(t,e,n,r,o){r.placeholder=e;const s=r.global,c=s.newest,u=s.oldest;if(c===u||W(c,L.stateConfig,u.state,u.states),t.tagJsType===a.stateRender){const e=t.wrapper||{original:t};if(!o){const e=Qn(t,r,n);return Xe(e),e}const s=lt(t,e,c);return Xe(s),s}const i=(0,t.wrapper)(c,r);return Xe(i),i}function Kn(t,e){t.domElement&&e.appendChild(t.domElement),t.marker&&e.appendChild(t.marker)}const tr={tagElement:qn,renderWithSupport:cn,renderSupport:pn,renderTagOnly:qe,paint:Rt};var er=e.W9,nr=e.cg,rr=e.m0,or=e.rS,sr=e.Y2,cr=e.ei,ar=e.B7,ur=e.TU,ir=e.XF,lr=e.PC,pr=e.Ot,fr=e.Mj,dr=e.tD,gr=e.j8,hr=e.um,br=e.E2,mr=e.OH,vr=e.TB,yr=e.Ii,wr=e.yV,Cr=e.zV,Sr=e.ze,jr=e.WJ,kr=e.aZ,Tr=e.O,xr=e.Ie,Er=e.B4,Ar=e.Az,Pr=e.Xi,Or=e.pc,Vr=e.Ah,Jr=e.ck,Wr=e.k6,Nr=e.Gk,Ir=e.zC,Rr=e.cF,Mr=e.jU,Dr=e.PB,Lr=e.qy,$r=e.cy,_r=e.Tn,Br=e.Gv,Hr=e.yL,Ur=e.D8,Fr=e.Ze,zr=e._4,Zr=e.mn,Gr=e.z,Xr=e.sA,qr=e.MG,Qr=e.PL,Yr=e.nI,Kr=e.PZ,to=e.N_,eo=e.r5,no=e.uc,ro=e.pG,oo=e.QB,so=e.R6,co=e.Ll,ao=e.vP,uo=e.wk,io=e.xP,lo=e.bc,po=e.ag,fo=e.Tc,go=e.Hf,ho=e._A,bo=e.Ag,mo=e.NU,vo=e.hW,yo=e.wB,wo=e.id,Co=e.MC,So=e.SZ;export{er as ArrayNoKeyError,nr as BasicTypes,rr as ImmutableTypes,or as PropWatches,sr as RouteQuery,cr as StateMismatchError,ar as Subject,ur as Subjective,ir as SyncCallbackError,lr as TagError,pr as ValueSubject,fr as ValueSubjective,dr as ValueTypes,gr as addOneContext,hr as buildBeforeElement,br as callback,mr as callbackMaker,vr as checkArrayValueChange,yr as checkSimpleValueChange,wr as checkTagValueChange,Cr as combineLatest,Sr as createTrigger,jr as defineValueOn,kr as destroyArray,Tr as destroySupport,xr as empty,Er as getBaseSupport,Ar as getDomMeta,Pr as getDomTag,Or as getHtmlSupport,Vr as getNewGlobal,Jr as getStringTag,Wr as getSupport,Nr as getTemplaterResult,Ir as hasPropChanges,Rr as hmr,Mr as howToSetFirstInputValue,Dr as howToSetInputValue,Lr as html,$r as isArray,_r as isFunction,Br as isObject,Hr as isPromise,Ur as isSimpleType,Fr as isStaticTag,zr as isSubjectInstance,Zr as isTagComponent,Gr as letProp,Xr as onDestroy,qr as onInit,Qr as oneRenderToSupport,Yr as paint,Kr as processFirstSubjectValue,to as processSubUpdate,eo as providers,no as renderSupport,ro as renderTagOnly,oo as renderWithSupport,so as runWrapper,co as setUseMemory,ao as signal,uo as state,io as states,lo as subject,po as syncError,fo as tag,go as tagElement,ho as tags,bo as upgradeBaseToSupport,mo as variablePrefix,vo as variableSuffix,yo as watch,wo as willCallback,Co as willPromise,So as willSubscribe};
1
+ 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:()=>oe,cg:()=>c,m0:()=>s,rS:()=>de,Y2:()=>o,ei:()=>re,B7:()=>R,TU:()=>L,XF:()=>se,PC:()=>ne,Ot:()=>pn,Mj:()=>fn,tD:()=>a,j8:()=>_t,um:()=>$t,E2:()=>jn,OH:()=>xn,TB:()=>Y,Ii:()=>tt,yV:()=>Xt,zV:()=>I,ze:()=>En,WJ:()=>M,Ng:()=>et,VI:()=>qt,aZ:()=>K,O:()=>X,Ie:()=>r,B4:()=>De,Az:()=>co,Xi:()=>Ln,pc:()=>$e,Ah:()=>n,ck:()=>Rn,k6:()=>_e,Gk:()=>Kt,zC:()=>Je,cF:()=>go,jU:()=>pt,PB:()=>lt,qy:()=>ao,cy:()=>S,Tn:()=>C,Gv:()=>k,yL:()=>w,D8:()=>b,Ze:()=>m,_4:()=>y,mn:()=>v,z:()=>Sn,sA:()=>Pn,MG:()=>On,PL:()=>ee,nI:()=>h,PZ:()=>en,N_:()=>nt,r5:()=>Tn,uc:()=>Oe,pG:()=>ie,QB:()=>Se,R6:()=>po,Ll:()=>B,vP:()=>un,wk:()=>bn,xP:()=>kn,bc:()=>Cn,B1:()=>Vn,ag:()=>An,Tc:()=>ge,Hf:()=>io,_A:()=>te,Ag:()=>Be,NU:()=>Wn,hW:()=>Nn,wB:()=>mn,id:()=>dn,MC:()=>gn,SZ:()=>hn});class o{get(t){return"todo"}}const r="";var s,c;!function(t){t.string="string",t.number="number",t.boolean="boolean",t[void 0]="undefined"}(s||(s={})),function(t){t.function="function",t.date="date",t.unknown="unknown",t.object="object"}(c||(c={}));const a={tag:"html",dom:"dom",templater:"templater",tagComponent:"tagComponent",tagArray:"tagArray",subscribe:"subscribe",signal:"signal",renderOnce:"renderOnce",stateRender:"stateRender",version:Date.now()};let u=[],i=[],l=[],p=[],f=[],d=[];const g={locks:0};function h(){if(!(g.locks>0)){for(let t=u.length-1;t>=0;--t){const e=u[t];e.parentNode.removeChild(e)}for(const t of i)t();for(const[t,e]of l)e.textContent=t;for(const t of p)t.relative.appendChild(t.element);for(const{element:t,relative:e}of f)e.parentNode.insertBefore(t,e);u=[],i=[],p=[],f=[],l=[];for(const t of d)t();d=[]}}function b(t){switch(t){case s.string:case s.number:case s.boolean:return!0}return!1}function m(t){if(!t)return!1;switch(t.tagJsType){case a.dom:case a.tag:case a.templater:return!0}return!1}function v(t){const e=t?.tagJsType;return e===a.tagComponent||e===a.stateRender}function y(t){return k(t)&&typeof t.subscribe===c.function}function w(t){return t&&C(t.then)}function C(t){return typeof t===c.function}function k(t){return typeof t===c.object&&null!==t}function S(t){return Array.isArray(t)}function T(t){let e=t;for(;e.ownerSupport&&!v(e.templater);)e=e.ownerSupport;return e.subject.global.newest||e}function j(t){const e=B.stateConfig;return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>t))}function E(t){const e=B.stateConfig,n=(e.support,e.statesIndex),o=T(e.prevSupport).states[n];let r=[];o((function(...t){return r=t,t}));return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>(r)))}function x(t,e){e.handlers.handler=J,e.handlers.statesHandler=j,e.rearray=[],e.stateArray=[],e.states=[],e.statesIndex=0,e.support=t}function A(t,e,n,o,r){n.rearray=o,n.stateArray=[],n.states=[],n.statesIndex=0,n.handlers.handler=V,n.handlers.statesHandler=E,n.prevSupport=e}class O{}function P(t){const e=t.callback;if(!e)return t.defaultValue;const[n]=function(t){const[e]=t(O),[n]=t(e);return[e,n]}(e);return n}function V(){const t=B.stateConfig,e=t.rearray[t.stateArray.length];return t.stateArray.push(e),e.defaultValue}function J(t){const e=B.stateConfig;let n=t;if(typeof t===c.function&&(n=t()),typeof n===c.function){const t=n;n=function(...e){return t(...e)},n.original=t}const o={get:function(){return P(o)},defaultValue:n};return e.stateArray.push(o),n}function I(t){const e=new R;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))),a=s.map(((t,e)=>t.subscribe((t=>r(t,e+1)))));return c.subscriptions=a,c},e}function W(t,e,n){const o=R.globalSubCount$;R.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=R.globalSubCount$;R.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 N(t,e,n){const o=[...e],r=o.shift(),s=t=>{if(o.length)return N(t,o,n);n(t)};let c=s;const a=r(t,{setHandler:t=>c=t,next:s});c(a)}class R{value;onSubscription;methods=[];isSubject=!0;subscribers=[];subscribeWith;constructor(t,e){this.value=t,this.onSubscription=e}subscribe(t){const e=W(0,t,this.subscribers),n=this.subscribeWith;if(n){if(this.methods.length){const n=t;t=t=>{N(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 R(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 I(t.map((t=>{if(y(t))return t;return new R(t,(e=>(e.next(t),e)))})))}static globalSubCount$=new R(0)}class L extends R{value;onSubscription;_value;constructor(t,e){super(t,e),this.value=t,this.onSubscription=e,this._value=t,M(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 M(t){Object.defineProperty(t,"value",{set(e){t._value=e,t.emit()},get:()=>t._value})}const D=new R(void 0,(function(t){Jn()||t.next()})),B={stateConfig:{stateArray:[],version:Date.now(),handlers:{handler:J,statesHandler:j}},tagClosed$:D};function $(t,e){const n=document.createTextNode(t);return f.push({element:n,relative:e}),n}function _(t){switch(t){case void 0:case!1:case null:return r}return t}function H(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].subject.global===e&&t.children.splice(n,1)}e.destroy$&&e.destroy$.next(),t.subject.renderCount=0}function U(t){for(const e of t){const t=e.lastArray;if(t){U(t.map((t=>t.context)));continue}const n=e.global;if(!n)continue;const o=n.newest,r=n.subscriptions;r&&r.forEach((t=>t.unsubscribe())),v(o.templater)&&H(o,n);U(n.context)}}function F(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.context;s&&F(s,e,n)}return{tags:e,subs:n}}function z(t,e){const n=t.context,o=t.destroys;if(o)return function(t,e,n){const o=[];if(t.forEach((t=>{const e=t();e instanceof Promise&&o.push(e)})),o.length){const t=Promise.all(o).then((()=>{++g.locks,Z(e.context,n),G(e),--g.locks,h()}));return void n.push(t)}++g.locks,Z(e.context,n),G(e),--g.locks,h()}(o,t,e);Z(n,e),G(t)}function Z(t,e){for(const n of t){if(n.withinOwnerElement)continue;const t=n.lastArray;if(t){K(n,t);continue}const o=n.simpleValueElm;if(o){delete n.simpleValueElm,u.push(o);continue}const r=n.global;if(void 0===r)continue;if(!0===r.deleted)continue;r.deleted=!0;r.oldest&&z(r,e)}}function G(t){t.htmlDomMeta.forEach((t=>{const e=t.marker;e&&u.push(e);const n=t.domElement;n&&u.push(n)}))}function X(t,e){const n=t.subject;e.deleted=!0,n.renderCount=0;const o=[];return U(e.context),e.destroy$&&H(t,e),z(e,o),o}function q(t,e,n,o,r){const s=t.length-1,c=e-o,a=c<0||s<c,u=n[e].context;if(a)return Q(u,r),1;const i=function(t,e,n,o,r,s){const c=e&&t!==e.arrayValue;if(c)return Q(n,o),r.splice(s,1),2;return 0}(u.value.arrayValue,t[e],u,r,n,e);return i}function Q(t,e){!function(t,e){if(t){X(t.oldest,t)}else{const t=e.simpleValueElm;delete e.simpleValueElm,u.push(t)}}(t.global,t),++e.removed}function Y(t,e){if(!S(t)){return K(e,e.lastArray),9}return!1}function K(t,e){const n={added:0,removed:0};for(let t=0;t<e.length;++t)Q(e[t],n);delete t.lastArray}function tt(t,e){return null==t||typeof t!==c.object?(function(t,e){const n=_(t),o=e.simpleValueElm;l.push([n,o])}(t,e),-1):(et(e),6)}function et(t){const e=t.simpleValueElm;delete t.simpleValueElm,u.push(e)}function nt(t,e,n){n.subject.global.deleted||(Ze(e,t,n),B.stateConfig.support||h())}function ot({subject:t,support:e,counts:n,contextItem:o,appendTo:r}){const s=function(t,e,n,o,r){let s=function(t){en(t,e,n,{...o},a?r:void 0),a||B.stateConfig.support||h(),s=function(t){nt(t,e,n)}};const c=function(t){s(t)};let a=!0;const u=t.subscribe(c);return e.subject=t,a=!1,u}(t,o,e,n,r),c=e.subject.global;(c.subscriptions=c.subscriptions||[]).push(s)}function rt(t,e){return st(t,e)}function st(t,e){if(null===t||typeof t!==c.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=S(t)?[]:Object.create(Object.getPrototypeOf(t));if(S(t))for(let o=0;o<t.length;o++)n[o]=st(t[o],e-1);else for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=st(t[o],e-1));return n}function ct(t,e,n){return at(t,e,n)}function at(t,e,n){return!(t!==e&&(o=t,r=e,!C(o)||!C(r)||o.toString()!==r.toString()))||(n<0||typeof t===c.object&&typeof e===c.object&&(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():S(t)&&S(e)?function(t,e,n){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!at(t[o],e[o],n-1))return!1;return!0}(t,e,n-1):!S(t)&&!S(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)||!at(t[s],e[s],n-1))return!1}return!0}(t,e,n-1)));var o,r}function ut(t){return t.map(it)}function it(t,e){const n=t,o=t?.tagJsType;if(o)switch(o){case a.stateRender:return;case a.dom:case a.tag:case a.templater:return ut(n.values)}return S(t)?ut(n):rt(t,e)}function lt(t,e,n){i.push((()=>{pt(t,e,n)}))}function pt(t,e,n){void 0!==n&&!1!==n&&null!==n?t.setAttribute(e,n):t.removeAttribute(e)}function ft(t,e,n,o,r,s){switch(o){case"init":{const t=s.added;return void d.push((()=>{e({target:n,stagger:t})}))}case"destroy":{const t=++s.removed,o=r.subject.global;return o.destroys=o.destroys||[],void o.destroys.push((()=>e({target:n,stagger:t})))}case"autofocus":return void d.push((()=>n.focus()));case"autoselect":return void d.push((()=>n.select()));case"style":{const o=t.split(".");return void i.push((()=>n.style[o[1]]=e))}case"class":return void function(t,e,n){const o=t.split(".");if(o.shift(),e){for(const t of o)i.push((()=>n.classList.add(t)));return}for(const t of o)i.push((()=>n.classList.remove(t)))}(t,e,n)}throw new Error(`Invalid special attribute of ${o}. ${t}`)}function dt(t,e){const n=function(t,e,n=[]){const o=t.subject;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.subject;n.push({support:o,renderCount:s.renderCount,provider:e})}return n}(t,e);return n}function gt(t,e=[]){const n=t.subject.global,o=Ae(t.templater),r=t.ownerSupport;if(n.locked)return e.push(t),e;if(o)return gt(r,e);const s=t,c=v(s.templater),u=t.templater.tagJsType,i=r&&u!==a.stateRender&&(!c||function(t,e,n){const o=function(t,e){const n=t.props,o=e.propsConfig,r=o.latest;if(Ve(n,r))return!0;switch(t.propWatch){case de.IMMUTABLE:return We(n,r);case de.SHALLOW:return Ne(n,r)}return!ct(n,r,Le)}(e,n);if(t&&o)return!0;return!1}(r,s.templater,s)),l=function(t){const e=t.subject.global.providers;if(!e)return[];const n=[];for(const t of e){const e=dt(t.owner,t);n.push(...e.map((t=>t.support)))}return n}(s);return e.push(...l),i?(gt(r,e),c&&e.push(s),e):(e.push(s),e)}function ht(t){++g.locks,t.forEach(bt),--g.locks,h()}function bt(t){const e=t.subject.global;e&&Oe(e.newest)}const mt="no-data-ever",vt="promise-no-data-ever";function yt(t,e){const n=e.subject.global,o=function(t,e){if(!0!==n.deleted)return function(t,e,n,o,r){const s=T(e),c=s.subject,a=c.global;a.locked=!0;const u=t.apply(o,r);delete a.locked;const i=function(t,e){const n=e.subject.global;return function(t,e,n){return ht(gt(t)),function(t,e,n){if(w(t)){return e.subject.global.locked=!0,t.then((()=>{if(!0===n.deleted)return vt;delete e.subject.global.locked;return ht(gt(e)),vt}))}return mt}(e,t,n)}(e,t,n)}(u,s);return i}(o.tagFunction,o.support,o.states,t,e)};o.tagFunction=t;const r=T(e);o.support=e;const s=r.states;return o.states=s,o}const wt=["init","destroy"];function Ct(t,e,n,o,r,s,c){if(c)return ft(t,e,n,c,s,r);o(n,t,e)}function kt(t,e,n,o){const r=t.appElement;"blur"===e&&(e="focusout");const s="_"+e,c=t.subject.global.events;if(!c[e]){const t=function(t){t.originalStopPropagation=t.stopPropagation,St(t,s,t.target)};c[e]=t,r.addEventListener(e,t)}n[s]=o,n[e]=o}function St(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&&St(t,e,r)}function Tt(t,e,n,o){const r=function(...e){return r.tagFunction(t,e)};r.tagFunction=e,r.support=n,kt(n.appSupport,o,t,r)}function jt(t){if(t.startsWith("class."))return"class";const e=function(t){switch(t){case"autoselect":return"autoselect";case"autofocus":return"autofocus";case"oninit":case"init":return"oninit";case"ondestroy":case"destroy":return"destroy"}return!1}(t);return!1!==e||!!t.startsWith("style.")&&"style"}const Et={added:0,removed:0};function xt(t,e,n,o){if(n.isNameOnly)return function(t,e,n,o,r,s,a,u){if(n){if(Wt(e))return void o.removeAttribute(n);if(typeof n===c.object)if(typeof e===c.object)for(const t in n)t in e||i.push((function(){o.removeAttribute(t)}));else for(const t in n)i.push((function(){o.removeAttribute(t)}))}Ot(t,e,o,r,s,a,u)}(t,e,n.value,n.element,o,n.howToSet,[],Et),void(n.value=e);const r=n.element;Pt(e,n.attrName,n,r,o,n.howToSet,n.isSpecial,Et),n.value=e}function At(t,e,n,o,r,s,a,u,l){const p=It(e);if(p>=0){const e=t[p],c=_t(e,s,!0);return c.isAttr=!0,c.element=n,c.howToSet=r,c.isNameOnly=!0,c.handler=(t,e)=>xt(e,t,c,o),void Ot(t,e,n,o,r,s,u)}const f=It(l);if(f>=0){const l=t[f],p={isAttr:!0,element:n,attrName:e,checkValueChange:tt,delete:et,withinOwnerElement:!0};s.push(p);return y(p.value)?function(t,e,n,o,r,s,c){s&&i.push((function(){n.removeAttribute(t)}));const a=e.value;if(y(a)){e.handler=Nt;const u=function(a){Pt(a,t,e,n,o,r,s,c)},i=a.subscribe(u),l=e.global;(l.subscriptions=l.subscriptions||[]).push(i)}return void Pt(e.value,t,e,n,o,r,s,c)}(e,p,n,o,r,a,u):(p.handler=(t,e)=>xt(e,t,p,o),function(t,e,n,o,r,s,a,u){n.attrName=t,n.element=o,n.howToSet=r,typeof e===c.function?u&&wt.includes(t)?ft(t,e,o,t,s,a):Jt(n,e,s,t,o):(n.attrName=t,n.element=o,n.howToSet=r,n.isSpecial=u,Ct(t,e,o,r,a,s,u))}(e,l,p,n,r,o,u,a),void(p.value=l))}return Ct(e,l,n,r,u,o,a)}function Ot(t,e,n,o,s,a,u){if(!Wt(e))if(typeof e!==c.object)0!==e.length&&s(n,e,r);else for(const r in e){const c=e[r];At(t,r,n,o,s,a,jt(r),u,c)}}function Pt(t,e,n,o,r,s,c,u){return C(t)?function(t,e,n,o,r,s,c,u){const i=t.templater.wrapper;if((i?.tagJsType||i?.original?.tagJsType)!==a.renderOnce)return Jt(c,e,t,o,n);return Vt(e,n,o,r,s,t,u)}(r,t,o,e,c,s,n,u):Vt(t,o,e,c,s,r,u)}function Vt(t,e,n,o,r,s,c){if(!1===o){switch(t){case void 0:case!1:case null:return void i.push((function(){e.removeAttribute(n)}))}if(C(t))return Tt(e,t,s,n);r(e,n,t)}else ft(n,t,e,o,s,c)}function Jt(t,e,n,o,r){return Tt(r,e=yt(e,n),n,o)}function It(t){return k(t)&&"tagJsVar"in t?t.tagJsVar:-1}function Wt(t){return null==t||!1===t}const Nt=()=>{},Rt="object"==typeof document&&document.createElement("div");function Lt(t,e,n,o,s,c,a,u,i=[]){const l=[];a&&void 0===u&&(u=document.createTextNode(r),p.push({element:u,relative:a}),a=void 0);for(let r=0;r<t.length;++r){const p=t[r],f=p.v;if(!isNaN(f)){const t=s.length;Bt(e[t],t,s,n,i,o,c,a,u);continue}const d={};if(l.push(d),"text"===p.nn){Dt(d,p,a,u);continue}const g=Mt(d,p,e,n,s,o,a,u);p.ch&&(d.ch=Lt(p.ch,e,n,o,s,c+1,g,u,i).dom)}return{subs:i,dom:l,context:s}}function Mt(t,e,n,o,r,s,c,a){const u=t.domElement=document.createElement(e.nn);return e.at&&e.at.forEach((t=>{const e=t[0],c=t[1],a=t[2]||!1;At(n,e,u,o,pt,r,a,s,c)})),c?p.push({element:u,relative:c}):f.push({element:u,relative:a}),u}function Dt(t,e,n,o){const r=t,s=r.tc=e.tc;Rt.innerHTML=s;const c=r.domElement=document.createTextNode(Rt.innerText);n?p.push({element:c,relative:n}):f.push({element:c,relative:o})}function Bt(t,e,n,o,s,c,a,u,i){const l=document.createTextNode(r),d=_t(t,n,a>0);d.placeholder=l,u?p.push({relative:u,element:l}):f.push({relative:i,element:l}),d.handler=(t,e,n,o)=>Ze(o,t,n);o.subject.global.locked=!0,en(t,d,o,c,u,i);delete o.subject.global.locked,d.value=t}function $t(t,e,n,o){const r=t.subject;r.delete=qt;const s=r.global;s.oldest=t,s.newest=t,++g.locks;const c=function(t,e,n,o){const r=function(t){const e=t.templater,n=e.tag;if(n.tagJsType===a.dom)return n.dom;const o=n.strings;return co(o,n.values)}(t),s=t.templater.tag,c=s.values,u=[],i=t.subject.global;i.context=u;const l=Lt(r,c,t,e,u,0,n,o);return l}(t,e,n,o);return s.htmlDomMeta=c.dom,--g.locks,c}function _t(t,e,n){const o={value:t,checkValueChange:tt,delete:et,withinOwnerElement:n};return e.push(o),o}function Ht(t,e,n){return t.map((t=>function(t,e,n,o){if(m(t)||!t)return t;if(!e)return t;return Ut(t,e,n,o)}(t,e.ownerSupport,e,n)))}function Ut(t,e,n,o){if(!t)return t;if(t.tagJsType)return t;if(typeof t===c.function)return function(t,e){const n=t.mem;if(n)return t;const o=function(...t){return o.toCall(...t)};return o.original=t,o.mem=t,o.toCall=function(...t){return function(t,e,n){const o=n.subject.global,r=o?.newest||n,s=void 0===Jn(),c=t(...e),a=function(){const t=r.subject.global;if(!1===s){if(!0===t.locked)return c}return function(t,e){const n=t.subject,o=Ae(t.templater);if(o){return Pe(e,t)}const r=n.global;r.locked=!0,xe(r.newest,t,e,n),delete r.locked}(r,n),c};if(s)return a();return B.tagClosed$.toCallback(a),c}(o.mem,t,e)},Object.assign(o,t),o}(t,e);if(o===Le)return t;return zt(t)?t:S(t)?function(t,e,n,o){for(let r=t.length-1;r>=0;--r){const s=t[r];if(t[r]=Ut(s,n,e,o+1),typeof s===c.function){if(s.mem)continue;Ft(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],a=Ut(r,n,e,o+1);if(t[s]===a)continue;const u=Object.getOwnPropertyDescriptor(t,s);if(!(u?.get||u?.set)&&(t[s]=a,typeof a===c.function)){if(r.mem)continue;Ft(o+1,s,r,t,e)}}return t}(t,n,e,o)}function Ft(t,e,n,o,r){if(t>0){const t=r.subject.global;o[e].subscription=t.destroy$.toCallback((function(){o[e]=n}))}}function zt(t){return typeof t!==c.object||!t||t.tagJsType}function Zt(t,e,n,o){const r=e.original,s=t.tagJsType===a.stateRender,u=B.stateConfig;let i;return u.support=n,s?i=t():(i=r(...o),typeof i===c.function&&(i=i())),i.templater=t,t.tag=i,n.state=u.stateArray,n.states=u.states,n}function Gt(t,e){const n=t.templater,o=e.templater,r=n?.tag||t,s=o.tag;if(n?.tagJsType===a.stateRender)return n.dom===o.dom;switch(r.tagJsType){case a.dom:return s?.tagJsType===a.dom&&function(t,e){const n=t.dom,o=e.dom;return n===o}(r,s);case a.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 a=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(((e,n)=>{const o=t[n];if(typeof e===c.function&&typeof o===c.function){return!!(e.toString()===o.toString())}return!0}));if(o)return!0;return!1}(a,u)}(r,s,t,e);return n}}throw new Error(`unknown tagJsType of ${r.tagJsType}`)}function Xt(t,e){const o=e.global,r=o?.newest;if(m(t)){return!Gt(t,r)&&(X(r,o),n(e),7)}const s=t?.tagJsType;if(s){return!0===qe(e,t,o.newest.ownerSupport)&&-1}return 0===r.subject.renderCount?(delete e.global,e.renderCount=0,d.push((()=>{X(r,o),d.shift(),h()})),8):(qt(e),8)}function qt(t){const e=t.global,n=e?.newest;X(n,e),delete t.global,t.renderCount=0}function Qt(t,e,n,o,r,s){e.checkValueChange=Xt;const c=Fe(t,n,e);c.ownerSupport=n;const a=$t(c,o,r,r?void 0:s);for(const t of a.dom)t.marker&&(r?p.push({element:t.marker,relative:r}):f.push({element:t.marker,relative:s})),t.domElement&&(r?p.push({element:t.domElement,relative:r}):f.push({element:t.domElement,relative:s}));let u=-1;const i=a.subs.length-1;for(;u++<i;){ot(a.subs[u])}return c}function Yt(t,e,n,o,r,s){return e.checkValueChange=Xt,r?Qt(t,e,n,o,r,s):He(n,e,o)}function Kt(t,e){const n={tagJsType:a.templater,processInit:Yt,propWatch:t,props:e,key:function(t){return n.arrayValue=t,n}};return n}const te=[];function ee(t,e,n){const o=Kt(de.DEEP);o.tagJsType=t.tagJsType;const r=Fe(o,n,e);function s(){return o.tag=t(),r}return o.wrapper=s,s.tagJsType=t.tagJsType,s.original=t.original||t,r}class ne extends Error{details;constructor(t,e,n={}){super(t),this.name=ne.name,this.details={...n,errorCode:e}}}class oe extends ne{constructor(t,e){super(t,"array-no-key-error",e),this.name=oe.name}}class re extends ne{constructor(t,e){super(t,"state-mismatch-error",e),this.name=re.name}}class se extends ne{constructor(t,e){super(t,"sync-callback-error",e),this.name=se.name}}function ce(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},a=new re(o,c);throw console.error(ae,c),a}(n,e,t)}const ae="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 ue(t,e){const n=t.subject;++n.renderCount;const o=B.stateConfig;t.state=o.stateArray,t.states=o.states,n.global.newest=t,ce(o,t),delete o.prevSupport,delete o.support,delete o.stateArray,delete o.states,B.tagClosed$.next(e)}function ie(t,e,n,o){const r=e?.state,s=B.stateConfig;r?A(0,e,B.stateConfig,r,e.states):x(t,s);const c=t.templater;let u;if(c.tagJsType===a.stateRender){const e=c;u=_e(c,o,t.appSupport,n),Zt(c,e,u)}else{u=(0,c.wrapper)(t,n,e)}return ue(u,o),u}function le(t,e,o,r,s,c){n(e);const a=ee(t,e,o);ie(a,void 0,e,o);const u=Qt(a.templater,e,o,r,s,c);return e.checkValueChange=Xt,u}function pe(t,e,o,r,s){if(n(e),e.checkValueChange=Xt,s){const n=function(t,e,n,o,r){const s=_e(t,n,n.appSupport,e),c=s.propsConfig;if(c){const e=t.tagJsType!==a.tagComponent?[]:be(t,s);c.castProps=e}const u=e.global,{support:i}=Se(s,u.newest,e,n);return function(t,e,n){let o=p.length;const r=$t(t,e,n,void 0);for(const t of r.dom)t.domElement&&p.splice(o++,0,{element:t.domElement,relative:n}),t.marker&&p.splice(o++,0,{element:t.marker,relative:n});const s=r.subs;for(const t of s)ot(t)}(i,o,r),i}(t,e,o,r,s);return n}return me(t,e,o,r)}let fe=0;var de;function ge(t,e=de.SHALLOW){const n=function(...o){const r=Kt(e,o);r.tagJsType=a.tagComponent,r.processInit=pe;const s=function(t,e){const n=function(n,o,r){const s=be(t,n,r),c=n.ownerSupport,a=_e(t,c,n.appSupport,o,s);return Zt(t,e,a,s)};return n}(r,n);return s.original=t,r.wrapper=s,r},o=t;return n.original=t,o.tags=te,o.setUse=B,o.ValueTypes=a,o.tagIndex=fe++,te.push(n),n}function he(){throw new Error("Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `")}function be(t,e,n){const o=t.propWatch===de.DEEP?Le:Re,r=t.props,s=e.propsConfig;let c=s.castProps;const a=n?.propsConfig,u=a?.castProps;u&&(s.castProps=u,c=we(e,n,n.ownerSupport,r,o));return c||Ht(r,e,0)}function me(t,e,n,o){const r=_e(t,n,n.appSupport,e),s=r.propsConfig;if(s){const e=t.tagJsType!==a.tagComponent?[]:be(t,r);s.castProps=e}const c=e.global,{support:u}=Se(r,c.newest,e,n);return function(t,e,n){n.checkValueChange=Xt;const o=$t(t,e,void 0,n.placeholder).subs;for(const t of o)ot(t)}(u,o,e),u}function ve(t,e,n,o,r,s){return null==t||s>r?e:typeof t===c.function?e.mem?(t.mem=e.mem,e):(t.mem=e,t):zt(e)?e:S(e)?function(t,e,n,o,r,s){for(let c=t.length-1;c>=0;--c){const a=t[c],u=e[c];t[c]=ve(u,a,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 a of c){const c=t[a],u=ve(e[a],c,n,o,s,r+1);if(c===u)continue;const i=Object.getOwnPropertyDescriptor(t,a)?.set;i||(t[a]=u)}return t}(e,t,n,o,s,r)}function ye(t,e,o){const r=o.global,s=r.newest,c=s.templater.wrapper,u=e.templater.wrapper;let i=!1;const l=e.templater.tagJsType,p=a.stateRender===l||a.renderOnce===l;if(p)i=e.templater.tagJsType===a.renderOnce||Gt(s,e);else if(c&&u){i=c.original===u.original}const f=e.templater;if(!i)return void function(t,e,o){const r=t.global,s=r.oldest;X(s,r),n(t);const c=me(e,t,o,{added:0,removed:0})}(o,f,t);const d=p||function(t,e){const n=e.props,o=t.propsConfig,r=o.latest,s=Je(n,r,t.templater.propWatch);return s}(s,f);if(d)r.locked?r.blocked.push(e):(Oe(e),++o.renderCount);else{!function(t,e,n,o,r){const s=t.props,c=we(e,n,o,s,r),a=e.propsConfig;a.castProps=c;const u=n.propsConfig;u.latest=a.latest}(f,e,s,t,f.propWatch===de.DEEP?Le:Re)}}function we(t,e,n,o,r,s=-1){if(0===r)throw new Error("before here");const c=e.subject.global.newest;if(!c){const e=Ht(o,t,s);o.push(...e);return t.propsConfig.castProps=e,o}const a=(e=c||e).propsConfig.castProps,u=[];for(let e=0;e<o.length;++e){const c=o[e],i=ve(a[e],c,t,n,r,s+1);u.push(i)}return t.propsConfig.castProps=u,u}function Ce(t){const e=t.subject,o=e.global,{subs:r,tags:s}=F(o.context);ke(o);for(const t of s){const e=t.subject.global;if(!0===e.deleted)return;ke(e)}o.subscriptions&&r.forEach((t=>t.unsubscribe())),n(e)}function ke(t){t.deleted=!0,z(t,[])}function Se(t,e,n,o){const r=e?.templater,s=r?.tag,c=ie(t,e,n,o),u=!e||Gt(e,c);if(u){if(e){const t=e.templater.tag;t&&n.renderCount>0&&function(t,e,n){if(t.tagJsType===a.dom){const o=n?.dom;return void(o!==t.dom&&Ce(e))}if(n){const o=n.strings;if(o){const n=o?.length;n!==t.strings.length&&Ce(e)}}}(t,e,s)}}else{!function(t,e){const n=t.subject.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].subject.global)return t.children.splice(s,1),void t.children.push(e)}}(e,c),Ce(e);const t=c.subject.global;t.oldest=c,t.newest=c}const i=e?.ownerSupport;return c.ownerSupport=o||i,{support:c,wasLikeTags:u}}function Te(t,e,n,o){const r=t[e],s=n[e];if(r===s.value)return;(0,s.handler)(r,t,o,s),s.value=r}function je(t,e){const n=t.subject.global.context;!function(t,e){const n=e.templater.tag||e.templater,o=e.templater.values||n.values,r=t.templater.tag;r.values=o}(t,e),++g.locks,function(t,e){const n=t.templater.tag.values;let o=0;const r=n.length;for(;o<r;)Te(n,o,e,t),++o}(t,n),--g.locks,h()}!function(t){t.DEEP="deep",t.SHALLOW="shallow",t.NONE="none",t.IMMUTABLE="immutable"}(de||(de={})),ge.renderOnce=function(){throw new Error("Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `")},ge.state=he,ge.use=he,ge.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`` `")},ge.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`` `")},ge.deepPropWatch=ge,ge.immutableProps=function(t){return ge(t,de.IMMUTABLE)},ge.watchProps=function(t){return ge(t,de.SHALLOW)},Object.defineProperty(ge,"renderOnce",{set(t){t.tagJsType=a.renderOnce,t.processInit=le}}),Object.defineProperty(ge,"state",{set(t){t.original={setUse:B,tags:te},t.tagJsType=a.stateRender,t.processInit=pe}}),Object.defineProperty(ge,"use",{set(t){t.original={setUse:B,tags:te},t.tagJsType=a.stateRender,t.processInit=pe}});const Ee={added:0,removed:0};function xe(t,e,n,o){const r=o.global,{support:s,wasLikeTags:c}=Se(e,t,o,n);return c?(je(r.oldest,s),s):(He(n,o,Ee),s)}function Ae(t){return a.templater===t.tagJsType}function Oe(t){const e=t.subject.global,n=Ae(t.templater),o=t.ownerSupport;if(e.locked)return e.blocked.push(t),t;if(n){return Pe(o,t)}e.locked=!0;const r=t.subject;e.blocked.length&&(t=e.blocked.pop(),e.blocked=[]);const s=xe(e.newest,t,o,r);return delete e.locked,s}function Pe(t,e){const n=t.subject.global;if(!n||!0===n.deleted)return e;return Oe(n.newest||t)}function Ve(t,e){return t.length!==e.length}function Je(t,e,n){if(Ve(t,e))return 11;switch(n){case de.NONE:return 1;case de.SHALLOW:return Ne(t,e);case de.IMMUTABLE:return We(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===c.object){const e={...t},n={...r||{}},o=Object.entries(e).every((([t,o])=>Ie(o,n[t],(()=>{delete e[t],delete n[t]}))));return o}return Ie(t,r,(()=>{n.splice(e,1),o.splice(e,1)}))}(t,e,n,o))))return 7;return!1}(t,e)}function Ie(t,e,n){if(typeof t!==c.function)return!!ct(t,e,Le)&&4;if(typeof e!==c.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 We(t,e){const n=t.length;for(let o=0;o<n;++o){if(t[o]!==e[o])return 2}return!1}function Ne(t,e){const n=t.length;for(let o=0;o<n;++o){const n=t[o],r=e[o];if(S(n)&&S(r)){if(n===r)continue;return 3}if(typeof n!==c.function||typeof r!==c.function)if(typeof n!==c.object){if(n!==r)return 3.3}else if(typeof e===c.object){const t=Object.entries(n);for(const e of t){if(!Me(e,r))return 3.1}}}return!1}const Re=3,Le=10;function Me([t,e],n){const o=n[t];return typeof e===c.function&&typeof o===c.function||o===e}function De(t,e,n){const o={templater:t,subject:e,castedProps:n,appSupport:void 0},r=e.global;return r.blocked=[],r.destroy$=new R,o}function Be(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!==a.stateRender){switch(o.propWatch){case de.IMMUTABLE:return t.propsConfig={latest:e,castProps:n};case de.SHALLOW:return t.propsConfig={latest:e.map((t=>it(t,Re))),castProps:n}}return t.propsConfig={latest:e.map((t=>it(t,Le))),castProps:n}}}(e,r,o)),e}function $e(t,e,n,o,r){const s={templater:t,subject:o,castedProps:r,appSupport:void 0};return s.ownerSupport=e,s.appSupport=n,s}function _e(t,e,n,o,r){const s=De(t,o,r);return s.ownerSupport=e,Be(t,s,n,r)}function He(t,e,n){const o=e.global.newest;o.ownerSupport=t,e.checkValueChange=Xt;const r=$t(o,n,void 0,e.placeholder);for(const t of r.subs)ot(t);return o}function Ue(){return{tagJsType:a.templater,processInit:Yt}}function Fe(t,e,n){const o=$e(t,e,e.appSupport,n);return n.global.context=[],o}const ze={added:0,removed:0};function Ze(t,e,n){e!==t.value&&Ge(t,e,n)}function Ge(t,e,n){const o=t.checkValueChange(e,t);-1!==o&&function(t,e,n,o){const r=t&&t.tagJsType;if(r){if(r===a.renderOnce)return;return void qe(e,t,n)}if(S(t))return void Ye(e,t,n,{added:0,removed:0});if(typeof t===c.function)return void(e.value=t);o&&function(t,e){e.checkValueChange=tt;const n=e.placeholder,o=_(t);e.simpleValueElm=$(o,n)}(t,e)}(e,t,n,o)}function Xe(t,e,n,o){typeof n!==c.function&&function(t,e,n,o){const r=_e(n.templater||n,o,o.appSupport,e);je(t.subject.global.oldest,r)}(t,e,n,o)}function qe(t,e,o){const r=e.tagJsType;if(v(e))return void 0===t.global&&n(t),function(t,e,n){if(!e.global.newest)return void me(t,e,n,{added:0,removed:0});ye(n,_e(t,n,n.appSupport,e),e)}(e,t,o),!0;const s=t.global;if(s){const n=s.newest;if(n)return Xe(n,t,e,o),!0}switch(r){case a.templater:return He(o,t,ze),!0;case a.tag:case a.dom:return function(t,e,o){const r=t;let s=r.templater;s||(s=Ue(),r.templater=s,s.tag=r),(e.global?e.global:n(e)).newest=Fe(s,o,e),He(o,e,ze)}(e,t,o),!0}return!1}function Qe(t,e,o){o.checkValueChange=Xt;const r=t;let s=r.templater;s||(s=Kt(de.DEEP),s.tag=r,r.templater=s);const c=o.global=n(o),a=c.newest=_e(s,e,e.appSupport,o);return c.oldest=a,o}function Ye(t,e,n,o,r){const s=void 0===t.lastArray;s&&(t.lastArray=[]);const c=t.lastArray;let a=t.placeholder,u=0;const i=[];if(!s){for(let t=0;t<c.length;++t){const n=c[t],r=q(e,t,c,u,o);0!==r?2!==r?u+=r:t-=1:i.push(n)}t.lastArray=i}const l=e.length;for(let s=0;s<l;++s){a=Ke(e,s,t.lastArray,n,a,o,r).placeholder}}function Ke(t,e,n,o,r,s,c){const a=t[e],u=n[e];return u?function(t,e,n,o,r,s,c,a){const u=n.length>r;if(u)return Ze(e,t,o),e;const i=tn(t,s,o,c,n,a);return i}(a,u.context,n,o,e,r,s,c):tn(a,r,o,s,n,c)}function tn(t,e,n,o,r,s){const c={value:t,checkValueChange:tt,delete:et,withinOwnerElement:!1};o.added=o.added+1;const u=document.createTextNode("");return c.placeholder=u,s||f.push({element:u,relative:e}),function(t,e,n){const o=t.tagJsType;if(o)switch(o){case a.templater:Qe(t.tag,e,n);break;case a.tag:case a.dom:Qe(t,e,n)}}(t,n,c),en(t,c,n,o,s),c.value=t,r.push({context:c,global:c.global}),s&&p.push({element:u,relative:s}),c}function en(t,e,n,o,r,s){const c=t?.tagJsType;return c?(++e.renderCount,t.processInit(t,e,n,o,r,s)):S(t)?(Ye(e,t,n,o,r),void(e.checkValueChange=Y)):void function(t,e,n){const o=_(t),r=$(o,n);e.simpleValueElm=r,e.checkValueChange=tt}(t,e,e.placeholder)}function nn(t,e){for(let n=0;n<t.length;++n){on(t[n],e[n])}}function on(t,e){let n;t(((...t)=>(n=t,t)),1),e((()=>n),2)}function rn(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){const e=[],r=(...t)=>(e.push(t),t);(0,o[t])(r);let s=0;const c=(...t)=>e[s++];n[t](c)}}function sn(t,e,n,o,r,s){const c=function(t,e,n,o,r,s){const c=T(n);let a;let u=function(t){l.callback&&(t=l.callback(t)),l.hasEmitted=!0,en(t,e,n,{...o},p?s:void 0),p||B.stateConfig.support||h(),u=function(t){Ge(e,t,n),p||B.stateConfig.support||h()}};const i=function(t){a=t;!function(t,e){nn(t.states,e.states)}(c.subject.global.newest,c),l.callback&&(t=l.callback(t)),u(t)},l={hasEmitted:!1,handler:i,getLastValue:()=>a,callback:r,states:c.states};let p=!0;return l.subscription=t.subscribe(i),p=!1,l}(t,e,n,o,r,s);e.delete=()=>{c.subscription.unsubscribe()},e.handler=(t,e,n)=>{if(!c.hasEmitted)return;c.callback=t.callback,c.handler(c.getLastValue());const o=T(n);c.states=o.states}}function cn(t,e,n,o,r){return sn(t.Observable,e,n,o,t.callback,r)}function an(t,e,n,o,r){sn(t,e,n,o,void 0,r)}function un(t){return Jn()?bn((()=>ln(t))):ln(t)}function ln(t){let e=t;const n=new Set;return{tagJsType:a.signal,processInit:an,get value(){return e},set value(t){e!==t&&(e=t,n.forEach((e=>e(t))))},subscribe(t){t(e),n.add(t);const o=()=>n.delete(t);return o.unsubscribe=o,o}}}class pn extends R{value;constructor(t){super(t),this.value=t}subscribe(t){const e=super.subscribe(t);return t(this.value,e),e}}class fn extends R{value;constructor(t){super(t),this.value=t,this._value=t,M(this)}subscribe(t){const e=super.subscribe(t);return t(this._value,e),e}}function dn(t){return(e,n)=>{n.setHandler((()=>{})),t(e,n.next)}}function gn(t){return(e,n)=>{n.setHandler((()=>{}));t(e).then((t=>n.next(t)))}}const hn=t=>(e,n)=>{n.setHandler((()=>{}));const o=t(e).subscribe((t=>{o.unsubscribe(),n.next(t)}))};function bn(t){return B.stateConfig.handlers.handler(t)}const mn=(t,e)=>yn(t,e),vn=t=>t;const yn=(t,e,{init:n,before:o,final:r=vn}={})=>{const s=bn({pastResult:void 0,values:void 0}),c=s.values;if(void 0===c){if(o&&!o(t))return s.values=t,s.pastResult;const a=(n||e)(t,c);return s.pastResult=r(a),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 a=e(t,c);return s.pastResult=r(a),c.length=0,c.push(...t),s.pastResult};function wn(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=bn((()=>Jn())),o=bn((()=>new pn(void 0))),r=bn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),s=(t,s)=>(yn(t,((t,e)=>{const c=Jn(),a=s(t,e);if(c!==n){const t=r.stateArray,e=n.subject.global.oldest;rn(t,e.state,r.states,e.states)}o.next(a)}),e.setup),o);return s.setup=e.setup,wn((()=>s),s),s}}),Object.defineProperty(e,"truthy",{get(){const e=t();return e.setup.before=t=>t.every((t=>t)),e}}),e}function Cn(t){return Jn()?bn((()=>new R(t))):new R(t)}function kn(t){return B.stateConfig.handlers.statesHandler(t)}function Sn(t){const e=un([]),n=un(0),o=un(0);let r=[],s=0;return o.value=n.value,t(((...t)=>(r=t,e.value))),mn(r,(()=>{++s,e.value=r,t((()=>r))})),kn(((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}wn((()=>function(t){const e=(e,n)=>yn(e,n,t);return e.setup=t,wn((()=>e),e),e}({})),mn),Cn._value=t=>{const e=bn((function(){return{stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}})),n=Jn();return bn((function(){return new pn(t).pipe((t=>(rn(n.state,e.stateArray,n.states,e.states),t)))}))},Cn.all=function(t){const e=bn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),n=Jn();return R.all(t).pipe((t=>(rn(n.state,e.stateArray,n.states,e.states),t)))};const Tn={create:t=>{const e=bn((()=>({stateDiff:0,provider:void 0})));if(e.stateDiff){let t=e.stateDiff;for(;t--;)bn(void 0);return bn(void 0)}const n=bn((()=>{const n=B.stateConfig,o=n.stateArray.length,r=t.prototype?new t:t(),s=n.support,c=n.stateArray.length-o,a={constructMethod:t,instance:r,stateDiff:c,owner:s,children:[]};e.provider=a;const u=s.subject.global;return(u.providers=u.providers||[]).push(a),e.stateDiff=c,r})),o=t,r=o.compareTo=o.toString();return e.provider.constructMethod.compareTo=r,n},inject:t=>bn((()=>{const e=t,n=e.compareTo=e.compareTo||t.toString(),o=Jn(),r=[];let s={ownerSupport:o.ownerSupport};for(;s.ownerSupport;){const t=s.ownerSupport.subject.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.subject.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)}))};function jn(t){const e=Jn();if(!e)throw An;return En(e,B.stateConfig,t)}function En(t,e,n){const o=e.states;return function(...e){return t.subject.renderCount>0?function(t,e,n,...o){const r=t.subject.global.newest;nn(r.states,e);const s=n(...o);return nn(e,r.states),Oe(r),w(s)&&s.finally((()=>{nn(e,r.states),Oe(r)})),s}(t,o,n,...e):n(...e)}}const xn=()=>{const t=Jn();if(!t)throw An;const e=B.stateConfig;return function(n){return En(t,e,n)}},An=new se("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){bn(t)}function Pn(t){bn((function(){Jn().subject.global.destroy$.toCallback(t)}))}function Vn(t,e){return{tagJsType:a.subscribe,processInit:cn,Observable:t,callback:e,states:T(Jn()).states}}function Jn(){return B.stateConfig.support}function In(t,e,o,r,s,c){e.checkValueChange=Xt;const a=t;let u=a.templater;u||(u=function(t){const e=Ue();return e.tag=t,t.templater=e,e}(a));const i=n(e);return s?Qt(u,e,o,r,s,c):(i.newest=Fe(u,o,e),e.checkValueChange=Xt,He(o,e,r))}const Wn=":tagvar",Nn=":";function Rn(t,e){const n={values:e,ownerSupport:Jn(),tagJsType:a.tag,processInit:In,strings:t,key:t=>(n.arrayValue=t,n),html:function(t,e){return n.children={strings:t,values:e},n}};return n}function Ln(t,e){const n={values:e,ownerSupport:Jn(),dom:t,tagJsType:a.dom,processInit:In,key:function(t){return n.arrayValue=t,n},html:{dom:function(t,e){return n.children={dom:t,values:e},n}}};return n}const Mn=/(:tagvar\d+:)/,Dn="ondoubleclick",Bn=/([:_a-zA-Z0-9\-.]+)\s*(?:=\s*"([^"]*)"|=\s*(\S+))?/g,$n=/<\/?([a-zA-Z0-9-]+)((?:\s+[a-zA-Z_:*][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)+\s*|\s*)\/?>/g;function _n(t){const e=[],n=[],o=[];let r=null,s=-1,c=0;const a=new RegExp($n,"g");for(t=function(t){return t.replace(Hn,(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);c<t.length;){const u=a.exec(t);if(!u)break;const[i,l,p]=u,f=i.startsWith("</"),d=i.endsWith("/>");if(c<u.index){const e=t.slice(c,u.index);if(e.trim()){Zn(e).forEach((t=>{t.startsWith(Wn)&&(t=Wn+ ++s+Nn),Fn(r,n,t)}))}}if(c=u.index+i.length,f){r=o.pop()||null;continue}const g=[];let h;for(;null!==(h=Bn.exec(p));){const t=h[1]||h[3]||h[5];let n=h[2]||h[4]||h[6];if(void 0===t)continue;const o=""!==h[2],r=void 0===n&&o,c=t.toLowerCase(),a=c.startsWith("on")?Un(c):c;if(r){if(t.slice(0,Wn.length)===Wn){const t=Wn+ ++s+Nn;e.push(["at",t]),g.push([t]);continue}if(h[0].startsWith(t)&&h[0].slice(t.length,h[0].length).search(/\s+$/)>=0){g.push([a]);continue}n=Wn+ ++s+Nn}o||(n=h[2]);const u=[a,n],i=jt(c);i&&u.push(i),g.push(u)}const b={nn:l};g.length&&(b.at=g),r?(r.ch||(r.ch=[]),r.ch.push(b)):n.push(b),d||(o.push(r),r=b)}if(c<t.length){const e=t.slice(c);if(e.trim()){Zn(e).forEach((t=>(t.startsWith(Wn)&&++s,Fn(r,n,t))))}}return n}const Hn=new RegExp("(\x3c!--[\\s\\S]*?--\x3e)","g");function Un(t){if(t.startsWith("on")){return t.length===Dn.length&&t===Dn?"dblclick":t.slice(2,t.length)}return t}function Fn(t,e,n){!function(t,e,n){t?(t.ch||(t.ch=[]),t.ch.push(n)):e.push(n)}(t,e,{nn:"text",tc:zn(n)})}function zn(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 Zn(t){return t.split(Mn).filter((t=>""!==t))}const Gn=/(^:tagvar\d+:|:tagvar\d+:$)/g,Xn="__safeTagVar";function qn(t,e){return function(t,e){const n=t.map(((t,n)=>n<e.length?t+Wn+n+Nn:t));return function(t,e,n){const o=n.length-e.length;if(o>0)for(let n=o;n>0;--n)t.push(Wn+(e.length+n-1)+Nn)}(n,t,e),n}(t.map((t=>t.replace(Gn,((t,e)=>Xn+e)))),e)}const Qn=new RegExp(Wn+"(\\d+)"+Nn,"g"),Yn="ch";function Kn(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=eo(t,e)}if(c.ch){const t=c.ch,o=[...s,Yn];c.ch=Kn(t,e,n,o)}t=to(c,e,r,t)}return r}function to(t,e,n,o){if("text"!==t.nn)return o;const r=t;let c,a=r.tc;if(typeof a!==s.string)return o;for(;null!==(c=Qn.exec(a));){const t=c[1],r=parseInt(t,10);if(!isNaN(r)&&r<e){const t=Wn+r+Nn,e=a.slice(c.index+t.length);n.splice(o,1,{nn:"text",v:r}),a=e,Qn.lastIndex=0}}return r.tc=a,o}function eo(t,e){return t.map((t=>{const[n,o,r]=t;if(n.startsWith(Wn)){const t=parseInt(n.replace(Wn,""),10);if(!isNaN(t)&&t<e)return[{tagJsVar:t}]}if(typeof o===s.string&&o.startsWith(Wn)){const t=parseInt(o.replace(Wn,""),10);if(!isNaN(t)&&t<e)return[n,{tagJsVar:t},r]}return t}))}const no="__safeTagVar";const oo=/__safeTagVar(\d+)/g;function ro(t){if(t.at&&(t.at=t.at?t.at.map((t=>{if(1===t.length)return t;const[,e]=t;if(typeof e===s.string&&e.startsWith(no)){const n=parseInt(e.replace(no,""),10);t[1]=Wn+n+Nn}return t})):[]),t.ch){const e=t.ch;for(let t=0;t<e.length;t++){const n=e[t];if("text"===n.nn){if(typeof n.tc!==s.string)return;n.tc=n.tc.replace(oo,((t,e)=>Wn+e+Nn))}ro(n)}0===e.length&&delete t.ch}}const so={};function co(t,e){const n=function(t){const e=t.map((t=>t.length));return e.push(t.length),Number(e.join(""))}(t),o=so[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=function(t,e){return qn(t,e),_n(qn(t,e).join(""))}(t,e),c=Kn(s,e.length);c.forEach(ro);const a={interpolation:void 0,string:void 0,strings:t,values:e,domMetaMap:c};return so[n]=a,c}function ao(t,...e){const n=Rn(t,e),o=Kt(de.NONE);return o.tag=n,n.templater=o,n}ao.dom=function(t,...e){return Ln(t,e)};const uo=[];function io(t,e,o){const r=uo.findIndex((t=>t.element===e));if(r>=0){const t=uo[r].support;X(t,t.subject.global),uo.splice(r,1),console.warn("Found and destroyed app element already rendered to element",{element:e})}let s=()=>l(o);s.propWatch=de.NONE,s.tagJsType=a.stateRender,s.props=[o],s.isApp=!0;const u=function(t,e){const o={value:t,checkValueChange:Xt,delete:qt,withinOwnerElement:!1,renderCount:0,global:void 0},r=n(o);return r.events={},lo(t,o,e),o}(s,e),i=u.global;x(i.newest,B.stateConfig);let l=t(o);const p=typeof l==c.function;p||(v(l)?(i.newest.propsConfig={latest:[o],castProps:[o]},s.propWatch=l.propWatch,s.tagJsType=l.tagJsType,s.wrapper=l.wrapper,s=l):(s.tag=l,l=t));const f=document.createTextNode("");te.push(s.wrapper||{original:s});const d=po(s,f,e,u,p);if(i.isApp=!0,p&&(l.tag=d.templater.tag),!e)throw new Error(`Cannot tagElement, element received is type ${typeof e} and not type Element`);e.destroy=function(){const t=i.events;for(const n in t){const o=t[n];e.removeEventListener(n,o)}i.events={},++g.locks;const n=X(d,i);return--g.locks,h(),n},++g.locks;const b=function(t,e,n,o,r,s){const c=$t(t,{added:0,removed:0},e,void 0);n.oldest=t,n.newest=t;let u=o.setUse;if(o.tagJsType!==a.stateRender){const t=r.original;u=t.setUse,t.isApp=!0}e.setUse=u,e.ValueTypes=a,uo.push({element:e,support:t});const i=document.createDocumentFragment();i.appendChild(s);for(const t of c.dom)fo(t,i);for(const t of c.subs)ot(t);return i}(d,e,i,s,t,f);return--g.locks,h(),e.appendChild(b),{support:d,tags:te,ValueTypes:a}}function lo(t,e,n){const o=e.global,r=De(t,e);return Be(t,r,r),r.appElement=n,o.oldest=o.oldest||r,o.newest=r,r}function po(t,e,n,o,r){o.placeholder=e;const s=o.global,c=s.oldest,u=s.newest===c,i=_e(t,s.newest,s.newest.appSupport,o);if(u||A(0,s.newest,B.stateConfig,c.state,c.states),t.tagJsType===a.stateRender)return function(t,e,n,o,r){const s=t.wrapper||{original:t};if(!e){const e=lo(t,o,r);return ue(e),e}return Zt(t,s,n),ue(n),n}(t,r,i,o,n);const l=(0,t.wrapper)(i,o);return ue(i),l}function fo(t,e){t.domElement&&e.appendChild(t.domElement),t.marker&&e.appendChild(t.marker)}const go={tagElement:io,renderWithSupport:Se,renderSupport:Oe,renderTagOnly:ie,paint:h};var ho=e.W9,bo=e.cg,mo=e.m0,vo=e.rS,yo=e.Y2,wo=e.ei,Co=e.B7,ko=e.TU,So=e.XF,To=e.PC,jo=e.Ot,Eo=e.Mj,xo=e.tD,Ao=e.j8,Oo=e.um,Po=e.E2,Vo=e.OH,Jo=e.TB,Io=e.Ii,Wo=e.yV,No=e.zV,Ro=e.ze,Lo=e.WJ,Mo=e.Ng,Do=e.VI,Bo=e.aZ,$o=e.O,_o=e.Ie,Ho=e.B4,Uo=e.Az,Fo=e.Xi,zo=e.pc,Zo=e.Ah,Go=e.ck,Xo=e.k6,qo=e.Gk,Qo=e.zC,Yo=e.cF,Ko=e.jU,tr=e.PB,er=e.qy,nr=e.cy,or=e.Tn,rr=e.Gv,sr=e.yL,cr=e.D8,ar=e.Ze,ur=e._4,ir=e.mn,lr=e.z,pr=e.sA,fr=e.MG,dr=e.PL,gr=e.nI,hr=e.PZ,br=e.N_,mr=e.r5,vr=e.uc,yr=e.pG,wr=e.QB,Cr=e.R6,kr=e.Ll,Sr=e.vP,Tr=e.wk,jr=e.xP,Er=e.bc,xr=e.B1,Ar=e.ag,Or=e.Tc,Pr=e.Hf,Vr=e._A,Jr=e.Ag,Ir=e.NU,Wr=e.hW,Nr=e.wB,Rr=e.id,Lr=e.MC,Mr=e.SZ;export{ho as ArrayNoKeyError,bo as BasicTypes,mo as ImmutableTypes,vo as PropWatches,yo as RouteQuery,wo as StateMismatchError,Co as Subject,ko as Subjective,So as SyncCallbackError,To as TagError,jo as ValueSubject,Eo as ValueSubjective,xo as ValueTypes,Ao as addOneContext,Oo as buildBeforeElement,Po as callback,Vo as callbackMaker,Jo as checkArrayValueChange,Io as checkSimpleValueChange,Wo as checkTagValueChange,No as combineLatest,Ro as createTrigger,Lo as defineValueOn,Mo as deleteSimpleValue,Do as destorySupportByContextItem,Bo as destroyArray,$o as destroySupport,_o as empty,Ho as getBaseSupport,Uo as getDomMeta,Fo as getDomTag,zo as getHtmlSupport,Zo as getNewGlobal,Go as getStringTag,Xo as getSupport,qo as getTemplaterResult,Qo as hasPropChanges,Yo as hmr,Ko as howToSetFirstInputValue,tr as howToSetInputValue,er as html,nr as isArray,or as isFunction,rr as isObject,sr as isPromise,cr as isSimpleType,ar as isStaticTag,ur as isSubjectInstance,ir as isTagComponent,lr as letProp,pr as onDestroy,fr as onInit,dr as oneRenderToSupport,gr as paint,hr as processFirstSubjectValue,br as processSubUpdate,mr as providers,vr as renderSupport,yr as renderTagOnly,wr as renderWithSupport,Cr as runWrapper,kr as setUseMemory,Sr as signal,Tr as state,jr as states,Er as subject,xr as subscribe,Ar as syncError,Or as tag,Pr as tagElement,Vr as tags,Jr as upgradeBaseToSupport,Ir as variablePrefix,Wr as variableSuffix,Nr as watch,Rr as willCallback,Lr as willPromise,Mr as willSubscribe};
2
2
  //# sourceMappingURL=bundle.js.map