@estjs/template 0.0.15 → 0.0.16-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
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
1
+ import {c,e,g,a,d,f,b}from'./chunk-IRDMO5MX.esm.js';import {normalizeClassName,isObject,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isString,isArray,camelCase,capitalize,isBrowser,warn,isPromise,isFunction,isOn,coerceArray}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,signal}from'@estjs/signals';var ue="_$spread$";var We="http://www.w3.org/2000/svg",_e="http://www.w3.org/2000/xlink",xe="http://www.w3.org/2000/xmlns/";var Ae=Symbol(""),ie=Symbol(""),Pe=Symbol(""),Xe=Symbol("");function G(t,e,n,o){if(e==="key"){o==null?t.removeAttribute(e):t.setAttribute(e,String(o));return}if(e===ue){let d=isObject(n)?n:null,p=isObject(o)?o:null;if(d)for(let h in d)h!==ue&&(!p||!(h in p))&&G(t,h,d[h],null);if(p)for(let h in p)h!==ue&&G(t,h,d==null?void 0:d[h],p[h]);return}let r=(t==null?void 0:t.namespaceURI)===We,s=r&&e.startsWith("xlink:"),i=r&&e.startsWith("xmlns:"),c=isSpecialBooleanAttr(e)||isBooleanAttr(e);if(n===o||e.length>2&&e.charCodeAt(0)===111&&e.charCodeAt(1)===110)return;let l=e.toLowerCase();if(l==="innerhtml"||l==="srcdoc")return;if(o==null){if(s)t.removeAttributeNS(_e,e.slice(6));else if(i){let d=e.slice(6);t.removeAttributeNS(xe,d);}else t.removeAttribute(e);return}if(c){includeBooleanAttr(o)?t.setAttribute(e,""):t.removeAttribute(e);return}let u=isSymbol(o)?String(o):o;if((l==="href"||l==="src"||l==="xlink:href"||l==="action"||l==="formaction"||l==="poster")&&isString(u)){let d=u.trim().toLowerCase();if(d.startsWith("javascript:")||d.startsWith("data:"))return}if(s){t.setAttributeNS(_e,e,String(u));return}if(i){t.setAttributeNS(xe,e,String(u));return}if(r)t.setAttribute(e,String(u));else if(e in t)try{t[e]=u;}catch(d){t.setAttribute(e,String(u));}else t.setAttribute(e,String(u));}function de(t,e,n,o=false){if(e===n)return;let r=fe(n);if(!r){t.removeAttribute("class");return}(isString(e)?e:fe(e))!==r&&(o?t.setAttribute("class",r):t.className=r);}var fe=normalizeClassName;var Ge=/\s*!important$/,Pt=["Webkit","Moz","ms"],ke={};function me(t,e,n){let o=t.style;if(n&&isString(n)){e!==n&&(o.cssText=n);return}if(!n){e&&t.removeAttribute("style");return}if(e&&!isString(e)){let r=e;for(let s in r)(!n||n[s]==null)&&J(o,s,"");}else if(e&&isString(e)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(e))!==null;){let i=s[1].trim();i&&n&&isObject(n)&&n[i]==null&&J(o,i,"");}}if(n&&!isString(n)){let r=n;for(let s in r){let i=r[s];(!e||isString(e)||e[s]!==i)&&i!=null&&J(o,s,i);}}}function J(t,e,n){if(isArray(n)){for(let r of n)J(t,e,r);return}if((n==null||n==="")&&(n=""),e.startsWith("--")){t.setProperty(e,n);return}let o=kt(t,e);isString(n)&&Ge.test(n)?t.setProperty(camelCase(o),n.replace(Ge,""),"important"):t[o]=n;}function kt(t,e){let n=ke[e];if(n)return n;let o=camelCase(e);if(o!=="filter"&&o in t)return ke[e]=o;o=capitalize(o);for(let r of Pt){let s=r+o;if(s in t)return ke[e]=s}return e}var Te=0;function Je(){return String(Te++)}function Lt(){Te=0;}var z=false;function le(){return z}var Q=new Map;function Dt(t){let e=t.querySelectorAll("[data-hk]");for(let n of e){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function Ft(){if(typeof document=="undefined")return;let t=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),e;for(;e=t.nextNode();){let n=e.data;if(n==="teleport-anchor")ye.push(e);else if(n==="teleport-start"){let o=e.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(e);}}}function Re(){var t;return (t=ye.shift())!=null?t:null}function Le(t){let e=se.get(t),n=e==null?void 0:e.shift();if(!n)return null;let o=[],r=n.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:n,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function De(t){z=true,Te=0,Q.clear(),ye.length=0,se.clear(),Dt(t),Ft();}function Fe(){z=false,Q.clear(),ye.length=0,se.clear();}function Mt(t){if(!isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let e=null;return ()=>{if(!z)return e||(e=pe(t)),e();let n=Je(),o=Q.get(n);return o?(Q.delete(n),o):(warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),e||(e=pe(t)),e())}}function It(t,e,n,o){z||de(t,e,n,o);}function Ht(t,e,n,o){z||G(t,e,n,o);}function Ot(t,e,n){z||me(t,e,n);}function Me(t,e){return e&&e.parentNode===t?e:null}function Qe(t,e,n,o){let r=Me(t,o),s=e.length,i=n.length;if(s===0&&i===0)return n;if(s===0){for(let f=0;f<i;f++)F(t,n[f],r);return n}if(i===0){for(let f=0;f<s;f++)K(e[f]);return []}let c=0,l=s-1,u=i-1;for(;c<=l&&c<=u&&e[c]===n[c];)c++;for(;l>=c&&u>=c&&e[l]===n[u];)l--,u--;if(c>l){if(c<=u){let f=u+1,d=Me(t,f<i?n[f]:r);for(let p=c;p<=u;p++)F(t,n[p],d);}}else if(c>u)for(let f=c;f<=l;f++)K(e[f]);else Vt(t,e,n,c,l,u,r);return n}function Vt(t,e,n,o,r,s,i){let c=s-o+1,l=new Map;for(let m=o;m<=s;m++)l.set(n[m],m);let u=new Int32Array(c);u.fill(0);let f=0,d=false,p=0;for(let m=o;m<=r;m++){let g=e[m];if(f>=c){K(g);continue}let a=l.get(g);a===void 0?K(g):(u[a-o]=m+1,a>=p?p=a:d=true,f++);}let h=d?Ie(u):[],N=h.length-1;for(let m=c-1;m>=0;m--){let g=o+m,a=n[g],y=Me(t,g+1<n.length?n[g+1]:i);u[m]===0?F(t,a,y):d&&(N<0||m!==h[N]?F(t,a,y):N--);}}function Ie(t){let e=new Int32Array(t.length),n=[0],o=t.length,r,s,i,c,l;for(r=0;r<o;r++){let u=t[r];if(u!==0){if(s=n[n.length-1],t[s]<u){e[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)l=i+c>>1,t[n[l]]<u?i=l+1:c=l;u<t[n[i]]&&(i>0&&(e[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=e[c];return n}function K(t){if(t)if(M(t))t.destroy();else {let e=t;e.parentNode&&e.remove();}}function F(t,e,n){if(!t||!e)return;let o=M(n)?n.firstChild:n;if(M(e)){e.mount(t,o);return}o?t.insertBefore(e,o):t.appendChild(e);}function Z(t){if(t instanceof Node||M(t))return t;let e=typeof t;return t==null||e==="string"||e==="number"||e==="boolean"||e==="symbol"?document.createTextNode(t===false||t==null?"":String(t)):document.createTextNode(String(t))}function B(t,e$1,n){if(!t)return;let o=c(),r=[],s=true,i=l=>{if(l instanceof Node)return [l];if(M(l))return [l];let u=typeof l;return l==null||u==="string"||u==="number"||u==="boolean"?[Z(l)]:coerceArray(l).map(f=>isFunction(f)?f():f).flatMap(f=>f).map(Z)},c$1=effect(()=>{let l=()=>{let u=isFunction(e$1)?e$1():e$1,f=i(u);if(s&&le()&&f.every(d=>d instanceof Node&&d.parentNode===t)){r=f,s=false;return}r=Qe(t,r,f,n),s=false;};o&&!o.isDestroyed?e(o,l):l();});return g(()=>{c$1.stop();for(let l of r)K(l);r=[];}),r}function $t(t){return (t==null?void 0:t.firstChild)||null}function Ut(t,e=1){for(;t&&e>0;)t=t.nextSibling,e--;return t||null}function zt(t,e){if(!t||e<0)return null;let n=t.firstChild;for(;n&&e>0;)n=n.nextSibling,e--;return n||null}function ee(t,e,n,o){if(!(o!=null&&o.delegate))return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o);let r=o.delegate,s=u=>{let f=u.target;(f.matches(r)||f.closest(r))&&n.call(t,u);},l=o,{delegate:i}=l,c=a(l,["delegate"]);return t.addEventListener(e,s,c),()=>{t.removeEventListener(e,s,c);}}function He(t,e,n){let o=t[e];o||(o=[],t[e]=o),o.push(n);}function tt(t,e,n){let o=t.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=t[s]();if(isPromise(i)){let c=i.catch(l=>{});(r||(r=[])).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Oe(t){let e=c();if(e){if(e.isMounted){try{let n=t();isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(e,"onMount",t);}}function Bt(t){let e=c();e&&He(e,"onUpdate",t);}function te(t){let e=c();e&&He(e,"onDestroy",t);}function nt(t){if(t.isDestroyed)return;if(!t.onMount||t.onMount.length===0){t.isMounted=true;return}let e$1=t.onMount,n=e(t,()=>tt(e$1,t.id));return e$1.length=0,t.isMounted=true,n}function ot(t){if(!(t.isDestroyed||!t.onUpdate||t.onUpdate.length===0))return e(t,()=>tt(t.onUpdate,t.id))}function it(t,e,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(e))o==null||o.add(r),Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));if(o)for(let r of Object.getOwnPropertyNames(t))o.has(r)||delete t[r];}function Gt(t,e){let n=Object.getOwnPropertyDescriptor(t,e);return n.get?n.get.call(t):n.value}var st;st="normal";var ne=class{constructor(e,n={}){this.component=e;this.props=n;this[st]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=c();let o={};it(o,n),this.reactiveProps=shallowReactive(o);}mount(e$1,n){var s;if(this.parentNode=e$1,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)F(e$1,i,n);return this.state=2,this.renderedNodes}let o=d((s=this.parentScope)!=null?s:c());this.scope=o;let r=e(o,()=>{var c;let i=this.component(this.reactiveProps);return isFunction(i)&&(i=i(this.reactiveProps)),(isSignal(i)||isComputed(i))&&(i=i.value),(c=B(e$1,i,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,nt(o),this.renderedNodes}update(e){this.props=e;let n=this.scope;!n||n.isDestroyed||(it(this.reactiveProps,e!=null?e:{},true),this.syncSpecialProps(e),ot(n));}forceUpdate(){if(!this.parentNode)return;let e=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(e,n);}destroy(){let e=this.scope;if(!(!e||e.isDestroyed)){this.scope=null,this.releaseSpecialProps(),f(e);for(let n of this.renderedNodes)K(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(e){if(!e)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(e)){let r=Gt(e,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(isOn(o)&&isFunction(r)){let s=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,s,r));}}}}releaseSpecialProps(){for(let e of this.rootEventCleanups)e();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(e,n){if(isFunction(e))return e(n),()=>e(null);if(isSignal(e)){let o=e.value;return e.value=n,()=>{e.value===n&&(e.value=o);}}}};function M(t){return !!t&&!!t.normal}function he(t,e){return M(t)?t:new ne(t,e)}function pe(t){let e,n=()=>{let o=document.createElement("template");o.innerHTML=t;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(e||(e=n())).cloneNode(true)}function Yt(t,e$1){let n=isString(e$1)?document.querySelector(e$1):e$1;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=d(),s;try{e(r,()=>{let i=he(t);M(i)&&(s=i,F(n,i));});}catch(i){throw f(r),i}return {root:s,unmount:()=>{f(r),s==null||s.destroy();}}}function Jt(t,e$1){let n=isString(e$1)?document.querySelector(e$1):e$1;if(!n)return;De(n);let o=d(),r;try{e(o,()=>{let s=he(t);M(s)&&(r=s,B(n,s));});}catch(s){throw f(o),s}finally{Fe();}return {root:r,unmount:()=>{f(o),r==null||r.destroy();}}}function je(t,e){let n=c();n&&(n.provides||(n.provides=new Map),n.provides.set(t,e));}function ce(t,e){let n=c();if(!n)return e;let o=n;for(;o;){if(o.provides&&o.provides.has(t))return o.provides.get(t);o=o.parent;}return e}function Ke(t,e){Object.defineProperty(t,"target",{configurable:true,value:e});}function at(t){let e=t.target,n=t.type,o=t.target,r=t.currentTarget,s=()=>{let c=e[`_$${n}`];if(c&&isFunction(c)&&!e.disabled){let l=e[`${n}Data`];if(l?c.call(e,l,t):c.call(e,t),t.cancelBubble)return false}return e.host&&!isString(e.host)&&!e.host._$host&&isFunction(e.contains)&&e.contains(t.target)&&Ke(t,e.host),true},i=()=>{for(;s()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(t,"currentTarget",{configurable:true,get(){return e||document}}),t.composedPath){let c=t.composedPath();Ke(t,c[0]);for(let l=0;l<c.length-2&&(e=c[l],!!s());l++){if(e._$host){e=e._$host,i();break}if(e.parentNode===r)break}}else i();Ke(t,o);}var ge=Symbol("_$EVENTS");function Zt(t,e=window.document){let n=e,o=n[ge]||(n[ge]=new Set);for(let r of t)o.has(r)||(o.add(r),e.addEventListener(r,at));}function en(t=window.document){let e=t,n=e[ge];if(n){for(let o of n.keys())t.removeEventListener(o,at);delete e[ge];}}function oe(t,e,n,o){let r=ee(t,e,n,o);c()&&g(r);}function $e(t,e){let n=t,o=e==null?"":String(e);n.value!==o&&(n.value=o);}var rn={event:"change",forceChange:true,read:t=>t.checked,write(t,e){let n=t,o=!!e;n.checked!==o&&(n.checked=o);}},sn={event:"change",forceChange:true,read(t){let e=t;return e.checked?e.value:""},write(t,e){let n=t,o=String(e)===n.value;n.checked!==o&&(n.checked=o);}},ln={event:"change",forceChange:true,read:t=>t.files,write(){}},cn={event:"input",ime:true,read:t=>t.value,write:$e},an={event:"input",ime:true,read:t=>t.value,write:$e},un={event:"change",forceChange:true,read(t){let e=t;return e.multiple?Array.from(e.selectedOptions,n=>n.value):e.value},write(t,e){let n=t;if(n.multiple){let o=new Set((Array.isArray(e)?e:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else $e(t,e);}};function fn(t,e){switch(t.nodeName){case "INPUT":return e==="checked"?t.type==="radio"?sn:rn:e==="files"?ln:cn;case "SELECT":return un;case "TEXTAREA":return an;default:return {event:"input",read:n=>n[e],write(n,o){n[e]=o;}}}}function dn(t,e,n){if(!isString(t))return t;let o=t;if(e&&(o=o.trim()),n&&o!==""){let r=Number(o);if(!Number.isNaN(r))return r}return o}function mn(t){let e=t.getRootNode();return (e instanceof Document||e instanceof ShadowRoot)&&e.activeElement===t}function pn(t,e,n,o,r={}){if(!t)return;let{event:s,read:i,write:c$1,forceChange:l,ime:u}=fn(t,e),f=r.trim===true,d=r.number===true,p=r.lazy===true,h=(f||d)&&e!=="files",N=isFunction(n)?n:()=>n,m=h?S=>dn(S,f,d):S=>S,g$1=false,a=p||l?"change":s,y=()=>{if(g$1)return;let S=i(t);if(S===void 0)return;let A=m(S);Object.is(N(),A)||o(A);};oe(t,a,y),!p&&h&&a!=="change"&&oe(t,"change",()=>c$1(t,m(i(t)))),u&&!p&&(oe(t,"compositionstart",()=>{g$1=true;}),oe(t,"compositionend",()=>{g$1&&(g$1=false,y());}));let v=effect(()=>{let S=N();u&&!p&&mn(t)&&(g$1||Object.is(m(i(t)),S))||c$1(t,S);});c()&&g(()=>v.stop());}function yn(t,e){let n=new Set(e);return new Proxy(t,{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)}})}function ut(t){return !t||t.children==null?null:t.children}ut[Ae]=true;function hn(t){return !!t&&!!t[Ae]}function Ee(t){let e=isFunction(t.target)?t.target():t.target;return e==null?null:isString(e)?document.querySelector(e):e}function Ne(t){return isFunction(t.disabled)?!!t.disabled():!!t.disabled}function dt(t){if(le()){let f=Nn(t);if(f)return f}let e$1=document.createComment("portal");e$1[ie]=true;let{children:n}=t;if(n==null)return e$1;let o=c(),r=null,s=(f,d$1)=>{r=d(o),e(r,()=>{B(f,()=>n,d$1);});},i=()=>{r&&(f(r),r=null);},c$1=(f,d)=>{if(i(),f){let p=e$1.parentNode;if(!p)return;s(p,e$1);return}d&&s(d);},l=false,u=effect(()=>{let f=Ne(t),d=f?null:Ee(t);l&&c$1(f,d);});return Oe(()=>{l=!0;let f=Ne(t),d=f?null:Ee(t);if(f||d){c$1(f,d);return}queueMicrotask(()=>{e$1.parentNode&&c$1(Ne(t),Ee(t));});}),g(()=>{u.stop(),i();}),e$1}dt[ie]=true;function Nn(t){if(Ne(t))return null;let e=Re();if(!e)return null;let n=Ee(t);return !n||!Le(n)?null:(e[ie]=true,e)}function vn(t){return !!t&&!!t[ie]}function Se(t){for(;t.firstChild;)t.removeChild(t.firstChild);}function mt(t){let e=t;for(;isFunction(e);)e=e();return isSignal(e)||isComputed(e)?mt(e.value):e}var ae=Symbol("SuspenseContext");function pt(t){var N;if(!isBrowser())return (N=t.fallback)!=null?N:"";let e=document.createElement("div");e.style.display="contents";let n=true,o=0,r=false,s=null,i=m=>{let g=mt(m);if(isArray(g)){let a=[];for(let y of g){let v=i(y);isArray(v)?a.push(...v):a.push(v);}return a}return Z(g)},c=m=>{let g=i(m),a=isArray(g)?g:[g];for(let y of a)y!=null&&F(e,y);},l=()=>{Se(e),t.fallback!=null&&c(t.fallback);},u=()=>{r||(r=true,l());},f=()=>{!r||!(s||t.children!=null&&!isPromise(t.children))||(r=false,Se(e),s?d(s):t.children!=null&&!isPromise(t.children)&&d(t.children));},d=m=>{if(r||(Se(e),m==null))return;let g=isArray(m)?m:[m];for(let a of g)a!=null&&c(a);r&&l();},p={register:m=>{o++,u(),m.then(()=>{n&&(o--,o===0&&f());}).catch(g=>{n&&(o--,o===0&&f());});},increment:()=>{o++,u();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};je(ae,p);let h=t.children;return isPromise(h)?(h.then(m=>{s=m;}).catch(()=>{}),p.register(h)):h!=null?d(h):u(),te(()=>{n=false,o=0,s=null,Se(e),e.remove();}),e}pt[Pe]=true;function _n(t){return !!t&&!!t[Pe]}function xn(t,e){let n=signal(e==null?void 0:e.initialValue),o=signal(true),r=signal(null),s=signal("pending"),i=0,c=null,l=false,u=ce(ae,null),f=()=>b(null,null,function*(){let h=++i;o.value=true,s.value="pending",r.value=null,l=false,u&&u.increment();try{let N=t();c=N,N.catch(()=>{});let m=yield N;h===i&&(n.value=m,s.value="ready",o.value=!1);}catch(N){h===i&&(r.value=N instanceof Error?N:new Error(String(N)),s.value="errored",o.value=false);}finally{u&&u.decrement();}});f();let d=(()=>(!l&&o.value&&c&&u&&(l=true,u.register(c)),n.value));return d.loading=o,d.error=r,d.state=s,[d,{mutate:h=>{n.value=h,s.value="ready",o.value=false,r.value=null;},refetch:()=>b(null,null,function*(){yield f();})}]}function yt(t){return isFunction(t)?t:t.default}function ze(t,e,n){let o=new ne(e,n);return o.mount(t),o}function Pn(t,e={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:s}=e;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=t,g.__asyncResolved=()=>null,g}let p=null,h=null,N=()=>h||(h=t().then(g=>{p=yt(g);}).catch(()=>{}),h);N();let m=g=>p?p(g):"";return m.__asyncLoader=N,m.__asyncResolved=()=>p,m}let i=null,c=null,l="pending",u=null;function f(){return u||(u=t().then(p=>{i=yt(p),l="resolved";}).catch(p=>{c=p instanceof Error?p:new Error(String(p)),l="errored",u=null;}),u)}f();function d(p){var W;if(l==="resolved"&&i){let C=document.createElement("div");C.style.display="contents";let I=ze(C,i,p);return g(()=>I.destroy()),C}if(l==="errored"&&c){let C=document.createElement("div");if(C.style.display="contents",e.error){let I=true,R=null,$=(q,E)=>{I&&(R==null||R.destroy(),R=ze(C,q,E));},X=()=>{u=null,l="pending",c=null,e.loading&&$(e.loading),f().then(()=>{I&&(l==="resolved"&&i?$(i,p):l==="errored"&&c&&e.error&&$(e.error,{error:c,retry:X}));});};$(e.error,{error:c,retry:X}),te(()=>{I=false,R==null||R.destroy(),R=null;});}return C}let h=document.createElement("div");h.style.display="contents";let N=true,m=null,g$1=null,a=null,y=(C,I)=>{N&&(m==null||m.destroy(),m=ze(h,C,I));},v=C=>()=>{u=null,l="pending",c=null,e.loading&&y(e.loading),f().then(()=>{l==="resolved"&&i?y(i,C):l==="errored"&&c&&e.error&&y(e.error,{error:c,retry:v(C)});});};te(()=>{N=false,m==null||m.destroy(),m=null,g$1!=null&&clearTimeout(g$1),a!=null&&clearTimeout(a);});let S=(W=ce(ae))!=null?W:null,A=C=>y(C,p),T=C=>{e.error&&y(e.error,{error:C,retry:v(p)});},V=()=>{e.loading&&y(e.loading);},j=f().then(()=>{N&&(l==="resolved"&&i?A(i):l==="errored"&&c&&(T(c),s&&s(c,v(p))),g$1!=null&&clearTimeout(g$1),a!=null&&clearTimeout(a));});return S&&S.register(j),n>0?g$1=setTimeout(()=>{N&&l==="pending"&&V();},n):e.loading&&V(),o!=null&&(a=setTimeout(()=>{if(N&&l==="pending"){let C=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=C,l="errored",T(C),s&&s(C,v(p));}},o)),h}return d.__asyncLoader=f,d.__asyncResolved=()=>i,d}function ht(t){let e$1=document.createDocumentFragment(),n=document.createComment("");e$1.appendChild(n);let o=[],r=[],s=t.key,i=t.children,c$1=()=>{var y,v;let a=t.each;return isSignal(a)?(y=a.value)!=null?y:[]:isFunction(a)?(v=a())!=null?v:[]:a!=null?a:[]},l=a=>s?s(a):a,u=a=>{if(Array.isArray(a)){let y=[];for(let v of a)y.push(...u(v));return y}return [Z(a)]},f$1=(a,y,v)=>{let S=u(a);for(let A of S)v?y.insertBefore(A,v):y.appendChild(A);return S},d$1=(a,y)=>{if(!t.fallback)return;r=f$1(t.fallback(),a,y);},p=()=>{for(let a of r)a.parentNode&&a.parentNode.removeChild(a);r=[];},h=(a,y,v,S)=>{let A=c(),T=d(A),V=[];return e(T,()=>{V=f$1(i(a,y),v,S);}),{key:l(a),item:a,nodes:V,scope:T}},N=a=>{f(a.scope);for(let y of a.nodes)y.parentNode&&y.parentNode.removeChild(y);},m=effect(()=>{let a=c$1(),y=n.parentNode;if(!y){if(a.length===0)d$1(e$1,n);else {o=new Array(a.length);let v=0;for(let S of a)o[v]=h(S,v,e$1,n),v++;}return}g$1(y,a);});function g$1(a,y){let v=o.length,S=y.length;if(S===0){for(let E=0;E<v;E++)N(o[E]);o=[],t.fallback&&r.length===0&&d$1(a,n);return}if(v===0||r.length>0){r.length>0&&p(),o=new Array(S);let E=document.createDocumentFragment();for(let x=0;x<S;x++)o[x]=h(y[x],x,E,null);a.insertBefore(E,n);return}let A=new Map;for(let E=0;E<v;E++){let x=o[E],H=A.get(x.key),U=[x,E];H?H.push(U):A.set(x.key,[U]);}let T=new Array(S),V=[],j=null,W=new Int32Array(S),C=false,I=0,R=new Array(S);for(let E=0;E<S;E++)R[E]=l(y[E]);for(let E=0;E<S;E++){let x=y[E],H=R[E],U=A.get(H);if(U&&U.length>0){let[re,L]=U.shift();Object.is(re.item,x)?(re.item=x,T[E]=re,W[E]=L+1,L<I?C=true:I=L):(j||(j=document.createDocumentFragment()),N(re),T[E]=h(x,E,j,null));}else j||(j=document.createDocumentFragment()),T[E]=h(x,E,j,null);}for(let E of A.values())for(let[x]of E)V.push(x);for(let E of V)N(E);let $=C?Ie(W):[],X=$.length-1,q=n;for(let E=S-1;E>=0;E--){let H=T[E].nodes;if(!(W[E]===0)&&C&&X>=0&&E===$[X]){X--;for(let L=H.length-1;L>=0;L--)q=H[L];continue}for(let L=H.length-1;L>=0;L--){let be=H[L];be.nextSibling!==q&&a.insertBefore(be,q),q=be;}}o=T;}return g(()=>{m.stop();for(let a of o)N(a);o=[],p(),n.parentNode&&n.parentNode.removeChild(n);}),e$1}ht[Xe]=true;
2
+ export{ne as Component,ht as For,ut as Fragment,dt as Portal,pt as Suspense,ee as addEvent,oe as addEventListener,De as beginHydration,pn as bindElement,$t as child,en as clearDelegatedEvents,Re as consumeTeleportAnchor,Le as consumeTeleportBlock,Yt as createApp,he as createComponent,xn as createResource,Pn as defineAsyncComponent,Zt as delegateEvents,Fe as endHydration,Je as getHydrationKey,Mt as getRenderedElement,Jt as hydrate,ce as inject,B as insert,M as isComponent,hn as isFragment,le as isHydrating,vn as isPortal,_n as isSuspense,Ut as next,fe as normalizeClass,zt as nthChild,yn as omitProps,te as onDestroy,Oe as onMount,Bt as onUpdate,G as patchAttr,Ht as patchAttrHydrate,de as patchClass,It as patchClassHydrate,me as patchStyle,Ot as patchStyleHydrate,je as provide,Lt as resetHydrationKey,J as setStyle,pe as template};//# sourceMappingURL=template.esm.js.map
3
3
  //# sourceMappingURL=template.esm.js.map