@estjs/template 0.0.15-beta.9 → 0.0.15

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.
@@ -1,3 +1,3 @@
1
- import {isHTMLElement,isPrimitive,isFalsy,error,isHtmlInputElement,isHtmlSelectElement,isHtmlTextAreaElement,isFunction,isObject,startsWith,isString,normalizeClassName,isArray,camelCase,capitalize,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isUndefined,isPromise,isNumber,coerceArray,isTextNode}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,signal}from'@estjs/signals';var Qe=Object.defineProperty;var Ne=Object.getOwnPropertySymbols;var Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var Se=(e,t,o)=>t in e?Qe(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o,O=(e,t)=>{for(var o in t||(t={}))Ze.call(t,o)&&Se(e,o,t[o]);if(Ne)for(var o of Ne(t))et.call(t,o)&&Se(e,o,t[o]);return e};var V=(e,t,o)=>new Promise((n,r)=>{var s=c=>{try{a(o.next(c));}catch(f){r(f);}},i=c=>{try{a(o.throw(c));}catch(f){r(f);}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,i);a((o=o.apply(e,t)).next());});var R=null,tt=0;function N(){return R}function ve(e){R=e;}function q(e=R){let t={id:++tt,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(t)),t}function b(e,t){let o=R;R=e;try{return t()}finally{R=o;}}function j(e){var t,o,n,r,s;if(!(!e||e.isDestroyed)){if(e.children)for(;e.children.size>0;){let i=e.children.values().next().value;i&&j(i);}if(e.onDestroy){for(let i of e.onDestroy)try{i();}catch(a){}e.onDestroy.clear();}if(e.cleanup){for(let i of e.cleanup)try{i();}catch(a){}e.cleanup.clear();}(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),(o=e.children)==null||o.clear(),(n=e.provides)==null||n.clear(),(r=e.onMount)==null||r.clear(),(s=e.onUpdate)==null||s.clear(),ve(e.parent),e.parent=null,e.isDestroyed=true;}}function F(e){let t=R;t&&(t.cleanup||(t.cleanup=new Set),t.cleanup.add(e));}var Ee="_$spread$";var xe="http://www.w3.org/2000/svg",B="http://www.w3.org/2000/xlink",J="http://www.w3.org/2000/xmlns/";var Ae=1e3,be=new WeakMap;function Pe(e){let t=be.get(e);if(!t){let o=e.name||"anonymous",n=ke(e.toString()).toString(36);t=`${o}_${n}`,be.set(e,t);}return t}function ke(e){let t=0,o=e.length<100?e.length:100;for(let n=0;n<o;n++)t=Math.trunc((t<<5)-t+e.charCodeAt(n));return t<0?-t:t}var it=0;function Z(e){if(!isFalsy(e)){if(isString(e))return e.length<=Ae?e:`${e.slice(0,Ae-10)}_${ke(e).toString(36)}`;if(isNumber(e))return String(e);if(isSymbol(e)){let t=Symbol.keyFor(e);if(t)return `_s.${t}`;let o=e.description;return o?`_s.${o}`:`${it++}`}return String(e)}}var Q=Symbol("essor.key");function U(e,t){if(m(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let o=Z(t);isFalsy(o)?delete e[Q]:e[Q]=o;}function T(e){if(e)return m(e)?e.key:e[Q]}function L(e){if(isHTMLElement(e))return e;if(isPrimitive(e)){let t=isFalsy(e)?"":String(e);return document.createTextNode(t)}return e}function C(e,t){let o=T(e),n=T(t);if(o!==n)return false;let r=m(e),s=m(t);if(r&&s)return e.component===t.component;if(r!==s)return false;if(isPrimitive(e)||isPrimitive(t))return e===t;let i=e,a=t;return i.nodeType!==a.nodeType?false:i.nodeType===Node.ELEMENT_NODE?i.tagName===a.tagName:true}function te(e,t){if(e===t)return true;if(!e||!t||Array.isArray(e)!==Array.isArray(t))return false;for(let o in e)if(e[o]!==t[o])return false;for(let o in t)if(!(o in e))return false;return true}function x(e){if(e)try{if(m(e))e.destroy();else {let t=e;t.parentElement&&t.remove();}}catch(t){error("Failed to remove node:",t);}}function h(e,t,o){if(!(!e||!t))try{let n=m(o)?o.firstChild:o;if(m(t)){t.mount(e,n);return}n?e.insertBefore(t,n):e.appendChild(t);}catch(n){error("Failed to insert node:",n);}}function z(e,t,o){if(!(!e||!t||!o||t===o))try{let n=m(o)?o.beforeNode:o.nextSibling;x(o),h(e,t,n);}catch(n){error("Failed to replace node:",n);}}function A(e){if(e){if(m(e))return e.firstChild;if(!isPrimitive(e))return e}}function Te(e,t){if(m(e)||m(t))return;let o=T(e);o&&!T(t)&&U(t,o);}function M(e,t,o){if(o===t)return t;let n=isHTMLElement(t);if(isHTMLElement(o)&&n){if(o.isEqualNode(t))return t;if(t.tagName===o.tagName){let a=t.attributes,c=o.attributes;for(let f=a.length-1;f>=0;f--){let l=a[f].name;o.hasAttribute(l)||t.removeAttribute(l);}for(let f=0,l=c.length;f<l;f++){let u=c[f];t.getAttribute(u.name)!==u.value&&t.setAttribute(u.name,u.value);}return Te(t,o),t}}if(isTextNode(t)&&isTextNode(o))return t.textContent!==o.textContent&&(t.textContent=o.textContent),Te(t,o),t;let s=m(t),i=m(o);return s&&i&&t.component===o.component?o.update(t):(z(e,o,t),o)}function Le(e,t,o,n){let r=t.length,s=o.length;if(r===0&&s===0)return [];if(r===0){for(let i=0;i<s;i++)h(e,o[i],n);return o}if(s===0){for(let i=0;i<r;i++)x(t[i]);return []}if(r===1&&s===1){let i=t[0],a=o[0];return C(i,a)?(M(e,i,a),o[0]=i):z(e,a,i),o}if(r===2&&s===2){let i=t[0],a=t[1],c=o[0],f=o[1];if(C(i,c)&&C(a,f))return M(e,i,c),M(e,a,f),o[0]=i,o[1]=a,o;if(C(i,f)&&C(a,c)){M(e,i,f),M(e,a,c);let l=A(a),u=A(i);return l&&u&&l.parentNode===e&&e.insertBefore(l,u),o[0]=a,o[1]=i,o}}return ft(e,t,o,n)}function ft(e,t,o,n){let r=0,s=0,i=t.length-1,a=o.length-1,c=t[0],f=t[i],l=o[0],u=o[a];for(;r<=i&&s<=a;)if(!c)c=t[++r];else if(!f)f=t[--i];else if(C(c,l))M(e,c,l),o[s]=c,c=t[++r],l=o[++s];else break;for(;r<=i&&s<=a;)if(!c)c=t[++r];else if(!f)f=t[--i];else if(C(f,u))M(e,f,u),o[a]=f,f=t[--i],u=o[--a];else break;if(r>i){if(s<=a){let y=a+1<o.length?A(o[a+1]):n;for(let v=s;v<=a;v++)h(e,o[v],y);}}else if(s>a)for(let y=r;y<=i;y++){let v=t[y];v&&x(v);}else ut(e,t,o,r,i,s,a,n);return o}function ut(e,t,o,n,r,s,i,a){let c=i-s+1,f;for(let g=s;g<=i;g++){let E=T(o[g]);E!==void 0&&(f||(f=Object.create(null)),f[E]=g);}let l=new Int32Array(c),u=false,y=0,v=0;for(let g=n;g<=r;g++){let E=t[g];if(!E)continue;if(v>=c){x(E);continue}let S,D=T(E);if(D!==void 0&&f&&D in f)S=f[D];else for(let H=s;H<=i;H++)if(l[H-s]===0&&D===void 0&&T(o[H])===void 0&&C(E,o[H])){S=H;break}S===void 0?x(E):(l[S-s]=g+1,S>=y?y=S:u=true,M(e,E,o[S]),o[S]=E,v++);}let P=u?lt(l):[],I=P.length-1,k=a;for(let g=c-1;g>=0;g--){let E=s+g,S=o[E];if(l[g]===0)h(e,S,k),k=A(S)||k;else if(u)if(I<0||g!==P[I]){let D=A(S);D&&D.parentNode===e&&h(e,D,k),k=D||k;}else k=A(S)||k,I--;else k=A(S)||k;}}function lt(e){let t=e.length;if(t===0)return [];if(t===1)return e[0]!==0?[0]:[];let o=[],n=new Int32Array(t),r,s,i,a,c;for(r=0;r<t;r++){let f=e[r];if(f!==0){if(s=o[o.length-1],o.length===0||e[s]<f){n[r]=s,o.push(r);continue}for(i=0,a=o.length-1;i<a;)c=i+a>>1,e[o[c]]<f?i=c+1:a=c;f<e[o[i]]&&(i>0&&(n[r]=o[i-1]),o[i]=r);}}for(i=o.length,a=o[i-1];i-- >0;)o[i]=a,a=n[a];return o}var ne=false;function dt(){ne=true;}function pt(){ne=false;}function w(){return ne}function _(e,t,o,n){e.addEventListener(t,o,n),F(()=>{e.removeEventListener(t,o,n);});}function St(e,t,o,n){isHtmlInputElement(e)?vt(e,n):isHtmlSelectElement(e)?Et(e,n):isHtmlTextAreaElement(e)&&_(e,"input",()=>{n(e.value);});}function vt(e,t){switch(e.type){case "checkbox":_(e,"change",()=>{t(!!e.checked);});break;case "radio":_(e,"change",()=>{t(e.checked?e.value:"");});break;case "file":_(e,"change",()=>{t(e.files);});break;case "number":case "range":_(e,"input",()=>{t(e.value||"");});break;case "date":case "datetime-local":case "month":case "time":case "week":_(e,"change",()=>{t(e.value||"");});break;default:_(e,"input",()=>{t(e.value);});break}}function Et(e,t){_(e,"change",()=>{if(e.multiple){let o=Array.from(e.options).filter(n=>n.selected).map(n=>n.value);t(o);}else t(e.value);});}var Me=true;function xt(e,t,o,n,r){let s=()=>{let i=isFunction(o)?o():o,a=coerceArray(i).map(c=>isFunction(c)?c():c).flatMap(c=>c).map(L);return Me&&w()?(Me=false,r):Le(t,r,a,n)};return e&&!e.isDestroyed?b(e,s):s()}function re(e,t,o){if(!e)return;let n=N(),r=[],s=effect(()=>{r=xt(n,e,t,o,r);});return F(()=>{s(),r.forEach(i=>x(i)),r.length=0;}),r}function At(e,t){let o=t.length,n=new Array(o),r=new Set(t),s=1,i=0,a=c=>{if(c.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(r.has(s)&&(n[i++]=c,i===o))return true;s++;}let f=c.firstChild;for(;f;){if(a(f))return true;f=f.nextSibling;}return false};return a(e),n}function bt(e){let t=N();if(t){if(t.isMounted){try{e();}catch(o){}return}t.onMount||(t.onMount=new Set),t.onMount.add(e);}}function _t(e){let t=N();t&&(t.onUpdate||(t.onUpdate=new Set),t.onUpdate.add(e));}function Pt(e){let t=N();t&&(t.onDestroy||(t.onDestroy=new Set),t.onDestroy.add(e));}function Re(e){!e||e.isDestroyed||e.isMounted||(e.isMounted=true,e.onMount&&b(e,()=>{for(let t of e.onMount)try{t();}catch(o){}}));}function Y(e){if(!(!e||e.isDestroyed)&&e.onUpdate)for(let t of e.onUpdate)try{t();}catch(o){}}function ie(e){bt(e);}function se(e){Pt(e);}function kt(e){_t(e);}var Ke;Ke="normal";var G=class{constructor(t,o={}){this.component=t;this.props=o;this.renderedNodes=[];this.scope=null;this.parentNode=void 0;this.beforeNode=void 0;this.reactiveProps={};this.state=0;this.parentScope=null;this[Ke]=true;this.key=o.key?Z(o.key):Pe(t),this.reactiveProps=shallowReactive(O({},o||{})),this.parentScope=N();}get isConnected(){return this.state===2}get firstChild(){for(let t of this.renderedNodes){let o=A(t);if(o)return o}}mount(t,o){var s;if(this.parentNode=t,this.beforeNode=o,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)h(t,i,o);return this.state=2,this.renderedNodes}let n=(s=this.parentScope)!=null?s:N();this.scope=q(n);let r=b(this.scope,()=>{var c;let i=this.component(this.reactiveProps);return isFunction(i)&&(i=i(this.reactiveProps)),(isSignal(i)||isComputed(i))&&(i=i.value),(c=re(t,i,o))!=null?c:[]});return this.renderedNodes=r,b(this.scope,()=>{this.applyProps(this.props||{});}),this.state=2,this.scope&&Re(this.scope),this.renderedNodes}update(t){if(this.key!==t.key)return this.mount(t.parentNode,t.beforeNode),this;if(this.parentNode=t.parentNode,this.beforeNode=t.beforeNode,this.scope=t.scope,this.parentScope=t.parentScope,this.renderedNodes=t.renderedNodes,this.state=t.state,this.reactiveProps=t.reactiveProps,!this.props||Object.keys(this.props).length===0)return !this.isConnected&&this.parentNode?(this.mount(this.parentNode,this.beforeNode),this):(this.scope&&(b(this.scope,()=>{this.applyProps(this.props||{});}),Y(this.scope)),this);let o=false;for(let n in this.props){if(n==="key")continue;let r=this.props[n],s=this.reactiveProps[n];Object.is(s,r)||isObject(s)&&isObject(r)&&te(s,r)||(this.reactiveProps[n]=r,o=true);}return !this.isConnected&&this.parentNode&&this.mount(this.parentNode,this.beforeNode),this.scope&&(o||!this.isConnected)&&(b(this.scope,()=>{this.applyProps(this.props||{});}),o&&Y(this.scope)),this}forceUpdate(){return V(this,null,function*(){if(yield Promise.resolve(),this.state===5||!this.parentNode||!this.scope)return;let t=[...this.renderedNodes];try{b(this.scope,()=>{let o=this.component(this.reactiveProps);isFunction(o)&&(o=o(this.reactiveProps)),(isSignal(o)||isComputed(o))&&(o=o.value);let n=coerceArray(o);if(this.parentNode){let r=this.beforeNode;if(!r&&this.renderedNodes.length>0){let s=this.renderedNodes[this.renderedNodes.length-1],i=A(s);i&&(r=i.nextSibling);}for(let s of this.renderedNodes)x(s);for(let s of n)h(this.parentNode,s,r);this.renderedNodes=n;}}),this.scope&&Y(this.scope);}catch(o){throw this.renderedNodes=t,o}})}destroy(){if(this.state===4||this.state===5)return;this.state=4;let t=this.scope;t&&(j(t),this.scope=null);for(let o of this.renderedNodes)x(o);this.renderedNodes=[],this.parentNode=void 0,this.beforeNode=void 0,this.parentScope=null,this.reactiveProps={},this.props={},this.state=5;}applyProps(t){if(!t)return;let o=this.firstChild;for(let[n,r]of Object.entries(t))if(startsWith(n,"on")&&o){let s=n.slice(2).toLowerCase();isHTMLElement(o)&&_(o,s,r);}else n==="ref"&&isSignal(r)&&(r.value=o);this.props=t;}};function m(e){return !!e&&!!e.normal}function ae(e,t){return m(e)?e:new G(e,t)}function Mt(e){let t,o=()=>{let n=document.createElement("template");n.innerHTML=e;let r=n.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(t||(t=o())).cloneNode(true)}function Rt(e,t){let o=isString(t)?document.querySelector(t):t;if(!o){error(`Target element not found: ${t}`);return}o.innerHTML&&(error(`Target element is not empty, it will be delete: ${t}`),o.innerHTML="");let r=ae(e);return r.mount(o),r}function fe(e,t){let o=N();o&&(o.provides||(o.provides=new Map),o.provides.set(e,t));}function ue(e,t){let o=N();if(!o)return t;let n=o;for(;n;){if(n.provides){let r=n.provides.get(e);if(r)return r}n=n.parent;}return t}function Ht(e){let t=e.target,o=`${e.type}`,n=e.target,r=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:true,value:c}),i=()=>{let c=t[`_$${o}`];if(c&&isFunction(c)&&!t.disabled){let f=t[`${o}Data`];if(f?c.call(t,f,e):c.call(t,e),e.cancelBubble)return false}return t.host&&!isString(t.host)&&!t.host._$host&&isFunction(t.contains)&&t.contains(e.target)&&s(t.host),true},a=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();s(c[0]);for(let f=0;f<c.length-2&&(t=c[f],!!i());f++){if(t._$host){t=t._$host,a();break}if(t.parentNode===r)break}}else a();s(n);}var $e=Symbol("_$EVENTS");function Ft(e,t=window.document){let o=t,n=o[$e]||(o[$e]=new Set);for(let r of e)n.has(r)||(n.add(r),t.addEventListener(r,Ht));}function Kt(e,t){let o=new Set(t);return new Proxy(e,{get(n,r){if(!o.has(r))return Reflect.get(n,r)},ownKeys(n){return Reflect.ownKeys(n).filter(r=>!o.has(r))},getOwnPropertyDescriptor(n,r){if(!o.has(r))return Reflect.getOwnPropertyDescriptor(n,r)},has(n,r){return o.has(r)?false:Reflect.has(n,r)}})}function Oe(e,t,o,n=false){if(t===o||w())return;let r=W(o),s=W(t);r&&s===r||(r?n?e.setAttribute("class",r):e.className=r:e.removeAttribute("class"));}function W(e){return normalizeClassName(e)}var je=/\s*!important$/,jt=["Webkit","Moz","ms"],le={};function Ye(e,t,o){let n=e.style,r=isString(o);if(!w()){if(o&&r){t!==o&&(n.cssText=o);return}if(!o){t&&e.removeAttribute("style");return}if(t&&!isString(t))for(let s in t)(!o||o[s]==null)&&K(n,s,"");else if(t&&isString(t)){let s=t.split(";");for(let i of s){let a=i.indexOf(":");if(a>0){let c=i.slice(0,a).trim();o&&isObject(o)&&o[c]==null&&K(n,c,"");}}}if(o&&!isString(o))for(let s in o){let i=o[s];(!t||isString(t)||t[s]!==i)&&i!=null&&K(n,s,i);}}}function K(e,t,o){if(isArray(o)){for(let r of o)K(e,t,r);return}if((o==null||o==="")&&(o=""),t.startsWith("--")){e.setProperty(t,o);return}let n=zt(e,t);typeof o=="string"&&je.test(o)?e.setProperty(camelCase(n),o.replace(je,""),"important"):e[n]=o;}function zt(e,t){let o=le[t];if(o)return o;let n=camelCase(t);if(n!=="filter"&&n in e)return le[t]=n;n=capitalize(n);for(let r of jt){let s=r+n;if(s in e)return le[t]=s}return t}function de(e,t,o,n){if(t==="key"){n==null?U(e,void 0):U(e,String(n));return}if(t===Ee){Object.keys(n).forEach(u=>{de(e,u,o==null?void 0:o[u],n==null?void 0:n[u]);});return}if(w())return;let r=(e==null?void 0:e.namespaceURI)===xe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),a=isSpecialBooleanAttr(t)||isBooleanAttr(t);if(o===n)return;let c=t.toLowerCase();if(c.length>2&&c.charCodeAt(0)===111&&c.charCodeAt(1)===110||c==="innerhtml")return;if(n==null){if(s)e.removeAttributeNS(B,t.slice(6));else if(i){let u=t.slice(6);e.removeAttributeNS(J,u);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(B,t,String(n));return}if(i){e.setAttributeNS(J,t,String(n));return}if(a){includeBooleanAttr(n)?e.setAttribute(t,""):e.removeAttribute(t);return}let f=isSymbol(n)?String(n):n;if((c==="href"||c==="src"||c==="xlink:href")&&typeof f=="string"){let u=f.trim().toLowerCase();if(u.startsWith("javascript:")||u.startsWith("data:"))return}if(r)e.setAttribute(t,String(f));else if(t in e)try{e[t]=f;}catch(u){e.setAttribute(t,String(f));}else e.setAttribute(t,String(f));}function Ge(e,t,o,n){if(!(n!=null&&n.delegate))return e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n);let r=n.delegate,s=a=>{let c=a.target;(c.matches(r)||c.closest(r))&&o.call(e,a);},i=O({},n);return i.delegate=void 0,e.addEventListener(t,s,i),()=>{e.removeEventListener(t,s,i);}}function pe(e){return e==null?void 0:e.children}pe.fragment=true;function We(e){return !!e&&!!e.fragment}function me(e){if(typeof document=="undefined"){let n=e.children;return n?(isArray(n)?n:[n]).map(s=>String(s||"")).join(""):""}let t=document.createComment("portal");t.portal=true;let o=e.children;if(o){let n=isArray(o)?o:[o],r=[];ie(()=>{let s=isString(e.target)?document.querySelector(e.target):e.target;s&&(n.forEach(i=>{if(i!=null){let a=L(i);a&&(h(s,a),r.push(a));}}),F(()=>{r.forEach(i=>{typeof i!="string"&&i.parentNode===s&&s.removeChild(i);});}));});}return t}me.portal=true;function qe(e){return !!e&&!!e.portal}var he=Symbol("SuspenseContext");function ge(e){if(isUndefined(document)){let u=e.fallback;return u?String(u||""):""}let t=document.createElement("div");t.style.display="contents";let o=true,n=0,r=false,s=null,i=()=>{if(!r){for(r=true;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let u=L(e.fallback);u&&h(t,u);}}},a=()=>{if(!(!r||!(s||e.children!=null&&!isPromise(e.children)))){for(r=false;t.firstChild;)t.removeChild(t.firstChild);s?c(s):e.children!=null&&!isPromise(e.children)&&c(e.children);}},c=u=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(u==null)return;let y=N();if((isArray(u)?u:[u]).forEach(P=>{if(P!=null){m(P)&&(P.parentContext=y);let I=L(P);I&&h(t,I);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let P=L(e.fallback);P&&h(t,P);}}},f={register:u=>{n++,i(),u.then(()=>{o&&(n--,n===0&&a());}).catch(y=>{o&&(n--,n===0&&a());});},increment:()=>{n++,i();},decrement:()=>{n--,n===0&&a();}};fe(he,f);let l=e.children;return isPromise(l)?(l.then(u=>{s=u;}).catch(()=>{}),f.register(l)):l!=null?c(l):i(),se(()=>{for(o=false;t.firstChild;)t.removeChild(t.firstChild);}),t}ge.suspense=true;function Be(e){return !!e&&!!e.suspense}function Je(e,t){let o=signal(t==null?void 0:t.initialValue),n=signal(true),r=signal(null),s=signal("pending"),i=0,a=null,c=()=>V(null,null,function*(){let u=++i;n.value=true,s.value="pending",r.value=null;try{let y=e();a=y.then(()=>{}).catch(()=>{});let v=yield y;u===i&&(o.value=v,s.value="ready",n.value=!1);}catch(y){u===i&&(r.value=y instanceof Error?y:new Error(String(y)),s.value="errored",n.value=false);}});c();let f=(()=>{if(n.value&&a){let u=ue(he,null);u&&u.register(a);}return o.value});return f.loading=n,f.error=r,f.state=s,[f,{mutate:u=>{o.value=u,s.value="ready",n.value=false,r.value=null;},refetch:()=>V(null,null,function*(){yield c();})}]}
2
- export{G as Component,pe as Fragment,me as Portal,ge as Suspense,Ge as addEvent,_ as addEventListener,St as bindElement,Rt as createApp,ae as createComponent,Je as createResource,q as createScope,Ft as delegateEvents,j as disposeScope,pt as endHydration,N as getActiveScope,A as getFirstDOMNode,ue as inject,re as insert,h as insertNode,m as isComponent,We as isFragment,w as isHydrating,qe as isPortal,C as isSameNode,Be as isSuspense,At as mapNodes,W as normalizeClass,L as normalizeNode,Kt as omitProps,F as onCleanup,se as onDestroy,ie as onMount,kt as onUpdate,de as patchAttr,Oe as patchClass,Ye as patchStyle,fe as provide,x as removeNode,z as replaceNode,b as runWithScope,ve as setActiveScope,K as setStyle,te as shallowCompare,dt as startHydration,Mt as template};//# sourceMappingURL=template.esm.js.map
1
+ import {isHTMLElement,isPrimitive,isFalsy,isNull,isObject,isArray,isHtmlInputElement,isHtmlSelectElement,isHtmlTextAreaElement,isFunction,hasChanged,isPromise,coerceArray,startsWith,isString,error,isBrowser,normalizeClassName,camelCase,capitalize,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isUndefined,isNumber,isTextNode}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,signal,memoEffect,untrack}from'@estjs/signals';var _t=Object.defineProperty;var Me=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable;var Re=(e,t,n)=>t in e?_t(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&Re(e,n,t[n]);if(Me)for(var n of Me(t))Pt.call(t,n)&&Re(e,n,t[n]);return e};var ie=(e,t,n)=>new Promise((o,r)=>{var s=a=>{try{c(n.next(a));}catch(u){r(u);}},i=a=>{try{c(n.throw(a));}catch(u){r(u);}},c=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,i);c((n=n.apply(e,t)).next());});var kt={mount:"mount",destroy:"destroy",update:"update"};function se(e,t,n){let o=e[t];o||(o=e[t]=[]),o.includes(n)||o.push(n);}function ce(e,t,n){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(isPromise(i)){let c=i.catch(a=>{});(r!=null?r:r=[]).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function ae(e){let t=C();if(t){if(t.isMounted){try{let n=e();isPromise(n)&&n.catch(o=>{});}catch(n){}return}se(t,"onMount",e);}}function Tt(e){let t=C();t&&se(t,"onUpdate",e);}function ue(e){let t=C();t&&se(t,"onDestroy",e);}function He(e){var o;if(e.isDestroyed||!((o=e.onMount)!=null&&o.length)){e.isMounted=true;return}let t=e.onMount,n=L(e,()=>ce(t,e.id,kt.mount));return t.length=0,e.isMounted=true,n}function fe(e){var o;if(e.isDestroyed||!((o=e.onUpdate)!=null&&o.length))return;let t=e.onUpdate,n=L(e,()=>ce(t,e.id,"update"));return t.length=0,n}function Fe(e){var t;if(!(e.isDestroyed||!((t=e.onDestroy)!=null&&t.length)))return L(e,()=>ce(e.onDestroy,e.id,"destroy"))}var M=null,Dt=0;function C(){return M}function O(e){M=e;}function z(e=M){let t={id:++Dt,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=[]),e.children.push(t)),t}function L(e,t){let n=M;M=e;try{return t()}finally{M=n;}}function $(e){var n,o,r;if(!e||e.isDestroyed)return;let t=e.parent;if(e.children){for(let s of e.children)$(s);e.children.length=0;}if((n=e.onDestroy)!=null&&n.length&&(Fe(e),e.onDestroy.length=0),(o=e.cleanup)!=null&&o.length){for(let s of e.cleanup)try{s();}catch(i){}e.cleanup.length=0;}if(t!=null&&t.children){let s=t.children.indexOf(e);s!==-1&&t.children.splice(s,1);}(r=e.provides)==null||r.clear(),e.onMount&&(e.onMount.length=0),e.onUpdate&&(e.onUpdate.length=0),e.parent=null,e.isDestroyed=true,M===e&&(M=t);}function H(e){let t=M;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}var Ke="_$spread$";var Oe="http://www.w3.org/2000/svg",le="http://www.w3.org/2000/xlink",de="http://www.w3.org/2000/xmlns/";var pe=Symbol(""),me=Symbol(""),X=Symbol(""),ye=Symbol(""),Ve=Symbol("");var $e=1e3,je=new WeakMap;function ze(e){let t=je.get(e);if(!t){let n=e.name||"anonymous",o=Ye(e.toString()).toString(36);t=`${n}_${o}`,je.set(e,t);}return t}function Ye(e){let t=0,n=e.length<100?e.length:100;for(let o=0;o<n;o++)t=Math.trunc((t<<5)-t+e.charCodeAt(o));return t<0?-t:t}var Rt=0;function ge(e){if(!isFalsy(e)){if(isString(e))return e.length<=$e?e:`${e.slice(0,$e-10)}_${Ye(e).toString(36)}`;if(isNumber(e))return String(e);if(isSymbol(e)){let t=Symbol.keyFor(e);if(t)return `_s.${t}`;let n=e.description;return n?`_s.${n}`:`${Rt++}`}return String(e)}}var he=Symbol("essor.key");function Y(e,t){if(y(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let n=ge(t);isFalsy(n)?delete e[he]:e[he]=n;}function R(e){if(e)return y(e)?e.key:e[he]}function I(e){if(isHTMLElement(e))return e;if(isPrimitive(e)){let t=isFalsy(e)?"":String(e);return document.createTextNode(t)}return e}function w(e,t){let n=R(e),o=R(t);if(n!==o)return false;let r=y(e),s=y(t);if(r&&s)return e.component===t.component;if(r!==s)return false;if(isPrimitive(e)||isPrimitive(t))return e===t;let i=e,c=t;return i.nodeType!==c.nodeType?false:i.nodeType===Node.ELEMENT_NODE?i.tagName===c.tagName:true}function Se(e,t){if(e===t)return true;if(isNull(e)||isNull(t)||!isObject(e)||!isObject(t)||isArray(e)!==isArray(t))return false;let n=e,o=t,r=Object.keys(n),s=Object.keys(o);if(r.length!==s.length)return false;for(let i of r)if(!(i in o)||n[i]!==o[i])return false;return true}function k(e){if(!e)return;if(y(e)){e.destroy();return}let t=e;t.parentElement&&t.remove();}function P(e,t,n){if(!e||!t)return;if(y(t)){let r=y(n)?n.firstChild:n;t.mount(e,r);return}let o=y(n)?n.firstChild:n;o?e.insertBefore(t,o):e.appendChild(t);}function q(e,t,n){if(!e||!t||!n||t===n)return;let o=y(n)?n.beforeNode:n.nextSibling;k(n),P(e,t,o);}function T(e){if(e){if(y(e))return e.firstChild;if(!isPrimitive(e))return e}}function Je(e,t){if(y(e)||y(t))return;let n=R(e);n&&!R(t)&&Y(t,n);}function F(e,t,n){if(n===t)return t;let o=isHTMLElement(t);if(isHTMLElement(n)&&o){if(n.isEqualNode(t))return t;if(t.tagName===n.tagName){let c=t.attributes,a=n.attributes;for(let u=c.length-1;u>=0;u--){let p=c[u].name;n.hasAttribute(p)||t.removeAttribute(p);}for(let u=0,p=a.length;u<p;u++){let f=a[u];t.getAttribute(f.name)!==f.value&&t.setAttribute(f.name,f.value);}return Je(t,n),t}}if(isTextNode(t)&&isTextNode(n))return t.textContent!==n.textContent&&(t.textContent=n.textContent),Je(t,n),t;let s=y(t),i=y(n);return s&&i&&t.component===n.component?n.update(t):(q(e,n,t),n)}function Qe(e,t,n,o){let r=t.length,s=n.length;if(r===0&&s===0)return [];if(r===0){for(let i=0;i<s;i++)P(e,n[i],o);return n}if(s===0){for(let i=0;i<r;i++)k(t[i]);return []}if(r===1&&s===1){let i=t[0],c=n[0];return w(i,c)?(F(e,i,c),n[0]=i):q(e,c,i),n}if(r===2&&s===2){let i=t[0],c=t[1],a=n[0],u=n[1];if(w(i,a)&&w(c,u))return F(e,i,a),F(e,c,u),n[0]=i,n[1]=c,n;if(w(i,u)&&w(c,a)){F(e,i,u),F(e,c,a);let p=T(c),f=T(i);return p&&f&&p.parentNode===e&&e.insertBefore(p,f),n[0]=c,n[1]=i,n}}return Kt(e,t,n,o)}function Kt(e,t,n,o){let r=0,s=0,i=t.length-1,c=n.length-1,a=t[0],u=t[i],p=n[0],f=n[c];for(;r<=i&&s<=c;)if(!a)a=t[++r];else if(!u)u=t[--i];else if(w(a,p))F(e,a,p),n[s]=a,a=t[++r],p=n[++s];else break;for(;r<=i&&s<=c;)if(!a)a=t[++r];else if(!u)u=t[--i];else if(w(u,f))F(e,u,f),n[c]=u,u=t[--i],f=n[--c];else break;if(r>i){if(s<=c){let l=c+1<n.length?T(n[c+1]):o;for(let m=s;m<=c;m++)P(e,n[m],l);}}else if(s>c)for(let l=r;l<=i;l++){let m=t[l];m&&k(m);}else Ot(e,t,n,r,i,s,c,o);return n}function Ot(e,t,n,o,r,s,i,c){let a=i-s+1,u;for(let S=s;S<=i;S++){let v=R(n[S]);v!==void 0&&(u||(u=Object.create(null)),u[v]=S);}let p=new Int32Array(a),f=false,l=0,m=0;for(let S=o;S<=r;S++){let v=t[S];if(!v)continue;if(m>=a){k(v);continue}let A,b=R(v);if(b!==void 0&&u&&b in u)A=u[b];else for(let d=s;d<=i;d++)if(p[d-s]===0&&b===void 0&&R(n[d])===void 0&&w(v,n[d])){A=d;break}A===void 0?k(v):(p[A-s]=S+1,A>=l?l=A:f=true,F(e,v,n[A]),n[A]=v,m++);}let E=f?Vt(p):[],x=E.length-1,h=c;for(let S=a-1;S>=0;S--){let v=s+S,A=n[v];if(p[S]===0)P(e,A,h),h=T(A)||h;else if(f)if(x<0||S!==E[x]){let b=T(A);b&&b.parentNode===e&&P(e,b,h),h=b||h;}else h=T(A)||h,x--;else h=T(A)||h;}}function Vt(e){let t=e.length;if(t===0)return [];if(t===1)return e[0]!==0?[0]:[];let n=[],o=new Int32Array(t),r,s,i,c,a;for(r=0;r<t;r++){let u=e[r];if(u!==0){if(s=n[n.length-1],n.length===0||e[s]<u){o[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)a=i+c>>1,e[n[a]]<u?i=a+1:c=a;u<e[n[i]]&&(i>0&&(o[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=o[c];return n}function D(e,t,n,o){e.addEventListener(t,n,o),H(()=>{e.removeEventListener(t,n,o);});}function Bt(e,t,n,o){isHtmlInputElement(e)?Gt(e,o):isHtmlSelectElement(e)?Wt(e,o):isHtmlTextAreaElement(e)&&D(e,"input",()=>{o(e.value);});}function Gt(e,t){switch(e.type){case "checkbox":D(e,"change",()=>{t(!!e.checked);});break;case "radio":D(e,"change",()=>{t(e.checked?e.value:"");});break;case "file":D(e,"change",()=>{t(e.files);});break;case "number":case "range":D(e,"input",()=>{t(e.value||"");});break;case "date":case "datetime-local":case "month":case "time":case "week":D(e,"change",()=>{t(e.value||"");});break;default:D(e,"input",()=>{t(e.value);});break}}function Wt(e,t){D(e,"change",()=>{if(e.multiple){let n=Array.from(e.options).filter(o=>o.selected).map(o=>o.value);t(n);}else t(e.value);});}function Ee(e,t,n){if(!e)return;let o=[],r=C(),s=effect(()=>{let i=()=>{let c=isFunction(t)?t():t,a=coerceArray(c).map(u=>isFunction(u)?u():u).flatMap(I);o=Qe(e,o,a,n);};r?L(r,i):i();});return H(()=>{s(),o.forEach(i=>k(i)),o.length=0;}),o}function ve(e,t){let n=t.length,o=new Array(n),r=new Set(t),s=1,i=0,c=a=>{if(a.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(r.has(s)&&(o[i++]=a,i===n))return true;s++;}let u=a.firstChild;for(;u;){if(c(u))return true;u=u.nextSibling;}return false};return c(e),o}var ot;ot=pe;var Q=class{constructor(t,n={}){this.component=t;this.props=n;this.renderedNodes=[];this.scope=null;this.parentNode=void 0;this.beforeNode=void 0;this.reactiveProps={};this._propSnapshots={};this.state=0;this.parentScope=null;this[ot]=true;this.key=n.key?ge(n.key):ze(t),this.reactiveProps=shallowReactive(V({},n)),this.parentScope=C();for(let o in n){let r=n[o];isObject(r)&&(this._propSnapshots[o]=isArray(r)?[...r]:V({},r));}}get isConnected(){return this.state===2}get firstChild(){for(let t of this.renderedNodes){let n=T(t);if(n)return n}}mount(t,n){var i,c;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let a of this.renderedNodes)P(t,a,n);return this.state=2,this.renderedNodes}let o=(i=this.parentScope)!=null?i:C();this.scope=z(o),O(this.scope);let r=this.component(this.reactiveProps);isFunction(r)&&(r=r(this.reactiveProps)),(isSignal(r)||isComputed(r))&&(r=r.value);let s=(c=Ee(t,r,n))!=null?c:[];return this.renderedNodes=s,this.applyProps(this.props),this.state=2,He(this.scope),this.renderedNodes}update(t){return this.key!==t.key?(this.mount(t.parentNode,t.beforeNode),this):(this.parentNode=t.parentNode,this.beforeNode=t.beforeNode,this.scope=t.scope,this.parentScope=t.parentScope,this.renderedNodes=t.renderedNodes,this.state=t.state,this.reactiveProps=t.reactiveProps,this._propSnapshots=t._propSnapshots,this._updateReactiveProps(this.props),!this.isConnected&&this.parentNode?(this.mount(this.parentNode,this.beforeNode),this):(this.scope&&(O(this.scope),this.applyProps(this.props),fe(this.scope)),this))}_updateReactiveProps(t){for(let n in t){if(n==="key")continue;let o=t[n],r=this.reactiveProps[n];if(o===r&&!this._propSnapshots[n])continue;if(isObject(o)){let i=this._propSnapshots[n];if(i&&Se(o,i))continue;let c=isArray(o)?[...o]:V({},o);this.reactiveProps[n]=c,this._propSnapshots[n]=c;}else hasChanged(o,r)&&(this.reactiveProps[n]=o,this._propSnapshots[n]&&delete this._propSnapshots[n]);}}unwrapRenderResult(t){return isFunction(t)&&(t=t(this.reactiveProps)),(isSignal(t)||isComputed(t))&&(t=t.value),y(t)&&(t=t.mount(this.parentNode,this.beforeNode)),isPromise(t)&&(t=t.then(n=>this.unwrapRenderResult(n))),t}forceUpdate(){if(this.state===5||!this.parentNode||!this.scope)return;let t=[...this.renderedNodes];try{L(this.scope,()=>{let n=this.component(this.reactiveProps);isFunction(n)&&(n=n(this.reactiveProps)),(isSignal(n)||isComputed(n))&&(n=n.value);let o=coerceArray(n),r=this._getAnchorNode();if(this.parentNode){for(let s of this.renderedNodes)k(s);for(let s of o)P(this.parentNode,s,r);this.renderedNodes=o;}}),this.scope&&fe(this.scope);}catch(n){throw this.renderedNodes=t,n}}_getAnchorNode(){if(this.beforeNode)return this.beforeNode;if(this.renderedNodes.length>0){let t=this.renderedNodes[this.renderedNodes.length-1],n=T(t);if(n)return n.nextSibling}}destroy(){if(this.state===4||this.state===5)return;this.state=4;for(let n of this.renderedNodes)k(n);let t=this.scope;t&&($(t),this.scope=null),this.renderedNodes=[],this.parentNode=void 0,this.beforeNode=void 0,this.parentScope=null,this.reactiveProps={},this.props={},this.state=5;}applyProps(t){if(!t)return;let n=this.firstChild;for(let[o,r]of Object.entries(t))if(startsWith(o,"on")){if(!n||!isHTMLElement(n))return;let s=o.slice("on".length).toLowerCase();D(n,s,r);}else o==="ref"&&isSignal(r)&&(r.value=n);this.props=t;}};function y(e){return !!e&&!!e[pe]}function B(e,t){return y(e)?e:new Q(e,t)}function be(e){let t,n=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(t||(t=n())).cloneNode(true)}function on(e,t){let n=isString(t)?document.querySelector(t):t;if(!n){error(`Target element not found: ${t}`);return}n.innerHTML&&(error(`Target element is not empty, it will be delete: ${t}`),n.innerHTML="");let r=y(e)?e:B(e);return r.mount(n),r}function _e(e,t){let n=C();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function Ce(e,t){let n=C();if(!n)return t;let o=n;for(;o;){if(o.provides){let r=o.provides.get(e);if(r)return r}o=o.parent;}return t}function Pe(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function at(e,t,n){let o=e[`_$${n}`];if(o&&isFunction(o)&&!e.disabled){let r=e[`${n}Data`];if(r?o.call(e,r,t):o.call(e,t),t.cancelBubble)return false}return e.host&&!isString(e.host)&&!e.host._$host&&isFunction(e.contains)&&e.contains(t.target)&&Pe(t,e.host),true}function st(e,t,n){let o=e;for(;at(o,t,n)&&(o=o._$host||o.parentNode||o.host););return o}function sn(e){let t=e.target,n=`${e.type}`,o=e.target,r=e.currentTarget;if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let s=e.composedPath();Pe(e,s[0]);for(let i=0;i<s.length-2&&(t=s[i],!!at(t,e,n));i++){if(t._$host){t=t._$host,t=st(t,e,n);break}if(t.parentNode===r)break}}else t=st(t,e,n);Pe(e,o);}var ct=Symbol("_$EVENTS");function cn(e,t=window.document){let n=t,o=n[ct]||(n[ct]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,sn));}function an(e,t){let n=new Set(t);return new Proxy(e,{get(o,r){if(!n.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!n.has(r))},getOwnPropertyDescriptor(o,r){if(!n.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return n.has(r)?false:Reflect.has(o,r)}})}var ke=false;function Z(){ke=true;}function G(){ke=false;}function K(){return ke}var ut=0;function ee(){return `${ut++}`}function te(){ut=0;}var lt=/^\d+-\d+$/;function dt(e){return ()=>{if(!isBrowser())return null;let t=ee(),n=document.querySelector(`[data-hk="${t}"]`);return n||be(e)()}}function pt(e,t){let n=e.dataset.hk;if(!n)return ve(e,t);let o=[],r=e.querySelectorAll(`[data-idx^="${n}"]`);r.length>0&&o.push(...Array.from(r).filter(a=>{let u=a.dataset.idx;return u!==null&&lt.test(u)}).map(a=>{let u=a.dataset.idx||"",[p,f]=u.split("-");return {hk:p,idx:f,node:a}}));let s=[],i=a=>{if(a.nodeType===Node.COMMENT_NODE&&a.textContent&&lt.test(a.textContent)){let[p,f]=a.textContent.split("-");s.push({hk:p,idx:f,node:a});}let u=a.firstChild;for(;u;)i(u),u=u.nextSibling;};i(e),o.push(...s);let c=[e];return t.forEach(a=>{let u=o.find(p=>p.idx===String(a));u&&c.push(u.node);}),c}function mt(e,t){Z(),te();try{let n=isString(t)?document.querySelector(t):t;if(!n){error("Hydration error: Root element not found");return}let o=B(e);return o.mount(n),G(),o}catch(n){error("Hydration error:",n),G();return}}function yt(e,t,n,o=false){if(t===n||K())return;let r=ne(n),s=ne(t);r&&s===r||(r?o?e.setAttribute("class",r):e.className=r:e.removeAttribute("class"));}function ne(e){return normalizeClassName(e)}var ht=/\s*!important$/,yn=["Webkit","Moz","ms"],Te={};function Nt(e,t,n){let o=e.style,r=isString(n);if(!K()){if(n&&r){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!isString(t))for(let s in t)(!n||n[s]==null)&&U(o,s,"");else if(t&&isString(t)){let s=t.split(";");for(let i of s){let c=i.indexOf(":");if(c>0){let a=i.slice(0,c).trim();n&&isObject(n)&&n[a]==null&&U(o,a,"");}}}if(n&&!isString(n))for(let s in n){let i=n[s];(!t||isString(t)||t[s]!==i)&&i!=null&&U(o,s,i);}}}function U(e,t,n){if(isArray(n)){for(let r of n)U(e,t,r);return}if((n==null||n==="")&&(n=""),t.startsWith("--")){e.setProperty(t,n);return}let o=hn(e,t);isString(n)&&ht.test(n)?e.setProperty(camelCase(o),n.replace(ht,""),"important"):e[o]=n;}function hn(e,t){let n=Te[t];if(n)return n;let o=camelCase(t);if(o!=="filter"&&o in e)return Te[t]=o;o=capitalize(o);for(let r of yn){let s=r+o;if(s in e)return Te[t]=s}return t}function De(e,t,n,o){if(t==="key"){o==null?Y(e,void 0):Y(e,String(o));return}if(t===Ke){Object.keys(o).forEach(f=>{De(e,f,n==null?void 0:n[f],o==null?void 0:o[f]);});return}if(K())return;let r=(e==null?void 0:e.namespaceURI)===Oe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=isSpecialBooleanAttr(t)||isBooleanAttr(t);if(n===o)return;let a=t.toLowerCase();if(a.length>2&&a.charCodeAt(0)===111&&a.charCodeAt(1)===110||a==="innerhtml")return;if(o==null){if(s)e.removeAttributeNS(le,t.slice(6));else if(i){let f=t.slice(6);e.removeAttributeNS(de,f);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(le,t,String(o));return}if(i){e.setAttributeNS(de,t,String(o));return}if(c){includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let u=isSymbol(o)?String(o):o;if((a==="href"||a==="src"||a==="xlink:href")&&isString(u)){let f=u.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(r)e.setAttribute(t,String(u));else if(t in e)try{e[t]=u;}catch(f){e.setAttribute(t,String(u));}else e.setAttribute(t,String(u));}function St(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,s=c=>{let a=c.target;(a.matches(r)||a.closest(r))&&n.call(e,c);},i=V({},o);return i.delegate=void 0,e.addEventListener(t,s,i),()=>{e.removeEventListener(t,s,i);}}function Et(e){if(!(e!=null&&e.children))return error("Fragment component requires children"),null;let{children:t}=e;return t}Et[me]=true;function bn(e){return !!e&&!!e[me]}function xt(e){let t=document.createComment("portal");t[X]=true;let n=e.children;if(n){let o=isArray(n)?n:[n],r=[];ae(()=>{let s=isString(e.target)?document.querySelector(e.target):e.target;s&&(o.forEach(i=>{if(i!=null){let c=I(i);c&&(P(s,c),r.push(c));}}),H(()=>{r.forEach(i=>{!isString(i)&&i.parentNode===s&&s.removeChild(i);});}));});}return t}xt[X]=true;function Cn(e){return !!e&&!!e[X]}var Le=Symbol("SuspenseContext");function At(e){if(isUndefined(document)){let f=e.fallback;return f?String(f||""):""}let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,s=null,i=()=>{if(!r){for(r=true;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let f=I(e.fallback);f&&P(t,f);}}},c=()=>{if(!(!r||!(s||e.children!=null&&!isPromise(e.children)))){for(r=false;t.firstChild;)t.removeChild(t.firstChild);s?a(s):e.children!=null&&!isPromise(e.children)&&a(e.children);}},a=f=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(f==null)return;let l=C();if((isArray(f)?f:[f]).forEach(E=>{if(E!=null){y(E)&&(E.parentContext=l);let x=I(E);x&&P(t,x);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let E=I(e.fallback);E&&P(t,E);}}},u={register:f=>{o++,i(),f.then(()=>{n&&(o--,o===0&&c());}).catch(l=>{n&&(o--,o===0&&c());});},increment:()=>{o++,i();},decrement:()=>{o--,o===0&&c();}};_e(Le,u);let p=e.children;return isPromise(p)?(p.then(f=>{s=f;}).catch(()=>{}),u.register(p)):p!=null?a(p):i(),ue(()=>{for(n=false;t.firstChild;)t.removeChild(t.firstChild);}),t}At[ye]=true;function Tn(e){return !!e&&!!e[ye]}function Dn(e,t){let n=signal(t==null?void 0:t.initialValue),o=signal(true),r=signal(null),s=signal("pending"),i=0,c=null,a=()=>ie(null,null,function*(){let f=++i;o.value=true,s.value="pending",r.value=null;try{let l=e();c=l.then(()=>{}).catch(()=>{});let m=yield l;f===i&&(n.value=m,s.value="ready",o.value=!1);}catch(l){f===i&&(r.value=l instanceof Error?l:new Error(String(l)),s.value="errored",o.value=false);}});a();let u=(()=>{if(o.value&&c){let f=Ce(Le,null);f&&f.register(c);}return n.value});return u.loading=o,u.error=r,u.state=s,[u,{mutate:f=>{n.value=f,s.value="ready",o.value=false,r.value=null;},refetch:()=>ie(null,null,function*(){yield a();})}]}function bt(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=null,s=e.keyFn,i=e.children,c=()=>{var m,E;let l=e.each;return isSignal(l)?(m=l.value)!=null?m:[]:typeof l=="function"?(E=l())!=null?E:[]:l!=null?l:[]},a=l=>s?s(l):l,u=(l,m,E,x)=>{var A;let h=C(),S=z(h);O(S);let v;try{let b=i(l,m);y(b)?(b.mount(E,x),v=(A=b.firstChild)!=null?A:document.createComment("empty")):(v=b,v.parentNode||(x?E.insertBefore(v,x):E.appendChild(v)));}finally{O(h);}return {key:a(l),node:v,scope:S}},p=l=>{$(l.scope),l.node.parentNode&&l.node.parentNode.removeChild(l.node);};memoEffect(({prev:l})=>{var x;let m=c();if(l===m)return {prev:m};let E=n.parentNode;if(!E){if(m.length===0){if(e.fallback){let h=e.fallback();y(h)?(h.mount(t,n),r=(x=h.firstChild)!=null?x:document.createComment("empty")):(r=h,t.insertBefore(r,n));}return {prev:m}}o=new Array(m.length);for(let[h,S]of m.entries())o[h]=u(S,h,t,n);return {prev:m}}return untrack(()=>f(E,m)),{prev:m}},{prev:[]});function f(l,m){var b;let E=o.length,x=m.length;if(x===0){for(let d=0;d<E;d++)p(o[d]);if(o=[],e.fallback&&!r){let d=e.fallback();y(d)?(d.mount(l,n),r=(b=d.firstChild)!=null?b:document.createComment("empty")):(r=d,l.insertBefore(r,n));}return}if(E===0||r){r&&(r.parentNode&&r.parentNode.removeChild(r),r=null),o=new Array(x);let d=document.createDocumentFragment();for(let _=0;_<x;_++)o[_]=u(m[_],_,d,null);l.insertBefore(d,n);return}let h=new Map;for(let d=0;d<E;d++){let _=o[d],W=h.get(_.key);W?W.push(_):h.set(_.key,[_]);}let S=new Array(x),v=[],A=document.createDocumentFragment();for(let d=0;d<x;d++){let _=m[d],W=a(_),re=h.get(W);re&&re.length>0?S[d]=re.shift():S[d]=u(_,d,A,null);}for(let d of h.values())for(let _ of d)v.push(_);for(let d of v)p(d);for(let d=0;d<x;d++){let _=S[d].node;l.insertBefore(_,n);}o=S;}return H(()=>{for(let l of o)p(l);r&&r.parentNode&&r.parentNode.removeChild(r),n.parentNode&&n.parentNode.removeChild(n);}),t}bt[Ve]=true;
2
+ export{Q as Component,bt as For,Et as Fragment,xt as Portal,At as Suspense,St as addEvent,D as addEventListener,Bt as bindElement,on as createApp,B as createComponent,Dn as createResource,z as createScope,cn as delegateEvents,$ as disposeScope,G as endHydration,C as getActiveScope,T as getFirstDOMNode,ee as getHydrationKey,dt as getRenderedElement,mt as hydrate,Ce as inject,Ee as insert,P as insertNode,y as isComponent,bn as isFragment,K as isHydrating,Cn as isPortal,w as isSameNode,Tn as isSuspense,ve as mapNodes,pt as mapSSRNodes,ne as normalizeClass,I as normalizeNode,an as omitProps,H as onCleanup,ue as onDestroy,ae as onMount,Tt as onUpdate,De as patchAttr,yt as patchClass,Nt as patchStyle,_e as provide,k as removeNode,q as replaceNode,te as resetHydrationKey,L as runWithScope,O as setActiveScope,U as setStyle,Se as shallowCompare,Z as startHydration,be as template};//# sourceMappingURL=template.esm.js.map
3
3
  //# sourceMappingURL=template.esm.js.map