@mateosuarezdev/flash 0.0.1 → 0.0.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/index.cjs CHANGED
@@ -8,4 +8,4 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./jsx-dev-runtime-D4XANMVW.cjs");var B=Symbol.for("preact-signals");function E(){if(y>1)y--;else{for(var t,e=!1;S!==void 0;){var n=S;for(S=void 0,N++;n!==void 0;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&I(n))try{n.c()}catch(r){e||(t=r,e=!0)}n=i}}if(N=0,y--,e)throw t}}function W(t){if(y>0)return t();y++;try{return t()}finally{E()}}var c=void 0;function F(t){var e=c;c=void 0;try{return t()}finally{c=e}}var S=void 0,y=0,N=0,w=0;function L(t){if(c!==void 0){var e=t.n;if(e===void 0||e.t!==c)return e={i:0,S:t,p:c.s,n:void 0,t:c,e:void 0,x:void 0,r:e},c.s!==void 0&&(c.s.n=e),c.s=e,t.n=e,32&c.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=c.s,e.n=void 0,c.s.n=e,c.s=e),e}}function u(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}u.prototype.brand=B;u.prototype.h=function(){return!0};u.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:F(function(){var i;(i=e.W)==null||i.call(e)}))};u.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,i=t.x;n!==void 0&&(n.x=i,t.e=void 0),i!==void 0&&(i.e=n,t.x=void 0),t===this.t&&(this.t=i,i===void 0&&F(function(){var r;(r=e.Z)==null||r.call(e)}))}};u.prototype.subscribe=function(t){var e=this;return g(function(){var n=e.value,i=c;c=void 0;try{t(n)}finally{c=i}},{name:"sub"})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=c;c=void 0;try{return this.value}finally{c=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=L(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(N>100)throw new Error("Cycle detected");this.v=t,this.i++,w++,y++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{E()}}}});function z(t,e){return new u(t,e)}function I(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function K(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function V(t){for(var e=t.s,n=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=n}function m(t,e){u.call(this,void 0),this.x=t,this.s=void 0,this.g=w-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}m.prototype=new u;m.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===w))return!0;if(this.g=w,this.f|=1,this.i>0&&!I(this))return this.f&=-2,!0;var t=c;try{K(this),c=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return c=t,V(this),this.f&=-2,!0};m.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}u.prototype.S.call(this,t)};m.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};m.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(m.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=L(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function R(t,e){return new m(t,e)}function G(t){var e=t.u;if(t.u=void 0,typeof e=="function"){y++;var n=c;c=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,A(t),i}finally{c=n,E()}}}function A(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,G(t)}function q(t){if(c!==this)throw new Error("Out-of-order effect");V(this),c=t,this.f&=-2,8&this.f&&A(this),E()}function b(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}b.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,G(this),K(this),y++;var t=c;return c=this,q.bind(this,t)};b.prototype.N=function(){2&this.f||(this.f|=2,this.o=S,S=this)};b.prototype.d=function(){this.f|=8,1&this.f||A(this)};b.prototype.dispose=function(){this.d()};function g(t,e){var n=new b(t,e);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Z(t){return t instanceof u?t.peek():t}function J(t){return t instanceof u?t.value:t}function Q(t,e){typeof e=="function"?t.value=e():t.value=e}function ee(t){return t instanceof u?()=>t.value:t}function te(t,e,n=!1){const i=[];for(const[r,s]of Object.entries(e))if(s!=null&&!(r==="children"||r==="key"||r==="autoanimate")){if(typeof s=="function"&&r!=="ref"&&!r.startsWith("on")&&r!=="viewTransitionName"){const o=g(()=>{const a=s();P(t,r,a,n)});i.push(o);continue}P(t,r,s,n)}return()=>i.forEach(r=>r())}function P(t,e,n,i){if(e==="ref"&&typeof n=="function"){n(t);return}if(e.startsWith("on")&&typeof n=="function"){const r=e.slice(2).toLowerCase();t.addEventListener(r,n);return}if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function ne(t,e){const n=document.createTextNode(String(e));t.appendChild(n)}function j(t){return{type:"reactive",kind:"ReactiveVNode",fn:t,_id:d.newVNodeId(),_dispose:null,_currentChild:null,_currentDom:null,_placeholder:null,_parent:null,_renderedChildren:[]}}function k(t,e){if(!t&&t!==0)return{vnode:null,dom:null};if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return{vnode:null,dom:document.createTextNode(String(t))};if(t instanceof Node)return{vnode:null,dom:t};if(typeof t=="object"&&"type"in t){const n=t;n.type!=="reactive"&&(n._parent=e),e._renderedChildren.push(n);const i=_(n);return{vnode:n,dom:i}}return{vnode:null,dom:null}}class x{_cancelled=!1;_cancelCallbacks=[];get cancelled(){return this._cancelled}cancel(){this._cancelled||(this._cancelled=!0,this._cancelCallbacks.forEach(e=>{try{e()}catch(n){console.error("Cancel callback error:",n)}}),this._cancelCallbacks=[])}onCancel(e){this._cancelled?e():this._cancelCallbacks.push(e)}throwIfCancelled(){if(this._cancelled)throw new Error("Operation cancelled")}}async function H(t,e){if(!t)return;const n=t,i=e||new x;if("_onBeforeExitCallbacks"in n&&n._onBeforeExitCallbacks.length>0)for(const r of n._onBeforeExitCallbacks)try{if(i.cancelled)break;await r(i)}catch(s){console.error("onBeforeExit error:",s)}if("_onUnmountCallbacks"in n&&n._onUnmountCallbacks.length>0&&n._onUnmountCallbacks.forEach(r=>{try{r()}catch(s){console.error("onUnmount error:",s)}}),n.type==="reactive"){const r=n;r._dispose&&(r._dispose(),r._dispose=null)}"_renderedChildren"in n&&n._renderedChildren.forEach(r=>{X(r)})}function X(t){if(!t)return;const e=t,n=new x;if(n.cancel(),"_onBeforeExitCallbacks"in e&&e._onBeforeExitCallbacks.length>0&&e._onBeforeExitCallbacks.forEach(i=>{try{const r=i(n);r instanceof Promise&&r.catch(s=>console.error("onBeforeExit error:",s))}catch(r){console.error("onBeforeExit error:",r)}}),"_onUnmountCallbacks"in e&&e._onUnmountCallbacks.length>0&&e._onUnmountCallbacks.forEach(i=>{try{i()}catch(r){console.error("onUnmount error:",r)}}),e.type==="reactive"){const i=e;i._dispose&&(i._dispose(),i._dispose=null)}"_renderedChildren"in e&&e._renderedChildren.forEach(i=>{X(i)})}let ie=0;const p=new WeakMap;async function M(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=t._currentChild,s=t._currentDom;if(re(r,e)){const f=p.get(t);f&&(f.token.cancel(),p.delete(t)),r&&"_lifecycleState"in r&&(r._lifecycleState="mounted");return}if(s instanceof Text&&n instanceof Text){s.nodeValue!==n.nodeValue&&(s.nodeValue=n.nodeValue),t._currentDom=s,t._currentChild=e,e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),p.delete(t);return}const o=++ie,a=p.get(t);a&&a.token.cancel();const l=new x;if(p.set(t,{id:o,token:l}),r&&"_lifecycleState"in r&&(r._lifecycleState="exiting"),r)try{await H(r,l)}catch(f){console.error(`ReactiveVNode ${t._id}: Unmount threw:`,f)}const h=p.get(t);if(!(!h||h.id!==o)){if(l.cancelled){p.delete(t);return}r&&"_lifecycleState"in r&&(r._lifecycleState="exited"),s&&s.remove(),n&&i.parentNode.insertBefore(n,i.nextSibling),e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),t._currentChild=e,t._currentDom=n,p.delete(t)}}function re(t,e){if(!t||!e||typeof t!="object"||typeof e!="object"||!("type"in t)||!("type"in e))return!1;if(typeof t.type=="function"&&typeof e.type=="function"){if(t.type!==e.type)return!1}else if(typeof t.type=="string"&&typeof e.type=="string"){if(t.type!==e.type)return!1}else return!1;const n="props"in t?t.props?.key:void 0,i="props"in e?e.props?.key:void 0;return n!==i?!1:"_lifecycleState"in t&&t._lifecycleState==="exiting"}function se(t,e){const n=t._listState;n?ae(t,e,n):oe(t,e)}function oe(t,e){const n=t._placeholder;if(!n?.parentNode)return;const i=[];for(let r=0;r<e.length;r++){const s=e[r],o=O(s,r),{vnode:a,dom:l}=k(s,t);l&&n.parentNode.appendChild(l),i.push({key:o,vnode:a,dom:l})}t._listState={items:i}}function ae(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=new Map;for(const a of n.items)r.set(a.key,a);const s=new Set,o=[];for(let a=0;a<e.length;a++){const l=e[a],h=O(l,a);s.add(h);const f=r.get(h);f?(o.push(f),r.delete(h)):le(t,l,o)}r.size>0&&ce(r),ue(i,o),t._listState={items:o}}function le(t,e,n){const i=O(e,n.length),{vnode:r,dom:s}=k(e,t);n.push({key:i,vnode:r,dom:s})}function ce(t){for(const[e,n]of t)n.vnode&&H(n.vnode),n.dom?.parentNode&&n.dom.parentNode.removeChild(n.dom)}function ue(t,e){const n=t.parentNode;if(!n)return;let i=t;for(const r of e)r.dom&&(i.nextSibling!==r.dom&&n.insertBefore(r.dom,i.nextSibling),i=r.dom)}function O(t,e){return t&&typeof t=="object"&&"key"in t?t.key??e:e}function Y(t,e,n=null,i=!1){if(!e)return;(Array.isArray(e)?e:[e]).forEach(s=>{if(s){if(Array.isArray(s)&&Y(t,s,n,i),typeof s=="string"||typeof s=="number")ne(t,s);else if(typeof s=="function"){const o=j(s);o._parent=n,n&&n._renderedChildren.push(o);const a=document.createComment("reactive");t.appendChild(a),o._placeholder=a;const l=g(()=>{const h=s();if(Array.isArray(h))se(o,h);else{const{vnode:f,dom:T}=k(h,o);M(o,f,T)}});o._dispose=l}else if(s instanceof Node)t.append(s);else if(s&&typeof s=="object"&&"type"in s){const o=s;"type"in o&&o.type!=="reactive"&&(o._parent=n),n&&n._renderedChildren.push(o);const a=_(o,i);a&&t.append(a)}}})}const fe="http://www.w3.org/2000/svg";function U(t,e=!1){if(t._dom)return t._dom;const n=e||t.type==="svg",i=n?document.createElementNS(fe,t.type):document.createElement(t.type),r=te(i,t.props,n);return t._onUnmountCallbacks.push(r),t.props.children&&Y(i,t.props.children,t,n),t._dom=i,t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(s=>s()),i}function _(t,e=!1){if("type"in t&&t.type==="reactive")return t._placeholder;if(typeof t.type=="string")return U(t,e);const n=t;d.setCurrentVNode(n);const i=n.type(n.props);if(d.setCurrentVNode(null),!i)return null;let r=null;if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")r=document.createTextNode(String(i));else if(i instanceof Node)n._element=i,r=i;else if(i&&typeof i=="object"&&"type"in i){const s=i;"type"in s&&s.type!=="reactive"&&(s._parent=n,n._renderedChildren.push(s));const o=_(s,e);o&&(n._element=o),r=o}return r&&n._onMountCallbacks.length>0&&n._onMountCallbacks.forEach(s=>{s()}),r&&(n._lifecycleState="mounted"),r}function de(t,e){const n=t instanceof Node?t:_(t);n&&e.append(n)}function he(t){return document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null)}function pe(t,e="self"){const n=he(t);return e==="children"&&n.firstChild(),{walker:n,isSVG:!1}}function ye(t,e,n,i){if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function me(t,e,n=!1,i){const r=[];for(const[s,o]of Object.entries(e))if(o!=null&&!(s==="children"||s==="key"||s==="autoanimate")){if(s==="ref"&&typeof o=="function"){i&&console.log("→ Attaching ref"),o(t);continue}if(s.startsWith("on")&&typeof o=="function"){const a=s.slice(2).toLowerCase();i&&console.log(`→ Attaching event: ${a}`),t.addEventListener(a,o);continue}if(typeof o=="function"&&s!=="ref"&&s!=="viewTransitionName"){i&&console.log(`→ Reactive prop: ${s}`);const a=g(()=>{const l=o();ye(t,s,l,n)});r.push(a);continue}}return()=>r.forEach(s=>s())}function be(t,e,n=null,i){if(!e)return;const r=Array.isArray(e)?e:[e];if(!i.walker.firstChild()&&r.length>0){console.warn("Hydration mismatch: VNode has children but DOM is empty");return}for(const o of r)!o&&o!==0||ge(o,t,n,i);i.walker.parentNode()}function ge(t,e,n,i){if(!(!t&&t!==0)){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){const r=i.walker.currentNode;r.nodeType===Node.TEXT_NODE?(i.debug&&console.log("→ Hydrated text node"),i.walker.nextSibling()):console.warn(`Hydration mismatch: expected text node but found ${r.nodeName}`);return}if(typeof t=="function"){i.debug&&console.log("→ Hydrating reactive child");const r=j(t);r._parent=n,n&&n._renderedChildren.push(r);const s=i.walker.currentNode,o=t();if(o&&typeof o=="object"&&"type"in o){const f=o;v(f,i),r._currentChild=f,r._currentDom=f._dom??f._element}else(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(r._currentDom=s),i.walker.nextSibling();const a=document.createComment("reactive");r._currentDom?.parentNode&&r._currentDom.parentNode.insertBefore(a,r._currentDom),r._placeholder=a;let l=!0;const h=g(()=>{const f=t();if(l){l=!1;return}const{vnode:T,dom:$}=k(f,r);M(r,T,$)});r._dispose=h;return}if(t instanceof Node){i.walker.nextSibling();return}if(t&&typeof t=="object"&&"type"in t){const r=t;"type"in r&&r.type!=="reactive"&&r.type!=="suspended"&&(r._parent=n),n&&n._renderedChildren.push(r),v(r,i)}}}function ve(t,e){const n=e.walker.currentNode;if(n.nodeType!==Node.ELEMENT_NODE)return console.warn(`Hydration mismatch: expected element <${t.type}> but found ${n.nodeName}`),D(t,n,e);const i=n,r=i.tagName.toLowerCase();if(r!==t.type.toLowerCase())return console.warn(`Hydration mismatch: expected <${t.type}> but found <${r}>`),D(t,n,e);const s=e.isSVG||t.type==="svg",o=e.isSVG;e.isSVG=s,t._dom=i,e.debug&&console.log(`→ Attached existing <${t.type}> DOM`);const a=me(i,t.props,s,e.debug);return t._onUnmountCallbacks.push(a),t.props.children&&be(i,t.props.children,t,e),t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(l=>l()),e.isSVG=o,e.walker.nextSibling(),i}function D(t,e,n){n.debug&&console.log(`→ Fallback: rendering <${t.type}> fresh`);const i=e.parentNode,r=e.nextSibling;i?.removeChild(e);const s=U(t,n.isSVG);return i&&(r?i.insertBefore(s,r):i.appendChild(s)),n.walker.nextSibling(),s}function v(t,e){if("type"in t&&t.type==="reactive")return e.debug&&console.log(`Hydrating ReactiveVNode #${t._id}`),Se(t,e);if("type"in t&&t.type==="suspended")return e.debug&&console.log(`Hydrating SuspendedVNode: ${t._componentName}`),ke(t,e);if(typeof t.type=="string")return e.debug&&console.log(`Hydrating <${t.type}>`),ve(t,e);const n=t.type.name||"Anonymous";return e.debug&&console.log(`Hydrating Component: ${n}`),_e(t,e)}function _e(t,e){d.setCurrentVNode(t);const n=t.type(t.props);if(d.setCurrentVNode(null),!n)return null;if(typeof n=="object"&&"type"in n&&n.type==="suspended")return v(n,e);let i=null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){const r=e.walker.currentNode;r.nodeType===Node.TEXT_NODE&&(t._element=r,i=r,e.walker.nextSibling())}else if(n instanceof Node)t._element=n,i=n,e.walker.nextSibling();else if(n&&typeof n=="object"&&"type"in n){const r=n;"type"in r&&r.type!=="reactive"&&(r._parent=t,t._renderedChildren.push(r));const s=v(r,e);s&&(t._element=s),i=s}return i&&t._onMountCallbacks.length>0&&(e.debug&&console.log(`→ Firing ${t._onMountCallbacks.length} onMount callback(s)`),t._onMountCallbacks.forEach(r=>r())),i&&(t._lifecycleState="mounted"),i}function Se(t,e){const n=t.fn(),i=e.walker.currentNode,r=document.createComment("reactive");if(i.parentNode?.insertBefore(r,i),t._placeholder=r,n&&typeof n=="object"&&"type"in n){const a=n;v(a,e),t._currentChild=a,t._currentDom=a._dom??a._element}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(t._currentDom=i),e.walker.nextSibling();let s=!0;const o=g(()=>{const a=t.fn();if(s){s=!1,e.debug&&console.log("→ Reactive effect setup (skipping initial)");return}const{vnode:l,dom:h}=k(a,t);M(t,l,h)});return t._dispose=o,t._currentDom}function ke(t,e){const n=e.walker.currentNode;if(n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute("data-suspended")){const r=n;return r.getAttribute("data-suspended-state")==="resolved"?(t._state="resolved",e.walker.firstChild(),t.promise.then(o=>{t._state="resolved"}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.parentNode(),e.walker.nextSibling(),r):(t._state="pending",t.promise.then(o=>{t._state="resolved",r.innerHTML="";const a=C(o,e.isSVG);a&&r.appendChild(a)}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.nextSibling(),r)}console.warn("Hydration mismatch: expected suspended container");const i=_(t,e.isSVG);return e.walker.nextSibling(),i}function C(t,e){return!t&&t!==0?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?document.createTextNode(String(t)):t instanceof Node?t:typeof t=="object"&&"type"in t?_(t,e):typeof t=="function"?C(t(),e):null}function Ce(t,e,n="self"){const i=pe(e,n);v(t,i)}function we(t,e="Loading...",n="Error"){return i=>({type:"suspended",kind:"SuspendedVNode",promise:t(i),fallback:e,errorFallback:n,_id:d.newVNodeId(),_componentName:t.name||"AsyncComponent",_parent:null,_renderedChildren:[],_currentChild:null,_state:"pending"})}function Ee(t){const e=Symbol("context");return{_id:e,_defaultValue:t,provide(n){if(typeof document>"u")return;const i=d.getCurrentVNode();if(!i)throw new Error("context.provide() called outside of component render");i._contextMap||(i._contextMap=new Map),i._contextMap.set(e,n)}}}function Te(t){if(typeof document>"u")return t._defaultValue;const e=d.getCurrentVNode();if(!e)throw new Error("useContext called outside of component render");let n=e;for(;n;){if(n.kind==="VNode"&&n._contextMap?.has(t._id))return n._contextMap.get(t._id);n=n._parent}return t._defaultValue}function Ne(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onMount must be called inside a component during render");d.currentVNode._onMountCallbacks.push(t)}}function Ae(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onUnmount must be called inside a component during render");d.currentVNode._onUnmountCallbacks.push(t)}}function xe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onBeforeExit must be called inside a component during render");d.currentVNode._onBeforeExitCallbacks.push(t)}}function Me(t){if(!(typeof document>"u"))try{t()}catch(e){console.error(e)}}class Oe{readCallbacks=new Set;updateCallbacks=new Set;renderCallbacks=new Set;readKeepAlive=new Set;updateKeepAlive=new Set;renderKeepAlive=new Set;isProcessing=!1;frameScheduled=!1;frameId=null;lastTimestamp=0;currentDelta=0;trackFPS;fpsHistorySize;fpsHistory=[];constructor(e={}){this.trackFPS=e.trackFPS??!1,this.fpsHistorySize=e.fpsHistorySize??60}read(e,n=!1){return n?this.readKeepAlive.add(e):this.readCallbacks.add(e),this.scheduleFrame(),e}update(e,n=!1){return n?this.updateKeepAlive.add(e):this.updateCallbacks.add(e),this.scheduleFrame(),e}render(e,n=!1){return n?this.renderKeepAlive.add(e):this.renderCallbacks.add(e),this.scheduleFrame(),e}chain(e){let n,i;"read"in e&&this.readCallbacks.add(r=>{n=e.read(r)}),"update"in e?(this.updateCallbacks.add(r=>{i=e.update(n,r)}),this.renderCallbacks.add(r=>{e.render(i,r)})):this.renderCallbacks.add(r=>{e.render(n,r)}),this.scheduleFrame()}cancel(e){this.readCallbacks.delete(e),this.updateCallbacks.delete(e),this.renderCallbacks.delete(e),this.readKeepAlive.delete(e),this.updateKeepAlive.delete(e),this.renderKeepAlive.delete(e)}cancelAll(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null),this.readCallbacks.clear(),this.updateCallbacks.clear(),this.renderCallbacks.clear(),this.readKeepAlive.clear(),this.updateKeepAlive.clear(),this.renderKeepAlive.clear(),this.isProcessing=!1,this.frameScheduled=!1,this.lastTimestamp=0,this.currentDelta=0,this.trackFPS&&(this.fpsHistory=[])}get data(){return{timestamp:this.lastTimestamp,delta:this.currentDelta||16.67}}get isRunning(){return this.isProcessing||this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}get fps(){return this.trackFPS?this.currentDelta>0?1e3/this.currentDelta:0:(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}get averageFps(){if(!this.trackFPS)return console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0;if(this.fpsHistory.length===0)return 0;const e=this.fpsHistory.reduce((n,i)=>n+i,0);return Math.round(e/this.fpsHistory.length)}get refreshRate(){return this.trackFPS?Math.round(this.averageFps):(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}scheduleFrame(){this.frameScheduled||this.isProcessing||(this.frameScheduled=!0,this.frameId=requestAnimationFrame(e=>{this.processFrame(e)}))}processFrame(e){this.isProcessing=!0,this.frameScheduled=!1,this.lastTimestamp===0?this.currentDelta=16.67:this.currentDelta=e-this.lastTimestamp,this.lastTimestamp=e,this.trackFPS&&this.currentDelta>0&&(this.fpsHistory.push(1e3/this.currentDelta),this.fpsHistory.length>this.fpsHistorySize&&this.fpsHistory.shift());const n=this.data;this.executeCallbacks(this.readCallbacks,n),this.executeCallbacks(this.readKeepAlive,n),this.executeCallbacks(this.updateCallbacks,n),this.executeCallbacks(this.updateKeepAlive,n),this.executeCallbacks(this.renderCallbacks,n),this.executeCallbacks(this.renderKeepAlive,n),this.isProcessing=!1,this.hasKeepAliveCallbacks()&&this.scheduleFrame()}executeCallbacks(e,n){e.forEach(i=>{try{i(n)}catch(r){console.error("Frame callback error:",r)}}),this.isKeepAliveSet(e)||e.clear()}hasKeepAliveCallbacks(){return this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}isKeepAliveSet(e){return e===this.readKeepAlive||e===this.updateKeepAlive||e===this.renderKeepAlive}}class Pe{gestureId=0;activeGestures=new Map;disabledGestures=new Map;capturedId;gestureWithPriority=new Map;maxPriority=-1/0;newId(){return++this.gestureId}canStart(e){if(this.capturedId!==void 0)return!1;const n=this.disabledGestures.get(e);return!(n&&n.size>0)}start(e,n,i){return this.canStart(n)?(this.activeGestures.set(e,n),this.gestureWithPriority.set(e,i),this.maxPriority=Math.max(this.maxPriority,i),!0):!1}capture(e,n,i){return!this.activeGestures.has(e)&&!this.start(e,n,i)?!1:i>=this.maxPriority?(this.capturedId=e,this.activeGestures.forEach((r,s)=>{s!==e&&this.release(s)}),!0):(this.release(e),!1)}release(e){const n=this.activeGestures.get(e);this.activeGestures.delete(e);const i=this.gestureWithPriority.get(e);if(this.gestureWithPriority.delete(e),this.capturedId===e&&(this.capturedId=void 0),i===this.maxPriority&&(this.maxPriority=-1/0,this.gestureWithPriority.forEach(r=>{this.maxPriority=Math.max(this.maxPriority,r)})),n){const r=this.disabledGestures.get(n);r&&(r.delete(e),r.size===0&&this.disabledGestures.delete(n))}}disableGesture(e,n){let i=this.disabledGestures.get(e);i||(i=new Set,this.disabledGestures.set(e,i)),i.add(n)}enableGesture(e,n){const i=this.disabledGestures.get(e);i&&(i.delete(n),i.size===0&&this.disabledGestures.delete(e))}createGesture(e,n){const i=this.newId(),r=n.name||"gesture-"+i,s=n.priority??0;return new Fe(this,i,e,r,s,n)}}const De=new Pe;class Fe{el;options;details;minTouches;maxTouches;threshold;direction;lastMoveTime=0;prevX=0;prevY=0;initialDistance=0;initialAngle=0;boundOnStart;boundOnMove;boundOnEnd;passive;hasPassedThreshold=!1;controller;id;name;priority;useThreshold;constructor(e,n,i,r,s,o){this.controller=e,this.id=n,this.el=i,this.options=o,this.name=r,this.priority=s*1e3+n,this.minTouches=o.minTouches??1,this.maxTouches=o.maxTouches??1/0,this.passive=o.passive??!0,this.threshold=o.threshold??0,this.direction=o.direction??"all",this.useThreshold=this.threshold>0,this.details={type:this.name,isTracking:!1,startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,velocityX:0,velocityY:0,touchCount:0,scale:1,rotation:0},this.boundOnStart=this.onStart.bind(this),this.boundOnMove=this.onMove.bind(this),this.boundOnEnd=this.onEnd.bind(this)}getDistance(e){if(e.length<2)return 0;const n=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+i*i)}getAngle(e){if(e.length<2)return 0;const n=e[1].clientX-e[0].clientX,i=e[1].clientY-e[0].clientY;return Math.atan2(i,n)*180/Math.PI}getCenter(e){if("touches"in e){if(e.touches.length===0)return{x:0,y:0};let n=0,i=0;for(let r=0;r<e.touches.length;r++)n+=e.touches[r].clientX,i+=e.touches[r].clientY;return{x:n/e.touches.length,y:i/e.touches.length}}else return{x:e.clientX,y:e.clientY}}canStart(e){const i="touches"in e?e.touches.length:1;return i>=this.minTouches&&i<=this.maxTouches&&this.controller.canStart(this.name)}checkThreshold(){if(!this.useThreshold)return!0;const{deltaX:e,deltaY:n}=this.details;return this.direction==="x"?Math.abs(e)>=this.threshold:this.direction==="y"?Math.abs(n)>=this.threshold:Math.sqrt(e*e+n*n)>=this.threshold}onStart(e){if(!this.canStart(e))return;const n="touches"in e,i=this.getCenter(e);this.details.startX=i.x,this.details.startY=i.y,this.details.currentX=i.x,this.details.currentY=i.y,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2?(this.initialDistance=this.getDistance(e.touches),this.initialAngle=this.getAngle(e.touches)):(this.initialDistance=0,this.initialAngle=0),!(this.options.canStart&&!this.options.canStart(this.details))&&(this.passive||e.preventDefault(),this.details.isTracking=!0,this.details.deltaX=0,this.details.deltaY=0,this.details.velocityX=0,this.details.velocityY=0,this.details.scale=1,this.details.rotation=0,this.hasPassedThreshold=!this.useThreshold,this.lastMoveTime=Date.now(),this.prevX=i.x,this.prevY=i.y,this.controller.start(this.id,this.name,this.priority),this.useThreshold||this.tryCapture())}onMove(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e,i=this.getCenter(e),r=Date.now(),s=r-this.lastMoveTime;if(this.details.currentX=i.x,this.details.currentY=i.y,this.details.deltaX=this.details.currentX-this.details.startX,this.details.deltaY=this.details.currentY-this.details.startY,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2){const o=this.getDistance(e.touches),a=this.getAngle(e.touches);this.initialDistance>0&&(this.details.scale=o/this.initialDistance);let l=a-this.initialAngle;l>180&&(l-=360),l<-180&&(l+=360),this.details.rotation=l}else this.details.scale=1,this.details.rotation=0;if(s>0&&(this.details.velocityX=(this.details.currentX-this.prevX)/s,this.details.velocityY=(this.details.currentY-this.prevY)/s),this.prevX=this.details.currentX,this.prevY=this.details.currentY,this.lastMoveTime=r,!this.hasPassedThreshold&&this.checkThreshold()){this.hasPassedThreshold=!0,this.tryCapture();return}this.hasPassedThreshold&&this.options.onMove&&this.options.onMove(this.details)}tryCapture(){this.controller.capture(this.id,this.name,this.priority)&&this.options.onStart&&this.options.onStart(this.details)}onEnd(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e;this.details.touchCount=n?e.touches.length:0,this.details.event=e,this.controller.release(this.id),this.details.isTracking=!1,this.hasPassedThreshold=!this.useThreshold,this.options.onEnd&&this.options.onEnd(this.details)}init(){if(!this.el)return;const e={passive:this.passive},n={passive:this.passive},i={passive:this.passive};this.el.addEventListener("touchstart",this.boundOnStart,e),document.addEventListener("touchmove",this.boundOnMove,n),document.addEventListener("touchend",this.boundOnEnd,i),document.addEventListener("touchcancel",this.boundOnEnd,i),this.el.addEventListener("mousedown",this.boundOnStart,e),document.addEventListener("mousemove",this.boundOnMove,n),document.addEventListener("mouseup",this.boundOnEnd,i),document.addEventListener("mouseleave",this.boundOnEnd,i)}destroy(){this.el&&(this.el.removeEventListener("touchstart",this.boundOnStart),document.removeEventListener("touchmove",this.boundOnMove),document.removeEventListener("touchend",this.boundOnEnd),document.removeEventListener("touchcancel",this.boundOnEnd),this.el.removeEventListener("mousedown",this.boundOnStart),document.removeEventListener("mousemove",this.boundOnMove),document.removeEventListener("mouseup",this.boundOnEnd),document.removeEventListener("mouseleave",this.boundOnEnd),this.controller.release(this.id))}}function Le(t,e){return De.createGesture(t,e)}function Ie(t){typeof document>"u"||(document.startViewTransition?document.startViewTransition(t):t())}let Ke=0;function Ve(t,e=[],n={duration:500,namePrefix:"vt"}){if(!document.startViewTransition){t();return}const i=e.map((s,o)=>`${n.namePrefix}-${++Ke}-${o}`);e.forEach((s,o)=>{s.style.viewTransitionName=i[o]}),document.startViewTransition(()=>{t()}).finished.finally(()=>{e.forEach(s=>{s.style.viewTransitionName=""})}),document.documentElement.style.setProperty("--vt-duration",`${n.duration}ms`)}exports.Fragment=d.Fragment;exports.Computed=m;exports.Effect=b;exports.FrameScheduler=Oe;exports.Signal=u;exports.batch=W;exports.computed=R;exports.createContext=Ee;exports.createGesture=Le;exports.effect=g;exports.get=J;exports.hydrate=Ce;exports.link=ee;exports.onBeforeExit=xe;exports.onLoad=Me;exports.onMount=Ne;exports.onUnmount=Ae;exports.peek=Z;exports.render=de;exports.set=Q;exports.signal=z;exports.startViewTransition=Ie;exports.suspend=we;exports.useContext=Te;exports.withViewTransition=Ve;
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./jsx-dev-runtime-C5Q23IsT.cjs");var B=Symbol.for("preact-signals");function E(){if(y>1)y--;else{for(var t,e=!1;S!==void 0;){var n=S;for(S=void 0,N++;n!==void 0;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&I(n))try{n.c()}catch(r){e||(t=r,e=!0)}n=i}}if(N=0,y--,e)throw t}}function W(t){if(y>0)return t();y++;try{return t()}finally{E()}}var c=void 0;function F(t){var e=c;c=void 0;try{return t()}finally{c=e}}var S=void 0,y=0,N=0,w=0;function L(t){if(c!==void 0){var e=t.n;if(e===void 0||e.t!==c)return e={i:0,S:t,p:c.s,n:void 0,t:c,e:void 0,x:void 0,r:e},c.s!==void 0&&(c.s.n=e),c.s=e,t.n=e,32&c.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=c.s,e.n=void 0,c.s.n=e,c.s=e),e}}function u(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}u.prototype.brand=B;u.prototype.h=function(){return!0};u.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:F(function(){var i;(i=e.W)==null||i.call(e)}))};u.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,i=t.x;n!==void 0&&(n.x=i,t.e=void 0),i!==void 0&&(i.e=n,t.x=void 0),t===this.t&&(this.t=i,i===void 0&&F(function(){var r;(r=e.Z)==null||r.call(e)}))}};u.prototype.subscribe=function(t){var e=this;return g(function(){var n=e.value,i=c;c=void 0;try{t(n)}finally{c=i}},{name:"sub"})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=c;c=void 0;try{return this.value}finally{c=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=L(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(N>100)throw new Error("Cycle detected");this.v=t,this.i++,w++,y++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{E()}}}});function z(t,e){return new u(t,e)}function I(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function K(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function V(t){for(var e=t.s,n=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=n}function m(t,e){u.call(this,void 0),this.x=t,this.s=void 0,this.g=w-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}m.prototype=new u;m.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===w))return!0;if(this.g=w,this.f|=1,this.i>0&&!I(this))return this.f&=-2,!0;var t=c;try{K(this),c=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return c=t,V(this),this.f&=-2,!0};m.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}u.prototype.S.call(this,t)};m.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};m.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(m.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=L(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function R(t,e){return new m(t,e)}function G(t){var e=t.u;if(t.u=void 0,typeof e=="function"){y++;var n=c;c=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,A(t),i}finally{c=n,E()}}}function A(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,G(t)}function q(t){if(c!==this)throw new Error("Out-of-order effect");V(this),c=t,this.f&=-2,8&this.f&&A(this),E()}function b(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}b.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,G(this),K(this),y++;var t=c;return c=this,q.bind(this,t)};b.prototype.N=function(){2&this.f||(this.f|=2,this.o=S,S=this)};b.prototype.d=function(){this.f|=8,1&this.f||A(this)};b.prototype.dispose=function(){this.d()};function g(t,e){var n=new b(t,e);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Z(t){return t instanceof u?t.peek():t}function J(t){return t instanceof u?t.value:t}function Q(t,e){typeof e=="function"?t.value=e():t.value=e}function ee(t){return t instanceof u?()=>t.value:t}function te(t,e,n=!1){const i=[];for(const[r,s]of Object.entries(e))if(s!=null&&!(r==="children"||r==="key"||r==="autoanimate")){if(typeof s=="function"&&r!=="ref"&&!r.startsWith("on")&&r!=="viewTransitionName"){const o=g(()=>{const a=s();P(t,r,a,n)});i.push(o);continue}P(t,r,s,n)}return()=>i.forEach(r=>r())}function P(t,e,n,i){if(e==="ref"&&typeof n=="function"){n(t);return}if(e.startsWith("on")&&typeof n=="function"){const r=e.slice(2).toLowerCase();t.addEventListener(r,n);return}if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function ne(t,e){const n=document.createTextNode(String(e));t.appendChild(n)}function j(t){return{type:"reactive",kind:"ReactiveVNode",fn:t,_id:d.newVNodeId(),_dispose:null,_currentChild:null,_currentDom:null,_placeholder:null,_parent:null,_renderedChildren:[]}}function k(t,e){if(!t&&t!==0)return{vnode:null,dom:null};if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return{vnode:null,dom:document.createTextNode(String(t))};if(t instanceof Node)return{vnode:null,dom:t};if(typeof t=="object"&&"type"in t){const n=t;n.type!=="reactive"&&(n._parent=e),e._renderedChildren.push(n);const i=_(n);return{vnode:n,dom:i}}return{vnode:null,dom:null}}class x{_cancelled=!1;_cancelCallbacks=[];get cancelled(){return this._cancelled}cancel(){this._cancelled||(this._cancelled=!0,this._cancelCallbacks.forEach(e=>{try{e()}catch(n){console.error("Cancel callback error:",n)}}),this._cancelCallbacks=[])}onCancel(e){this._cancelled?e():this._cancelCallbacks.push(e)}throwIfCancelled(){if(this._cancelled)throw new Error("Operation cancelled")}}async function H(t,e){if(!t)return;const n=t,i=e||new x;if("_onBeforeExitCallbacks"in n&&n._onBeforeExitCallbacks.length>0)for(const r of n._onBeforeExitCallbacks)try{if(i.cancelled)break;await r(i)}catch(s){console.error("onBeforeExit error:",s)}if("_onUnmountCallbacks"in n&&n._onUnmountCallbacks.length>0&&n._onUnmountCallbacks.forEach(r=>{try{r()}catch(s){console.error("onUnmount error:",s)}}),n.type==="reactive"){const r=n;r._dispose&&(r._dispose(),r._dispose=null)}"_renderedChildren"in n&&n._renderedChildren.forEach(r=>{X(r)})}function X(t){if(!t)return;const e=t,n=new x;if(n.cancel(),"_onBeforeExitCallbacks"in e&&e._onBeforeExitCallbacks.length>0&&e._onBeforeExitCallbacks.forEach(i=>{try{const r=i(n);r instanceof Promise&&r.catch(s=>console.error("onBeforeExit error:",s))}catch(r){console.error("onBeforeExit error:",r)}}),"_onUnmountCallbacks"in e&&e._onUnmountCallbacks.length>0&&e._onUnmountCallbacks.forEach(i=>{try{i()}catch(r){console.error("onUnmount error:",r)}}),e.type==="reactive"){const i=e;i._dispose&&(i._dispose(),i._dispose=null)}"_renderedChildren"in e&&e._renderedChildren.forEach(i=>{X(i)})}let ie=0;const p=new WeakMap;async function M(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=t._currentChild,s=t._currentDom;if(re(r,e)){const f=p.get(t);f&&(f.token.cancel(),p.delete(t)),r&&"_lifecycleState"in r&&(r._lifecycleState="mounted");return}if(s instanceof Text&&n instanceof Text){s.nodeValue!==n.nodeValue&&(s.nodeValue=n.nodeValue),t._currentDom=s,t._currentChild=e,e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),p.delete(t);return}const o=++ie,a=p.get(t);a&&a.token.cancel();const l=new x;if(p.set(t,{id:o,token:l}),r&&"_lifecycleState"in r&&(r._lifecycleState="exiting"),r)try{await H(r,l)}catch(f){console.error(`ReactiveVNode ${t._id}: Unmount threw:`,f)}const h=p.get(t);if(!(!h||h.id!==o)){if(l.cancelled){p.delete(t);return}r&&"_lifecycleState"in r&&(r._lifecycleState="exited"),s&&s.remove(),n&&i.parentNode.insertBefore(n,i.nextSibling),e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),t._currentChild=e,t._currentDom=n,p.delete(t)}}function re(t,e){if(!t||!e||typeof t!="object"||typeof e!="object"||!("type"in t)||!("type"in e))return!1;if(typeof t.type=="function"&&typeof e.type=="function"){if(t.type!==e.type)return!1}else if(typeof t.type=="string"&&typeof e.type=="string"){if(t.type!==e.type)return!1}else return!1;const n="props"in t?t.props?.key:void 0,i="props"in e?e.props?.key:void 0;return n!==i?!1:"_lifecycleState"in t&&t._lifecycleState==="exiting"}function se(t,e){const n=t._listState;n?ae(t,e,n):oe(t,e)}function oe(t,e){const n=t._placeholder;if(!n?.parentNode)return;const i=[];for(let r=0;r<e.length;r++){const s=e[r],o=O(s,r),{vnode:a,dom:l}=k(s,t);l&&n.parentNode.appendChild(l),i.push({key:o,vnode:a,dom:l})}t._listState={items:i}}function ae(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=new Map;for(const a of n.items)r.set(a.key,a);const s=new Set,o=[];for(let a=0;a<e.length;a++){const l=e[a],h=O(l,a);s.add(h);const f=r.get(h);f?(o.push(f),r.delete(h)):le(t,l,o)}r.size>0&&ce(r),ue(i,o),t._listState={items:o}}function le(t,e,n){const i=O(e,n.length),{vnode:r,dom:s}=k(e,t);n.push({key:i,vnode:r,dom:s})}function ce(t){for(const[e,n]of t)n.vnode&&H(n.vnode),n.dom?.parentNode&&n.dom.parentNode.removeChild(n.dom)}function ue(t,e){const n=t.parentNode;if(!n)return;let i=t;for(const r of e)r.dom&&(i.nextSibling!==r.dom&&n.insertBefore(r.dom,i.nextSibling),i=r.dom)}function O(t,e){return t&&typeof t=="object"&&"key"in t?t.key??e:e}function Y(t,e,n=null,i=!1){if(!e)return;(Array.isArray(e)?e:[e]).forEach(s=>{if(s){if(Array.isArray(s)&&Y(t,s,n,i),typeof s=="string"||typeof s=="number")ne(t,s);else if(typeof s=="function"){const o=j(s);o._parent=n,n&&n._renderedChildren.push(o);const a=document.createComment("reactive");t.appendChild(a),o._placeholder=a;const l=g(()=>{const h=s();if(Array.isArray(h))se(o,h);else{const{vnode:f,dom:T}=k(h,o);M(o,f,T)}});o._dispose=l}else if(s instanceof Node)t.append(s);else if(s&&typeof s=="object"&&"type"in s){const o=s;"type"in o&&o.type!=="reactive"&&(o._parent=n),n&&n._renderedChildren.push(o);const a=_(o,i);a&&t.append(a)}}})}const fe="http://www.w3.org/2000/svg";function U(t,e=!1){if(t._dom)return t._dom;const n=e||t.type==="svg",i=n?document.createElementNS(fe,t.type):document.createElement(t.type),r=te(i,t.props,n);return t._onUnmountCallbacks.push(r),t.props.children&&Y(i,t.props.children,t,n),t._dom=i,t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(s=>s()),i}function _(t,e=!1){if("type"in t&&t.type==="reactive")return t._placeholder;if(typeof t.type=="string")return U(t,e);const n=t;d.setCurrentVNode(n);const i=n.type(n.props);if(d.setCurrentVNode(null),!i)return null;let r=null;if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")r=document.createTextNode(String(i));else if(i instanceof Node)n._element=i,r=i;else if(i&&typeof i=="object"&&"type"in i){const s=i;"type"in s&&s.type!=="reactive"&&(s._parent=n,n._renderedChildren.push(s));const o=_(s,e);o&&(n._element=o),r=o}return r&&n._onMountCallbacks.length>0&&n._onMountCallbacks.forEach(s=>{s()}),r&&(n._lifecycleState="mounted"),r}function de(t,e){const n=t instanceof Node?t:_(t);n&&e.append(n)}function he(t){return document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null)}function pe(t,e="self"){const n=he(t);return e==="children"&&n.firstChild(),{walker:n,isSVG:!1}}function ye(t,e,n,i){if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function me(t,e,n=!1,i){const r=[];for(const[s,o]of Object.entries(e))if(o!=null&&!(s==="children"||s==="key"||s==="autoanimate")){if(s==="ref"&&typeof o=="function"){i&&console.log("→ Attaching ref"),o(t);continue}if(s.startsWith("on")&&typeof o=="function"){const a=s.slice(2).toLowerCase();i&&console.log(`→ Attaching event: ${a}`),t.addEventListener(a,o);continue}if(typeof o=="function"&&s!=="ref"&&s!=="viewTransitionName"){i&&console.log(`→ Reactive prop: ${s}`);const a=g(()=>{const l=o();ye(t,s,l,n)});r.push(a);continue}}return()=>r.forEach(s=>s())}function be(t,e,n=null,i){if(!e)return;const r=Array.isArray(e)?e:[e];if(!i.walker.firstChild()&&r.length>0){console.warn("Hydration mismatch: VNode has children but DOM is empty");return}for(const o of r)!o&&o!==0||ge(o,t,n,i);i.walker.parentNode()}function ge(t,e,n,i){if(!(!t&&t!==0)){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){const r=i.walker.currentNode;r.nodeType===Node.TEXT_NODE?(i.debug&&console.log("→ Hydrated text node"),i.walker.nextSibling()):console.warn(`Hydration mismatch: expected text node but found ${r.nodeName}`);return}if(typeof t=="function"){i.debug&&console.log("→ Hydrating reactive child");const r=j(t);r._parent=n,n&&n._renderedChildren.push(r);const s=i.walker.currentNode,o=t();if(o&&typeof o=="object"&&"type"in o){const f=o;v(f,i),r._currentChild=f,r._currentDom=f._dom??f._element}else(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(r._currentDom=s),i.walker.nextSibling();const a=document.createComment("reactive");r._currentDom?.parentNode&&r._currentDom.parentNode.insertBefore(a,r._currentDom),r._placeholder=a;let l=!0;const h=g(()=>{const f=t();if(l){l=!1;return}const{vnode:T,dom:$}=k(f,r);M(r,T,$)});r._dispose=h;return}if(t instanceof Node){i.walker.nextSibling();return}if(t&&typeof t=="object"&&"type"in t){const r=t;"type"in r&&r.type!=="reactive"&&r.type!=="suspended"&&(r._parent=n),n&&n._renderedChildren.push(r),v(r,i)}}}function ve(t,e){const n=e.walker.currentNode;if(n.nodeType!==Node.ELEMENT_NODE)return console.warn(`Hydration mismatch: expected element <${t.type}> but found ${n.nodeName}`),D(t,n,e);const i=n,r=i.tagName.toLowerCase();if(r!==t.type.toLowerCase())return console.warn(`Hydration mismatch: expected <${t.type}> but found <${r}>`),D(t,n,e);const s=e.isSVG||t.type==="svg",o=e.isSVG;e.isSVG=s,t._dom=i,e.debug&&console.log(`→ Attached existing <${t.type}> DOM`);const a=me(i,t.props,s,e.debug);return t._onUnmountCallbacks.push(a),t.props.children&&be(i,t.props.children,t,e),t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(l=>l()),e.isSVG=o,e.walker.nextSibling(),i}function D(t,e,n){n.debug&&console.log(`→ Fallback: rendering <${t.type}> fresh`);const i=e.parentNode,r=e.nextSibling;i?.removeChild(e);const s=U(t,n.isSVG);return i&&(r?i.insertBefore(s,r):i.appendChild(s)),n.walker.nextSibling(),s}function v(t,e){if("type"in t&&t.type==="reactive")return e.debug&&console.log(`Hydrating ReactiveVNode #${t._id}`),Se(t,e);if("type"in t&&t.type==="suspended")return e.debug&&console.log(`Hydrating SuspendedVNode: ${t._componentName}`),ke(t,e);if(typeof t.type=="string")return e.debug&&console.log(`Hydrating <${t.type}>`),ve(t,e);const n=t.type.name||"Anonymous";return e.debug&&console.log(`Hydrating Component: ${n}`),_e(t,e)}function _e(t,e){d.setCurrentVNode(t);const n=t.type(t.props);if(d.setCurrentVNode(null),!n)return null;if(typeof n=="object"&&"type"in n&&n.type==="suspended")return v(n,e);let i=null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){const r=e.walker.currentNode;r.nodeType===Node.TEXT_NODE&&(t._element=r,i=r,e.walker.nextSibling())}else if(n instanceof Node)t._element=n,i=n,e.walker.nextSibling();else if(n&&typeof n=="object"&&"type"in n){const r=n;"type"in r&&r.type!=="reactive"&&(r._parent=t,t._renderedChildren.push(r));const s=v(r,e);s&&(t._element=s),i=s}return i&&t._onMountCallbacks.length>0&&(e.debug&&console.log(`→ Firing ${t._onMountCallbacks.length} onMount callback(s)`),t._onMountCallbacks.forEach(r=>r())),i&&(t._lifecycleState="mounted"),i}function Se(t,e){const n=t.fn(),i=e.walker.currentNode,r=document.createComment("reactive");if(i.parentNode?.insertBefore(r,i),t._placeholder=r,n&&typeof n=="object"&&"type"in n){const a=n;v(a,e),t._currentChild=a,t._currentDom=a._dom??a._element}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(t._currentDom=i),e.walker.nextSibling();let s=!0;const o=g(()=>{const a=t.fn();if(s){s=!1,e.debug&&console.log("→ Reactive effect setup (skipping initial)");return}const{vnode:l,dom:h}=k(a,t);M(t,l,h)});return t._dispose=o,t._currentDom}function ke(t,e){const n=e.walker.currentNode;if(n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute("data-suspended")){const r=n;return r.getAttribute("data-suspended-state")==="resolved"?(t._state="resolved",e.walker.firstChild(),t.promise.then(o=>{t._state="resolved"}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.parentNode(),e.walker.nextSibling(),r):(t._state="pending",t.promise.then(o=>{t._state="resolved",r.innerHTML="";const a=C(o,e.isSVG);a&&r.appendChild(a)}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.nextSibling(),r)}console.warn("Hydration mismatch: expected suspended container");const i=_(t,e.isSVG);return e.walker.nextSibling(),i}function C(t,e){return!t&&t!==0?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?document.createTextNode(String(t)):t instanceof Node?t:typeof t=="object"&&"type"in t?_(t,e):typeof t=="function"?C(t(),e):null}function Ce(t,e,n="self"){const i=pe(e,n);v(t,i)}function we(t,e="Loading...",n="Error"){return i=>({type:"suspended",kind:"SuspendedVNode",promise:t(i),fallback:e,errorFallback:n,_id:d.newVNodeId(),_componentName:t.name||"AsyncComponent",_parent:null,_renderedChildren:[],_currentChild:null,_state:"pending"})}function Ee(t){const e=Symbol("context");return{_id:e,_defaultValue:t,provide(n){if(typeof document>"u")return;const i=d.getCurrentVNode();if(!i)throw new Error("context.provide() called outside of component render");i._contextMap||(i._contextMap=new Map),i._contextMap.set(e,n)}}}function Te(t){if(typeof document>"u")return t._defaultValue;const e=d.getCurrentVNode();if(!e)throw new Error("useContext called outside of component render");let n=e;for(;n;){if(n.kind==="VNode"&&n._contextMap?.has(t._id))return n._contextMap.get(t._id);n=n._parent}return t._defaultValue}function Ne(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onMount must be called inside a component during render");d.currentVNode._onMountCallbacks.push(t)}}function Ae(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onUnmount must be called inside a component during render");d.currentVNode._onUnmountCallbacks.push(t)}}function xe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onBeforeExit must be called inside a component during render");d.currentVNode._onBeforeExitCallbacks.push(t)}}function Me(t){if(!(typeof document>"u"))try{t()}catch(e){console.error(e)}}class Oe{readCallbacks=new Set;updateCallbacks=new Set;renderCallbacks=new Set;readKeepAlive=new Set;updateKeepAlive=new Set;renderKeepAlive=new Set;isProcessing=!1;frameScheduled=!1;frameId=null;lastTimestamp=0;currentDelta=0;trackFPS;fpsHistorySize;fpsHistory=[];constructor(e={}){this.trackFPS=e.trackFPS??!1,this.fpsHistorySize=e.fpsHistorySize??60}read(e,n=!1){return n?this.readKeepAlive.add(e):this.readCallbacks.add(e),this.scheduleFrame(),e}update(e,n=!1){return n?this.updateKeepAlive.add(e):this.updateCallbacks.add(e),this.scheduleFrame(),e}render(e,n=!1){return n?this.renderKeepAlive.add(e):this.renderCallbacks.add(e),this.scheduleFrame(),e}chain(e){let n,i;"read"in e&&this.readCallbacks.add(r=>{n=e.read(r)}),"update"in e?(this.updateCallbacks.add(r=>{i=e.update(n,r)}),this.renderCallbacks.add(r=>{e.render(i,r)})):this.renderCallbacks.add(r=>{e.render(n,r)}),this.scheduleFrame()}cancel(e){this.readCallbacks.delete(e),this.updateCallbacks.delete(e),this.renderCallbacks.delete(e),this.readKeepAlive.delete(e),this.updateKeepAlive.delete(e),this.renderKeepAlive.delete(e)}cancelAll(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null),this.readCallbacks.clear(),this.updateCallbacks.clear(),this.renderCallbacks.clear(),this.readKeepAlive.clear(),this.updateKeepAlive.clear(),this.renderKeepAlive.clear(),this.isProcessing=!1,this.frameScheduled=!1,this.lastTimestamp=0,this.currentDelta=0,this.trackFPS&&(this.fpsHistory=[])}get data(){return{timestamp:this.lastTimestamp,delta:this.currentDelta||16.67}}get isRunning(){return this.isProcessing||this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}get fps(){return this.trackFPS?this.currentDelta>0?1e3/this.currentDelta:0:(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}get averageFps(){if(!this.trackFPS)return console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0;if(this.fpsHistory.length===0)return 0;const e=this.fpsHistory.reduce((n,i)=>n+i,0);return Math.round(e/this.fpsHistory.length)}get refreshRate(){return this.trackFPS?Math.round(this.averageFps):(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}scheduleFrame(){this.frameScheduled||this.isProcessing||(this.frameScheduled=!0,this.frameId=requestAnimationFrame(e=>{this.processFrame(e)}))}processFrame(e){this.isProcessing=!0,this.frameScheduled=!1,this.lastTimestamp===0?this.currentDelta=16.67:this.currentDelta=e-this.lastTimestamp,this.lastTimestamp=e,this.trackFPS&&this.currentDelta>0&&(this.fpsHistory.push(1e3/this.currentDelta),this.fpsHistory.length>this.fpsHistorySize&&this.fpsHistory.shift());const n=this.data;this.executeCallbacks(this.readCallbacks,n),this.executeCallbacks(this.readKeepAlive,n),this.executeCallbacks(this.updateCallbacks,n),this.executeCallbacks(this.updateKeepAlive,n),this.executeCallbacks(this.renderCallbacks,n),this.executeCallbacks(this.renderKeepAlive,n),this.isProcessing=!1,this.hasKeepAliveCallbacks()&&this.scheduleFrame()}executeCallbacks(e,n){e.forEach(i=>{try{i(n)}catch(r){console.error("Frame callback error:",r)}}),this.isKeepAliveSet(e)||e.clear()}hasKeepAliveCallbacks(){return this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}isKeepAliveSet(e){return e===this.readKeepAlive||e===this.updateKeepAlive||e===this.renderKeepAlive}}class Pe{gestureId=0;activeGestures=new Map;disabledGestures=new Map;capturedId;gestureWithPriority=new Map;maxPriority=-1/0;newId(){return++this.gestureId}canStart(e){if(this.capturedId!==void 0)return!1;const n=this.disabledGestures.get(e);return!(n&&n.size>0)}start(e,n,i){return this.canStart(n)?(this.activeGestures.set(e,n),this.gestureWithPriority.set(e,i),this.maxPriority=Math.max(this.maxPriority,i),!0):!1}capture(e,n,i){return!this.activeGestures.has(e)&&!this.start(e,n,i)?!1:i>=this.maxPriority?(this.capturedId=e,this.activeGestures.forEach((r,s)=>{s!==e&&this.release(s)}),!0):(this.release(e),!1)}release(e){const n=this.activeGestures.get(e);this.activeGestures.delete(e);const i=this.gestureWithPriority.get(e);if(this.gestureWithPriority.delete(e),this.capturedId===e&&(this.capturedId=void 0),i===this.maxPriority&&(this.maxPriority=-1/0,this.gestureWithPriority.forEach(r=>{this.maxPriority=Math.max(this.maxPriority,r)})),n){const r=this.disabledGestures.get(n);r&&(r.delete(e),r.size===0&&this.disabledGestures.delete(n))}}disableGesture(e,n){let i=this.disabledGestures.get(e);i||(i=new Set,this.disabledGestures.set(e,i)),i.add(n)}enableGesture(e,n){const i=this.disabledGestures.get(e);i&&(i.delete(n),i.size===0&&this.disabledGestures.delete(e))}createGesture(e,n){const i=this.newId(),r=n.name||"gesture-"+i,s=n.priority??0;return new Fe(this,i,e,r,s,n)}}const De=new Pe;class Fe{el;options;details;minTouches;maxTouches;threshold;direction;lastMoveTime=0;prevX=0;prevY=0;initialDistance=0;initialAngle=0;boundOnStart;boundOnMove;boundOnEnd;passive;hasPassedThreshold=!1;controller;id;name;priority;useThreshold;constructor(e,n,i,r,s,o){this.controller=e,this.id=n,this.el=i,this.options=o,this.name=r,this.priority=s*1e3+n,this.minTouches=o.minTouches??1,this.maxTouches=o.maxTouches??1/0,this.passive=o.passive??!0,this.threshold=o.threshold??0,this.direction=o.direction??"all",this.useThreshold=this.threshold>0,this.details={type:this.name,isTracking:!1,startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,velocityX:0,velocityY:0,touchCount:0,scale:1,rotation:0},this.boundOnStart=this.onStart.bind(this),this.boundOnMove=this.onMove.bind(this),this.boundOnEnd=this.onEnd.bind(this)}getDistance(e){if(e.length<2)return 0;const n=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+i*i)}getAngle(e){if(e.length<2)return 0;const n=e[1].clientX-e[0].clientX,i=e[1].clientY-e[0].clientY;return Math.atan2(i,n)*180/Math.PI}getCenter(e){if("touches"in e){if(e.touches.length===0)return{x:0,y:0};let n=0,i=0;for(let r=0;r<e.touches.length;r++)n+=e.touches[r].clientX,i+=e.touches[r].clientY;return{x:n/e.touches.length,y:i/e.touches.length}}else return{x:e.clientX,y:e.clientY}}canStart(e){const i="touches"in e?e.touches.length:1;return i>=this.minTouches&&i<=this.maxTouches&&this.controller.canStart(this.name)}checkThreshold(){if(!this.useThreshold)return!0;const{deltaX:e,deltaY:n}=this.details;return this.direction==="x"?Math.abs(e)>=this.threshold:this.direction==="y"?Math.abs(n)>=this.threshold:Math.sqrt(e*e+n*n)>=this.threshold}onStart(e){if(!this.canStart(e))return;const n="touches"in e,i=this.getCenter(e);this.details.startX=i.x,this.details.startY=i.y,this.details.currentX=i.x,this.details.currentY=i.y,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2?(this.initialDistance=this.getDistance(e.touches),this.initialAngle=this.getAngle(e.touches)):(this.initialDistance=0,this.initialAngle=0),!(this.options.canStart&&!this.options.canStart(this.details))&&(this.passive||e.preventDefault(),this.details.isTracking=!0,this.details.deltaX=0,this.details.deltaY=0,this.details.velocityX=0,this.details.velocityY=0,this.details.scale=1,this.details.rotation=0,this.hasPassedThreshold=!this.useThreshold,this.lastMoveTime=Date.now(),this.prevX=i.x,this.prevY=i.y,this.controller.start(this.id,this.name,this.priority),this.useThreshold||this.tryCapture())}onMove(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e,i=this.getCenter(e),r=Date.now(),s=r-this.lastMoveTime;if(this.details.currentX=i.x,this.details.currentY=i.y,this.details.deltaX=this.details.currentX-this.details.startX,this.details.deltaY=this.details.currentY-this.details.startY,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2){const o=this.getDistance(e.touches),a=this.getAngle(e.touches);this.initialDistance>0&&(this.details.scale=o/this.initialDistance);let l=a-this.initialAngle;l>180&&(l-=360),l<-180&&(l+=360),this.details.rotation=l}else this.details.scale=1,this.details.rotation=0;if(s>0&&(this.details.velocityX=(this.details.currentX-this.prevX)/s,this.details.velocityY=(this.details.currentY-this.prevY)/s),this.prevX=this.details.currentX,this.prevY=this.details.currentY,this.lastMoveTime=r,!this.hasPassedThreshold&&this.checkThreshold()){this.hasPassedThreshold=!0,this.tryCapture();return}this.hasPassedThreshold&&this.options.onMove&&this.options.onMove(this.details)}tryCapture(){this.controller.capture(this.id,this.name,this.priority)&&this.options.onStart&&this.options.onStart(this.details)}onEnd(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e;this.details.touchCount=n?e.touches.length:0,this.details.event=e,this.controller.release(this.id),this.details.isTracking=!1,this.hasPassedThreshold=!this.useThreshold,this.options.onEnd&&this.options.onEnd(this.details)}init(){if(!this.el)return;const e={passive:this.passive},n={passive:this.passive},i={passive:this.passive};this.el.addEventListener("touchstart",this.boundOnStart,e),document.addEventListener("touchmove",this.boundOnMove,n),document.addEventListener("touchend",this.boundOnEnd,i),document.addEventListener("touchcancel",this.boundOnEnd,i),this.el.addEventListener("mousedown",this.boundOnStart,e),document.addEventListener("mousemove",this.boundOnMove,n),document.addEventListener("mouseup",this.boundOnEnd,i),document.addEventListener("mouseleave",this.boundOnEnd,i)}destroy(){this.el&&(this.el.removeEventListener("touchstart",this.boundOnStart),document.removeEventListener("touchmove",this.boundOnMove),document.removeEventListener("touchend",this.boundOnEnd),document.removeEventListener("touchcancel",this.boundOnEnd),this.el.removeEventListener("mousedown",this.boundOnStart),document.removeEventListener("mousemove",this.boundOnMove),document.removeEventListener("mouseup",this.boundOnEnd),document.removeEventListener("mouseleave",this.boundOnEnd),this.controller.release(this.id))}}function Le(t,e){return De.createGesture(t,e)}function Ie(t){typeof document>"u"||(document.startViewTransition?document.startViewTransition(t):t())}let Ke=0;function Ve(t,e=[],n={duration:500,namePrefix:"vt"}){if(!document.startViewTransition){t();return}const i=e.map((s,o)=>`${n.namePrefix}-${++Ke}-${o}`);e.forEach((s,o)=>{s.style.viewTransitionName=i[o]}),document.startViewTransition(()=>{t()}).finished.finally(()=>{e.forEach(s=>{s.style.viewTransitionName=""})}),document.documentElement.style.setProperty("--vt-duration",`${n.duration}ms`)}exports.Fragment=d.Fragment;exports.Computed=m;exports.Effect=b;exports.FrameScheduler=Oe;exports.Signal=u;exports.batch=W;exports.computed=R;exports.createContext=Ee;exports.createGesture=Le;exports.effect=g;exports.get=J;exports.hydrate=Ce;exports.link=ee;exports.onBeforeExit=xe;exports.onLoad=Me;exports.onMount=Ne;exports.onUnmount=Ae;exports.peek=Z;exports.render=de;exports.set=Q;exports.signal=z;exports.startViewTransition=Ie;exports.suspend=we;exports.useContext=Te;exports.withViewTransition=Ve;
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- import { n as L, s as w, g as I, c as m } from "./jsx-dev-runtime-BfTCjShK.js";
12
- import { F as $e } from "./jsx-dev-runtime-BfTCjShK.js";
11
+ import { n as L, s as w, g as I, c as m } from "./jsx-dev-runtime-dAReTOgq.js";
12
+ import { F as $e } from "./jsx-dev-runtime-dAReTOgq.js";
13
13
  var R = Symbol.for("preact-signals");
14
14
  function T() {
15
15
  if (p > 1)
@@ -8,4 +8,4 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";let d=0;const r=()=>d++;exports.currentVNode=null;function l(n){exports.currentVNode=n}function u(){return exports.currentVNode}function c(n,e,t){return{type:n,kind:"VNode",props:e,key:t,children:e.children,_id:r(),_onMountCallbacks:[],_onUnmountCallbacks:[],_onBeforeExitCallbacks:[],_element:null,_parent:null,_renderedChildren:[],_lifecycleState:"mounting"}}function i(n,e,t){return{type:n,kind:"IntrinsicVNode",props:e,key:t,_id:r(),_dom:void 0,_parent:null,_renderedChildren:[],_onMountCallbacks:[],_onUnmountCallbacks:[],_onBeforeExitCallbacks:[],_lifecycleState:"mounting"}}const o=Symbol("fragment");function a(n,e,t){return n===o?e?.children:typeof n=="function"?c(n,e??{},t):i(n,e??{},t)}exports.Fragment=o;exports.getCurrentVNode=u;exports.jsx=a;exports.newVNodeId=r;exports.setCurrentVNode=l;
11
+ "use strict";let d=0;const r=()=>d++;exports.currentVNode=null;function l(n){exports.currentVNode=n}function u(){return exports.currentVNode}function c(n,e,t){return{type:n,kind:"VNode",props:e,key:t,children:e.children,_id:r(),_onMountCallbacks:[],_onUnmountCallbacks:[],_onBeforeExitCallbacks:[],_element:null,_parent:null,_renderedChildren:[],_lifecycleState:"mounting"}}function i(n,e,t){return{type:n,kind:"IntrinsicVNode",props:e,key:t,_id:r(),_dom:void 0,_parent:null,_renderedChildren:[],_onMountCallbacks:[],_onUnmountCallbacks:[],_onBeforeExitCallbacks:[],_lifecycleState:"mounting"}}const o=Symbol.for("jsx.fragment");function a(n,e,t){return n===o?e?.children:typeof n=="function"?c(n,e??{},t):i(n,e??{},t)}exports.Fragment=o;exports.getCurrentVNode=u;exports.jsx=a;exports.newVNodeId=r;exports.setCurrentVNode=l;
@@ -8,14 +8,14 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- let o = 0;
12
- const r = () => o++;
13
- let l = null;
11
+ let l = 0;
12
+ const r = () => l++;
13
+ let o = null;
14
14
  function d(n) {
15
- l = n;
15
+ o = n;
16
16
  }
17
17
  function u() {
18
- return l;
18
+ return o;
19
19
  }
20
20
  function i(n, e, t) {
21
21
  return {
@@ -51,13 +51,13 @@ function c(n, e, t) {
51
51
  _lifecycleState: "mounting"
52
52
  };
53
53
  }
54
- const a = Symbol("fragment");
54
+ const a = Symbol.for("jsx.fragment");
55
55
  function s(n, e, t) {
56
56
  return n === a ? e?.children : typeof n == "function" ? i(n, e ?? {}, t) : c(n, e ?? {}, t);
57
57
  }
58
58
  export {
59
59
  a as F,
60
- l as c,
60
+ o as c,
61
61
  u as g,
62
62
  s as j,
63
63
  r as n,
@@ -8,4 +8,4 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-dev-runtime-D4XANMVW.cjs");exports.Fragment=e.Fragment;exports.jsx=e.jsx;exports.jsxDEV=e.jsx;exports.jsxs=e.jsx;
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-dev-runtime-C5Q23IsT.cjs");exports.Fragment=e.Fragment;exports.jsx=e.jsx;exports.jsxDEV=e.jsx;exports.jsxs=e.jsx;
@@ -8,7 +8,7 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- import { F as a, j as x, j as r, j as e } from "./jsx-dev-runtime-BfTCjShK.js";
11
+ import { F as a, j as x, j as r, j as e } from "./jsx-dev-runtime-dAReTOgq.js";
12
12
  export {
13
13
  a as Fragment,
14
14
  x as jsx,
@@ -8,4 +8,4 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-dev-runtime-D4XANMVW.cjs");exports.Fragment=e.Fragment;exports.jsx=e.jsx;exports.jsxDEV=e.jsx;exports.jsxs=e.jsx;
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-dev-runtime-C5Q23IsT.cjs");exports.Fragment=e.Fragment;exports.jsx=e.jsx;exports.jsxDEV=e.jsx;exports.jsxs=e.jsx;
@@ -8,7 +8,7 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- import { F as a, j as x, j as r, j as e } from "./jsx-dev-runtime-BfTCjShK.js";
11
+ import { F as a, j as x, j as r, j as e } from "./jsx-dev-runtime-dAReTOgq.js";
12
12
  export {
13
13
  a as Fragment,
14
14
  x as jsx,
package/dist/server.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs/promises"),m=require("node:path");function b(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const A=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function E(t){return/^on[A-Z]/.test(t)}function w(t){return Object.entries(t).map(([r,o])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${o}`).join(";")}function D(t,r=!0){const o=Object.entries(t).filter(([e,n])=>!(n==null||r&&e==="children"||E(e))).map(([e,n])=>(e==="className"&&(e="class"),e==="style"&&typeof n=="object"&&(n=w(n)),typeof n=="boolean"?n?e:"":`${e}="${v(String(n))}"`)).filter(Boolean).join(" ");return o?` ${o}`:""}function $(t){return t?Array.isArray(t)?t:[t]:[]}function j(t){return t&&typeof t.then=="function"}function h(t,r){return`<div id="${t}" data-server-component="suspended" data-component-name="${r}">Loading...</div>`}const a=new Map;let f=0;function H(t){return a.clear(),f=0,s(t)}async function T(t){a.clear(),f=0;let r=s(t);for(;a.size>0;){console.log(`🔄 Resolving ${a.size} async components in parallel...`);const o=Array.from(a.entries());a.clear();const e=await Promise.allSettled(o.map(([n,{promise:i}])=>i));for(let n=0;n<o.length;n++){const i=o[n];if(!i)continue;const[l,{componentName:c,errorFallback:u}]=i,p=e[n];if(!p)continue;const y=h(l,c);if(p.status==="fulfilled")try{console.log(`✅ Resolved: ${c} (${l})`);const d=s(p.value);r=r.replace(y,d)}catch(d){console.error(`❌ Error rendering ${c}:`,d);const S=u?s(typeof u=="function"?u(d):u):`<div class="error">Error rendering ${c}</div>`;r=r.replace(y,S)}else{console.error(`❌ Error resolving ${c}:`,p.reason);const d=u?s(typeof u=="function"?u(p.reason):u):`<div class="error">Error loading ${c}</div>`;r=r.replace(y,d)}}}return console.log("✅ All async components resolved!"),r}async function*P(t){for(a.clear(),f=0,yield s(t);a.size>0;){const o=Array.from(a.entries());a.clear();const e=o.map(async([n,{promise:i}])=>{try{const l=await i,c=s(l);return`<script>
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs/promises"),m=require("node:path");function b(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const v=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function E(t){return/^on[A-Z]/.test(t)}function w(t){return Object.entries(t).map(([r,o])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${o}`).join(";")}function D(t,r=!0){const o=Object.entries(t).filter(([e,n])=>!(n==null||r&&e==="children"||E(e))).map(([e,n])=>(e==="className"&&(e="class"),e==="style"&&typeof n=="object"&&(n=w(n)),typeof n=="boolean"?n?e:"":`${e}="${A(String(n))}"`)).filter(Boolean).join(" ");return o?` ${o}`:""}function $(t){return t?Array.isArray(t)?t:[t]:[]}function j(t){return t&&typeof t.then=="function"}function h(t,r){return`<div id="${t}" data-server-component="suspended" data-component-name="${r}">Loading...</div>`}const a=new Map;let d=0;function H(t){return a.clear(),d=0,s(t)}async function T(t){a.clear(),d=0;let r=s(t);for(;a.size>0;){console.log(`🔄 Resolving ${a.size} async components in parallel...`);const o=Array.from(a.entries());a.clear();const e=await Promise.allSettled(o.map(([n,{promise:i}])=>i));for(let n=0;n<o.length;n++){const i=o[n];if(!i)continue;const[l,{componentName:c,errorFallback:u}]=i,p=e[n];if(!p)continue;const y=h(l,c);if(p.status==="fulfilled")try{console.log(`✅ Resolved: ${c} (${l})`);const f=s(p.value);r=r.replace(y,f)}catch(f){console.error(`❌ Error rendering ${c}:`,f);const S=u?s(typeof u=="function"?u(f):u):`<div class="error">Error rendering ${c}</div>`;r=r.replace(y,S)}else{console.error(`❌ Error resolving ${c}:`,p.reason);const f=u?s(typeof u=="function"?u(p.reason):u):`<div class="error">Error loading ${c}</div>`;r=r.replace(y,f)}}}return console.log("✅ All async components resolved!"),r}async function*P(t){for(a.clear(),d=0,yield s(t);a.size>0;){const o=Array.from(a.entries());a.clear();const e=o.map(async([n,{promise:i}])=>{try{const l=await i,c=s(l);return`<script>
12
12
  (function() {
13
13
  const el = document.getElementById('${n}');
14
14
  if (el) {
@@ -22,6 +22,6 @@
22
22
  el.innerHTML = '<div class="error">Error loading component</div>';
23
23
  }
24
24
  })();
25
- <\/script>`}});for(const n of e)yield await n}}function s(t){if(typeof t=="function"){const e=t();return Array.isArray(e)?`<!--reactive-list-->${e.map(i=>s(i)).join("")}`:s(e)}if(typeof t=="string")return b(t);if(typeof t=="number")return String(t);if(!t||typeof t!="object")return"";const{type:r,props:o}=t;if(r===Symbol.for("jsx.fragment"))return $(o.children).map(n=>s(n)).join("");if(typeof r=="string"&&r==="suspended"){const e=t,n=`async-${f++}`;return console.log(`⏳ Suspending: ${e._componentName} (${n})`),a.set(n,{id:n,promise:e.promise,componentName:e._componentName,errorFallback:e.errorFallback}),h(n,e._componentName)}if(typeof r=="function"){const e=r(o);if(j(e)){const n=`async-${f++}`,i=r.name||"AsyncComponent";return console.warn(`⚠️ DEPRECATED: Direct async component "${i}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
26
- Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);`),console.log(`⏳ Suspending: ${i} (${n})`),a.set(n,{id:n,promise:e,componentName:i}),h(n,i)}return s(e)}if(typeof r=="string"){const e=D(o);if(A.has(r))return`<${r}${e} />`;const i=$(o.children).map(l=>{if(typeof l=="function"){const c=l();return Array.isArray(c)?`<!--reactive-list-->${c.map(p=>s(p)).join("")}`:`<!--reactive-->${s(c)}`}return s(l)}).join("");return r==="html"?`<!DOCTYPE html>
25
+ <\/script>`}});for(const n of e)yield await n}}function s(t){if(typeof t=="function"){const e=t();return Array.isArray(e)?`<!--reactive-list-->${e.map(i=>s(i)).join("")}`:s(e)}if(typeof t=="string")return b(t);if(typeof t=="number")return String(t);if(!t||typeof t!="object")return"";const{type:r,props:o}=t;if(r===Symbol.for("jsx.fragment"))return $(o.children).map(n=>s(n)).join("");if(typeof r=="string"&&r==="suspended"){const e=t,n=`async-${d++}`;return console.log(`⏳ Suspending: ${e._componentName} (${n})`),a.set(n,{id:n,promise:e.promise,componentName:e._componentName,errorFallback:e.errorFallback}),h(n,e._componentName)}if(typeof r=="function"){const e=r(o);if(j(e)){const n=`async-${d++}`,i=r.name||"AsyncComponent";return console.warn(`⚠️ DEPRECATED: Direct async component "${i}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
26
+ Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);`),console.log(`⏳ Suspending: ${i} (${n})`),a.set(n,{id:n,promise:e,componentName:i}),h(n,i)}return s(e)}if(typeof r=="string"){const e=D(o);if(v.has(r))return`<${r}${e} />`;const i=$(o.children).map(l=>{if(Array.isArray(l))return l.map(c=>s(c)).join("");if(typeof l=="function"){const c=l();return Array.isArray(c)?`<!--reactive-list-->${c.map(p=>s(p)).join("")}`:`<!--reactive-->${s(c)}`}return s(l)}).join("");return r==="html"?`<!DOCTYPE html>
27
27
  <html${e}>${i}</html>`:`<${r}${e}>${i}</${r}>`}return""}class C{cacheDir;useDirectoryStructure;constructor(r={}){this.cacheDir=r.cacheDir||"./cache/html",this.useDirectoryStructure=r.useDirectoryStructure??!1}async save(r,o){const e=this.getFilepath(r);return await g.mkdir(m.dirname(e),{recursive:!0}),await Bun.write(e,o),console.log(`✅ Pre-rendered: ${r} → ${e}`),e}async load(r){const o=this.getFilepath(r),e=Bun.file(o);return await e.exists()?e:null}async clear(){await g.rm(this.cacheDir,{recursive:!0,force:!0}),await g.mkdir(this.cacheDir,{recursive:!0}),console.log("🗑️ Cache cleared")}async exists(r){const o=this.getFilepath(r);return await Bun.file(o).exists()}getFilepath(r){const o=r.replace(/^\/+|\/+$/g,"");if(this.useDirectoryStructure)return o===""?m.join(this.cacheDir,"index.html"):m.join(this.cacheDir,o,"index.html");{const e=o===""?"index.html":`${o.replace(/\//g,"-")}.html`;return m.join(this.cacheDir,e)}}}exports.PreRenderer=C;exports.renderToStream=P;exports.renderToString=H;exports.renderToStringAsync=T;
package/dist/server.js CHANGED
@@ -8,9 +8,9 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- import { mkdir as g, rm as b } from "node:fs/promises";
12
- import { dirname as v, join as y } from "node:path";
13
- function A(t) {
11
+ import { mkdir as h, rm as A } from "node:fs/promises";
12
+ import { dirname as b, join as y } from "node:path";
13
+ function v(t) {
14
14
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
15
15
  }
16
16
  function E(t) {
@@ -47,17 +47,17 @@ function $(t) {
47
47
  function P(t) {
48
48
  return t && typeof t.then == "function";
49
49
  }
50
- function h(t, r) {
50
+ function g(t, r) {
51
51
  return `<div id="${t}" data-server-component="suspended" data-component-name="${r}">Loading...</div>`;
52
52
  }
53
53
  const a = /* @__PURE__ */ new Map();
54
54
  let d = 0;
55
55
  function N(t) {
56
- return a.clear(), d = 0, c(t);
56
+ return a.clear(), d = 0, s(t);
57
57
  }
58
58
  async function T(t) {
59
59
  a.clear(), d = 0;
60
- let r = c(t);
60
+ let r = s(t);
61
61
  for (; a.size > 0; ) {
62
62
  console.log(
63
63
  `🔄 Resolving ${a.size} async components in parallel...`
@@ -70,26 +70,26 @@ async function T(t) {
70
70
  for (let n = 0; n < o.length; n++) {
71
71
  const i = o[n];
72
72
  if (!i) continue;
73
- const [l, { componentName: s, errorFallback: u }] = i, p = e[n];
73
+ const [l, { componentName: c, errorFallback: u }] = i, p = e[n];
74
74
  if (!p) continue;
75
- const m = h(l, s);
75
+ const m = g(l, c);
76
76
  if (p.status === "fulfilled")
77
77
  try {
78
- console.log(`✅ Resolved: ${s} (${l})`);
79
- const f = c(p.value);
78
+ console.log(`✅ Resolved: ${c} (${l})`);
79
+ const f = s(p.value);
80
80
  r = r.replace(m, f);
81
81
  } catch (f) {
82
- console.error(`❌ Error rendering ${s}:`, f);
83
- const S = u ? c(
82
+ console.error(`❌ Error rendering ${c}:`, f);
83
+ const S = u ? s(
84
84
  typeof u == "function" ? u(f) : u
85
- ) : `<div class="error">Error rendering ${s}</div>`;
85
+ ) : `<div class="error">Error rendering ${c}</div>`;
86
86
  r = r.replace(m, S);
87
87
  }
88
88
  else {
89
- console.error(`❌ Error resolving ${s}:`, p.reason);
90
- const f = u ? c(
89
+ console.error(`❌ Error resolving ${c}:`, p.reason);
90
+ const f = u ? s(
91
91
  typeof u == "function" ? u(p.reason) : u
92
- ) : `<div class="error">Error loading ${s}</div>`;
92
+ ) : `<div class="error">Error loading ${c}</div>`;
93
93
  r = r.replace(m, f);
94
94
  }
95
95
  }
@@ -97,18 +97,18 @@ async function T(t) {
97
97
  return console.log("✅ All async components resolved!"), r;
98
98
  }
99
99
  async function* F(t) {
100
- for (a.clear(), d = 0, yield c(t); a.size > 0; ) {
100
+ for (a.clear(), d = 0, yield s(t); a.size > 0; ) {
101
101
  const o = Array.from(a.entries());
102
102
  a.clear();
103
103
  const e = o.map(
104
104
  async ([n, { promise: i }]) => {
105
105
  try {
106
- const l = await i, s = c(l);
106
+ const l = await i, c = s(l);
107
107
  return `<script>
108
108
  (function() {
109
109
  const el = document.getElementById('${n}');
110
110
  if (el) {
111
- el.outerHTML = \`${s.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;
111
+ el.outerHTML = \`${c.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;
112
112
  }
113
113
  })();
114
114
  <\/script>`;
@@ -128,20 +128,20 @@ async function* F(t) {
128
128
  yield await n;
129
129
  }
130
130
  }
131
- function c(t) {
131
+ function s(t) {
132
132
  if (typeof t == "function") {
133
133
  const e = t();
134
- return Array.isArray(e) ? `<!--reactive-list-->${e.map((i) => c(i)).join("")}` : c(e);
134
+ return Array.isArray(e) ? `<!--reactive-list-->${e.map((i) => s(i)).join("")}` : s(e);
135
135
  }
136
136
  if (typeof t == "string")
137
- return A(t);
137
+ return v(t);
138
138
  if (typeof t == "number")
139
139
  return String(t);
140
140
  if (!t || typeof t != "object")
141
141
  return "";
142
142
  const { type: r, props: o } = t;
143
143
  if (r === Symbol.for("jsx.fragment"))
144
- return $(o.children).map((n) => c(n)).join("");
144
+ return $(o.children).map((n) => s(n)).join("");
145
145
  if (typeof r == "string" && r === "suspended") {
146
146
  const e = t, n = `async-${d++}`;
147
147
  return console.log(
@@ -152,7 +152,7 @@ function c(t) {
152
152
  componentName: e._componentName,
153
153
  errorFallback: e.errorFallback
154
154
  // Store custom error fallback
155
- }), h(n, e._componentName);
155
+ }), g(n, e._componentName);
156
156
  }
157
157
  if (typeof r == "function") {
158
158
  const e = r(o);
@@ -165,20 +165,22 @@ Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);
165
165
  id: n,
166
166
  promise: e,
167
167
  componentName: i
168
- }), h(n, i);
168
+ }), g(n, i);
169
169
  }
170
- return c(e);
170
+ return s(e);
171
171
  }
172
172
  if (typeof r == "string") {
173
173
  const e = j(o);
174
174
  if (w.has(r))
175
175
  return `<${r}${e} />`;
176
176
  const i = $(o.children).map((l) => {
177
+ if (Array.isArray(l))
178
+ return l.map((c) => s(c)).join("");
177
179
  if (typeof l == "function") {
178
- const s = l();
179
- return Array.isArray(s) ? `<!--reactive-list-->${s.map((p) => c(p)).join("")}` : `<!--reactive-->${c(s)}`;
180
+ const c = l();
181
+ return Array.isArray(c) ? `<!--reactive-list-->${c.map((p) => s(p)).join("")}` : `<!--reactive-->${s(c)}`;
180
182
  }
181
- return c(l);
183
+ return s(l);
182
184
  }).join("");
183
185
  return r === "html" ? `<!DOCTYPE html>
184
186
  <html${e}>${i}</html>` : `<${r}${e}>${i}</${r}>`;
@@ -193,14 +195,14 @@ class z {
193
195
  }
194
196
  async save(r, o) {
195
197
  const e = this.getFilepath(r);
196
- return await g(v(e), { recursive: !0 }), await Bun.write(e, o), console.log(`✅ Pre-rendered: ${r} → ${e}`), e;
198
+ return await h(b(e), { recursive: !0 }), await Bun.write(e, o), console.log(`✅ Pre-rendered: ${r} → ${e}`), e;
197
199
  }
198
200
  async load(r) {
199
201
  const o = this.getFilepath(r), e = Bun.file(o);
200
202
  return await e.exists() ? e : null;
201
203
  }
202
204
  async clear() {
203
- await b(this.cacheDir, { recursive: !0, force: !0 }), await g(this.cacheDir, { recursive: !0 }), console.log("🗑️ Cache cleared");
205
+ await A(this.cacheDir, { recursive: !0, force: !0 }), await h(this.cacheDir, { recursive: !0 }), console.log("🗑️ Cache cleared");
204
206
  }
205
207
  async exists(r) {
206
208
  const o = this.getFilepath(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mateosuarezdev/flash",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Custom jsx runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",