@verajs/renderer 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1000 -12
  2. package/dist/development/vera-renderer-hydrate.d.ts +32 -13
  3. package/dist/development/vera-renderer-hydrate.d.ts.map +1 -1
  4. package/dist/development/vera-renderer-hydrate.js +1812 -234
  5. package/dist/development/vera-renderer-hydrate.js.map +1 -1
  6. package/dist/development/vera-renderer-keyed.d.ts +17 -0
  7. package/dist/development/vera-renderer-keyed.d.ts.map +1 -0
  8. package/dist/development/vera-renderer-keyed.js +322 -0
  9. package/dist/development/vera-renderer-keyed.js.map +1 -0
  10. package/dist/development/vera-renderer-profiler.d.ts +57 -17
  11. package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
  12. package/dist/development/vera-renderer-profiler.js +1445 -209
  13. package/dist/development/vera-renderer-profiler.js.map +1 -1
  14. package/dist/development/vera-renderer-slots.d.ts +103 -0
  15. package/dist/development/vera-renderer-slots.d.ts.map +1 -0
  16. package/dist/development/vera-renderer-slots.js +1387 -0
  17. package/dist/development/vera-renderer-slots.js.map +1 -0
  18. package/dist/development/vera-renderer-spread.d.ts +51 -0
  19. package/dist/development/vera-renderer-spread.d.ts.map +1 -0
  20. package/dist/development/vera-renderer-spread.js +499 -0
  21. package/dist/development/vera-renderer-spread.js.map +1 -0
  22. package/dist/development/vera-renderer-tag.d.ts +61 -0
  23. package/dist/development/vera-renderer-tag.d.ts.map +1 -0
  24. package/dist/development/vera-renderer-tag.js +727 -0
  25. package/dist/development/vera-renderer-tag.js.map +1 -0
  26. package/dist/development/vera-renderer.d.ts +41 -16
  27. package/dist/development/vera-renderer.d.ts.map +1 -1
  28. package/dist/development/vera-renderer.js +1375 -200
  29. package/dist/development/vera-renderer.js.map +1 -1
  30. package/dist/vera-renderer-hydrate.min.js +1 -1
  31. package/dist/vera-renderer-hydrate.min.js.map +1 -1
  32. package/dist/vera-renderer-keyed.min.js +2 -0
  33. package/dist/vera-renderer-keyed.min.js.map +1 -0
  34. package/dist/vera-renderer-slots.min.js +2 -0
  35. package/dist/vera-renderer-slots.min.js.map +1 -0
  36. package/dist/vera-renderer-spread.min.js +2 -0
  37. package/dist/vera-renderer-spread.min.js.map +1 -0
  38. package/dist/vera-renderer-tag.min.js +2 -0
  39. package/dist/vera-renderer-tag.min.js.map +1 -0
  40. package/dist/vera-renderer.min.js +1 -1
  41. package/dist/vera-renderer.min.js.map +1 -1
  42. package/package.json +24 -1
@@ -1,2 +1,2 @@
1
- const t=(t,s)=>(s.key=t,s),s=t=>({$h:t}),n="$v"+(1e9*Math.random()>>>0).toString(36)+"$",e="?"+n,i=document,l=(t="")=>i.createComment(t),o=i.createTreeWalker(i,129),h=i.createTreeWalker(i,5),r=/^(?:script|style|textarea|title)$/i,c=/[\s"'>=/]/,u=new WeakMap;class f{t;i=[];constructor(t){const s=t._$litType$??1,{markup:u,specs:f}=(t=>{const s=[];let e="",i=0,l="",o=0,h="",u=0,f=!1,_="",a=[],p="";const d=t=>{let s=t;for(;s>0&&!c.test(e[s-1]);)s--;return e.slice(s,t)};for(let c=0;c<t.length;c++){const m=t[c];let v=0;for(;v<m.length;){const t=m[v];if(5===i){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){a.push(p);const t=l||'"';e+=` ${s.length}${n}=${t}${a.join(n)}${t}`,s.push({l:1,o:_}),i=1,""!==l&&v++;continue}p+=t,v++}else if(0===i){if("<"===t){if(m.startsWith("!--",v+1)){i=3,e+="\x3c!--",v+=4;continue}f="/"===m[v+1],u=e.length+(f?2:1),i=1}e+=t,v++}else if(1===i){if('"'===t||"'"===t)l=t,o=e.length,i=2;else if(">"===t){const t=e.slice(u).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";f||!r.test(t)||e.endsWith("/")?i=0:(h=t.toLowerCase(),i=4)}e+=t,v++}else if(2===i)t===l&&(i=1),e+=t,v++;else if(3===i){if("-"===t&&m.startsWith("->",v+1)){e+="--\x3e",v+=3,i=0;continue}e+=t,v++}else"<"===t&&m.slice(v+1,v+2+h.length).toLowerCase()==="/"+h&&(v+2+h.length>=m.length||/[\s/>]/.test(m[v+2+h.length]))&&(f=!0,u=e.length+2,i=1),e+=t,v++}if(c===t.length-1)break;if(0===i)e+=`<?${n}>`,s.push({l:0});else if(4===i)e+=n,s.push({l:0});else if(3===i)s.push({l:2});else if(5===i)a.push(p),p="";else if(2===i){const t="="===e[o-1]?d(o-1):"";t?(_=t,a=[e.slice(o+1)],p="",e=e.slice(0,o-1-t.length),i=5):s.push({l:2})}else{const t=e.endsWith("=")?d(e.length-1):"";t?(_=t,a=[""],p="",l="",e=e.slice(0,e.length-1-t.length),i=5):(e+=` ${s.length}${n}="${n}"`,s.push({l:1,o:"&"}))}}return{markup:e,specs:s}})(t.strings);this.t=i.createElement("template"),this.t.innerHTML=2===s?`<svg>${u}</svg>`:3===s?`<math>${u}</math>`:u;const _=this.t.content;if(1!==s){const t=_.firstChild;for(;t.firstChild;)_.insertBefore(t.firstChild,t);_.removeChild(t)}o.currentNode=_;let a,p=0;const d=this.i,m=()=>{for(;p<f.length&&2===f[p].l;)d.push({l:2,h:-1}),p++};for(m();p<f.length&&null!==(a=o.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const s of t.getAttributeNames())if(s.endsWith(n)){const e=f[p++];d.push({l:1,h:-1,o:e.o,u:t.getAttribute(s).split(n),_:t}),t.removeAttribute(s),m()}if(r.test(t.tagName)&&t.textContent.includes(n)){const s=t.textContent.split(n);t.textContent="";for(let n=0;n<s.length-1;n++)s[n]&&t.append(s[n]),t.append(l(e));s[s.length-1]&&t.append(s[s.length-1])}}else if(a.data===e){p++;const t=i.createTextNode("");a.parentNode.insertBefore(t,a),o.currentNode=t,a.remove(),d.push({l:0,h:-1,_:t}),m()}h.currentNode=_;let v=-1,y=0;for(;y<d.length&&2===d[y].l;)y++;for(;y<d.length&&null!==(a=h.nextNode());)for(v++;y<d.length&&d[y]._===a;)for(d[y].h=v,y++;y<d.length&&2===d[y].l;)y++;for(const t of d)t._=void 0}}const _=t=>{let s=u.get(t.strings);return void 0===s&&u.set(t.strings,s=new f(t)),s},a={p:(t,s)=>s+1},p={},d=i.createDocumentFragment(),m=(t,s)=>{const n=l(),e=l();return t.insertBefore(n,s),t.insertBefore(e,s),new b(n,e)},v=t=>null==t?"":String(t);class y{t;o;u;m;v;$;k=p;j=null;constructor(t,s,n){const e=s[0];let i="."===e?1:"?"===e?2:"@"===e?3:"&"===e?4:0,l=i?s.slice(1):s;0===i&&"o"===e&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(i=3,l=s.slice(2).toLowerCase()),this.v=i,this.o=l,this.t=t,this.u=n,this.m=n.length-1,this.$=1===this.m&&""===n[0]&&""===n[1]}handleEvent(t){this.j&&this.j.call(this.t,t)}p(t,s){const n=this.v;let e;if(this.$||n>=3)e=t[s];else{const n=this.u;let i=n[0];for(let e=0;e<this.m;e++)i+=v(t[s+e])+n[e+1];e=i}if(e!==this.k){const t=this.k===p;this.k=e,0===n?null==e?t||this.t.removeAttribute(this.o):this.t.setAttribute(this.o,e):1===n?this.t[this.o]=e:2===n?t&&!e||this.t.toggleAttribute(this.o,!!e):3===n?(null===this.j&&null!=e&&this.t.addEventListener(this.o,this),this.j=e??null):null!=e&&("function"==typeof e?e(this.t):"object"==typeof e&&(e.value=this.t))}return s+this.m}}class w{i=[];I;constructor(t){this.I=t.t.content.cloneNode(!0);const s=t.i;h.currentNode=this.I;let n=-1,e=null;for(let t=0;t<s.length;t++){const i=s[t];if(2!==i.l){for(;n<i.h;)e=h.nextNode(),n++;this.i.push(0===i.l?new k(e):new y(e,i.o,i.u))}else this.i.push(a)}}M(t){let s=0;const n=this.i;for(let e=0;e<n.length;e++)s=n[e].p(t,s)}}const $=t=>void 0!==t.strings;class k{A;S="";W=null;constructor(t){this.A=t}p(t,s){const n=t[s];if(null!==this.W)return this.W.L(n),s+1;if(null==n||"object"==typeof n){const t=l(),e=l(),i=this.A.parentNode;i.insertBefore(t,this.A),i.insertBefore(e,this.A.nextSibling);const o=new b(t,e);return o.F=x,o.A=this.A,o.S=this.S,this.W=o,o.L(n),s+1}return n!==this.S&&(this.S=n,this.A.data=n),s+1}}const x=1;class b{H;N;F=0;S;A=null;O=null;V=null;Z=null;q=!1;B=null;constructor(t,s){this.H=t,this.N=s}p(t,s){return this.L(t[s]),s+1}C(t){this.H.parentNode.insertBefore(t,this.N)}D(){const t=this.H.parentNode,s=this.N;if(null!==this.H.previousSibling||null!==s&&null!==s.nextSibling){let s=this.H.nextSibling;for(;null!==s&&s!==this.N;){const n=s.nextSibling;t.removeChild(s),s=n}}else t.textContent="",t.appendChild(this.H),null!==s&&t.appendChild(s);this.F=0,this.A=null,this.O=null,this.Z=null,this.V=null}L(t){if(null==t)return void(0!==this.F&&this.D());if("object"!=typeof t)return void(this.F===x?this.S!==t&&(this.S=t,this.A.data=t):(0!==this.F&&this.D(),this.A=i.createTextNode(t),this.C(this.A),this.S=t,this.F=x));const s=t.$h;if(void 0===s){if($(t)){if(this.V===t.strings)return void this.O.M(t.values);const s=_(t);0!==this.F&&this.D();const n=new w(s);return n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,void(this.F=2)}Array.isArray(t)?this.G(t):"function"!=typeof t[Symbol.iterator]?this.L(String(t)):this.G([...t])}else this.J(s)}J(t){if(2===this.F&&this.V===t.strings)return void this.O.M(t.values);const s=this.B??=new Map;if(2===this.F){const t=this.O.I;let n=this.H.nextSibling;for(;n!==this.N;){const s=n.nextSibling;t.appendChild(n),n=s}s.set(this.V,this.O)}else 0!==this.F&&this.D();const n=s.get(t.strings)??new w(_(t));n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,this.F=2}K(t,s,n){if(null!==t&&"object"==typeof t&&void 0!==t.strings){const e=t,i=_(e),l=new w(i);l.M(e.values);const o=l.I.firstChild;if(null!==o&&1===o.nodeType&&null===o.nextSibling)return s.insertBefore(o,n),{P:e.key,t:o,O:l,V:e.strings,R:null};const h=m(s,n);return h.O=l,h.V=e.strings,h.F=2,h.H.parentNode.insertBefore(l.I,h.N),{P:e.key,t:null,O:null,V:null,R:h}}const e=m(s,n);return e.L(t),{P:t?.key,t:null,O:null,V:null,R:e}}T(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.V)return void t.O.M(s.values);const n=m(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.O=null,t.V=null,void(t.R=n).L(s)}t.R.L(s)}U(t){return t.t??t.R.H}X(t,s,n=this.H.parentNode){if(null!==t.t)return void n.insertBefore(t.t,s);let e=t.R.H;const i=t.R.N.nextSibling;for(;e!==i;){const t=e.nextSibling;n.insertBefore(e,s),e=t}}Y(t){this.X(t,null,d),d.textContent=""}G(t){3!==this.F&&(0!==this.F&&this.D(),this.Z=[],this.q=!1,this.F=3);const s=t.length;if(0===s)return void(this.Z.length&&(this.D(),this.Z=[],this.F=3));const n=null!=t[0]&&void 0!==t[0].key;n!==this.q&&this.Z.length&&(this.D(),this.Z=[],this.F=3),this.q=n;const e=this.Z,l=this.H.parentNode;if(0===e.length){const n=i.createDocumentFragment();for(let i=0;i<s;i++)e.push(this.K(t[i],n,null));return void this.C(n)}if(!n){const n=e.length<s?e.length:s;for(let s=0;s<n;s++)this.T(e[s],t[s]);if(s>e.length){const n=i.createDocumentFragment();for(let i=e.length;i<s;i++)e.push(this.K(t[i],n,null));this.C(n)}else if(s<e.length){const t=e[e.length-1];let n=this.U(e[s]);const i=null!==t.t?t.t.nextSibling:t.R.N.nextSibling;for(;n!==i;){const t=n.nextSibling;l.removeChild(n),n=t}e.length=s}return}if(e.length===s){let n=0;for(;n<s&&e[n].P===t[n].key;)this.T(e[n],t[n]),n++;if(n===s)return}const o=e,h=new Array(s);for(let n=0;n<s;n++)h[n]=t[n].key;const r=new Array(s);let c,u,f=0,_=o.length-1,a=0,p=s-1;const d=t=>t<s&&void 0!==r[t]?this.U(r[t]):this.N;for(;f<=_&&a<=p;)if(null===o[f])f++;else if(null===o[_])_--;else if(o[f].P===h[a])this.T(r[a]=o[f],t[a]),f++,a++;else if(o[_].P===h[p])this.T(r[p]=o[_],t[p]),_--,p--;else if(o[f].P===h[p]){const s=o[f];this.X(s,d(p+1)),this.T(s,t[p]),r[p]=s,f++,p--}else if(o[_].P===h[a]){const s=o[_];this.X(s,this.U(o[f])),this.T(s,t[a]),r[a]=s,_--,a++}else{if(void 0===c){c=new Map;for(let t=a;t<=p;t++)c.set(h[t],t);u=new Map;for(let t=f;t<=_;t++)null!==o[t]&&u.set(o[t].P,t)}if(c.has(o[f].P))if(c.has(o[_].P)){const s=u.get(h[a]);if(void 0===s)r[a]=this.K(t[a],l,this.U(o[f]));else{const n=o[s];this.X(n,this.U(o[f])),this.T(n,t[a]),r[a]=n,o[s]=null}a++}else this.Y(o[_]),_--;else this.Y(o[f]),f++}for(;a<=p;)r[a]=this.K(t[a],l,d(p+1)),a++;for(;f<=_;){const t=o[f++];null!==t&&this.Y(t)}this.Z=r}}const j=new WeakMap,I={},M=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),g=new WeakMap,A=(t,s,n)=>{n.tt++;const e=n.st.i;if(3===t.nodeType){let i=!1;for(;n.nt<e.length&&e[n.nt].h===n.tt;)i=!0,n.nt++,W(s,n.et[n.it++],n.lt),S(n);return void(i||((t,s)=>{let n=s;for(;n.length>0;){const s=t.node;if(null===s||3!==s.nodeType)throw I;const e=s.data,i=e.length-t.offset;if(0===i){t.node=s.nextSibling,t.offset=0;continue}const l=i<n.length?i:n.length;if(e.slice(t.offset,t.offset+l)!==n.slice(0,l))throw I;n=n.slice(l),t.offset+=l,t.offset===e.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}const i=M(s);if(null===i||1!==i.nodeType)throw I;if(i.localName!==t.localName)throw I;for(;n.nt<e.length&&e[n.nt].h===n.tt;){const t=e[n.nt++],s=new y(i,t.o,t.u);n.lt.push(s),n.it=s.p(n.et,n.it),S(n)}const l={parent:i,node:i.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,l,n),o=o.nextSibling;if(null!==l.node&&(3!==l.node.nodeType||""!==l.node.data||null!==l.node.nextSibling))throw I;s.node=i.nextSibling,s.offset=0},S=t=>{const s=t.st.i;for(;t.nt<s.length&&2===s[t.nt].l;)t.lt.push(a),t.it++,t.nt++},W=(t,s,n)=>{const e=s?.$h,o=void 0!==e?e:s;if(null!=o&&"object"!=typeof o){const s=new k(((t,s)=>{const n=M(t);if(""===s){const s=i.createTextNode("");return t.parent.insertBefore(s,n),s}if(null===n||3!==n.nodeType)throw I;const e=n;if(e.data.length>s.length&&e.splitText(s.length),e.data!==s)throw I;return t.node=e.nextSibling,t.offset=0,e})(t,v(o)));return s.S=o,void n.push(s)}const h=l();t.parent.insertBefore(h,M(t));const r=new b(h,null);if(null==o);else if($(o))r.O=z(_(o),o.values,t),r.V=o.strings,r.F=2;else{const s=Array.isArray(o)?o:[...o],n=[];for(const e of s)n.push(L(t,e));r.Z=n,r.q=s.length>0&&void 0!==s[0]?.key,r.F=3}const c=l();t.parent.insertBefore(c,M(t)),r.N=c,n.push(r)},L=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const n=s,e=_(n),i=e.t.content.firstChild;if(null!==i&&1===i.nodeType&&null===i.nextSibling){const s=M(t),i=z(e,n.values,t);return{P:n.key,t:s,O:i,V:n.strings,R:null}}const o=l();t.parent.insertBefore(o,M(t));const h=z(e,n.values,t),r=l();t.parent.insertBefore(r,M(t));const c=new b(o,r);return c.O=h,c.V=n.strings,c.F=2,{P:n.key,t:null,O:null,V:null,R:c}}const n=[];return W(t,s,n),{P:s?.key,t:null,O:null,V:null,R:n[0]}},z=(t,s,n)=>{const e=Object.create(w.prototype);e.i=[],e.I=i.createDocumentFragment();const l={st:t,et:s,it:0,nt:0,tt:-1,lt:e.i};S(l),(t=>{let s=g.get(t);if(void 0===s){let n;for(s=[],h.currentNode=t.t.content;null!==(n=h.nextNode());)s.push(n);g.set(t,s)}})(t);let o=t.t.content.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,n,l),o=o.nextSibling;if(S(l),l.nt!==t.i.length)throw I;return e},E=(t,s)=>{if(!j.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&$(t)){const n=((t,s)=>{let n=s.firstChild;for(;null!==n&&1===n.nodeType&&n.hasAttribute("vera-styles");)n=n.nextSibling;const e=l();s.insertBefore(e,n);try{const n={parent:s,node:e.nextSibling,offset:0},i=z(_(t),t.values,n);if(null!==n.node)throw I;const l=new b(e,null);return l.O=i,l.V=t.strings,l.F=2,l}catch(t){if(t!==I)throw t;return e.remove(),null}})(t,s);if(null!==n)return void j.set(s,n);(t=>{let s=t.firstChild;for(;null!==s;){const n=s.nextSibling;1===s.nodeType&&s.hasAttribute("vera-styles")||t.removeChild(s),s=n}})(s)}((t,s)=>{let n=j.get(s);if(void 0===n){const t=l();s.appendChild(t),j.set(s,n=new b(t,null))}n.L(t)})(t,s)};export{s as hold,t as keyed,E as render};
1
+ const t=t=>null!=t&&"object"==typeof t&&g(t)?{$h:t}:t,s="$v"+(1e9*Math.random()>>>0).toString(36)+"$",i="?"+s,n=document,l=(t="")=>n.createComment(t),e=n.createTreeWalker(n,129),o=n.createTreeWalker(n,5),h=/^(?:script|style|textarea|title|iframe|noscript)$/i,r=/[\s"'>=/]/;let c=null;new Set;const f=new WeakMap;class u{t;i=[];constructor(t){const c=t._$litType$??1,{markup:f,specs:u}=(t=>{const i=[];let n="",l=0,e="",o=0,c="",f=0,u=!1,a="",_=[],d="";const p=t=>{let s=t;for(;s>0&&!r.test(n[s-1]);)s--;return n.slice(s,t)};for(let r=0;r<t.length;r++){const v=t[r];let m=0;for(;m<v.length;){const t=v[m];if(5===l){if(t===e||""===e&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){_.push(d);const t=e||'"';n+=` ${i.length}${s}=${t}${_.join(s)}${t}`,i.push({l:1,o:a}),l=1,""!==e&&m++;continue}d+=t,m++}else if(0===l){if("<"===t){if(v.startsWith("!--",m+1)){l=3,n+="\x3c!--",m+=4;continue}u="/"===v[m+1],f=n.length+(u?2:1),l=1}n+=t,m++}else if(1===l){if('"'===t||"'"===t)e=t,o=n.length,l=2;else if(">"===t){const t=n.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!h.test(t)||n.endsWith("/")?l=0:(c=t.toLowerCase(),l=4)}n+=t,m++}else if(2===l)t===e&&(l=1),n+=t,m++;else if(3===l){if("-"===t&&v.startsWith("->",m+1)){n+="--\x3e",m+=3,l=0;continue}n+=t,m++}else"<"===t&&v.slice(m+1,m+2+c.length).toLowerCase()==="/"+c&&(m+2+c.length>=v.length||/[\s/>]/.test(v[m+2+c.length]))&&(u=!0,f=n.length+2,l=1),n+=t,m++}if(r===t.length-1)break;if(0===l)n+=`<?${s}>`,i.push({l:0});else if(4===l)n+=s,i.push({l:0});else if(3===l)i.push({l:2});else if(5===l)_.push(d),d="";else if(2===l){const t="="===n[o-1]?p(o-1):"";t?(a=t,_=[n.slice(o+1)],d="",n=n.slice(0,o-1-t.length),l=5):i.push({l:2})}else{const t=n.endsWith("=")?p(n.length-1):"";t?(a=t,_=[""],d="",e="",n=n.slice(0,n.length-1-t.length),l=5):(n+=` ${i.length}${s}="${s}"`,i.push({l:1,o:"&"}))}}return{markup:n,specs:i}})(t.strings);this.t=n.createElement("template"),this.t.innerHTML=2===c?`<svg>${f}</svg>`:3===c?`<math>${f}</math>`:f;const a=this.t.content;if(1!==c){const t=a.firstChild;for(;t.firstChild;)a.insertBefore(t.firstChild,t);a.removeChild(t)}e.currentNode=a;let _,d=0;const p=this.i,v=()=>{for(;d<u.length&&2===u[d].l;)p.push({l:2,h:-1}),d++};for(v();d<u.length&&null!==(_=e.nextNode());)if(1===_.nodeType){const t=_;if(t.hasAttributes())for(const i of t.getAttributeNames())if(i.endsWith(s)){const n=parseInt(i,10);if(n>d)do{p.push({l:2,h:-1})}while(++d<n);const l=u[d++];p.push({l:1,h:-1,o:l.o,u:t.getAttribute(i).split(s),_:t.hasAttribute(l.o),p:t}),t.removeAttribute(i),v()}if(h.test(t.tagName)&&t.textContent.includes(s)){const n=t.textContent.split(s);t.textContent="";for(let s=0;s<n.length-1;s++)n[s]&&t.append(n[s]),t.append(l(i));n[n.length-1]&&t.append(n[n.length-1])}}else if(_.data===i){d++;const t=n.createTextNode("");_.parentNode.insertBefore(t,_),e.currentNode=t,_.remove(),p.push({l:0,h:-1,p:t}),v()}o.currentNode=a;let m=-1,y=0;for(;y<p.length&&2===p[y].l;)y++;for(;y<p.length&&null!==(_=o.nextNode());)for(m++;y<p.length&&p[y].p===_;)for(p[y].h=m,y++;y<p.length&&2===p[y].l;)y++;for(const t of p)t.p=void 0;const w=I();if(void 0!==w){o.currentNode=a;let t=-1;for(;null!==(_=o.nextNode());)t++,"slot"===_.localName&&(this.v=w,(this.m??=[]).push(t))}}}const a=t=>{let s=f.get(t.strings);return void 0===s&&f.set(t.strings,s=new u(t)),s},_={$:(t,s)=>s+1},d={},p=(t,s)=>{const i=l(),n=l();return t.insertBefore(i,s),t.insertBefore(n,s),new F(i,n)},v=t=>null==t?"":`${t}`,m=(t,s)=>{try{t(s)}catch(t){console.error("[vera] ref threw",t)}};class y{t;o;u;m;k;j;S=d;A=null;M=!1;_;constructor(t,s,i,n=!1){const l=s[0];let e="."===l?1:"?"===l?2:"@"===l?4:"&"===l?5:"!"===l?3:0,o=e?s.slice(1):s;1!==e&&3!==e||"__proto__"!==o||(e=-1),0===e&&"o"===l&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(e=4,o=s.slice(2).toLowerCase()),this.k=e,this.o=o,this.t=t,this.u=i,this.m=i.length-1,this.j=1===this.m&&""===i[0]&&""===i[1],this.M=1===e&&"value"===o&&"select"===t.localName,this._=n}I(){const t=this.S;"function"==typeof t?m(t,null):null!==t&&"object"==typeof t&&void 0===t._$apply$&&(t.value=null),this.S=d}handleEvent(t){const s=this.A;"function"==typeof s?s.call(this.t,t):"function"==typeof s?.handleEvent&&s.handleEvent(t)}$(t,s,i){const n=this.k;if(-1===n)return s+this.m;let l;if(this.j||n>=4)l=t[s];else{const i=this.u;let n=i[0];for(let l=0;l<this.m;l++)n+=v(t[s+l])+i[l+1];l=n}if(3===n){if(this.S=l,!i){const t=this.t;t[this.o]!==l&&(t[this.o]=l)}return s+this.m}if(this.M)return this.S=l,i||(w??=[]).push(this.t,l),s+this.m;if(l!==this.S){if(0===n)null==l?(this._||this.S!==d)&&this.t.removeAttribute(this.o):this.t.setAttribute(this.o,l);else if(1===n){const t=this.t,n=this.o;if(i&&("value"===n||"checked"===n||"selected"===n))return this.S=l,s+this.m;t[n]=l}else if(2===n)this.t.toggleAttribute(this.o,!!l);else if(4===n)null===this.A&&null!=l&&this.t.addEventListener(this.o,this),this.A=l??null;else if(null!=l)if(L=!0,"function"==typeof l)m(l,this.t);else if("object"==typeof l){const t=l;t._$apply$?t._$apply$(this.t,this):t.value=this.t}this.S=l}return s+this.m}}let w=null;const $=n.createDocumentFragment(),b={value:!0,enumerable:!1,configurable:!0,writable:!0},k=(t,s=!0)=>{if(b.value=s,11!==t.nodeType)Object.defineProperty(t,"_$own$",b);else for(let s=t.firstChild;null!==s;s=s.nextSibling)Object.defineProperty(s,"_$own$",b)},j=t=>{t.W?.O(),t.F?.L()};class x{i=[];H;constructor(t){this.H=n.importNode(t.t.content,!0);const s=t.i;o.currentNode=this.H;let i=-1,l=null;for(let t=0;t<s.length;t++){const n=s[t];if(2!==n.l){for(;i<n.h;)l=o.nextNode(),i++;this.i.push(0===n.l?new S(l):new y(l,n.o,n.u,n._))}else this.i.push(_)}if(void 0!==t.v&&null!==c){const s=t.m;o.currentNode=this.H,i=-1;const n=[];for(let t=0;t<s.length;t++){for(;i<s[t];)l=o.nextNode(),i++;n.push(l)}this.N=n}}O(){const t=this.i;for(let s=0;s<t.length;s++){const i=t[s];5===i.k&&i.I(),i.V?.L()}this.Z?.forEach((t=>t._$park$?.()))}q(t){let s=0;const i=this.i;for(let n=0;n<i.length;n++)s=i[n].$(t,s);void 0!==this.N&&this.B()}B(){const t=this.N;this.N=void 0;const s=c,i=I();if(void 0!==i&&null!==s)for(let n=0;n<t.length;n++){const l=t[n],e=i(l,s,l.getAttribute("name")??"");null!=e&&((this.Z??=[]).push(e),L=!0)}}}const g=t=>void 0!==t.strings;class S{C;D="";V=null;constructor(t){this.C=t}$(t,s){const i=t[s];if(null!==this.V)return this.V.G(i),s+1;if(null==i||"object"==typeof i){const t=l(),n=l(),e=I()?._$home$?.(this.C)??null,o=null!==e?e.parentNode:this.C.parentNode;null!==e?(o.insertBefore(t,e),o.insertBefore(n,e)):(o.insertBefore(t,this.C),o.insertBefore(n,this.C.nextSibling));const h=new F(t,n);return h.J=E,h.C=this.C,h.D=this.D,this.V=h,h.G(i),s+1}return i!==this.D&&(this.D=i,this.C.data=i),s+1}}let A=null,M=!1;const I=()=>{const t=A?.get("slot")?.[0];return void 0!==t&&(M=!0),t},O=[],W=[];let L=!1;const z=()=>{L=!0},E=1;class F{K;P;J=0;D;C=null;W=null;R=null;T=null;U=!1;X=null;Y=void 0;tt=void 0;constructor(t,s){this.K=t,this.P=s}$(t,s){return this.G(t[s]),s+1}st(t){const s=this.K.parentNode;M&&!0===s._$hosted$&&k(t,null===this.P||this),s.insertBefore(t,this.P)}L(){void 0!==this.tt&&this.tt._$detach$?.(this.Y),this.W?.O();const t=this.T;if(null!=t)for(let s=0;s<t.length;s++)j(t[s])}it(){L&&this.L();const t=this.K.parentNode,s=this.P,i=this.T;if(this.K.nextSibling===s&&0!==this.J)if(null!==i){for(const t of i)null!==t&&this.$m(t,null,$);$.textContent=""}else if(this.J===E)this.C?.remove();else if(2===this.J){if(Array.isArray(this.D))for(const t of this.D)t.remove()}else 4===this.J&&"function"==typeof this.D.remove&&this.D.remove();else if(null!==this.K.previousSibling||null!==s&&null!==s.nextSibling){let s=this.K.nextSibling;for(;null!==s&&s!==this.P;){const i=s.nextSibling;t.removeChild(s),s=i}}else t.textContent="",t.appendChild(this.K),null!==s&&t.appendChild(s);this.J=0,this.C=null,this.W=null,this.T=null,this.R=null,this.Y=void 0,this.tt=void 0}_$commit$(t){const s=this.Y,i=this.tt;this.G(t),this.Y=s,this.tt=i}G(t){if(null==t)return void(0!==this.J&&this.it());if("object"!=typeof t)return void(this.J===E?this.D!==t&&(this.D=t,this.C.data=t):(0!==this.J&&this.it(),this.C=n.createTextNode(t),this.st(this.C),this.D=t,this.J=E));const s=t.$h;if(void 0!==s)return void this.nt(s);if(g(t)){if(this.R===t.strings)return void this.W.q(t.values);const s=a(t);0!==this.J&&this.it();const i=new x(s);return i.q(t.values),this.D=[...i.H.childNodes],this.st(i.H),this.W=i,this.R=t.strings,void(this.J=2)}const i=A?A.get("value")??O:O;for(let s=0;s<i.length;s++)if(i[s](this,t))return;for(let s=0;s<W.length;s++)if(W[s](this,t))return;const l=t._$child$;if(void 0!==l){const s=this.tt===l?this.Y:void 0;return this.tt=l,void 0!==l._$detach$&&(L=!0),void(this.Y=l.call(t,this,s))}void 0===t.nodeType?this.G(String(t)):4===this.J&&this.D===t||(0!==this.J&&this.it(),this.st(t),this.D=t,this.J=4)}nt(t){if(2===this.J&&this.R===t.strings)return void this.W.q(t.values);const s=this.X??=new Map;if(2===this.J){const t=this.W.H;if(this.K.nextSibling===this.P&&Array.isArray(this.D))for(const s of this.D)t.appendChild(s);else{let s=this.K.nextSibling;for(;s!==this.P;){const i=s.nextSibling;t.appendChild(s),s=i}}s.set(this.R,this.W)}else 0!==this.J&&this.it();const i=s.get(t.strings)??new x(a(t));i.q(t.values),this.D=[...i.H.childNodes],this.st(i.H),this.W=i,this.R=t.strings,this.J=2}$c(t,s,i){const n=M&&!0===s._$hosted$?null===this.P||this:null;if(null!==t&&"object"==typeof t&&void 0!==t.strings){const l=t,e=a(l),o=new x(e);o.q(l.values);const h=o.H.firstChild;if(null!==h&&1===h.nodeType&&null===h.nextSibling)return null!==n&&k(h,n),s.insertBefore(h,i),{$k:l.key,t:h,W:o,R:l.strings,F:null};const r=p(s,i);return r.W=o,r.R=l.strings,r.J=2,r.D=[...o.H.childNodes],null!==n&&k(o.H,n),r.K.parentNode.insertBefore(o.H,r.P),{$k:l.key,t:null,W:null,R:null,F:r}}const l=p(s,i);return l.G(t),{$k:t?.key,t:null,W:null,R:null,F:l}}$u(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.R)return void t.W.q(s.values);const i=p(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.W=null,t.R=null,void(t.F=i).G(s)}t.F.G(s)}$f(t){return t.t??t.F.K}$m(t,s,i=this.K.parentNode){const n=t.t??t.F.P;if(n.nextSibling===s&&n.parentNode===i)return;if(null!==t.t)return void i.insertBefore(t.t,s);let l=t.F.K;const e=t.F.P.nextSibling;for(;l!==e;){const t=l.nextSibling;i.insertBefore(l,s),l=t}}$d(t){L&&j(t),this.$m(t,null,$),$.textContent=""}lt(t){3!==this.J&&(0!==this.J&&this.it(),this.T=[],this.U=!1,this.J=3);const s=t.length;if(0===s)return void(this.T.length&&(this.it(),this.T=[],this.J=3));const i=null!=t[0]&&void 0!==t[0].$r;i!==this.U&&this.T.length&&(this.it(),this.T=[],this.J=3),this.U=i;const l=this.T;if(0!==l.length)if(i)this.T=t[0].$r(this,t,l,this.K.parentNode,this.P);else{const i=l.length<s?l.length:s;for(let s=0;s<i;s++)this.$u(l[s],t[s]);if(s>l.length){const i=n.createDocumentFragment();for(let n=l.length;n<s;n++)l.push(this.$c(t[n],i,null));this.st(i)}else if(s<l.length){if(L)for(let t=s;t<l.length;t++)j(l[t]);for(let t=s;t<l.length;t++)this.$m(l[t],null,$);$.textContent="",l.length=s}}else{const i=n.createDocumentFragment();for(let n=0;n<s;n++)l.push(this.$c(t[n],i,null));this.st(i)}}}const H=new WeakMap,N=(t,s)=>{let i=H.get(s);if(void 0===i){const t=l();s.appendChild(t),1===s.nodeType&&I()?._$capture$?.(s,t),H.set(s,i=new F(t,null))}c=s;try{i.G(t)}finally{c=null,(()=>{const t=w;if(null!==t){w=null;for(let s=0;s<t.length;s+=2)t[s].value=t[s+1]}})()}};W.push(((t,s)=>Array.isArray(s)?(t.lt(s),!0):null!==s&&"function"==typeof s[Symbol.iterator]&&(t.lt([...s]),!0)));const V={name:"@verajs/renderer",on:"render",fn:N,priority:50,connect:t=>{A=t}},Z={},q=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),B=t=>{for(;0===t.offset&&null!==t.node&&8===t.node.nodeType;)t.node=t.node.nextSibling},C=new WeakMap;let D=null,G=!1,J=[];const K=(t,s)=>{const i=s.et.i;for(let l=t.firstChild;null!==l;l=l.nextSibling)if(1===l.nodeType||3===l.nodeType){for(s.ot++;s.ht<i.length&&i[s.ht].h===s.ot;)s.rt+=1===(n=i[s.ht]).l?n.u.length-1:1,s.ht++;1===l.nodeType&&K(l,s)}var n},P=(t,s,i)=>{i.ot++;const n=i.et.i;if(3===t.nodeType){let l=!1;for(;i.ht<n.length&&n[i.ht].h===i.ot;)l=!0,i.ht++,R(s,i.ct[i.rt++],i.ft),Q(i);return void(l||((t,s)=>{let i=s;for(;i.length>0;){B(t);const s=t.node;if(null===s||3!==s.nodeType)throw Z;const n=s.data,l=n.length-t.offset;if(0===l){t.node=s.nextSibling,t.offset=0;continue}const e=l<i.length?l:i.length;if(n.slice(t.offset,t.offset+e)!==i.slice(0,e))throw Z;i=i.slice(e),t.offset+=e,t.offset===n.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}if(void 0!==i.et.v&&"slot"===t.localName)return void((t,s,i)=>{const n=i.et.v._$adopt$,l=t.cloneNode(!1),e=i.et.i;for(;i.ht<e.length&&e[i.ht].h===i.ot;){const t=e[i.ht++],s=new y(l,t.o,t.u,t._);i.ft.push(s),i.rt=s.$(i.ct,i.rt,!0),Q(i)}const o=l.getAttribute("name")??"";B(s);const h=s.parent,r=[];if(""!==o){let t=q(s);for(;null!==t&&1===t.nodeType&&t.getAttribute("slot")===o;)r.push(t),s.node=t.nextSibling,t=q(s)}else if(!G){const t=h.getAttribute?.("data-vm-slotted"),i=null==t?0:Number(t.slice(t.indexOf(",")+1));if(i>0){G=!0,h.removeAttribute("data-vm-slotted");for(let t=0;t<i;t++){const t=q(s);if(null===t)break;r.push(t),s.node=t.nextSibling}}}if(r.length>0){const e=s.node,c=[];for(let s=t.firstChild;null!==s;s=s.nextSibling)1!==s.nodeType&&3!==s.nodeType||c.push(s.cloneNode(!0));K(t,i);const f=n(D,o,r,c,h,e,l);J.push(f),(i.Z??=[]).push(f),z()}else{const e=s.node;for(let n=t.firstChild;null!==n;n=n.nextSibling)1!==n.nodeType&&3!==n.nodeType||P(n,s,i);const r=[];for(let t=e;null!==t&&t!==s.node;t=t.nextSibling)r.push(t);const c=n(D,o,null,r,h,s.node,l);J.push(c),(i.Z??=[]).push(c),z()}})(t,s,i);B(s);const l=q(s);if(null===l||1!==l.nodeType)throw Z;if(l.localName!==t.localName)throw Z;for(;i.ht<n.length&&n[i.ht].h===i.ot;){const t=n[i.ht++],s=new y(l,t.o,t.u,t._);i.ft.push(s),i.rt=s.$(i.ct,i.rt,!0),Q(i)}const e={parent:l,node:l.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||P(o,e,i),o=o.nextSibling;if(null!==e.node&&3===e.node.nodeType&&null===e.node.nextSibling&&null===t.firstChild&&"textarea"===l.localName&&(e.node=null),B(e),null!==e.node&&(3!==e.node.nodeType||""!==e.node.data||null!==e.node.nextSibling))throw Z;s.node=l.nextSibling,s.offset=0},Q=t=>{const s=t.et.i;for(;t.ht<s.length&&2===s[t.ht].l;)t.ft.push(_),t.rt++,t.ht++},R=(t,s,i)=>{const e=s?.$h,o=void 0!==e?e:s;if(null!=o&&("object"!=typeof o||!g(o)&&void 0===o.nodeType&&"function"!=typeof o[Symbol.iterator])){const s=new S(((t,s)=>{const i=q(t);if(""===s){const s=n.createTextNode("");return t.parent.insertBefore(s,i),s}if(null===i||3!==i.nodeType)throw Z;const l=i;if(l.data.length>s.length&&l.splitText(s.length),l.data!==s)throw Z;return t.node=l.nextSibling,t.offset=0,l})(t,v(o)));return s.D=o,void i.push(s)}const h=l();t.parent.insertBefore(h,q(t));const r=new F(h,null);if(null==o);else if(g(o))r.W=U(a(o),o.values,t),r.R=o.strings,r.J=2;else if(void 0!==o.nodeType)t.parent.insertBefore(o,q(t)),r.D=o,r.J=4;else{const s=Array.isArray(o)?o:[...o],i=[];for(const n of s)i.push(T(t,n));r.T=i,r.U=s.length>0&&void 0!==s[0]?.$r,r.J=3}const c=l();t.parent.insertBefore(c,q(t)),r.P=c,i.push(r)},T=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const i=s,n=a(i),e=n.t.content.firstChild;if(null!==e&&1===e.nodeType&&null===e.nextSibling){const s=q(t),l=U(n,i.values,t);return{$k:i.key,t:s,W:l,R:i.strings,F:null}}const o=l();t.parent.insertBefore(o,q(t));const h=U(n,i.values,t),r=l();t.parent.insertBefore(r,q(t));const c=new F(o,r);return c.W=h,c.R=i.strings,c.J=2,{$k:i.key,t:null,W:null,R:null,F:c}}const i=[];return R(t,s,i),{$k:s?.key,t:null,W:null,R:null,F:i[0]}},U=(t,s,i)=>{const l=Object.create(x.prototype);l.i=[],l.H=n.createDocumentFragment();const e={et:t,ct:s,rt:0,ht:0,ot:-1,ft:l.i};Q(e),(t=>{let s=C.get(t);if(void 0===s){let i;for(s=[],o.currentNode=t.t.content;null!==(i=o.nextNode());)s.push(i);C.set(t,s)}})(t);let h=t.t.content.firstChild;for(;null!==h;)1!==h.nodeType&&3!==h.nodeType||P(h,i,e),h=h.nextSibling;if(Q(e),e.ht!==t.i.length)throw Z;return void 0!==e.Z&&(l.Z=e.Z),l},X=(t,s)=>{if(!H.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&g(t)){const i=((t,s)=>{let i=s.firstChild;for(;null!==i&&1===i.nodeType&&i.hasAttribute("data-vm-sheet");)i=i.nextSibling;const n=l();s.insertBefore(n,i),D=1===s.nodeType?s:null,G=!1,J=[];try{const i={parent:s,node:n.nextSibling,offset:0},l=U(a(t),t.values,i);if(B(i),null!==i.node)throw Z;const e=new F(n,null);return e.W=l,e.R=t.strings,e.J=2,e}catch(t){if(t!==Z)throw t;for(const t of J)t._$park$();return J=[],n.remove(),null}})(t,s);if(null!==i)return void H.set(s,i);const n=1===s.nodeType?I()?._$rescue$?.(s):null;if((t=>{let s=t.firstChild;for(;null!==s;){const i=s.nextSibling;1===s.nodeType&&s.hasAttribute("data-vm-sheet")||t.removeChild(s),s=i}})(s),null!=n)for(const t of n)s.appendChild(t)}N(t,s)},Y={...V,fn:X};export{t as hold,X as renderInto,Y as renderer};
2
2
  //# sourceMappingURL=vera-renderer-hydrate.min.js.map