@ryupold/vode 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vode.js CHANGED
@@ -331,7 +331,7 @@ var V = (() => {
331
331
  function renderDom(isAsync) {
332
332
  const sw = Date.now();
333
333
  const vom = dom(_vode.state);
334
- _vode.vode = render(_vode.state, container.parentElement, 0, _vode.vode, vom);
334
+ _vode.vode = render(_vode.state, container.parentElement, 0, 0, _vode.vode, vom);
335
335
  if (container.tagName.toUpperCase() !== vom[0].toUpperCase()) {
336
336
  container = _vode.vode.node;
337
337
  container._vode = _vode;
@@ -383,10 +383,12 @@ var V = (() => {
383
383
  _vode.state = patchableState;
384
384
  const root = container;
385
385
  root._vode = _vode;
386
+ const indexInParent = Array.from(container.parentElement.children).indexOf(container);
386
387
  _vode.vode = render(
387
388
  state,
388
389
  container.parentElement,
389
- Array.from(container.parentElement.children).indexOf(container),
390
+ indexInParent,
391
+ indexInParent,
390
392
  hydrate(container, true),
391
393
  dom(state)
392
394
  );
@@ -536,7 +538,7 @@ var V = (() => {
536
538
  }
537
539
  return target;
538
540
  }
539
- function render(state, parent, childIndex, oldVode, newVode, xmlns) {
541
+ function render(state, parent, childIndex, indexInParent, oldVode, newVode, xmlns) {
540
542
  try {
541
543
  newVode = remember(state, newVode, oldVode);
542
544
  const isNoVode = !newVode || typeof newVode === "number" || typeof newVode === "boolean";
@@ -572,9 +574,16 @@ var V = (() => {
572
574
  oldNode.onUnmount && state.patch(oldNode.onUnmount(oldNode));
573
575
  oldNode.replaceWith(text);
574
576
  } else {
575
- if (parent.childNodes[childIndex]) {
576
- parent.insertBefore(text, parent.childNodes[childIndex]);
577
- } else {
577
+ let inserted = false;
578
+ for (let i = 0; i < parent.childNodes.length; i++) {
579
+ const nextSibling = parent.childNodes[indexInParent + i];
580
+ if (nextSibling) {
581
+ nextSibling.before(text, nextSibling);
582
+ inserted = true;
583
+ break;
584
+ }
585
+ }
586
+ if (!inserted) {
578
587
  parent.appendChild(text);
579
588
  }
580
589
  }
@@ -598,19 +607,28 @@ var V = (() => {
598
607
  oldNode.onUnmount && state.patch(oldNode.onUnmount(oldNode));
599
608
  oldNode.replaceWith(newNode);
600
609
  } else {
601
- if (parent.childNodes[childIndex]) {
602
- parent.insertBefore(newNode, parent.childNodes[childIndex]);
603
- } else {
610
+ let inserted = false;
611
+ for (let i = 0; i < parent.childNodes.length; i++) {
612
+ const nextSibling = parent.childNodes[indexInParent + i];
613
+ if (nextSibling) {
614
+ nextSibling.before(newNode, nextSibling);
615
+ inserted = true;
616
+ break;
617
+ }
618
+ }
619
+ if (!inserted) {
604
620
  parent.appendChild(newNode);
605
621
  }
606
622
  }
607
623
  const newKids = children(newVode);
608
624
  if (newKids) {
609
625
  const childOffset = !!properties ? 2 : 1;
626
+ let indexP = 0;
610
627
  for (let i = 0; i < newKids.length; i++) {
611
628
  const child2 = newKids[i];
612
- const attached = render(state, newNode, i, void 0, child2, xmlns);
629
+ const attached = render(state, newNode, i, indexP, void 0, child2, xmlns);
613
630
  newVode[i + childOffset] = attached;
631
+ if (attached) indexP++;
614
632
  }
615
633
  }
616
634
  newNode.onMount && state.patch(newNode.onMount(newNode));
@@ -640,19 +658,19 @@ var V = (() => {
640
658
  const oldKids = children(oldVode);
641
659
  if (newKids) {
642
660
  const childOffset = !!properties ? 2 : 1;
661
+ let indexP = 0;
643
662
  for (let i = 0; i < newKids.length; i++) {
644
663
  const child2 = newKids[i];
645
664
  const oldChild = oldKids && oldKids[i];
646
- const attached = render(state, oldNode, i, oldChild, child2, xmlns);
647
- if (attached) {
648
- newVode[i + childOffset] = attached;
649
- }
665
+ const attached = render(state, oldNode, i, indexP, oldChild, child2, xmlns);
666
+ newVode[i + childOffset] = attached;
667
+ if (attached) indexP++;
650
668
  }
651
669
  }
652
670
  if (oldKids) {
653
671
  const newKidsCount = newKids ? newKids.length : 0;
654
672
  for (let i = oldKids.length - 1; i >= newKidsCount; i--) {
655
- render(state, oldNode, i, oldKids[i], void 0, xmlns);
673
+ render(state, oldNode, i, i, oldKids[i], void 0, xmlns);
656
674
  }
657
675
  }
658
676
  return newVode;
@@ -665,6 +683,7 @@ var V = (() => {
665
683
  state,
666
684
  parent,
667
685
  childIndex,
686
+ indexInParent,
668
687
  hydrate(newVode?.node || oldVode?.node, true),
669
688
  handledVode,
670
689
  xmlns
package/dist/vode.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var V=(()=>{var R=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var B=(e,n)=>{for(var s in n)R(e,s,{get:n[s],enumerable:!0})},_=(e,n,s,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of G(n))!K.call(e,t)&&t!==s&&R(e,t,{get:()=>n[t],enumerable:!(o=U(n,t))||o.enumerable});return e};var q=e=>_(R({},"__esModule",{value:!0}),e);var Xo={};B(Xo,{A:()=>nt,ABBR:()=>ot,ADDRESS:()=>st,ANIMATE:()=>rn,ANIMATEMOTION:()=>cn,ANIMATETRANSFORM:()=>pn,ANNOTATION:()=>So,ANNOTATION_XML:()=>uo,AREA:()=>at,ARTICLE:()=>rt,ASIDE:()=>ct,AUDIO:()=>it,B:()=>pt,BASE:()=>lt,BDI:()=>ft,BDO:()=>St,BLOCKQUOTE:()=>dt,BODY:()=>ut,BR:()=>Tt,BUTTON:()=>yt,CANVAS:()=>gt,CAPTION:()=>xt,CIRCLE:()=>ln,CITE:()=>ht,CLIPPATH:()=>fn,CODE:()=>mt,COL:()=>Et,COLGROUP:()=>bt,DATA:()=>Pt,DATALIST:()=>At,DD:()=>Ct,DEFS:()=>Sn,DEL:()=>Mt,DESC:()=>dn,DETAILS:()=>Nt,DFN:()=>Rt,DIALOG:()=>Ot,DIV:()=>Dt,DL:()=>vt,DT:()=>Lt,DelegateStateContext:()=>L,ELLIPSE:()=>un,EM:()=>It,EMBED:()=>Vt,FEBLEND:()=>Tn,FECOLORMATRIX:()=>yn,FECOMPONENTTRANSFER:()=>gn,FECOMPOSITE:()=>xn,FECONVOLVEMATRIX:()=>hn,FEDIFFUSELIGHTING:()=>mn,FEDISPLACEMENTMAP:()=>En,FEDISTANTLIGHT:()=>bn,FEDROPSHADOW:()=>Pn,FEFLOOD:()=>An,FEFUNCA:()=>Cn,FEFUNCB:()=>Mn,FEFUNCG:()=>Nn,FEFUNCR:()=>Rn,FEGAUSSIANBLUR:()=>On,FEIMAGE:()=>Dn,FEMERGE:()=>vn,FEMERGENODE:()=>Ln,FEMORPHOLOGY:()=>In,FEOFFSET:()=>Vn,FEPOINTLIGHT:()=>Fn,FESPECULARLIGHTING:()=>kn,FESPOTLIGHT:()=>jn,FETILE:()=>Hn,FETURBULENCE:()=>Un,FIELDSET:()=>Ft,FIGCAPTION:()=>kt,FIGURE:()=>jt,FILTER:()=>Gn,FOOTER:()=>Ht,FOREIGNOBJECT:()=>Kn,FORM:()=>Ut,G:()=>Bn,H1:()=>Gt,H2:()=>Kt,H3:()=>Bt,H4:()=>_t,H5:()=>qt,H6:()=>Xt,HEAD:()=>$t,HEADER:()=>wt,HGROUP:()=>Yt,HR:()=>Wt,HTML:()=>Jt,I:()=>Qt,IFRAME:()=>zt,IMAGE:()=>_n,IMG:()=>Zt,INPUT:()=>te,INS:()=>ee,KBD:()=>ne,KeyStateContext:()=>v,LABEL:()=>oe,LEGEND:()=>se,LI:()=>ae,LINE:()=>qn,LINEARGRADIENT:()=>Xn,LINK:()=>re,MACTION:()=>To,MAIN:()=>ce,MAP:()=>ie,MARK:()=>pe,MARKER:()=>$n,MASK:()=>wn,MATH:()=>yo,MENU:()=>le,MERROR:()=>go,META:()=>fe,METADATA:()=>Yn,METER:()=>Se,MFRAC:()=>xo,MI:()=>ho,MMULTISCRIPTS:()=>mo,MN:()=>Eo,MO:()=>bo,MOVER:()=>Po,MPADDED:()=>Ao,MPATH:()=>Wn,MPHANTOM:()=>Co,MPRESCRIPTS:()=>Mo,MROOT:()=>No,MROW:()=>Ro,MS:()=>Oo,MSPACE:()=>Do,MSQRT:()=>vo,MSTYLE:()=>Lo,MSUB:()=>Io,MSUBSUP:()=>Vo,MSUP:()=>Fo,MTABLE:()=>ko,MTD:()=>jo,MTEXT:()=>Ho,MTR:()=>Uo,MUNDER:()=>Go,MUNDEROVER:()=>Ko,NAV:()=>de,NOSCRIPT:()=>ue,OBJECT:()=>Te,OL:()=>ye,OPTGROUP:()=>ge,OPTION:()=>xe,OUTPUT:()=>he,P:()=>me,PATH:()=>Jn,PATTERN:()=>Qn,PICTURE:()=>Ee,POLYGON:()=>zn,POLYLINE:()=>Zn,PRE:()=>be,PROGRESS:()=>Pe,Q:()=>Ae,RADIALGRADIENT:()=>to,RECT:()=>eo,RP:()=>Ce,RT:()=>Me,RUBY:()=>Ne,S:()=>Re,SAMP:()=>Oe,SCRIPT:()=>De,SEARCH:()=>ve,SECTION:()=>Le,SELECT:()=>Ie,SEMANTICS:()=>Bo,SET:()=>no,SLOT:()=>Ve,SMALL:()=>Fe,SOURCE:()=>ke,SPAN:()=>je,STOP:()=>oo,STRONG:()=>He,STYLE:()=>Ue,SUB:()=>Ge,SUMMARY:()=>Ke,SUP:()=>Be,SVG:()=>so,SWITCH:()=>ao,SYMBOL:()=>ro,TABLE:()=>_e,TBODY:()=>qe,TD:()=>Xe,TEMPLATE:()=>$e,TEXT:()=>co,TEXTAREA:()=>we,TEXTPATH:()=>io,TFOOT:()=>Ye,TH:()=>We,THEAD:()=>Je,TIME:()=>Qe,TITLE:()=>ze,TR:()=>Ze,TRACK:()=>tn,TSPAN:()=>po,U:()=>en,UL:()=>nn,USE:()=>lo,VAR:()=>on,VIDEO:()=>sn,VIEW:()=>fo,WBR:()=>an,app:()=>$,child:()=>Z,childCount:()=>z,children:()=>A,childrenStart:()=>N,createPatch:()=>J,createState:()=>W,defuse:()=>w,globals:()=>m,hydrate:()=>M,memo:()=>Y,mergeClass:()=>_o,mergeStyle:()=>qo,props:()=>E,tag:()=>Q,vode:()=>X});var m={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function X(e,n,...s){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...s]:[e,...s]}function $(e,n,s,...o){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof s!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=m.requestAnimationFrame,t.asyncRenderer=m.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let a=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,u)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{a.patch(S.value,u),S=await l.next()}finally{t.stats.liveEffectCount--}}a.patch(S.value,u)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;a.patch(l,u)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)a.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{m.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?a.patch(p(t.state),u):u?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let u=Date.now(),l=s(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-u,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await m.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,m.currentViewTransition=t.asyncRenderer(i),await m.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=a;let b=e;b._vode=t,t.vode=P(n,e.parentElement,Array.from(e.parentElement.children).indexOf(e),M(e,!0),s(n));for(let p of o)a.patch(p);return p=>a.patch(p)}function w(e){if(e?._vode){let s=function(t){if(!t?.node)return;let a=E(t);if(a){for(let c in a)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=A(t);if(r)for(let c of r)s(c)};var n=s;let o=e._vode;delete e._vode,Object.defineProperty(o.state,"patch",{value:void 0}),Object.defineProperty(o,"renderSync",{value:()=>{}}),Object.defineProperty(o,"renderAsync",{value:()=>{}}),s(o.vode)}}function M(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let o=[e.tagName.toLowerCase()];if(n&&(o.node=e),e?.hasAttributes()){let t={},a=e.attributes;for(let r of a)t[r.name]=r.value;o.push(t)}if(e.hasChildNodes()){let t=[];for(let a of e.childNodes){let r=a&&M(a,n);r?o.push(r):a&&n&&t.push(a)}for(let a of t)a.remove()}return o}else return}function Y(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function W(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function J(e){return e}function Q(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function E(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function A(e){let n=N(e);return n>0?e.slice(n):null}function z(e){let n=N(e);return n<0?0:e.length-n}function Z(e,n){let s=N(e);if(s>0)return e[n+s]}function N(e){return E(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,n,s){if(!n)return e;for(let o in n){let t=n[o];if(t&&typeof t=="object"){let a=e[o];a?Array.isArray(t)?e[o]=[...t]:t instanceof Date&&a!==t?e[o]=new Date(t):Array.isArray(a)?e[o]=y({},t,s):typeof a=="object"?y(e[o],t,s):e[o]=y({},t,s):Array.isArray(t)?e[o]=[...t]:t instanceof Date?e[o]=new Date(t):e[o]=y({},t,s)}else t===void 0&&s?delete e[o]:e[o]=t}return e}function P(e,n,s,o,t,a){try{t=O(e,t,o);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===o||!o&&r)return o;let c=o?.nodeType===Node.TEXT_NODE,i=c?o:o?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!r&&et(t),p=!r&&tt(t),u=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!u&&!o)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(u&&b?t=t.wholeText:u&&p&&(t=[...t]),c&&b)return i.nodeValue!==t&&(i.nodeValue=t),o;if(b&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):n.childNodes[s]?n.insertBefore(l,n.childNodes[s]):n.appendChild(l),l}if(p&&(!i||c||o[0]!==t[0])){let l=t;1 in l&&(l[1]=O(e,l[1],void 0));let S=E(t);S?.xmlns!==void 0&&(a=S.xmlns);let f=a?document.createElementNS(a,t[0]):document.createElement(t[0]);t.node=f,D(e,f,void 0,S,a),S&&"catch"in S&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(f)):n.childNodes[s]?n.insertBefore(f,n.childNodes[s]):n.appendChild(f);let g=A(t);if(g){let x=S?2:1;for(let T=0;T<g.length;T++){let h=g[T],d=P(e,f,T,void 0,h,a);t[T+x]=d}}return f.onMount&&e.patch(f.onMount(f)),t}if(!c&&p&&o[0]===t[0]){t.node=i;let l=t,S=o,f=E(t),g=E(o);if(f?.xmlns!==void 0&&(a=f.xmlns),l[1]?.__memo){let h=l[1];l[1]=O(e,l[1],S[1]),h!==l[1]&&D(e,i,g,f,a)}else D(e,i,g,f,a);f?.catch&&g?.catch!==f.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let x=A(t),T=A(o);if(x){let h=f?2:1;for(let d=0;d<x.length;d++){let j=x[d],H=T&&T[d],I=P(e,i,d,H,j,a);I&&(t[d+h]=I)}}if(T){let h=x?x.length:0;for(let d=T.length-1;d>=h;d--)P(e,i,d,T[d],void 0,a)}return t}}catch(r){let c=E(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,n,s,M(t?.node||o?.node,!0),i,a)}else throw r}}function tt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function et(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function O(e,n,s){if(typeof n!="function")return n;let o=n?.__memo,t=s?.__memo;if(Array.isArray(o)&&Array.isArray(t)&&o.length===t.length){let r=!0;for(let c=0;c<o.length;c++)if(o[c]!==t[c]){r=!1;break}if(r)return s}let a=V(n,e);return typeof a=="object"&&(a.__memo=n?.__memo),a}function V(e,n){return typeof e=="function"?V(e(n),n):e}function D(e,n,s,o,t){if(!o&&!s)return;let a=t!==void 0;if(s)for(let r in s){let c=s[r],i=o?.[r];c!==i&&(o?o[r]=C(e,n,r,c,i,a):C(e,n,r,c,void 0,a))}if(o&&s){for(let r in o)if(!(r in s)){let c=o[r];o[r]=C(e,n,r,void 0,c,a)}}else if(o)for(let r in o){let c=o[r];o[r]=C(e,n,r,void 0,c,a)}}function C(e,n,s,o,t,a){if(s==="style")if(!t)n.style.cssText="";else if(typeof t=="string")o!==t&&(n.style.cssText=t);else if(o&&typeof o=="object"){for(let r in o)t[r]||(n.style[r]=null);for(let r in t){let c=o[r],i=t[r];c!==i&&(n.style[r]=i)}}else for(let r in t)n.style[r]=t[r];else if(s==="class")t?n.setAttribute("class",F(t)):n.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=i=>e.patch(c(e,i))}else typeof t=="object"&&(r=()=>e.patch(t));n[s]=r}else n[s]=null;else a||(n[s]=t),t==null||t===!1?n.removeAttribute(s):n.setAttribute(s,t);return t}function F(e){return typeof e=="string"?e:Array.isArray(e)?e.map(F).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var nt="a",ot="abbr",st="address",at="area",rt="article",ct="aside",it="audio",pt="b",lt="base",ft="bdi",St="bdo",dt="blockquote",ut="body",Tt="br",yt="button",gt="canvas",xt="caption",ht="cite",mt="code",Et="col",bt="colgroup",Pt="data",At="datalist",Ct="dd",Mt="del",Nt="details",Rt="dfn",Ot="dialog",Dt="div",vt="dl",Lt="dt",It="em",Vt="embed",Ft="fieldset",kt="figcaption",jt="figure",Ht="footer",Ut="form",Gt="h1",Kt="h2",Bt="h3",_t="h4",qt="h5",Xt="h6",$t="head",wt="header",Yt="hgroup",Wt="hr",Jt="html",Qt="i",zt="iframe",Zt="img",te="input",ee="ins",ne="kbd",oe="label",se="legend",ae="li",re="link",ce="main",ie="map",pe="mark",le="menu",fe="meta",Se="meter",de="nav",ue="noscript",Te="object",ye="ol",ge="optgroup",xe="option",he="output",me="p",Ee="picture",be="pre",Pe="progress",Ae="q",Ce="rp",Me="rt",Ne="ruby",Re="s",Oe="samp",De="script",ve="search",Le="section",Ie="select",Ve="slot",Fe="small",ke="source",je="span",He="strong",Ue="style",Ge="sub",Ke="summary",Be="sup",_e="table",qe="tbody",Xe="td",$e="template",we="textarea",Ye="tfoot",We="th",Je="thead",Qe="time",ze="title",Ze="tr",tn="track",en="u",nn="ul",on="var",sn="video",an="wbr",rn="animate",cn="animateMotion",pn="animateTransform",ln="circle",fn="clipPath",Sn="defs",dn="desc",un="ellipse",Tn="feBlend",yn="feColorMatrix",gn="feComponentTransfer",xn="feComposite",hn="feConvolveMatrix",mn="feDiffuseLighting",En="feDisplacementMap",bn="feDistantLight",Pn="feDropShadow",An="feFlood",Cn="feFuncA",Mn="feFuncB",Nn="feFuncG",Rn="feFuncR",On="feGaussianBlur",Dn="feImage",vn="feMerge",Ln="feMergeNode",In="feMorphology",Vn="feOffset",Fn="fePointLight",kn="feSpecularLighting",jn="feSpotLight",Hn="feTile",Un="feTurbulence",Gn="filter",Kn="foreignObject",Bn="g",_n="image",qn="line",Xn="linearGradient",$n="marker",wn="mask",Yn="metadata",Wn="mpath",Jn="path",Qn="pattern",zn="polygon",Zn="polyline",to="radialGradient",eo="rect",no="set",oo="stop",so="svg",ao="switch",ro="symbol",co="text",io="textPath",po="tspan",lo="use",fo="view",So="annotation",uo="annotation-xml",To="maction",yo="math",go="merror",xo="mfrac",ho="mi",mo="mmultiscripts",Eo="mn",bo="mo",Po="mover",Ao="mpadded",Co="mphantom",Mo="mprescripts",No="mroot",Ro="mrow",Oo="ms",Do="mspace",vo="msqrt",Lo="mstyle",Io="msub",Vo="msubsup",Fo="msup",ko="mtable",jo="mtd",Ho="mtext",Uo="mtr",Go="munder",Ko="munderover",Bo="semantics";function _o(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let s=1;s<e.length;s++){let o=n,t=e[s];if(!o)n=t;else if(t)if(typeof o=="string"&&typeof t=="string"){let a=o.split(" "),r=t.split(" "),c=new Set([...a,...r]);n=Array.from(c).join(" ").trim()}else if(typeof o=="string"&&Array.isArray(t)){let a=new Set([...t,...o.split(" ")]);n=Array.from(a).join(" ").trim()}else if(Array.isArray(o)&&typeof t=="string"){let a=new Set([...o,...t.split(" ")]);n=Array.from(a).join(" ").trim()}else if(Array.isArray(o)&&Array.isArray(t)){let a=new Set([...o,...t]);n=Array.from(a).join(" ").trim()}else if(typeof o=="string"&&typeof t=="object")n={[o]:!0,...t};else if(typeof o=="object"&&typeof t=="string")n={...o,[t]:!0};else if(typeof o=="object"&&typeof t=="object")n={...o,...t};else if(typeof o=="object"&&Array.isArray(t)){let a={...o};for(let r of t)a[r]=!0;n=a}else if(Array.isArray(o)&&typeof t=="object"){let a={};for(let r of o)a[r]=!0;for(let r of Object.keys(t))a[r]=t[r];n=a}else throw new Error(`cannot merge classes of ${o} (${typeof o}) and ${t} (${typeof t})`);else continue}return n}var k=document.createElement("div");function qo(...e){try{let n=k.style;for(let s of e)if(typeof s=="object"&&s!==null)for(let o in s)n[o]=s[o];else typeof s=="string"&&(n.cssText+=";"+s);return n.cssText}finally{k.style.cssText=""}}var v=class{constructor(n,s){this.state=n;this.path=s;this.keys=s.split(".")}keys;get(){let n=this.keys,s=this.state?this.state[n[0]]:void 0;for(let o=1;o<n.length&&s;o++)s=s[n[o]];return s}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let s=[];for(let o of n)s.push(this.createPatch(o));this.state.patch(s)}else this.state.patch(this.createPatch(n))}createPatch(n){let s={};return this.putDeep(n,s),s}putDeep(n,s){let o=this.keys;if(o.length>1){let t=0,a=s[o[t]];for((typeof a!="object"||a===null)&&(s[o[t]]=a={}),t=1;t<o.length-1;t++){let r=a;a=a[o[t]],(typeof a!="object"||a===null)&&(r[o[t]]=a={})}a[o[t]]=n}else typeof s[o[0]]=="object"&&typeof n=="object"?Object.assign(s[o[0]],n):s[o[0]]=n}},L=class{constructor(n,s,o,t){this.state=n;this.get=s;this.put=o;this.patch=t}};return q(Xo);})();
1
+ "use strict";var V=(()=>{var D=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var q=(e,n)=>{for(var a in n)D(e,a,{get:n[a],enumerable:!0})},X=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!_.call(e,t)&&t!==a&&D(e,t,{get:()=>n[t],enumerable:!(s=K(n,t))||s.enumerable});return e};var $=e=>X(D({},"__esModule",{value:!0}),e);var wo={};q(wo,{A:()=>st,ABBR:()=>at,ADDRESS:()=>rt,ANIMATE:()=>pn,ANIMATEMOTION:()=>ln,ANIMATETRANSFORM:()=>dn,ANNOTATION:()=>To,ANNOTATION_XML:()=>yo,AREA:()=>ct,ARTICLE:()=>it,ASIDE:()=>pt,AUDIO:()=>lt,B:()=>dt,BASE:()=>ft,BDI:()=>St,BDO:()=>ut,BLOCKQUOTE:()=>Tt,BODY:()=>yt,BR:()=>gt,BUTTON:()=>xt,CANVAS:()=>ht,CAPTION:()=>mt,CIRCLE:()=>fn,CITE:()=>Et,CLIPPATH:()=>Sn,CODE:()=>bt,COL:()=>Pt,COLGROUP:()=>At,DATA:()=>Ct,DATALIST:()=>Mt,DD:()=>Nt,DEFS:()=>un,DEL:()=>Rt,DESC:()=>Tn,DETAILS:()=>Ot,DFN:()=>Dt,DIALOG:()=>vt,DIV:()=>Lt,DL:()=>It,DT:()=>Vt,DelegateStateContext:()=>V,ELLIPSE:()=>yn,EM:()=>Ft,EMBED:()=>kt,FEBLEND:()=>gn,FECOLORMATRIX:()=>xn,FECOMPONENTTRANSFER:()=>hn,FECOMPOSITE:()=>mn,FECONVOLVEMATRIX:()=>En,FEDIFFUSELIGHTING:()=>bn,FEDISPLACEMENTMAP:()=>Pn,FEDISTANTLIGHT:()=>An,FEDROPSHADOW:()=>Cn,FEFLOOD:()=>Mn,FEFUNCA:()=>Nn,FEFUNCB:()=>Rn,FEFUNCG:()=>On,FEFUNCR:()=>Dn,FEGAUSSIANBLUR:()=>vn,FEIMAGE:()=>Ln,FEMERGE:()=>In,FEMERGENODE:()=>Vn,FEMORPHOLOGY:()=>Fn,FEOFFSET:()=>kn,FEPOINTLIGHT:()=>jn,FESPECULARLIGHTING:()=>Hn,FESPOTLIGHT:()=>Un,FETILE:()=>Gn,FETURBULENCE:()=>Kn,FIELDSET:()=>jt,FIGCAPTION:()=>Ht,FIGURE:()=>Ut,FILTER:()=>Bn,FOOTER:()=>Gt,FOREIGNOBJECT:()=>_n,FORM:()=>Kt,G:()=>qn,H1:()=>Bt,H2:()=>_t,H3:()=>qt,H4:()=>Xt,H5:()=>$t,H6:()=>wt,HEAD:()=>Yt,HEADER:()=>Wt,HGROUP:()=>Jt,HR:()=>Qt,HTML:()=>zt,I:()=>Zt,IFRAME:()=>te,IMAGE:()=>Xn,IMG:()=>ee,INPUT:()=>ne,INS:()=>oe,KBD:()=>se,KeyStateContext:()=>I,LABEL:()=>ae,LEGEND:()=>re,LI:()=>ce,LINE:()=>$n,LINEARGRADIENT:()=>wn,LINK:()=>ie,MACTION:()=>go,MAIN:()=>pe,MAP:()=>le,MARK:()=>de,MARKER:()=>Yn,MASK:()=>Wn,MATH:()=>xo,MENU:()=>fe,MERROR:()=>ho,META:()=>Se,METADATA:()=>Jn,METER:()=>ue,MFRAC:()=>mo,MI:()=>Eo,MMULTISCRIPTS:()=>bo,MN:()=>Po,MO:()=>Ao,MOVER:()=>Co,MPADDED:()=>Mo,MPATH:()=>Qn,MPHANTOM:()=>No,MPRESCRIPTS:()=>Ro,MROOT:()=>Oo,MROW:()=>Do,MS:()=>vo,MSPACE:()=>Lo,MSQRT:()=>Io,MSTYLE:()=>Vo,MSUB:()=>Fo,MSUBSUP:()=>ko,MSUP:()=>jo,MTABLE:()=>Ho,MTD:()=>Uo,MTEXT:()=>Go,MTR:()=>Ko,MUNDER:()=>Bo,MUNDEROVER:()=>_o,NAV:()=>Te,NOSCRIPT:()=>ye,OBJECT:()=>ge,OL:()=>xe,OPTGROUP:()=>he,OPTION:()=>me,OUTPUT:()=>Ee,P:()=>be,PATH:()=>zn,PATTERN:()=>Zn,PICTURE:()=>Pe,POLYGON:()=>to,POLYLINE:()=>eo,PRE:()=>Ae,PROGRESS:()=>Ce,Q:()=>Me,RADIALGRADIENT:()=>no,RECT:()=>oo,RP:()=>Ne,RT:()=>Re,RUBY:()=>Oe,S:()=>De,SAMP:()=>ve,SCRIPT:()=>Le,SEARCH:()=>Ie,SECTION:()=>Ve,SELECT:()=>Fe,SEMANTICS:()=>qo,SET:()=>so,SLOT:()=>ke,SMALL:()=>je,SOURCE:()=>He,SPAN:()=>Ue,STOP:()=>ao,STRONG:()=>Ge,STYLE:()=>Ke,SUB:()=>Be,SUMMARY:()=>_e,SUP:()=>qe,SVG:()=>ro,SWITCH:()=>co,SYMBOL:()=>io,TABLE:()=>Xe,TBODY:()=>$e,TD:()=>we,TEMPLATE:()=>Ye,TEXT:()=>po,TEXTAREA:()=>We,TEXTPATH:()=>lo,TFOOT:()=>Je,TH:()=>Qe,THEAD:()=>ze,TIME:()=>Ze,TITLE:()=>tn,TR:()=>en,TRACK:()=>nn,TSPAN:()=>fo,U:()=>on,UL:()=>sn,USE:()=>So,VAR:()=>an,VIDEO:()=>rn,VIEW:()=>uo,WBR:()=>cn,app:()=>Y,child:()=>et,childCount:()=>tt,children:()=>M,childrenStart:()=>O,createPatch:()=>z,createState:()=>Q,defuse:()=>W,globals:()=>P,hydrate:()=>R,memo:()=>J,mergeClass:()=>Xo,mergeStyle:()=>$o,props:()=>A,tag:()=>Z,vode:()=>w});var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function w(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function Y(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let o=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{o.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}o.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;o.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)o.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?o.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=o;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(n,e.parentElement,b,b,R(e,!0),a(n));for(let p of s)o.patch(p);return p=>o.patch(p)}function W(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=A(t);if(o){for(let c in o)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=M(t);if(r)for(let c of r)a(c)};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function R(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&R(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function J(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function Q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function z(e){return e}function Z(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=O(e);return n>0?e.slice(n):null}function tt(e){let n=O(e);return n<0?0:e.length-n}function et(e,n){let a=O(e);if(a>0)return e[n+a]}function O(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=E({},t,a):typeof o=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){try{o=v(e,o,t);let c=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&ot(o),p=!c&&nt(o),y=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(y&&b?o=o.wholeText:y&&p&&(o=[...o]),f&&b)return i.nodeValue!==o&&(i.nodeValue=o),t;if(b&&(!i||!f)){let l=document.createTextNode(o);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=0;d<n.childNodes.length;d++){let g=n.childNodes[s+d];if(g){g.before(l,g),S=!0;break}}S||n.appendChild(l)}return l}if(p&&(!i||f||t[0]!==o[0])){let l=o;1 in l&&(l[1]=v(e,l[1],void 0));let S=A(o);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,o[0]):document.createElement(o[0]);if(o.node=d,L(e,d,void 0,S,r),S&&"catch"in S&&(o.node.catch=null,o.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=0;T<n.childNodes.length;T++){let u=n.childNodes[s+T];if(u){u.before(d,u),x=!0;break}}x||n.appendChild(d)}let g=M(o);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);o[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),o}if(!f&&p&&t[0]===o[0]){o.node=i;let l=o,S=t,d=A(o),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=v(e,l[1],S[1]),u!==l[1]&&L(e,i,g,d,r)}else L(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(o.node.catch=null,o.node.removeAttribute("catch"));let x=M(o),T=M(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let U=x[m],G=T&&T[m],F=C(e,i,m,h,G,U,r);o[m+u]=F,F&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return o}}catch(c){let f=A(o)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,n,a,s,R(o?.node||t?.node,!0),i,r)}else throw c}}function nt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function ot(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function v(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let o=k(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function k(e,n){return typeof e=="function"?k(e(n),n):e}function L(e,n,a,s,t){if(!s&&!a)return;let o=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=N(e,n,r,c,f,o):N(e,n,r,c,void 0,o))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}else if(s)for(let r in s){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}function N(e,n,a,s,t,o){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")s!==t&&(n.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(n.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(n.style[r]=f)}}else for(let r in t)n.style[r]=t[r];else if(a==="class")t?n.setAttribute("class",j(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));n[a]=r}else n[a]=null;else o||(n[a]=t),t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function j(e){return typeof e=="string"?e:Array.isArray(e)?e.map(j).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var st="a",at="abbr",rt="address",ct="area",it="article",pt="aside",lt="audio",dt="b",ft="base",St="bdi",ut="bdo",Tt="blockquote",yt="body",gt="br",xt="button",ht="canvas",mt="caption",Et="cite",bt="code",Pt="col",At="colgroup",Ct="data",Mt="datalist",Nt="dd",Rt="del",Ot="details",Dt="dfn",vt="dialog",Lt="div",It="dl",Vt="dt",Ft="em",kt="embed",jt="fieldset",Ht="figcaption",Ut="figure",Gt="footer",Kt="form",Bt="h1",_t="h2",qt="h3",Xt="h4",$t="h5",wt="h6",Yt="head",Wt="header",Jt="hgroup",Qt="hr",zt="html",Zt="i",te="iframe",ee="img",ne="input",oe="ins",se="kbd",ae="label",re="legend",ce="li",ie="link",pe="main",le="map",de="mark",fe="menu",Se="meta",ue="meter",Te="nav",ye="noscript",ge="object",xe="ol",he="optgroup",me="option",Ee="output",be="p",Pe="picture",Ae="pre",Ce="progress",Me="q",Ne="rp",Re="rt",Oe="ruby",De="s",ve="samp",Le="script",Ie="search",Ve="section",Fe="select",ke="slot",je="small",He="source",Ue="span",Ge="strong",Ke="style",Be="sub",_e="summary",qe="sup",Xe="table",$e="tbody",we="td",Ye="template",We="textarea",Je="tfoot",Qe="th",ze="thead",Ze="time",tn="title",en="tr",nn="track",on="u",sn="ul",an="var",rn="video",cn="wbr",pn="animate",ln="animateMotion",dn="animateTransform",fn="circle",Sn="clipPath",un="defs",Tn="desc",yn="ellipse",gn="feBlend",xn="feColorMatrix",hn="feComponentTransfer",mn="feComposite",En="feConvolveMatrix",bn="feDiffuseLighting",Pn="feDisplacementMap",An="feDistantLight",Cn="feDropShadow",Mn="feFlood",Nn="feFuncA",Rn="feFuncB",On="feFuncG",Dn="feFuncR",vn="feGaussianBlur",Ln="feImage",In="feMerge",Vn="feMergeNode",Fn="feMorphology",kn="feOffset",jn="fePointLight",Hn="feSpecularLighting",Un="feSpotLight",Gn="feTile",Kn="feTurbulence",Bn="filter",_n="foreignObject",qn="g",Xn="image",$n="line",wn="linearGradient",Yn="marker",Wn="mask",Jn="metadata",Qn="mpath",zn="path",Zn="pattern",to="polygon",eo="polyline",no="radialGradient",oo="rect",so="set",ao="stop",ro="svg",co="switch",io="symbol",po="text",lo="textPath",fo="tspan",So="use",uo="view",To="annotation",yo="annotation-xml",go="maction",xo="math",ho="merror",mo="mfrac",Eo="mi",bo="mmultiscripts",Po="mn",Ao="mo",Co="mover",Mo="mpadded",No="mphantom",Ro="mprescripts",Oo="mroot",Do="mrow",vo="ms",Lo="mspace",Io="msqrt",Vo="mstyle",Fo="msub",ko="msubsup",jo="msup",Ho="mtable",Uo="mtd",Go="mtext",Ko="mtr",Bo="munder",_o="munderover",qo="semantics";function Xo(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),c=new Set([...o,...r]);n=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var H=document.createElement("div");function $o(...e){try{let n=H.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)n[s]=a[s];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{H.style.cssText=""}}var I=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},V=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return $(wo);})();
package/dist/vode.min.mjs CHANGED
@@ -1 +1 @@
1
- var E={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function G(e,o,...s){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...s]:[e,...s]}function K(e,o,s,...n){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof s!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=E.requestAnimationFrame,t.asyncRenderer=E.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let a=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,u)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{a.patch(S.value,u),S=await l.next()}finally{t.stats.liveEffectCount--}}a.patch(S.value,u)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;a.patch(l,u)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)a.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{E.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?a.patch(p(t.state),u):u?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let u=Date.now(),l=s(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-u,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await E.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,E.currentViewTransition=t.asyncRenderer(i),await E.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=a;let m=e;m._vode=t,t.vode=P(o,e.parentElement,Array.from(e.parentElement.children).indexOf(e),R(e,!0),s(o));for(let p of n)a.patch(p);return p=>a.patch(p)}function B(e){if(e?._vode){let s=function(t){if(!t?.node)return;let a=b(t);if(a){for(let c in a)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=C(t);if(r)for(let c of r)s(c)};var o=s;let n=e._vode;delete e._vode,Object.defineProperty(n.state,"patch",{value:void 0}),Object.defineProperty(n,"renderSync",{value:()=>{}}),Object.defineProperty(n,"renderAsync",{value:()=>{}}),s(n.vode)}}function R(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let n=[e.tagName.toLowerCase()];if(o&&(n.node=e),e?.hasAttributes()){let t={},a=e.attributes;for(let r of a)t[r.name]=r.value;n.push(t)}if(e.hasChildNodes()){let t=[];for(let a of e.childNodes){let r=a&&R(a,o);r?n.push(r):a&&o&&t.push(a)}for(let a of t)a.remove()}return n}else return}function _(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function X(e){return e}function $(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function b(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function C(e){let o=O(e);return o>0?e.slice(o):null}function w(e){let o=O(e);return o<0?0:e.length-o}function Y(e,o){let s=O(e);if(s>0)return e[o+s]}function O(e){return b(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,o,s){if(!o)return e;for(let n in o){let t=o[n];if(t&&typeof t=="object"){let a=e[n];a?Array.isArray(t)?e[n]=[...t]:t instanceof Date&&a!==t?e[n]=new Date(t):Array.isArray(a)?e[n]=y({},t,s):typeof a=="object"?y(e[n],t,s):e[n]=y({},t,s):Array.isArray(t)?e[n]=[...t]:t instanceof Date?e[n]=new Date(t):e[n]=y({},t,s)}else t===void 0&&s?delete e[n]:e[n]=t}return e}function P(e,o,s,n,t,a){try{t=M(e,t,n);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===n||!n&&r)return n;let c=n?.nodeType===Node.TEXT_NODE,i=c?n:n?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let m=!r&&U(t),p=!r&&H(t),u=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!m&&!p&&!u&&!n)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(u&&m?t=t.wholeText:u&&p&&(t=[...t]),c&&m)return i.nodeValue!==t&&(i.nodeValue=t),n;if(m&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):o.childNodes[s]?o.insertBefore(l,o.childNodes[s]):o.appendChild(l),l}if(p&&(!i||c||n[0]!==t[0])){let l=t;1 in l&&(l[1]=M(e,l[1],void 0));let S=b(t);S?.xmlns!==void 0&&(a=S.xmlns);let f=a?document.createElementNS(a,t[0]):document.createElement(t[0]);t.node=f,N(e,f,void 0,S,a),S&&"catch"in S&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(f)):o.childNodes[s]?o.insertBefore(f,o.childNodes[s]):o.appendChild(f);let g=C(t);if(g){let x=S?2:1;for(let T=0;T<g.length;T++){let h=g[T],d=P(e,f,T,void 0,h,a);t[T+x]=d}}return f.onMount&&e.patch(f.onMount(f)),t}if(!c&&p&&n[0]===t[0]){t.node=i;let l=t,S=n,f=b(t),g=b(n);if(f?.xmlns!==void 0&&(a=f.xmlns),l[1]?.__memo){let h=l[1];l[1]=M(e,l[1],S[1]),h!==l[1]&&N(e,i,g,f,a)}else N(e,i,g,f,a);f?.catch&&g?.catch!==f.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let x=C(t),T=C(n);if(x){let h=f?2:1;for(let d=0;d<x.length;d++){let k=x[d],j=T&&T[d],D=P(e,i,d,j,k,a);D&&(t[d+h]=D)}}if(T){let h=x?x.length:0;for(let d=T.length-1;d>=h;d--)P(e,i,d,T[d],void 0,a)}return t}}catch(r){let c=b(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,o,s,R(t?.node||n?.node,!0),i,a)}else throw r}}function H(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function U(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function M(e,o,s){if(typeof o!="function")return o;let n=o?.__memo,t=s?.__memo;if(Array.isArray(n)&&Array.isArray(t)&&n.length===t.length){let r=!0;for(let c=0;c<n.length;c++)if(n[c]!==t[c]){r=!1;break}if(r)return s}let a=v(o,e);return typeof a=="object"&&(a.__memo=o?.__memo),a}function v(e,o){return typeof e=="function"?v(e(o),o):e}function N(e,o,s,n,t){if(!n&&!s)return;let a=t!==void 0;if(s)for(let r in s){let c=s[r],i=n?.[r];c!==i&&(n?n[r]=A(e,o,r,c,i,a):A(e,o,r,c,void 0,a))}if(n&&s){for(let r in n)if(!(r in s)){let c=n[r];n[r]=A(e,o,r,void 0,c,a)}}else if(n)for(let r in n){let c=n[r];n[r]=A(e,o,r,void 0,c,a)}}function A(e,o,s,n,t,a){if(s==="style")if(!t)o.style.cssText="";else if(typeof t=="string")n!==t&&(o.style.cssText=t);else if(n&&typeof n=="object"){for(let r in n)t[r]||(o.style[r]=null);for(let r in t){let c=n[r],i=t[r];c!==i&&(o.style[r]=i)}}else for(let r in t)o.style[r]=t[r];else if(s==="class")t?o.setAttribute("class",L(t)):o.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=i=>e.patch(c(e,i))}else typeof t=="object"&&(r=()=>e.patch(t));o[s]=r}else o[s]=null;else a||(o[s]=t),t==null||t===!1?o.removeAttribute(s):o.setAttribute(s,t);return t}function L(e){return typeof e=="string"?e:Array.isArray(e)?e.map(L).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var J="a",Q="abbr",z="address",Z="area",tt="article",et="aside",nt="audio",ot="b",st="base",at="bdi",rt="bdo",ct="blockquote",it="body",pt="br",lt="button",ft="canvas",St="caption",dt="cite",ut="code",Tt="col",yt="colgroup",gt="data",xt="datalist",ht="dd",mt="del",Et="details",bt="dfn",Pt="dialog",At="div",Ct="dl",Mt="dt",Nt="em",Rt="embed",Ot="fieldset",Dt="figcaption",vt="figure",Lt="footer",It="form",Vt="h1",Ft="h2",kt="h3",jt="h4",Ht="h5",Ut="h6",Gt="head",Kt="header",Bt="hgroup",_t="hr",qt="html",Xt="i",$t="iframe",wt="img",Yt="input",Wt="ins",Jt="kbd",Qt="label",zt="legend",Zt="li",te="link",ee="main",ne="map",oe="mark",se="menu",ae="meta",re="meter",ce="nav",ie="noscript",pe="object",le="ol",fe="optgroup",Se="option",de="output",ue="p",Te="picture",ye="pre",ge="progress",xe="q",he="rp",me="rt",Ee="ruby",be="s",Pe="samp",Ae="script",Ce="search",Me="section",Ne="select",Re="slot",Oe="small",De="source",ve="span",Le="strong",Ie="style",Ve="sub",Fe="summary",ke="sup",je="table",He="tbody",Ue="td",Ge="template",Ke="textarea",Be="tfoot",_e="th",qe="thead",Xe="time",$e="title",we="tr",Ye="track",We="u",Je="ul",Qe="var",ze="video",Ze="wbr",tn="animate",en="animateMotion",nn="animateTransform",on="circle",sn="clipPath",an="defs",rn="desc",cn="ellipse",pn="feBlend",ln="feColorMatrix",fn="feComponentTransfer",Sn="feComposite",dn="feConvolveMatrix",un="feDiffuseLighting",Tn="feDisplacementMap",yn="feDistantLight",gn="feDropShadow",xn="feFlood",hn="feFuncA",mn="feFuncB",En="feFuncG",bn="feFuncR",Pn="feGaussianBlur",An="feImage",Cn="feMerge",Mn="feMergeNode",Nn="feMorphology",Rn="feOffset",On="fePointLight",Dn="feSpecularLighting",vn="feSpotLight",Ln="feTile",In="feTurbulence",Vn="filter",Fn="foreignObject",kn="g",jn="image",Hn="line",Un="linearGradient",Gn="marker",Kn="mask",Bn="metadata",_n="mpath",qn="path",Xn="pattern",$n="polygon",wn="polyline",Yn="radialGradient",Wn="rect",Jn="set",Qn="stop",zn="svg",Zn="switch",to="symbol",eo="text",no="textPath",oo="tspan",so="use",ao="view",ro="annotation",co="annotation-xml",io="maction",po="math",lo="merror",fo="mfrac",So="mi",uo="mmultiscripts",To="mn",yo="mo",go="mover",xo="mpadded",ho="mphantom",mo="mprescripts",Eo="mroot",bo="mrow",Po="ms",Ao="mspace",Co="msqrt",Mo="mstyle",No="msub",Ro="msubsup",Oo="msup",Do="mtable",vo="mtd",Lo="mtext",Io="mtr",Vo="munder",Fo="munderover",ko="semantics";function Ho(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let s=1;s<e.length;s++){let n=o,t=e[s];if(!n)o=t;else if(t)if(typeof n=="string"&&typeof t=="string"){let a=n.split(" "),r=t.split(" "),c=new Set([...a,...r]);o=Array.from(c).join(" ").trim()}else if(typeof n=="string"&&Array.isArray(t)){let a=new Set([...t,...n.split(" ")]);o=Array.from(a).join(" ").trim()}else if(Array.isArray(n)&&typeof t=="string"){let a=new Set([...n,...t.split(" ")]);o=Array.from(a).join(" ").trim()}else if(Array.isArray(n)&&Array.isArray(t)){let a=new Set([...n,...t]);o=Array.from(a).join(" ").trim()}else if(typeof n=="string"&&typeof t=="object")o={[n]:!0,...t};else if(typeof n=="object"&&typeof t=="string")o={...n,[t]:!0};else if(typeof n=="object"&&typeof t=="object")o={...n,...t};else if(typeof n=="object"&&Array.isArray(t)){let a={...n};for(let r of t)a[r]=!0;o=a}else if(Array.isArray(n)&&typeof t=="object"){let a={};for(let r of n)a[r]=!0;for(let r of Object.keys(t))a[r]=t[r];o=a}else throw new Error(`cannot merge classes of ${n} (${typeof n}) and ${t} (${typeof t})`);else continue}return o}var I=document.createElement("div");function Go(...e){try{let o=I.style;for(let s of e)if(typeof s=="object"&&s!==null)for(let n in s)o[n]=s[n];else typeof s=="string"&&(o.cssText+=";"+s);return o.cssText}finally{I.style.cssText=""}}var V=class{constructor(o,s){this.state=o;this.path=s;this.keys=s.split(".")}keys;get(){let o=this.keys,s=this.state?this.state[o[0]]:void 0;for(let n=1;n<o.length&&s;n++)s=s[o[n]];return s}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let s=[];for(let n of o)s.push(this.createPatch(n));this.state.patch(s)}else this.state.patch(this.createPatch(o))}createPatch(o){let s={};return this.putDeep(o,s),s}putDeep(o,s){let n=this.keys;if(n.length>1){let t=0,a=s[n[t]];for((typeof a!="object"||a===null)&&(s[n[t]]=a={}),t=1;t<n.length-1;t++){let r=a;a=a[n[t]],(typeof a!="object"||a===null)&&(r[n[t]]=a={})}a[n[t]]=o}else typeof s[n[0]]=="object"&&typeof o=="object"?Object.assign(s[n[0]],o):s[n[0]]=o}},F=class{constructor(o,s,n,t){this.state=o;this.get=s;this.put=n;this.patch=t}};export{J as A,Q as ABBR,z as ADDRESS,tn as ANIMATE,en as ANIMATEMOTION,nn as ANIMATETRANSFORM,ro as ANNOTATION,co as ANNOTATION_XML,Z as AREA,tt as ARTICLE,et as ASIDE,nt as AUDIO,ot as B,st as BASE,at as BDI,rt as BDO,ct as BLOCKQUOTE,it as BODY,pt as BR,lt as BUTTON,ft as CANVAS,St as CAPTION,on as CIRCLE,dt as CITE,sn as CLIPPATH,ut as CODE,Tt as COL,yt as COLGROUP,gt as DATA,xt as DATALIST,ht as DD,an as DEFS,mt as DEL,rn as DESC,Et as DETAILS,bt as DFN,Pt as DIALOG,At as DIV,Ct as DL,Mt as DT,F as DelegateStateContext,cn as ELLIPSE,Nt as EM,Rt as EMBED,pn as FEBLEND,ln as FECOLORMATRIX,fn as FECOMPONENTTRANSFER,Sn as FECOMPOSITE,dn as FECONVOLVEMATRIX,un as FEDIFFUSELIGHTING,Tn as FEDISPLACEMENTMAP,yn as FEDISTANTLIGHT,gn as FEDROPSHADOW,xn as FEFLOOD,hn as FEFUNCA,mn as FEFUNCB,En as FEFUNCG,bn as FEFUNCR,Pn as FEGAUSSIANBLUR,An as FEIMAGE,Cn as FEMERGE,Mn as FEMERGENODE,Nn as FEMORPHOLOGY,Rn as FEOFFSET,On as FEPOINTLIGHT,Dn as FESPECULARLIGHTING,vn as FESPOTLIGHT,Ln as FETILE,In as FETURBULENCE,Ot as FIELDSET,Dt as FIGCAPTION,vt as FIGURE,Vn as FILTER,Lt as FOOTER,Fn as FOREIGNOBJECT,It as FORM,kn as G,Vt as H1,Ft as H2,kt as H3,jt as H4,Ht as H5,Ut as H6,Gt as HEAD,Kt as HEADER,Bt as HGROUP,_t as HR,qt as HTML,Xt as I,$t as IFRAME,jn as IMAGE,wt as IMG,Yt as INPUT,Wt as INS,Jt as KBD,V as KeyStateContext,Qt as LABEL,zt as LEGEND,Zt as LI,Hn as LINE,Un as LINEARGRADIENT,te as LINK,io as MACTION,ee as MAIN,ne as MAP,oe as MARK,Gn as MARKER,Kn as MASK,po as MATH,se as MENU,lo as MERROR,ae as META,Bn as METADATA,re as METER,fo as MFRAC,So as MI,uo as MMULTISCRIPTS,To as MN,yo as MO,go as MOVER,xo as MPADDED,_n as MPATH,ho as MPHANTOM,mo as MPRESCRIPTS,Eo as MROOT,bo as MROW,Po as MS,Ao as MSPACE,Co as MSQRT,Mo as MSTYLE,No as MSUB,Ro as MSUBSUP,Oo as MSUP,Do as MTABLE,vo as MTD,Lo as MTEXT,Io as MTR,Vo as MUNDER,Fo as MUNDEROVER,ce as NAV,ie as NOSCRIPT,pe as OBJECT,le as OL,fe as OPTGROUP,Se as OPTION,de as OUTPUT,ue as P,qn as PATH,Xn as PATTERN,Te as PICTURE,$n as POLYGON,wn as POLYLINE,ye as PRE,ge as PROGRESS,xe as Q,Yn as RADIALGRADIENT,Wn as RECT,he as RP,me as RT,Ee as RUBY,be as S,Pe as SAMP,Ae as SCRIPT,Ce as SEARCH,Me as SECTION,Ne as SELECT,ko as SEMANTICS,Jn as SET,Re as SLOT,Oe as SMALL,De as SOURCE,ve as SPAN,Qn as STOP,Le as STRONG,Ie as STYLE,Ve as SUB,Fe as SUMMARY,ke as SUP,zn as SVG,Zn as SWITCH,to as SYMBOL,je as TABLE,He as TBODY,Ue as TD,Ge as TEMPLATE,eo as TEXT,Ke as TEXTAREA,no as TEXTPATH,Be as TFOOT,_e as TH,qe as THEAD,Xe as TIME,$e as TITLE,we as TR,Ye as TRACK,oo as TSPAN,We as U,Je as UL,so as USE,Qe as VAR,ze as VIDEO,ao as VIEW,Ze as WBR,K as app,Y as child,w as childCount,C as children,O as childrenStart,X as createPatch,q as createState,B as defuse,E as globals,R as hydrate,_ as memo,Ho as mergeClass,Go as mergeStyle,b as props,$ as tag,G as vode};
1
+ var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function B(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function _(e,o,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let n=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{n.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}n.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;n.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)n.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?n.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=n;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(o,e.parentElement,b,b,D(e,!0),a(o));for(let p of s)n.patch(p);return p=>n.patch(p)}function q(e){if(e?._vode){let a=function(t){if(!t?.node)return;let n=A(t);if(n){for(let c in n)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=N(t);if(r)for(let c of r)a(c)};var o=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function D(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(o&&(s.node=e),e?.hasAttributes()){let t={},n=e.attributes;for(let r of n)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let n of e.childNodes){let r=n&&D(n,o);r?s.push(r):n&&o&&t.push(n)}for(let n of t)n.remove()}return s}else return}function X(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function w(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function N(e){let o=v(e);return o>0?e.slice(o):null}function W(e){let o=v(e);return o<0?0:e.length-o}function J(e,o){let a=v(e);if(a>0)return e[o+a]}function v(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,o,a){if(!o)return e;for(let s in o){let t=o[s];if(t&&typeof t=="object"){let n=e[s];n?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&n!==t?e[s]=new Date(t):Array.isArray(n)?e[s]=E({},t,a):typeof n=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,o,a,s,t,n,r){try{n=R(e,n,t);let c=!n||typeof n=="number"||typeof n=="boolean";if(n===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&K(n),p=!c&&G(n),y=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(y&&b?n=n.wholeText:y&&p&&(n=[...n]),f&&b)return i.nodeValue!==n&&(i.nodeValue=n),t;if(b&&(!i||!f)){let l=document.createTextNode(n);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=0;d<o.childNodes.length;d++){let g=o.childNodes[s+d];if(g){g.before(l,g),S=!0;break}}S||o.appendChild(l)}return l}if(p&&(!i||f||t[0]!==n[0])){let l=n;1 in l&&(l[1]=R(e,l[1],void 0));let S=A(n);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,n[0]):document.createElement(n[0]);if(n.node=d,O(e,d,void 0,S,r),S&&"catch"in S&&(n.node.catch=null,n.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=0;T<o.childNodes.length;T++){let u=o.childNodes[s+T];if(u){u.before(d,u),x=!0;break}}x||o.appendChild(d)}let g=N(n);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);n[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),n}if(!f&&p&&t[0]===n[0]){n.node=i;let l=n,S=t,d=A(n),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=R(e,l[1],S[1]),u!==l[1]&&O(e,i,g,d,r)}else O(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(n.node.catch=null,n.node.removeAttribute("catch"));let x=N(n),T=N(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let H=x[m],U=T&&T[m],L=C(e,i,m,h,U,H,r);n[m+u]=L,L&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return n}}catch(c){let f=A(n)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,o,a,s,D(n?.node||t?.node,!0),i,r)}else throw c}}function G(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function K(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,o,a){if(typeof o!="function")return o;let s=o?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let n=I(o,e);return typeof n=="object"&&(n.__memo=o?.__memo),n}function I(e,o){return typeof e=="function"?I(e(o),o):e}function O(e,o,a,s,t){if(!s&&!a)return;let n=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=M(e,o,r,c,f,n):M(e,o,r,c,void 0,n))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}else if(s)for(let r in s){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}function M(e,o,a,s,t,n){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")s!==t&&(o.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(o.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(o.style[r]=f)}}else for(let r in t)o.style[r]=t[r];else if(a==="class")t?o.setAttribute("class",V(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));o[a]=r}else o[a]=null;else n||(o[a]=t),t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var z="a",Z="abbr",tt="address",et="area",nt="article",ot="aside",st="audio",at="b",rt="base",ct="bdi",it="bdo",pt="blockquote",lt="body",dt="br",ft="button",St="canvas",ut="caption",Tt="cite",yt="code",gt="col",xt="colgroup",ht="data",mt="datalist",Et="dd",bt="del",Pt="details",At="dfn",Ct="dialog",Mt="div",Nt="dl",Rt="dt",Ot="em",Dt="embed",vt="fieldset",Lt="figcaption",It="figure",Vt="footer",Ft="form",kt="h1",jt="h2",Ht="h3",Ut="h4",Gt="h5",Kt="h6",Bt="head",_t="header",qt="hgroup",Xt="hr",$t="html",wt="i",Yt="iframe",Wt="img",Jt="input",Qt="ins",zt="kbd",Zt="label",te="legend",ee="li",ne="link",oe="main",se="map",ae="mark",re="menu",ce="meta",ie="meter",pe="nav",le="noscript",de="object",fe="ol",Se="optgroup",ue="option",Te="output",ye="p",ge="picture",xe="pre",he="progress",me="q",Ee="rp",be="rt",Pe="ruby",Ae="s",Ce="samp",Me="script",Ne="search",Re="section",Oe="select",De="slot",ve="small",Le="source",Ie="span",Ve="strong",Fe="style",ke="sub",je="summary",He="sup",Ue="table",Ge="tbody",Ke="td",Be="template",_e="textarea",qe="tfoot",Xe="th",$e="thead",we="time",Ye="title",We="tr",Je="track",Qe="u",ze="ul",Ze="var",tn="video",en="wbr",nn="animate",on="animateMotion",sn="animateTransform",an="circle",rn="clipPath",cn="defs",pn="desc",ln="ellipse",dn="feBlend",fn="feColorMatrix",Sn="feComponentTransfer",un="feComposite",Tn="feConvolveMatrix",yn="feDiffuseLighting",gn="feDisplacementMap",xn="feDistantLight",hn="feDropShadow",mn="feFlood",En="feFuncA",bn="feFuncB",Pn="feFuncG",An="feFuncR",Cn="feGaussianBlur",Mn="feImage",Nn="feMerge",Rn="feMergeNode",On="feMorphology",Dn="feOffset",vn="fePointLight",Ln="feSpecularLighting",In="feSpotLight",Vn="feTile",Fn="feTurbulence",kn="filter",jn="foreignObject",Hn="g",Un="image",Gn="line",Kn="linearGradient",Bn="marker",_n="mask",qn="metadata",Xn="mpath",$n="path",wn="pattern",Yn="polygon",Wn="polyline",Jn="radialGradient",Qn="rect",zn="set",Zn="stop",to="svg",eo="switch",no="symbol",oo="text",so="textPath",ao="tspan",ro="use",co="view",io="annotation",po="annotation-xml",lo="maction",fo="math",So="merror",uo="mfrac",To="mi",yo="mmultiscripts",go="mn",xo="mo",ho="mover",mo="mpadded",Eo="mphantom",bo="mprescripts",Po="mroot",Ao="mrow",Co="ms",Mo="mspace",No="msqrt",Ro="mstyle",Oo="msub",Do="msubsup",vo="msup",Lo="mtable",Io="mtd",Vo="mtext",Fo="mtr",ko="munder",jo="munderover",Ho="semantics";function Go(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let s=o,t=e[a];if(!s)o=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let n=s.split(" "),r=t.split(" "),c=new Set([...n,...r]);o=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let n=new Set([...t,...s.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let n=new Set([...s,...t.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let n=new Set([...s,...t]);o=Array.from(n).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")o={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")o={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")o={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let n={...s};for(let r of t)n[r]=!0;o=n}else if(Array.isArray(s)&&typeof t=="object"){let n={};for(let r of s)n[r]=!0;for(let r of Object.keys(t))n[r]=t[r];o=n}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return o}var F=document.createElement("div");function Bo(...e){try{let o=F.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)o[s]=a[s];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{F.style.cssText=""}}var k=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let s=1;s<o.length&&a;s++)a=a[o[s]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let s of o)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let s=this.keys;if(s.length>1){let t=0,n=a[s[t]];for((typeof n!="object"||n===null)&&(a[s[t]]=n={}),t=1;t<s.length-1;t++){let r=n;n=n[s[t]],(typeof n!="object"||n===null)&&(r[s[t]]=n={})}n[s[t]]=o}else typeof a[s[0]]=="object"&&typeof o=="object"?Object.assign(a[s[0]],o):a[s[0]]=o}},j=class{constructor(o,a,s,t){this.state=o;this.get=a;this.put=s;this.patch=t}};export{z as A,Z as ABBR,tt as ADDRESS,nn as ANIMATE,on as ANIMATEMOTION,sn as ANIMATETRANSFORM,io as ANNOTATION,po as ANNOTATION_XML,et as AREA,nt as ARTICLE,ot as ASIDE,st as AUDIO,at as B,rt as BASE,ct as BDI,it as BDO,pt as BLOCKQUOTE,lt as BODY,dt as BR,ft as BUTTON,St as CANVAS,ut as CAPTION,an as CIRCLE,Tt as CITE,rn as CLIPPATH,yt as CODE,gt as COL,xt as COLGROUP,ht as DATA,mt as DATALIST,Et as DD,cn as DEFS,bt as DEL,pn as DESC,Pt as DETAILS,At as DFN,Ct as DIALOG,Mt as DIV,Nt as DL,Rt as DT,j as DelegateStateContext,ln as ELLIPSE,Ot as EM,Dt as EMBED,dn as FEBLEND,fn as FECOLORMATRIX,Sn as FECOMPONENTTRANSFER,un as FECOMPOSITE,Tn as FECONVOLVEMATRIX,yn as FEDIFFUSELIGHTING,gn as FEDISPLACEMENTMAP,xn as FEDISTANTLIGHT,hn as FEDROPSHADOW,mn as FEFLOOD,En as FEFUNCA,bn as FEFUNCB,Pn as FEFUNCG,An as FEFUNCR,Cn as FEGAUSSIANBLUR,Mn as FEIMAGE,Nn as FEMERGE,Rn as FEMERGENODE,On as FEMORPHOLOGY,Dn as FEOFFSET,vn as FEPOINTLIGHT,Ln as FESPECULARLIGHTING,In as FESPOTLIGHT,Vn as FETILE,Fn as FETURBULENCE,vt as FIELDSET,Lt as FIGCAPTION,It as FIGURE,kn as FILTER,Vt as FOOTER,jn as FOREIGNOBJECT,Ft as FORM,Hn as G,kt as H1,jt as H2,Ht as H3,Ut as H4,Gt as H5,Kt as H6,Bt as HEAD,_t as HEADER,qt as HGROUP,Xt as HR,$t as HTML,wt as I,Yt as IFRAME,Un as IMAGE,Wt as IMG,Jt as INPUT,Qt as INS,zt as KBD,k as KeyStateContext,Zt as LABEL,te as LEGEND,ee as LI,Gn as LINE,Kn as LINEARGRADIENT,ne as LINK,lo as MACTION,oe as MAIN,se as MAP,ae as MARK,Bn as MARKER,_n as MASK,fo as MATH,re as MENU,So as MERROR,ce as META,qn as METADATA,ie as METER,uo as MFRAC,To as MI,yo as MMULTISCRIPTS,go as MN,xo as MO,ho as MOVER,mo as MPADDED,Xn as MPATH,Eo as MPHANTOM,bo as MPRESCRIPTS,Po as MROOT,Ao as MROW,Co as MS,Mo as MSPACE,No as MSQRT,Ro as MSTYLE,Oo as MSUB,Do as MSUBSUP,vo as MSUP,Lo as MTABLE,Io as MTD,Vo as MTEXT,Fo as MTR,ko as MUNDER,jo as MUNDEROVER,pe as NAV,le as NOSCRIPT,de as OBJECT,fe as OL,Se as OPTGROUP,ue as OPTION,Te as OUTPUT,ye as P,$n as PATH,wn as PATTERN,ge as PICTURE,Yn as POLYGON,Wn as POLYLINE,xe as PRE,he as PROGRESS,me as Q,Jn as RADIALGRADIENT,Qn as RECT,Ee as RP,be as RT,Pe as RUBY,Ae as S,Ce as SAMP,Me as SCRIPT,Ne as SEARCH,Re as SECTION,Oe as SELECT,Ho as SEMANTICS,zn as SET,De as SLOT,ve as SMALL,Le as SOURCE,Ie as SPAN,Zn as STOP,Ve as STRONG,Fe as STYLE,ke as SUB,je as SUMMARY,He as SUP,to as SVG,eo as SWITCH,no as SYMBOL,Ue as TABLE,Ge as TBODY,Ke as TD,Be as TEMPLATE,oo as TEXT,_e as TEXTAREA,so as TEXTPATH,qe as TFOOT,Xe as TH,$e as THEAD,we as TIME,Ye as TITLE,We as TR,Je as TRACK,ao as TSPAN,Qe as U,ze as UL,ro as USE,Ze as VAR,tn as VIDEO,co as VIEW,en as WBR,_ as app,J as child,W as childCount,N as children,v as childrenStart,w as createPatch,$ as createState,q as defuse,P as globals,D as hydrate,X as memo,Go as mergeClass,Bo as mergeStyle,A as props,Y as tag,B as vode};
package/dist/vode.mjs CHANGED
@@ -87,7 +87,7 @@ function app(container, state, dom, ...initialPatches) {
87
87
  function renderDom(isAsync) {
88
88
  const sw = Date.now();
89
89
  const vom = dom(_vode.state);
90
- _vode.vode = render(_vode.state, container.parentElement, 0, _vode.vode, vom);
90
+ _vode.vode = render(_vode.state, container.parentElement, 0, 0, _vode.vode, vom);
91
91
  if (container.tagName.toUpperCase() !== vom[0].toUpperCase()) {
92
92
  container = _vode.vode.node;
93
93
  container._vode = _vode;
@@ -139,10 +139,12 @@ function app(container, state, dom, ...initialPatches) {
139
139
  _vode.state = patchableState;
140
140
  const root = container;
141
141
  root._vode = _vode;
142
+ const indexInParent = Array.from(container.parentElement.children).indexOf(container);
142
143
  _vode.vode = render(
143
144
  state,
144
145
  container.parentElement,
145
- Array.from(container.parentElement.children).indexOf(container),
146
+ indexInParent,
147
+ indexInParent,
146
148
  hydrate(container, true),
147
149
  dom(state)
148
150
  );
@@ -292,7 +294,7 @@ function mergeState(target, source, allowDeletion) {
292
294
  }
293
295
  return target;
294
296
  }
295
- function render(state, parent, childIndex, oldVode, newVode, xmlns) {
297
+ function render(state, parent, childIndex, indexInParent, oldVode, newVode, xmlns) {
296
298
  try {
297
299
  newVode = remember(state, newVode, oldVode);
298
300
  const isNoVode = !newVode || typeof newVode === "number" || typeof newVode === "boolean";
@@ -328,9 +330,16 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
328
330
  oldNode.onUnmount && state.patch(oldNode.onUnmount(oldNode));
329
331
  oldNode.replaceWith(text);
330
332
  } else {
331
- if (parent.childNodes[childIndex]) {
332
- parent.insertBefore(text, parent.childNodes[childIndex]);
333
- } else {
333
+ let inserted = false;
334
+ for (let i = 0; i < parent.childNodes.length; i++) {
335
+ const nextSibling = parent.childNodes[indexInParent + i];
336
+ if (nextSibling) {
337
+ nextSibling.before(text, nextSibling);
338
+ inserted = true;
339
+ break;
340
+ }
341
+ }
342
+ if (!inserted) {
334
343
  parent.appendChild(text);
335
344
  }
336
345
  }
@@ -354,19 +363,28 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
354
363
  oldNode.onUnmount && state.patch(oldNode.onUnmount(oldNode));
355
364
  oldNode.replaceWith(newNode);
356
365
  } else {
357
- if (parent.childNodes[childIndex]) {
358
- parent.insertBefore(newNode, parent.childNodes[childIndex]);
359
- } else {
366
+ let inserted = false;
367
+ for (let i = 0; i < parent.childNodes.length; i++) {
368
+ const nextSibling = parent.childNodes[indexInParent + i];
369
+ if (nextSibling) {
370
+ nextSibling.before(newNode, nextSibling);
371
+ inserted = true;
372
+ break;
373
+ }
374
+ }
375
+ if (!inserted) {
360
376
  parent.appendChild(newNode);
361
377
  }
362
378
  }
363
379
  const newKids = children(newVode);
364
380
  if (newKids) {
365
381
  const childOffset = !!properties ? 2 : 1;
382
+ let indexP = 0;
366
383
  for (let i = 0; i < newKids.length; i++) {
367
384
  const child2 = newKids[i];
368
- const attached = render(state, newNode, i, void 0, child2, xmlns);
385
+ const attached = render(state, newNode, i, indexP, void 0, child2, xmlns);
369
386
  newVode[i + childOffset] = attached;
387
+ if (attached) indexP++;
370
388
  }
371
389
  }
372
390
  newNode.onMount && state.patch(newNode.onMount(newNode));
@@ -396,19 +414,19 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
396
414
  const oldKids = children(oldVode);
397
415
  if (newKids) {
398
416
  const childOffset = !!properties ? 2 : 1;
417
+ let indexP = 0;
399
418
  for (let i = 0; i < newKids.length; i++) {
400
419
  const child2 = newKids[i];
401
420
  const oldChild = oldKids && oldKids[i];
402
- const attached = render(state, oldNode, i, oldChild, child2, xmlns);
403
- if (attached) {
404
- newVode[i + childOffset] = attached;
405
- }
421
+ const attached = render(state, oldNode, i, indexP, oldChild, child2, xmlns);
422
+ newVode[i + childOffset] = attached;
423
+ if (attached) indexP++;
406
424
  }
407
425
  }
408
426
  if (oldKids) {
409
427
  const newKidsCount = newKids ? newKids.length : 0;
410
428
  for (let i = oldKids.length - 1; i >= newKidsCount; i--) {
411
- render(state, oldNode, i, oldKids[i], void 0, xmlns);
429
+ render(state, oldNode, i, i, oldKids[i], void 0, xmlns);
412
430
  }
413
431
  }
414
432
  return newVode;
@@ -421,6 +439,7 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
421
439
  state,
422
440
  parent,
423
441
  childIndex,
442
+ indexInParent,
424
443
  hydrate(newVode?.node || oldVode?.node, true),
425
444
  handledVode,
426
445
  xmlns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "a minimalist web framework",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
package/src/vode.ts CHANGED
@@ -213,7 +213,7 @@ export function app<S extends PatchableState = PatchableState>(
213
213
  function renderDom(isAsync: boolean) {
214
214
  const sw = Date.now();
215
215
  const vom = dom(_vode.state);
216
- _vode.vode = render<S>(_vode.state, container.parentElement as Element, 0, _vode.vode, vom)!;
216
+ _vode.vode = render<S>(_vode.state, container.parentElement as Element, 0, 0, _vode.vode, vom)!;
217
217
 
218
218
  if ((<ContainerNode<S>>container).tagName.toUpperCase() !== (vom[0] as Tag).toUpperCase()) { //the tag name was changed during render -> update reference to vode-app-root
219
219
  container = _vode.vode.node as Element;
@@ -273,11 +273,12 @@ export function app<S extends PatchableState = PatchableState>(
273
273
 
274
274
  const root = container as ContainerNode<S>;
275
275
  root._vode = _vode;
276
-
276
+ const indexInParent = Array.from(container.parentElement.children).indexOf(container);
277
277
  _vode.vode = render(
278
278
  <S>state,
279
279
  container.parentElement,
280
- Array.from(container.parentElement.children).indexOf(container),
280
+ indexInParent,
281
+ indexInParent,
281
282
  hydrate<S>(container, true) as AttachedVode<S>,
282
283
  dom(<S>state)
283
284
  )!;
@@ -472,7 +473,7 @@ function mergeState(target: any, source: any, allowDeletion: boolean) {
472
473
  return target;
473
474
  };
474
475
 
475
- function render<S extends PatchableState>(state: S, parent: Element, childIndex: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, xmlns?: string | null): AttachedVode<S> | undefined {
476
+ function render<S extends PatchableState>(state: S, parent: Element, childIndex: number, indexInParent: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, xmlns?: string | null): AttachedVode<S> | undefined {
476
477
  try {
477
478
  // unwrap component if it is memoized
478
479
  newVode = remember(state, newVode, oldVode) as ChildVode<S>;
@@ -520,9 +521,16 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
520
521
  (<any>oldNode).onUnmount && state.patch((<any>oldNode).onUnmount(oldNode));
521
522
  oldNode.replaceWith(text);
522
523
  } else {
523
- if (parent.childNodes[childIndex]) {
524
- parent.insertBefore(text, parent.childNodes[childIndex]);
525
- } else {
524
+ let inserted = false;
525
+ for (let i = 0; i < parent.childNodes.length; i++) {
526
+ const nextSibling = parent.childNodes[indexInParent + i];
527
+ if (nextSibling) {
528
+ nextSibling.before(text, nextSibling);
529
+ inserted = true;
530
+ break;
531
+ }
532
+ }
533
+ if (!inserted) {
526
534
  parent.appendChild(text);
527
535
  }
528
536
  }
@@ -558,9 +566,16 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
558
566
  (<any>oldNode).onUnmount && state.patch((<any>oldNode).onUnmount(oldNode));
559
567
  oldNode.replaceWith(newNode);
560
568
  } else {
561
- if (parent.childNodes[childIndex]) {
562
- parent.insertBefore(newNode, parent.childNodes[childIndex]);
563
- } else {
569
+ let inserted = false;
570
+ for (let i = 0; i < parent.childNodes.length; i++) {
571
+ const nextSibling = parent.childNodes[indexInParent + i];
572
+ if (nextSibling) {
573
+ nextSibling.before(newNode, nextSibling);
574
+ inserted = true;
575
+ break;
576
+ }
577
+ }
578
+ if (!inserted) {
564
579
  parent.appendChild(newNode);
565
580
  }
566
581
  }
@@ -568,10 +583,12 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
568
583
  const newKids = children(newVode);
569
584
  if (newKids) {
570
585
  const childOffset = !!properties ? 2 : 1;
586
+ let indexP = 0;
571
587
  for (let i = 0; i < newKids.length; i++) {
572
588
  const child = newKids[i];
573
- const attached = render(state, newNode as Element, i, undefined, child, xmlns);
589
+ const attached = render(state, newNode as Element, i, indexP, undefined, child, xmlns);
574
590
  (<Vode<S>>newVode!)[i + childOffset] = <Vode<S>>attached;
591
+ if (attached) indexP++;
575
592
  }
576
593
  }
577
594
 
@@ -611,21 +628,21 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
611
628
  const oldKids = children(oldVode) as AttachedVode<S>[];
612
629
  if (newKids) {
613
630
  const childOffset = !!properties ? 2 : 1;
631
+ let indexP = 0;
614
632
  for (let i = 0; i < newKids.length; i++) {
615
633
  const child = newKids[i];
616
634
  const oldChild = oldKids && oldKids[i];
617
635
 
618
- const attached = render(state, oldNode as Element, i, oldChild, child, xmlns);
619
- if (attached) {
620
- (<Vode<S>>newVode)[i + childOffset] = <Vode<S>>attached;
621
- }
636
+ const attached = render(state, oldNode as Element, i, indexP, oldChild, child, xmlns);
637
+ (<Vode<S>>newVode)[i + childOffset] = <Vode<S>>attached;
638
+ if (attached) indexP++;
622
639
  }
623
640
  }
624
641
 
625
642
  if (oldKids) {
626
643
  const newKidsCount = newKids ? newKids.length : 0;
627
644
  for (let i = oldKids.length - 1; i >= newKidsCount; i--) {
628
- render(state, oldNode as Element, i, oldKids[i], undefined, xmlns);
645
+ render(state, oldNode as Element, i, i, oldKids[i], undefined, xmlns);
629
646
  }
630
647
  }
631
648
 
@@ -638,7 +655,7 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
638
655
  ? (<(s: S, error: any) => ChildVode<S>>catchVode)(state, error)
639
656
  : catchVode;
640
657
 
641
- return render(state, parent, childIndex,
658
+ return render(state, parent, childIndex, indexInParent,
642
659
  hydrate(((<AttachedVode<S>>newVode)?.node || oldVode?.node) as Element, true) as AttachedVode<S>,
643
660
  handledVode,
644
661
  xmlns);