@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.
- package/dist/chunk-3E4EK64L.dev.esm.js +152 -0
- package/dist/chunk-3E4EK64L.dev.esm.js.map +1 -0
- package/dist/chunk-IRDMO5MX.esm.js +2 -0
- package/dist/chunk-IRDMO5MX.esm.js.map +1 -0
- package/dist/internal-Bz6h0aPa.d.cts +84 -0
- package/dist/internal-Bz6h0aPa.d.ts +84 -0
- package/dist/internal.cjs.js +2 -0
- package/dist/internal.cjs.js.map +1 -0
- package/dist/internal.d.cts +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.dev.cjs.js +110 -0
- package/dist/internal.dev.cjs.js.map +1 -0
- package/dist/internal.dev.esm.js +3 -0
- package/dist/internal.dev.esm.js.map +1 -0
- package/dist/internal.esm.js +2 -0
- package/dist/internal.esm.js.map +1 -0
- package/dist/template.cjs.js +2 -2
- package/dist/template.cjs.js.map +1 -1
- package/dist/template.d.cts +424 -368
- package/dist/template.d.ts +424 -368
- package/dist/template.dev.cjs.js +1506 -1353
- package/dist/template.dev.cjs.js.map +1 -1
- package/dist/template.dev.esm.js +1417 -1405
- package/dist/template.dev.esm.js.map +1 -1
- package/dist/template.esm.js +2 -2
- package/dist/template.esm.js.map +1 -1
- package/package.json +13 -3
package/dist/template.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var bt=Object.defineProperty;var Le=Object.getOwnPropertySymbols;var _t=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Me=(e,t,n)=>t in e?bt(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))_t.call(t,n)&&Me(e,n,t[n]);if(Le)for(var n of Le(t))Ct.call(t,n)&&Me(e,n,t[n]);return e};var re=(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 Pt={mount:"mount",destroy:"destroy",update:"update"};function ie(e,t,n){let o=e[t];o||(o=e[t]=[]),o.includes(n)||o.push(n);}function se(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(shared.isPromise(i)){let c=i.catch(a=>{});(r!=null?r:r=[]).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function ce(e){let t=_();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}ie(t,"onMount",e);}}function kt(e){let t=_();t&&ie(t,"onUpdate",e);}function ae(e){let t=_();t&&ie(t,"onDestroy",e);}function Ie(e){var o;if(e.isDestroyed||!((o=e.onMount)!=null&&o.length)){e.isMounted=true;return}let t=e.onMount,n=w(e,()=>se(t,e.id,Pt.mount));return t.length=0,e.isMounted=true,n}function ue(e){var o;if(e.isDestroyed||!((o=e.onUpdate)!=null&&o.length))return;let t=e.onUpdate,n=w(e,()=>se(t,e.id,"update"));return t.length=0,n}function He(e){var t;if(!(e.isDestroyed||!((t=e.onDestroy)!=null&&t.length)))return w(e,()=>se(e.onDestroy,e.id,"destroy"))}var L=null,Tt=0;function _(){return L}function K(e){L=e;}function U(e=L){let t={id:++Tt,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=[]),e.children.push(t)),t}function w(e,t){let n=L;L=e;try{return t()}finally{L=n;}}function V(e){var n,o,r;if(!e||e.isDestroyed)return;let t=e.parent;if(e.children){for(let s of e.children)V(s);e.children.length=0;}if((n=e.onDestroy)!=null&&n.length&&(He(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,L===e&&(L=t);}function I(e){let t=L;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}var Fe="_$spread$";var Ke="http://www.w3.org/2000/svg",fe="http://www.w3.org/2000/xlink",le="http://www.w3.org/2000/xmlns/";var de=Symbol(""),pe=Symbol(""),W=Symbol(""),me=Symbol(""),Oe=Symbol("");var Ve=1e3,$e=new WeakMap;function Ue(e){let t=$e.get(e);if(!t){let n=e.name||"anonymous",o=ze(e.toString()).toString(36);t=`${n}_${o}`,$e.set(e,t);}return t}function ze(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 Mt=0;function he(e){if(!shared.isFalsy(e)){if(shared.isString(e))return e.length<=Ve?e:`${e.slice(0,Ve-10)}_${ze(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}`:`${Mt++}`}return String(e)}}var ye=Symbol("essor.key");function z(e,t){if(y(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let n=he(t);shared.isFalsy(n)?delete e[ye]:e[ye]=n;}function M(e){if(e)return y(e)?e.key:e[ye]}function R(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 D(e,t){let n=M(e),o=M(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 Ne(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 P(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;P(n),C(e,t,o);}function k(e){if(e){if(y(e))return e.firstChild;if(!shared.isPrimitive(e))return e}}function qe(e,t){if(y(e)||y(t))return;let n=M(e);n&&!M(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 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 qe(t,n),t}}if(shared.isTextNode(t)&&shared.isTextNode(n))return t.textContent!==n.textContent&&(t.textContent=n.textContent),qe(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 Je(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++)P(t[i]);return []}if(r===1&&s===1){let i=t[0],c=n[0];return D(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],u=n[1];if(D(i,a)&&D(c,u))return H(e,i,a),H(e,c,u),n[0]=i,n[1]=c,n;if(D(i,u)&&D(c,a)){H(e,i,u),H(e,c,a);let p=k(c),f=k(i);return p&&f&&p.parentNode===e&&e.insertBefore(p,f),n[0]=c,n[1]=i,n}}return Ft(e,t,n,o)}function Ft(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(D(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(!u)u=t[--i];else if(D(u,f))H(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?k(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&&P(m);}else Kt(e,t,n,r,i,s,c,o);return n}function Kt(e,t,n,o,r,s,i,c){let a=i-s+1,u;for(let N=s;N<=i;N++){let E=M(n[N]);E!==void 0&&(u||(u=Object.create(null)),u[E]=N);}let p=new Int32Array(a),f=false,l=0,m=0;for(let N=o;N<=r;N++){let E=t[N];if(!E)continue;if(m>=a){P(E);continue}let x,A=M(E);if(A!==void 0&&u&&A in u)x=u[A];else for(let d=s;d<=i;d++)if(p[d-s]===0&&A===void 0&&M(n[d])===void 0&&D(E,n[d])){x=d;break}x===void 0?P(E):(p[x-s]=N+1,x>=l?l=x:f=true,H(e,E,n[x]),n[x]=E,m++);}let S=f?Ot(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=k(x)||h;else if(f)if(v<0||N!==S[v]){let A=k(x);A&&A.parentNode===e&&C(e,A,h),h=A||h;}else h=k(x)||h,v--;else h=k(x)||h;}}function Ot(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 T(e,t,n,o){e.addEventListener(t,n,o),I(()=>{e.removeEventListener(t,n,o);});}function Yt(e,t,n,o){shared.isHtmlInputElement(e)?Bt(e,o):shared.isHtmlSelectElement(e)?Gt(e,o):shared.isHtmlTextAreaElement(e)&&T(e,"input",()=>{o(e.value);});}function Bt(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 Gt(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 Se(e,t,n){if(!e)return;let o=[],r=_(),s=signals.effect(()=>{let i=()=>{let c=shared.isFunction(t)?t():t,a=shared.coerceArray(c).map(u=>shared.isFunction(u)?u():u).flatMap(R);o=Je(e,o,a,n);};r?w(r,i):i();});return I(()=>{s(),o.forEach(i=>P(i)),o.length=0;}),o}function Ee(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 nt;nt=de;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[nt]=true;this.key=n.key?he(n.key):Ue(t),this.reactiveProps=signals.shallowReactive(O({},n)),this.parentScope=_();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=k(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:_();this.scope=U(o),K(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=Se(t,r,n))!=null?c:[];return this.renderedNodes=s,this.applyProps(this.props),this.state=2,Ie(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&&(K(this.scope),this.applyProps(this.props),ue(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&&Ne(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{w(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)P(s);for(let s of o)C(this.parentNode,s,r);this.renderedNodes=o;}}),this.scope&&ue(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=k(t);if(n)return n.nextSibling}}destroy(){if(this.state===4||this.state===5)return;this.state=4;for(let n of this.renderedNodes)P(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[de]}function Y(e,t){return y(e)?e:new J(e,t)}function Ae(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 nn(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 be(e,t){let n=_();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function _e(e,t){let n=_();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 Ce(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ct(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)&&Ce(t,e.host),true}function it(e,t,n){let o=e;for(;ct(o,t,n)&&(o=o._$host||o.parentNode||o.host););return o}function rn(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();Ce(e,s[0]);for(let i=0;i<s.length-2&&(t=s[i],!!ct(t,e,n));i++){if(t._$host){t=t._$host,t=it(t,e,n);break}if(t.parentNode===r)break}}else t=it(t,e,n);Ce(e,o);}var st=Symbol("_$EVENTS");function sn(e,t=window.document){let n=t,o=n[st]||(n[st]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,rn));}function cn(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 Pe=false;function Q(){Pe=true;}function B(){Pe=false;}function F(){return Pe}var at=0;function Z(){return `${at++}`}function ee(){at=0;}var ft=/^\d+-\d+$/;function lt(e){return ()=>{if(!shared.isBrowser())return null;let t=Z(),n=document.querySelector(`[data-hk="${t}"]`);return n||Ae(e)()}}function dt(e,t){let n=e.dataset.hk;if(!n)return Ee(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&&ft.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&&ft.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 pt(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 mt(e,t,n,o=false){if(t===n||F())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 yt=/\s*!important$/,mn=["Webkit","Moz","ms"],ke={};function gt(e,t,n){let o=e.style,r=shared.isString(n);if(!F()){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)&&j(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&&j(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&&j(o,s,i);}}}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=yn(e,t);shared.isString(n)&&yt.test(n)?e.setProperty(shared.camelCase(o),n.replace(yt,""),"important"):e[o]=n;}function yn(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 mn){let s=r+o;if(s in e)return ke[t]=s}return t}function Te(e,t,n,o){if(t==="key"){o==null?z(e,void 0):z(e,String(o));return}if(t===Fe){Object.keys(o).forEach(f=>{Te(e,f,n==null?void 0:n[f],o==null?void 0:o[f]);});return}if(F())return;let r=(e==null?void 0:e.namespaceURI)===Ke,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(fe,t.slice(6));else if(i){let f=t.slice(6);e.removeAttributeNS(le,f);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(fe,t,String(o));return}if(i){e.setAttributeNS(le,t,String(o));return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let u=shared.isSymbol(o)?String(o):o;if((a==="href"||a==="src"||a==="xlink:href")&&shared.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 Nt(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 St(e){if(!(e!=null&&e.children))return shared.error("Fragment component requires children"),null;let{children:t}=e;return t}St[pe]=true;function An(e){return !!e&&!!e[pe]}function vt(e){let t=document.createComment("portal");t[W]=true;let n=e.children;if(n){let o=shared.isArray(n)?n:[n],r=[];ce(()=>{let s=shared.isString(e.target)?document.querySelector(e.target):e.target;s&&(o.forEach(i=>{if(i!=null){let c=R(i);c&&(C(s,c),r.push(c));}}),I(()=>{r.forEach(i=>{!shared.isString(i)&&i.parentNode===s&&s.removeChild(i);});}));});}return t}vt[W]=true;function _n(e){return !!e&&!!e[W]}var we=Symbol("SuspenseContext");function xt(e){if(shared.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=R(e.fallback);f&&C(t,f);}}},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=f=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(f==null)return;let l=_();if((shared.isArray(f)?f:[f]).forEach(S=>{if(S!=null){y(S)&&(S.parentContext=l);let v=R(S);v&&C(t,v);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let S=R(e.fallback);S&&C(t,S);}}},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();}};be(we,u);let p=e.children;return shared.isPromise(p)?(p.then(f=>{s=f;}).catch(()=>{}),u.register(p)):p!=null?a(p):i(),ae(()=>{for(n=false;t.firstChild;)t.removeChild(t.firstChild);}),t}xt[me]=true;function kn(e){return !!e&&!!e[me]}function Tn(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 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=_e(we,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:()=>re(null,null,function*(){yield a();})}]}function At(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,u=(l,m,S,v)=>{var x;let h=_(),N=U(h);K(N);let E;try{let A=i(l,m);y(A)?(A.mount(S,v),E=(x=A.firstChild)!=null?x:document.createComment("empty")):(E=A,E.parentNode||(v?S.insertBefore(E,v):S.appendChild(E)));}finally{K(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]=u(N,h,t,n);return {prev:m}}return signals.untrack(()=>f(S,m)),{prev:m}},{prev:[]});function f(l,m){var A;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=(A=d.firstChild)!=null?A: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 b=0;b<v;b++)o[b]=u(m[b],b,d,null);l.insertBefore(d,n);return}let h=new Map;for(let d=0;d<S;d++){let b=o[d],G=h.get(b.key);G?G.push(b):h.set(b.key,[b]);}let N=new Array(v),E=[],x=document.createDocumentFragment();for(let d=0;d<v;d++){let b=m[d],G=a(b),oe=h.get(G);oe&&oe.length>0?N[d]=oe.shift():N[d]=u(b,d,x,null);}for(let d of h.values())for(let b of d)E.push(b);for(let d of E)p(d);for(let d=0;d<v;d++){let b=N[d].node;l.insertBefore(b,n);}o=N;}return I(()=>{for(let l of o)p(l);r&&r.parentNode&&r.parentNode.removeChild(r),n.parentNode&&n.parentNode.removeChild(n);}),t}At[Oe]=true;
|
|
2
|
-
exports.Component=
|
|
1
|
+
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var Be=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var We=(e,t)=>{var n={};for(var o in e)vt.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&&St.call(e,o)&&(n[o]=e[o]);return n};var Ce=(e,t,n)=>new Promise((o,r)=>{var l=i=>{try{c(n.next(i));}catch(a){r(a);}},s=i=>{try{c(n.throw(i));}catch(a){r(a);}},c=i=>i.done?o(i.value):Promise.resolve(i.value).then(l,s);c((n=n.apply(e,t)).next());});var ue="_$spread$";var Xe="http://www.w3.org/2000/svg",we="http://www.w3.org/2000/xlink",xe="http://www.w3.org/2000/xmlns/";var Ae=Symbol(""),ie=Symbol(""),Pe=Symbol(""),qe=Symbol("");var H=null,Et=0;function C(){return H}function O(e=H){let t={id:++Et,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=H;H=e;try{return t()}finally{H=n;}}function P(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,P(o));e.children.clear();}let t=H;H=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{H=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 k(e){let t=H;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,p=shared.isObject(o)?o:null;if(f)for(let h in f)h!==ue&&(!p||!(h in p))&&G(e,h,f[h],null);if(p)for(let h in p)h!==ue&&G(e,h,f==null?void 0:f[h],p[h]);return}let r=(e==null?void 0:e.namespaceURI)===Xe,l=r&&t.startsWith("xlink:"),s=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 i=t.toLowerCase();if(i==="innerhtml"||i==="srcdoc")return;if(o==null){if(l)e.removeAttributeNS(we,t.slice(6));else if(s){let f=t.slice(6);e.removeAttributeNS(xe,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((i==="href"||i==="src"||i==="xlink:href"||i==="action"||i==="formaction"||i==="poster")&&shared.isString(a)){let f=a.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(l){e.setAttributeNS(we,t,String(a));return}if(s){e.setAttributeNS(xe,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 Ye=/\s*!important$/,Dt=["Webkit","Moz","ms"],ke={};function me(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 l in r)(!n||n[l]==null)&&J(o,l,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,l;for(;(l=r.exec(t))!==null;){let s=l[1].trim();s&&n&&shared.isObject(n)&&n[s]==null&&J(o,s,"");}}if(n&&!shared.isString(n)){let r=n;for(let l in r){let s=r[l];(!t||shared.isString(t)||t[l]!==s)&&s!=null&&J(o,l,s);}}}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=Mt(e,t);shared.isString(n)&&Ye.test(n)?e.setProperty(shared.camelCase(o),n.replace(Ye,""),"important"):e[o]=n;}function Mt(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 Dt){let l=r+o;if(l in e)return ke[t]=l}return t}var Te=0;function Qe(){return String(Te++)}function It(){Te=0;}var z=false;function le(){return z}var Q=new Map;function Ht(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 Ot(){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 Me(e){z=true,Te=0,Q.clear(),ye.length=0,se.clear(),Ht(e),Ot();}function Le(){z=false,Q.clear(),ye.length=0,se.clear();}function Vt(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!z)return t||(t=pe(e)),t();let n=Qe(),o=Q.get(n);return o?(Q.delete(n),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),t||(t=pe(e)),t())}}function jt(e,t,n,o){z||fe(e,t,n,o);}function Kt(e,t,n,o){z||G(e,t,n,o);}function Ut(e,t,n){z||me(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Ze(e,t,n,o){let r=Fe(e,o),l=t.length,s=n.length;if(l===0&&s===0)return n;if(l===0){for(let d=0;d<s;d++)M(e,n[d],r);return n}if(s===0){for(let d=0;d<l;d++)K(t[d]);return []}let c=0,i=l-1,a=s-1;for(;c<=i&&c<=a&&t[c]===n[c];)c++;for(;i>=c&&a>=c&&t[i]===n[a];)i--,a--;if(c>i){if(c<=a){let d=a+1,f=Fe(e,d<s?n[d]:r);for(let p=c;p<=a;p++)M(e,n[p],f);}}else if(c>a)for(let d=c;d<=i;d++)K(t[d]);else $t(e,t,n,c,i,a,r);return n}function $t(e,t,n,o,r,l,s){let c=l-o+1,i=new Map;for(let m=o;m<=l;m++)i.set(n[m],m);let a=new Int32Array(c);a.fill(0);let d=0,f=false,p=0;for(let m=o;m<=r;m++){let g=t[m];if(d>=c){K(g);continue}let u=i.get(g);u===void 0?K(g):(a[u-o]=m+1,u>=p?p=u:f=true,d++);}let h=f?Ie(a):[],S=h.length-1;for(let m=c-1;m>=0;m--){let g=o+m,u=n[g],y=Fe(e,g+1<n.length?n[g+1]:s);a[m]===0?M(e,u,y):f&&(S<0||m!==h[S]?M(e,u,y):S--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,l,s,c,i;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(l=n[n.length-1],e[l]<a){t[r]=l,n.push(r);continue}for(s=0,c=n.length-1;s<c;)i=s+c>>1,e[n[i]]<a?s=i+1:c=i;a<e[n[s]]&&(s>0&&(t[r]=n[s-1]),n[s]=r);}}for(s=n.length,c=n[s-1];s-- >0;)n[s]=c,c=t[c];return n}function K(e){if(e)if(L(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function M(e,t,n){if(!e||!t)return;let o=L(n)?n.firstChild:n;if(L(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){if(e instanceof Node||L(e))return e;let t=typeof e;return e==null||t==="string"||t==="number"||t==="boolean"||t==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function B(e,t,n){if(!e)return;let o=C(),r=[],l=true,s=i=>{if(i instanceof Node)return [i];if(L(i))return [i];let a=typeof i;return i==null||a==="string"||a==="number"||a==="boolean"?[Z(i)]:shared.coerceArray(i).map(d=>shared.isFunction(d)?d():d).flatMap(d=>d).map(Z)},c=signals.effect(()=>{let i=()=>{let a=shared.isFunction(t)?t():t,d=s(a);if(l&&le()&&d.every(f=>f instanceof Node&&f.parentNode===e)){r=d,l=false;return}r=Ze(e,r,d,n),l=false;};o&&!o.isDestroyed?A(o,i):i();});return k(()=>{c.stop();for(let i of r)K(i);r=[];}),r}function Wt(e){return (e==null?void 0:e.firstChild)||null}function Xt(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function qt(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,l=a=>{let d=a.target;(d.matches(r)||d.closest(r))&&n.call(e,a);},i=o,{delegate:s}=i,c=We(i,["delegate"]);return e.addEventListener(t,l,c),()=>{e.removeEventListener(t,l,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function nt(e,t,n){let o=e.length;if(o===0)return;let r;for(let l=0;l<o;l++)try{let s=e[l]();if(shared.isPromise(s)){let c=s.catch(i=>{});(r||(r=[])).push(c);}}catch(s){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=C();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function Gt(e){let t=C();t&&He(t,"onUpdate",e);}function te(e){let t=C();t&&He(t,"onDestroy",e);}function ot(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=A(e,()=>nt(t,e.id,"mount"));return t.length=0,e.isMounted=true,n}function rt(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return A(e,()=>nt(e.onUpdate,e.id,"update"))}function st(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 Zt(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var lt;lt="normal";var ne=class{constructor(t,n={}){this.component=t;this.props=n;this[lt]=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={};st(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var l;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let s of this.renderedNodes)M(t,s,n);return this.state=2,this.renderedNodes}let o=O((l=this.parentScope)!=null?l:C());this.scope=o;let r=A(o,()=>{var c;let s=this.component(this.reactiveProps);return shared.isFunction(s)&&(s=s(this.reactiveProps)),(signals.isSignal(s)||signals.isComputed(s))&&(s=s.value),(c=B(t,s,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,ot(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(st(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),rt(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(),P(t);for(let n of this.renderedNodes)K(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=Zt(t,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)&&shared.isFunction(r)){let l=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,l,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 L(e){return !!e&&!!e.normal}function he(e,t){return L(e)?e:new ne(e,t)}function pe(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)return;n.innerHTML&&(n.innerHTML="");let r=O(),l;try{A(r,()=>{let s=he(e);L(s)&&(l=s,M(n,s));});}catch(s){throw P(r),s}return {root:l,unmount:()=>{P(r),l==null||l.destroy();}}}function tn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Me(n);let o=O(),r;try{A(o,()=>{let l=he(e);L(l)&&(r=l,B(n,l));});}catch(l){throw P(o),l}finally{Le();}return {root:r,unmount:()=>{P(o),r==null||r.destroy();}}}function je(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&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return t}function Ke(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ut(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,l=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let i=t[`${n}Data`];if(i?c.call(t,i,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)&&Ke(e,t.host),true},s=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();Ke(e,c[0]);for(let i=0;i<c.length-2&&(t=c[i],!!l());i++){if(t._$host){t=t._$host,s();break}if(t.parentNode===r)break}}else s();Ke(e,o);}var ge=Symbol("_$EVENTS");function on(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,ut));}function rn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,ut);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);C()&&k(r);}function Ue(e,t){let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}var an={event:"change",forceChange:true,read:e=>e.checked,write(e,t){let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},un={event:"change",forceChange: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);}},dn={event:"change",forceChange:true,read:e=>e.files,write(){}},fn={event:"input",ime:true,read:e=>e.value,write:Ue},mn={event:"input",ime:true,read:e=>e.value,write:Ue},pn={event:"change",forceChange: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 Ue(e,t);}};function yn(e,t){switch(e.nodeName){case "INPUT":return t==="checked"?e.type==="radio"?un:an:t==="files"?dn:fn;case "SELECT":return pn;case "TEXTAREA":return mn;default:return {event:"input",read:n=>n[t],write(n,o){n[t]=o;}}}}function hn(e,t,n){if(!shared.isString(e))return e;let o=e;if(t&&(o=o.trim()),n&&o!==""){let r=Number(o);if(!Number.isNaN(r))return r}return o}function gn(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function vn(e,t,n,o,r={}){if(!e)return;let{event:l,read:s,write:c,forceChange:i,ime:a}=yn(e,t),d=r.trim===true,f=r.number===true,p=r.lazy===true,h=(d||f)&&t!=="files",S=shared.isFunction(n)?n:()=>n,m=h?N=>hn(N,d,f):N=>N,g=false,u=p||i?"change":l,y=()=>{if(g)return;let N=s(e);if(N===void 0)return;let x=m(N);Object.is(S(),x)||o(x);};oe(e,u,y),!p&&h&&u!=="change"&&oe(e,"change",()=>c(e,m(s(e)))),a&&!p&&(oe(e,"compositionstart",()=>{g=true;}),oe(e,"compositionend",()=>{g&&(g=false,y());}));let E=signals.effect(()=>{let N=S();a&&!p&&gn(e)&&(g||Object.is(m(s(e)),N))||c(e,N);});C()&&k(()=>E.stop());}function Sn(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 dt(e){return !e||e.children==null?null:e.children}dt[Ae]=true;function En(e){return !!e&&!!e[Ae]}function ve(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function Se(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function mt(e){if(le()){let d=_n(e);if(d)return d}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=C(),r=null,l=(d,f)=>{r=O(o),A(r,()=>{B(d,()=>n,f);});},s=()=>{r&&(P(r),r=null);},c=(d,f)=>{if(s(),d){let p=t.parentNode;if(!p)return;l(p,t);return}f&&l(f);},i=false,a=signals.effect(()=>{let d=Se(e),f=d?null:ve(e);i&&c(d,f);});return Oe(()=>{i=!0;let d=Se(e),f=d?null:ve(e);if(d||f){c(d,f);return}queueMicrotask(()=>{t.parentNode&&c(Se(e),ve(e));});}),k(()=>{a.stop(),s();}),t}mt[ie]=true;function _n(e){if(Se(e))return null;let t=Re();if(!t)return null;let n=ve(e);return !n||!De(n)?null:(t[ie]=true,t)}function Cn(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 yt(e){var S;if(!shared.isBrowser())return (S=e.fallback)!=null?S:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,l=null,s=m=>{let g=pt(m);if(shared.isArray(g)){let u=[];for(let y of g){let E=s(y);shared.isArray(E)?u.push(...E):u.push(E);}return u}return Z(g)},c=m=>{let g=s(m),u=shared.isArray(g)?g:[g];for(let y of u)y!=null&&M(t,y);},i=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,i());},d=()=>{!r||!(l||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),l?f(l):e.children!=null&&!shared.isPromise(e.children)&&f(e.children));},f=m=>{if(r||(Ne(t),m==null))return;let g=shared.isArray(m)?m:[m];for(let u of g)u!=null&&c(u);r&&i();},p={register:m=>{o++,a(),m.then(()=>{n&&(o--,o===0&&d());}).catch(g=>{n&&(o--,o===0&&d());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&d();}};je(ae,p);let h=e.children;return shared.isPromise(h)?(h.then(m=>{l=m;}).catch(()=>{}),p.register(h)):h!=null?f(h):a(),te(()=>{n=false,o=0,l=null,Ne(t),t.remove();}),t}yt[Pe]=true;function kn(e){return !!e&&!!e[Pe]}function Tn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),l=signals.signal("pending"),s=0,c=null,i=false,a=ce(ae,null),d=()=>Ce(null,null,function*(){let h=++s;o.value=true,l.value="pending",r.value=null,i=false,a&&a.increment();try{let S=e();c=S,S.catch(()=>{});let m=yield S;h===s&&(n.value=m,l.value="ready",o.value=!1);}catch(S){h===s&&(r.value=S instanceof Error?S:new Error(String(S)),l.value="errored",o.value=false);}finally{a&&a.decrement();}});d();let f=(()=>(!i&&o.value&&c&&a&&(i=true,a.register(c)),n.value));return f.loading=o,f.error=r,f.state=l,[f,{mutate:h=>{n.value=h,l.value="ready",o.value=false,r.value=null;},refetch:()=>Ce(null,null,function*(){yield d();})}]}function ht(e){return shared.isFunction(e)?e:e.default}function ze(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Dn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:l}=t;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=e,g.__asyncResolved=()=>null,g}let p=null,h=null,S=()=>h||(h=e().then(g=>{p=ht(g);}).catch(()=>{}),h);S();let m=g=>p?p(g):"";return m.__asyncLoader=S,m.__asyncResolved=()=>p,m}let s=null,c=null,i="pending",a=null;function d(){return a||(a=e().then(p=>{s=ht(p),i="resolved";}).catch(p=>{c=p instanceof Error?p:new Error(String(p)),i="errored",a=null;}),a)}d();function f(p){var W;if(i==="resolved"&&s){let b=document.createElement("div");b.style.display="contents";let F=ze(b,s,p);return k(()=>F.destroy()),b}if(i==="errored"&&c){let b=document.createElement("div");if(b.style.display="contents",t.error){let F=true,R=null,U=(q,v)=>{F&&(R==null||R.destroy(),R=ze(b,q,v));},X=()=>{a=null,i="pending",c=null,t.loading&&U(t.loading),d().then(()=>{F&&(i==="resolved"&&s?U(s,p):i==="errored"&&c&&t.error&&U(t.error,{error:c,retry:X}));});};U(t.error,{error:c,retry:X}),te(()=>{F=false,R==null||R.destroy(),R=null;});}return b}let h=document.createElement("div");h.style.display="contents";let S=true,m=null,g=null,u=null,y=(b,F)=>{S&&(m==null||m.destroy(),m=ze(h,b,F));},E=b=>()=>{a=null,i="pending",c=null,t.loading&&y(t.loading),d().then(()=>{i==="resolved"&&s?y(s,b):i==="errored"&&c&&t.error&&y(t.error,{error:c,retry:E(b)});});};te(()=>{S=false,m==null||m.destroy(),m=null,g!=null&&clearTimeout(g),u!=null&&clearTimeout(u);});let N=(W=ce(ae))!=null?W:null,x=b=>y(b,p),T=b=>{t.error&&y(t.error,{error:b,retry:E(p)});},V=()=>{t.loading&&y(t.loading);},j=d().then(()=>{S&&(i==="resolved"&&s?x(s):i==="errored"&&c&&(T(c),l&&l(c,E(p))),g!=null&&clearTimeout(g),u!=null&&clearTimeout(u));});return N&&N.register(j),n>0?g=setTimeout(()=>{S&&i==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(S&&i==="pending"){let b=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=b,i="errored",T(b),l&&l(b,E(p));}},o)),h}return f.__asyncLoader=d,f.__asyncResolved=()=>s,f}function gt(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],l=e.key,s=e.children,c=()=>{var y,E;let u=e.each;return signals.isSignal(u)?(y=u.value)!=null?y:[]:shared.isFunction(u)?(E=u())!=null?E:[]:u!=null?u:[]},i=u=>l?l(u):u,a=u=>{if(Array.isArray(u)){let y=[];for(let E of u)y.push(...a(E));return y}return [Z(u)]},d=(u,y,E)=>{let N=a(u);for(let x of N)E?y.insertBefore(x,E):y.appendChild(x);return N},f=(u,y)=>{if(!e.fallback)return;r=d(e.fallback(),u,y);},p=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,y,E,N)=>{let x=C(),T=O(x),V=[];return A(T,()=>{V=d(s(u,y),E,N);}),{key:i(u),item:u,nodes:V,scope:T}},S=u=>{P(u.scope);for(let y of u.nodes)y.parentNode&&y.parentNode.removeChild(y);},m=signals.effect(()=>{let u=c(),y=n.parentNode;if(!y){if(u.length===0)f(t,n);else {o=new Array(u.length);let E=0;for(let N of u)o[E]=h(N,E,t,n),E++;}return}g(y,u);});function g(u,y){let E=o.length,N=y.length;if(N===0){for(let v=0;v<E;v++)S(o[v]);o=[],e.fallback&&r.length===0&&f(u,n);return}if(E===0||r.length>0){r.length>0&&p(),o=new Array(N);let v=document.createDocumentFragment();for(let w=0;w<N;w++)o[w]=h(y[w],w,v,null);u.insertBefore(v,n);return}let x=new Map;for(let v=0;v<E;v++){let w=o[v],I=x.get(w.key),$=[w,v];I?I.push($):x.set(w.key,[$]);}let T=new Array(N),V=[],j=null,W=new Int32Array(N),b=false,F=0,R=new Array(N);for(let v=0;v<N;v++)R[v]=i(y[v]);for(let v=0;v<N;v++){let w=y[v],I=R[v],$=x.get(I);if($&&$.length>0){let[re,D]=$.shift();Object.is(re.item,w)?(re.item=w,T[v]=re,W[v]=D+1,D<F?b=true:F=D):(j||(j=document.createDocumentFragment()),S(re),T[v]=h(w,v,j,null));}else j||(j=document.createDocumentFragment()),T[v]=h(w,v,j,null);}for(let v of x.values())for(let[w]of v)V.push(w);for(let v of V)S(v);let U=b?Ie(W):[],X=U.length-1,q=n;for(let v=N-1;v>=0;v--){let I=T[v].nodes;if(!(W[v]===0)&&b&&X>=0&&v===U[X]){X--;for(let D=I.length-1;D>=0;D--)q=I[D];continue}for(let D=I.length-1;D>=0;D--){let _e=I[D];_e.nextSibling!==q&&u.insertBefore(_e,q),q=_e;}}o=T;}return k(()=>{m.stop();for(let u of o)S(u);o=[],p(),n.parentNode&&n.parentNode.removeChild(n);}),t}gt[qe]=true;
|
|
2
|
+
exports.Component=ne;exports.For=gt;exports.Fragment=dt;exports.Portal=mt;exports.Suspense=yt;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Me;exports.bindElement=vn;exports.child=Wt;exports.clearDelegatedEvents=rn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=en;exports.createComponent=he;exports.createResource=Tn;exports.defineAsyncComponent=Dn;exports.delegateEvents=on;exports.endHydration=Le;exports.getHydrationKey=Qe;exports.getRenderedElement=Vt;exports.hydrate=tn;exports.inject=ce;exports.insert=B;exports.isComponent=L;exports.isFragment=En;exports.isHydrating=le;exports.isPortal=Cn;exports.isSuspense=kn;exports.next=Xt;exports.normalizeClass=de;exports.nthChild=qt;exports.omitProps=Sn;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=Gt;exports.patchAttr=G;exports.patchAttrHydrate=Kt;exports.patchClass=fe;exports.patchClassHydrate=jt;exports.patchStyle=me;exports.patchStyleHydrate=Ut;exports.provide=je;exports.resetHydrationKey=It;exports.setStyle=J;exports.template=pe;//# sourceMappingURL=template.cjs.js.map
|
|
3
3
|
//# sourceMappingURL=template.cjs.js.map
|