@askrjs/askr 0.0.9 → 0.0.11

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.
Files changed (49) hide show
  1. package/dist/chunk-37RC6ZT3.js +1 -0
  2. package/dist/chunk-4RTKQ7SC.js +1 -0
  3. package/dist/chunk-62D2TNHX.js +1 -0
  4. package/dist/chunk-72PLUBKM.js +1 -0
  5. package/dist/chunk-CI6AOGB5.js +1 -0
  6. package/dist/chunk-D2JSJKCW.js +1 -0
  7. package/dist/chunk-DPHQ4JD6.js +1 -0
  8. package/dist/chunk-FFSNBDHN.js +1 -0
  9. package/dist/chunk-IOUHU5SL.js +1 -0
  10. package/dist/chunk-JJDSOK6C.js +1 -0
  11. package/dist/chunk-OQMK7H2R.js +1 -0
  12. package/dist/chunk-SUQBZD2N.js +2 -0
  13. package/dist/chunk-UJ6R5KBB.js +2 -0
  14. package/dist/chunk-WKLC6NZC.js +1 -0
  15. package/dist/chunk-YRY4OLQF.js +1 -0
  16. package/dist/{component-DHAn9JxU.d.ts → component-mtwBWhUr.d.ts} +1 -1
  17. package/dist/for/index.d.ts +61 -0
  18. package/dist/for/index.js +1 -0
  19. package/dist/foundations/core.d.ts +449 -0
  20. package/dist/foundations/core.js +1 -0
  21. package/dist/foundations/index.d.ts +4 -722
  22. package/dist/foundations/index.js +1 -1274
  23. package/dist/foundations/structures.d.ts +223 -0
  24. package/dist/foundations/structures.js +1 -0
  25. package/dist/fx/index.js +1 -636
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +1 -3955
  28. package/dist/jsx-dev-runtime.js +1 -17
  29. package/dist/jsx-runtime.js +1 -23
  30. package/dist/logger-MPMIVXAP.js +1 -0
  31. package/dist/main-EPE35NMW.js +65 -0
  32. package/dist/navigate-FFGHH7CQ.js +1 -0
  33. package/dist/resources/index.d.ts +1 -1
  34. package/dist/resources/index.js +1 -792
  35. package/dist/route-I3FHHF6U.js +1 -0
  36. package/dist/router/index.d.ts +5 -0
  37. package/dist/router/index.js +1 -3194
  38. package/dist/ssr/index.js +1 -3935
  39. package/dist/vite/index.js +1 -2306
  40. package/package.json +19 -5
  41. package/dist/foundations/index.js.map +0 -1
  42. package/dist/fx/index.js.map +0 -1
  43. package/dist/index.js.map +0 -1
  44. package/dist/jsx-dev-runtime.js.map +0 -1
  45. package/dist/jsx-runtime.js.map +0 -1
  46. package/dist/resources/index.js.map +0 -1
  47. package/dist/router/index.js.map +0 -1
  48. package/dist/ssr/index.js.map +0 -1
  49. package/dist/vite/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ var e=Symbol.for("askr.element"),r=Symbol.for("askr.fragment");export{e as a,r as b};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-37RC6ZT3.js';function f(n){return typeof n=="object"&&n!==null&&n.$$typeof===a$1}function c(n,e){return {...n,props:{...n.props,...e}}}function d(){if(typeof createPortalSlot=="function"){let t=function(){return o.read()};let o=createPortalSlot();return t.render=function(i){return o.write(i.children),null},t}let n=false,e;function r(){return n=true,e}return r.render=function(t){return n&&(e=t.children),null},r}var u;function a(){return u||(u=d()),u}var S=(()=>{function n(){let e=a()();return e===void 0?null:e}return n.render=function(r){return a().render(r),null},n})();export{f as a,c as b,d as c,S as d};
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var e=(b=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(a,c)=>(typeof require<"u"?require:a)[c]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var f=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports),g=(b,a)=>{for(var c in a)d(b,c,{get:a[c],enumerable:true});};export{e as a,f as b,g as c};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-WKLC6NZC.js';import {c}from'./chunk-DPHQ4JD6.js';function x(e){return `${e.prefix??"askr"}-${String(e.id)}`}function y({node:e,disabled:t,onDismiss:n}){function o(i){t||i.key==="Escape"&&(i.preventDefault?.(),i.stopPropagation?.(),n?.("escape"));}function a(i){if(t)return;let l=i.target;l instanceof Node&&e&&(e.contains(l)||n?.("outside"));}return {onKeyDown:o,onPointerDownCapture:a}}function g({disabled:e,tabIndex:t}){return {tabIndex:e?-1:t===void 0?0:t,...c(e)}}function T({disabled:e,onEnter:t,onLeave:n}){return {onPointerEnter:e?void 0:o=>{t?.(o);},onPointerLeave:e?void 0:o=>{n?.(o);}}}function C(e){let{currentIndex:t,itemCount:n,orientation:o="horizontal",loop:a=false,onNavigate:i,isDisabled:l}=e;function p(s,u){let r=s+u;if(a)r<0&&(r=n-1),r>=n&&(r=0);else if(r<0||r>=n)return;return l?.(r)?r===s?void 0:p(r,u):r}function m(s){let{key:u}=s,r;if((o==="horizontal"||o==="both")&&(u==="ArrowRight"&&(r=1),u==="ArrowLeft"&&(r=-1)),(o==="vertical"||o==="both")&&(u==="ArrowDown"&&(r=1),u==="ArrowUp"&&(r=-1)),r===void 0)return;let d=p(t,r);d!==void 0&&(s.preventDefault?.(),s.stopPropagation?.(),i?.(d));}return {container:{onKeyDown:m},item:s=>({tabIndex:s===t?0:-1,"data-roving-index":s})}}function b(e){return e!==void 0}function v(e,t){let n=b(e);return {value:n?e:t,isControlled:n}}function P(e){let{value:t,defaultValue:n,onChange:o,setInternal:a}=e,{isControlled:i}=v(t,n);function l(p){i||a?.(p),o?.(p);}return {set:l,isControlled:i}}function R(e){let t=a(e.defaultValue),n=e.value!==void 0;function o(){return n?e.value:t()}return o.set=a=>{let i=o(),l=typeof a=="function"?a(i):a;if(!Object.is(i,l)){if(n){e.onChange?.(l);return}t.set(a),e.onChange?.(l);}},o.isControlled=n,o}export{x as a,y as b,g as c,T as d,C as e,b as f,v as g,P as h,R as i};
@@ -0,0 +1 @@
1
+ import {b,a}from'./chunk-4RTKQ7SC.js';import {b as b$1,a as a$1}from'./chunk-37RC6ZT3.js';function T(e){if(e.asChild){let{children:n,asChild:a$1,...l}=e;return a(n)?b(n,l):null}return {$$typeof:a$1,type:b$1,props:{children:e.children},key:null}}function P({present:e,children:r}){return (typeof e=="function"?e():!!e)?{$$typeof:a$1,type:b$1,props:{children:r},key:null}:null}function E(){let e=new Map;function r(s,t){let o={node:s,metadata:t};return e.set(s,o),()=>{e.delete(s);}}function n(){return Array.from(e.values())}function a(){e.clear();}function l(){return e.size}return {register:r,items:n,clear:a,size:l}}function g(){let e=[],r=1;function n(t){let o=r++,i={id:o,options:t};e.push(i);function m(){return e[e.length-1]?.id===o}function y(){let p=e.findIndex(x=>x.id===o);p!==-1&&e.splice(p,1);}return {id:o,isTop:m,unregister:y}}function a(){return e.map(t=>({id:t.id,isTop:()=>e[e.length-1]?.id===t.id,unregister:()=>{let o=e.findIndex(i=>i.id===t.id);o!==-1&&e.splice(o,1);}}))}function l(){let t=e[e.length-1];t&&t.options.onEscape?.();}function s(t){let o=e[e.length-1];if(!o)return;let i=o.options.node;i&&t.target instanceof Node&&i.contains(t.target)||o.options.onOutsidePointer?.(t);}return {register:n,layers:a,handleEscape:l,handleOutsidePointer:s}}export{T as a,P as b,E as c,g as d};
@@ -0,0 +1 @@
1
+ var o=Symbol.for("__ASKR_EXECUTION_MODEL__");function s(){return globalThis[o]}function i(e){let t=globalThis,n=t[o];if(n&&n!==e)throw new Error(`[Askr] mixing execution models is not allowed (current: ${n}, attempted: ${e}). Choose exactly one: createSPA, createSSR, or createIslands.`);n||(t[o]=e);}export{s as a,i as b};
@@ -0,0 +1 @@
1
+ function g(e){return typeof e=="object"&&e!==null&&"defaultPrevented"in e&&e.defaultPrevented===true}function u(e,t,r){if(!e&&!t)return m;if(!e)return t;if(!t)return e;let o=r?.checkDefaultPrevented!==false;return function(...a){e(...a),!(o&&g(a[0]))&&t(...a);}}function m(){}function x(e){return e.startsWith("on")}function l(e,t){let r=Object.keys(e);if(r.length===0)return t;let o={...t};for(let n of r){let a=e[n],i=t[n];if(x(n)&&typeof a=="function"&&typeof i=="function"){o[n]=u(i,a);continue}o[n]=a;}return o}function c(e){return e?{"aria-disabled":"true"}:{}}function D(e){return e===void 0?{}:{"aria-expanded":String(e)}}function I(e){return e===void 0?{}:{"aria-selected":String(e)}}function P(e,t){if(e){if(typeof e=="function"){e(t);return}try{e.current=t;}catch{}}}function k(...e){return t=>{for(let r of e)P(r,t);}}function y({disabled:e,onPress:t,isNativeButton:r=false}){let o={onClick:n=>{if(e){n.preventDefault?.(),n.stopPropagation?.();return}t?.(n);}};return r?(e&&(o.disabled=true,Object.assign(o,c(e))),o):(o.role="button",o.tabIndex=e?-1:0,o.onKeyDown=n=>{if(e){n.preventDefault?.(),n.stopPropagation?.();return}if(n.key==="Enter"){n.preventDefault?.(),t?.(n);return}n.key===" "&&n.preventDefault?.();},o.onKeyUp=n=>{if(e){n.preventDefault?.(),n.stopPropagation?.();return}n.key===" "&&(n.preventDefault?.(),t?.(n));},e&&Object.assign(o,c(e)),o)}function S({isNative:e,disabled:t,onPress:r,ref:o}){function n(i){if(t){i.preventDefault?.();return}r?.(i);}if(e)return {disabled:t||void 0,onClick:i=>n(i),ref:o};let a=y({disabled:t,isNativeButton:false,onPress:i=>n(i)});return {...a,"aria-disabled":t||void 0,tabIndex:t?-1:a.tabIndex??0,ref:o}}function F(e,t,r){let o=l(e,t);r&&(o=l(o,r));for(let s in o){if(!s.startsWith("on"))continue;let d=t?.[s],p=r?.[s],v=e?.[s];if(d||p||v){let f=b=>typeof b=="function"?b:void 0;o[s]=u(f(d),u(f(p),f(v)));}}let n=e?.ref,a=r?.ref,i=t?.ref;return o.ref=k(n,a,i),o}export{u as a,l as b,c,D as d,I as e,P as f,k as g,y as h,S as i,F as j};
@@ -0,0 +1 @@
1
+ function r(n){return (o,t)=>{let e={...t,children:o};return n(e)}}export{r as a};
@@ -0,0 +1 @@
1
+ import {b,l}from'./chunk-SUQBZD2N.js';import {p,o}from'./chunk-UJ6R5KBB.js';import {a}from'./chunk-OQMK7H2R.js';var e=null;function u(n,t){e=n,process.env.NODE_ENV==="production"&&b();}function m(n){if(typeof window>"u")return;let t=l(n);if(!t){process.env.NODE_ENV!=="production"&&a.warn(`No route found for path: ${n}`);return}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 d(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 v(){typeof window<"u"&&window.addEventListener("popstate",d);}function w(){typeof window<"u"&&window.removeEventListener("popstate",d);}export{u as a,m as b,v as c,w as d};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-37RC6ZT3.js';function o(n,r,t){return {$$typeof:a,type:n,props:r??{},key:t??null}}function i(n,r,t){return o(n,r,t)}function l(n,r,t){return o(n,r,t)}export{o as a,i as b,l as c};
@@ -0,0 +1 @@
1
+ function o(n,u){let r=typeof console<"u"?console:void 0;if(!r)return;let e=r[n];if(typeof e=="function")try{e.apply(console,u);}catch{}}var c={debug:(...n)=>{process.env.NODE_ENV!=="production"&&o("debug",n);},info:(...n)=>{process.env.NODE_ENV!=="production"&&o("info",n);},warn:(...n)=>{process.env.NODE_ENV!=="production"&&o("warn",n);},error:(...n)=>{o("error",n);}};export{c as a};
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-UJ6R5KBB.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
+ 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};
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-OQMK7H2R.js';import {b as b$1}from'./chunk-37RC6ZT3.js';function ae(e,n,t){if(!e){let r=t?`
2
+ `+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function Se(e,n){ae(e,`[Scheduler Precondition] ${n}`);}var Ae=50;function U(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var ue=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){if(Se(typeof n=="function","enqueue() requires a function"),U()&&!this.allowSyncProgress){if(process.env.NODE_ENV!=="production")throw new Error("[Scheduler] enqueue() during bulk commit (not allowed)");return}this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!U()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!U())try{this.flush();}catch(t){setTimeout(()=>{throw t});}}));}flush(){if(ae(!this.running,"[Scheduler] flush() called while already running"),process.env.NODE_ENV!=="production"&&U()&&!this.allowSyncProgress)throw new Error("[Scheduler] flush() started during bulk commit (not allowed)");this.running=true,this.depth=0;let n=null;try{for(;this.head<this.q.length;){if(this.depth++,process.env.NODE_ENV!=="production"&&this.depth>Ae)throw new Error(`[Scheduler] exceeded MAX_FLUSH_DEPTH (${Ae}). Likely infinite update loop.`);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 r=globalThis,o=r.queueMicrotask,i=r.setTimeout;process.env.NODE_ENV!=="production"&&(r.queueMicrotask=()=>{throw new Error("[Scheduler] queueMicrotask not allowed during runWithSyncProgress")},r.setTimeout=()=>{throw new Error("[Scheduler] setTimeout not allowed during runWithSyncProgress")});let s=this.flushVersion;try{let a=n();if(!this.running&&this.q.length-this.head>0&&this.flush(),process.env.NODE_ENV!=="production"&&this.q.length-this.head>0)throw new Error("[Scheduler] tasks remain after runWithSyncProgress flush");return a}finally{process.env.NODE_ENV!=="production"&&(r.queueMicrotask=o,r.setTimeout=i);try{this.flushVersion===s&&(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,i)=>{let s=setTimeout(()=>{let a=globalThis.__ASKR__||{},u={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:U(),namespace:a};i(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(u)}`));},t);this.waiters.push({target:r,resolve:o,reject:i,timer:s});})}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();}},g=new ue;function be(){return g.isExecuting()}var ke=Symbol("__tempoContextFrame__"),z=null;function B(e,n){let t=z;z=e;try{return n()}finally{z=t;}}function kt(e,n){try{return n()}finally{}}function Te(){return z}function Ce(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function _(e,n){try{let t=Ce();t[e]=n;try{let r=globalThis;try{let o=r.__ASKR__||(r.__ASKR__={});try{o[e]=n;}catch(i){}}catch(o){}}catch(r){}}catch(t){}}function b(e){try{let n=Ce(),r=(typeof n[e]=="number"?n[e]:0)+1;n[e]=r;try{let o=globalThis,i=o.__ASKR__||(o.__ASKR__={});try{let s=typeof i[e]=="number"?i[e]:0;i[e]=s+1;}catch(s){}}catch(o){}}catch(n){}}function q(e){return !e.startsWith("on")||e.length<=2?null:e.slice(2).charAt(0).toLowerCase()+e.slice(3).toLowerCase()}function j(e){if(e==="wheel"||e==="scroll"||e.startsWith("touch"))return {passive:true}}function $(e,n=false){return t=>{g.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(g.setInHandler(false),n){let r=g.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{g.isExecuting()||g.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function ce(e){return e==="children"||e==="key"||e==="ref"}function J(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function de(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 ve(e){for(let n of Object.keys(e))if(!J(n))return true;return false}function we(e,n){for(let t of Object.keys(n))if(!J(t)&&de(e,t,n[t]))return true;return false}function R(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 Ne(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 Y(e){try{b("__DOM_REPLACE_COUNT"),_(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function Q(e,n){try{_("__LAST_FASTPATH_STATS",e),_("__LAST_FASTPATH_COMMIT_COUNT",1),n&&b(n);}catch{}}function Z(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 W(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}var y=new WeakMap;function ee(e){return y.get(e)}function xe(e){try{if(y.has(e))return;let n=Ne(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 i=Number(o);Number.isNaN(i)||n.set(i,r);}}}n.size>0&&y.set(e,n);}catch{}}var Re=new WeakSet;function nn(e){let n=[];for(let t of e){let r=R(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function tn(e){let n=[];for(let t of e){if(t===-1)continue;let r=0,o=n.length;for(;r<o;){let i=r+o>>1;n[i]<t?r=i+1:o=i;}r===n.length?n.push(t):n[r]=t;}return n.length}function rn(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&ve(t.props))return true}return false}function on(e,n){for(let{key:t,vnode:r}of e){let o=n?.get(t);if(!o||typeof r!="object"||r===null)continue;let s=r.props||{};for(let a of Object.keys(s))if(!J(a)&&de(o,a,s[a]))return true}return false}function M(e,n,t){let r=nn(n),o=r.length,i=r.map(A=>A.key),s=t?Array.from(t.keys()):[],a=0;for(let A=0;A<i.length;A++){let w=i[A];(A>=s.length||s[A]!==w||!t?.has(w))&&a++;}let f=o>=128&&s.length>0&&a>Math.max(64,Math.floor(o*.1)),c=false,d=0;if(o>=128){let A=Array.from(e.children),w=r.map(({key:H})=>{let Ee=t?.get(H);return Ee?.parentElement===e?A.indexOf(Ee):-1});d=tn(w),c=d<Math.floor(o*.5);}let E=rn(r),S=on(r,t);return {useFastPath:(f||c)&&!S&&!E,totalKeyed:o,moveCount:a,lisLen:d,hasPropChanges:S}}function Fe(){if(process.env.NODE_ENV==="production")return {};try{let e=globalThis;return e.__ASKR__||(e.__ASKR__={}),e.__ASKR__}catch{return {}}}function D(e,n){if(process.env.NODE_ENV!=="production")try{Fe()[e]=n;}catch{}}function P(e){if(process.env.NODE_ENV!=="production")try{return Fe()[e]}catch{return}}var fe=false,O=null;function Me(){fe=true,O=new WeakSet;try{let e=g.clearPendingSyncTasks?.()??0;D("__ASKR_FASTLANE_CLEARED_TASKS",e);}catch(e){if(process.env.NODE_ENV!=="production")throw e}}function De(){fe=false,O=null;}function I(){return fe}function pe(e){if(O)try{O.add(e);}catch(n){}}function sn(e){return !!(O&&O.has(e))}function an(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 i=o._readers;i&&i.delete(e);}e.lastRenderToken=r;for(let o of n){let i=o._readers;i||(i=new Map,o._readers=i),i.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function un(e){if(!e||typeof e!="object"||!("type"in e))return e;let n=e;if(typeof n.type=="symbol"&&(n.type===b$1||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 ln(e,n){let t=un(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 i=o.children[0];if(!i)return {useFastPath:false,reason:"no-first-child"};if(i.tagName.toLowerCase()!==String(r.type).toLowerCase())return {useFastPath:false,reason:"root-tag-mismatch"};let s=r.children||r.props?.children;if(!Array.isArray(s))return {useFastPath:false,reason:"no-children-array"};for(let l of s)if(typeof l=="object"&&l!==null&&"type"in l&&typeof l.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{xe(i);}catch{}let a=ee(i),u=M(i,s,a);return !u.useFastPath||u.totalKeyed<128?{...u,useFastPath:false,reason:"renderer-declined"}:{...u,useFastPath:true}}function cn(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;let r=process.env.NODE_ENV!=="production"?g.getState():null;Me();try{g.runWithSyncProgress(()=>{t(n,e.target);try{an(e);}catch(i){if(process.env.NODE_ENV!=="production")throw i}});let o=g.clearPendingSyncTasks?.()??0;return D("__FASTLANE_CLEARED_AFTER",o),process.env.NODE_ENV!=="production"&&dn(e,r),!0}finally{De();}if(process.env.NODE_ENV!=="production"&&I())throw new Error("Fast-lane invariant violated: bulk commit flag still set after commit")}function dn(e,n){let t=P("__LAST_FASTPATH_COMMIT_COUNT")??0,r={commitCount:t,mountOps:e.mountOperations.length,cleanupFns:e.cleanupFns.length};if(D("__LAST_FASTLANE_INVARIANTS",r),t!==1)throw console.error("[FASTLANE][INV] commitCount",t,"diag",globalThis.__ASKR_DIAG),new Error("Fast-lane invariant violated: expected exactly one DOM commit during reorder-only commit");if(r.mountOps>0)throw new Error("Fast-lane invariant violated: mount operations were registered during bulk commit");if(r.cleanupFns>0)throw new Error("Fast-lane invariant violated: cleanup functions were added during bulk commit");let o=g.getState();if(n&&o&&o.taskCount>n.taskCount)throw console.error("[FASTLANE] schedBefore, schedAfter",n,o),console.error("[FASTLANE] enqueue logs",P("__ENQUEUE_LOGS")),new Error("Fast-lane invariant violated: scheduler enqueued leftover work during bulk commit");let i=g.getState(),s=g.isExecuting(),a=Math.max(0,i.taskCount-(s?1:0));if(a!==0){let u=0;for(;u<5&&(g.clearPendingSyncTasks?.()??0)!==0;)u++;if(i=g.getState(),a=Math.max(0,i.taskCount-(g.isExecuting()?1:0)),a!==0)throw console.error("[FASTLANE] Post-commit enqueue logs:",P("__ENQUEUE_LOGS")),console.error("[FASTLANE] Cleared counts:",P("__FASTLANE_CLEARED_TASKS"),P("__FASTLANE_CLEARED_AFTER")),new Error(`Fast-lane invariant violated: scheduler has ${i.taskCount} pending task(s) after commit`)}}function fn(e,n){if(!ln(e,n).useFastPath)return D("__LAST_FASTPATH_STATS",void 0),D("__LAST_FASTPATH_COMMIT_COUNT",0),false;try{return cn(e,n)}catch(r){if(process.env.NODE_ENV!=="production")throw r;return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:I,enterBulkCommit:Me,exitBulkCommit:De,tryRuntimeFastLaneSync:fn,markFastPathApplied:pe,isFastPathApplied:sn});var Pe=Symbol("__FOR_BOUNDARY__");function T(e){return typeof e=="object"&&e!==null&&"type"in e}function Oe(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{Ke(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Le(e,n){try{let r=e.ownerDocument,o=r?.createTreeWalker;if(typeof o=="function"){let i=o.call(r,e,1),s=i.firstChild();for(;s;)n(s),s=i.nextNode();return}}catch{}let t=e.querySelectorAll("*");for(let r=0;r<t.length;r++)n(t[r]);}function v(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{Oe(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Le(e,o=>{try{Oe(o,r,t);}catch(i){t?r.push(i):a.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",i);}});}catch(o){a.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",o);}}function me(e,n){v(e);}var k=new WeakMap;function Ie(e){let n=k.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);k.delete(e);}}function N(e){e&&(Ie(e),Le(e,Ie));}var L=globalThis,pn=(e,n)=>e!=null&&typeof e=="object"&&"id"in e?e.id:n;function Wt(e,n,t){let r=typeof e=="function"?null:e,o=te();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||pn,renderFn:n,parentInstance:o,mounted:false}}function mn(e,n,t,r){let o=t,i=Object.assign(()=>o,{set(f){let c=typeof f=="function"?f(o):f;c!==o&&(o=c);}}),s=()=>null,a=ne(`for-item-${e}`,s,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let u=L.__ASKR_CURRENT_INSTANCE__;L.__ASKR_CURRENT_INSTANCE__=a;let l=r.renderFn(n,()=>i());return L.__ASKR_CURRENT_INSTANCE__=u,{key:e,item:n,indexSignal:i,componentInstance:a,vnode:l}}function hn(e,n){let{items:t,orderedKeys:r,byFn:o}=e,i=new Map;for(let l=0;l<n.length;l++){let f=n[l],c=o(f,l);i.set(c,{item:f,index:l});}let s=[],a=[],u=new Set(r);for(let[l,{item:f,index:c}]of i){u.delete(l),s.push(l);let d=t.get(l);if(d){let E=d.item!==f,S=d.indexSignal()!==c;if(E){d.item=f;let p=L.__ASKR_CURRENT_INSTANCE__;L.__ASKR_CURRENT_INSTANCE__=d.componentInstance,d.vnode=e.renderFn(f,()=>d.indexSignal()),L.__ASKR_CURRENT_INSTANCE__=p;}S&&d.indexSignal.set(c),a.push(d.vnode);}else {let E=mn(l,f,c,e);t.set(l,E),a.push(E.vnode);}}for(let l of u){let f=t.get(l);if(f){let c=f.componentInstance;c.abortController.abort();for(let d of c.cleanupFns)try{d();}catch(E){process.env.NODE_ENV!=="production"&&console.error("[For] Cleanup error:",E);}t.delete(l);}}return e.orderedKeys=s,a}function Ve(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return hn(e,t)}var gn=typeof document<"u",He=0;function yn(){let e="__COMPONENT_INSTANCE_ID";try{b(e);let t=globalThis.__ASKR_DIAG,r=t?t[e]:void 0;if(typeof r=="number"&&Number.isFinite(r))return `comp-${r}`}catch{}return He++,`comp-${He}`}function _n(e,n,t){let r=$(t,true),o=j(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),k.has(e)||k.set(e,new Map),k.get(e).set(n,{handler:r,original:t,options:o});}function En(e,n,t){for(let r in n){let o=n[r];if(ce(r)||o==null||o===false)continue;if(r==="ref"){Sn(e,o);continue}let i=q(r);if(i){_n(e,i,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?An(e,r,o,t):e.setAttribute(r,String(o));}}function Sn(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function An(e,n,t,r){n==="value"?((G(r,"input")||G(r,"textarea")||G(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(G(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function Ue(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function bn(e){if(process.env.NODE_ENV==="production")return;let n=false,t=false;for(let r of e)if(typeof r=="object"&&r!==null&&"type"in r&&(n=true,(r.key??r.props?.key)!==void 0)){t=true;break}if(n&&!t)try{let o=te()?.fn?.name||"<anonymous>";a.warn(`Missing keys on dynamic lists in ${o}. Each child in a list should have a unique "key" prop.`);}catch{a.warn('Missing keys on dynamic lists. Each child in a list should have a unique "key" prop.');}}function h(e){if(!gn){if(process.env.NODE_ENV!=="production")try{a.warn("[Askr] createDOMNode called in non-DOM environment");}catch{}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=h(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 kn(e,n,t);if(typeof n=="function")return Tn(e,n,t);if(n===Pe)return vn(e,t);if(typeof n=="symbol"&&(n===b$1||String(n)==="Symbol(Fragment)"))return Cn(e,t)}return null}function kn(e,n,t){let r=document.createElement(n);Ue(r,e,t),En(r,t,n);let o=t.children||e.children;if(o)if(Array.isArray(o)){bn(o);for(let i of o){let s=h(i);s&&r.appendChild(s);}}else {let i=h(o);i&&r.appendChild(i);}return r}function Tn(e,n,t){let o=e[ke]||Te(),i=n;if(i.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let a=e.__instance;a||(a=ne(yn(),i,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let u=B(o,()=>je(a));if(u instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let l=B(o,()=>h(u));if(l instanceof Element)return ge(a,l),l;if(!l){let c=document.createComment("");return a._placeholder=c,a.mounted=true,a.notifyUpdate=a._enqueueRun,c}let f=document.createElement("div");return f.appendChild(l),ge(a,f),f}function Cn(e,n){let t=document.createDocumentFragment(),r=n.children||e.children;if(r)if(Array.isArray(r))for(let o of r){let i=h(o);i&&t.appendChild(i);}else {let o=h(r);o&&t.appendChild(o);}return t}function vn(e,n){let t=document.createDocumentFragment(),r=e._forState;if(!r)return process.env.NODE_ENV!=="production"&&a.warn("[Askr] For boundary missing _forState"),t;let o=n.source,i=Ve(r,o);for(let s of i){let a=h(s);a&&t.appendChild(a);}return t}function x(e,n,t=true){if(!T(n))return;let r=n.props||{};Ue(e,n,r);let o=k.get(e),i=null;for(let s in r){let a=r[s];if(ce(s))continue;let u=q(s);if(a==null||a===false){if(s==="class"||s==="className")e.className="";else if(u&&o?.has(u)){let l=o.get(u);l.options!==void 0?e.removeEventListener(u,l.handler,l.options):e.removeEventListener(u,l.handler),o.delete(u);}else e.removeAttribute(s);continue}if(s==="class"||s==="className")e.className=String(a);else if(s==="value"||s==="checked")e[s]=a;else if(u){o&&o.size>0&&(i??=new Set).add(u);let l=o?.get(u);if(l&&l.original===a)continue;l&&(l.options!==void 0?e.removeEventListener(u,l.handler,l.options):e.removeEventListener(u,l.handler));let f=$(a,false),c=j(u);c!==void 0?e.addEventListener(u,f,c):e.addEventListener(u,f),k.has(e)||k.set(e,new Map),k.get(e).set(u,{handler:f,original:a,options:c});}else e.setAttribute(s,String(a));}if(o&&o.size>0)if(i===null){for(let[s,a]of o)a.options!==void 0?e.removeEventListener(s,a.handler,a.options):e.removeEventListener(s,a.handler);k.delete(e);}else {for(let[s,a]of o)i.has(s)||(a.options!==void 0?e.removeEventListener(s,a.handler,a.options):e.removeEventListener(s,a.handler),o.delete(s));o.size===0&&k.delete(e);}if(t){let s=n.children||r.children;wn(e,s);}}function wn(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)){ye(e,n);return}e.textContent="";let t=h(n);t&&e.appendChild(t);}function ye(e,n){let t=Array.from(e.children);if(n.length===1&&t.length===0&&e.childNodes.length===1){let o=n[0],i=e.firstChild;if((typeof o=="string"||typeof o=="number")&&i?.nodeType===3){i.data=String(o);return}}t.length===0&&e.childNodes.length>0&&(e.textContent="");let r=Math.max(t.length,n.length);for(let o=0;o<r;o++){let i=t[o],s=n[o];if(s===void 0&&i){v(i),i.remove();continue}if(!i&&s!==void 0){let a=h(s);a&&e.appendChild(a);continue}if(!(!i||s===void 0))if(typeof s=="string"||typeof s=="number")i.textContent=String(s);else if(T(s))if(typeof s.type=="string")if(X(i.tagName,s.type))x(i,s);else {let a=h(s);a&&(i instanceof Element&&N(i),v(i),e.replaceChild(a,i));}else {let a=h(s);a&&(i instanceof Element&&N(i),v(i),e.replaceChild(a,i));}else {let a=h(s);a&&(i instanceof Element&&N(i),v(i),e.replaceChild(a,i));}}}function re(e,n){let t=n.length,r=0,o=0,i=W(),s=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let l=0;l<t;l++){let{key:f,vnode:c}=n[l],d=e.children[l];if(d&&T(c)&&typeof c.type=="string"){let E=c.type;if(X(d.tagName,E)){let S=c.children||c.props?.children;s&&Z("positional idx",l,{chTag:d.tagName,vnodeType:E,chChildNodes:d.childNodes.length,childrenType:Array.isArray(S)?"array":typeof S}),Nn(d,S,c),Rn(d,f,()=>o++),r++;continue}else s&&Z("positional tag mismatch",l,{chTag:d.tagName,vnodeType:E});}else s&&Z("positional missing or invalid",l,{ch:!!d});Mn(e,l,c);}let a=W()-i;Dn(e,n);let u={n:t,reused:r,updatedKeys:o,t:a};return Q(u,"bulkKeyedPositionalHits"),u}function Nn(e,n,t){typeof n=="string"||typeof n=="number"?K(e,String(n)):Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number")?K(e,String(n[0])):xn(e,t)||x(e,t);}function xn(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(!T(r)||!T(o)||typeof r.type!="string"||typeof o.type!="string")return false;let i=e.children[0],s=e.children[1];if(!i||!s||!X(i.tagName,r.type)||!X(s.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")K(i,String(a));else if(Array.isArray(a)&&a.length===1&&(typeof a[0]=="string"||typeof a[0]=="number"))K(i,String(a[0]));else return false;if(typeof u=="string"||typeof u=="number")K(s,String(u));else if(Array.isArray(u)&&u.length===1&&(typeof u[0]=="string"||typeof u[0]=="number"))K(s,String(u[0]));else return false;return true}function K(e,n){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=n:e.textContent=n;}function Rn(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Fn(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 G(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),i=n.charCodeAt(r);if(o===i)continue;let s=o>=65&&o<=90?o+32:o,a=i>=65&&i<=90?i+32:i;if(s!==a)return false}return true}function X(e,n){let t=Fn(n);return t!==null&&e===t?true:G(e,n)}function Mn(e,n,t){let r=h(t);if(r){let o=e.children[n];o?(v(o),e.replaceChild(r,o)):e.appendChild(r);}}function Dn(e,n){try{let t=y.get(e),r=t?(t.clear(),t):new Map;for(let o=0;o<n.length;o++){let i=n[o].key,s=e.children[o];s&&r.set(i,s);}y.set(e,r);}catch{}}function Be(e,n){let t=W(),r=Array.from(e.childNodes),o=[],i=0,s=0;for(let f=0;f<n.length;f++){let c=Pn(n[f],r[f],o);c==="reused"?i++:c==="created"&&s++;}let a=W()-t,u=Ln(e,o);y.delete(e);let l={n:n.length,reused:i,created:s,tBuild:a,tCommit:u};return Kn(l),l}function Pn(e,n,t){return typeof e=="string"||typeof e=="number"?On(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?In(e,n,t):"skipped"}function On(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function In(e,n,t){let r=e;if(typeof r.type=="string"){let i=r.type;if(n&&n.nodeType===1&&X(n.tagName,i))return x(n,e),t.push(n),"reused"}let o=h(e);return o?(t.push(o),"created"):"skipped"}function Ln(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 i=o.nextSibling;o instanceof Element&&N(o),v(o),o=i;}}catch{}return Y("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Kn(e){try{_("__LAST_BULK_TEXT_FASTPATH_STATS",e),_("__LAST_FASTPATH_STATS",e),_("__LAST_FASTPATH_COMMIT_COUNT",1),b("bulkTextFastpathHits");}catch{}}function qe(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 he({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let i=Vn(n);if(i.componentFound!==void 0)return he({phase:"bulk-unkeyed-eligible",reason:"component-child",index:i.componentFound}),false;let s=i.simple/o,a=s>=r&&e.childNodes.length>=o;return he({phase:"bulk-unkeyed-eligible",total:o,simple:i.simple,fraction:s,requiredFraction:r,eligible:a}),a}function Vn(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"&&Hn(o)&&n++;}}return {simple:n}}function Hn(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 he(e){if(process.env.NODE_ENV!=="production"||process.env.ASKR_FASTPATH_DEBUG==="1")try{_("__BULK_DIAG",e);}catch{}}function $e(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;be()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let i,s;if(o<=20)try{let c=e.children;i=new Array(c.length);for(let d=0;d<c.length;d++)i[d]=c[d];}catch(c){i=void 0;}else {s=new Map;try{for(let c=e.firstElementChild;c;c=c.nextElementSibling){let d=c.getAttribute("data-key");if(d!==null){s.set(d,c);let E=Number(d);Number.isNaN(E)||s.set(E,c);}}}catch(c){s=void 0;}}let a$1=[],u=0,l=0,f=0;for(let c=0;c<n.length;c++){let{key:d,vnode:E}=n[c];u++;let S;if(o<=20&&i){let p=String(d);for(let A=0;A<i.length;A++){let w=i[A],H=w.getAttribute("data-key");if(H!==null&&(H===p||Number(H)===d)){S=w;break}}S||(S=t?.get(d));}else S=s?.get(d)??t?.get(d);if(S)a$1.push(S),f++;else {let p=h(E);p&&(a$1.push(p),l++);}}if(r&&r.length)for(let c of r){let d=h(c);d&&(a$1.push(d),l++);}try{let c=Date.now(),d=document.createDocumentFragment(),E=0;for(let p=0;p<a$1.length;p++)d.appendChild(a$1[p]),E++;try{for(let p=e.firstChild;p;){let A=p.nextSibling;p instanceof Element&&N(p),v(p),p=A;}}catch(p){}try{b("__DOM_REPLACE_COUNT"),_("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(p){}e.replaceChildren(d);try{_("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(p){}try{I()&&pe(e);}catch(p){}let S=new Map;for(let p=0;p<n.length;p++){let A=n[p].key,w=a$1[p];w instanceof Element&&S.set(A,w);}try{let p={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-c,t_commit:0,t_bookkeeping:0,fragmentAppendCount:E,mapLookups:u,createdNodes:l,reusedCount:f};typeof globalThis<"u"&&(_("__LAST_FASTPATH_STATS",p),_("__LAST_FASTPATH_REUSED",f>0),b("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:l,reusedCount:f}));}catch(p){}try{Re.add(e);}catch(p){}return S}catch(c){return null}}function oe(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 i=r>=65&&r<=90?r+32:r,s=o>=65&&o<=90?o+32:o;if(i!==s)return false}return true}function ie(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=Un(n),i=Bn(e,n,r,o,t);return i||Xn(e,n,r,t)}function Un(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],i=R(o);i!==void 0?n.push({key:i,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Bn(e,n,t,r,o){try{let i=qn(e,n,t,r,o);if(i)return i;let s=jn(e,t);if(s)return s}catch{}return null}function qn(e,n,t,r,o){if(M(e,n,o).useFastPath&&t.length>=128||I())try{let s=$e(e,t,o,r);if(s)return y.set(e,s),s}catch{}return null}function jn(e,n){let t=n.length;if(t<10||$n(e,n)/t<.9||Wn(e,n))return null;try{let o=re(e,n);return Q(o,"bulkKeyedPositionalHits"),Gn(e),y.get(e)}catch{return null}}function $n(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 i=e.children[r];i&&oe(i.tagName,o.type)&&t++;}}catch{}return t}function Wn(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")&&we(o,r.props||{}))return !0}}catch{return true}return false}function Gn(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);}}y.set(e,n);}catch{}}function Xn(e,n,t,r){let o=new Map,i=[],s=new WeakSet,a=zn(e,r,s);for(let u=0;u<n.length;u++){let l=n[u],f=Yn(l,u,e,a,s,o);f&&i.push(f);}return typeof document>"u"||(rt(e,i),y.delete(e)),o}function zn(e,n,t){return r=>{if(!n)return;let o=n.get(r);if(o&&!t.has(o))return t.add(o),o;let i=String(r),s=n.get(i);if(s&&!t.has(s))return t.add(s),s;let a=Number(i);if(!Number.isNaN(a)){let u=n.get(a);if(u&&!t.has(u))return t.add(u),u}return Jn(e,r,i,t)}}function Jn(e,n,t,r){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(r.has(o))continue;let i=o.getAttribute("data-key");if(i===t)return r.add(o),o;if(i!==null){let s=Number(i);if(!Number.isNaN(s)&&s===n)return r.add(o),o}}}catch{}}function Yn(e,n,t,r,o,i){let s=R(e);return s!==void 0?Qn(e,s,t,r,i):Zn(e,n,t,o)}function Qn(e,n,t,r,o){let i=r(n);if(i&&i.parentElement===t)try{let a=e;if(a&&typeof a=="object"&&typeof a.type=="string"&&oe(i.tagName,a.type))return x(i,e),o.set(n,i),i}catch{}let s=h(e);return s?(s instanceof Element&&o.set(n,s),s):null}function Zn(e,n,t,r){try{let i=t.children[n];if(i&&(typeof e=="string"||typeof e=="number")&&i.nodeType===1)return i.textContent=String(e),r.add(i),i;if(et(i,e))return x(i,e),r.add(i),i;let s=nt(t,r);if(s){let a=tt(s,e,r);if(a)return a}}catch{}return h(e)}function et(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"&&oe(e.tagName,t.type)}function nt(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function tt(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"&&oe(e.tagName,r.type))return x(e,n),t.add(e),e}return null}function rt(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&&N(r),v(r),r=o;}}catch{}Y("reconcile"),e.replaceChildren(t);}var _e=new WeakMap;function We(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 i=r>=65&&r<=90?r+32:r,s=o>=65&&o<=90?o+32:o;if(i!==s)return false}return true}function ot(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 it(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function Ge(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 st(e){let n=y.get(e);return n||(n=Ge(e),n.size>0&&y.set(e,n)),n.size>0?n:void 0}function Xe(e){for(let n=0;n<e.length;n++)if(R(e[n])!==void 0)return true;return false}function at(e){if(process.env.NODE_ENV!=="production")try{_("__LAST_BULK_TEXT_FASTPATH_STATS",e),b("bulkTextHits");}catch{}}function ut(){if(process.env.NODE_ENV!=="production")try{b("bulkTextMisses");}catch{}}function lt(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&ct(e,n))return;let r=ie(e,n,t);y.set(e,r);}function ct(e,n){try{let t=[];for(let i of n)T(i)&&i.key!==void 0&&t.push({key:i.key,vnode:i});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=re(e,t);if(process.env.NODE_ENV!=="production"||process.env.ASKR_FASTPATH_DEBUG==="1")try{_("__LAST_FASTPATH_STATS",r),_("__LAST_FASTPATH_COMMIT_COUNT",1),b("bulkKeyedPositionalForced");}catch{}let o=Ge(e);return y.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 dt(e,n){if(qe(e,n)){let t=Be(e,n);at(t);}else ut(),ye(e,n);y.delete(e);}function ft(e,n){if(!n){e.textContent="",y.delete(e);return}if(!Array.isArray(n)){e.textContent="";let t=h(n);t&&e.appendChild(t),y.delete(e);return}if(Xe(n)){let t=st(e);try{lt(e,n,t);}catch{let r=ie(e,n,t);y.set(e,r);}}else dt(e,n);}function ze(e,n){let t=n.children||n.props?.children,r=ot(t);r.isSimple&&it(e,r.text)||ft(e,t),x(e,n,false);}function pt(e,n){let t=e.firstElementChild;for(let r=0;r<n.length;r++){let o=n[r],i=t?t.nextElementSibling:null;if(t&&T(o)&&typeof o.type=="string"&&We(t.tagName,o.type)){ze(t,o),t=i;continue}let s=h(o);s&&(t?e.replaceChild(s,t):e.appendChild(s)),t=i;}for(;t;){let r=t.nextElementSibling;e.removeChild(t),t=r;}}function mt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){ht(e,r);continue}let o=q(t);if(o){let i=$(r,false),s=j(o);s!==void 0?e.addEventListener(o,i,s):e.addEventListener(o,i),k.has(e)||k.set(e,new Map),k.get(e).set(o,{handler:i,original:r,options:s});continue}t==="class"||t==="className"?e.className=String(r):t==="value"||t==="checked"?e[t]=r:e.setAttribute(t,String(r));}}function ht(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function gt(e,n){let t=n.children;if(!Array.isArray(t)||!Xe(t))return false;let r=document.createElement(n.type);e.appendChild(r),mt(r,n.props||{});let o=ie(r,t,void 0);return y.set(r,o),true}function yt(e){return T(e)&&typeof e.type=="symbol"&&(e.type===b$1||String(e.type)==="Symbol(askr.fragment)")}function _t(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function V(e,n,t){if(n){if(typeof document>"u"){if(process.env.NODE_ENV!=="production")try{console.warn("[Askr] evaluate() called in non-DOM environment; no-op.");}catch(r){}return}if(t&&_e.has(t)){let r=_e.get(t),o=r.start.nextSibling;for(;o&&o!==r.end;){let s=o.nextSibling;o.remove(),o=s;}let i=h(e);i&&n.insertBefore(i,r.end);}else if(t){let r=document.createComment("component-start"),o=document.createComment("component-end");n.appendChild(r),n.appendChild(o),_e.set(t,{start:r,end:o});let i=h(e);i&&n.insertBefore(i,o);}else {let r=e;if(yt(r)){let i=_t(r);if(i.length===1&&T(i[0])&&typeof i[0].type=="string")r=i[0];else {pt(n,i);return}}let o=n.children[0];if(o&&T(r)&&typeof r.type=="string"&&We(o.tagName,r.type))ze(o,r);else {if(n.textContent="",T(r)&&typeof r.type=="string"&&gt(n,r))return;let i=h(r);i&&n.appendChild(i);}}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:V,isKeyedReorderFastPathEligible:M,getKeyMapForElement:ee};}function ne(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,Ze(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,g.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var C=null,Je=0;function Wr(){return C}function Gr(e){C=e;}function Ye(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 ge(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&&Ye(e);}var Qe=0;function Ze(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++Qe,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=en(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(o){if(process.env.NODE_ENV!=="production")throw o}g.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){se(e);return}let o=e._placeholder,i=o.parentNode;if(!i){a.warn("[Askr] placeholder no longer in DOM, cannot render component");return}let s=document.createElement("div"),a$1=C;C=e;try{V(t,s),i.replaceChild(s,o),e.target=s,e._placeholder=void 0,s.__ASKR_INSTANCE=e,se(e);}finally{C=a$1;}return}if(e.target){let o=[];try{let i=!e.mounted,s=C;C=e,o=Array.from(e.target.childNodes);try{V(t,e.target);}catch(a$1){try{let u=Array.from(e.target.childNodes);for(let l of u)try{me(l);}catch(f){a.warn("[Askr] error cleaning up failed commit children:",f);}}catch(u){}try{b("__DOM_REPLACE_COUNT"),_("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(u){}throw e.target.replaceChildren(...o),a$1}finally{C=s;}se(e),e.mounted=!0,i&&e.mountOperations.length>0&&Ye(e);}catch(i){try{let s=Array.from(e.target.childNodes);for(let a$1 of s)try{me(a$1);}catch(u){a.warn("[Askr] error cleaning up partial children during rollback:",u);}}catch(s){}try{try{b("__DOM_REPLACE_COUNT"),_("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(s){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw i}}});}}function je(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++Qe,e._pendingReadStates=new Set);try{let o=en(e);return n||se(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function en(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,C=e,Je=0;try{let n=process.env.NODE_ENV!=="production"?Date.now():0,t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=B(r,()=>e.fn(e.props,t)),i=Date.now()-n;i>5&&a.warn(`[askr] Slow render detected: ${i}ms. Consider optimizing component performance.`),e.firstRenderComplete||(e.firstRenderComplete=!0);for(let s=0;s<e.stateValues.length;s++){let a$1=e.stateValues[s];if(a$1&&!a$1._hasBeenRead)try{let u=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${u} at index ${s}. 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{C=null;}}function Et(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,g.enqueue(()=>Ze(e));}function te(){return C}function zr(){if(!C)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return C.abortController.signal}function se(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 i=o._readers;i&&i.delete(e);}e.lastRenderToken=r;for(let o of n){let i=o._readers;i||(i=new Map,o._readers=i),i.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function Jr(){return Je++}function Yr(e){Et(e);}function Ke(e){let n=[];for(let t of e.cleanupFns)try{t();}catch(r){e.cleanupStrict?n.push(r):process.env.NODE_ENV!=="production"&&a.warn("[Askr] cleanup function threw:",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{ae as a,g as b,kt as c,Te as d,I as e,Pe as f,N as g,Wt as h,ne as i,Wr as j,Gr as k,te as l,zr as m,Jr as n,Yr as o,Ke as p};
@@ -0,0 +1 @@
1
+ import {l,n,a,e,b}from'./chunk-UJ6R5KBB.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};
@@ -0,0 +1 @@
1
+ var r=class e extends Error{constructor(n="Server-side rendering requires all data to be available synchronously. This component attempted to use async data during SSR."){super(n);this.code="SSR_DATA_MISSING";this.name="SSRDataMissingError",Object.setPrototypeOf(this,e.prototype);}};var o={getCurrentSSRContext(){return null},throwSSRDataMissing(){throw new Error("[Askr] SSR data missing (SSR bridge not installed). If you are rendering on the server, ensure you are using the askr SSR entrypoints.")},getCurrentRenderData(){return null},getNextKey(){throw new Error("[Askr] getNextKey() called outside SSR render phase (SSR bridge not installed).")}},t=o;function s(e){t=e;}function d(){return t}export{r as a,s as b,d as c};
@@ -174,4 +174,4 @@ interface ComponentInstance {
174
174
  */
175
175
  declare function getSignal(): AbortSignal;
176
176
 
177
- export { type ComponentFunction as C, type State as S, getSignal as g, state as s };
177
+ export { type ComponentFunction as C, type State as S, type ComponentInstance as a, getSignal as g, state as s };
@@ -0,0 +1,61 @@
1
+ import { S as State, a as ComponentInstance } from '../component-mtwBWhUr.js';
2
+ import { P as Props } from '../jsx-CSWf4VFg.js';
3
+
4
+ /**
5
+ * For primitive runtime
6
+ *
7
+ * Manages per-item component instances and array reconciliation
8
+ * to eliminate over-invalidation in list rendering.
9
+ */
10
+
11
+ interface ForItemInstance<T> {
12
+ key: string | number;
13
+ item: T;
14
+ indexSignal: State<number>;
15
+ componentInstance: ComponentInstance;
16
+ vnode: VNode | undefined;
17
+ }
18
+ interface ForState<T> {
19
+ sourceState: State<T[]> | null;
20
+ items: Map<string | number, ForItemInstance<T>>;
21
+ orderedKeys: Array<string | number>;
22
+ byFn: (item: T, index: number) => string | number;
23
+ renderFn: (item: T, index: () => number) => VNode;
24
+ parentInstance: ComponentInstance | null;
25
+ mounted: boolean;
26
+ }
27
+
28
+ /**
29
+ * Common call contracts: VNode / virtual DOM shapes
30
+ */
31
+
32
+ interface DOMElement {
33
+ type: string | ((props: Props) => unknown) | symbol;
34
+ props?: Props;
35
+ children?: VNode[];
36
+ key?: string | number;
37
+ [Symbol.iterator]?: never;
38
+ _forState?: ForState<unknown>;
39
+ }
40
+ type VNode = DOMElement | string | number | boolean | null | undefined;
41
+
42
+ /**
43
+ * For component primitive
44
+ *
45
+ * Creates a reactivity boundary for list iteration, preventing
46
+ * parent re-execution when individual items update.
47
+ */
48
+
49
+ interface ForOptions<T> {
50
+ by?: (item: T, index: number) => string | number;
51
+ fallback?: VNode;
52
+ }
53
+ /**
54
+ * For primitive - creates a reactivity boundary for efficient list rendering.
55
+ *
56
+ * Instead of re-executing all rows when one changes, For creates isolated
57
+ * component instances for each item, re-executing only items that changed.
58
+ */
59
+ declare function For<T>(source: State<T[]> | (() => T[]), render: (item: T, index: () => number) => VNode, options?: ForOptions<T>): VNode;
60
+
61
+ export { For, type ForOptions };
@@ -0,0 +1 @@
1
+ import {a}from'../chunk-WKLC6NZC.js';import {h,f}from'../chunk-UJ6R5KBB.js';import'../chunk-JJDSOK6C.js';import'../chunk-OQMK7H2R.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.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 For};