@estjs/template 0.0.15-beta.13 → 0.0.15-beta.17

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
- 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var Et=Object.defineProperty;var we=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;var De=(e,t,n)=>t in e?Et(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))vt.call(t,n)&&De(e,n,t[n]);if(we)for(var n of we(t))xt.call(t,n)&&De(e,n,t[n]);return e};var re=(e,t,n)=>new Promise((o,r)=>{var s=a=>{try{c(n.next(a));}catch(f){r(f);}},i=a=>{try{c(n.throw(a));}catch(f){r(f);}},c=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,i);c((n=n.apply(e,t)).next());});var F=null,_t=0;function b(){return F}function M(e){F=e;}function j(e=F){let t={id:++_t,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 K(e,t){let n=F;F=e;try{return t()}finally{F=n;}}function V(e){var t,n,o,r,s;if(!(!e||e.isDestroyed)){if(e.children)for(;e.children.size>0;){let i=e.children.values().next().value;i&&V(i);}if(e.onDestroy){for(let i of e.onDestroy)try{i();}catch(c){}e.onDestroy.clear();}if(e.cleanup){for(let i of e.cleanup)try{i();}catch(c){}e.cleanup.clear();}(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),(n=e.children)==null||n.clear(),(o=e.provides)==null||o.clear(),(r=e.onMount)==null||r.clear(),(s=e.onUpdate)==null||s.clear(),M(e.parent),e.parent=null,e.isDestroyed=true;}}function R(e){let t=F;t&&(t.cleanup||(t.cleanup=new Set),t.cleanup.add(e));}var Le="_$spread$";var Me="http://www.w3.org/2000/svg",ie="http://www.w3.org/2000/xlink",se="http://www.w3.org/2000/xmlns/";var ce=Symbol(""),ae=Symbol(""),W=Symbol(""),fe=Symbol(""),Re=Symbol("");var He=1e3,Ie=new WeakMap;function Ke(e){let t=Ie.get(e);if(!t){let n=e.name||"anonymous",o=Oe(e.toString()).toString(36);t=`${n}_${o}`,Ie.set(e,t);}return t}function Oe(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 kt=0;function le(e){if(!shared.isFalsy(e)){if(shared.isString(e))return e.length<=He?e:`${e.slice(0,He-10)}_${Oe(e).toString(36)}`;if(shared.isNumber(e))return String(e);if(shared.isSymbol(e)){let t=Symbol.keyFor(e);if(t)return `_s.${t}`;let n=e.description;return n?`_s.${n}`:`${kt++}`}return String(e)}}var ue=Symbol("essor.key");function z(e,t){if(y(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let n=le(t);shared.isFalsy(n)?delete e[ue]:e[ue]=n;}function D(e){if(e)return y(e)?e.key:e[ue]}function L(e){if(shared.isHTMLElement(e))return e;if(shared.isPrimitive(e)){let t=shared.isFalsy(e)?"":String(e);return document.createTextNode(t)}return e}function w(e,t){let n=D(e),o=D(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(shared.isPrimitive(e)||shared.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 pe(e,t){if(e===t)return true;if(shared.isNull(e)||shared.isNull(t)||!shared.isObject(e)||!shared.isObject(t)||shared.isArray(e)!==shared.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 C(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 X(e,t,n){if(!e||!t||!n||t===n)return;let o=y(n)?n.beforeNode:n.nextSibling;k(n),C(e,t,o);}function P(e){if(e){if(y(e))return e.firstChild;if(!shared.isPrimitive(e))return e}}function Ye(e,t){if(y(e)||y(t))return;let n=D(e);n&&!D(t)&&z(t,n);}function H(e,t,n){if(n===t)return t;let o=shared.isHTMLElement(t);if(shared.isHTMLElement(n)&&o){if(n.isEqualNode(t))return t;if(t.tagName===n.tagName){let c=t.attributes,a=n.attributes;for(let f=c.length-1;f>=0;f--){let p=c[f].name;n.hasAttribute(p)||t.removeAttribute(p);}for(let f=0,p=a.length;f<p;f++){let u=a[f];t.getAttribute(u.name)!==u.value&&t.setAttribute(u.name,u.value);}return Ye(t,n),t}}if(shared.isTextNode(t)&&shared.isTextNode(n))return t.textContent!==n.textContent&&(t.textContent=n.textContent),Ye(t,n),t;let s=y(t),i=y(n);return s&&i&&t.component===n.component?n.update(t):(X(e,n,t),n)}function Be(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++)C(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)?(H(e,i,c),n[0]=i):X(e,c,i),n}if(r===2&&s===2){let i=t[0],c=t[1],a=n[0],f=n[1];if(w(i,a)&&w(c,f))return H(e,i,a),H(e,c,f),n[0]=i,n[1]=c,n;if(w(i,f)&&w(c,a)){H(e,i,f),H(e,c,a);let p=P(c),u=P(i);return p&&u&&p.parentNode===e&&e.insertBefore(p,u),n[0]=c,n[1]=i,n}}return Dt(e,t,n,o)}function Dt(e,t,n,o){let r=0,s=0,i=t.length-1,c=n.length-1,a=t[0],f=t[i],p=n[0],u=n[c];for(;r<=i&&s<=c;)if(!a)a=t[++r];else if(!f)f=t[--i];else if(w(a,p))H(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(!f)f=t[--i];else if(w(f,u))H(e,f,u),n[c]=f,f=t[--i],u=n[--c];else break;if(r>i){if(s<=c){let l=c+1<n.length?P(n[c+1]):o;for(let m=s;m<=c;m++)C(e,n[m],l);}}else if(s>c)for(let l=r;l<=i;l++){let m=t[l];m&&k(m);}else Lt(e,t,n,r,i,s,c,o);return n}function Lt(e,t,n,o,r,s,i,c){let a=i-s+1,f;for(let N=s;N<=i;N++){let E=D(n[N]);E!==void 0&&(f||(f=Object.create(null)),f[E]=N);}let p=new Int32Array(a),u=false,l=0,m=0;for(let N=o;N<=r;N++){let E=t[N];if(!E)continue;if(m>=a){k(E);continue}let x,_=D(E);if(_!==void 0&&f&&_ in f)x=f[_];else for(let d=s;d<=i;d++)if(p[d-s]===0&&_===void 0&&D(n[d])===void 0&&w(E,n[d])){x=d;break}x===void 0?k(E):(p[x-s]=N+1,x>=l?l=x:u=true,H(e,E,n[x]),n[x]=E,m++);}let S=u?Mt(p):[],v=S.length-1,h=c;for(let N=a-1;N>=0;N--){let E=s+N,x=n[E];if(p[N]===0)C(e,x,h),h=P(x)||h;else if(u)if(v<0||N!==S[v]){let _=P(x);_&&_.parentNode===e&&C(e,_,h),h=_||h;}else h=P(x)||h,v--;else h=P(x)||h;}}function Mt(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 f=e[r];if(f!==0){if(s=n[n.length-1],n.length===0||e[s]<f){o[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)a=i+c>>1,e[n[a]]<f?i=a+1:c=a;f<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 T(e,t,n,o){e.addEventListener(t,n,o),R(()=>{e.removeEventListener(t,n,o);});}function Ot(e,t,n,o){shared.isHtmlInputElement(e)?Vt(e,o):shared.isHtmlSelectElement(e)?$t(e,o):shared.isHtmlTextAreaElement(e)&&T(e,"input",()=>{o(e.value);});}function Vt(e,t){switch(e.type){case "checkbox":T(e,"change",()=>{t(!!e.checked);});break;case "radio":T(e,"change",()=>{t(e.checked?e.value:"");});break;case "file":T(e,"change",()=>{t(e.files);});break;case "number":case "range":T(e,"input",()=>{t(e.value||"");});break;case "date":case "datetime-local":case "month":case "time":case "week":T(e,"change",()=>{t(e.value||"");});break;default:T(e,"input",()=>{t(e.value);});break}}function $t(e,t){T(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 me(e,t,n){if(!e)return;let o=[],r=b(),s=signals.effect(()=>{let i=()=>{let c=shared.isFunction(t)?t():t,a=shared.coerceArray(c).map(f=>shared.isFunction(f)?f():f).flatMap(L);o=Be(e,o,a,n);};r?K(r,i):i();});return R(()=>{s(),o.forEach(i=>k(i)),o.length=0;}),o}function ye(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 f=a.firstChild;for(;f;){if(c(f))return true;f=f.nextSibling;}return false};return c(e),o}function Ut(e){let t=b();if(t){if(t.isMounted){try{e();}catch(n){}return}t.onMount||(t.onMount=new Set),t.onMount.add(e);}}function jt(e){let t=b();t&&(t.onUpdate||(t.onUpdate=new Set),t.onUpdate.add(e));}function zt(e){let t=b();t&&(t.onDestroy||(t.onDestroy=new Set),t.onDestroy.add(e));}function We(e){!e||e.isDestroyed||e.isMounted||(e.isMounted=true,e.onMount&&K(e,()=>{for(let t of e.onMount)try{t();}catch(n){}}));}function he(e){if(!(!e||e.isDestroyed)&&e.onUpdate)for(let t of e.onUpdate)try{t();}catch(n){}}function ge(e){Ut(e);}function Ne(e){zt(e);}function Yt(e){jt(e);}var Qe;Qe=ce;var J=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[Qe]=true;this.key=n.key?le(n.key):Ke(t),this.reactiveProps=signals.shallowReactive(O({},n)),this.parentScope=b();for(let o in n){let r=n[o];shared.isObject(r)&&(this._propSnapshots[o]=shared.isArray(r)?[...r]:O({},r));}}get isConnected(){return this.state===2}get firstChild(){for(let t of this.renderedNodes){let n=P(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)C(t,a,n);return this.state=2,this.renderedNodes}let o=(i=this.parentScope)!=null?i:b();this.scope=j(o),M(this.scope);let r=this.component(this.reactiveProps);shared.isFunction(r)&&(r=r(this.reactiveProps)),(signals.isSignal(r)||signals.isComputed(r))&&(r=r.value);let s=(c=me(t,r,n))!=null?c:[];return this.renderedNodes=s,this.applyProps(this.props),this.state=2,We(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&&(M(this.scope),this.applyProps(this.props),he(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(shared.isObject(o)){let i=this._propSnapshots[n];if(i&&pe(o,i))continue;let c=shared.isArray(o)?[...o]:O({},o);this.reactiveProps[n]=c,this._propSnapshots[n]=c;}else shared.hasChanged(o,r)&&(this.reactiveProps[n]=o,this._propSnapshots[n]&&delete this._propSnapshots[n]);}}unwrapRenderResult(t){return shared.isFunction(t)&&(t=t(this.reactiveProps)),(signals.isSignal(t)||signals.isComputed(t))&&(t=t.value),y(t)&&(t=t.mount(this.parentNode,this.beforeNode)),shared.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{K(this.scope,()=>{let n=this.component(this.reactiveProps);shared.isFunction(n)&&(n=n(this.reactiveProps)),(signals.isSignal(n)||signals.isComputed(n))&&(n=n.value);let o=shared.coerceArray(n),r=this._getAnchorNode();if(this.parentNode){for(let s of this.renderedNodes)k(s);for(let s of o)C(this.parentNode,s,r);this.renderedNodes=o;}}),this.scope&&he(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=P(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&&(V(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(shared.startsWith(o,"on")){if(!n||!shared.isHTMLElement(n))return;let s=o.slice("on".length).toLowerCase();T(n,s,r);}else o==="ref"&&signals.isSignal(r)&&(r.value=n);this.props=t;}};function y(e){return !!e&&!!e[ce]}function Y(e,t){return y(e)?e:new J(e,t)}function ve(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 en(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n){shared.error(`Target element not found: ${t}`);return}n.innerHTML&&(shared.error(`Target element is not empty, it will be delete: ${t}`),n.innerHTML="");let r=y(e)?e:Y(e);return r.mount(n),r}function xe(e,t){let n=b();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function _e(e,t){let n=b();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 Ae(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ot(e,t,n){let o=e[`_$${n}`];if(o&&shared.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&&!shared.isString(e.host)&&!e.host._$host&&shared.isFunction(e.contains)&&e.contains(t.target)&&Ae(t,e.host),true}function tt(e,t,n){let o=e;for(;ot(o,t,n)&&(o=o._$host||o.parentNode||o.host););return o}function nn(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();Ae(e,s[0]);for(let i=0;i<s.length-2&&(t=s[i],!!ot(t,e,n));i++){if(t._$host){t=t._$host,t=tt(t,e,n);break}if(t.parentNode===r)break}}else t=tt(t,e,n);Ae(e,o);}var nt=Symbol("_$EVENTS");function on(e,t=window.document){let n=t,o=n[nt]||(n[nt]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,nn));}function rn(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 be=false;function Q(){be=true;}function B(){be=false;}function I(){return be}var rt=0;function Z(){return `${rt++}`}function ee(){rt=0;}var st=/^\d+-\d+$/;function ct(e){return ()=>{if(!shared.isBrowser())return null;let t=Z(),n=document.querySelector(`[data-hk="${t}"]`);return n||ve(e)()}}function at(e,t){let n=e.dataset.hk;if(!n)return ye(e,t);let o=[],r=e.querySelectorAll(`[data-idx^="${n}"]`);r.length>0&&o.push(...Array.from(r).filter(a=>{let f=a.dataset.idx;return f!==null&&st.test(f)}).map(a=>{let f=a.dataset.idx||"",[p,u]=f.split("-");return {hk:p,idx:u,node:a}}));let s=[],i=a=>{if(a.nodeType===Node.COMMENT_NODE&&a.textContent&&st.test(a.textContent)){let[p,u]=a.textContent.split("-");s.push({hk:p,idx:u,node:a});}let f=a.firstChild;for(;f;)i(f),f=f.nextSibling;};i(e),o.push(...s);let c=[e];return t.forEach(a=>{let f=o.find(p=>p.idx===String(a));f&&c.push(f.node);}),c}function ft(e,t){Q(),ee();try{let n=shared.isString(t)?document.querySelector(t):t;if(!n){shared.error("Hydration error: Root element not found");return}let o=Y(e);return o.mount(n),B(),o}catch(n){shared.error("Hydration error:",n),B();return}}function ut(e,t,n,o=false){if(t===n||I())return;let r=te(n),s=te(t);r&&s===r||(r?o?e.setAttribute("class",r):e.className=r:e.removeAttribute("class"));}function te(e){return shared.normalizeClassName(e)}var lt=/\s*!important$/,dn=["Webkit","Moz","ms"],Ce={};function pt(e,t,n){let o=e.style,r=shared.isString(n);if(!I()){if(n&&r){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t))for(let s in t)(!n||n[s]==null)&&U(o,s,"");else if(t&&shared.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&&shared.isObject(n)&&n[a]==null&&U(o,a,"");}}}if(n&&!shared.isString(n))for(let s in n){let i=n[s];(!t||shared.isString(t)||t[s]!==i)&&i!=null&&U(o,s,i);}}}function U(e,t,n){if(shared.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=pn(e,t);shared.isString(n)&&lt.test(n)?e.setProperty(shared.camelCase(o),n.replace(lt,""),"important"):e[o]=n;}function pn(e,t){let n=Ce[t];if(n)return n;let o=shared.camelCase(t);if(o!=="filter"&&o in e)return Ce[t]=o;o=shared.capitalize(o);for(let r of dn){let s=r+o;if(s in e)return Ce[t]=s}return t}function ke(e,t,n,o){if(t==="key"){o==null?z(e,void 0):z(e,String(o));return}if(t===Le){Object.keys(o).forEach(u=>{ke(e,u,n==null?void 0:n[u],o==null?void 0:o[u]);});return}if(I())return;let r=(e==null?void 0:e.namespaceURI)===Me,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=shared.isSpecialBooleanAttr(t)||shared.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(ie,t.slice(6));else if(i){let u=t.slice(6);e.removeAttributeNS(se,u);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(ie,t,String(o));return}if(i){e.setAttributeNS(se,t,String(o));return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let f=shared.isSymbol(o)?String(o):o;if((a==="href"||a==="src"||a==="xlink:href")&&shared.isString(f)){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 mt(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=O({},o);return i.delegate=void 0,e.addEventListener(t,s,i),()=>{e.removeEventListener(t,s,i);}}function yt(e){if(!(e!=null&&e.children))return shared.error("Fragment component requires children"),null;let{children:t}=e;return t}yt[ae]=true;function vn(e){return !!e&&!!e[ae]}function gt(e){let t=document.createComment("portal");t[W]=true;let n=e.children;if(n){let o=shared.isArray(n)?n:[n],r=[];ge(()=>{let s=shared.isString(e.target)?document.querySelector(e.target):e.target;s&&(o.forEach(i=>{if(i!=null){let c=L(i);c&&(C(s,c),r.push(c));}}),R(()=>{r.forEach(i=>{!shared.isString(i)&&i.parentNode===s&&s.removeChild(i);});}));});}return t}gt[W]=true;function _n(e){return !!e&&!!e[W]}var Te=Symbol("SuspenseContext");function Nt(e){if(shared.isUndefined(document)){let u=e.fallback;return u?String(u||""):""}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 u=L(e.fallback);u&&C(t,u);}}},c=()=>{if(!(!r||!(s||e.children!=null&&!shared.isPromise(e.children)))){for(r=false;t.firstChild;)t.removeChild(t.firstChild);s?a(s):e.children!=null&&!shared.isPromise(e.children)&&a(e.children);}},a=u=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(u==null)return;let l=b();if((shared.isArray(u)?u:[u]).forEach(S=>{if(S!=null){y(S)&&(S.parentContext=l);let v=L(S);v&&C(t,v);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let S=L(e.fallback);S&&C(t,S);}}},f={register:u=>{o++,i(),u.then(()=>{n&&(o--,o===0&&c());}).catch(l=>{n&&(o--,o===0&&c());});},increment:()=>{o++,i();},decrement:()=>{o--,o===0&&c();}};xe(Te,f);let p=e.children;return shared.isPromise(p)?(p.then(u=>{s=u;}).catch(()=>{}),f.register(p)):p!=null?a(p):i(),Ne(()=>{for(n=false;t.firstChild;)t.removeChild(t.firstChild);}),t}Nt[fe]=true;function Cn(e){return !!e&&!!e[fe]}function kn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,c=null,a=()=>re(null,null,function*(){let u=++i;o.value=true,s.value="pending",r.value=null;try{let l=e();c=l.then(()=>{}).catch(()=>{});let m=yield l;u===i&&(n.value=m,s.value="ready",o.value=!1);}catch(l){u===i&&(r.value=l instanceof Error?l:new Error(String(l)),s.value="errored",o.value=false);}});a();let f=(()=>{if(o.value&&c){let u=_e(Te,null);u&&u.register(c);}return n.value});return f.loading=o,f.error=r,f.state=s,[f,{mutate:u=>{n.value=u,s.value="ready",o.value=false,r.value=null;},refetch:()=>re(null,null,function*(){yield a();})}]}function St(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=null,s=e.keyFn,i=e.children,c=()=>{var m,S;let l=e.each;return signals.isSignal(l)?(m=l.value)!=null?m:[]:typeof l=="function"?(S=l())!=null?S:[]:l!=null?l:[]},a=l=>s?s(l):l,f=(l,m,S,v)=>{var x;let h=b(),N=j(h);M(N);let E;try{let _=i(l,m);y(_)?(_.mount(S,v),E=(x=_.firstChild)!=null?x:document.createComment("empty")):(E=_,E.parentNode||(v?S.insertBefore(E,v):S.appendChild(E)));}finally{M(h);}return {key:a(l),node:E,scope:N}},p=l=>{V(l.scope),l.node.parentNode&&l.node.parentNode.removeChild(l.node);};signals.memoEffect(({prev:l})=>{var v;let m=c();if(l===m)return {prev:m};let S=n.parentNode;if(!S){if(m.length===0){if(e.fallback){let h=e.fallback();y(h)?(h.mount(t,n),r=(v=h.firstChild)!=null?v:document.createComment("empty")):(r=h,t.insertBefore(r,n));}return {prev:m}}o=new Array(m.length);for(let[h,N]of m.entries())o[h]=f(N,h,t,n);return {prev:m}}return signals.untrack(()=>u(S,m)),{prev:m}},{prev:[]});function u(l,m){var _;let S=o.length,v=m.length;if(v===0){for(let d=0;d<S;d++)p(o[d]);if(o=[],e.fallback&&!r){let d=e.fallback();y(d)?(d.mount(l,n),r=(_=d.firstChild)!=null?_:document.createComment("empty")):(r=d,l.insertBefore(r,n));}return}if(S===0||r){r&&(r.parentNode&&r.parentNode.removeChild(r),r=null),o=new Array(v);let d=document.createDocumentFragment();for(let A=0;A<v;A++)o[A]=f(m[A],A,d,null);l.insertBefore(d,n);return}let h=new Map;for(let d=0;d<S;d++){let A=o[d],G=h.get(A.key);G?G.push(A):h.set(A.key,[A]);}let N=new Array(v),E=[],x=document.createDocumentFragment();for(let d=0;d<v;d++){let A=m[d],G=a(A),oe=h.get(G);oe&&oe.length>0?N[d]=oe.shift():N[d]=f(A,d,x,null);}for(let d of h.values())for(let A of d)E.push(A);for(let d of E)p(d);for(let d=0;d<v;d++){let A=N[d].node;l.insertBefore(A,n);}o=N;}return R(()=>{for(let l of o)p(l);r&&r.parentNode&&r.parentNode.removeChild(r),n.parentNode&&n.parentNode.removeChild(n);}),t}St[Re]=true;
2
- exports.Component=J;exports.For=St;exports.Fragment=yt;exports.Portal=gt;exports.Suspense=Nt;exports.addEvent=mt;exports.addEventListener=T;exports.bindElement=Ot;exports.createApp=en;exports.createComponent=Y;exports.createResource=kn;exports.createScope=j;exports.delegateEvents=on;exports.disposeScope=V;exports.endHydration=B;exports.getActiveScope=b;exports.getFirstDOMNode=P;exports.getHydrationKey=Z;exports.getRenderedElement=ct;exports.hydrate=ft;exports.inject=_e;exports.insert=me;exports.insertNode=C;exports.isComponent=y;exports.isFragment=vn;exports.isHydrating=I;exports.isPortal=_n;exports.isSameNode=w;exports.isSuspense=Cn;exports.mapNodes=ye;exports.mapSSRNodes=at;exports.normalizeClass=te;exports.normalizeNode=L;exports.omitProps=rn;exports.onCleanup=R;exports.onDestroy=Ne;exports.onMount=ge;exports.onUpdate=Yt;exports.patchAttr=ke;exports.patchClass=ut;exports.patchStyle=pt;exports.provide=xe;exports.removeNode=k;exports.replaceNode=X;exports.resetHydrationKey=ee;exports.runWithScope=K;exports.setActiveScope=M;exports.setStyle=U;exports.shallowCompare=pe;exports.startHydration=Q;exports.template=ve;//# sourceMappingURL=template.cjs.js.map
1
+ 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var Be=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var ze=(e,t)=>{var n={};for(var o in e)gt.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Be)for(var o of Be(e))t.indexOf(o)<0&&Et.call(e,o)&&(n[o]=e[o]);return n};var be=(e,t,n)=>new Promise((o,r)=>{var i=s=>{try{c(n.next(s));}catch(a){r(a);}},l=s=>{try{c(n.throw(s));}catch(a){r(a);}},c=s=>s.done?o(s.value):Promise.resolve(s.value).then(i,l);c((n=n.apply(e,t)).next());});var ue="_$spread$";var We="http://www.w3.org/2000/svg",xe="http://www.w3.org/2000/xlink",Ae="http://www.w3.org/2000/xmlns/";var we=Symbol(""),ie=Symbol(""),Pe=Symbol(""),Xe=Symbol("");var I=null,vt=0;function _(){return I}function H(e=I){let t={id:++vt,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 A(e,t){let n=I;I=e;try{return t()}finally{I=n;}}function w(e){var n;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,e.children&&e.children.size>0){for(let o of e.children)o&&(o.parent=null,w(o));e.children.clear();}let t=I;I=e;try{if(e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(r){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(r){}e.cleanup=null;}}finally{I=t;}(n=e.parent)!=null&&n.children&&e.parent.children.delete(e),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null,e.parent=null;}function P(e){let t=I;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}function G(e,t,n,o){if(t==="key"){o==null?e.removeAttribute(t):e.setAttribute(t,String(o));return}if(t===ue){let f=shared.isObject(n)?n:null,y=shared.isObject(o)?o:null;if(f)for(let h in f)h!==ue&&(!y||!(h in y))&&G(e,h,f[h],null);if(y)for(let h in y)h!==ue&&G(e,h,f==null?void 0:f[h],y[h]);return}let r=(e==null?void 0:e.namespaceURI)===We,i=r&&t.startsWith("xlink:"),l=r&&t.startsWith("xmlns:"),c=shared.isSpecialBooleanAttr(t)||shared.isBooleanAttr(t);if(n===o||t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110)return;let s=t.toLowerCase();if(s==="innerhtml"||s==="srcdoc")return;if(o==null){if(i)e.removeAttributeNS(xe,t.slice(6));else if(l){let f=t.slice(6);e.removeAttributeNS(Ae,f);}else e.removeAttribute(t);return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let a=shared.isSymbol(o)?String(o):o;if((s==="href"||s==="src"||s==="xlink:href"||s==="action"||s==="formaction"||s==="poster")&&shared.isString(a)){let f=a.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(i){e.setAttributeNS(xe,t,String(a));return}if(l){e.setAttributeNS(Ae,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(f){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function fe(e,t,n,o=false){if(t===n)return;let r=de(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:de(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var de=shared.normalizeClassName;var Ge=/\s*!important$/,Rt=["Webkit","Moz","ms"],ke={};function pe(e,t,n){let o=e.style;if(n&&shared.isString(n)){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t)){let r=t;for(let i in r)(!n||n[i]==null)&&J(o,i,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,i;for(;(i=r.exec(t))!==null;){let l=i[1].trim();l&&n&&shared.isObject(n)&&n[l]==null&&J(o,l,"");}}if(n&&!shared.isString(n)){let r=n;for(let i in r){let l=r[i];(!t||shared.isString(t)||t[i]!==l)&&l!=null&&J(o,i,l);}}}function J(e,t,n){if(shared.isArray(n)){for(let r of n)J(e,t,r);return}if((n==null||n==="")&&(n=""),t.startsWith("--")){e.setProperty(t,n);return}let o=Dt(e,t);shared.isString(n)&&Ge.test(n)?e.setProperty(shared.camelCase(o),n.replace(Ge,""),"important"):e[o]=n;}function Dt(e,t){let n=ke[t];if(n)return n;let o=shared.camelCase(t);if(o!=="filter"&&o in e)return ke[t]=o;o=shared.capitalize(o);for(let r of Rt){let i=r+o;if(i in e)return ke[t]=i}return t}var Te=0;function Je(){return String(Te++)}function Ft(){Te=0;}var B=false;function le(){return B}var Q=new Map;function It(e){let t=e.querySelectorAll("[data-hk]");for(let n of t){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function Ht(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),t;for(;t=e.nextNode();){let n=t.data;if(n==="teleport-anchor")ye.push(t);else if(n==="teleport-start"){let o=t.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(t);}}}function Re(){var e;return (e=ye.shift())!=null?e:null}function De(e){let t=se.get(e),n=t==null?void 0:t.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 Le(e){B=true,Te=0,Q.clear(),ye.length=0,se.clear(),It(e),Ht();}function Me(){B=false,Q.clear(),ye.length=0,se.clear();}function Ot(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!B)return t||(t=me(e)),t();let n=Je(),o=Q.get(n);return o?(Q.delete(n),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),t||(t=me(e)),t())}}function Vt(e,t,n,o){B||fe(e,t,n,o);}function jt(e,t,n,o){B||G(e,t,n,o);}function Ut(e,t,n){B||pe(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Qe(e,t,n,o){let r=Fe(e,o),i=t.length,l=n.length;if(i===0&&l===0)return n;if(i===0){for(let d=0;d<l;d++)L(e,n[d],r);return n}if(l===0){for(let d=0;d<i;d++)U(t[d]);return []}let c=0,s=i-1,a=l-1;for(;c<=s&&c<=a&&t[c]===n[c];)c++;for(;s>=c&&a>=c&&t[s]===n[a];)s--,a--;if(c>s){if(c<=a){let d=a+1,f=Fe(e,d<l?n[d]:r);for(let y=c;y<=a;y++)L(e,n[y],f);}}else if(c>a)for(let d=c;d<=s;d++)U(t[d]);else Kt(e,t,n,c,s,a,r);return n}function Kt(e,t,n,o,r,i,l){let c=i-o+1,s=new Map;for(let p=o;p<=i;p++)s.set(n[p],p);let a=new Int32Array(c);a.fill(0);let d=0,f=false,y=0;for(let p=o;p<=r;p++){let m=t[p];if(d>=c){U(m);continue}let u=s.get(m);u===void 0?U(m):(a[u-o]=p+1,u>=y?y=u:f=true,d++);}let h=f?Ie(a):[],v=h.length-1;for(let p=c-1;p>=0;p--){let m=o+p,u=n[m],g=Fe(e,m+1<n.length?n[m+1]:l);a[p]===0?L(e,u,g):f&&(v<0||p!==h[v]?L(e,u,g):v--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,i,l,c,s;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(i=n[n.length-1],e[i]<a){t[r]=i,n.push(r);continue}for(l=0,c=n.length-1;l<c;)s=l+c>>1,e[n[s]]<a?l=s+1:c=s;a<e[n[l]]&&(l>0&&(t[r]=n[l-1]),n[l]=r);}}for(l=n.length,c=n[l-1];l-- >0;)n[l]=c,c=t[c];return n}function U(e){if(e)if(O(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function L(e,t,n){if(!e||!t)return;let o=O(n)?n.firstChild:n;if(O(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){return shared.isHTMLElement(e)?e:shared.isPrimitive(e)?document.createTextNode(shared.isFalsy(e)?"":String(e)):e}function z(e,t,n){if(!e)return;let o=_(),r=[],i=true,l=s=>s instanceof Node?[s]:shared.isNull(s)||shared.isUndefined(s)||shared.isString(s)||shared.isNumber(s)||shared.isBoolean(s)?[Z(s)]:shared.coerceArray(s).map(a=>shared.isFunction(a)?a():a).flatMap(a=>a).map(Z),c=signals.effect(()=>{let s=()=>{let a=shared.isFunction(t)?t():t,d=l(a);if(i&&le()&&d.every(f=>f instanceof Node&&f.parentNode===e)){r=d,i=false;return}r=Qe(e,r,d,n),i=false;};o&&!o.isDestroyed?A(o,s):s();});return P(()=>{c.stop();for(let s of r)U(s);r=[];}),r}function Zt(e){return (e==null?void 0:e.firstChild)||null}function en(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function tn(e,t){if(!e||t<0)return null;let n=e.firstChild;for(;n&&t>0;)n=n.nextSibling,t--;return n||null}function ee(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,i=a=>{let d=a.target;(d.matches(r)||d.closest(r))&&n.call(e,a);},s=o,{delegate:l}=s,c=ze(s,["delegate"]);return e.addEventListener(t,i,c),()=>{e.removeEventListener(t,i,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function tt(e,t,n){let o=e.length;if(o===0)return;let r;for(let i=0;i<o;i++)try{let l=e[i]();if(shared.isPromise(l)){let c=l.catch(s=>{});(r||(r=[])).push(c);}}catch(l){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=_();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function nn(e){let t=_();t&&He(t,"onUpdate",e);}function te(e){let t=_();t&&He(t,"onDestroy",e);}function nt(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=A(e,()=>tt(t,e.id,"mount"));return t.length=0,e.isMounted=true,n}function ot(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return A(e,()=>tt(e.onUpdate,e.id,"update"))}function it(e,t,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(t))o==null||o.add(r),Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));if(o)for(let r of Object.getOwnPropertyNames(e))o.has(r)||delete e[r];}function ln(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var st;st="normal";var ne=class{constructor(t,n={}){this.component=t;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=_();let o={};it(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var i;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let l of this.renderedNodes)L(t,l,n);return this.state=2,this.renderedNodes}let o=H((i=this.parentScope)!=null?i:_());this.scope=o;let r=A(o,()=>{var c;let l=this.component(this.reactiveProps);return shared.isFunction(l)&&(l=l(this.reactiveProps)),(signals.isSignal(l)||signals.isComputed(l))&&(l=l.value),(c=z(t,l,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,nt(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(it(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),ot(n));}forceUpdate(){if(!this.parentNode)return;let t=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(t,n);}destroy(){let t=this.scope;if(!(!t||t.isDestroyed)){this.scope=null,this.releaseSpecialProps(),w(t);for(let n of this.renderedNodes)U(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(t){if(!t)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(t)){let r=ln(t,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)&&shared.isFunction(r)){let i=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,i,r));}}}}releaseSpecialProps(){for(let t of this.rootEventCleanups)t();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(t,n){if(shared.isFunction(t))return t(n),()=>t(null);if(signals.isSignal(t)){let o=t.value;return t.value=n,()=>{t.value===n&&(t.value=o);}}}};function O(e){return !!e&&!!e.normal}function he(e,t){return O(e)?e:new ne(e,t)}function me(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 cn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=H(),i;try{A(r,()=>{let l=he(e);O(l)&&(i=l,L(n,l));});}catch(l){throw w(r),l}return {root:i,unmount:()=>{w(r),i==null||i.destroy();}}}function an(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Le(n);let o=H(),r;try{A(o,()=>{let i=he(e);O(i)&&(r=i,z(n,i));});}catch(i){throw w(o),i}finally{Me();}return {root:r,unmount:()=>{w(o),r==null||r.destroy();}}}function je(e,t){let n=_();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function ce(e,t){let n=_();if(!n)return t;let o=n;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return t}function Ue(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function at(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,i=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let s=t[`${n}Data`];if(s?c.call(t,s,e):c.call(t,e),e.cancelBubble)return false}return t.host&&!shared.isString(t.host)&&!t.host._$host&&shared.isFunction(t.contains)&&t.contains(e.target)&&Ue(e,t.host),true},l=()=>{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();Ue(e,c[0]);for(let s=0;s<c.length-2&&(t=c[s],!!i());s++){if(t._$host){t=t._$host,l();break}if(t.parentNode===r)break}}else l();Ue(e,o);}var ge=Symbol("_$EVENTS");function dn(e,t=window.document){let n=t,o=n[ge]||(n[ge]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,at));}function fn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,at);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);_()&&P(r);}var hn={event:"change",forceChangeEvent:true,read:e=>e.checked,write:(e,t)=>{let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},gn={event:"change",forceChangeEvent:true,read:e=>{let t=e;return t.checked?t.value:""},write:(e,t)=>{let n=e,o=String(t)===n.value;n.checked!==o&&(n.checked=o);}},En={event:"change",forceChangeEvent:true,read:e=>e.files,write:()=>{}},vn={event:"input",needsComposition:true,read:e=>e.value,write:(e,t)=>{let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}},Sn={event:"change",forceChangeEvent:true,read:e=>{let t=e;return t.multiple?Array.from(t.selectedOptions,n=>n.value):t.value},write:(e,t)=>{let n=e;if(n.multiple){let o=new Set((Array.isArray(t)?t:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else {let o=t==null?"":String(t);n.value!==o&&(n.value=o);}}},Nn={event:"input",needsComposition:true,read:e=>e.value,write:(e,t)=>{let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}};function Cn(e,t){let n=e.nodeName;if(n==="INPUT"){let o=e.type;return t==="checked"?o==="radio"?gn:hn:t==="files"?En:vn}return n==="SELECT"?Sn:n==="TEXTAREA"?Nn:{event:"input",read:o=>o[t],write:(o,r)=>{o[t]=r;}}}function _n(e,t,n){if(!shared.isString(e))return e;if(t&&(e=e.trim()),n&&e!==""){let o=Number(e);if(!Number.isNaN(o))return o}return e}function bn(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function xn(e,t,n,o,r={}){if(!e)return;let i=Cn(e,t),{trim:l,number:c,lazy:s}=r,a=t==="files",d=()=>shared.isFunction(n)?n():n,f=m=>a?m:_n(m,l,c),y=s||i.forceChangeEvent?"change":i.event,h=false,v=()=>{if(h)return;let m=i.read(e);if(m===void 0)return;if(a){o(m);return}let u=f(m);Object.is(d(),u)||o(u);};oe(e,y,v),!s&&!a&&(l||c)&&y!=="change"&&oe(e,"change",()=>{i.write(e,f(i.read(e)));}),i.needsComposition&&!s&&(oe(e,"compositionstart",()=>{h=true;}),oe(e,"compositionend",()=>{h&&(h=false,v());}));let p=signals.effect(()=>{let m=d();if(i.needsComposition&&!s&&bn(e)){if(h)return;let u=f(i.read(e));if(Object.is(u,m))return}i.write(e,m);});_()&&P(()=>p.stop());}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)}})}function ut(e){return !e||e.children==null?null:e.children}ut[we]=true;function wn(e){return !!e&&!!e[we]}function Ee(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function ve(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function ft(e){if(le()){let d=Tn(e);if(d)return d}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=_(),r=null,i=(d,f)=>{r=H(o),A(r,()=>{z(d,()=>n,f);});},l=()=>{r&&(w(r),r=null);},c=(d,f)=>{if(l(),d){let y=t.parentNode;if(!y)return;i(y,t);return}f&&i(f);},s=false,a=signals.effect(()=>{let d=ve(e),f=d?null:Ee(e);s&&c(d,f);});return Oe(()=>{s=!0;let d=ve(e),f=d?null:Ee(e);if(d||f){c(d,f);return}queueMicrotask(()=>{t.parentNode&&c(ve(e),Ee(e));});}),P(()=>{a.stop(),l();}),t}ft[ie]=true;function Tn(e){if(ve(e))return null;let t=Re();if(!t)return null;let n=Ee(e);return !n||!De(n)?null:(t[ie]=true,t)}function Rn(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function pt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?pt(t.value):t}var ae=Symbol("SuspenseContext");function mt(e){var v;if(!shared.isBrowser())return (v=e.fallback)!=null?v:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,i=null,l=p=>{let m=pt(p);if(shared.isArray(m)){let u=[];for(let g of m){let S=l(g);shared.isArray(S)?u.push(...S):u.push(S);}return u}return Z(m)},c=p=>{let m=l(p),u=shared.isArray(m)?m:[m];for(let g of u)g!=null&&L(t,g);},s=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,s());},d=()=>{!r||!(i||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),i?f(i):e.children!=null&&!shared.isPromise(e.children)&&f(e.children));},f=p=>{if(r||(Ne(t),p==null))return;let m=shared.isArray(p)?p:[p];for(let u of m)u!=null&&c(u);r&&s();},y={register:p=>{o++,a(),p.then(()=>{n&&(o--,o===0&&d());}).catch(m=>{n&&(o--,o===0&&d());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&d();}};je(ae,y);let h=e.children;return shared.isPromise(h)?(h.then(p=>{i=p;}).catch(()=>{}),y.register(h)):h!=null?f(h):a(),te(()=>{n=false,o=0,i=null,Ne(t),t.remove();}),t}mt[Pe]=true;function In(e){return !!e&&!!e[Pe]}function Hn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),i=signals.signal("pending"),l=0,c=null,s=false,a=ce(ae,null),d=()=>be(null,null,function*(){let h=++l;o.value=true,i.value="pending",r.value=null,s=false,a&&a.increment();try{let v=e();c=v,v.catch(()=>{});let p=yield v;h===l&&(n.value=p,i.value="ready",o.value=!1);}catch(v){h===l&&(r.value=v instanceof Error?v:new Error(String(v)),i.value="errored",o.value=false);}finally{a&&a.decrement();}});d();let f=(()=>(!s&&o.value&&c&&a&&(s=true,a.register(c)),n.value));return f.loading=o,f.error=r,f.state=i,[f,{mutate:h=>{n.value=h,i.value="ready",o.value=false,r.value=null;},refetch:()=>be(null,null,function*(){yield d();})}]}function yt(e){return shared.isFunction(e)?e:e.default}function $e(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Vn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:i}=t;if(typeof window=="undefined"){if(r==="client-only"){let m=()=>"";return m.__asyncLoader=e,m.__asyncResolved=()=>null,m}let y=null,h=null,v=()=>h||(h=e().then(m=>{y=yt(m);}).catch(()=>{}),h);v();let p=m=>y?y(m):"";return p.__asyncLoader=v,p.__asyncResolved=()=>y,p}let l=null,c=null,s="pending",a=null;function d(){return a||(a=e().then(y=>{l=yt(y),s="resolved";}).catch(y=>{c=y instanceof Error?y:new Error(String(y)),s="errored",a=null;}),a)}d();function f(y){var W;if(s==="resolved"&&l){let N=document.createElement("div");N.style.display="contents";let M=$e(N,l,y);return P(()=>M.destroy()),N}if(s==="errored"&&c){let N=document.createElement("div");if(N.style.display="contents",t.error){let M=true,R=null,K=(q,E)=>{M&&(R==null||R.destroy(),R=$e(N,q,E));},X=()=>{a=null,s="pending",c=null,t.loading&&K(t.loading),d().then(()=>{M&&(s==="resolved"&&l?K(l,y):s==="errored"&&c&&t.error&&K(t.error,{error:c,retry:X}));});};K(t.error,{error:c,retry:X}),te(()=>{M=false,R==null||R.destroy(),R=null;});}return N}let h=document.createElement("div");h.style.display="contents";let v=true,p=null,m=null,u=null,g=(N,M)=>{v&&(p==null||p.destroy(),p=$e(h,N,M));},S=N=>()=>{a=null,s="pending",c=null,t.loading&&g(t.loading),d().then(()=>{s==="resolved"&&l?g(l,N):s==="errored"&&c&&t.error&&g(t.error,{error:c,retry:S(N)});});};te(()=>{v=false,p==null||p.destroy(),p=null,m!=null&&clearTimeout(m),u!=null&&clearTimeout(u);});let b=(W=ce(ae))!=null?W:null,k=N=>g(N,y),T=N=>{t.error&&g(t.error,{error:N,retry:S(y)});},V=()=>{t.loading&&g(t.loading);},j=d().then(()=>{v&&(s==="resolved"&&l?k(l):s==="errored"&&c&&(T(c),i&&i(c,S(y))),m!=null&&clearTimeout(m),u!=null&&clearTimeout(u));});return b&&b.register(j),n>0?m=setTimeout(()=>{v&&s==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(v&&s==="pending"){let N=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=N,s="errored",T(N),i&&i(N,S(y));}},o)),h}return f.__asyncLoader=d,f.__asyncResolved=()=>l,f}function ht(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],i=e.key,l=e.children,c=()=>{var g,S;let u=e.each;return signals.isSignal(u)?(g=u.value)!=null?g:[]:shared.isFunction(u)?(S=u())!=null?S:[]:u!=null?u:[]},s=u=>i?i(u):u,a=u=>{if(Array.isArray(u)){let g=[];for(let S of u)g.push(...a(S));return g}return [Z(u)]},d=(u,g,S)=>{let b=a(u);for(let k of b)S?g.insertBefore(k,S):g.appendChild(k);return b},f=(u,g)=>{if(!e.fallback)return;r=d(e.fallback(),u,g);},y=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,g,S,b)=>{let k=_(),T=H(k),V=[];return A(T,()=>{V=d(l(u,g),S,b);}),{key:s(u),item:u,nodes:V,scope:T}},v=u=>{w(u.scope);for(let g of u.nodes)g.parentNode&&g.parentNode.removeChild(g);},p=signals.effect(()=>{let u=c(),g=n.parentNode;if(!g){if(u.length===0)f(t,n);else {o=new Array(u.length);let S=0;for(let b of u)o[S]=h(b,S,t,n),S++;}return}m(g,u);});function m(u,g){let S=o.length,b=g.length;if(b===0){for(let E=0;E<S;E++)v(o[E]);o=[],e.fallback&&r.length===0&&f(u,n);return}if(S===0||r.length>0){r.length>0&&y(),o=new Array(b);let E=document.createDocumentFragment();for(let x=0;x<b;x++)o[x]=h(g[x],x,E,null);u.insertBefore(E,n);return}let k=new Map;for(let E=0;E<S;E++){let x=o[E],F=k.get(x.key),$=[x,E];F?F.push($):k.set(x.key,[$]);}let T=new Array(b),V=[],j=null,W=new Int32Array(b),N=false,M=0,R=new Array(b);for(let E=0;E<b;E++)R[E]=s(g[E]);for(let E=0;E<b;E++){let x=g[E],F=R[E],$=k.get(F);if($&&$.length>0){let[re,D]=$.shift();Object.is(re.item,x)?(re.item=x,T[E]=re,W[E]=D+1,D<M?N=true:M=D):(j||(j=document.createDocumentFragment()),v(re),T[E]=h(x,E,j,null));}else j||(j=document.createDocumentFragment()),T[E]=h(x,E,j,null);}for(let E of k.values())for(let[x]of E)V.push(x);for(let E of V)v(E);let K=N?Ie(W):[],X=K.length-1,q=n;for(let E=b-1;E>=0;E--){let F=T[E].nodes;if(!(W[E]===0)&&N&&X>=0&&E===K[X]){X--;for(let D=F.length-1;D>=0;D--)q=F[D];continue}for(let D=F.length-1;D>=0;D--){let _e=F[D];_e.nextSibling!==q&&u.insertBefore(_e,q),q=_e;}}o=T;}return P(()=>{p.stop();for(let u of o)v(u);o=[],y(),n.parentNode&&n.parentNode.removeChild(n);}),t}ht[Xe]=true;
2
+ exports.Component=ne;exports.For=ht;exports.Fragment=ut;exports.Portal=ft;exports.Suspense=mt;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Le;exports.bindElement=xn;exports.child=Zt;exports.clearDelegatedEvents=fn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=cn;exports.createComponent=he;exports.createResource=Hn;exports.defineAsyncComponent=Vn;exports.delegateEvents=dn;exports.endHydration=Me;exports.getHydrationKey=Je;exports.getRenderedElement=Ot;exports.hydrate=an;exports.inject=ce;exports.insert=z;exports.isComponent=O;exports.isFragment=wn;exports.isHydrating=le;exports.isPortal=Rn;exports.isSuspense=In;exports.next=en;exports.normalizeClass=de;exports.nthChild=tn;exports.omitProps=An;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=nn;exports.patchAttr=G;exports.patchAttrHydrate=jt;exports.patchClass=fe;exports.patchClassHydrate=Vt;exports.patchStyle=pe;exports.patchStyleHydrate=Ut;exports.provide=je;exports.resetHydrationKey=Ft;exports.setStyle=J;exports.template=me;//# sourceMappingURL=template.cjs.js.map
3
3
  //# sourceMappingURL=template.cjs.js.map