@mateosuarezdev/flash 0.0.2 → 0.0.4

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-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;
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 H(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 K(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{H(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,K(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 V(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,V(t)}function q(t){if(c!==this)throw new Error("Out-of-order effect");K(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,V(this),H(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"||r==="innerHTML")){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 G(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 j(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 j(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&&j(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=G(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.innerHTML!==void 0?i.innerHTML=t.props.innerHTML: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=G(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 He=0;function Ke(t,e=[],n={duration:500,namePrefix:"vt"}){if(!document.startViewTransition){t();return}const i=e.map((s,o)=>`${n.namePrefix}-${++He}-${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=Ke;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@
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-dAReTOgq.js";
11
+ import { n as L, s as w, g as H, c as m } from "./jsx-dev-runtime-dAReTOgq.js";
12
12
  import { F as $e } from "./jsx-dev-runtime-dAReTOgq.js";
13
13
  var R = Symbol.for("preact-signals");
14
14
  function T() {
@@ -19,7 +19,7 @@ function T() {
19
19
  var i = S;
20
20
  for (S = void 0, A++; i !== void 0; ) {
21
21
  var n = i.o;
22
- if (i.o = void 0, i.f &= -3, !(8 & i.f) && H(i)) try {
22
+ if (i.o = void 0, i.f &= -3, !(8 & i.f) && G(i)) try {
23
23
  i.c();
24
24
  } catch (r) {
25
25
  e || (t = r, e = !0);
@@ -40,7 +40,7 @@ function Ce(t) {
40
40
  }
41
41
  }
42
42
  var c = void 0;
43
- function K(t) {
43
+ function I(t) {
44
44
  var e = c;
45
45
  c = void 0;
46
46
  try {
@@ -50,7 +50,7 @@ function K(t) {
50
50
  }
51
51
  }
52
52
  var S = void 0, p = 0, A = 0, E = 0;
53
- function G(t) {
53
+ function K(t) {
54
54
  if (c !== void 0) {
55
55
  var e = t.n;
56
56
  if (e === void 0 || e.t !== c)
@@ -68,7 +68,7 @@ u.prototype.h = function() {
68
68
  };
69
69
  u.prototype.S = function(t) {
70
70
  var e = this, i = this.t;
71
- i !== t && t.e === void 0 && (t.x = i, this.t = t, i !== void 0 ? i.e = t : K(function() {
71
+ i !== t && t.e === void 0 && (t.x = i, this.t = t, i !== void 0 ? i.e = t : I(function() {
72
72
  var n;
73
73
  (n = e.W) == null || n.call(e);
74
74
  }));
@@ -77,7 +77,7 @@ u.prototype.U = function(t) {
77
77
  var e = this;
78
78
  if (this.t !== void 0) {
79
79
  var i = t.e, n = t.x;
80
- i !== void 0 && (i.x = n, t.e = void 0), n !== void 0 && (n.e = i, t.x = void 0), t === this.t && (this.t = n, n === void 0 && K(function() {
80
+ i !== void 0 && (i.x = n, t.e = void 0), n !== void 0 && (n.e = i, t.x = void 0), t === this.t && (this.t = n, n === void 0 && I(function() {
81
81
  var r;
82
82
  (r = e.Z) == null || r.call(e);
83
83
  }));
@@ -85,7 +85,7 @@ u.prototype.U = function(t) {
85
85
  };
86
86
  u.prototype.subscribe = function(t) {
87
87
  var e = this;
88
- return g(function() {
88
+ return v(function() {
89
89
  var i = e.value, n = c;
90
90
  c = void 0;
91
91
  try {
@@ -114,7 +114,7 @@ u.prototype.peek = function() {
114
114
  }
115
115
  };
116
116
  Object.defineProperty(u.prototype, "value", { get: function() {
117
- var t = G(this);
117
+ var t = K(this);
118
118
  return t !== void 0 && (t.i = this.i), this.v;
119
119
  }, set: function(t) {
120
120
  if (t !== this.v) {
@@ -130,7 +130,7 @@ Object.defineProperty(u.prototype, "value", { get: function() {
130
130
  function we(t, e) {
131
131
  return new u(t, e);
132
132
  }
133
- function H(t) {
133
+ function G(t) {
134
134
  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;
135
135
  return !1;
136
136
  }
@@ -157,7 +157,7 @@ y.prototype = new u();
157
157
  y.prototype.h = function() {
158
158
  if (this.f &= -3, 1 & this.f) return !1;
159
159
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === E)) return !0;
160
- if (this.g = E, this.f |= 1, this.i > 0 && !H(this))
160
+ if (this.g = E, this.f |= 1, this.i > 0 && !G(this))
161
161
  return this.f &= -2, !0;
162
162
  var t = c;
163
163
  try {
@@ -190,7 +190,7 @@ y.prototype.N = function() {
190
190
  };
191
191
  Object.defineProperty(y.prototype, "value", { get: function() {
192
192
  if (1 & this.f) throw new Error("Cycle detected");
193
- var t = G(this);
193
+ var t = K(this);
194
194
  if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
195
195
  return this.v;
196
196
  } });
@@ -220,10 +220,10 @@ function q(t) {
220
220
  if (c !== this) throw new Error("Out-of-order effect");
221
221
  j(this), c = t, this.f &= -2, 8 & this.f && x(this), T();
222
222
  }
223
- function v(t, e) {
223
+ function g(t, e) {
224
224
  this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e?.name;
225
225
  }
226
- v.prototype.c = function() {
226
+ g.prototype.c = function() {
227
227
  var t = this.S();
228
228
  try {
229
229
  if (8 & this.f || this.x === void 0) return;
@@ -233,23 +233,23 @@ v.prototype.c = function() {
233
233
  t();
234
234
  }
235
235
  };
236
- v.prototype.S = function() {
236
+ g.prototype.S = function() {
237
237
  if (1 & this.f) throw new Error("Cycle detected");
238
238
  this.f |= 1, this.f &= -9, Y(this), X(this), p++;
239
239
  var t = c;
240
240
  return c = this, q.bind(this, t);
241
241
  };
242
- v.prototype.N = function() {
242
+ g.prototype.N = function() {
243
243
  2 & this.f || (this.f |= 2, this.o = S, S = this);
244
244
  };
245
- v.prototype.d = function() {
245
+ g.prototype.d = function() {
246
246
  this.f |= 8, 1 & this.f || x(this);
247
247
  };
248
- v.prototype.dispose = function() {
248
+ g.prototype.dispose = function() {
249
249
  this.d();
250
250
  };
251
- function g(t, e) {
252
- var i = new v(t, e);
251
+ function v(t, e) {
252
+ var i = new g(t, e);
253
253
  try {
254
254
  i.c();
255
255
  } catch (r) {
@@ -273,9 +273,9 @@ function xe(t) {
273
273
  function Z(t, e, i = !1) {
274
274
  const n = [];
275
275
  for (const [r, s] of Object.entries(e))
276
- if (s != null && !(r === "children" || r === "key" || r === "autoanimate")) {
276
+ if (s != null && !(r === "children" || r === "key" || r === "autoanimate" || r === "innerHTML")) {
277
277
  if (typeof s == "function" && r !== "ref" && !r.startsWith("on") && r !== "viewTransitionName") {
278
- const o = g(() => {
278
+ const o = v(() => {
279
279
  const a = s();
280
280
  D(t, r, a, i);
281
281
  });
@@ -523,7 +523,7 @@ function B(t, e, i = null, n = !1) {
523
523
  o._parent = i, i && i._renderedChildren.push(o);
524
524
  const a = document.createComment("reactive");
525
525
  t.appendChild(a), o._placeholder = a;
526
- const l = g(() => {
526
+ const l = v(() => {
527
527
  const d = s();
528
528
  if (Array.isArray(d))
529
529
  te(o, d);
@@ -549,7 +549,7 @@ function W(t, e = !1) {
549
549
  if (t._dom)
550
550
  return t._dom;
551
551
  const i = e || t.type === "svg", n = i ? document.createElementNS(ae, t.type) : document.createElement(t.type), r = Z(n, t.props, i);
552
- return t._onUnmountCallbacks.push(r), t.props.children && B(n, t.props.children, t, i), t._dom = n, t._lifecycleState = "mounted", t._onMountCallbacks.length > 0 && t._onMountCallbacks.forEach((s) => s()), n;
552
+ return t._onUnmountCallbacks.push(r), t.props.innerHTML !== void 0 ? n.innerHTML = t.props.innerHTML : t.props.children && B(n, t.props.children, t, i), t._dom = n, t._lifecycleState = "mounted", t._onMountCallbacks.length > 0 && t._onMountCallbacks.forEach((s) => s()), n;
553
553
  }
554
554
  function _(t, e = !1) {
555
555
  if ("type" in t && t.type === "reactive")
@@ -628,7 +628,7 @@ function fe(t, e, i = !1, n) {
628
628
  }
629
629
  if (typeof o == "function" && s !== "ref" && s !== "viewTransitionName") {
630
630
  n && console.log(`→ Reactive prop: ${s}`);
631
- const a = g(() => {
631
+ const a = v(() => {
632
632
  const l = o();
633
633
  ue(t, s, l, i);
634
634
  });
@@ -673,7 +673,7 @@ function he(t, e, i, n) {
673
673
  r._currentDom
674
674
  ), r._placeholder = a;
675
675
  let l = !0;
676
- const d = g(() => {
676
+ const d = v(() => {
677
677
  const f = t();
678
678
  if (l) {
679
679
  l = !1;
@@ -759,7 +759,7 @@ function me(t, e) {
759
759
  b(a, e), t._currentChild = a, t._currentDom = a._dom ?? a._element;
760
760
  } else (typeof i == "string" || typeof i == "number" || typeof i == "boolean") && (t._currentDom = n), e.walker.nextSibling();
761
761
  let s = !0;
762
- const o = g(() => {
762
+ const o = v(() => {
763
763
  const a = t.fn();
764
764
  if (s) {
765
765
  s = !1, e.debug && console.log("→ Reactive effect setup (skipping initial)");
@@ -832,7 +832,7 @@ function De(t) {
832
832
  _defaultValue: t,
833
833
  provide(i) {
834
834
  if (typeof document > "u") return;
835
- const n = I();
835
+ const n = H();
836
836
  if (!n)
837
837
  throw new Error("context.provide() called outside of component render");
838
838
  n._contextMap || (n._contextMap = /* @__PURE__ */ new Map()), n._contextMap.set(e, i);
@@ -841,7 +841,7 @@ function De(t) {
841
841
  }
842
842
  function Fe(t) {
843
843
  if (typeof document > "u") return t._defaultValue;
844
- const e = I();
844
+ const e = H();
845
845
  if (!e)
846
846
  throw new Error("useContext called outside of component render");
847
847
  let i = e;
@@ -859,7 +859,7 @@ function Le(t) {
859
859
  m._onMountCallbacks.push(t);
860
860
  }
861
861
  }
862
- function Ie(t) {
862
+ function He(t) {
863
863
  if (!(typeof document > "u")) {
864
864
  if (m === null)
865
865
  throw new Error(
@@ -868,7 +868,7 @@ function Ie(t) {
868
868
  m._onUnmountCallbacks.push(t);
869
869
  }
870
870
  }
871
- function Ke(t) {
871
+ function Ie(t) {
872
872
  if (!(typeof document > "u")) {
873
873
  if (m === null)
874
874
  throw new Error(
@@ -877,7 +877,7 @@ function Ke(t) {
877
877
  m._onBeforeExitCallbacks.push(t);
878
878
  }
879
879
  }
880
- function Ge(t) {
880
+ function Ke(t) {
881
881
  if (!(typeof document > "u"))
882
882
  try {
883
883
  t();
@@ -885,7 +885,7 @@ function Ge(t) {
885
885
  console.error(e);
886
886
  }
887
887
  }
888
- class He {
888
+ class Ge {
889
889
  // One-time callbacks
890
890
  readCallbacks = /* @__PURE__ */ new Set();
891
891
  updateCallbacks = /* @__PURE__ */ new Set();
@@ -1066,7 +1066,7 @@ class He {
1066
1066
  return e === this.readKeepAlive || e === this.updateKeepAlive || e === this.renderKeepAlive;
1067
1067
  }
1068
1068
  }
1069
- class ve {
1069
+ class ge {
1070
1070
  gestureId = 0;
1071
1071
  activeGestures = /* @__PURE__ */ new Map();
1072
1072
  disabledGestures = /* @__PURE__ */ new Map();
@@ -1138,7 +1138,7 @@ class ve {
1138
1138
  return new _e(this, n, e, r, s, i);
1139
1139
  }
1140
1140
  }
1141
- const ge = new ve();
1141
+ const ve = new ge();
1142
1142
  class _e {
1143
1143
  // Private members
1144
1144
  el;
@@ -1276,7 +1276,7 @@ class _e {
1276
1276
  }
1277
1277
  }
1278
1278
  function Xe(t, e) {
1279
- return ge.createGesture(t, e);
1279
+ return ve.createGesture(t, e);
1280
1280
  }
1281
1281
  function je(t) {
1282
1282
  typeof document > "u" || (document.startViewTransition ? document.startViewTransition(t) : t());
@@ -1308,22 +1308,22 @@ function Ye(t, e = [], i = {
1308
1308
  }
1309
1309
  export {
1310
1310
  y as Computed,
1311
- v as Effect,
1311
+ g as Effect,
1312
1312
  $e as Fragment,
1313
- He as FrameScheduler,
1313
+ Ge as FrameScheduler,
1314
1314
  u as Signal,
1315
1315
  Ce as batch,
1316
1316
  Ee as computed,
1317
1317
  De as createContext,
1318
1318
  Xe as createGesture,
1319
- g as effect,
1319
+ v as effect,
1320
1320
  Ne as get,
1321
1321
  Oe as hydrate,
1322
1322
  xe as link,
1323
- Ke as onBeforeExit,
1324
- Ge as onLoad,
1323
+ Ie as onBeforeExit,
1324
+ Ke as onLoad,
1325
1325
  Le as onMount,
1326
- Ie as onUnmount,
1326
+ He as onUnmount,
1327
1327
  Te as peek,
1328
1328
  Me as render,
1329
1329
  Ae as set,
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 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>
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs/promises"),m=require("node:path");function A(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function b(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 H(t){return Object.entries(t).map(([r,o])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${o}`).join(";")}function j(t,r=!0){const o=Object.entries(t).filter(([e,n])=>!(n==null||r&&e==="children"||e==="innerHTML"||E(e))).map(([e,n])=>(e==="className"&&(e="class"),e==="style"&&typeof n=="object"&&(n=H(n)),typeof n=="boolean"?n?e:"":`${e}="${b(String(n))}"`)).filter(Boolean).join(" ");return o?` ${o}`:""}function $(t){return t?Array.isArray(t)?t:[t]:[]}function w(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 D(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-${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
- <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;
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 A(t);if(typeof t=="number")return String(t);if(Array.isArray(t))return t.map(e=>s(e)).join("");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(w(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=j(o);if(v.has(r))return`<${r}${e} />`;if(o.innerHTML!==void 0)return`<${r}${e}>${o.innerHTML}</${r}>`;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
+ <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=D;exports.renderToStringAsync=T;
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- import { mkdir as h, rm as A } from "node:fs/promises";
11
+ import { mkdir as h, rm as S } from "node:fs/promises";
12
12
  import { dirname as b, join as y } from "node:path";
13
13
  function v(t) {
14
14
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
@@ -16,7 +16,7 @@ function v(t) {
16
16
  function E(t) {
17
17
  return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
18
18
  }
19
- const w = /* @__PURE__ */ new Set([
19
+ const H = /* @__PURE__ */ new Set([
20
20
  "area",
21
21
  "base",
22
22
  "br",
@@ -31,20 +31,20 @@ const w = /* @__PURE__ */ new Set([
31
31
  "track",
32
32
  "wbr"
33
33
  ]);
34
- function D(t) {
34
+ function w(t) {
35
35
  return /^on[A-Z]/.test(t);
36
36
  }
37
- function H(t) {
37
+ function D(t) {
38
38
  return Object.entries(t).map(([r, o]) => `${r.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`)}:${o}`).join(";");
39
39
  }
40
40
  function j(t, r = !0) {
41
- const o = Object.entries(t).filter(([e, n]) => !(n == null || r && e === "children" || D(e))).map(([e, n]) => (e === "className" && (e = "class"), e === "style" && typeof n == "object" && (n = H(n)), typeof n == "boolean" ? n ? e : "" : `${e}="${E(String(n))}"`)).filter(Boolean).join(" ");
41
+ const o = Object.entries(t).filter(([e, n]) => !(n == null || r && e === "children" || e === "innerHTML" || w(e))).map(([e, n]) => (e === "className" && (e = "class"), e === "style" && typeof n == "object" && (n = D(n)), typeof n == "boolean" ? n ? e : "" : `${e}="${E(String(n))}"`)).filter(Boolean).join(" ");
42
42
  return o ? ` ${o}` : "";
43
43
  }
44
44
  function $(t) {
45
45
  return t ? Array.isArray(t) ? t : [t] : [];
46
46
  }
47
- function P(t) {
47
+ function T(t) {
48
48
  return t && typeof t.then == "function";
49
49
  }
50
50
  function g(t, r) {
@@ -52,10 +52,10 @@ function g(t, r) {
52
52
  }
53
53
  const a = /* @__PURE__ */ new Map();
54
54
  let d = 0;
55
- function N(t) {
55
+ function C(t) {
56
56
  return a.clear(), d = 0, s(t);
57
57
  }
58
- async function T(t) {
58
+ async function L(t) {
59
59
  a.clear(), d = 0;
60
60
  let r = s(t);
61
61
  for (; a.size > 0; ) {
@@ -80,10 +80,10 @@ async function T(t) {
80
80
  r = r.replace(m, f);
81
81
  } catch (f) {
82
82
  console.error(`❌ Error rendering ${c}:`, f);
83
- const S = u ? s(
83
+ const A = u ? s(
84
84
  typeof u == "function" ? u(f) : u
85
85
  ) : `<div class="error">Error rendering ${c}</div>`;
86
- r = r.replace(m, S);
86
+ r = r.replace(m, A);
87
87
  }
88
88
  else {
89
89
  console.error(`❌ Error resolving ${c}:`, p.reason);
@@ -96,7 +96,7 @@ async function T(t) {
96
96
  }
97
97
  return console.log("✅ All async components resolved!"), r;
98
98
  }
99
- async function* F(t) {
99
+ async function* N(t) {
100
100
  for (a.clear(), d = 0, yield s(t); a.size > 0; ) {
101
101
  const o = Array.from(a.entries());
102
102
  a.clear();
@@ -137,6 +137,8 @@ function s(t) {
137
137
  return v(t);
138
138
  if (typeof t == "number")
139
139
  return String(t);
140
+ if (Array.isArray(t))
141
+ return t.map((e) => s(e)).join("");
140
142
  if (!t || typeof t != "object")
141
143
  return "";
142
144
  const { type: r, props: o } = t;
@@ -156,7 +158,7 @@ function s(t) {
156
158
  }
157
159
  if (typeof r == "function") {
158
160
  const e = r(o);
159
- if (P(e)) {
161
+ if (T(e)) {
160
162
  const n = `async-${d++}`, i = r.name || "AsyncComponent";
161
163
  return console.warn(
162
164
  `⚠️ DEPRECATED: Direct async component "${i}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
@@ -171,8 +173,10 @@ Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);
171
173
  }
172
174
  if (typeof r == "string") {
173
175
  const e = j(o);
174
- if (w.has(r))
176
+ if (H.has(r))
175
177
  return `<${r}${e} />`;
178
+ if (o.innerHTML !== void 0)
179
+ return `<${r}${e}>${o.innerHTML}</${r}>`;
176
180
  const i = $(o.children).map((l) => {
177
181
  if (Array.isArray(l))
178
182
  return l.map((c) => s(c)).join("");
@@ -187,7 +191,7 @@ Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);
187
191
  }
188
192
  return "";
189
193
  }
190
- class z {
194
+ class F {
191
195
  cacheDir;
192
196
  useDirectoryStructure;
193
197
  constructor(r = {}) {
@@ -202,7 +206,7 @@ class z {
202
206
  return await e.exists() ? e : null;
203
207
  }
204
208
  async clear() {
205
- await A(this.cacheDir, { recursive: !0, force: !0 }), await h(this.cacheDir, { recursive: !0 }), console.log("🗑️ Cache cleared");
209
+ await S(this.cacheDir, { recursive: !0, force: !0 }), await h(this.cacheDir, { recursive: !0 }), console.log("🗑️ Cache cleared");
206
210
  }
207
211
  async exists(r) {
208
212
  const o = this.getFilepath(r);
@@ -219,8 +223,8 @@ class z {
219
223
  }
220
224
  }
221
225
  export {
222
- z as PreRenderer,
223
- F as renderToStream,
224
- N as renderToString,
225
- T as renderToStringAsync
226
+ F as PreRenderer,
227
+ N as renderToStream,
228
+ C as renderToString,
229
+ L as renderToStringAsync
226
230
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mateosuarezdev/flash",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Custom jsx runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",