@askrjs/askr 0.0.17 → 0.0.18

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.
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-HGMOQ3I7.js';import {b}from'./chunk-37RC6ZT3.js';function _e(e,n,t){if(!e){let r=t?`
2
+ `+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function Me(e,n){_e(e,`[Scheduler Precondition] ${n}`);}function oe(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var Ee=class{constructor(){this.q=[];this.head=0;this.running=false;this.inHandler=false;this.depth=0;this.executionDepth=0;this.flushVersion=0;this.kickScheduled=false;this.allowSyncProgress=false;this.waiters=[];this.taskCount=0;}enqueue(n){Me(typeof n=="function","enqueue() requires a function"),!(oe()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!oe()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!oe())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){_e(!this.running,"[Scheduler] flush() called while already running"),this.running=true,this.depth=0;let n=null;try{for(;this.head<this.q.length;){this.depth++;let t=this.q[this.head++];try{this.executionDepth++,t(),this.executionDepth--;}catch(r){this.executionDepth>0&&(this.executionDepth=0),n=r;break}this.taskCount>0&&this.taskCount--;}}finally{if(this.running=false,this.depth=0,this.executionDepth=0,this.head>=this.q.length)this.q.length=0,this.head=0;else if(this.head>0){let t=this.q.length-this.head;for(let r=0;r<t;r++)this.q[r]=this.q[this.head+r];this.q.length=t,this.head=0;}this.flushVersion++,this.resolveWaiters();}if(n)throw n}runWithSyncProgress(n){let t=this.allowSyncProgress;this.allowSyncProgress=true;let i=this.flushVersion;try{let a=n();return !this.running&&this.q.length-this.head>0&&this.flush(),a}finally{try{this.flushVersion===i&&(this.flushVersion++,this.resolveWaiters());}catch(a){}this.allowSyncProgress=t;}}waitForFlush(n,t=2e3){let r=typeof n=="number"?n:this.flushVersion+1;return this.flushVersion>=r?Promise.resolve():new Promise((o,s)=>{let i=setTimeout(()=>{let a=globalThis.__ASKR__||{},c={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:oe(),namespace:a};s(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(c)}`));},t);this.waiters.push({target:r,resolve:o,reject:s,timer:i});})}getState(){return {queueLength:this.q.length-this.head,running:this.running,depth:this.depth,executionDepth:this.executionDepth,taskCount:this.taskCount,flushVersion:this.flushVersion,inHandler:this.inHandler,allowSyncProgress:this.allowSyncProgress}}setInHandler(n){this.inHandler=n;}isInHandler(){return this.inHandler}isExecuting(){return this.running||this.executionDepth>0}clearPendingSyncTasks(){let n=this.q.length-this.head;return n<=0?0:this.running?(this.q.length=this.head,this.taskCount=Math.max(0,this.taskCount-n),queueMicrotask(()=>{try{this.flushVersion++,this.resolveWaiters();}catch(t){}}),n):(this.q.length=0,this.head=0,this.taskCount=Math.max(0,this.taskCount-n),this.flushVersion++,this.resolveWaiters(),n)}resolveWaiters(){if(this.waiters.length===0)return;let n=[],t=[];for(let r of this.waiters)this.flushVersion>=r.target?(r.timer&&clearTimeout(r.timer),n.push(r.resolve)):t.push(r);this.waiters=t;for(let r of n)r();}},C=new Ee;function Ie(){return C.isExecuting()}var Pe=Symbol("__tempoContextFrame__"),se=null;function z(e,n){let t=se;se=e;try{return n()}finally{se=t;}}function Ot(e,n){try{return n()}finally{}}function De(){return se}function Oe(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function T(e,n){try{let t=Oe();t[e]=n;try{let r=globalThis;try{let o=r.__ASKR__||(r.__ASKR__={});try{o[e]=n;}catch(s){}}catch(o){}}catch(r){}}catch(t){}}function R(e){try{let n=Oe(),r=(typeof n[e]=="number"?n[e]:0)+1;n[e]=r;try{let o=globalThis,s=o.__ASKR__||(o.__ASKR__={});try{let i=typeof s[e]=="number"?s[e]:0;s[e]=i+1;}catch(i){}}catch(o){}}catch(n){}}function J(e){return !e.startsWith("on")||e.length<=2?null:e.slice(2).charAt(0).toLowerCase()+e.slice(3).toLowerCase()}function Y(e){if(e==="wheel"||e==="scroll"||e.startsWith("touch"))return {passive:true}}function Q(e,n=false){return t=>{C.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(C.setInHandler(false),n){let r=C.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{C.isExecuting()||C.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function ke(e){return e==="children"||e==="key"||e==="ref"}function ie(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function Ae(e,n,t){try{if(n==="class"||n==="className")return e.className!==String(t);if(n==="value"||n==="checked")return e[n]!==t;let r=e.getAttribute(n);return t==null||t===!1?r!==null:String(t)!==r}catch{return true}}function Ke(e){for(let n of Object.keys(e))if(!ie(n))return true;return false}function Le(e,n){for(let t of Object.keys(n))if(!ie(t)&&Ae(e,t,n[t]))return true;return false}function L(e){if(typeof e!="object"||e===null)return;let n=e,t=n.key??n.props?.key;if(t!==void 0)return typeof t=="symbol"?String(t):t}function Ve(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function ae(e){try{R("__DOM_REPLACE_COUNT"),T(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function ce(e,n){try{T("__LAST_FASTPATH_STATS",e),T("__LAST_FASTPATH_COMMIT_COUNT",1),n&&R(n);}catch{}}function ue(e,n,t){(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&(t!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n,t):n!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n):a.warn(`[Askr][FASTPATH] ${e}`));}function Z(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}var S=new WeakMap;function le(e){return S.get(e)}function He(e){try{if(S.has(e))return;let n=Ve(e);if(n.size===0){n=new Map;let t=Array.from(e.children);for(let r of t){let o=(r.textContent||"").trim();if(o){n.set(o,r);let s=Number(o);Number.isNaN(s)||n.set(s,r);}}}n.size>0&&S.set(e,n);}catch{}}var Ue=new WeakSet;function Sn(e){let n=[];for(let t of e){let r=L(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function kn(e){let n=[];for(let t of e){if(t===-1)continue;let r=0,o=n.length;for(;r<o;){let s=r+o>>1;n[s]<t?r=s+1:o=s;}r===n.length?n.push(t):n[r]=t;}return n.length}function An(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&Ke(t.props))return true}return false}function bn(e,n){for(let{key:t,vnode:r}of e){let o=n?.get(t);if(!o||typeof r!="object"||r===null)continue;let i=r.props||{};for(let a of Object.keys(i))if(!ie(a)&&Ae(o,a,i[a]))return true}return false}function j(e,n,t){let r=Sn(n),o=r.length,s=r.map(h=>h.key),i=t?Array.from(t.keys()):[],a=0;for(let h=0;h<s.length;h++){let b=s[h];(h>=i.length||i[h]!==b||!t?.has(b))&&a++;}let f=o>=128&&i.length>0&&a>Math.max(64,Math.floor(o*.1)),l=false,d=0;if(o>=128){let h=Array.from(e.children),b=r.map(({key:M})=>{let K=t?.get(M);return K?.parentElement===e?h.indexOf(K):-1});d=kn(b),l=d<Math.floor(o*.5);}let m=An(r),g=bn(r,t);return {useFastPath:(f||l)&&!g&&!m,totalKeyed:o,moveCount:a,lisLen:d,hasPropChanges:g}}var be=false,$=null;function Be(){be=true,$=new WeakSet;try{let e=C.clearPendingSyncTasks?.()??0;}catch{}}function qe(){be=false,$=null;}function ee(){return be}function Te(e){if($)try{$.add(e);}catch(n){}}function Tn(e){return !!($&&$.has(e))}function Cn(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function vn(e){if(!e||typeof e!="object"||!("type"in e))return e;let n=e;if(typeof n.type=="symbol"&&(n.type===b||String(n.type)==="Symbol(askr.fragment)")){let t=n.children||n.props?.children;if(Array.isArray(t)&&t.length>0){for(let r of t)if(r&&typeof r=="object"&&"type"in r&&typeof r.type=="string")return r}}return e}function Nn(e,n){let t=vn(n);if(!t||typeof t!="object"||!("type"in t))return {useFastPath:false,reason:"not-vnode"};let r=t;if(r==null||typeof r.type!="string")return {useFastPath:false,reason:"not-intrinsic"};let o=e.target;if(!o)return {useFastPath:false,reason:"no-root"};let s=o.children[0];if(!s)return {useFastPath:false,reason:"no-first-child"};if(s.tagName.toLowerCase()!==String(r.type).toLowerCase())return {useFastPath:false,reason:"root-tag-mismatch"};let i=r.children||r.props?.children;if(!Array.isArray(i))return {useFastPath:false,reason:"no-children-array"};for(let u of i)if(typeof u=="object"&&u!==null&&"type"in u&&typeof u.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{He(s);}catch{}let a=le(s),c=j(s,i,a);return !c.useFastPath||c.totalKeyed<128?{...c,useFastPath:false,reason:"renderer-declined"}:{...c,useFastPath:true}}function Rn(e,n){let t=globalThis.__ASKR_RENDERER?.evaluate;if(typeof t!="function")return a.warn("[Tempo][FASTPATH][DEV] renderer.evaluate not available; declining fast-lane"),false;Be();try{C.runWithSyncProgress(()=>{t(n,e.target);try{Cn(e);}catch{}});let o=C.clearPendingSyncTasks?.()??0;return !0}finally{qe();}}function wn(e,n){if(!Nn(e,n).useFastPath)return false;try{return Rn(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:ee,enterBulkCommit:Be,exitBulkCommit:qe,tryRuntimeFastLaneSync:wn,markFastPathApplied:Te,isFastPathApplied:Tn});var V=Symbol("__FOR_BOUNDARY__");function k(e){return typeof e=="object"&&e!==null&&"type"in e}function je(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{Xe(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Ge(e,n){try{let r=e.ownerDocument,o=r?.createTreeWalker;if(typeof o=="function"){let s=o.call(r,e,1),i=s.firstChild();for(;i;)n(i),i=s.nextNode();return}}catch{}let t=e.querySelectorAll("*");for(let r=0;r<t.length;r++)n(t[r]);}function w(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{je(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Ge(e,o=>{try{je(o,r,t);}catch(s){t?r.push(s):a.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",s);}});}catch(o){a.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",o);}}function Ce(e,n){w(e);}var N=new WeakMap,D=new WeakMap;function $e(e){let n=D.get(e);if(n){for(let t of n.values())try{t.cleanup();}catch(r){a.warn("[Askr] reactive prop cleanup failed:",r);}D.delete(e);}}function We(e){let n=N.get(e);if(n){for(let[t,r]of n)r.options!==void 0?e.removeEventListener(t,r.handler,r.options):e.removeEventListener(t,r.handler);N.delete(e);}}function I(e){e&&(We(e),$e(e),Ge(e,n=>{We(n),$e(n);}));}var A=globalThis;function fe(e,n){}var Fn=(e,n)=>e!=null&&typeof e=="object"&&"id"in e?e.id:n;function rr(e,n,t){let r=typeof e=="function"?null:e,o=H();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||Fn,renderFn:n,parentInstance:o,mounted:false}}var ze=1;function Je(e,n,t,r){let o=t,s=Object.assign(()=>o,{set(d){let m=typeof d=="function"?d(o):d;m!==o&&(o=m);}}),i=()=>null,a=me(`for-item-${e}`,i,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let c=H();O(a);let u=Ye();a._currentRenderToken=ze++,a._pendingReadStates=new Set;let f=r.renderFn(n,()=>s());U(a),O(c);let l={key:e,item:n,indexSignal:s,componentInstance:a,vnode:f,_startStateIndex:u};return a._pendingFlushTask=()=>{let d=H();O(a),a.stateIndexCheck=-1;let m=a.stateValues;for(let p=0;p<m.length;p++){let h=m[p];h&&(h._hasBeenRead=false);}Qe(u),a._currentRenderToken=ze++,a._pendingReadStates=new Set;try{let p=r.renderFn(n,()=>s());l.vnode=p,U(a);}finally{O(d);}let g=r.parentInstance;g&&g._enqueueRun?.();},l}function Mn(e,n){let t=A.__ASKR_BENCH__?performance.now():0,{items:r,orderedKeys:o,byFn:s}=e,i=o.length,a=n.length;if(i<=a){let l=true;for(let d=0;d<i;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let m=0;m<i;m++){let g=n[m],p=o[m],h=r.get(p);let b=h.item!==g,M=h.indexSignal()!==m;if(b){h.item=g;let K=A.__ASKR_CURRENT_INSTANCE__;A.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),A.__ASKR_CURRENT_INSTANCE__=K;}M&&h.indexSignal.set(m),d.push(h.vnode);}for(let m=i;m<a;m++){let g=n[m],p=s(g,m),h=Je(p,g,m,e);r.set(p,h),d.push(h.vnode),o[m]=p;}return A.__ASKR_BENCH__&&fe("reconcile",performance.now()-t),d}}if(a<=i){let l=true;for(let d=0;d<a;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let m=0;m<a;m++){let g=n[m],p=o[m],h=r.get(p);let b=h.item!==g,M=h.indexSignal()!==m;if(b){h.item=g;let K=A.__ASKR_CURRENT_INSTANCE__;A.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),A.__ASKR_CURRENT_INSTANCE__=K;}M&&h.indexSignal.set(m),d.push(h.vnode);}for(let m=a;m<i;m++){let g=o[m],p=r.get(g);if(p){let h=p.componentInstance;h.abortController.abort();for(let b of h.cleanupFns)try{b();}catch{}r.delete(g);}}return o.length=a,e.orderedKeys=o,A.__ASKR_BENCH__&&fe("reconcile",performance.now()-t),d}}if(i===a){let l=true;for(let d=0;d<i;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let m=0;m<i;m++){let g=n[m],p=o[m],h=r.get(p);let b=h.item!==g,M=h.indexSignal()!==m;if(b){h.item=g;let K=A.__ASKR_CURRENT_INSTANCE__;A.__ASKR_CURRENT_INSTANCE__=h.componentInstance;let En=e.renderFn(g,()=>h.indexSignal());h.vnode=En,A.__ASKR_CURRENT_INSTANCE__=K;}M&&h.indexSignal.set(m),d.push(h.vnode);}return A.__ASKR_BENCH__&&fe("reconcile",performance.now()-t),d}}let c=new Set(o),u=[],f=[];for(let l=0;l<n.length;l++){let d=n[l],m=s(d,l);c.delete(m),u.push(m);let g=r.get(m);if(g){let p=g.item!==d,h=g.indexSignal()!==l;if(p){g.item=d;let b=A.__ASKR_CURRENT_INSTANCE__;A.__ASKR_CURRENT_INSTANCE__=g.componentInstance,g.vnode=e.renderFn(d,()=>g.indexSignal()),A.__ASKR_CURRENT_INSTANCE__=b;}h&&g.indexSignal.set(l),f.push(g.vnode);}else {let p=Je(m,d,l,e);r.set(m,p),f.push(p.vnode);}}for(let l of c){let d=r.get(l);if(d){let m=d.componentInstance;m.abortController.abort();for(let g of m.cleanupFns)try{g();}catch{}r.delete(l);}}return e.orderedKeys=u,A.__ASKR_BENCH__&&fe("reconcile",performance.now()-t),f}function ne(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return Mn(e,t)}function Ze(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;Ie()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let s,i;if(o<=20)try{let l=e.children;s=new Array(l.length);for(let d=0;d<l.length;d++)s[d]=l[d];}catch(l){s=void 0;}else {i=new Map;try{for(let l=e.firstElementChild;l;l=l.nextElementSibling){let d=l.getAttribute("data-key");if(d!==null){i.set(d,l);let m=Number(d);Number.isNaN(m)||i.set(m,l);}}}catch(l){i=void 0;}}let a$1=[],c=0,u=0,f=0;for(let l=0;l<n.length;l++){let{key:d,vnode:m}=n[l];c++;let g;if(o<=20&&s){let p=String(d);for(let h=0;h<s.length;h++){let b=s[h],M=b.getAttribute("data-key");if(M!==null&&(M===p||Number(M)===d)){g=b;break}}g||(g=t?.get(d));}else g=i?.get(d)??t?.get(d);if(g)a$1.push(g),f++;else {let p=_(m);p&&(a$1.push(p),u++);}}if(r&&r.length)for(let l of r){let d=_(l);d&&(a$1.push(d),u++);}try{let l=Date.now(),d=document.createDocumentFragment(),m=0;for(let p=0;p<a$1.length;p++)d.appendChild(a$1[p]),m++;try{for(let p=e.firstChild;p;){let h=p.nextSibling;p instanceof Element&&I(p),w(p),p=h;}}catch(p){}try{R("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(p){}e.replaceChildren(d);try{T("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(p){}try{ee()&&Te(e);}catch(p){}let g=new Map;for(let p=0;p<n.length;p++){let h=n[p].key,b=a$1[p];b instanceof Element&&g.set(h,b);}try{let p={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-l,t_commit:0,t_bookkeeping:0,fragmentAppendCount:m,mapLookups:c,createdNodes:u,reusedCount:f};typeof globalThis<"u"&&(T("__LAST_FASTPATH_STATS",p),T("__LAST_FASTPATH_REUSED",f>0),R("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:u,reusedCount:f}));}catch(p){}try{Ue.add(e);}catch(p){}return g}catch(l){return null}}function pe(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function B(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=Pn(n),s=t||In(e),i=Dn(e,n,r,o,s);return i||Un(e,n,r,s)}function In(e){let n=new Map;try{for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}}catch{}return n}function Pn(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],s=L(o);s!==void 0?n.push({key:s,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Dn(e,n,t,r,o){try{let s=On(e,n,t,r,o);if(s)return s;let i=Kn(e,t);if(i)return i}catch{}return null}function On(e,n,t,r,o){if(j(e,n,o).useFastPath&&t.length>=128||ee())try{let i=Ze(e,t,o,r);if(i)return S.set(e,i),i}catch{}return null}function Kn(e,n){let t=n.length;if(t<10||e.children.length!==t)return null;let r=Ln(e,n),o=r/t;if(n.length>0){if(r!==t&&o>=.1)return null}else if(o<.9)return null;if(Vn(e,n))return null;try{let s=he(e,n);return ce(s,"bulkKeyedPositionalHits"),Hn(e),S.get(e)}catch{return null}}function Ln(e,n){let t=0;try{for(let r=0;r<n.length;r++){let o=n[r].vnode,s=n[r].key;if(!o||typeof o!="object"||typeof o.type!="string")continue;let i=e.children[r];if(i&&pe(i.tagName,o.type)){let a=i.getAttribute("data-key");(a===String(s)||a!==null&&!Number.isNaN(Number(a))&&Number(a)===s)&&t++;}}}catch{}return t}function Vn(e,n){try{for(let t=0;t<n.length;t++){let r=n[t].vnode,o=e.children[t];if(!(!o||!r||typeof r!="object")&&Le(o,r.props||{}))return !0}}catch{return true}return false}function Hn(e){try{let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}S.set(e,n);}catch{}}function Un(e,n,t,r){let o=new Map,s=[],i=new WeakSet,a=Bn(e,r,i);for(let c=0;c<n.length;c++){let u=n[c],f=jn(u,c,e,a,i,o);f&&s.push(f);}return typeof document>"u"||(Jn(e,s),S.delete(e)),o}function Bn(e,n,t){return r=>{if(!n)return;let o=n.get(r);if(o&&!t.has(o))return t.add(o),o;let s=String(r),i=n.get(s);if(i&&!t.has(i))return t.add(i),i;let a=Number(s);if(!Number.isNaN(a)){let c=n.get(a);if(c&&!t.has(c))return t.add(c),c}return qn(e,r,s,t)}}function qn(e,n,t,r){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(r.has(o))continue;let s=o.getAttribute("data-key");if(s===t)return r.add(o),o;if(s!==null){let i=Number(s);if(!Number.isNaN(i)&&i===n)return r.add(o),o}}}catch{}}function jn(e,n,t,r,o,s){let i=L(e);return i!==void 0?$n(e,i,t,r,s):Wn(e,n,t,o)}function $n(e,n,t,r,o){let s=r(n);if(s&&s.parentElement===t)try{let a=e;if(a&&typeof a=="object"&&typeof a.type=="string"&&pe(s.tagName,a.type))return P(s,e),o.set(n,s),s}catch{}let i=_(e);return i?(i instanceof Element&&o.set(n,i),i):null}function Wn(e,n,t,r){try{let s=t.childNodes[n];if((typeof e=="string"||typeof e=="number")&&s&&s.nodeType===3)return s.data=String(e),r.add(s),s;if(s instanceof Element&&Gn(s,e))return P(s,e),r.add(s),s;let i=Xn(t,r);if(i){let a=zn(i,e,r);if(a)return a}}catch{}return _(e)}function Gn(e,n){if(!e||typeof n!="object"||n===null||!("type"in n))return false;let t=n,r=e.getAttribute("data-key");return r==null&&typeof t.type=="string"&&pe(e.tagName,t.type)}function Xn(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function zn(e,n,t){if(typeof n=="string"||typeof n=="number")return e.textContent=String(n),t.add(e),e;if(typeof n=="object"&&n!==null&&"type"in n){let r=n;if(typeof r.type=="string"&&pe(e.tagName,r.type))return P(e,n),t.add(e),e}return null}function Jn(e,n){let t=document.createDocumentFragment();for(let r=0;r<n.length;r++)t.appendChild(n[r]);try{for(let r=e.firstChild;r;){let o=r.nextSibling;r instanceof Element&&I(r),w(r),r=o;}}catch{}ae("reconcile"),e.replaceChildren(t);}var Yn=typeof document<"u",en=0;function Qn(){let e="__COMPONENT_INSTANCE_ID";try{R(e);let t=globalThis.__ASKR_DIAG,r=t?t[e]:void 0;if(typeof r=="number"&&Number.isFinite(r))return `comp-${r}`}catch{}return en++,`comp-${en}`}function Zn(e,n,t){let r=Q(t,true),o=Y(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),N.has(e)||N.set(e,new Map),N.get(e).set(n,{handler:r,original:t,options:o});}var re=new Set,v=null,ge=false;function et(){if(!v){v={id:"reactive-props-coordinator",lastRenderToken:0,hasPendingUpdate:false,notifyUpdate:null,abortController:new AbortController};let e=()=>{if(!ge)return;ge=false;let n=H();try{for(let t of re){if(!t.isActive)continue;for(let s of t.readStates)s._readers&&s._readers.delete(v);t.readStates.clear();let r=new Set,o={_pendingReadStates:r,_currentRenderToken:v.lastRenderToken};O(o);try{let s=t.propFn();tn(t.el,t.propName,s,t.tagName),t.readStates=r;}catch{}}v.lastRenderToken++;for(let t of re)if(t.isActive)for(let r of t.readStates)r._readers||(r._readers=new Map),r._readers.set(v,v.lastRenderToken);}finally{O(n);}};v.notifyUpdate=()=>{ge||(ge=true,C.enqueue(e));},v._pendingFlushTask=()=>{v.hasPendingUpdate=false,v.notifyUpdate();};}return v}function nn(e,n,t,r){let o=et(),s={el:e,propName:n,propFn:t,tagName:r,readStates:new Set,isActive:true};re.add(s);let i=H(),a=new Set,c={_pendingReadStates:a,_currentRenderToken:o.lastRenderToken};O(c);try{let u=t();tn(e,n,u,r),s.readStates=a;for(let f of a)f._readers||(f._readers=new Map),f._readers.set(o,o.lastRenderToken);}finally{O(i);}return ()=>{if(s.isActive=false,re.delete(s),v)for(let u of s.readStates)u._readers&&u._readers.delete(v);s.readStates.clear(),re.size===0&&v&&(v.abortController.abort(),v=null);}}function tn(e,n,t,r){if(t==null||t===false){n==="class"||n==="className"?e.className="":e.removeAttribute(n);return}n==="class"||n==="className"?e.className=String(t):n==="value"||n==="checked"?rn(e,n,t,r):e.setAttribute(n,String(t));}function nt(e,n,t){for(let r in n){let o=n[r];if(r==="ref"){tt(e,o);continue}if(ke(r)||o==null||o===false)continue;let s=J(r);if(s){Zn(e,s,o);continue}if(typeof o=="function"&&!s&&r!=="ref"){let i=nn(e,r,o,t);D.has(e)||D.set(e,new Map),D.get(e).set(r,{cleanup:i,fnRef:o});continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?rn(e,r,o,t):e.setAttribute(r,String(o));}}function tt(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function rn(e,n,t,r){n==="value"?((te(r,"input")||te(r,"textarea")||te(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(te(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function on(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function _(e){if(!Yn)return null;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(String(e));if(!e)return null;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e){let r=_(t);r&&n.appendChild(r);}return n}if(typeof e=="object"&&e!==null&&"type"in e){let n=e.type,t=e.props||{};if(typeof n=="string")return rt(e,n,t);if(typeof n=="function")return ot(e,n,t);if(n===V)return at(e,t);if(typeof n=="symbol"&&(n===b||String(n)==="Symbol(Fragment)"))return st(e,t)}return null}function rt(e,n,t){let r=document.createElement(n);on(r,e,t),nt(r,t,n);let o=t.children??e.children;if(o!=null)if(Array.isArray(o)){for(let s of o){let i=_(s);i&&r.appendChild(i);}}else {let s=_(o);s&&r.appendChild(s);}return r}function ot(e,n,t){let o=e[Pe]||De(),s=n;if(s.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let a=e.__instance;a||(a=me(Qn(),s,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let c=z(o,()=>cn(a));if(c instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let u=z(o,()=>_(c));if(u instanceof Element)return Ne(a,u),u;if(!u){let l=document.createComment("");return a._placeholder=l,a.mounted=true,a.notifyUpdate=a._enqueueRun,l}let f=document.createElement("div");return f.appendChild(u),Ne(a,f),f}function st(e,n){let t=document.createDocumentFragment(),r=n.children||e.children;if(r)if(Array.isArray(r))for(let o of r){let s=_(o);s&&t.appendChild(s);}else {let o=_(r);o&&t.appendChild(o);}return t}function it(e,n){if(!k(n)||!(e instanceof Element))return true;let t=n.type;return typeof t!="string"?true:e.tagName.toLowerCase()!==t.toLowerCase()}function at(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=ne(t,r),s=document.createDocumentFragment();for(let i=0;i<o.length;i++){let a=o[i],c=t.orderedKeys[i],u=c!=null?t.items.get(c):null,f=null;if(u&&u._dom){let l=u._dom;it(l,a)||(f=l);}f||(f=_(a),u&&(u._dom=f??void 0)),f&&(f instanceof Element&&P(f,a,true),s.appendChild(f));}return s}function P(e,n,t=true){if(!k(n))return;let r=n.props||{};on(e,n,r);let o=N.get(e),s=null;for(let i in r){let a=r[i];if(ke(i))continue;let c=J(i);if(a==null||a===false){if(i==="class"||i==="className")e.className="";else if(c&&o?.has(c)){let u=o.get(c);u.options!==void 0?e.removeEventListener(c,u.handler,u.options):e.removeEventListener(c,u.handler),o.delete(c);}else e.removeAttribute(i);continue}if(typeof a=="function"&&!c&&i!=="ref"){let f=D.get(e)?.get(i);if(f&&f.fnRef===a)continue;f&&f.cleanup();let l=nn(e,i,a,n.type);D.has(e)||D.set(e,new Map),D.get(e).set(i,{cleanup:l,fnRef:a});continue}if(i==="class"||i==="className")e.className=String(a);else if(i==="value"||i==="checked")e[i]=a;else if(c){o&&o.size>0&&(s??=new Set).add(c);let u=o?.get(c);if(u&&u.original===a)continue;u&&(u.options!==void 0?e.removeEventListener(c,u.handler,u.options):e.removeEventListener(c,u.handler));let f=Q(a,true),l=Y(c);l!==void 0?e.addEventListener(c,f,l):e.addEventListener(c,f),N.has(e)||N.set(e,new Map),N.get(e).set(c,{handler:f,original:a,options:l});}else e.setAttribute(i,String(a));}if(o&&o.size>0)if(s===null){for(let[i,a]of o)a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler);N.delete(e);}else {for(let[i,a]of o)s.has(i)||(a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler),o.delete(i));o.size===0&&N.delete(e);}if(t){let i=n.children||r.children;ct(e,i);}}function ct(e,n){if(!n){e.textContent="";return}if(!Array.isArray(n)&&(typeof n=="string"||typeof n=="number")){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=String(n):e.textContent=String(n);return}if(Array.isArray(n)&&n.length===1&&k(n[0])&&n[0].type===V){let r=n[0],o=r._forState;if(!o)throw new Error("[updateElementChildren] For boundary missing _forState");let s=(r.props||{}).source,i=ne(o,s),a=S.get(e),c=B(e,i,a||new Map);S.set(e,c);return}if(Array.isArray(n)){Re(e,n);return}e.textContent="";let t=_(n);t&&e.appendChild(t);}function Re(e,n){let t=Array.from(e.children),r=n.some(i=>typeof i=="string"||typeof i=="number"),o=n.some(i=>k(i));if(r&&o){let i=Array.from(e.childNodes),a=Math.max(i.length,n.length);for(let c=0;c<a;c++){let u=i[c],f=n[c];if(f===void 0&&u){u.nodeType===1&&w(u),u.remove();continue}if(!u&&f!==void 0){let l=_(f);l&&e.appendChild(l);continue}if(!(!u||f===void 0)){if(typeof f=="string"||typeof f=="number")if(u.nodeType===3)u.data=String(f);else {let l=document.createTextNode(String(f));e.replaceChild(l,u);}else if(k(f))if(u.nodeType===1){let l=u;if(typeof f.type=="string")if(G(l.tagName,f.type))P(l,f);else {let d=_(f);d&&(I(l),w(l),e.replaceChild(d,u));}}else {let l=_(f);l&&e.replaceChild(l,u);}}}return}if(n.length===1&&t.length===0&&e.childNodes.length===1){let i=n[0],a=e.firstChild;if((typeof i=="string"||typeof i=="number")&&a?.nodeType===3){a.data=String(i);return}}t.length===0&&e.childNodes.length>0&&(e.textContent="");let s=Math.max(t.length,n.length);for(let i=0;i<s;i++){let a=t[i],c=n[i];if(c===void 0&&a){w(a),a.remove();continue}if(!a&&c!==void 0){let u=_(c);u&&e.appendChild(u);continue}if(!(!a||c===void 0))if(typeof c=="string"||typeof c=="number")a.textContent=String(c);else if(k(c))if(typeof c.type=="string")if(G(a.tagName,c.type))P(a,c);else {let u=_(c);u&&(a instanceof Element&&I(a),w(a),e.replaceChild(u,a));}else {let u=_(c);u&&(a instanceof Element&&I(a),w(a),e.replaceChild(u,a));}else {let u=_(c);u&&(a instanceof Element&&I(a),w(a),e.replaceChild(u,a));}}}function he(e,n){let t=n.length,r=0,o=0,s=Z(),i=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let u=0;u<t;u++){let{key:f,vnode:l}=n[u],d=e.children[u];if(d&&k(l)&&typeof l.type=="string"){let m=l.type;if(G(d.tagName,m)){let g=l.children||l.props?.children;i&&ue("positional idx",u,{chTag:d.tagName,vnodeType:m,chChildNodes:d.childNodes.length,childrenType:Array.isArray(g)?"array":typeof g}),ut(d,g,l),dt(d,f,()=>o++),r++;continue}else i&&ue("positional tag mismatch",u,{chTag:d.tagName,vnodeType:m});}else i&&ue("positional missing or invalid",u,{ch:!!d});mt(e,u,l);}let a=Z()-s;pt(e,n);let c={n:t,reused:r,updatedKeys:o,t:a};return ce(c,"bulkKeyedPositionalHits"),c}function ut(e,n,t){typeof n=="string"||typeof n=="number"?W(e,String(n)):Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number")?W(e,String(n[0])):lt(e,t)||P(e,t);}function lt(e,n){let t=n.children||n.props?.children;if(!Array.isArray(t)||t.length!==2)return false;let r=t[0],o=t[1];if(!k(r)||!k(o)||typeof r.type!="string"||typeof o.type!="string")return false;let s=e.children[0],i=e.children[1];if(!s||!i||!G(s.tagName,r.type)||!G(i.tagName,o.type))return false;let a=r.children||r.props?.children,c=o.children||o.props?.children;if(typeof a=="string"||typeof a=="number")W(s,String(a));else if(Array.isArray(a)&&a.length===1&&(typeof a[0]=="string"||typeof a[0]=="number"))W(s,String(a[0]));else return false;if(typeof c=="string"||typeof c=="number")W(i,String(c));else if(Array.isArray(c)&&c.length===1&&(typeof c[0]=="string"||typeof c[0]=="number"))W(i,String(c[0]));else return false;return true}function W(e,n){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=n:e.textContent=n;}function dt(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function ft(e){switch(e){case "div":return "DIV";case "span":return "SPAN";case "p":return "P";case "a":return "A";case "button":return "BUTTON";case "input":return "INPUT";case "ul":return "UL";case "ol":return "OL";case "li":return "LI";default:return null}}function te(e,n){if(e===n)return true;let t=e.length;if(t!==n.length)return false;for(let r=0;r<t;r++){let o=e.charCodeAt(r),s=n.charCodeAt(r);if(o===s)continue;let i=o>=65&&o<=90?o+32:o,a=s>=65&&s<=90?s+32:s;if(i!==a)return false}return true}function G(e,n){let t=ft(n);return t!==null&&e===t?true:te(e,n)}function mt(e,n,t){let r=_(t);if(r){let o=e.children[n];o?(w(o),e.replaceChild(r,o)):e.appendChild(r);}}function pt(e,n){try{let t=S.get(e),r=t?(t.clear(),t):new Map;for(let o=0;o<n.length;o++){let s=n[o].key,i=e.children[o];i&&r.set(s,i);}S.set(e,r);}catch{}}function sn(e,n){let t=Z(),r=Array.from(e.childNodes),o=[],s=0,i=0;for(let f=0;f<n.length;f++){let l=ht(n[f],r[f],o);l==="reused"?s++:l==="created"&&i++;}let a=Z()-t,c=_t(e,o);S.delete(e);let u={n:n.length,reused:s,created:i,tBuild:a,tCommit:c};return Et(u),u}function ht(e,n,t){return typeof e=="string"||typeof e=="number"?gt(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?yt(e,n,t):"skipped"}function gt(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function yt(e,n,t){let r=e;if(typeof r.type=="string"){let s=r.type;if(n&&n.nodeType===1&&G(n.tagName,s))return P(n,e),t.push(n),"reused"}let o=_(e);return o?(t.push(o),"created"):"skipped"}function _t(e,n){let t=Date.now(),r=document.createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);try{for(let o=e.firstChild;o;){let s=o.nextSibling;o instanceof Element&&I(o),w(o),o=s;}}catch{}return ae("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Et(e){try{T("__LAST_BULK_TEXT_FASTPATH_STATS",e),T("__LAST_FASTPATH_STATS",e),T("__LAST_FASTPATH_COMMIT_COUNT",1),R("bulkTextFastpathHits");}catch{}}function an(e,n){let t=Number(process.env.ASKR_BULK_TEXT_THRESHOLD)||1024,r=.8,o=Array.isArray(n)?n.length:0;if(o<t)return ve({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let s=St(n);if(s.componentFound!==void 0)return ve({phase:"bulk-unkeyed-eligible",reason:"component-child",index:s.componentFound}),false;let i=s.simple/o,a=i>=r&&e.childNodes.length>=o;return ve({phase:"bulk-unkeyed-eligible",total:o,simple:s.simple,fraction:i,requiredFraction:r,eligible:a}),a}function St(e){let n=0;for(let t=0;t<e.length;t++){let r=e[t];if(typeof r=="string"||typeof r=="number"){n++;continue}if(typeof r=="object"&&r!==null&&"type"in r){let o=r;if(typeof o.type=="function")return {simple:n,componentFound:t};typeof o.type=="string"&&kt(o)&&n++;}}return {simple:n}}function kt(e){let n=e.children||e.props?.children;return !!(!n||typeof n=="string"||typeof n=="number"||Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number"))}function ve(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{T("__BULK_DIAG",e);}catch{}}var we=new WeakMap;function xe(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function At(e){if(Array.isArray(e)){if(e.length===1){let n=e[0];if(typeof n=="string"||typeof n=="number")return {isSimple:true,text:String(n)}}}else if(typeof e=="string"||typeof e=="number")return {isSimple:true,text:String(e)};return {isSimple:false}}function bt(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function dn(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function fn(e){let n=S.get(e);return n||(n=dn(e),n.size>0&&S.set(e,n)),n.size>0?n:void 0}function mn(e){for(let n=0;n<e.length;n++)if(L(e[n])!==void 0)return true;return false}function pn(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&Tt(e,n))return;let r=B(e,n,t);S.set(e,r);}function Tt(e,n){try{let t=[];for(let s of n)k(s)&&s.key!==void 0&&t.push({key:s.key,vnode:s});if(t.length===0||t.length!==n.length)return !1;(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced positional bulk keyed reuse (evaluate-level)");let r=he(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{T("__LAST_FASTPATH_STATS",r),T("__LAST_FASTPATH_COMMIT_COUNT",1),R("bulkKeyedPositionalForced");}catch{}let o=dn(e);return S.set(e,o),!0}catch(t){return (process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced bulk path failed, falling back",t),false}}function Ct(e,n){if(an(e,n)){sn(e,n);}else Re(e,n);S.delete(e);}function un(e,n){let t=n._forState;if(!t)return;let r=(n.props||{}).source,o=ne(t,r);if(o.length>0){let s=fn(e);try{pn(e,o,s);}catch{let i=B(e,o,s);S.set(e,i);}}else e.textContent="",S.delete(e);}function ln(e,n){if(!n){e.textContent="",S.delete(e);return}if(!Array.isArray(n)&&k(n)&&n.type===V){un(e,n);return}if(!Array.isArray(n)){e.textContent="";let t=_(n);t&&e.appendChild(t),S.delete(e);return}if(n.length===1&&k(n[0])&&n[0].type===V){un(e,n[0]);return}if(mn(n)){let t=fn(e);try{pn(e,n,t);}catch{let r=B(e,n,t);S.set(e,r);}}else Ct(e,n);}function Fe(e,n){let t=n.children||n.props?.children;if(t&&k(t)&&t.type===V){ln(e,t),P(e,n,false);return}t&&!Array.isArray(t)&&(t=[t]);let r=At(t);r.isSimple&&bt(e,r.text)||ln(e,t),P(e,n,false);}function vt(e,n){let t=e.firstElementChild;for(let r=0;r<n.length;r++){let o=n[r],s=t?t.nextElementSibling:null;if(t&&k(o)&&typeof o.type=="string"&&xe(t.tagName,o.type)){Fe(t,o),t=s;continue}let i=_(o);i&&(t?e.replaceChild(i,t):e.appendChild(i)),t=s;}for(;t;){let r=t.nextElementSibling;e.removeChild(t),t=r;}}function Nt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){Rt(e,r);continue}let o=J(t);if(o){let s=Q(r,true),i=Y(o);i!==void 0?e.addEventListener(o,s,i):e.addEventListener(o,s),N.has(e)||N.set(e,new Map),N.get(e).set(o,{handler:s,original:r,options:i});continue}t==="class"||t==="className"?e.className=String(r):t==="value"||t==="checked"?e[t]=r:e.setAttribute(t,String(r));}}function Rt(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function wt(e,n){let t=n.children;if(!Array.isArray(t)||!mn(t))return false;let r=document.createElement(n.type);e.appendChild(r),Nt(r,n.props||{});let o=B(r,t,void 0);return S.set(r,o),true}function xt(e){return k(e)&&typeof e.type=="symbol"&&(e.type===b||String(e.type)==="Symbol(askr.fragment)")}function Ft(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function X(e,n,t){if(n&&!(typeof document>"u"))if(t&&we.has(t)){let r=we.get(t),o=r.start.nextSibling;for(;o&&o!==r.end;){let i=o.nextSibling;o.remove(),o=i;}let s=_(e);s&&n.insertBefore(s,r.end);}else if(t){let r=document.createComment("component-start"),o=document.createComment("component-end");n.appendChild(r),n.appendChild(o),we.set(t,{start:r,end:o});let s=_(e);s&&n.insertBefore(s,o);}else {let r=e;if(xt(r)){let a=Ft(r);if(a.length===1&&k(a[0])&&typeof a[0].type=="string")r=a[0];else {vt(n,a);return}}let s=n.__ASKR_INSTANCE;if(s&&s.target===n)if(k(r)&&typeof r.type=="string"&&xe(n.tagName,r.type)){Fe(n,r);return}else {let a=_(r);if(a&&n.parentNode){a instanceof Element&&(a.__ASKR_INSTANCE=s,s.target=a),I(n),n.parentNode.replaceChild(a,n);return}}let i=n.children[0];if(i&&k(r)&&typeof r.type=="string"&&xe(i.tagName,r.type))Fe(i,r);else {if(n.textContent="",k(r)&&typeof r.type=="string"&&wt(n,r))return;let a=_(r);a&&n.appendChild(a);}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:X,isKeyedReorderFastPathEligible:j,getKeyMapForElement:le};}function me(e,n,t,r){let o={id:e,fn:n,props:t,target:r,mounted:false,abortController:new AbortController,stateValues:[],evaluationGeneration:0,notifyUpdate:null,_pendingFlushTask:void 0,_pendingRunTask:void 0,_enqueueRun:void 0,stateIndexCheck:-1,expectedStateIndices:[],firstRenderComplete:false,mountOperations:[],cleanupFns:[],hasPendingUpdate:false,ownerFrame:null,ssr:false,cleanupStrict:false,isRoot:false,_currentRenderToken:void 0,lastRenderToken:0,_pendingReadStates:new Set,_lastReadStates:new Set};return o._pendingRunTask=()=>{o.hasPendingUpdate=false,yn(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,C.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var F=null,ye=0;function io(){return F}function O(e){F=e;}function hn(e){if(e.isRoot){for(let n of e.mountOperations){let t=n();t instanceof Promise?t.then(r=>{typeof r=="function"&&e.cleanupFns.push(r);}):typeof t=="function"&&e.cleanupFns.push(t);}e.mountOperations=[];}}function Ne(e,n){e.target=n;try{n instanceof Element&&(n.__ASKR_INSTANCE=e);}catch(r){}e.notifyUpdate=e._enqueueRun;let t=!e.mounted;e.mounted=true,t&&e.mountOperations.length>0&&hn(e);}var gn=0;function yn(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++gn,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=_n(e);if(t instanceof Promise)throw new Error("Async components are not supported. Components must be synchronous.");{let r=globalThis.__ASKR_FASTLANE;try{if(r?.tryRuntimeFastLaneSync?.(e,t))return}catch{}C.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){U(e);return}let o=e._placeholder,s=o.parentNode;if(!s){a.warn("[Askr] placeholder no longer in DOM, cannot render component");return}let i=document.createElement("div"),a$1=F;F=e;try{X(t,i),s.replaceChild(i,o),e.target=i,e._placeholder=void 0,i.__ASKR_INSTANCE=e,U(e);}finally{F=a$1;}return}if(e.target){let o=[];try{let s=!e.mounted,i=F;F=e,o=Array.from(e.target.childNodes);try{X(t,e.target);}catch(a$1){try{let c=Array.from(e.target.childNodes);for(let u of c)try{Ce(u);}catch(f){a.warn("[Askr] error cleaning up failed commit children:",f);}}catch(c){}try{R("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(c){}throw e.target.replaceChildren(...o),a$1}finally{F=i;}U(e),e.mounted=!0,s&&e.mountOperations.length>0&&hn(e);}catch(s){try{let i=Array.from(e.target.childNodes);for(let a$1 of i)try{Ce(a$1);}catch(c){a.warn("[Askr] error cleaning up partial children during rollback:",c);}}catch(i){}try{try{R("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(i){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw s}}});}}function cn(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++gn,e._pendingReadStates=new Set);try{let o=_n(e);return n||U(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function _n(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,F=e,ye=0;try{let t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=z(r,()=>e.fn(e.props,t)),s=Date.now()-0;s>5&&a.warn(`[askr] Slow render detected: ${s}ms. Consider optimizing component performance.`),e.firstRenderComplete||(e.firstRenderComplete=!0);for(let i=0;i<e.stateValues.length;i++){let a$1=e.stateValues[i];if(a$1&&!a$1._hasBeenRead)try{let c=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${c} at index ${i}. State should be read during render or removed.`);}catch{a.warn("[askr] Unused state variable detected. State should be read during render or removed.");}}return o}finally{F=null;}}function Mt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,C.enqueue(()=>yn(e));}function H(){return F}function co(){if(!F)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return F.abortController.signal}function U(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function uo(){return ye++}function Ye(){return ye}function Qe(e){ye=e;}function lo(e){Mt(e);}function Xe(e){let n=[];for(let t of e.cleanupFns)try{t();}catch(r){e.cleanupStrict&&n.push(r);}if(e.cleanupFns=[],n.length>0)throw new AggregateError(n,`Cleanup failed for component ${e.id}`);if(e._lastReadStates){for(let t of e._lastReadStates){let r=t._readers;r&&r.delete(e);}e._lastReadStates=new Set;}e.abortController.abort(),e.notifyUpdate=null,e.mounted=false;}export{_e as a,C as b,Ot as c,De as d,ee as e,V as f,I as g,rr as h,me as i,io as j,O as k,H as l,co as m,uo as n,lo as o,Xe as p};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-TWPSACYW.js';import {h,f}from'./chunk-65JSCTWN.js';function m(t,n,a$1){let p=a(h(t,n,a$1?.by))();return {type:f,props:{source:t},_forState:p}}export{m as a};
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-ED3HBBAN.js';import {c}from'./chunk-62D2TNHX.js';var q={};c(q,{_lockRouteRegistrationForTests:()=>T,_unlockRouteRegistrationForTests:()=>U,clearRoutes:()=>C,getLoadedNamespaces:()=>F,getNamespaceRoutes:()=>Q,getRoutes:()=>W,lockRouteRegistration:()=>L,registerRoute:()=>_,resolveRoute:()=>J,route:()=>S,setServerLocation:()=>O,unloadNamespace:()=>j});function h(e,r){let o=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,i=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r,t=o.split("/").filter(Boolean),n=i.split("/").filter(Boolean);if(n.length===1&&n[0]==="*")return {matched:true,params:{"*":t.length>1?o:t[0]}};if(t.length!==n.length)return {matched:false,params:{}};let s={};for(let a=0;a<n.length;a++){let c=n[a],u=t[a];if(c.startsWith("{")&&c.endsWith("}")){let f=c.slice(1,-1);s[f]=decodeURIComponent(u);}else if(c==="*")s["*"]=u;else if(c!==u)return {matched:false,params:{}}}return {matched:true,params:s}}var l=[],g=new Set,P=Symbol.for("__ASKR_HAS_ROUTES__");function b(e){try{let r=globalThis;r[P]=e;}catch{}}b(false);var p=new Map;function z(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;return r==="/"?0:r.split("/").filter(Boolean).length}function v(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;if(r==="/*")return 0;let o=r.split("/").filter(Boolean),i=0;for(let t of o)t.startsWith("{")&&t.endsWith("}")?i+=2:t==="*"?i+=1:i+=3;return i}var w=null;function O(e){w=e;}function M(e){try{let r=new URL(e,"http://localhost");return {pathname:r.pathname,search:r.search,hash:r.hash}}catch{return {pathname:"/",search:"",hash:""}}}function m(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e)){let o=e[r];o&&typeof o=="object"&&m(o);}}return e}function N(e){let r=new URLSearchParams(e||""),o=new Map;for(let[t,n]of r.entries()){let s=o.get(t);s?s.push(n):o.set(t,[n]);}return m({get(t){let n=o.get(t);return n?n[0]:null},getAll(t){let n=o.get(t);return n?[...n]:[]},has(t){return o.has(t)},toJSON(){let t={};for(let[n,s]of o.entries())t[n]=s.length>1?[...s]:s[0];return t}})}function B(e){let r=W(),o=[];function i(t){let n=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;if(n==="/*")return 0;let s=n.split("/").filter(Boolean),a=0;for(let c of s)c.startsWith("{")&&c.endsWith("}")?a+=2:c==="*"?a+=1:a+=3;return a}for(let t of r){let n=h(e,t.path);n.matched&&o.push({pattern:t.path,params:n.params,name:t.name,namespace:t.namespace,specificity:i(t.path)});}return o.sort((t,n)=>n.specificity-t.specificity),o.map(t=>({path:t.pattern,params:m({...t.params}),name:t.name,namespace:t.namespace}))}var d=false;function L(){d=true;}function T(){d=true;}function U(){d=false;}function S(e,r,o){if(a()==="islands")throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.");if(typeof e>"u"){let a=j$1();if(!a)throw new Error("route() can only be called during component render execution. Call route() from inside your component function.");let c="/",u="",f="";if(typeof window<"u"&&window.location)c=window.location.pathname||"/",u=window.location.search||"",f=window.location.hash||"";else if(w){let R=M(w);c=R.pathname,u=R.search,f=R.hash;}let A=m({...a.props||{}}),D=N(u),E=B(c);return Object.freeze({path:c,params:A,query:D,hash:f||null,matches:Object.freeze(E)})}let i=j$1();if(i&&i.ssr)throw new Error("route() cannot be called during SSR rendering. Register routes at module load time instead.");if(d)throw new Error("Route registration is locked after app startup. Register routes at module load time before calling createSPA or createSSR.");if(typeof r!="function")throw new Error("route(path, handler) requires a function handler that returns a VNode (e.g. () => <Page />). Passing JSX elements or VNodes directly is not supported.");let t={path:e,handler:r,namespace:o};l.push(t),b(true);let n=z(e),s=p.get(n);s||(s=[],p.set(n,s)),s.push(t),o&&g.add(o);}function W(){return [...l]}function Q(e){return l.filter(r=>r.namespace===e)}function j(e){let r=l.length;for(let o=l.length-1;o>=0;o--)if(l[o].namespace===e){let i=l[o];l.splice(o,1);let t=z(i.path),n=p.get(t);if(n){let s=n.indexOf(i);s>=0&&n.splice(s,1);}}return g.delete(e),r-l.length}function C(){l.length=0,g.clear(),p.clear(),d=false,b(false);}function k(e){if(e!=null&&typeof e=="function")return (r,o)=>{try{return e(r,o)}catch{return e(r)}}}function _(e,r,...o){let i=!e.startsWith("/"),t={path:e,handler:r,children:o.filter(Boolean),_isDescriptor:true};if(!i){let n=k(r);if(r!=null&&!n)throw new Error("registerRoute(path, handler) requires a function handler. Passing JSX elements or VNodes directly is not supported.");n&&S(e,n);for(let s of t.children||[]){let c=`${e==="/"?"":e.replace(/\/$/,"")}/${s.path.replace(/^\//,"")}`.replace(/\/\//g,"/");if(s.handler){let u=k(s.handler);if(!u)throw new Error("registerRoute child handler must be a function. Passing JSX elements directly is not supported.");u&&S(c,u);}s.children&&s.children.length&&_(c,null,...s.children);}return t}return t}function F(){return Array.from(g)}function J(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,o=r==="/"?0:r.split("/").filter(Boolean).length,i=[],t=p.get(o);if(t)for(let n of t){let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}for(let n of l){if(t?.includes(n))continue;let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}if(i.sort((n,s)=>s.specificity-n.specificity),i.length>0){let n=i[0];return {handler:n.route.handler,params:n.params}}return null}
1
+ import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-65JSCTWN.js';import {c}from'./chunk-62D2TNHX.js';var q={};c(q,{_lockRouteRegistrationForTests:()=>T,_unlockRouteRegistrationForTests:()=>U,clearRoutes:()=>C,getLoadedNamespaces:()=>F,getNamespaceRoutes:()=>Q,getRoutes:()=>W,lockRouteRegistration:()=>L,registerRoute:()=>_,resolveRoute:()=>J,route:()=>S,setServerLocation:()=>O,unloadNamespace:()=>j});function h(e,r){let o=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,i=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r,t=o.split("/").filter(Boolean),n=i.split("/").filter(Boolean);if(n.length===1&&n[0]==="*")return {matched:true,params:{"*":t.length>1?o:t[0]}};if(t.length!==n.length)return {matched:false,params:{}};let s={};for(let a=0;a<n.length;a++){let c=n[a],u=t[a];if(c.startsWith("{")&&c.endsWith("}")){let f=c.slice(1,-1);s[f]=decodeURIComponent(u);}else if(c==="*")s["*"]=u;else if(c!==u)return {matched:false,params:{}}}return {matched:true,params:s}}var l=[],g=new Set,P=Symbol.for("__ASKR_HAS_ROUTES__");function b(e){try{let r=globalThis;r[P]=e;}catch{}}b(false);var p=new Map;function z(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;return r==="/"?0:r.split("/").filter(Boolean).length}function v(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;if(r==="/*")return 0;let o=r.split("/").filter(Boolean),i=0;for(let t of o)t.startsWith("{")&&t.endsWith("}")?i+=2:t==="*"?i+=1:i+=3;return i}var w=null;function O(e){w=e;}function M(e){try{let r=new URL(e,"http://localhost");return {pathname:r.pathname,search:r.search,hash:r.hash}}catch{return {pathname:"/",search:"",hash:""}}}function m(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e)){let o=e[r];o&&typeof o=="object"&&m(o);}}return e}function N(e){let r=new URLSearchParams(e||""),o=new Map;for(let[t,n]of r.entries()){let s=o.get(t);s?s.push(n):o.set(t,[n]);}return m({get(t){let n=o.get(t);return n?n[0]:null},getAll(t){let n=o.get(t);return n?[...n]:[]},has(t){return o.has(t)},toJSON(){let t={};for(let[n,s]of o.entries())t[n]=s.length>1?[...s]:s[0];return t}})}function B(e){let r=W(),o=[];function i(t){let n=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;if(n==="/*")return 0;let s=n.split("/").filter(Boolean),a=0;for(let c of s)c.startsWith("{")&&c.endsWith("}")?a+=2:c==="*"?a+=1:a+=3;return a}for(let t of r){let n=h(e,t.path);n.matched&&o.push({pattern:t.path,params:n.params,name:t.name,namespace:t.namespace,specificity:i(t.path)});}return o.sort((t,n)=>n.specificity-t.specificity),o.map(t=>({path:t.pattern,params:m({...t.params}),name:t.name,namespace:t.namespace}))}var d=false;function L(){d=true;}function T(){d=true;}function U(){d=false;}function S(e,r,o){if(a()==="islands")throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.");if(typeof e>"u"){let a=j$1();if(!a)throw new Error("route() can only be called during component render execution. Call route() from inside your component function.");let c="/",u="",f="";if(typeof window<"u"&&window.location)c=window.location.pathname||"/",u=window.location.search||"",f=window.location.hash||"";else if(w){let R=M(w);c=R.pathname,u=R.search,f=R.hash;}let A=m({...a.props||{}}),D=N(u),E=B(c);return Object.freeze({path:c,params:A,query:D,hash:f||null,matches:Object.freeze(E)})}let i=j$1();if(i&&i.ssr)throw new Error("route() cannot be called during SSR rendering. Register routes at module load time instead.");if(d)throw new Error("Route registration is locked after app startup. Register routes at module load time before calling createSPA or createSSR.");if(typeof r!="function")throw new Error("route(path, handler) requires a function handler that returns a VNode (e.g. () => <Page />). Passing JSX elements or VNodes directly is not supported.");let t={path:e,handler:r,namespace:o};l.push(t),b(true);let n=z(e),s=p.get(n);s||(s=[],p.set(n,s)),s.push(t),o&&g.add(o);}function W(){return [...l]}function Q(e){return l.filter(r=>r.namespace===e)}function j(e){let r=l.length;for(let o=l.length-1;o>=0;o--)if(l[o].namespace===e){let i=l[o];l.splice(o,1);let t=z(i.path),n=p.get(t);if(n){let s=n.indexOf(i);s>=0&&n.splice(s,1);}}return g.delete(e),r-l.length}function C(){l.length=0,g.clear(),p.clear(),d=false,b(false);}function k(e){if(e!=null&&typeof e=="function")return (r,o)=>{try{return e(r,o)}catch{return e(r)}}}function _(e,r,...o){let i=!e.startsWith("/"),t={path:e,handler:r,children:o.filter(Boolean),_isDescriptor:true};if(!i){let n=k(r);if(r!=null&&!n)throw new Error("registerRoute(path, handler) requires a function handler. Passing JSX elements or VNodes directly is not supported.");n&&S(e,n);for(let s of t.children||[]){let c=`${e==="/"?"":e.replace(/\/$/,"")}/${s.path.replace(/^\//,"")}`.replace(/\/\//g,"/");if(s.handler){let u=k(s.handler);if(!u)throw new Error("registerRoute child handler must be a function. Passing JSX elements directly is not supported.");u&&S(c,u);}s.children&&s.children.length&&_(c,null,...s.children);}return t}return t}function F(){return Array.from(g)}function J(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,o=r==="/"?0:r.split("/").filter(Boolean).length,i=[],t=p.get(o);if(t)for(let n of t){let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}for(let n of l){if(t?.includes(n))continue;let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}if(i.sort((n,s)=>s.specificity-n.specificity),i.length>0){let n=i[0];return {handler:n.route.handler,params:n.params}}return null}
2
2
  export{O as a,L as b,T as c,U as d,S as e,W as f,Q as g,j as h,C as i,_ as j,F as k,J as l,q as m};
@@ -1 +1 @@
1
- import {l,n,a,e,b}from'./chunk-ED3HBBAN.js';function C(l$1){let e=l();if(!e)throw new Error("state() can only be called during component render execution. Move state() calls to the top level of your component function.");let t=n(),s=e.stateValues;if(t<e.stateIndexCheck)throw new Error(`State index violation: state() call at index ${t}, but previously saw index ${e.stateIndexCheck}. This happens when state() is called conditionally (inside if/for/etc). Move all state() calls to the top level of your component function, before any conditionals.`);if(a(t>=e.stateIndexCheck,"[State] State indices must increase monotonically"),e.stateIndexCheck=t,e.firstRenderComplete){if(!e.expectedStateIndices.includes(t))throw new Error(`Hook order violation: state() called at index ${t}, but this index was not in the first render's sequence [${e.expectedStateIndices.join(", ")}]. This usually means state() is inside a conditional or loop. Move all state() calls to the top level of your component function.`)}else e.expectedStateIndices.push(t);if(s[t]){let n=s[t];if(n._owner!==e)throw new Error(`State ownership violation: state() called at index ${t} is owned by a different component instance. State ownership is positional and immutable.`);return n}let o=S(l$1,e);return s[t]=o,o}function S(l$1,e$1){let t=l$1,s=new Map;function o(){o._hasBeenRead=true;let n=l();return n&&n._currentRenderToken!==void 0&&(n._pendingReadStates||(n._pendingReadStates=new Set),n._pendingReadStates.add(o)),t}return o._readers=s,o._owner=e$1,o.set=n=>{if(l()!==null)throw new Error("[Askr] state.set() cannot be called during component render. State mutations during render break the actor model and cause infinite loops. Move state updates to event handlers or use conditional rendering instead.");let r;if(typeof n=="function"?r=n(t):r=n,Object.is(t,r))return;if(e()){t=r;return}t=r;let c=o._readers;if(c){for(let[a,m]of c)if(a.lastRenderToken===m&&!a.hasPendingUpdate){a.hasPendingUpdate=true;let p=a._pendingFlushTask;p?b.enqueue(p):b.enqueue(()=>{a.hasPendingUpdate=false,a.notifyUpdate?.();});}}let u=c?.get(e$1);if(u!==void 0&&e$1.lastRenderToken===u&&!e$1.hasPendingUpdate){e$1.hasPendingUpdate=true;let a=e$1._pendingFlushTask;a?b.enqueue(a):b.enqueue(()=>{e$1.hasPendingUpdate=false,e$1.notifyUpdate?.();});}},o}export{C as a};
1
+ import {l,n,a,e,b}from'./chunk-65JSCTWN.js';function C(l$1){let e=l();if(!e)throw new Error("state() can only be called during component render execution. Move state() calls to the top level of your component function.");let t=n(),s=e.stateValues;if(t<e.stateIndexCheck)throw new Error(`State index violation: state() call at index ${t}, but previously saw index ${e.stateIndexCheck}. This happens when state() is called conditionally (inside if/for/etc). Move all state() calls to the top level of your component function, before any conditionals.`);if(a(t>=e.stateIndexCheck,"[State] State indices must increase monotonically"),e.stateIndexCheck=t,e.firstRenderComplete){if(!e.expectedStateIndices.includes(t))throw new Error(`Hook order violation: state() called at index ${t}, but this index was not in the first render's sequence [${e.expectedStateIndices.join(", ")}]. This usually means state() is inside a conditional or loop. Move all state() calls to the top level of your component function.`)}else e.expectedStateIndices.push(t);if(s[t]){let n=s[t];if(n._owner!==e)throw new Error(`State ownership violation: state() called at index ${t} is owned by a different component instance. State ownership is positional and immutable.`);return n}let o=S(l$1,e);return s[t]=o,o}function S(l$1,e$1){let t=l$1,s=new Map;function o(){o._hasBeenRead=true;let n=l();return n&&n._currentRenderToken!==void 0&&(n._pendingReadStates||(n._pendingReadStates=new Set),n._pendingReadStates.add(o)),t}return o._readers=s,o._owner=e$1,o.set=n=>{if(l()!==null)throw new Error("[Askr] state.set() cannot be called during component render. State mutations during render break the actor model and cause infinite loops. Move state updates to event handlers or use conditional rendering instead.");let r;if(typeof n=="function"?r=n(t):r=n,Object.is(t,r))return;if(e()){t=r;return}t=r;let c=o._readers;if(c){for(let[a,m]of c)if(a.lastRenderToken===m&&!a.hasPendingUpdate){a.hasPendingUpdate=true;let p=a._pendingFlushTask;p?b.enqueue(p):b.enqueue(()=>{a.hasPendingUpdate=false,a.notifyUpdate?.();});}}let u=c?.get(e$1);if(u!==void 0&&e$1.lastRenderToken===u&&!e$1.hasPendingUpdate){e$1.hasPendingUpdate=true;let a=e$1._pendingFlushTask;a?b.enqueue(a):b.enqueue(()=>{e$1.hasPendingUpdate=false,e$1.notifyUpdate?.();});}},o}export{C as a};
@@ -1 +1 @@
1
- import {b,l}from'./chunk-NLFOBEE4.js';import {p,o}from'./chunk-ED3HBBAN.js';var e=null;function f(n,t){e=n,b();}function c(n){if(typeof window>"u")return;let t=l(n);t&&(window.history.pushState({path:n},"",n),e&&(p(e),e.fn=t.handler,e.props=t.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e)));}function s(n){let t=window.location.pathname;if(!e)return;let o$1=l(t);o$1&&(p(e),e.fn=o$1.handler,e.props=o$1.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e));}function u(){typeof window<"u"&&window.addEventListener("popstate",s);}function m(){typeof window<"u"&&window.removeEventListener("popstate",s);}export{f as a,c as b,u as c,m as d};
1
+ import {b,l}from'./chunk-R4G2E76D.js';import {p,o}from'./chunk-65JSCTWN.js';var e=null;function f(n,t){e=n,b();}function c(n){if(typeof window>"u")return;let t=l(n);t&&(window.history.pushState({path:n},"",n),e&&(p(e),e.fn=t.handler,e.props=t.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e)));}function s(n){let t=window.location.pathname;if(!e)return;let o$1=l(t);o$1&&(p(e),e.fn=o$1.handler,e.props=o$1.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e));}function u(){typeof window<"u"&&window.addEventListener("popstate",s);}function m(){typeof window<"u"&&window.removeEventListener("popstate",s);}export{f as a,c as b,u as c,m as d};
package/dist/for/index.js CHANGED
@@ -1 +1 @@
1
- export{a as For}from'../chunk-SBD6PT2Z.js';import'../chunk-2LY2VFSS.js';import'../chunk-ED3HBBAN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';
1
+ export{a as For}from'../chunk-74KTJLWR.js';import'../chunk-TWPSACYW.js';import'../chunk-65JSCTWN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';
@@ -1 +1 @@
1
- import {a}from'../chunk-2LY2VFSS.js';import {c}from'../chunk-HZKAD5DE.js';export{i as applyInteractionPolicy,c as ariaDisabled,d as ariaExpanded,e as ariaSelected,a as composeHandlers,g as composeRefs,k as layout,j as mergeInteractionProps,b as mergeProps,h as pressable,f as setRef}from'../chunk-HZKAD5DE.js';import {b,a as a$1}from'../chunk-4RTKQ7SC.js';export{d as DefaultPortal,c as definePortal}from'../chunk-4RTKQ7SC.js';import'../chunk-ED3HBBAN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$1,a as a$2}from'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function w(e){return `${e.prefix??"askr"}-${String(e.id)}`}function F({node:e,disabled:o,onDismiss:n}){function r(l){o||l.key==="Escape"&&(l.preventDefault?.(),l.stopPropagation?.(),n?.("escape"));}function s(l){if(o)return;let t=l.target;t instanceof Node&&e&&(e.contains(t)||n?.("outside"));}return {onKeyDown:r,onPointerDownCapture:s}}function M({disabled:e,tabIndex:o}){return {tabIndex:e?-1:o===void 0?0:o,...c(e)}}function H({disabled:e,onEnter:o,onLeave:n}){return {onPointerEnter:e?void 0:r=>{o?.(r);},onPointerLeave:e?void 0:r=>{n?.(r);}}}function A(e){let{currentIndex:o,itemCount:n,orientation:r="horizontal",loop:s=false,onNavigate:l,isDisabled:t}=e;function i(u,p){let a=u+p;if(s)a<0&&(a=n-1),a>=n&&(a=0);else if(a<0||a>=n)return;return t?.(a)?a===u?void 0:i(a,p):a}function d(u){let{key:p}=u,a;if((r==="horizontal"||r==="both")&&(p==="ArrowRight"&&(a=1),p==="ArrowLeft"&&(a=-1)),(r==="vertical"||r==="both")&&(p==="ArrowDown"&&(a=1),p==="ArrowUp"&&(a=-1)),a===void 0)return;let f=i(o,a);f!==void 0&&(u.preventDefault?.(),u.stopPropagation?.(),l?.(f));}return {container:{onKeyDown:d},item:u=>({tabIndex:u===o?0:-1,"data-roving-index":u})}}function T(e){return e!==void 0}function g(e,o){let n=T(e);return {value:n?e:o,isControlled:n}}function K(e){let{value:o,defaultValue:n,onChange:r,setInternal:s}=e,{isControlled:l}=g(o,n);function t(i){l||s?.(i),r?.(i);}return {set:t,isControlled:l}}function J(e){let o=a(e.defaultValue),n=e.value!==void 0;function r(){return n?e.value:o()}return r.set=s=>{let l=r(),t=typeof s=="function"?s(l):s;if(!Object.is(l,t)){if(n){e.onChange?.(t);return}o.set(s),e.onChange?.(t);}},r.isControlled=n,r}function X(e){if(e.asChild){let{children:n,asChild:r,...s}=e;return a$1(n)?b(n,s):null}return {$$typeof:a$2,type:b$1,props:{children:e.children},key:null}}function z({present:e,children:o}){return (typeof e=="function"?e():!!e)?{$$typeof:a$2,type:b$1,props:{children:o},key:null}:null}function $(){let e=new Map;function o(l,t){let i={node:l,metadata:t};return e.set(l,i),()=>{e.delete(l);}}function n(){return Array.from(e.values())}function r(){e.clear();}function s(){return e.size}return {register:o,items:n,clear:r,size:s}}function j(){let e=[],o=1;function n(t){let i=o++,d={id:i,options:t};e.push(d);function u(){return e[e.length-1]?.id===i}function p(){let a=e.findIndex(f=>f.id===i);a!==-1&&e.splice(a,1);}return {id:i,isTop:u,unregister:p}}function r(){return e.map(t=>({id:t.id,isTop:()=>e[e.length-1]?.id===t.id,unregister:()=>{let i=e.findIndex(d=>d.id===t.id);i!==-1&&e.splice(i,1);}}))}function s(){let t=e[e.length-1];t&&t.options.onEscape?.();}function l(t){let i=e[e.length-1];if(!i)return;let d=i.options.node;d&&t.target instanceof Node&&d.contains(t.target)||i.options.onOutsidePointer?.(t);}return {register:n,layers:r,handleEscape:s,handleOutsidePointer:l}}export{z as Presence,X as Slot,J as controllableState,$ as createCollection,j as createLayer,F as dismissable,M as focusable,w as formatId,H as hoverable,T as isControlled,K as makeControllable,g as resolveControllable,A as rovingFocus};
1
+ import {a}from'../chunk-TWPSACYW.js';import {c}from'../chunk-HZKAD5DE.js';export{i as applyInteractionPolicy,c as ariaDisabled,d as ariaExpanded,e as ariaSelected,a as composeHandlers,g as composeRefs,k as layout,j as mergeInteractionProps,b as mergeProps,h as pressable,f as setRef}from'../chunk-HZKAD5DE.js';import {a as a$1,b}from'../chunk-4RTKQ7SC.js';export{d as DefaultPortal,c as definePortal}from'../chunk-4RTKQ7SC.js';import'../chunk-65JSCTWN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$1,a as a$2}from'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function w(e){return `${e.prefix??"askr"}-${String(e.id)}`}function F({node:e,disabled:o,onDismiss:n}){function r(l){o||l.key==="Escape"&&(l.preventDefault?.(),l.stopPropagation?.(),n?.("escape"));}function s(l){if(o)return;let t=l.target;t instanceof Node&&e&&(e.contains(t)||n?.("outside"));}return {onKeyDown:r,onPointerDownCapture:s}}function M({disabled:e,tabIndex:o}){return {tabIndex:e?-1:o===void 0?0:o,...c(e)}}function H({disabled:e,onEnter:o,onLeave:n}){return {onPointerEnter:e?void 0:r=>{o?.(r);},onPointerLeave:e?void 0:r=>{n?.(r);}}}function A(e){let{currentIndex:o,itemCount:n,orientation:r="horizontal",loop:s=false,onNavigate:l,isDisabled:t}=e;function i(u,p){let a=u+p;if(s)a<0&&(a=n-1),a>=n&&(a=0);else if(a<0||a>=n)return;return t?.(a)?a===u?void 0:i(a,p):a}function d(u){let{key:p}=u,a;if((r==="horizontal"||r==="both")&&(p==="ArrowRight"&&(a=1),p==="ArrowLeft"&&(a=-1)),(r==="vertical"||r==="both")&&(p==="ArrowDown"&&(a=1),p==="ArrowUp"&&(a=-1)),a===void 0)return;let f=i(o,a);f!==void 0&&(u.preventDefault?.(),u.stopPropagation?.(),l?.(f));}return {container:{onKeyDown:d},item:u=>({tabIndex:u===o?0:-1,"data-roving-index":u})}}function T(e){return e!==void 0}function g(e,o){let n=T(e);return {value:n?e:o,isControlled:n}}function K(e){let{value:o,defaultValue:n,onChange:r,setInternal:s}=e,{isControlled:l}=g(o,n);function t(i){l||s?.(i),r?.(i);}return {set:t,isControlled:l}}function J(e){let o=a(e.defaultValue),n=e.value!==void 0;function r(){return n?e.value:o()}return r.set=s=>{let l=r(),t=typeof s=="function"?s(l):s;if(!Object.is(l,t)){if(n){e.onChange?.(t);return}o.set(s),e.onChange?.(t);}},r.isControlled=n,r}function X(e){if(e.asChild){let{children:n,asChild:r,...s}=e;return a$1(n)?b(n,s):null}return {$$typeof:a$2,type:b$1,props:{children:e.children},key:null}}function z({present:e,children:o}){return (typeof e=="function"?e():!!e)?{$$typeof:a$2,type:b$1,props:{children:o},key:null}:null}function $(){let e=new Map;function o(l,t){let i={node:l,metadata:t};return e.set(l,i),()=>{e.delete(l);}}function n(){return Array.from(e.values())}function r(){e.clear();}function s(){return e.size}return {register:o,items:n,clear:r,size:s}}function j(){let e=[],o=1;function n(t){let i=o++,d={id:i,options:t};e.push(d);function u(){return e[e.length-1]?.id===i}function p(){let a=e.findIndex(f=>f.id===i);a!==-1&&e.splice(a,1);}return {id:i,isTop:u,unregister:p}}function r(){return e.map(t=>({id:t.id,isTop:()=>e[e.length-1]?.id===t.id,unregister:()=>{let i=e.findIndex(d=>d.id===t.id);i!==-1&&e.splice(i,1);}}))}function s(){let t=e[e.length-1];t&&t.options.onEscape?.();}function l(t){let i=e[e.length-1];if(!i)return;let d=i.options.node;d&&t.target instanceof Node&&d.contains(t.target)||i.options.onOutsidePointer?.(t);}return {register:n,layers:r,handleEscape:s,handleOutsidePointer:l}}export{z as Presence,X as Slot,J as controllableState,$ as createCollection,j as createLayer,F as dismissable,M as focusable,w as formatId,H as hoverable,T as isControlled,K as makeControllable,g as resolveControllable,A as rovingFocus};
package/dist/fx/index.js CHANGED
@@ -1 +1 @@
1
- import {j,b as b$1}from'../chunk-ED3HBBAN.js';import {a}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k(l,t,n){let e=null,{leading:r=false,trailing:i=true}=n||{},o=null,u=null,a=0,s=function(...f){let c=Date.now();o=f,u=this,e!==null&&clearTimeout(e),r&&c-a>=t&&(l.apply(this,f),a=c),i&&(e=setTimeout(()=>{l.apply(u,o),e=null,a=Date.now();},t));};return s.cancel=()=>{e!==null&&(clearTimeout(e),e=null);},s}function E(l,t,n){let e=0,r=null,{leading:i=true,trailing:o=true}=n||{},u=null,a=null,s=function(...f){let c=Date.now();u=f,a=this,i&&c-e>=t?(l.apply(this,f),e=c,r!==null&&(clearTimeout(r),r=null)):!i&&e===0&&(e=c),o&&r===null&&(r=setTimeout(()=>{l.apply(a,u),e=Date.now(),r=null;},t-(c-e)));};return s.cancel=()=>{r!==null&&(clearTimeout(r),r=null);},s}function x(l){let t=false,n;return((...e)=>(t||(t=true,n=l(...e)),n))}function g(l){Promise.resolve().then(l);}function F(l){let t=null,n=null,e=null;return function(...r){n=r,e=this,t===null&&(t=requestAnimationFrame(()=>{l.apply(e,n),t=null;}));}}function I(l,t){typeof requestIdleCallback<"u"?requestIdleCallback(l,t?{timeout:t.timeout}:void 0):Promise.resolve().then(()=>{setTimeout(l,0);});}function b(l){return new Promise(t=>setTimeout(t,l))}async function R(l,t){let{maxAttempts:n=3,delayMs:e=100,backoff:r=o=>e*Math.pow(2,o)}=t||{},i=null;for(let o=0;o<n;o++)try{return await l()}catch(u){if(i=u,o<n-1){let a=r(o);await b(a);}}throw i||new Error("Retry failed")}var h=Object.assign(l=>{},{cancel(){}}),y=Object.assign(l=>{},{cancel(){},flush(){}});function p(){if(j()!==null)throw new Error("[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.")}function d(l){b$1.enqueue(()=>{try{l();}catch(t){a.error("[Askr] FX handler error:",t);}});}function C(l,t,n){let{leading:e=false,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return y;let o=null,u=null,a=0,s=function(f){p();let c=Date.now();u=f,o!==null&&(clearTimeout(o),o=null),e&&c-a>=l&&(d(()=>t.call(null,f)),a=c),r&&(o=setTimeout(()=>{u&&d(()=>t.call(null,u)),o=null,a=Date.now();},l));};return s.cancel=()=>{o!==null&&(clearTimeout(o),o=null),u=null;},s.flush=()=>{if(o!==null){clearTimeout(o);let f=u;u=null,o=null,f&&d(()=>t.call(null,f));}},i&&i.cleanupFns.push(()=>{s.cancel();}),s}function A(l,t,n){let{leading:e=true,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return h;let o=0,u=null,a=null,s=function(f){p();let c=Date.now();if(a=f,e&&c-o>=l?(d(()=>t.call(null,f)),o=c,u!==null&&(clearTimeout(u),u=null)):!e&&o===0&&(o=c),r&&u===null){let w=l-(c-o);u=setTimeout(()=>{a&&d(()=>t.call(null,a)),o=Date.now(),u=null;},Math.max(0,w));}};return s.cancel=()=>{u!==null&&(clearTimeout(u),u=null),a=null;},i&&i.cleanupFns.push(()=>s.cancel()),s}function L(l){let t=j();if(t&&t.ssr)return h;let n=null,e=null,r=()=>{n=(typeof requestAnimationFrame<"u"?requestAnimationFrame:u=>setTimeout(()=>u(Date.now()),16))(()=>{if(n=null,e){let u=e;e=null,d(()=>l.call(null,u));}});},i=function(o){p(),e=o,n===null&&r();};return i.cancel=()=>{n!==null&&(typeof cancelAnimationFrame<"u"&&typeof n=="number"?cancelAnimationFrame(n):clearTimeout(n),n=null),e=null;},t&&t.cleanupFns.push(()=>i.cancel()),i}function q(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=setTimeout(()=>{e=null,d(t);},l),r=()=>{e!==null&&(clearTimeout(e),e=null);};return n&&n.cleanupFns.push(r),r}function D(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=null,r=false;typeof requestIdleCallback<"u"?(r=true,e=requestIdleCallback(()=>{e=null,d(l);},t)):e=setTimeout(()=>{e=null,d(l);},0);let i=()=>{e!==null&&(r&&typeof cancelIdleCallback<"u"&&typeof e=="number"?cancelIdleCallback(e):clearTimeout(e),e=null);};return n&&n.cleanupFns.push(i),i}function O(l,t){p();let n=j();if(n&&n.ssr)return {cancel:()=>{}};let{maxAttempts:e=3,delayMs:r=100,backoff:i=s=>r*Math.pow(2,s)}=t||{},o=false,u=s=>{o||b$1.enqueue(()=>{if(o)return;l().then(()=>{},()=>{if(!o&&s+1<e){let c=i(s);setTimeout(()=>{u(s+1);},c);}}).catch(c=>{a.error("[Askr] scheduleRetry error:",c);});});};u(0);let a$1=()=>{o=true;};return n&&n.cleanupFns.push(a$1),{cancel:a$1}}export{k as debounce,C as debounceEvent,g as defer,I as idle,x as once,F as raf,L as rafEvent,R as retry,D as scheduleIdle,O as scheduleRetry,q as scheduleTimeout,E as throttle,A as throttleEvent,b as timeout};
1
+ import {j,b as b$1}from'../chunk-65JSCTWN.js';import {a}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k(l,t,n){let e=null,{leading:r=false,trailing:i=true}=n||{},o=null,u=null,a=0,s=function(...f){let c=Date.now();o=f,u=this,e!==null&&clearTimeout(e),r&&c-a>=t&&(l.apply(this,f),a=c),i&&(e=setTimeout(()=>{l.apply(u,o),e=null,a=Date.now();},t));};return s.cancel=()=>{e!==null&&(clearTimeout(e),e=null);},s}function E(l,t,n){let e=0,r=null,{leading:i=true,trailing:o=true}=n||{},u=null,a=null,s=function(...f){let c=Date.now();u=f,a=this,i&&c-e>=t?(l.apply(this,f),e=c,r!==null&&(clearTimeout(r),r=null)):!i&&e===0&&(e=c),o&&r===null&&(r=setTimeout(()=>{l.apply(a,u),e=Date.now(),r=null;},t-(c-e)));};return s.cancel=()=>{r!==null&&(clearTimeout(r),r=null);},s}function x(l){let t=false,n;return((...e)=>(t||(t=true,n=l(...e)),n))}function g(l){Promise.resolve().then(l);}function F(l){let t=null,n=null,e=null;return function(...r){n=r,e=this,t===null&&(t=requestAnimationFrame(()=>{l.apply(e,n),t=null;}));}}function I(l,t){typeof requestIdleCallback<"u"?requestIdleCallback(l,t?{timeout:t.timeout}:void 0):Promise.resolve().then(()=>{setTimeout(l,0);});}function b(l){return new Promise(t=>setTimeout(t,l))}async function R(l,t){let{maxAttempts:n=3,delayMs:e=100,backoff:r=o=>e*Math.pow(2,o)}=t||{},i=null;for(let o=0;o<n;o++)try{return await l()}catch(u){if(i=u,o<n-1){let a=r(o);await b(a);}}throw i||new Error("Retry failed")}var h=Object.assign(l=>{},{cancel(){}}),y=Object.assign(l=>{},{cancel(){},flush(){}});function p(){if(j()!==null)throw new Error("[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.")}function d(l){b$1.enqueue(()=>{try{l();}catch(t){a.error("[Askr] FX handler error:",t);}});}function C(l,t,n){let{leading:e=false,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return y;let o=null,u=null,a=0,s=function(f){p();let c=Date.now();u=f,o!==null&&(clearTimeout(o),o=null),e&&c-a>=l&&(d(()=>t.call(null,f)),a=c),r&&(o=setTimeout(()=>{u&&d(()=>t.call(null,u)),o=null,a=Date.now();},l));};return s.cancel=()=>{o!==null&&(clearTimeout(o),o=null),u=null;},s.flush=()=>{if(o!==null){clearTimeout(o);let f=u;u=null,o=null,f&&d(()=>t.call(null,f));}},i&&i.cleanupFns.push(()=>{s.cancel();}),s}function A(l,t,n){let{leading:e=true,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return h;let o=0,u=null,a=null,s=function(f){p();let c=Date.now();if(a=f,e&&c-o>=l?(d(()=>t.call(null,f)),o=c,u!==null&&(clearTimeout(u),u=null)):!e&&o===0&&(o=c),r&&u===null){let w=l-(c-o);u=setTimeout(()=>{a&&d(()=>t.call(null,a)),o=Date.now(),u=null;},Math.max(0,w));}};return s.cancel=()=>{u!==null&&(clearTimeout(u),u=null),a=null;},i&&i.cleanupFns.push(()=>s.cancel()),s}function L(l){let t=j();if(t&&t.ssr)return h;let n=null,e=null,r=()=>{n=(typeof requestAnimationFrame<"u"?requestAnimationFrame:u=>setTimeout(()=>u(Date.now()),16))(()=>{if(n=null,e){let u=e;e=null,d(()=>l.call(null,u));}});},i=function(o){p(),e=o,n===null&&r();};return i.cancel=()=>{n!==null&&(typeof cancelAnimationFrame<"u"&&typeof n=="number"?cancelAnimationFrame(n):clearTimeout(n),n=null),e=null;},t&&t.cleanupFns.push(()=>i.cancel()),i}function q(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=setTimeout(()=>{e=null,d(t);},l),r=()=>{e!==null&&(clearTimeout(e),e=null);};return n&&n.cleanupFns.push(r),r}function D(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=null,r=false;typeof requestIdleCallback<"u"?(r=true,e=requestIdleCallback(()=>{e=null,d(l);},t)):e=setTimeout(()=>{e=null,d(l);},0);let i=()=>{e!==null&&(r&&typeof cancelIdleCallback<"u"&&typeof e=="number"?cancelIdleCallback(e):clearTimeout(e),e=null);};return n&&n.cleanupFns.push(i),i}function O(l,t){p();let n=j();if(n&&n.ssr)return {cancel:()=>{}};let{maxAttempts:e=3,delayMs:r=100,backoff:i=s=>r*Math.pow(2,s)}=t||{},o=false,u=s=>{o||b$1.enqueue(()=>{if(o)return;l().then(()=>{},()=>{if(!o&&s+1<e){let c=i(s);setTimeout(()=>{u(s+1);},c);}}).catch(c=>{a.error("[Askr] scheduleRetry error:",c);});});};u(0);let a$1=()=>{o=true;};return n&&n.cleanupFns.push(a$1),{cancel:a$1}}export{k as debounce,C as debounceEvent,g as defer,I as idle,x as once,F as raf,L as rafEvent,R as retry,D as scheduleIdle,O as scheduleRetry,q as scheduleTimeout,E as throttle,A as throttleEvent,b as timeout};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{a as For}from'./chunk-SBD6PT2Z.js';export{a as state}from'./chunk-2LY2VFSS.js';import {d}from'./chunk-4RTKQ7SC.js';import {b}from'./chunk-D2JSJKCW.js';import {j,g,p,i,o,b as b$1}from'./chunk-ED3HBBAN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import {a,b as b$2}from'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';var R=Symbol.for("__ASKR_HAS_ROUTES__");var N=0,l=new WeakMap,A=Symbol.for("__tempoCleanup__");function k(e,n){e[A]=()=>{let t=[];try{g(e);}catch(o){t.push(o);}try{let o=e.querySelectorAll("*");for(let s of Array.from(o))try{let r=s.__ASKR_INSTANCE;if(r){try{p(r);}catch(a){t.push(a);}try{delete s.__ASKR_INSTANCE;}catch(a){t.push(a);}}}catch(r){t.push(r);}}catch(o){t.push(o);}try{p(n);}catch(o){t.push(o);}if(t.length>0&&n.cleanupStrict)throw new AggregateError(t,"cleanup failed for app root")};try{let t=Object.getOwnPropertyDescriptor(e,"innerHTML")||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"innerHTML")||Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML");t&&(t.get||t.set)&&Object.defineProperty(e,"innerHTML",{get:t.get?function(){return t.get.call(this)}:void 0,set:function(o){if(o===""&&l.get(this)===n){try{g(e);}catch(s){if(n.cleanupStrict)throw s}try{p(n);}catch(s){if(n.cleanupStrict)throw s}}if(t.set)return t.set.call(this,o)},configurable:!0});}catch{}}function w(e,n,t){let o$1=(a$1,c)=>{let i=n(a$1,c),d$1={$$typeof:a,type:d,props:{},key:"__default_portal"};return {$$typeof:a,type:b$2,props:{children:i==null?[d$1]:[i,d$1]}}};Object.defineProperty(o$1,"name",{value:n.name||"Component"});let s=e[A];s&&s();let r=l.get(e);if(r){g(e);try{p(r);}catch{}r.fn=o$1,r.evaluationGeneration++,r.mounted=false,r.expectedStateIndices=[],r.firstRenderComplete=false,r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}else {let a=String(++N);r=i(a,o$1,{},e),l.set(e,r),r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}k(e,r),o(r),b$1.flush();}function L(e){if(b("islands"),!e||typeof e!="object")throw new Error("createIsland requires a config object");if(typeof e.component!="function")throw new Error("createIsland: component must be a function");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);if("routes"in e)throw new Error("createIsland does not accept routes; use createSPA for routed apps");try{if(globalThis[R])throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.")}catch{}w(n,e.component,{cleanupStrict:e.cleanupStrict});}async function M(e){if(b("spa"),!e||typeof e!="object")throw new Error("createSPA requires a config object");if(!Array.isArray(e.routes)||e.routes.length===0)throw new Error("createSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);let{clearRoutes:t,route:o,lockRouteRegistration:s,resolveRoute:r}=await import('./route-7P6D3WHZ.js');t();for(let p of e.routes)o(p.path,p.handler,p.namespace);s();let a=typeof window<"u"?window.location.pathname:"/",c=r(a);if(!c){w(n,()=>({type:"div",children:[]}),{cleanupStrict:false});let{registerAppInstance:p,initializeNavigation:b}=await import('./navigate-GJ64FKSW.js'),E=l.get(n);if(!E)throw new Error("Internal error: app instance missing");p(E,a),b();return}w(n,c.handler,{cleanupStrict:false});let{registerAppInstance:i,initializeNavigation:d}=await import('./navigate-GJ64FKSW.js'),y=l.get(n);if(!y)throw new Error("Internal error: app instance missing");i(y,a),d();}var O=new WeakMap;function _(e){let n=O.get(e);return n||(n=new Map,O.set(e,n)),n}function H(e,n){if(n===void 0&&typeof e=="function"){let a=e();if(a==null)return null;let c=j();if(!c)return a;let i=_(c);return i.has(a)?i.get(a):(i.set(a,a),a)}let t;if(typeof e=="function"&&!("value"in e)?t=e():t=e?.value??e,t==null)return null;let o=j();if(!o)return n(t);let s=_(o);if(s.has(t))return s.get(t);let r=n(t);return s.set(t,r),r}export{L as createIsland,M as createSPA,H as derive};
1
+ export{a as For}from'./chunk-74KTJLWR.js';export{a as state}from'./chunk-TWPSACYW.js';import {d}from'./chunk-4RTKQ7SC.js';import {b}from'./chunk-D2JSJKCW.js';import {j,g,p,i,o,b as b$1}from'./chunk-65JSCTWN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import {a,b as b$2}from'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';var R=Symbol.for("__ASKR_HAS_ROUTES__");var N=0,l=new WeakMap,A=Symbol.for("__tempoCleanup__");function k(e,n){e[A]=()=>{let t=[];try{g(e);}catch(o){t.push(o);}try{let o=e.querySelectorAll("*");for(let s of Array.from(o))try{let r=s.__ASKR_INSTANCE;if(r){try{p(r);}catch(a){t.push(a);}try{delete s.__ASKR_INSTANCE;}catch(a){t.push(a);}}}catch(r){t.push(r);}}catch(o){t.push(o);}try{p(n);}catch(o){t.push(o);}if(t.length>0&&n.cleanupStrict)throw new AggregateError(t,"cleanup failed for app root")};try{let t=Object.getOwnPropertyDescriptor(e,"innerHTML")||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"innerHTML")||Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML");t&&(t.get||t.set)&&Object.defineProperty(e,"innerHTML",{get:t.get?function(){return t.get.call(this)}:void 0,set:function(o){if(o===""&&l.get(this)===n){try{g(e);}catch(s){if(n.cleanupStrict)throw s}try{p(n);}catch(s){if(n.cleanupStrict)throw s}}if(t.set)return t.set.call(this,o)},configurable:!0});}catch{}}function w(e,n,t){let o$1=(a$1,c)=>{let i=n(a$1,c),d$1={$$typeof:a,type:d,props:{},key:"__default_portal"};return {$$typeof:a,type:b$2,props:{children:i==null?[d$1]:[i,d$1]}}};Object.defineProperty(o$1,"name",{value:n.name||"Component"});let s=e[A];s&&s();let r=l.get(e);if(r){g(e);try{p(r);}catch{}r.fn=o$1,r.evaluationGeneration++,r.mounted=false,r.expectedStateIndices=[],r.firstRenderComplete=false,r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}else {let a=String(++N);r=i(a,o$1,{},e),l.set(e,r),r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}k(e,r),o(r),b$1.flush();}function L(e){if(b("islands"),!e||typeof e!="object")throw new Error("createIsland requires a config object");if(typeof e.component!="function")throw new Error("createIsland: component must be a function");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);if("routes"in e)throw new Error("createIsland does not accept routes; use createSPA for routed apps");try{if(globalThis[R])throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.")}catch{}w(n,e.component,{cleanupStrict:e.cleanupStrict});}async function M(e){if(b("spa"),!e||typeof e!="object")throw new Error("createSPA requires a config object");if(!Array.isArray(e.routes)||e.routes.length===0)throw new Error("createSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);let{clearRoutes:t,route:o,lockRouteRegistration:s,resolveRoute:r}=await import('./route-SRINEX4U.js');t();for(let p of e.routes)o(p.path,p.handler,p.namespace);s();let a=typeof window<"u"?window.location.pathname:"/",c=r(a);if(!c){w(n,()=>({type:"div",children:[]}),{cleanupStrict:false});let{registerAppInstance:p,initializeNavigation:b}=await import('./navigate-GD4BICON.js'),E=l.get(n);if(!E)throw new Error("Internal error: app instance missing");p(E,a),b();return}w(n,c.handler,{cleanupStrict:false});let{registerAppInstance:i,initializeNavigation:d}=await import('./navigate-GD4BICON.js'),y=l.get(n);if(!y)throw new Error("Internal error: app instance missing");i(y,a),d();}var O=new WeakMap;function _(e){let n=O.get(e);return n||(n=new Map,O.set(e,n)),n}function H(e,n){if(n===void 0&&typeof e=="function"){let a=e();if(a==null)return null;let c=j();if(!c)return a;let i=_(c);return i.has(a)?i.get(a):(i.set(a,a),a)}let t;if(typeof e=="function"&&!("value"in e)?t=e():t=e?.value??e,t==null)return null;let o=j();if(!o)return n(t);let s=_(o);if(s.has(t))return s.get(t);let r=n(t);return s.set(t,r),r}export{L as createIsland,M as createSPA,H as derive};
@@ -0,0 +1 @@
1
+ export{d as cleanupNavigation,c as initializeNavigation,b as navigate,a as registerAppInstance}from'./chunk-ZREZCRWE.js';import'./chunk-R4G2E76D.js';import'./chunk-D2JSJKCW.js';import'./chunk-65JSCTWN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
@@ -1 +1 @@
1
- import {a}from'../chunk-2LY2VFSS.js';import {c,a as a$1}from'../chunk-YRY4OLQF.js';import {j,d as d$1,b,c as c$1}from'../chunk-ED3HBBAN.js';export{m as getSignal}from'../chunk-ED3HBBAN.js';import {a as a$2}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';var d=class{constructor(o,a,i){this.value=null;this.pending=true;this.error=null;this.generation=0;this.controller=null;this.deps=null;this.resourceFrame=null;this.subscribers=new Set;this.fn=o,this.deps=a?a.slice():null,this.resourceFrame=i,this.snapshot={value:null,pending:true,error:null,refresh:()=>this.refresh()};}subscribe(o){return this.subscribers.add(o),()=>this.subscribers.delete(o)}notifySubscribers(){this.snapshot.value=this.value,this.snapshot.pending=this.pending,this.snapshot.error=this.error;for(let o of this.subscribers)o();}start(o=false,a=true){let i=this.generation;this.controller?.abort();let l=new AbortController;this.controller=l,this.pending=true,this.error=null,a&&this.notifySubscribers();let u;try{u=c$1(this.resourceFrame,()=>this.fn({signal:l.signal}));}catch(t){this.pending=false,this.error=t,a&&this.notifySubscribers();return}if(!(u instanceof Promise)){this.value=u,this.pending=false,this.error=null,a&&this.notifySubscribers();return}o&&c().throwSSRDataMissing(),u.then(t=>{this.generation===i&&this.controller===l&&(this.value=t,this.pending=false,this.error=null,this.notifySubscribers());}).catch(t=>{if(this.generation===i&&this.controller===l){this.pending=false,this.error=t;try{this.ownerName?a$2.error(`[Askr] Async resource error in ${this.ownerName}:`,t):a$2.error("[Askr] Async resource error:",t);}catch{}this.notifySubscribers();}});}refresh(){this.generation++,this.controller?.abort(),this.start();}abort(){this.controller?.abort();}};function x(b$1,o=[]){let a$2=j(),i=a$2;if(!a$2){let r=c(),e=r.getCurrentRenderData();if(e){let n=r.getNextKey();return n in e||r.throwSSRDataMissing(),{value:e[n],pending:false,error:null,refresh:()=>{}}}throw r.getCurrentSSRContext()&&r.throwSSRDataMissing(),new Error("[Askr] resource() must be called during component render inside an app. Do not create resources at module scope or outside render.")}let l=c(),u=l.getCurrentRenderData();if(u){let r=l.getNextKey();r in u||l.throwSSRDataMissing();let e=u[r],p=a({cell:void 0,snapshot:{value:e,pending:false,error:null,refresh:()=>{}}}),n=p();return n.snapshot.value=e,n.snapshot.pending=false,n.snapshot.error=null,p.set(n),n.snapshot}let t=a({cell:void 0,snapshot:{value:null,pending:true,error:null,refresh:()=>{}}}),c$1=t();if(!c$1.cell){let r=d$1(),e=new d(b$1,o,r);e.ownerName=i.fn?.name||"<anonymous>",c$1.cell=e,c$1.snapshot=e.snapshot;let p=e.subscribe(()=>{let n=t();n.snapshot.value=e.snapshot.value,n.snapshot.pending=e.snapshot.pending,n.snapshot.error=e.snapshot.error,t.set(n);try{i._enqueueRun?.();}catch{}});if(i.cleanupFns.push(()=>{p(),e.abort();}),i.ssr){if(e.start(true,false),!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error;}}else b.enqueue(()=>{try{e.start(!1,!1);}catch(n){let h=t();h.snapshot.value=e.value,h.snapshot.pending=e.pending,h.snapshot.error=n??null,t.set(h),i._enqueueRun?.();return}if(!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error,t.set(n),i._enqueueRun?.();}});}let s=c$1.cell;if(!s.deps||s.deps.length!==o.length||s.deps.some((r,e)=>r!==o[e])){s.deps=o.slice(),s.generation++,s.pending=true,s.error=null;try{if(i.ssr){if(s.start(!0,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error;}}else b.enqueue(()=>{if(s.start(!1,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error,t.set(r),i._enqueueRun?.();}});}catch(r){if(r instanceof a$1)throw r;s.error=r,s.pending=false;let e=t();e.snapshot.value=s.value,e.snapshot.pending=s.pending,e.snapshot.error=s.error;}}return c$1.snapshot}export{x as resource};
1
+ import {a}from'../chunk-TWPSACYW.js';import {c,a as a$1}from'../chunk-YRY4OLQF.js';import {j,d as d$1,b,c as c$1}from'../chunk-65JSCTWN.js';export{m as getSignal}from'../chunk-65JSCTWN.js';import {a as a$2}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';var d=class{constructor(o,a,i){this.value=null;this.pending=true;this.error=null;this.generation=0;this.controller=null;this.deps=null;this.resourceFrame=null;this.subscribers=new Set;this.fn=o,this.deps=a?a.slice():null,this.resourceFrame=i,this.snapshot={value:null,pending:true,error:null,refresh:()=>this.refresh()};}subscribe(o){return this.subscribers.add(o),()=>this.subscribers.delete(o)}notifySubscribers(){this.snapshot.value=this.value,this.snapshot.pending=this.pending,this.snapshot.error=this.error;for(let o of this.subscribers)o();}start(o=false,a=true){let i=this.generation;this.controller?.abort();let l=new AbortController;this.controller=l,this.pending=true,this.error=null,a&&this.notifySubscribers();let u;try{u=c$1(this.resourceFrame,()=>this.fn({signal:l.signal}));}catch(t){this.pending=false,this.error=t,a&&this.notifySubscribers();return}if(!(u instanceof Promise)){this.value=u,this.pending=false,this.error=null,a&&this.notifySubscribers();return}o&&c().throwSSRDataMissing(),u.then(t=>{this.generation===i&&this.controller===l&&(this.value=t,this.pending=false,this.error=null,this.notifySubscribers());}).catch(t=>{if(this.generation===i&&this.controller===l){this.pending=false,this.error=t;try{this.ownerName?a$2.error(`[Askr] Async resource error in ${this.ownerName}:`,t):a$2.error("[Askr] Async resource error:",t);}catch{}this.notifySubscribers();}});}refresh(){this.generation++,this.controller?.abort(),this.start();}abort(){this.controller?.abort();}};function x(b$1,o=[]){let a$2=j(),i=a$2;if(!a$2){let r=c(),e=r.getCurrentRenderData();if(e){let n=r.getNextKey();return n in e||r.throwSSRDataMissing(),{value:e[n],pending:false,error:null,refresh:()=>{}}}throw r.getCurrentSSRContext()&&r.throwSSRDataMissing(),new Error("[Askr] resource() must be called during component render inside an app. Do not create resources at module scope or outside render.")}let l=c(),u=l.getCurrentRenderData();if(u){let r=l.getNextKey();r in u||l.throwSSRDataMissing();let e=u[r],p=a({cell:void 0,snapshot:{value:e,pending:false,error:null,refresh:()=>{}}}),n=p();return n.snapshot.value=e,n.snapshot.pending=false,n.snapshot.error=null,p.set(n),n.snapshot}let t=a({cell:void 0,snapshot:{value:null,pending:true,error:null,refresh:()=>{}}}),c$1=t();if(!c$1.cell){let r=d$1(),e=new d(b$1,o,r);e.ownerName=i.fn?.name||"<anonymous>",c$1.cell=e,c$1.snapshot=e.snapshot;let p=e.subscribe(()=>{let n=t();n.snapshot.value=e.snapshot.value,n.snapshot.pending=e.snapshot.pending,n.snapshot.error=e.snapshot.error,t.set(n);try{i._enqueueRun?.();}catch{}});if(i.cleanupFns.push(()=>{p(),e.abort();}),i.ssr){if(e.start(true,false),!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error;}}else b.enqueue(()=>{try{e.start(!1,!1);}catch(n){let h=t();h.snapshot.value=e.value,h.snapshot.pending=e.pending,h.snapshot.error=n??null,t.set(h),i._enqueueRun?.();return}if(!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error,t.set(n),i._enqueueRun?.();}});}let s=c$1.cell;if(!s.deps||s.deps.length!==o.length||s.deps.some((r,e)=>r!==o[e])){s.deps=o.slice(),s.generation++,s.pending=true,s.error=null;try{if(i.ssr){if(s.start(!0,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error;}}else b.enqueue(()=>{if(s.start(!1,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error,t.set(r),i._enqueueRun?.();}});}catch(r){if(r instanceof a$1)throw r;s.error=r,s.pending=false;let e=t();e.snapshot.value=s.value,e.snapshot.pending=s.pending,e.snapshot.error=s.error;}}return c$1.snapshot}export{x as resource};
@@ -1 +1 @@
1
- export{c as _lockRouteRegistrationForTests,d as _unlockRouteRegistrationForTests,i as clearRoutes,k as getLoadedNamespaces,g as getNamespaceRoutes,f as getRoutes,b as lockRouteRegistration,j as registerRoute,l as resolveRoute,e as route,a as setServerLocation,h as unloadNamespace}from'./chunk-NLFOBEE4.js';import'./chunk-D2JSJKCW.js';import'./chunk-ED3HBBAN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
1
+ export{c as _lockRouteRegistrationForTests,d as _unlockRouteRegistrationForTests,i as clearRoutes,k as getLoadedNamespaces,g as getNamespaceRoutes,f as getRoutes,b as lockRouteRegistration,j as registerRoute,l as resolveRoute,e as route,a as setServerLocation,h as unloadNamespace}from'./chunk-R4G2E76D.js';import'./chunk-D2JSJKCW.js';import'./chunk-65JSCTWN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
@@ -1,4 +1,4 @@
1
- import { a as RouteSnapshot, b as RouteHandler, R as Route } from '../router-DaGtH1Sq.js';
1
+ import { R as Route, a as RouteSnapshot, b as RouteHandler } from '../router-DaGtH1Sq.js';
2
2
  export { c as RouteMatch, d as RouteQuery } from '../router-DaGtH1Sq.js';
3
3
  export { l as layout } from '../layout-BINPv-nz.js';
4
4
 
@@ -1 +1 @@
1
- import {b}from'../chunk-SGJLVHOK.js';export{b as navigate}from'../chunk-SGJLVHOK.js';import {i,b as b$2}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-NLFOBEE4.js';import'../chunk-D2JSJKCW.js';import'../chunk-ED3HBBAN.js';import'../chunk-HGMOQ3I7.js';import {b as b$1}from'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k({href:r,class:s,children:u,rel:l,target:o,"aria-current":p,"aria-label":c}){let m=i({isNative:true,disabled:false,onPress:f=>{let t=f;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||o||(t.preventDefault(),b(r));}});return b$1("a",b$2(m,{href:r,class:s,rel:l,target:o,"aria-current":p,"aria-label":c,children:u}))}export{k as Link};
1
+ import {b}from'../chunk-ZREZCRWE.js';export{b as navigate}from'../chunk-ZREZCRWE.js';import {i,b as b$2}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-R4G2E76D.js';import'../chunk-D2JSJKCW.js';import'../chunk-65JSCTWN.js';import'../chunk-HGMOQ3I7.js';import {b as b$1}from'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k({href:r,class:s,children:u,rel:l,target:o,"aria-current":p,"aria-label":c}){let m=i({isNative:true,disabled:false,onPress:f=>{let t=f;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||o||(t.preventDefault(),b(r));}});return b$1("a",b$2(m,{href:r,class:s,rel:l,target:o,"aria-current":p,"aria-label":c,children:u}))}export{k as Link};
package/dist/ssr/index.js CHANGED
@@ -1 +1 @@
1
- import {d}from'../chunk-4RTKQ7SC.js';import {b as b$1,a as a$1}from'../chunk-YRY4OLQF.js';export{a as SSRDataMissingError}from'../chunk-YRY4OLQF.js';import {m}from'../chunk-NLFOBEE4.js';import'../chunk-D2JSJKCW.js';import {j,i,k as k$1}from'../chunk-ED3HBBAN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$2,a as a$2}from'../chunk-37RC6ZT3.js';import {a}from'../chunk-62D2TNHX.js';var b=null;try{let n=a("async_hooks");n?.AsyncLocalStorage&&(b=new n.AsyncLocalStorage);}catch{}var N=null;function D(n=12345,e={}){return {url:e.url??"",seed:n,data:e.data,params:e.params,signal:e.signal,keyCounter:0,renderData:null}}function _(n,e){if(b)return b.run(n,e);let t=N;N=n;try{return e()}finally{N=t;}}function y(){return b?b.getStore()??null:N}function x(){throw new a$1}function Q(){return y()?.renderData??null}function ee(){let n=y();return n?`r:${n.keyCounter++}`:"r:0"}function T(n){let e=y();e&&(e.renderData=n??null,e.keyCounter=0);}function v(){let n=y();n&&(n.renderData=null,n.keyCounter=0);}var ne="SSR collection/prepass is removed: SSR is strictly synchronous";async function te(n){throw new Error(`${ne}; async resource plans are not supported`)}function fe(n){throw new Error(`${ne}; collectResources is disabled`)}var pe=te;var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E=new Map,re=256,le=/[&<>]/g,de=/[&"'<>]/g,ge=/[{}<>\\]/g,Se=/(?:url|expression|javascript)\s*\(/i,I=new Map,me=512,ye=n=>{let e=n.charCodeAt(0);return e===38?"&amp;":e===60?"&lt;":e===62?"&gt;":n},he=n=>{let e=n.charCodeAt(0);return e===38?"&amp;":e===34?"&quot;":e===39?"&#x27;":e===60?"&lt;":e===62?"&gt;":n};function Re(n){let e=I.get(n);if(e!==void 0)return e;let t=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);return I.size<me&&I.set(n,t),t}function we(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===60||t===62)return true}return false}function X(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===34||t===39||t===60||t===62)return true}return false}function h(n){let e=n.length<=64;if(e){let r=E.get(n);if(r!==void 0)return r}if(!we(n))return e&&E.size<re&&E.set(n,n),n;let t=n.replace(le,ye);return e&&E.size<re&&E.set(n,t),t}function k(n){return n.replace(de,he)}function Ce(n){let e=String(n),t=false,r=-1;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s===123||s===125||s===60||s===62||s===92){if(t=true,r>=0)break}else if(s===40&&r<0&&(r=o,t))break}return !t&&r===-1?e:r!==-1&&Se.test(e)?"":t?e.replace(ge,""):e}function J(n){if(!n||typeof n!="object")return null;let e=n,t="";for(let r in e){let o=e[r];if(o==null||o===false)continue;let s=Re(r),a=Ce(String(o));a&&(t+=`${s}:${a};`);}return t||null}function oe(n){return n.length>=3&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>=65&&n.charCodeAt(2)<=90}function U(n,e){if(!n||typeof n!="object")return;let t=n;for(let r in t){let o=t[r];if(r==="children"||r==="key"||r==="ref"||r==="dangerouslySetInnerHTML"||oe(r)||r.charCodeAt(0)===95)continue;let s=r==="className"?"class":r;if(s==="style"){let i=typeof o=="string"?o:J(o);if(!i)continue;e.write(' style="'),X(i)?e.write(k(i)):e.write(i),e.write('"');continue}if(o===true){e.write(" "),e.write(s);continue}if(o===false||o===null||o===void 0)continue;let a=String(o);e.write(" "),e.write(s),e.write('="'),X(a)?e.write(k(a)):e.write(a),e.write('"');}}function P(n,e){if(!n||typeof n!="object")return e?.returnDangerousHtml?{attrs:""}:"";let t=[],r,o=n;for(let a in o){let i=o[a];if(a==="children"||a==="key"||a==="ref")continue;if(a==="dangerouslySetInnerHTML"){i&&typeof i=="object"&&"__html"in i&&(r=String(i.__html));continue}if(oe(a)||a.charCodeAt(0)===95)continue;let c=a==="class"||a==="className"?"class":a;if(c==="style"){let p=typeof i=="string"?i:J(i);if(p===null||p==="")continue;t.push(` style="${k(p)}"`);continue}if(i===true)t.push(` ${c}`);else {if(i===false||i===null||i===void 0)continue;{let p=String(i);t.push(` ${c}="${k(p)}"`);}}}let s=t.join("");return e?.returnDangerousHtml?{attrs:s,dangerousHtml:r}:s}var R=class R{constructor(){this.chunks=[];this.bufferChunks=[];this.bufferLen=0;}write(e){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length,this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0));}write2(e,t){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}write3(e,t,r){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),r&&(this.bufferChunks.push(r),this.bufferLen+=r.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}end(){this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}toString(){return this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0),this.chunks.join("")}};R.FLUSH_THRESHOLD=32*1024;var w=R,V=class{constructor(e,t){this.onChunk=e;this.onComplete=t;}write(e){e&&this.onChunk(e);}end(){this.onComplete();}};function be(n){return !n||typeof n!="object"?false:typeof n.then=="function"}function xe(n,e,t){let r=n(e??{},{signal:t.signal});return be(r)&&x(),r}function F(n,e,t){let r=n.children;if(r===void 0&&(r=n.props?.children),!(r==null||r===false)){if(Array.isArray(r)){for(let o=0;o<r.length;o++)A(r[o],e,t);return}A(r,e,t);}}function A(n,e,t){if(n==null)return;if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(String(n));return}if(typeof n=="boolean"||typeof n!="object")return;let r=n,o=r.type;if(o===b$2){F(r,e,t);return}if(typeof o=="symbol"){F(r,e,t);return}if(typeof o=="function"){let p=xe(o,r.props,t);A(p,e,t);return}let s=o,a=r.props,i=a?.dangerouslySetInnerHTML,c=i&&typeof i=="object"&&"__html"in i?String(i.__html):void 0;if(L.has(s)){e.write("<"),e.write(s),U(a,e),e.write(" />");return}e.write("<"),e.write(s),U(a,e),e.write(">"),c!==void 0?e.write(c):F(r,e,t),e.write("</"),e.write(s),e.write(">");}var G=new Map;function C(n){let e=G.get(n);return e||(e={open:`<${n}`,close:`</${n}>`,selfClose:`<${n} />`},G.size<256&&G.set(n,e)),e}b$1({getCurrentSSRContext:y,throwSSRDataMissing:x,getCurrentRenderData:Q,getNextKey:ee});function Ye(){}function Ze(){}function Ee(n,e,t){if(!(n==null||n===false)){if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(h(String(n)));return}n&&typeof n=="object"&&"type"in n&&H(n,e,t);}}function K(n,e,t){if(!(!n||!Array.isArray(n)||n.length===0))for(let r=0;r<n.length;r++)Ee(n[r],e,t);}function H(n,e,t){let{type:r,props:o}=n;if(typeof r=="function"){let u=z(r,o,t);H(u,e,t);return}if(typeof r=="symbol"){if(r===b$2){let u=Array.isArray(n.children)?n.children:Array.isArray(o?.children)?o?.children:void 0;K(u,e,t);return}throw new Error(`renderNodeSyncToSink: unsupported VNode symbol type: ${String(r)}`)}let s=r;if(L.has(s)){let u=o?P(o):"",{selfClose:f}=C(s);e.write(u?`${f.slice(0,-3)}${u} />`:f);return}let a=o?o?.dangerouslySetInnerHTML:void 0;if(a!=null){let{attrs:u,dangerousHtml:f}=P(o,{returnDangerousHtml:true}),{open:d,close:l}=C(s);e.write(u?`${d}${u}>`:`${d}>`),f!==void 0?e.write(f):K(n.children,e,t),e.write(l);return}let i=o?P(o):"",c=n.children;if(c===void 0&&o?.children!==void 0){let u=o.children;Array.isArray(u)?c=u:u!==null&&u!==false&&(c=[u]);}if(!c||Array.isArray(c)&&c.length===0){let{open:u,close:f}=C(s);e.write(i?`${u}${i}>${f}`:`${u}>${f}`);return}if(Array.isArray(c)&&c.length===1){let u=c[0];if(typeof u=="string"){let{open:f,close:d}=C(s),l=h(u);e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}if(typeof u=="number"){let{open:f,close:d}=C(s),l=h(String(u));e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}}let{open:p,close:S}=C(s);e.write(i?`${p}${i}>`:`${p}>`),K(c,e,t),e.write(S);}function z(n,e,t){{let r=j(),o=i("ssr-temp",n,e||{},null);o.ssr=true,k$1(o);try{let s=n(e||{},{ssr:t});if(s instanceof Promise&&x(),typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null||s===void 0){let a=s==null||s===!1?"":String(s);return {$$typeof:a$2,type:b$2,props:{children:a?[a]:[]}}}return s}finally{k$1(r);}}}function ke(n,e,t){let r=t?.seed??12345,o=D(r,{data:t?.data});return _(o,()=>{T(t?.data??null);try{let a=z((c,p)=>{let S=n(c??{},p),u={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return S==null?{$$typeof:a$2,type:b$2,props:{children:[u]}}:{$$typeof:a$2,type:b$2,props:{children:[S,u]}}},e||{},o);if(!a)throw new Error("renderToStringSync: wrapped component returned empty");let i=new w;return H(a,i,o),i.end(),i.toString()}finally{v();}})}function qe(n){let{url:e,routes:t,options:r}=n,{clearRoutes:o,route:s,setServerLocation:a,lockRouteRegistration:i,resolveRoute:c}=m;o();for(let f of t)s(f.path,f.handler,f.namespace);a(e),i();let p=c(e);if(!p)throw new Error(`renderToStringSync: no route found for url: ${e}`);let S=r?.seed??12345,u=D(S,{url:e,data:r?.data});return _(u,()=>{T(r?.data??null);try{let d$1=z((ue,ae)=>{let B=p.handler(ue??{},ae),Y={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return B==null?{$$typeof:a$2,type:b$2,props:{children:[Y]}}:{$$typeof:a$2,type:b$2,props:{children:[B,Y]}}},p.params||{},u),l=new w;return H(d$1,l,u),l.end(),l.toString()}finally{v();}})}function nn(n){if(typeof n=="function")return ke(n);let e=n,t=new w;return ie({...e,sink:t}),t.end(),t.toString()}function tn(n){let e=new V(n.onChunk,n.onComplete);ie({...n,sink:e}),e.end();}function ie(n){let{url:e,routes:t,seed:r=12345,data:o,sink:s}=n,{clearRoutes:a,route:i,setServerLocation:c,lockRouteRegistration:p,resolveRoute:S}=m;a();for(let l of t)i(l.path,l.handler,l.namespace);c(e),p();let u=S(e);if(!u)throw new Error(`SSR: no route found for url: ${e}`);let f=D(r,{url:e,data:o,params:u.params}),d=u.handler(u.params);_(f,()=>{T(o||null);try{A(d,s,f);}finally{v();}});}export{fe as collectResources,Ze as popSSRStrictPurityGuard,Ye as pushSSRStrictPurityGuard,tn as renderToStream,nn as renderToString,ke as renderToStringSync,qe as renderToStringSyncForUrl,te as resolvePlan,pe as resolveResources};
1
+ import {d}from'../chunk-4RTKQ7SC.js';import {b as b$1,a as a$1}from'../chunk-YRY4OLQF.js';export{a as SSRDataMissingError}from'../chunk-YRY4OLQF.js';import {m}from'../chunk-R4G2E76D.js';import'../chunk-D2JSJKCW.js';import {j,i,k as k$1}from'../chunk-65JSCTWN.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$2,a as a$2}from'../chunk-37RC6ZT3.js';import {a}from'../chunk-62D2TNHX.js';var b=null;try{let n=a("async_hooks");n?.AsyncLocalStorage&&(b=new n.AsyncLocalStorage);}catch{}var N=null;function D(n=12345,e={}){return {url:e.url??"",seed:n,data:e.data,params:e.params,signal:e.signal,keyCounter:0,renderData:null}}function _(n,e){if(b)return b.run(n,e);let t=N;N=n;try{return e()}finally{N=t;}}function y(){return b?b.getStore()??null:N}function x(){throw new a$1}function Q(){return y()?.renderData??null}function ee(){let n=y();return n?`r:${n.keyCounter++}`:"r:0"}function T(n){let e=y();e&&(e.renderData=n??null,e.keyCounter=0);}function v(){let n=y();n&&(n.renderData=null,n.keyCounter=0);}var ne="SSR collection/prepass is removed: SSR is strictly synchronous";async function te(n){throw new Error(`${ne}; async resource plans are not supported`)}function fe(n){throw new Error(`${ne}; collectResources is disabled`)}var pe=te;var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E=new Map,re=256,le=/[&<>]/g,de=/[&"'<>]/g,ge=/[{}<>\\]/g,Se=/(?:url|expression|javascript)\s*\(/i,I=new Map,me=512,ye=n=>{let e=n.charCodeAt(0);return e===38?"&amp;":e===60?"&lt;":e===62?"&gt;":n},he=n=>{let e=n.charCodeAt(0);return e===38?"&amp;":e===34?"&quot;":e===39?"&#x27;":e===60?"&lt;":e===62?"&gt;":n};function Re(n){let e=I.get(n);if(e!==void 0)return e;let t=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);return I.size<me&&I.set(n,t),t}function we(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===60||t===62)return true}return false}function X(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===34||t===39||t===60||t===62)return true}return false}function h(n){let e=n.length<=64;if(e){let r=E.get(n);if(r!==void 0)return r}if(!we(n))return e&&E.size<re&&E.set(n,n),n;let t=n.replace(le,ye);return e&&E.size<re&&E.set(n,t),t}function k(n){return n.replace(de,he)}function Ce(n){let e=String(n),t=false,r=-1;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s===123||s===125||s===60||s===62||s===92){if(t=true,r>=0)break}else if(s===40&&r<0&&(r=o,t))break}return !t&&r===-1?e:r!==-1&&Se.test(e)?"":t?e.replace(ge,""):e}function J(n){if(!n||typeof n!="object")return null;let e=n,t="";for(let r in e){let o=e[r];if(o==null||o===false)continue;let s=Re(r),a=Ce(String(o));a&&(t+=`${s}:${a};`);}return t||null}function oe(n){return n.length>=3&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>=65&&n.charCodeAt(2)<=90}function U(n,e){if(!n||typeof n!="object")return;let t=n;for(let r in t){let o=t[r];if(r==="children"||r==="key"||r==="ref"||r==="dangerouslySetInnerHTML"||oe(r)||r.charCodeAt(0)===95)continue;let s=r==="className"?"class":r;if(s==="style"){let i=typeof o=="string"?o:J(o);if(!i)continue;e.write(' style="'),X(i)?e.write(k(i)):e.write(i),e.write('"');continue}if(o===true){e.write(" "),e.write(s);continue}if(o===false||o===null||o===void 0)continue;let a=String(o);e.write(" "),e.write(s),e.write('="'),X(a)?e.write(k(a)):e.write(a),e.write('"');}}function P(n,e){if(!n||typeof n!="object")return e?.returnDangerousHtml?{attrs:""}:"";let t=[],r,o=n;for(let a in o){let i=o[a];if(a==="children"||a==="key"||a==="ref")continue;if(a==="dangerouslySetInnerHTML"){i&&typeof i=="object"&&"__html"in i&&(r=String(i.__html));continue}if(oe(a)||a.charCodeAt(0)===95)continue;let c=a==="class"||a==="className"?"class":a;if(c==="style"){let p=typeof i=="string"?i:J(i);if(p===null||p==="")continue;t.push(` style="${k(p)}"`);continue}if(i===true)t.push(` ${c}`);else {if(i===false||i===null||i===void 0)continue;{let p=String(i);t.push(` ${c}="${k(p)}"`);}}}let s=t.join("");return e?.returnDangerousHtml?{attrs:s,dangerousHtml:r}:s}var R=class R{constructor(){this.chunks=[];this.bufferChunks=[];this.bufferLen=0;}write(e){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length,this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0));}write2(e,t){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}write3(e,t,r){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),r&&(this.bufferChunks.push(r),this.bufferLen+=r.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}end(){this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}toString(){return this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0),this.chunks.join("")}};R.FLUSH_THRESHOLD=32*1024;var w=R,V=class{constructor(e,t){this.onChunk=e;this.onComplete=t;}write(e){e&&this.onChunk(e);}end(){this.onComplete();}};function be(n){return !n||typeof n!="object"?false:typeof n.then=="function"}function xe(n,e,t){let r=n(e??{},{signal:t.signal});return be(r)&&x(),r}function F(n,e,t){let r=n.children;if(r===void 0&&(r=n.props?.children),!(r==null||r===false)){if(Array.isArray(r)){for(let o=0;o<r.length;o++)A(r[o],e,t);return}A(r,e,t);}}function A(n,e,t){if(n==null)return;if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(String(n));return}if(typeof n=="boolean"||typeof n!="object")return;let r=n,o=r.type;if(o===b$2){F(r,e,t);return}if(typeof o=="symbol"){F(r,e,t);return}if(typeof o=="function"){let p=xe(o,r.props,t);A(p,e,t);return}let s=o,a=r.props,i=a?.dangerouslySetInnerHTML,c=i&&typeof i=="object"&&"__html"in i?String(i.__html):void 0;if(L.has(s)){e.write("<"),e.write(s),U(a,e),e.write(" />");return}e.write("<"),e.write(s),U(a,e),e.write(">"),c!==void 0?e.write(c):F(r,e,t),e.write("</"),e.write(s),e.write(">");}var G=new Map;function C(n){let e=G.get(n);return e||(e={open:`<${n}`,close:`</${n}>`,selfClose:`<${n} />`},G.size<256&&G.set(n,e)),e}b$1({getCurrentSSRContext:y,throwSSRDataMissing:x,getCurrentRenderData:Q,getNextKey:ee});function Ye(){}function Ze(){}function Ee(n,e,t){if(!(n==null||n===false)){if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(h(String(n)));return}n&&typeof n=="object"&&"type"in n&&H(n,e,t);}}function K(n,e,t){if(!(!n||!Array.isArray(n)||n.length===0))for(let r=0;r<n.length;r++)Ee(n[r],e,t);}function H(n,e,t){let{type:r,props:o}=n;if(typeof r=="function"){let u=z(r,o,t);H(u,e,t);return}if(typeof r=="symbol"){if(r===b$2){let u=Array.isArray(n.children)?n.children:Array.isArray(o?.children)?o?.children:void 0;K(u,e,t);return}throw new Error(`renderNodeSyncToSink: unsupported VNode symbol type: ${String(r)}`)}let s=r;if(L.has(s)){let u=o?P(o):"",{selfClose:f}=C(s);e.write(u?`${f.slice(0,-3)}${u} />`:f);return}let a=o?o?.dangerouslySetInnerHTML:void 0;if(a!=null){let{attrs:u,dangerousHtml:f}=P(o,{returnDangerousHtml:true}),{open:d,close:l}=C(s);e.write(u?`${d}${u}>`:`${d}>`),f!==void 0?e.write(f):K(n.children,e,t),e.write(l);return}let i=o?P(o):"",c=n.children;if(c===void 0&&o?.children!==void 0){let u=o.children;Array.isArray(u)?c=u:u!==null&&u!==false&&(c=[u]);}if(!c||Array.isArray(c)&&c.length===0){let{open:u,close:f}=C(s);e.write(i?`${u}${i}>${f}`:`${u}>${f}`);return}if(Array.isArray(c)&&c.length===1){let u=c[0];if(typeof u=="string"){let{open:f,close:d}=C(s),l=h(u);e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}if(typeof u=="number"){let{open:f,close:d}=C(s),l=h(String(u));e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}}let{open:p,close:S}=C(s);e.write(i?`${p}${i}>`:`${p}>`),K(c,e,t),e.write(S);}function z(n,e,t){{let r=j(),o=i("ssr-temp",n,e||{},null);o.ssr=true,k$1(o);try{let s=n(e||{},{ssr:t});if(s instanceof Promise&&x(),typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null||s===void 0){let a=s==null||s===!1?"":String(s);return {$$typeof:a$2,type:b$2,props:{children:a?[a]:[]}}}return s}finally{k$1(r);}}}function ke(n,e,t){let r=t?.seed??12345,o=D(r,{data:t?.data});return _(o,()=>{T(t?.data??null);try{let a=z((c,p)=>{let S=n(c??{},p),u={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return S==null?{$$typeof:a$2,type:b$2,props:{children:[u]}}:{$$typeof:a$2,type:b$2,props:{children:[S,u]}}},e||{},o);if(!a)throw new Error("renderToStringSync: wrapped component returned empty");let i=new w;return H(a,i,o),i.end(),i.toString()}finally{v();}})}function qe(n){let{url:e,routes:t,options:r}=n,{clearRoutes:o,route:s,setServerLocation:a,lockRouteRegistration:i,resolveRoute:c}=m;o();for(let f of t)s(f.path,f.handler,f.namespace);a(e),i();let p=c(e);if(!p)throw new Error(`renderToStringSync: no route found for url: ${e}`);let S=r?.seed??12345,u=D(S,{url:e,data:r?.data});return _(u,()=>{T(r?.data??null);try{let d$1=z((ue,ae)=>{let B=p.handler(ue??{},ae),Y={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return B==null?{$$typeof:a$2,type:b$2,props:{children:[Y]}}:{$$typeof:a$2,type:b$2,props:{children:[B,Y]}}},p.params||{},u),l=new w;return H(d$1,l,u),l.end(),l.toString()}finally{v();}})}function nn(n){if(typeof n=="function")return ke(n);let e=n,t=new w;return ie({...e,sink:t}),t.end(),t.toString()}function tn(n){let e=new V(n.onChunk,n.onComplete);ie({...n,sink:e}),e.end();}function ie(n){let{url:e,routes:t,seed:r=12345,data:o,sink:s}=n,{clearRoutes:a,route:i,setServerLocation:c,lockRouteRegistration:p,resolveRoute:S}=m;a();for(let l of t)i(l.path,l.handler,l.namespace);c(e),p();let u=S(e);if(!u)throw new Error(`SSR: no route found for url: ${e}`);let f=D(r,{url:e,data:o,params:u.params}),d=u.handler(u.params);_(f,()=>{T(o||null);try{A(d,s,f);}finally{v();}});}export{fe as collectResources,Ze as popSSRStrictPurityGuard,Ye as pushSSRStrictPurityGuard,tn as renderToStream,nn as renderToString,ke as renderToStringSync,qe as renderToStringSyncForUrl,te as resolvePlan,pe as resolveResources};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "devDependencies": {
88
88
  "@eslint/js": "^9.39.2",
89
- "@types/node": "^25.0.9",
89
+ "@types/node": "^25.0.10",
90
90
  "cross-env": "^10.1.0",
91
91
  "eslint": "^9.39.2",
92
92
  "eslint-config-prettier": "^10.1.8",
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-HGMOQ3I7.js';import {b}from'./chunk-37RC6ZT3.js';function pe(e,n,t){if(!e){let r=t?`
2
- `+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function Re(e,n){pe(e,`[Scheduler Precondition] ${n}`);}function ee(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var he=class{constructor(){this.q=[];this.head=0;this.running=false;this.inHandler=false;this.depth=0;this.executionDepth=0;this.flushVersion=0;this.kickScheduled=false;this.allowSyncProgress=false;this.waiters=[];this.taskCount=0;}enqueue(n){Re(typeof n=="function","enqueue() requires a function"),!(ee()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!ee()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!ee())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){pe(!this.running,"[Scheduler] flush() called while already running"),this.running=true,this.depth=0;let n=null;try{for(;this.head<this.q.length;){this.depth++;let t=this.q[this.head++];try{this.executionDepth++,t(),this.executionDepth--;}catch(r){this.executionDepth>0&&(this.executionDepth=0),n=r;break}this.taskCount>0&&this.taskCount--;}}finally{if(this.running=false,this.depth=0,this.executionDepth=0,this.head>=this.q.length)this.q.length=0,this.head=0;else if(this.head>0){let t=this.q.length-this.head;for(let r=0;r<t;r++)this.q[r]=this.q[this.head+r];this.q.length=t,this.head=0;}this.flushVersion++,this.resolveWaiters();}if(n)throw n}runWithSyncProgress(n){let t=this.allowSyncProgress;this.allowSyncProgress=true;let i=this.flushVersion;try{let a=n();return !this.running&&this.q.length-this.head>0&&this.flush(),a}finally{try{this.flushVersion===i&&(this.flushVersion++,this.resolveWaiters());}catch(a){}this.allowSyncProgress=t;}}waitForFlush(n,t=2e3){let r=typeof n=="number"?n:this.flushVersion+1;return this.flushVersion>=r?Promise.resolve():new Promise((o,s)=>{let i=setTimeout(()=>{let a=globalThis.__ASKR__||{},u={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:ee(),namespace:a};s(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(u)}`));},t);this.waiters.push({target:r,resolve:o,reject:s,timer:i});})}getState(){return {queueLength:this.q.length-this.head,running:this.running,depth:this.depth,executionDepth:this.executionDepth,taskCount:this.taskCount,flushVersion:this.flushVersion,inHandler:this.inHandler,allowSyncProgress:this.allowSyncProgress}}setInHandler(n){this.inHandler=n;}isInHandler(){return this.inHandler}isExecuting(){return this.running||this.executionDepth>0}clearPendingSyncTasks(){let n=this.q.length-this.head;return n<=0?0:this.running?(this.q.length=this.head,this.taskCount=Math.max(0,this.taskCount-n),queueMicrotask(()=>{try{this.flushVersion++,this.resolveWaiters();}catch(t){}}),n):(this.q.length=0,this.head=0,this.taskCount=Math.max(0,this.taskCount-n),this.flushVersion++,this.resolveWaiters(),n)}resolveWaiters(){if(this.waiters.length===0)return;let n=[],t=[];for(let r of this.waiters)this.flushVersion>=r.target?(r.timer&&clearTimeout(r.timer),n.push(r.resolve)):t.push(r);this.waiters=t;for(let r of n)r();}},N=new he;function we(){return N.isExecuting()}var xe=Symbol("__tempoContextFrame__"),ne=null;function q(e,n){let t=ne;ne=e;try{return n()}finally{ne=t;}}function Rt(e,n){try{return n()}finally{}}function Fe(){return ne}function Me(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function T(e,n){try{let t=Me();t[e]=n;try{let r=globalThis;try{let o=r.__ASKR__||(r.__ASKR__={});try{o[e]=n;}catch(s){}}catch(o){}}catch(r){}}catch(t){}}function v(e){try{let n=Me(),r=(typeof n[e]=="number"?n[e]:0)+1;n[e]=r;try{let o=globalThis,s=o.__ASKR__||(o.__ASKR__={});try{let i=typeof s[e]=="number"?s[e]:0;s[e]=i+1;}catch(i){}}catch(o){}}catch(n){}}function j(e){return !e.startsWith("on")||e.length<=2?null:e.slice(2).charAt(0).toLowerCase()+e.slice(3).toLowerCase()}function $(e){if(e==="wheel"||e==="scroll"||e.startsWith("touch"))return {passive:true}}function W(e,n=false){return t=>{N.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(N.setInHandler(false),n){let r=N.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{N.isExecuting()||N.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function ye(e){return e==="children"||e==="key"||e==="ref"}function te(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function _e(e,n,t){try{if(n==="class"||n==="className")return e.className!==String(t);if(n==="value"||n==="checked")return e[n]!==t;let r=e.getAttribute(n);return t==null||t===!1?r!==null:String(t)!==r}catch{return true}}function Ie(e){for(let n of Object.keys(e))if(!te(n))return true;return false}function Pe(e,n){for(let t of Object.keys(n))if(!te(t)&&_e(e,t,n[t]))return true;return false}function O(e){if(typeof e!="object"||e===null)return;let n=e,t=n.key??n.props?.key;if(t!==void 0)return typeof t=="symbol"?String(t):t}function Oe(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function re(e){try{v("__DOM_REPLACE_COUNT"),T(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function oe(e,n){try{T("__LAST_FASTPATH_STATS",e),T("__LAST_FASTPATH_COMMIT_COUNT",1),n&&v(n);}catch{}}function se(e,n,t){(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&(t!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n,t):n!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n):a.warn(`[Askr][FASTPATH] ${e}`));}function G(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}var S=new WeakMap;function ie(e){return S.get(e)}function De(e){try{if(S.has(e))return;let n=Oe(e);if(n.size===0){n=new Map;let t=Array.from(e.children);for(let r of t){let o=(r.textContent||"").trim();if(o){n.set(o,r);let s=Number(o);Number.isNaN(s)||n.set(s,r);}}}n.size>0&&S.set(e,n);}catch{}}var Ke=new WeakSet;function dn(e){let n=[];for(let t of e){let r=O(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function fn(e){let n=[];for(let t of e){if(t===-1)continue;let r=0,o=n.length;for(;r<o;){let s=r+o>>1;n[s]<t?r=s+1:o=s;}r===n.length?n.push(t):n[r]=t;}return n.length}function mn(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&Ie(t.props))return true}return false}function pn(e,n){for(let{key:t,vnode:r}of e){let o=n?.get(t);if(!o||typeof r!="object"||r===null)continue;let i=r.props||{};for(let a of Object.keys(i))if(!te(a)&&_e(o,a,i[a]))return true}return false}function L(e,n,t){let r=dn(n),o=r.length,s=r.map(h=>h.key),i=t?Array.from(t.keys()):[],a=0;for(let h=0;h<s.length;h++){let b=s[h];(h>=i.length||i[h]!==b||!t?.has(b))&&a++;}let m=o>=128&&i.length>0&&a>Math.max(64,Math.floor(o*.1)),l=false,d=0;if(o>=128){let h=Array.from(e.children),b=r.map(({key:F})=>{let P=t?.get(F);return P?.parentElement===e?h.indexOf(P):-1});d=fn(b),l=d<Math.floor(o*.5);}let f=mn(r),g=pn(r,t);return {useFastPath:(m||l)&&!g&&!f,totalKeyed:o,moveCount:a,lisLen:d,hasPropChanges:g}}var Ee=false,V=null;function Le(){Ee=true,V=new WeakSet;try{let e=N.clearPendingSyncTasks?.()??0;}catch{}}function Ve(){Ee=false,V=null;}function X(){return Ee}function Se(e){if(V)try{V.add(e);}catch(n){}}function hn(e){return !!(V&&V.has(e))}function gn(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function yn(e){if(!e||typeof e!="object"||!("type"in e))return e;let n=e;if(typeof n.type=="symbol"&&(n.type===b||String(n.type)==="Symbol(askr.fragment)")){let t=n.children||n.props?.children;if(Array.isArray(t)&&t.length>0){for(let r of t)if(r&&typeof r=="object"&&"type"in r&&typeof r.type=="string")return r}}return e}function _n(e,n){let t=yn(n);if(!t||typeof t!="object"||!("type"in t))return {useFastPath:false,reason:"not-vnode"};let r=t;if(r==null||typeof r.type!="string")return {useFastPath:false,reason:"not-intrinsic"};let o=e.target;if(!o)return {useFastPath:false,reason:"no-root"};let s=o.children[0];if(!s)return {useFastPath:false,reason:"no-first-child"};if(s.tagName.toLowerCase()!==String(r.type).toLowerCase())return {useFastPath:false,reason:"root-tag-mismatch"};let i=r.children||r.props?.children;if(!Array.isArray(i))return {useFastPath:false,reason:"no-children-array"};for(let c of i)if(typeof c=="object"&&c!==null&&"type"in c&&typeof c.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{De(s);}catch{}let a=ie(s),u=L(s,i,a);return !u.useFastPath||u.totalKeyed<128?{...u,useFastPath:false,reason:"renderer-declined"}:{...u,useFastPath:true}}function En(e,n){let t=globalThis.__ASKR_RENDERER?.evaluate;if(typeof t!="function")return a.warn("[Tempo][FASTPATH][DEV] renderer.evaluate not available; declining fast-lane"),false;Le();try{N.runWithSyncProgress(()=>{t(n,e.target);try{gn(e);}catch{}});let o=N.clearPendingSyncTasks?.()??0;return !0}finally{Ve();}}function Sn(e,n){if(!_n(e,n).useFastPath)return false;try{return En(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:X,enterBulkCommit:Le,exitBulkCommit:Ve,tryRuntimeFastLaneSync:Sn,markFastPathApplied:Se,isFastPathApplied:hn});var z=Symbol("__FOR_BOUNDARY__");function A(e){return typeof e=="object"&&e!==null&&"type"in e}function He(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{qe(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Ue(e,n){try{let r=e.ownerDocument,o=r?.createTreeWalker;if(typeof o=="function"){let s=o.call(r,e,1),i=s.firstChild();for(;i;)n(i),i=s.nextNode();return}}catch{}let t=e.querySelectorAll("*");for(let r=0;r<t.length;r++)n(t[r]);}function R(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{He(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Ue(e,o=>{try{He(o,r,t);}catch(s){t?r.push(s):a.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",s);}});}catch(o){a.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",o);}}function ke(e,n){R(e);}var C=new WeakMap;function Be(e){let n=C.get(e);if(n){for(let[t,r]of n)r.options!==void 0?e.removeEventListener(t,r.handler,r.options):e.removeEventListener(t,r.handler);C.delete(e);}}function M(e){e&&(Be(e),Ue(e,Be));}var k=globalThis;function ue(e,n){}var An=(e,n)=>e!=null&&typeof e=="object"&&"id"in e?e.id:n;function zt(e,n,t){let r=typeof e=="function"?null:e,o=Y();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||An,renderFn:n,parentInstance:o,mounted:false}}var je=1;function $e(e,n,t,r){let o=t,s=Object.assign(()=>o,{set(d){let f=typeof d=="function"?d(o):d;f!==o&&(o=f);}}),i=()=>null,a=ce(`for-item-${e}`,i,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let u=Y();J(a);let c=We();a._currentRenderToken=je++,a._pendingReadStates=new Set;let m=r.renderFn(n,()=>s());D(a),J(u);let l={key:e,item:n,indexSignal:s,componentInstance:a,vnode:m,_startStateIndex:c};return a._pendingFlushTask=()=>{let d=Y();J(a),a.stateIndexCheck=-1;let f=a.stateValues;for(let p=0;p<f.length;p++){let h=f[p];h&&(h._hasBeenRead=false);}Ge(c),a._currentRenderToken=je++,a._pendingReadStates=new Set;try{let p=r.renderFn(n,()=>s());l.vnode=p,D(a);}finally{J(d);}let g=r.parentInstance;g&&g._enqueueRun?.();},l}function bn(e,n){let t=k.__ASKR_BENCH__?performance.now():0,{items:r,orderedKeys:o,byFn:s}=e,i=o.length,a=n.length;if(i<=a){let l=true;for(let d=0;d<i;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let f=0;f<i;f++){let g=n[f],p=o[f],h=r.get(p);let b=h.item!==g,F=h.indexSignal()!==f;if(b){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),d.push(h.vnode);}for(let f=i;f<a;f++){let g=n[f],p=s(g,f),h=$e(p,g,f,e);r.set(p,h),d.push(h.vnode),o[f]=p;}return k.__ASKR_BENCH__&&ue("reconcile",performance.now()-t),d}}if(a<=i){let l=true;for(let d=0;d<a;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let f=0;f<a;f++){let g=n[f],p=o[f],h=r.get(p);let b=h.item!==g,F=h.indexSignal()!==f;if(b){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),d.push(h.vnode);}for(let f=a;f<i;f++){let g=o[f],p=r.get(g);if(p){let h=p.componentInstance;h.abortController.abort();for(let b of h.cleanupFns)try{b();}catch{}r.delete(g);}}return o.length=a,e.orderedKeys=o,k.__ASKR_BENCH__&&ue("reconcile",performance.now()-t),d}}if(i===a){let l=true;for(let d=0;d<i;d++)if(s(n[d],d)!==o[d]){l=false;break}if(l){let d=[];for(let f=0;f<i;f++){let g=n[f],p=o[f],h=r.get(p);let b=h.item!==g,F=h.indexSignal()!==f;if(b){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance;let cn=e.renderFn(g,()=>h.indexSignal());h.vnode=cn,k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),d.push(h.vnode);}return k.__ASKR_BENCH__&&ue("reconcile",performance.now()-t),d}}let u=new Set(o),c=[],m=[];for(let l=0;l<n.length;l++){let d=n[l],f=s(d,l);u.delete(f),c.push(f);let g=r.get(f);if(g){let p=g.item!==d,h=g.indexSignal()!==l;if(p){g.item=d;let b=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=g.componentInstance,g.vnode=e.renderFn(d,()=>g.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=b;}h&&g.indexSignal.set(l),m.push(g.vnode);}else {let p=$e(f,d,l,e);r.set(f,p),m.push(p.vnode);}}for(let l of u){let d=r.get(l);if(d){let f=d.componentInstance;f.abortController.abort();for(let g of f.cleanupFns)try{g();}catch{}r.delete(l);}}return e.orderedKeys=c,k.__ASKR_BENCH__&&ue("reconcile",performance.now()-t),m}function le(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return bn(e,t)}var Tn=typeof document<"u",Xe=0;function Cn(){let e="__COMPONENT_INSTANCE_ID";try{v(e);let t=globalThis.__ASKR_DIAG,r=t?t[e]:void 0;if(typeof r=="number"&&Number.isFinite(r))return `comp-${r}`}catch{}return Xe++,`comp-${Xe}`}function Nn(e,n,t){let r=W(t,true),o=$(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),C.has(e)||C.set(e,new Map),C.get(e).set(n,{handler:r,original:t,options:o});}function vn(e,n,t){for(let r in n){let o=n[r];if(r==="ref"){Rn(e,o);continue}if(ye(r)||o==null||o===false)continue;let s=j(r);if(s){Nn(e,s,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?wn(e,r,o,t):e.setAttribute(r,String(o));}}function Rn(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function wn(e,n,t,r){n==="value"?((Q(r,"input")||Q(r,"textarea")||Q(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(Q(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function ze(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function _(e){if(!Tn)return null;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(String(e));if(!e)return null;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e){let r=_(t);r&&n.appendChild(r);}return n}if(typeof e=="object"&&e!==null&&"type"in e){let n=e.type,t=e.props||{};if(typeof n=="string")return xn(e,n,t);if(typeof n=="function")return Fn(e,n,t);if(n===z)return Pn(e,t);if(typeof n=="symbol"&&(n===b||String(n)==="Symbol(Fragment)"))return Mn(e,t)}return null}function xn(e,n,t){let r=document.createElement(n);ze(r,e,t),vn(r,t,n);let o=t.children??e.children;if(o!=null)if(Array.isArray(o)){for(let s of o){let i=_(s);i&&r.appendChild(i);}}else {let s=_(o);s&&r.appendChild(s);}return r}function Fn(e,n,t){let o=e[xe]||Fe(),s=n;if(s.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let a=e.__instance;a||(a=ce(Cn(),s,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let u=q(o,()=>Qe(a));if(u instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let c=q(o,()=>_(u));if(c instanceof Element)return be(a,c),c;if(!c){let l=document.createComment("");return a._placeholder=l,a.mounted=true,a.notifyUpdate=a._enqueueRun,l}let m=document.createElement("div");return m.appendChild(c),be(a,m),m}function Mn(e,n){let t=document.createDocumentFragment(),r=n.children||e.children;if(r)if(Array.isArray(r))for(let o of r){let s=_(o);s&&t.appendChild(s);}else {let o=_(r);o&&t.appendChild(o);}return t}function In(e,n){return !A(e)||!A(n)?true:e.type!==n.type}function Pn(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=le(t,r),s=[],i=false;for(let u=0;u<o.length;u++){let c=o[u],m=c.key,l=null;if(m!=null&&t.items.has(m)){let d=t.items.get(m);d._dom&&!In(d.vnode,c)&&(l=d._dom);}l||(l=_(c),i=true,m!=null&&t.items.has(m)&&(t.items.get(m)._dom=l??void 0)),s.push(l);}!i&&s.length!==t.orderedKeys.length&&(i=true);let a=document.createDocumentFragment();for(let u=0;u<o.length;u++){let c=o[u],m=s[u];m&&(m instanceof Element&&I(m,c,true),a.appendChild(m));}return a}function I(e,n,t=true){if(!A(n))return;let r=n.props||{};ze(e,n,r);let o=C.get(e),s=null;for(let i in r){let a=r[i];if(ye(i))continue;let u=j(i);if(a==null||a===false){if(i==="class"||i==="className")e.className="";else if(u&&o?.has(u)){let c=o.get(u);c.options!==void 0?e.removeEventListener(u,c.handler,c.options):e.removeEventListener(u,c.handler),o.delete(u);}else e.removeAttribute(i);continue}if(i==="class"||i==="className")e.className=String(a);else if(i==="value"||i==="checked")e[i]=a;else if(u){o&&o.size>0&&(s??=new Set).add(u);let c=o?.get(u);if(c&&c.original===a)continue;c&&(c.options!==void 0?e.removeEventListener(u,c.handler,c.options):e.removeEventListener(u,c.handler));let m=W(a,true),l=$(u);l!==void 0?e.addEventListener(u,m,l):e.addEventListener(u,m),C.has(e)||C.set(e,new Map),C.get(e).set(u,{handler:m,original:a,options:l});}else e.setAttribute(i,String(a));}if(o&&o.size>0)if(s===null){for(let[i,a]of o)a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler);C.delete(e);}else {for(let[i,a]of o)s.has(i)||(a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler),o.delete(i));o.size===0&&C.delete(e);}if(t){let i=n.children||r.children;On(e,i);}}function On(e,n){if(!n){e.textContent="";return}if(!Array.isArray(n)&&(typeof n=="string"||typeof n=="number")){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=String(n):e.textContent=String(n);return}if(Array.isArray(n)){Te(e,n);return}e.textContent="";let t=_(n);t&&e.appendChild(t);}function Te(e,n){let t=Array.from(e.children),r=n.some(i=>typeof i=="string"||typeof i=="number"),o=n.some(i=>A(i));if(r&&o){let i=Array.from(e.childNodes),a=Math.max(i.length,n.length);for(let u=0;u<a;u++){let c=i[u],m=n[u];if(m===void 0&&c){c.nodeType===1&&R(c),c.remove();continue}if(!c&&m!==void 0){let l=_(m);l&&e.appendChild(l);continue}if(!(!c||m===void 0)){if(typeof m=="string"||typeof m=="number")if(c.nodeType===3)c.data=String(m);else {let l=document.createTextNode(String(m));e.replaceChild(l,c);}else if(A(m))if(c.nodeType===1){let l=c;if(typeof m.type=="string")if(B(l.tagName,m.type))I(l,m);else {let d=_(m);d&&(M(l),R(l),e.replaceChild(d,c));}}else {let l=_(m);l&&e.replaceChild(l,c);}}}return}if(n.length===1&&t.length===0&&e.childNodes.length===1){let i=n[0],a=e.firstChild;if((typeof i=="string"||typeof i=="number")&&a?.nodeType===3){a.data=String(i);return}}t.length===0&&e.childNodes.length>0&&(e.textContent="");let s=Math.max(t.length,n.length);for(let i=0;i<s;i++){let a=t[i],u=n[i];if(u===void 0&&a){R(a),a.remove();continue}if(!a&&u!==void 0){let c=_(u);c&&e.appendChild(c);continue}if(!(!a||u===void 0))if(typeof u=="string"||typeof u=="number")a.textContent=String(u);else if(A(u))if(typeof u.type=="string")if(B(a.tagName,u.type))I(a,u);else {let c=_(u);c&&(a instanceof Element&&M(a),R(a),e.replaceChild(c,a));}else {let c=_(u);c&&(a instanceof Element&&M(a),R(a),e.replaceChild(c,a));}else {let c=_(u);c&&(a instanceof Element&&M(a),R(a),e.replaceChild(c,a));}}}function de(e,n){let t=n.length,r=0,o=0,s=G(),i=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let c=0;c<t;c++){let{key:m,vnode:l}=n[c],d=e.children[c];if(d&&A(l)&&typeof l.type=="string"){let f=l.type;if(B(d.tagName,f)){let g=l.children||l.props?.children;i&&se("positional idx",c,{chTag:d.tagName,vnodeType:f,chChildNodes:d.childNodes.length,childrenType:Array.isArray(g)?"array":typeof g}),Dn(d,g,l),Ln(d,m,()=>o++),r++;continue}else i&&se("positional tag mismatch",c,{chTag:d.tagName,vnodeType:f});}else i&&se("positional missing or invalid",c,{ch:!!d});Hn(e,c,l);}let a=G()-s;Bn(e,n);let u={n:t,reused:r,updatedKeys:o,t:a};return oe(u,"bulkKeyedPositionalHits"),u}function Dn(e,n,t){typeof n=="string"||typeof n=="number"?H(e,String(n)):Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number")?H(e,String(n[0])):Kn(e,t)||I(e,t);}function Kn(e,n){let t=n.children||n.props?.children;if(!Array.isArray(t)||t.length!==2)return false;let r=t[0],o=t[1];if(!A(r)||!A(o)||typeof r.type!="string"||typeof o.type!="string")return false;let s=e.children[0],i=e.children[1];if(!s||!i||!B(s.tagName,r.type)||!B(i.tagName,o.type))return false;let a=r.children||r.props?.children,u=o.children||o.props?.children;if(typeof a=="string"||typeof a=="number")H(s,String(a));else if(Array.isArray(a)&&a.length===1&&(typeof a[0]=="string"||typeof a[0]=="number"))H(s,String(a[0]));else return false;if(typeof u=="string"||typeof u=="number")H(i,String(u));else if(Array.isArray(u)&&u.length===1&&(typeof u[0]=="string"||typeof u[0]=="number"))H(i,String(u[0]));else return false;return true}function H(e,n){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=n:e.textContent=n;}function Ln(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Vn(e){switch(e){case "div":return "DIV";case "span":return "SPAN";case "p":return "P";case "a":return "A";case "button":return "BUTTON";case "input":return "INPUT";case "ul":return "UL";case "ol":return "OL";case "li":return "LI";default:return null}}function Q(e,n){if(e===n)return true;let t=e.length;if(t!==n.length)return false;for(let r=0;r<t;r++){let o=e.charCodeAt(r),s=n.charCodeAt(r);if(o===s)continue;let i=o>=65&&o<=90?o+32:o,a=s>=65&&s<=90?s+32:s;if(i!==a)return false}return true}function B(e,n){let t=Vn(n);return t!==null&&e===t?true:Q(e,n)}function Hn(e,n,t){let r=_(t);if(r){let o=e.children[n];o?(R(o),e.replaceChild(r,o)):e.appendChild(r);}}function Bn(e,n){try{let t=S.get(e),r=t?(t.clear(),t):new Map;for(let o=0;o<n.length;o++){let s=n[o].key,i=e.children[o];i&&r.set(s,i);}S.set(e,r);}catch{}}function Je(e,n){let t=G(),r=Array.from(e.childNodes),o=[],s=0,i=0;for(let m=0;m<n.length;m++){let l=Un(n[m],r[m],o);l==="reused"?s++:l==="created"&&i++;}let a=G()-t,u=$n(e,o);S.delete(e);let c={n:n.length,reused:s,created:i,tBuild:a,tCommit:u};return Wn(c),c}function Un(e,n,t){return typeof e=="string"||typeof e=="number"?qn(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?jn(e,n,t):"skipped"}function qn(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function jn(e,n,t){let r=e;if(typeof r.type=="string"){let s=r.type;if(n&&n.nodeType===1&&B(n.tagName,s))return I(n,e),t.push(n),"reused"}let o=_(e);return o?(t.push(o),"created"):"skipped"}function $n(e,n){let t=Date.now(),r=document.createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);try{for(let o=e.firstChild;o;){let s=o.nextSibling;o instanceof Element&&M(o),R(o),o=s;}}catch{}return re("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Wn(e){try{T("__LAST_BULK_TEXT_FASTPATH_STATS",e),T("__LAST_FASTPATH_STATS",e),T("__LAST_FASTPATH_COMMIT_COUNT",1),v("bulkTextFastpathHits");}catch{}}function Ye(e,n){let t=Number(process.env.ASKR_BULK_TEXT_THRESHOLD)||1024,r=.8,o=Array.isArray(n)?n.length:0;if(o<t)return Ae({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let s=Gn(n);if(s.componentFound!==void 0)return Ae({phase:"bulk-unkeyed-eligible",reason:"component-child",index:s.componentFound}),false;let i=s.simple/o,a=i>=r&&e.childNodes.length>=o;return Ae({phase:"bulk-unkeyed-eligible",total:o,simple:s.simple,fraction:i,requiredFraction:r,eligible:a}),a}function Gn(e){let n=0;for(let t=0;t<e.length;t++){let r=e[t];if(typeof r=="string"||typeof r=="number"){n++;continue}if(typeof r=="object"&&r!==null&&"type"in r){let o=r;if(typeof o.type=="function")return {simple:n,componentFound:t};typeof o.type=="string"&&Xn(o)&&n++;}}return {simple:n}}function Xn(e){let n=e.children||e.props?.children;return !!(!n||typeof n=="string"||typeof n=="number"||Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number"))}function Ae(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{T("__BULK_DIAG",e);}catch{}}function Ze(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;we()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let s,i;if(o<=20)try{let l=e.children;s=new Array(l.length);for(let d=0;d<l.length;d++)s[d]=l[d];}catch(l){s=void 0;}else {i=new Map;try{for(let l=e.firstElementChild;l;l=l.nextElementSibling){let d=l.getAttribute("data-key");if(d!==null){i.set(d,l);let f=Number(d);Number.isNaN(f)||i.set(f,l);}}}catch(l){i=void 0;}}let a$1=[],u=0,c=0,m=0;for(let l=0;l<n.length;l++){let{key:d,vnode:f}=n[l];u++;let g;if(o<=20&&s){let p=String(d);for(let h=0;h<s.length;h++){let b=s[h],F=b.getAttribute("data-key");if(F!==null&&(F===p||Number(F)===d)){g=b;break}}g||(g=t?.get(d));}else g=i?.get(d)??t?.get(d);if(g)a$1.push(g),m++;else {let p=_(f);p&&(a$1.push(p),c++);}}if(r&&r.length)for(let l of r){let d=_(l);d&&(a$1.push(d),c++);}try{let l=Date.now(),d=document.createDocumentFragment(),f=0;for(let p=0;p<a$1.length;p++)d.appendChild(a$1[p]),f++;try{for(let p=e.firstChild;p;){let h=p.nextSibling;p instanceof Element&&M(p),R(p),p=h;}}catch(p){}try{v("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(p){}e.replaceChildren(d);try{T("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(p){}try{X()&&Se(e);}catch(p){}let g=new Map;for(let p=0;p<n.length;p++){let h=n[p].key,b=a$1[p];b instanceof Element&&g.set(h,b);}try{let p={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-l,t_commit:0,t_bookkeeping:0,fragmentAppendCount:f,mapLookups:u,createdNodes:c,reusedCount:m};typeof globalThis<"u"&&(T("__LAST_FASTPATH_STATS",p),T("__LAST_FASTPATH_REUSED",m>0),v("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:c,reusedCount:m}));}catch(p){}try{Ke.add(e);}catch(p){}return g}catch(l){return null}}function fe(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function Z(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=Jn(n),s=t||zn(e),i=Yn(e,n,r,o,s);return i||rt(e,n,r,s)}function zn(e){let n=new Map;try{for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}}catch{}return n}function Jn(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],s=O(o);s!==void 0?n.push({key:s,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Yn(e,n,t,r,o){try{let s=Qn(e,n,t,r,o);if(s)return s;let i=Zn(e,t);if(i)return i}catch{}return null}function Qn(e,n,t,r,o){if(L(e,n,o).useFastPath&&t.length>=128||X())try{let i=Ze(e,t,o,r);if(i)return S.set(e,i),i}catch{}return null}function Zn(e,n){let t=n.length;if(t<10||e.children.length!==t||et(e,n)/t<.9||nt(e,n))return null;try{let o=de(e,n);return oe(o,"bulkKeyedPositionalHits"),tt(e),S.get(e)}catch{return null}}function et(e,n){let t=0;try{for(let r=0;r<n.length;r++){let o=n[r].vnode;if(!o||typeof o!="object"||typeof o.type!="string")continue;let s=e.children[r];s&&fe(s.tagName,o.type)&&t++;}}catch{}return t}function nt(e,n){try{for(let t=0;t<n.length;t++){let r=n[t].vnode,o=e.children[t];if(!(!o||!r||typeof r!="object")&&Pe(o,r.props||{}))return !0}}catch{return true}return false}function tt(e){try{let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}S.set(e,n);}catch{}}function rt(e,n,t,r){let o=new Map,s=[],i=new WeakSet,a=ot(e,r,i);for(let u=0;u<n.length;u++){let c=n[u],m=it(c,u,e,a,i,o);m&&s.push(m);}return typeof document>"u"||(ft(e,s),S.delete(e)),o}function ot(e,n,t){return r=>{if(!n)return;let o=n.get(r);if(o&&!t.has(o))return t.add(o),o;let s=String(r),i=n.get(s);if(i&&!t.has(i))return t.add(i),i;let a=Number(s);if(!Number.isNaN(a)){let u=n.get(a);if(u&&!t.has(u))return t.add(u),u}return st(e,r,s,t)}}function st(e,n,t,r){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(r.has(o))continue;let s=o.getAttribute("data-key");if(s===t)return r.add(o),o;if(s!==null){let i=Number(s);if(!Number.isNaN(i)&&i===n)return r.add(o),o}}}catch{}}function it(e,n,t,r,o,s){let i=O(e);return i!==void 0?at(e,i,t,r,s):ut(e,n,t,o)}function at(e,n,t,r,o){let s=r(n);if(s&&s.parentElement===t)try{let a=e;if(a&&typeof a=="object"&&typeof a.type=="string"&&fe(s.tagName,a.type))return I(s,e),o.set(n,s),s}catch{}let i=_(e);return i?(i instanceof Element&&o.set(n,i),i):null}function ut(e,n,t,r){try{let s=t.childNodes[n];if((typeof e=="string"||typeof e=="number")&&s&&s.nodeType===3)return s.data=String(e),r.add(s),s;if(s instanceof Element&&lt(s,e))return I(s,e),r.add(s),s;let i=ct(t,r);if(i){let a=dt(i,e,r);if(a)return a}}catch{}return _(e)}function lt(e,n){if(!e||typeof n!="object"||n===null||!("type"in n))return false;let t=n,r=e.getAttribute("data-key");return r==null&&typeof t.type=="string"&&fe(e.tagName,t.type)}function ct(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function dt(e,n,t){if(typeof n=="string"||typeof n=="number")return e.textContent=String(n),t.add(e),e;if(typeof n=="object"&&n!==null&&"type"in n){let r=n;if(typeof r.type=="string"&&fe(e.tagName,r.type))return I(e,n),t.add(e),e}return null}function ft(e,n){let t=document.createDocumentFragment();for(let r=0;r<n.length;r++)t.appendChild(n[r]);try{for(let r=e.firstChild;r;){let o=r.nextSibling;r instanceof Element&&M(r),R(r),r=o;}}catch{}re("reconcile"),e.replaceChildren(t);}var Ce=new WeakMap;function Ne(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function mt(e){if(Array.isArray(e)){if(e.length===1){let n=e[0];if(typeof n=="string"||typeof n=="number")return {isSimple:true,text:String(n)}}}else if(typeof e=="string"||typeof e=="number")return {isSimple:true,text:String(e)};return {isSimple:false}}function pt(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function nn(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function tn(e){let n=S.get(e);return n||(n=nn(e),n.size>0&&S.set(e,n)),n.size>0?n:void 0}function rn(e){for(let n=0;n<e.length;n++)if(O(e[n])!==void 0)return true;return false}function on(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&ht(e,n))return;let r=Z(e,n,t);S.set(e,r);}function ht(e,n){try{let t=[];for(let s of n)A(s)&&s.key!==void 0&&t.push({key:s.key,vnode:s});if(t.length===0||t.length!==n.length)return !1;(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced positional bulk keyed reuse (evaluate-level)");let r=de(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{T("__LAST_FASTPATH_STATS",r),T("__LAST_FASTPATH_COMMIT_COUNT",1),v("bulkKeyedPositionalForced");}catch{}let o=nn(e);return S.set(e,o),!0}catch(t){return (process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced bulk path failed, falling back",t),false}}function gt(e,n){if(Ye(e,n)){Je(e,n);}else Te(e,n);S.delete(e);}function yt(e,n){let t=n._forState;if(!t)return;let r=(n.props||{}).source,o=le(t,r);if(o.length>0){let s=tn(e);try{on(e,o,s);}catch{let i=Z(e,o,s);S.set(e,i);}}else e.textContent="",S.delete(e);}function en(e,n){if(!n){e.textContent="",S.delete(e);return}if(!Array.isArray(n)&&A(n)&&n.type===z){yt(e,n);return}if(!Array.isArray(n)){e.textContent="";let t=_(n);t&&e.appendChild(t),S.delete(e);return}if(rn(n)){let t=tn(e);try{on(e,n,t);}catch{let r=Z(e,n,t);S.set(e,r);}}else gt(e,n);}function ve(e,n){let t=n.children||n.props?.children;if(t&&A(t)&&t.type===z){en(e,t),I(e,n,false);return}t&&!Array.isArray(t)&&(t=[t]);let r=mt(t);r.isSimple&&pt(e,r.text)||en(e,t),I(e,n,false);}function _t(e,n){let t=e.firstElementChild;for(let r=0;r<n.length;r++){let o=n[r],s=t?t.nextElementSibling:null;if(t&&A(o)&&typeof o.type=="string"&&Ne(t.tagName,o.type)){ve(t,o),t=s;continue}let i=_(o);i&&(t?e.replaceChild(i,t):e.appendChild(i)),t=s;}for(;t;){let r=t.nextElementSibling;e.removeChild(t),t=r;}}function Et(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){St(e,r);continue}let o=j(t);if(o){let s=W(r,true),i=$(o);i!==void 0?e.addEventListener(o,s,i):e.addEventListener(o,s),C.has(e)||C.set(e,new Map),C.get(e).set(o,{handler:s,original:r,options:i});continue}t==="class"||t==="className"?e.className=String(r):t==="value"||t==="checked"?e[t]=r:e.setAttribute(t,String(r));}}function St(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function kt(e,n){let t=n.children;if(!Array.isArray(t)||!rn(t))return false;let r=document.createElement(n.type);e.appendChild(r),Et(r,n.props||{});let o=Z(r,t,void 0);return S.set(r,o),true}function At(e){return A(e)&&typeof e.type=="symbol"&&(e.type===b||String(e.type)==="Symbol(askr.fragment)")}function bt(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function U(e,n,t){if(n&&!(typeof document>"u"))if(t&&Ce.has(t)){let r=Ce.get(t),o=r.start.nextSibling;for(;o&&o!==r.end;){let i=o.nextSibling;o.remove(),o=i;}let s=_(e);s&&n.insertBefore(s,r.end);}else if(t){let r=document.createComment("component-start"),o=document.createComment("component-end");n.appendChild(r),n.appendChild(o),Ce.set(t,{start:r,end:o});let s=_(e);s&&n.insertBefore(s,o);}else {let r=e;if(At(r)){let a=bt(r);if(a.length===1&&A(a[0])&&typeof a[0].type=="string")r=a[0];else {_t(n,a);return}}let s=n.__ASKR_INSTANCE;if(s&&s.target===n)if(A(r)&&typeof r.type=="string"&&Ne(n.tagName,r.type)){ve(n,r);return}else {let a=_(r);if(a&&n.parentNode){a instanceof Element&&(a.__ASKR_INSTANCE=s,s.target=a),M(n),n.parentNode.replaceChild(a,n);return}}let i=n.children[0];if(i&&A(r)&&typeof r.type=="string"&&Ne(i.tagName,r.type))ve(i,r);else {if(n.textContent="",A(r)&&typeof r.type=="string"&&kt(n,r))return;let a=_(r);a&&n.appendChild(a);}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:U,isKeyedReorderFastPathEligible:L,getKeyMapForElement:ie};}function ce(e,n,t,r){let o={id:e,fn:n,props:t,target:r,mounted:false,abortController:new AbortController,stateValues:[],evaluationGeneration:0,notifyUpdate:null,_pendingFlushTask:void 0,_pendingRunTask:void 0,_enqueueRun:void 0,stateIndexCheck:-1,expectedStateIndices:[],firstRenderComplete:false,mountOperations:[],cleanupFns:[],hasPendingUpdate:false,ownerFrame:null,ssr:false,cleanupStrict:false,isRoot:false,_currentRenderToken:void 0,lastRenderToken:0,_pendingReadStates:new Set,_lastReadStates:new Set};return o._pendingRunTask=()=>{o.hasPendingUpdate=false,un(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,N.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var x=null,me=0;function Jr(){return x}function J(e){x=e;}function sn(e){if(e.isRoot){for(let n of e.mountOperations){let t=n();t instanceof Promise?t.then(r=>{typeof r=="function"&&e.cleanupFns.push(r);}):typeof t=="function"&&e.cleanupFns.push(t);}e.mountOperations=[];}}function be(e,n){e.target=n;try{n instanceof Element&&(n.__ASKR_INSTANCE=e);}catch(r){}e.notifyUpdate=e._enqueueRun;let t=!e.mounted;e.mounted=true,t&&e.mountOperations.length>0&&sn(e);}var an=0;function un(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++an,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=ln(e);if(t instanceof Promise)throw new Error("Async components are not supported. Components must be synchronous.");{let r=globalThis.__ASKR_FASTLANE;try{if(r?.tryRuntimeFastLaneSync?.(e,t))return}catch{}N.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){D(e);return}let o=e._placeholder,s=o.parentNode;if(!s){a.warn("[Askr] placeholder no longer in DOM, cannot render component");return}let i=document.createElement("div"),a$1=x;x=e;try{U(t,i),s.replaceChild(i,o),e.target=i,e._placeholder=void 0,i.__ASKR_INSTANCE=e,D(e);}finally{x=a$1;}return}if(e.target){let o=[];try{let s=!e.mounted,i=x;x=e,o=Array.from(e.target.childNodes);try{U(t,e.target);}catch(a$1){try{let u=Array.from(e.target.childNodes);for(let c of u)try{ke(c);}catch(m){a.warn("[Askr] error cleaning up failed commit children:",m);}}catch(u){}try{v("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(u){}throw e.target.replaceChildren(...o),a$1}finally{x=i;}D(e),e.mounted=!0,s&&e.mountOperations.length>0&&sn(e);}catch(s){try{let i=Array.from(e.target.childNodes);for(let a$1 of i)try{ke(a$1);}catch(u){a.warn("[Askr] error cleaning up partial children during rollback:",u);}}catch(i){}try{try{v("__DOM_REPLACE_COUNT"),T("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(i){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw s}}});}}function Qe(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++an,e._pendingReadStates=new Set);try{let o=ln(e);return n||D(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function ln(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,x=e,me=0;try{let t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=q(r,()=>e.fn(e.props,t)),s=Date.now()-0;s>5&&a.warn(`[askr] Slow render detected: ${s}ms. Consider optimizing component performance.`),e.firstRenderComplete||(e.firstRenderComplete=!0);for(let i=0;i<e.stateValues.length;i++){let a$1=e.stateValues[i];if(a$1&&!a$1._hasBeenRead)try{let u=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${u} at index ${i}. State should be read during render or removed.`);}catch{a.warn("[askr] Unused state variable detected. State should be read during render or removed.");}}return o}finally{x=null;}}function Tt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,N.enqueue(()=>un(e));}function Y(){return x}function Qr(){if(!x)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return x.abortController.signal}function D(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function Zr(){return me++}function We(){return me}function Ge(e){me=e;}function eo(e){Tt(e);}function qe(e){let n=[];for(let t of e.cleanupFns)try{t();}catch(r){e.cleanupStrict&&n.push(r);}if(e.cleanupFns=[],n.length>0)throw new AggregateError(n,`Cleanup failed for component ${e.id}`);if(e._lastReadStates){for(let t of e._lastReadStates){let r=t._readers;r&&r.delete(e);}e._lastReadStates=new Set;}e.abortController.abort(),e.notifyUpdate=null,e.mounted=false;}export{pe as a,N as b,Rt as c,Fe as d,X as e,z as f,M as g,zt as h,ce as i,Jr as j,J as k,Y as l,Qr as m,Zr as n,eo as o,qe as p};
@@ -1 +0,0 @@
1
- import {a}from'./chunk-2LY2VFSS.js';import {h,f}from'./chunk-ED3HBBAN.js';function m(t,n,a$1){let p=a(h(t,n,a$1?.by))();return {type:f,props:{source:t},_forState:p}}export{m as a};
@@ -1 +0,0 @@
1
- export{d as cleanupNavigation,c as initializeNavigation,b as navigate,a as registerAppInstance}from'./chunk-SGJLVHOK.js';import'./chunk-NLFOBEE4.js';import'./chunk-D2JSJKCW.js';import'./chunk-ED3HBBAN.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';