diff --git a/esm/handler.js b/esm/handler.js index 5b40fee..196835e 100644 --- a/esm/handler.js +++ b/esm/handler.js @@ -194,7 +194,9 @@ export function hole(node, value) { } case 'object': case 'undefined': { - n.replaceWith((this.n = value == null ? node : value.valueOf())); + if (value == null) (this.n = node).data = ''; + else this.n = value.valueOf(); + n.replaceWith(this.n); break; } } diff --git a/index.js b/index.js index 7d34a1a..7359265 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ -const{isArray:e}=Array,t=[],n=()=>document.createRange(),r=(e,t,n)=>(e.set(t,n),n),s=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),l=e=>({s:e,t:null,n:null,d:t}),{setPrototypeOf:o}=Object;let i;var c=(e,t,r)=>(i||(i=n()),r?i.setStartAfter(e):i.setStartBefore(e),i.setEndAfter(t),i.deleteContents(),e);const a=({firstChild:e,lastChild:t})=>c(e,t,!0);let u=!1;const h=(e,t)=>u&&11===e.nodeType?1/t<0?t?a(e):e.lastChild:t?e.valueOf():e.firstChild:e;class d extends((e=>{function t(e){return o(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,u=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){a(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const f=(e,t)=>t.reduceRight(p,e),p=(e,t)=>e.childNodes[t];var g=e=>(n,r)=>{const{c:s,e:l,l:o}=e(n,r),i=s.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):t;for(;u--;){const{t:e,p:n,u:s,n:o}=l[u],d=n===a?c:c=f(i,a=n),p=8===e?s():s;h[u]={v:p(d,r[u],o,t),u:p,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild:new d(i),h)};const m=/^(?:plaintext|script|style|textarea|title|xmp)$/i,v=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,x=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,b=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,$=/[\x01\x02]/g;let C;const w=(t,n,s)=>{s=s.slice(1),C||(C=new WeakMap);const l=C.get(t)||r(C,t,{});let o=l[s];return o&&o[0]&&t.removeEventListener(...o),o=e(n)?n:[n,!1],l[s]=o,o[0]&&t.addEventListener(...o),n},y=(e,t,n)=>e[n]=t,N=(e,t,n)=>y(e,t,n.slice(1)),A=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),W=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,n,r,s)=>n.length?((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cs-a){const l=r(t[c],0);for(;a{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?e.removeAttribute(s):e.setAttribute(s,r)}return t}],["class",(e,t)=>y(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>y(e.style,t,"cssText")]]),M=(e,t)=>{switch(t[0]){case".":return N;case"?":return W;case"@":return w;default:return E.get(t)||(t in e?y:A)}},O=(e,t)=>(e.texContent=null==t?"":t,t);function S(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":n.replaceWith(this.n=null==t?e:t.valueOf())}return t}let T,B,j=document.createElement("template");var L=(e,t)=>{if(t)return T||(T=document.createElementNS("http://www.w3.org/2000/svg","svg"),B=n(),B.selectNodeContents(T)),B.createContextualFragment(e);j.innerHTML=e;const{content:r}=j;return j=j.cloneNode(!1),r};const z=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},F=()=>S.bind({n:null}),R=()=>k,Z=(n,l,o)=>{const i=L(((e,t,n)=>{let r=0;return e.join("").trim().replace(x,((e,t,r,s)=>`<${t}${r.replace(b,"=$2$1").trimEnd()}${s?n||v.test(t)?" /":`>`)).replace($,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(n,H,o),o);let c=t;const{length:a}=n;if(a>1){const t=document.createTreeWalker(i,129),n=[];let r=0,o=`${H}${r++}`;for(c=[];r(t,n)=>D.get(t)||Z(t,n,e);const _=g(P(!1)),q=g(P(!0)),G=(e,{s:n,t:r,v:s})=>{if(s.length&&e.s===t&&(e.s=[]),I(e,s),e.t!==r){const{n:t,d:l}=(n?q:_)(r,s);e.t=r,e.n=t,e.d=l}else{const{d:t}=e;for(let e=0;e{const{length:s}=r;for(let o=0;o{const s=K.get(e)||r(K,e,l(t));return s.n!==G(s,"function"==typeof n?n():n)&&e.replaceChildren(s.n),e}; +const{isArray:e}=Array,t=[],n=()=>document.createRange(),s=(e,t,n)=>(e.set(t,n),n),r=(e,t,n,s="")=>({t:e,p:t,u:n,n:s}),l=e=>({s:e,t:null,n:null,d:t}),{setPrototypeOf:o}=Object;let i;var c=(e,t,s)=>(i||(i=n()),s?i.setStartAfter(e):i.setStartBefore(e),i.setEndAfter(t),i.deleteContents(),e);const a=({firstChild:e,lastChild:t})=>c(e,t,!0);let u=!1;const h=(e,t)=>u&&11===e.nodeType?1/t<0?t?a(e):e.lastChild:t?e.valueOf():e.firstChild:e;class d extends((e=>{function t(e){return o(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,u=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){a(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const f=(e,t)=>t.reduceRight(p,e),p=(e,t)=>e.childNodes[t];var g=e=>(n,s)=>{const{c:r,e:l,l:o}=e(n,s),i=r.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):t;for(;u--;){const{t:e,p:n,u:r,n:o}=l[u],d=n===a?c:c=f(i,a=n),p=8===e?r():r;h[u]={v:p(d,s[u],o,t),u:p,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild:new d(i),h)};const m=/^(?:plaintext|script|style|textarea|title|xmp)$/i,v=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,x=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,b=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,$=/[\x01\x02]/g;let C;const w=(t,n,r)=>{r=r.slice(1),C||(C=new WeakMap);const l=C.get(t)||s(C,t,{});let o=l[r];return o&&o[0]&&t.removeEventListener(...o),o=e(n)?n:[n,!1],l[r]=o,o[0]&&t.addEventListener(...o),n},y=(e,t,n)=>e[n]=t,N=(e,t,n)=>y(e,t,n.slice(1)),A=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),W=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,n,s,r)=>n.length?((e,t,n,s,r)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cr-a){const l=s(t[c],0);for(;a{for(const n in t){const s=t[n],r="role"===n?n:`aria-${n}`;null==s?e.removeAttribute(r):e.setAttribute(r,s)}return t}],["class",(e,t)=>y(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>y(e.style,t,"cssText")]]),M=(e,t)=>{switch(t[0]){case".":return N;case"?":return W;case"@":return w;default:return E.get(t)||(t in e?y:A)}},O=(e,t)=>(e.texContent=null==t?"":t,t);function S(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}let T,B,j=document.createElement("template");var L=(e,t)=>{if(t)return T||(T=document.createElementNS("http://www.w3.org/2000/svg","svg"),B=n(),B.selectNodeContents(T)),B.createContextualFragment(e);j.innerHTML=e;const{content:s}=j;return j=j.cloneNode(!1),s};const z=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},F=()=>S.bind({n:null}),R=()=>k,Z=(n,l,o)=>{const i=L(((e,t,n)=>{let s=0;return e.join("").trim().replace(x,((e,t,s,r)=>`<${t}${s.replace(b,"=$2$1").trimEnd()}${r?n||v.test(t)?" /":`>`)).replace($,(e=>""===e?`\x3c!--${t+s++}--\x3e`:t+s++))})(n,H,o),o);let c=t;const{length:a}=n;if(a>1){const t=document.createTreeWalker(i,129),n=[];let s=0,o=`${H}${s++}`;for(c=[];s(t,n)=>D.get(t)||Z(t,n,e);const _=g(P(!1)),q=g(P(!0)),G=(e,{s:n,t:s,v:r})=>{if(r.length&&e.s===t&&(e.s=[]),I(e,r),e.t!==s){const{n:t,d:l}=(n?q:_)(s,r);e.t=s,e.n=t,e.d=l}else{const{d:t}=e;for(let e=0;e{const{length:r}=s;for(let o=0;o{const r=K.get(e)||s(K,e,l(t));return r.n!==G(r,"function"==typeof n?n():n)&&e.replaceChildren(r.n),e}; /*! (c) Andrea Giammarchi - MIT */const U=e=>(t,...n)=>new J(e,t,n),V=U(!1),X=U(!0);export{J as Hole,E as attr,V as html,Q as render,X as svg}; diff --git a/keyed.js b/keyed.js index 034a1da..3c3a56a 100644 --- a/keyed.js +++ b/keyed.js @@ -1,3 +1,3 @@ -const{isArray:e}=Array,t=[],n=()=>document.createRange(),r=(e,t,n)=>(e.set(t,n),n),s=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),l=e=>({s:e,t:null,n:null,d:t}),{setPrototypeOf:o}=Object;let i;var c=(e,t,r)=>(i||(i=n()),r?i.setStartAfter(e):i.setStartBefore(e),i.setEndAfter(t),i.deleteContents(),e);const a=({firstChild:e,lastChild:t})=>c(e,t,!0);let u=!1;const h=(e,t)=>u&&11===e.nodeType?1/t<0?t?a(e):e.lastChild:t?e.valueOf():e.firstChild:e;class d extends((e=>{function t(e){return o(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,u=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){a(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const f=(e,t)=>t.reduceRight(p,e),p=(e,t)=>e.childNodes[t];var g=e=>(n,r)=>{const{c:s,e:l,l:o}=e(n,r),i=s.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):t;for(;u--;){const{t:e,p:n,u:s,n:o}=l[u],d=n===a?c:c=f(i,a=n),p=8===e?s():s;h[u]={v:p(d,r[u],o,t),u:p,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild:new d(i),h)};const m=/^(?:plaintext|script|style|textarea|title|xmp)$/i,v=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,b=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,x=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,$=/[\x01\x02]/g;let w;const C=(t,n,s)=>{s=s.slice(1),w||(w=new WeakMap);const l=w.get(t)||r(w,t,{});let o=l[s];return o&&o[0]&&t.removeEventListener(...o),o=e(n)?n:[n,!1],l[s]=o,o[0]&&t.addEventListener(...o),n},y=(e,t,n)=>e[n]=t,N=(e,t,n)=>y(e,t,n.slice(1)),A=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),W=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,n,r,s)=>n.length?((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cs-a){const l=r(t[c],0);for(;a{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?e.removeAttribute(s):e.setAttribute(s,r)}return t}],["class",(e,t)=>y(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>y(e.style,t,"cssText")]]),E=(e,t)=>{switch(t[0]){case".":return N;case"?":return W;case"@":return C;default:return M.get(t)||(t in e?y:A)}},O=(e,t)=>(e.texContent=null==t?"":t,t);function S(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":n.replaceWith(this.n=null==t?e:t.valueOf())}return t}let T,B,j=document.createElement("template");var L=(e,t)=>{if(t)return T||(T=document.createElementNS("http://www.w3.org/2000/svg","svg"),B=n(),B.selectNodeContents(T)),B.createContextualFragment(e);j.innerHTML=e;const{content:r}=j;return j=j.cloneNode(!1),r};const z=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},F=()=>S.bind({n:null}),R=()=>k,Z=(n,l,o)=>{const i=L(((e,t,n)=>{let r=0;return e.join("").trim().replace(b,((e,t,r,s)=>`<${t}${r.replace(x,"=$2$1").trimEnd()}${s?n||v.test(t)?" /":`>`)).replace($,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(n,H,o),o);let c=t;const{length:a}=n;if(a>1){const t=document.createTreeWalker(i,129),n=[];let r=0,o=`${H}${r++}`;for(c=[];r(t,n)=>D.get(t)||Z(t,n,e);const _=g(P(!1)),q=g(P(!0)),G=(e,{s:n,t:r,v:s})=>{if(s.length&&e.s===t&&(e.s=[]),I(e,s),e.t!==r){const{n:t,d:l}=(n?q:_)(r,s);e.t=r,e.n=t,e.d=l}else{const{d:t}=e;for(let e=0;e{const{length:s}=r;for(let o=0;odocument.createRange(),r=(e,t,n)=>(e.set(t,n),n),s=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),l=e=>({s:e,t:null,n:null,d:t}),{setPrototypeOf:o}=Object;let i;var c=(e,t,r)=>(i||(i=n()),r?i.setStartAfter(e):i.setStartBefore(e),i.setEndAfter(t),i.deleteContents(),e);const a=({firstChild:e,lastChild:t})=>c(e,t,!0);let u=!1;const h=(e,t)=>u&&11===e.nodeType?1/t<0?t?a(e):e.lastChild:t?e.valueOf():e.firstChild:e;class d extends((e=>{function t(e){return o(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,u=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){a(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const f=(e,t)=>t.reduceRight(p,e),p=(e,t)=>e.childNodes[t];var g=e=>(n,r)=>{const{c:s,e:l,l:o}=e(n,r),i=s.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):t;for(;u--;){const{t:e,p:n,u:s,n:o}=l[u],d=n===a?c:c=f(i,a=n),p=8===e?s():s;h[u]={v:p(d,r[u],o,t),u:p,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild:new d(i),h)};const m=/^(?:plaintext|script|style|textarea|title|xmp)$/i,v=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,b=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,x=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,$=/[\x01\x02]/g;let w;const C=(t,n,s)=>{s=s.slice(1),w||(w=new WeakMap);const l=w.get(t)||r(w,t,{});let o=l[s];return o&&o[0]&&t.removeEventListener(...o),o=e(n)?n:[n,!1],l[s]=o,o[0]&&t.addEventListener(...o),n},y=(e,t,n)=>e[n]=t,N=(e,t,n)=>y(e,t,n.slice(1)),A=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),W=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,n,r,s)=>n.length?((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cs-a){const l=r(t[c],0);for(;a{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?e.removeAttribute(s):e.setAttribute(s,r)}return t}],["class",(e,t)=>y(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>y(e.style,t,"cssText")]]),E=(e,t)=>{switch(t[0]){case".":return N;case"?":return W;case"@":return C;default:return M.get(t)||(t in e?y:A)}},O=(e,t)=>(e.texContent=null==t?"":t,t);function S(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}let T,B,j=document.createElement("template");var L=(e,t)=>{if(t)return T||(T=document.createElementNS("http://www.w3.org/2000/svg","svg"),B=n(),B.selectNodeContents(T)),B.createContextualFragment(e);j.innerHTML=e;const{content:r}=j;return j=j.cloneNode(!1),r};const z=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},F=()=>S.bind({n:null}),R=()=>k,Z=(n,l,o)=>{const i=L(((e,t,n)=>{let r=0;return e.join("").trim().replace(b,((e,t,r,s)=>`<${t}${r.replace(x,"=$2$1").trimEnd()}${s?n||v.test(t)?" /":`>`)).replace($,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(n,H,o),o);let c=t;const{length:a}=n;if(a>1){const t=document.createTreeWalker(i,129),n=[];let r=0,o=`${H}${r++}`;for(c=[];r(t,n)=>D.get(t)||Z(t,n,e);const _=g(P(!1)),q=g(P(!0)),G=(e,{s:n,t:r,v:s})=>{if(s.length&&e.s===t&&(e.s=[]),I(e,s),e.t!==r){const{n:t,d:l}=(n?q:_)(r,s);e.t=r,e.n=t,e.d=l}else{const{d:t}=e;for(let e=0;e{const{length:s}=r;for(let o=0;o(t,...n)=>new J(e,t,n),Q=K(!1),U=K(!0),V=new WeakMap;var X=(e,n)=>{const s=V.get(e)||r(V,e,l(t)),o="function"==typeof n?n():n,{n:i}=s,c=o instanceof J?G(s,o):o;return i!==c&&e.replaceChildren(s.n=c),e}; /*! (c) Andrea Giammarchi - MIT */const Y=new WeakMap,ee=e=>(n,s)=>{const o=Y.get(n)||r(Y,n,new Map);return o.get(s)||r(o,s,function(t,...n){return G(this,new J(e,t,n))}.bind(l(t)))},te=ee(!1),ne=ee(!0);export{J as Hole,M as attr,Q as html,te as htmlFor,X as render,U as svg,ne as svgFor}; diff --git a/node.js b/node.js index 5d134e8..b8c28c1 100644 --- a/node.js +++ b/node.js @@ -1,3 +1,3 @@ -const{setPrototypeOf:e}=Object;const{isArray:t}=Array,n=[],r=()=>document.createRange(),s=(e,t,n)=>(e.set(t,n),n);let l;var o=(e,t,n)=>(l||(l=r()),n?l.setStartAfter(e):l.setStartBefore(e),l.setEndAfter(t),l.deleteContents(),e);const i=({firstChild:e,lastChild:t})=>o(e,t,!0);let c=!1;const a=(e,t)=>c&&11===e.nodeType?1/t<0?t?i(e):e.lastChild:t?e.valueOf():e.firstChild:e;class u extends((t=>{function n(t){return e(t,new.target.prototype)}return n.prototype=t.prototype,n})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,c=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){i(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const h=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),d=(e,t)=>t.reduceRight(f,e),f=(e,t)=>e.childNodes[t];const p=/^(?:plaintext|script|style|textarea|title|xmp)$/i,g=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,m=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,x=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,b=/[\x01\x02]/g;let v;const $=(e,n,r)=>{r=r.slice(1),v||(v=new WeakMap);const l=v.get(e)||s(v,e,{});let o=l[r];return o&&o[0]&&e.removeEventListener(...o),o=t(n)?n:[n,!1],l[r]=o,o[0]&&e.addEventListener(...o),n},C=(e,t,n)=>e[n]=t,y=(e,t,n)=>C(e,t,n.slice(1)),N=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),A=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),w=(e,t,r,s)=>t.length?((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cs-a){const l=r(t[c],0);for(;a{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?e.removeAttribute(s):e.setAttribute(s,r)}return t}],["class",(e,t)=>C(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>C(e.style,t,"cssText")]]),k=(e,t)=>{switch(t[0]){case".":return y;case"?":return A;case"@":return $;default:return W.get(t)||(t in e?C:N)}},E=(e,t)=>(e.texContent=null==t?"":t,t);function O(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":n.replaceWith(this.n=null==t?e:t.valueOf())}return t}let S,T,B=document.createElement("template");var M=(e,t)=>{if(t)return S||(S=document.createElementNS("http://www.w3.org/2000/svg","svg"),T=r(),T.selectNodeContents(S)),T.createContextualFragment(e);B.innerHTML=e;const{content:n}=B;return B=B.cloneNode(!1),n};const j=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},L=()=>O.bind({n:null}),z=()=>w,F=(e,r,l)=>{const o=M(((e,t,n)=>{let r=0;return e.join("").trim().replace(m,((e,t,r,s)=>`<${t}${r.replace(x,"=$2$1").trimEnd()}${s?n||g.test(t)?" /":`>`)).replace(b,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(e,Z,l),l);let i=n;const{length:c}=e;if(c>1){const e=document.createTreeWalker(o,129),n=[];let s=0,l=`${Z}${s++}`;for(i=[];s(e.replaceChildren("function"==typeof t?t():t),e); +const{setPrototypeOf:e}=Object;const{isArray:t}=Array,n=[],r=()=>document.createRange(),s=(e,t,n)=>(e.set(t,n),n);let l;var o=(e,t,n)=>(l||(l=r()),n?l.setStartAfter(e):l.setStartBefore(e),l.setEndAfter(t),l.deleteContents(),e);const i=({firstChild:e,lastChild:t})=>o(e,t,!0);let c=!1;const a=(e,t)=>c&&11===e.nodeType?1/t<0?t?i(e):e.lastChild:t?e.valueOf():e.firstChild:e;class u extends((t=>{function n(t){return e(t,new.target.prototype)}return n.prototype=t.prototype,n})(DocumentFragment)){#e;#t;constructor(e){super(e),this.#e=[...e.childNodes],this.#t=this.#e.length,c=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}replaceWith(e){i(this).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.append(...this.#e),this}}const h=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),d=(e,t)=>t.reduceRight(f,e),f=(e,t)=>e.childNodes[t];const p=/^(?:plaintext|script|style|textarea|title|xmp)$/i,g=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,m=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,x=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,b=/[\x01\x02]/g;let v;const $=(e,n,r)=>{r=r.slice(1),v||(v=new WeakMap);const l=v.get(e)||s(v,e,{});let o=l[r];return o&&o[0]&&e.removeEventListener(...o),o=t(n)?n:[n,!1],l[r]=o,o[0]&&e.addEventListener(...o),n},C=(e,t,n)=>e[n]=t,y=(e,t,n)=>C(e,t,n.slice(1)),N=(e,t,n)=>(null==t?e.removeAttribute(n):e.setAttribute(n,t),t),A=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),w=(e,t,r,s)=>t.length?((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;cs-a){const l=r(t[c],0);for(;a{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?e.removeAttribute(s):e.setAttribute(s,r)}return t}],["class",(e,t)=>C(e,t,"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",(e,t)=>("function"==typeof t?t(e):t.current=e,t)],["style",(e,t)=>C(e.style,t,"cssText")]]),k=(e,t)=>{switch(t[0]){case".":return y;case"?":return A;case"@":return $;default:return W.get(t)||(t in e?C:N)}},E=(e,t)=>(e.texContent=null==t?"":t,t);function O(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}let S,T,B=document.createElement("template");var M=(e,t)=>{if(t)return S||(S=document.createElementNS("http://www.w3.org/2000/svg","svg"),T=r(),T.selectNodeContents(S)),T.createContextualFragment(e);B.innerHTML=e;const{content:n}=B;return B=B.cloneNode(!1),n};const j=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},L=()=>O.bind({n:null}),z=()=>w,F=(e,r,l)=>{const o=M(((e,t,n)=>{let r=0;return e.join("").trim().replace(m,((e,t,r,s)=>`<${t}${r.replace(x,"=$2$1").trimEnd()}${s?n||g.test(t)?" /":`>`)).replace(b,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(e,Z,l),l);let i=n;const{length:c}=e;if(c>1){const e=document.createTreeWalker(o,129),n=[];let s=0,l=`${Z}${s++}`;for(i=[];s(e.replaceChildren("function"==typeof t?t():t),e); /*! (c) Andrea Giammarchi - MIT */ const H=e=>{const t=(e=>(t,r)=>{const{c:s,e:l,l:o}=e(t,r),i=s.cloneNode(!0);let c,a,h=l.length,f=h?l.slice(0):n;for(;h--;){const{t:e,p:t,u:s,n:o}=l[h],u=t===a?c:c=d(i,a=t),p=8===e?s():s;f[h]={v:p(u,r[h],o,n),u:p,t:u,n:o}}return{n:1===o?i.firstChild:new u(i),d:f}})((r=e,(e,t)=>R.get(e)||F(e,t,r)));var r;return(e,...n)=>t(e,n).n},P=H(!1),_=H(!0);export{W as attr,P as html,D as render,_ as svg};