@askrjs/askr 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,15 +27,17 @@ Developers should only think about:
27
27
  - state
28
28
  - HTML
29
29
 
30
- ## Quick start (tiny)
30
+ ## Quick Start
31
31
 
32
- Install:
32
+ **1. Install**
33
33
 
34
34
  ```sh
35
35
  npm i @askrjs/askr
36
36
  ```
37
37
 
38
- TypeScript JSX setup (`tsconfig.json`):
38
+ **2. Configure TypeScript**
39
+
40
+ Edit `tsconfig.json`:
39
41
 
40
42
  ```json
41
43
  {
@@ -46,55 +48,75 @@ TypeScript JSX setup (`tsconfig.json`):
46
48
  }
47
49
  ```
48
50
 
49
- Tiny app (routing + state):
51
+ **3. Create `src/main.tsx`**
50
52
 
51
53
  ```ts
52
- import { createSPA, getRoutes, Link, navigate, route, state } from '@askrjs/askr';
54
+ import { createSPA, getRoutes, Link, route, state } from '@askrjs/askr';
53
55
 
54
56
  function Home() {
55
57
  const count = state(0);
56
58
  return (
57
- <div>
59
+ <div style="padding:12px">
58
60
  <h1>Home</h1>
59
61
  <p>Count: {count()}</p>
60
62
  <button onClick={() => count.set(prev => prev + 1)}>Increment</button>
61
- <p>
62
- <Link href="/users/42">User 42</Link>
63
- </p>
63
+ <p><Link href="/users/42">User 42</Link></p>
64
64
  </div>
65
65
  );
66
66
  }
67
67
 
68
- ```
69
-
70
- **Tip:** Prefer functional updates when updating based on previous state: `count.set(prev => prev + 1)`.
71
-
72
- ```ts
73
-
74
68
  function User({ id }: { id: string }) {
75
69
  return (
76
- <div>
70
+ <div style="padding:12px">
77
71
  <h1>User {id}</h1>
78
- <Link href="/">Back</Link>
72
+ <Link href="/">← Back</Link>
79
73
  </div>
80
74
  );
81
75
  }
82
76
 
83
- // Register routes at module-load time
84
77
  route('/', () => <Home />);
85
78
  route('/users/{id}', ({ id }) => <User id={id} />);
86
79
 
87
- // App root component — render `Home` by default; registered routes will take over on navigation
88
- function App() {
89
- // Default page when app loads
90
- return <Home />;
91
- }
92
-
93
- // Create the app. Click the "User 42" link above to navigate to `/users/42`.
94
80
  createSPA({ root: 'app', routes: getRoutes() });
95
81
  ```
96
82
 
97
- Note: `root` is an element id string (or an `Element`).
83
+ **4. Create `index.html`**
84
+
85
+ ```html
86
+ <!doctype html>
87
+ <html>
88
+ <body>
89
+ <div id="app"></div>
90
+ <script type="module" src="./src/main.tsx"></script>
91
+ </body>
92
+ </html>
93
+ ```
94
+
95
+ **5. Run with Vite**
96
+
97
+ ```sh
98
+ npx vite
99
+ ```
100
+
101
+ Then install the Askr Vite plugin in `vite.config.ts` if needed (automatically handles JSX):
102
+
103
+ ```ts
104
+ import { defineConfig } from 'vite';
105
+ import { askrVitePlugin } from '@askrjs/askr/vite';
106
+
107
+ export default defineConfig({
108
+ plugins: [askrVitePlugin()],
109
+ });
110
+ ```
111
+
112
+ Done. Click links, increment counters, navigate routes. No hidden state, no effects, no lifecycle.
113
+
114
+ **Key takeaways:**
115
+
116
+ - Write normal functions and HTML
117
+ - Use `state()` for reactive values; call `set()` to update
118
+ - Use `route()` to register and read routes
119
+ - Platform primitives: cancellation is `AbortSignal`, state is plain functions
98
120
 
99
121
  ## JSX runtime
100
122
 
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-WGORSKNX.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-LW2VF6A3.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};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-FYTGHAKU.js';import {h,f}from'./chunk-LW2VF6A3.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 +1 @@
1
- import {l,n,a,e,b}from'./chunk-WGORSKNX.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-LW2VF6A3.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,2 @@
1
+ import {a}from'./chunk-HGMOQ3I7.js';import {b as b$1}from'./chunk-37RC6ZT3.js';function fe(e,n,t){if(!e){let r=t?`
2
+ `+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function ve(e,n){fe(e,`[Scheduler Precondition] ${n}`);}function Q(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var me=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){ve(typeof n=="function","enqueue() requires a function"),!(Q()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!Q()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!Q())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){fe(!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__||{},l={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:Q(),namespace:a};s(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(l)}`));},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();}},v=new me;function Ne(){return v.isExecuting()}var Re=Symbol("__tempoContextFrame__"),Z=null;function q(e,n){let t=Z;Z=e;try{return n()}finally{Z=t;}}function Ct(e,n){try{return n()}finally{}}function we(){return Z}function xe(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function b(e,n){try{let t=xe();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 N(e){try{let n=xe(),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=>{v.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(v.setInHandler(false),n){let r=v.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{v.isExecuting()||v.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function he(e){return e==="children"||e==="key"||e==="ref"}function ee(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function ge(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 Fe(e){for(let n of Object.keys(e))if(!ee(n))return true;return false}function Me(e,n){for(let t of Object.keys(n))if(!ee(t)&&ge(e,t,n[t]))return true;return false}function D(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 Ie(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 ne(e){try{N("__DOM_REPLACE_COUNT"),b(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function te(e,n){try{b("__LAST_FASTPATH_STATS",e),b("__LAST_FASTPATH_COMMIT_COUNT",1),n&&N(n);}catch{}}function re(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 oe(e){return S.get(e)}function Pe(e){try{if(S.has(e))return;let n=Ie(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 De=new WeakSet;function an(e){let n=[];for(let t of e){let r=D(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function ln(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 un(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&Fe(t.props))return true}return false}function cn(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(!ee(a)&&ge(o,a,i[a]))return true}return false}function L(e,n,t){let r=an(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 A=s[h];(h>=i.length||i[h]!==A||!t?.has(A))&&a++;}let p=o>=128&&i.length>0&&a>Math.max(64,Math.floor(o*.1)),u=false,c=0;if(o>=128){let h=Array.from(e.children),A=r.map(({key:F})=>{let P=t?.get(F);return P?.parentElement===e?h.indexOf(P):-1});c=ln(A),u=c<Math.floor(o*.5);}let f=un(r),g=cn(r,t);return {useFastPath:(p||u)&&!g&&!f,totalKeyed:o,moveCount:a,lisLen:c,hasPropChanges:g}}var ye=false,V=null;function Oe(){ye=true,V=new WeakSet;try{let e=v.clearPendingSyncTasks?.()??0;}catch{}}function Ke(){ye=false,V=null;}function X(){return ye}function _e(e){if(V)try{V.add(e);}catch(n){}}function dn(e){return !!(V&&V.has(e))}function fn(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 mn(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 pn(e,n){let t=mn(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 d of i)if(typeof d=="object"&&d!==null&&"type"in d&&typeof d.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{Pe(s);}catch{}let a=oe(s),l=L(s,i,a);return !l.useFastPath||l.totalKeyed<128?{...l,useFastPath:false,reason:"renderer-declined"}:{...l,useFastPath:true}}function hn(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;Oe();try{v.runWithSyncProgress(()=>{t(n,e.target);try{fn(e);}catch{}});let o=v.clearPendingSyncTasks?.()??0;return !0}finally{Ke();}}function gn(e,n){if(!pn(e,n).useFastPath)return false;try{return hn(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:X,enterBulkCommit:Oe,exitBulkCommit:Ke,tryRuntimeFastLaneSync:gn,markFastPathApplied:_e,isFastPathApplied:dn});var Le=Symbol("__FOR_BOUNDARY__");function T(e){return typeof e=="object"&&e!==null&&"type"in e}function Ve(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{Ue(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Be(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{Ve(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Be(e,o=>{try{Ve(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 Ee(e,n){R(e);}var C=new WeakMap;function He(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&&(He(e),Be(e,He));}var k=globalThis;function ie(e,n){}var _n=(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=J();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||_n,renderFn:n,parentInstance:o,mounted:false}}var qe=1;function je(e,n,t,r){let o=t,s=Object.assign(()=>o,{set(c){let f=typeof c=="function"?c(o):c;f!==o&&(o=f);}}),i=()=>null,a=ae(`for-item-${e}`,i,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let l=J();z(a);let d=We();a._currentRenderToken=qe++,a._pendingReadStates=new Set;let p=r.renderFn(n,()=>s());O(a),z(l);let u={key:e,item:n,indexSignal:s,componentInstance:a,vnode:p,_startStateIndex:d};return a._pendingFlushTask=()=>{let c=J();z(a),a.stateIndexCheck=-1;let f=a.stateValues;for(let m=0;m<f.length;m++){let h=f[m];h&&(h._hasBeenRead=false);}Ge(d),a._currentRenderToken=qe++,a._pendingReadStates=new Set;try{let m=r.renderFn(n,()=>s());u.vnode=m,O(a);}finally{z(c);}let g=r.parentInstance;g&&g._enqueueRun?.();},u}function En(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 u=true;for(let c=0;c<i;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<i;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){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),c.push(h.vnode);}for(let f=i;f<a;f++){let g=n[f],m=s(g,f),h=je(m,g,f,e);r.set(m,h),c.push(h.vnode),o[f]=m;}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}if(a<=i){let u=true;for(let c=0;c<a;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<a;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){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),c.push(h.vnode);}for(let f=a;f<i;f++){let g=o[f],m=r.get(g);if(m){let h=m.componentInstance;h.abortController.abort();for(let A of h.cleanupFns)try{A();}catch{}r.delete(g);}}return o.length=a,e.orderedKeys=o,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}if(i===a){let u=true;for(let c=0;c<i;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<i;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){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),c.push(h.vnode);}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}let l=new Set(o),d=[],p=[];for(let u=0;u<n.length;u++){let c=n[u],f=s(c,u);l.delete(f),d.push(f);let g=r.get(f);if(g){let m=g.item!==c,h=g.indexSignal()!==u;if(m){g.item=c;let A=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=g.componentInstance,g.vnode=e.renderFn(c,()=>g.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=A;}h&&g.indexSignal.set(u),p.push(g.vnode);}else {let m=je(f,c,u,e);r.set(f,m),p.push(m.vnode);}}for(let u of l){let c=r.get(u);if(c){let f=c.componentInstance;f.abortController.abort();for(let g of f.cleanupFns)try{g();}catch{}r.delete(u);}}return e.orderedKeys=d,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),p}function $e(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return En(e,t)}var Sn=typeof document<"u",Xe=0;function kn(){let e="__COMPONENT_INSTANCE_ID";try{N(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 An(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 bn(e,n,t){for(let r in n){let o=n[r];if(r==="ref"){Tn(e,o);continue}if(he(r)||o==null||o===false)continue;let s=j(r);if(s){An(e,s,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?Cn(e,r,o,t):e.setAttribute(r,String(o));}}function Tn(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function Cn(e,n,t,r){n==="value"?((Y(r,"input")||Y(r,"textarea")||Y(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(Y(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(!Sn)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 vn(e,n,t);if(typeof n=="function")return Nn(e,n,t);if(n===Le)return wn(e,t);if(typeof n=="symbol"&&(n===b$1||String(n)==="Symbol(Fragment)"))return Rn(e,t)}return null}function vn(e,n,t){let r=document.createElement(n);ze(r,e,t),bn(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 Nn(e,n,t){let o=e[Re]||we(),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=ae(kn(),s,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let l=q(o,()=>Qe(a));if(l instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let d=q(o,()=>_(l));if(d instanceof Element)return ke(a,d),d;if(!d){let u=document.createComment("");return a._placeholder=u,a.mounted=true,a.notifyUpdate=a._enqueueRun,u}let p=document.createElement("div");return p.appendChild(d),ke(a,p),p}function Rn(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 wn(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=$e(t,r),s=[],i=false;for(let l=0;l<o.length;l++){let d=o[l],p=d.key,u=null;if(p!=null&&t.items.has(p)){let c=t.items.get(p);c._dom&&c.vnode===d&&(u=c._dom);}u||(u=_(d),i=true,p!=null&&t.items.has(p)&&(t.items.get(p)._dom=u??void 0)),s.push(u);}if(!i&&s.length!==t.orderedKeys.length&&(i=true),!i)return document.createDocumentFragment();let a=document.createDocumentFragment();for(let l of s)l&&a.appendChild(l);return a}function I(e,n,t=true){if(!T(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(he(i))continue;let l=j(i);if(a==null||a===false){if(i==="class"||i==="className")e.className="";else if(l&&o?.has(l)){let d=o.get(l);d.options!==void 0?e.removeEventListener(l,d.handler,d.options):e.removeEventListener(l,d.handler),o.delete(l);}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(l){o&&o.size>0&&(s??=new Set).add(l);let d=o?.get(l);if(d&&d.original===a)continue;d&&(d.options!==void 0?e.removeEventListener(l,d.handler,d.options):e.removeEventListener(l,d.handler));let p=W(a,true),u=$(l);u!==void 0?e.addEventListener(l,p,u):e.addEventListener(l,p),C.has(e)||C.set(e,new Map),C.get(e).set(l,{handler:p,original:a,options:u});}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;xn(e,i);}}function xn(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)){Ae(e,n);return}e.textContent="";let t=_(n);t&&e.appendChild(t);}function Ae(e,n){let t=Array.from(e.children),r=n.some(i=>typeof i=="string"||typeof i=="number"),o=n.some(i=>T(i));if(r&&o){let i=Array.from(e.childNodes),a=Math.max(i.length,n.length);for(let l=0;l<a;l++){let d=i[l],p=n[l];if(p===void 0&&d){d.nodeType===1&&R(d),d.remove();continue}if(!d&&p!==void 0){let u=_(p);u&&e.appendChild(u);continue}if(!(!d||p===void 0)){if(typeof p=="string"||typeof p=="number")if(d.nodeType===3)d.data=String(p);else {let u=document.createTextNode(String(p));e.replaceChild(u,d);}else if(T(p))if(d.nodeType===1){let u=d;if(typeof p.type=="string")if(B(u.tagName,p.type))I(u,p);else {let c=_(p);c&&(M(u),R(u),e.replaceChild(c,d));}}else {let u=_(p);u&&e.replaceChild(u,d);}}}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],l=n[i];if(l===void 0&&a){R(a),a.remove();continue}if(!a&&l!==void 0){let d=_(l);d&&e.appendChild(d);continue}if(!(!a||l===void 0))if(typeof l=="string"||typeof l=="number")a.textContent=String(l);else if(T(l))if(typeof l.type=="string")if(B(a.tagName,l.type))I(a,l);else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}}}function le(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 d=0;d<t;d++){let{key:p,vnode:u}=n[d],c=e.children[d];if(c&&T(u)&&typeof u.type=="string"){let f=u.type;if(B(c.tagName,f)){let g=u.children||u.props?.children;i&&re("positional idx",d,{chTag:c.tagName,vnodeType:f,chChildNodes:c.childNodes.length,childrenType:Array.isArray(g)?"array":typeof g}),Fn(c,g,u),In(c,p,()=>o++),r++;continue}else i&&re("positional tag mismatch",d,{chTag:c.tagName,vnodeType:f});}else i&&re("positional missing or invalid",d,{ch:!!c});Dn(e,d,u);}let a=G()-s;On(e,n);let l={n:t,reused:r,updatedKeys:o,t:a};return te(l,"bulkKeyedPositionalHits"),l}function Fn(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])):Mn(e,t)||I(e,t);}function Mn(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 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,l=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 l=="string"||typeof l=="number")H(i,String(l));else if(Array.isArray(l)&&l.length===1&&(typeof l[0]=="string"||typeof l[0]=="number"))H(i,String(l[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 In(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Pn(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 Y(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=Pn(n);return t!==null&&e===t?true:Y(e,n)}function Dn(e,n,t){let r=_(t);if(r){let o=e.children[n];o?(R(o),e.replaceChild(r,o)):e.appendChild(r);}}function On(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 p=0;p<n.length;p++){let u=Kn(n[p],r[p],o);u==="reused"?s++:u==="created"&&i++;}let a=G()-t,l=Hn(e,o);S.delete(e);let d={n:n.length,reused:s,created:i,tBuild:a,tCommit:l};return Bn(d),d}function Kn(e,n,t){return typeof e=="string"||typeof e=="number"?Ln(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?Vn(e,n,t):"skipped"}function Ln(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function Vn(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 Hn(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 ne("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Bn(e){try{b("__LAST_BULK_TEXT_FASTPATH_STATS",e),b("__LAST_FASTPATH_STATS",e),b("__LAST_FASTPATH_COMMIT_COUNT",1),N("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 Se({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let s=Un(n);if(s.componentFound!==void 0)return Se({phase:"bulk-unkeyed-eligible",reason:"component-child",index:s.componentFound}),false;let i=s.simple/o,a=i>=r&&e.childNodes.length>=o;return Se({phase:"bulk-unkeyed-eligible",total:o,simple:s.simple,fraction:i,requiredFraction:r,eligible:a}),a}function Un(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"&&qn(o)&&n++;}}return {simple:n}}function qn(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 Se(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{b("__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;Ne()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let s,i;if(o<=20)try{let u=e.children;s=new Array(u.length);for(let c=0;c<u.length;c++)s[c]=u[c];}catch(u){s=void 0;}else {i=new Map;try{for(let u=e.firstElementChild;u;u=u.nextElementSibling){let c=u.getAttribute("data-key");if(c!==null){i.set(c,u);let f=Number(c);Number.isNaN(f)||i.set(f,u);}}}catch(u){i=void 0;}}let a$1=[],l=0,d=0,p=0;for(let u=0;u<n.length;u++){let{key:c,vnode:f}=n[u];l++;let g;if(o<=20&&s){let m=String(c);for(let h=0;h<s.length;h++){let A=s[h],F=A.getAttribute("data-key");if(F!==null&&(F===m||Number(F)===c)){g=A;break}}g||(g=t?.get(c));}else g=i?.get(c)??t?.get(c);if(g)a$1.push(g),p++;else {let m=_(f);m&&(a$1.push(m),d++);}}if(r&&r.length)for(let u of r){let c=_(u);c&&(a$1.push(c),d++);}try{let u=Date.now(),c=document.createDocumentFragment(),f=0;for(let m=0;m<a$1.length;m++)c.appendChild(a$1[m]),f++;try{for(let m=e.firstChild;m;){let h=m.nextSibling;m instanceof Element&&M(m),R(m),m=h;}}catch(m){}try{N("__DOM_REPLACE_COUNT"),b("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(m){}e.replaceChildren(c);try{b("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(m){}try{X()&&_e(e);}catch(m){}let g=new Map;for(let m=0;m<n.length;m++){let h=n[m].key,A=a$1[m];A instanceof Element&&g.set(h,A);}try{let m={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-u,t_commit:0,t_bookkeeping:0,fragmentAppendCount:f,mapLookups:l,createdNodes:d,reusedCount:p};typeof globalThis<"u"&&(b("__LAST_FASTPATH_STATS",m),b("__LAST_FASTPATH_REUSED",p>0),N("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:d,reusedCount:p}));}catch(m){}try{De.add(e);}catch(m){}return g}catch(u){return null}}function ue(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 ce(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=$n(n),s=t||jn(e),i=Wn(e,n,r,o,s);return i||Qn(e,n,r,s)}function jn(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 $n(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],s=D(o);s!==void 0?n.push({key:s,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Wn(e,n,t,r,o){try{let s=Gn(e,n,t,r,o);if(s)return s;let i=Xn(e,t);if(i)return i}catch{}return null}function Gn(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 Xn(e,n){let t=n.length;if(t<10||zn(e,n)/t<.9||Jn(e,n))return null;try{let o=le(e,n);return te(o,"bulkKeyedPositionalHits"),Yn(e),S.get(e)}catch{return null}}function zn(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&&ue(s.tagName,o.type)&&t++;}}catch{}return t}function Jn(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")&&Me(o,r.props||{}))return !0}}catch{return true}return false}function Yn(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 Qn(e,n,t,r){let o=new Map,s=[],i=new WeakSet,a=Zn(e,r,i);for(let l=0;l<n.length;l++){let d=n[l],p=nt(d,l,e,a,i,o);p&&s.push(p);}return typeof document>"u"||(at(e,s),S.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 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 l=n.get(a);if(l&&!t.has(l))return t.add(l),l}return et(e,r,s,t)}}function et(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 nt(e,n,t,r,o,s){let i=D(e);return i!==void 0?tt(e,i,t,r,s):rt(e,n,t,o)}function tt(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"&&ue(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 rt(e,n,t,r){try{let s=t.children[n];if(s&&(typeof e=="string"||typeof e=="number")&&s.nodeType===1)return s.textContent=String(e),r.add(s),s;if(ot(s,e))return I(s,e),r.add(s),s;let i=st(t,r);if(i){let a=it(i,e,r);if(a)return a}}catch{}return _(e)}function ot(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"&&ue(e.tagName,t.type)}function st(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function it(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"&&ue(e.tagName,r.type))return I(e,n),t.add(e),e}return null}function at(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{}ne("reconcile"),e.replaceChildren(t);}var be=new WeakMap;function Te(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 lt(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 ut(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function en(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 ct(e){let n=S.get(e);return n||(n=en(e),n.size>0&&S.set(e,n)),n.size>0?n:void 0}function nn(e){for(let n=0;n<e.length;n++)if(D(e[n])!==void 0)return true;return false}function dt(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&ft(e,n))return;let r=ce(e,n,t);S.set(e,r);}function ft(e,n){try{let t=[];for(let s of n)T(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=le(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{b("__LAST_FASTPATH_STATS",r),b("__LAST_FASTPATH_COMMIT_COUNT",1),N("bulkKeyedPositionalForced");}catch{}let o=en(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 mt(e,n){if(Ye(e,n)){Je(e,n);}else Ae(e,n);S.delete(e);}function pt(e,n){if(!n){e.textContent="",S.delete(e);return}if(!Array.isArray(n)){e.textContent="";let t=_(n);t&&e.appendChild(t),S.delete(e);return}if(nn(n)){let t=ct(e);try{dt(e,n,t);}catch{let r=ce(e,n,t);S.set(e,r);}}else mt(e,n);}function Ce(e,n){let t=n.children||n.props?.children;t&&!Array.isArray(t)&&(t=[t]);let r=lt(t);r.isSimple&&ut(e,r.text)||pt(e,t),I(e,n,false);}function ht(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&&T(o)&&typeof o.type=="string"&&Te(t.tagName,o.type)){Ce(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 gt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){yt(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 yt(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function _t(e,n){let t=n.children;if(!Array.isArray(t)||!nn(t))return false;let r=document.createElement(n.type);e.appendChild(r),gt(r,n.props||{});let o=ce(r,t,void 0);return S.set(r,o),true}function Et(e){return T(e)&&typeof e.type=="symbol"&&(e.type===b$1||String(e.type)==="Symbol(askr.fragment)")}function St(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&&be.has(t)){let r=be.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),be.set(t,{start:r,end:o});let s=_(e);s&&n.insertBefore(s,o);}else {let r=e;if(Et(r)){let a=St(r);if(a.length===1&&T(a[0])&&typeof a[0].type=="string")r=a[0];else {ht(n,a);return}}let s=n.__ASKR_INSTANCE;if(s&&s.target===n)if(T(r)&&typeof r.type=="string"&&Te(n.tagName,r.type)){Ce(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&&T(r)&&typeof r.type=="string"&&Te(i.tagName,r.type))Ce(i,r);else {if(n.textContent="",T(r)&&typeof r.type=="string"&&_t(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:oe};}function ae(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,on(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,v.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var x=null,de=0;function $r(){return x}function z(e){x=e;}function tn(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 ke(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&&tn(e);}var rn=0;function on(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++rn,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=sn(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{}v.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){O(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,O(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 l=Array.from(e.target.childNodes);for(let d of l)try{Ee(d);}catch(p){a.warn("[Askr] error cleaning up failed commit children:",p);}}catch(l){}try{N("__DOM_REPLACE_COUNT"),b("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(l){}throw e.target.replaceChildren(...o),a$1}finally{x=i;}O(e),e.mounted=!0,s&&e.mountOperations.length>0&&tn(e);}catch(s){try{let i=Array.from(e.target.childNodes);for(let a$1 of i)try{Ee(a$1);}catch(l){a.warn("[Askr] error cleaning up partial children during rollback:",l);}}catch(i){}try{try{N("__DOM_REPLACE_COUNT"),b("__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=++rn,e._pendingReadStates=new Set);try{let o=sn(e);return n||O(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function sn(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,x=e,de=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 l=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${l} 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 kt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,v.enqueue(()=>on(e));}function J(){return x}function Gr(){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 O(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 Xr(){return de++}function We(){return de}function Ge(e){de=e;}function zr(e){kt(e);}function Ue(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{fe as a,v as b,Ct as c,we as d,X as e,Le as f,M as g,Wt as h,ae as i,$r as j,z as k,J as l,Gr as m,Xr as n,zr as o,Ue as p};
@@ -1 +1 @@
1
- import {b,l}from'./chunk-2T3T4RZC.js';import {p,o}from'./chunk-WGORSKNX.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-7DNGQWPJ.js';import {p,o}from'./chunk-LW2VF6A3.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-V7SQ5U7C.js';import'../chunk-O3XARUHF.js';import'../chunk-WGORSKNX.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';
1
+ export{a as For}from'../chunk-BJ3TA3ZK.js';import'../chunk-FYTGHAKU.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';
@@ -1 +1 @@
1
- import {a}from'../chunk-O3XARUHF.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-WGORSKNX.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-FYTGHAKU.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-LW2VF6A3.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-WGORSKNX.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-LW2VF6A3.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-V7SQ5U7C.js';export{a as state}from'./chunk-O3XARUHF.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-WGORSKNX.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-B4ZJ6FEJ.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-2T6BK5D5.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-2T6BK5D5.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-BJ3TA3ZK.js';export{a as state}from'./chunk-FYTGHAKU.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-LW2VF6A3.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-WP5TWBJE.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-R2PQVY2C.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-R2PQVY2C.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-OD6C42QU.js';import'./chunk-7DNGQWPJ.js';import'./chunk-D2JSJKCW.js';import'./chunk-LW2VF6A3.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
@@ -1 +1 @@
1
- import {a}from'../chunk-O3XARUHF.js';import {c,a as a$1}from'../chunk-YRY4OLQF.js';import {j,d as d$1,b,c as c$1}from'../chunk-WGORSKNX.js';export{m as getSignal}from'../chunk-WGORSKNX.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-FYTGHAKU.js';import {c,a as a$1}from'../chunk-YRY4OLQF.js';import {j,d as d$1,b,c as c$1}from'../chunk-LW2VF6A3.js';export{m as getSignal}from'../chunk-LW2VF6A3.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-2T3T4RZC.js';import'./chunk-D2JSJKCW.js';import'./chunk-WGORSKNX.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-7DNGQWPJ.js';import'./chunk-D2JSJKCW.js';import'./chunk-LW2VF6A3.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
@@ -1 +1 @@
1
- import {b}from'../chunk-LMNN4PPU.js';export{b as navigate}from'../chunk-LMNN4PPU.js';import {i,b as b$1}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-2T3T4RZC.js';import'../chunk-D2JSJKCW.js';import'../chunk-WGORSKNX.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function c({href:o,children:p}){let i$1=i({isNative:true,disabled:false,onPress:u=>{let t=u;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),b(o));}});return {type:"a",props:b$1(i$1,{href:o,children:p})}}export{c as Link};
1
+ import {b}from'../chunk-OD6C42QU.js';export{b as navigate}from'../chunk-OD6C42QU.js';import {i,b as b$1}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-7DNGQWPJ.js';import'../chunk-D2JSJKCW.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function c({href:o,children:p}){let i$1=i({isNative:true,disabled:false,onPress:u=>{let t=u;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),b(o));}});return {type:"a",props:b$1(i$1,{href:o,children:p})}}export{c 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-2T3T4RZC.js';import'../chunk-D2JSJKCW.js';import {j,i,k as k$1}from'../chunk-WGORSKNX.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-7DNGQWPJ.js';import'../chunk-D2JSJKCW.js';import {j,i,k as k$1}from'../chunk-LW2VF6A3.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.13",
3
+ "version": "0.0.14",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -86,17 +86,17 @@
86
86
  },
87
87
  "devDependencies": {
88
88
  "@eslint/js": "^9.39.2",
89
- "@types/node": "^25.0.8",
89
+ "@types/node": "^25.0.9",
90
90
  "cross-env": "^10.1.0",
91
91
  "eslint": "^9.39.2",
92
92
  "eslint-config-prettier": "^10.1.8",
93
93
  "jiti": "^2.6.1",
94
94
  "jsdom": "^27.4.0",
95
- "prettier": "^3.7.4",
95
+ "prettier": "^3.8.0",
96
96
  "tsup": "^8.5.1",
97
97
  "tsd": "^0.33.0",
98
98
  "typescript": "^5.9.3",
99
- "typescript-eslint": "^8.53.0",
99
+ "typescript-eslint": "^8.53.1",
100
100
  "vitest": "^4.0.17",
101
101
  "vite": "^7.3.1"
102
102
  }
@@ -1 +0,0 @@
1
- import {a}from'./chunk-O3XARUHF.js';import {h,f}from'./chunk-WGORSKNX.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 +0,0 @@
1
- import {a}from'./chunk-HGMOQ3I7.js';import {b}from'./chunk-37RC6ZT3.js';function fe(e,n,t){if(!e){let r=t?`
2
- `+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function Te(e,n){fe(e,`[Scheduler Precondition] ${n}`);}function Q(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var me=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){Te(typeof n=="function","enqueue() requires a function"),!(Q()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!Q()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!Q())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){fe(!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__||{},l={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:Q(),namespace:a};s(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(l)}`));},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 me;function Ce(){return C.isExecuting()}var ve=Symbol("__tempoContextFrame__"),Z=null;function U(e,n){let t=Z;Z=e;try{return n()}finally{Z=t;}}function Ct(e,n){try{return n()}finally{}}function Ne(){return Z}function Re(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function A(e,n){try{let t=Re();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=Re(),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 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=>{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 he(e){return e==="children"||e==="key"||e==="ref"}function ee(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function ge(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 we(e){for(let n of Object.keys(e))if(!ee(n))return true;return false}function xe(e,n){for(let t of Object.keys(n))if(!ee(t)&&ge(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 Fe(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 ne(e){try{v("__DOM_REPLACE_COUNT"),A(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function te(e,n){try{A("__LAST_FASTPATH_STATS",e),A("__LAST_FASTPATH_COMMIT_COUNT",1),n&&v(n);}catch{}}function re(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 S=new WeakMap;function oe(e){return S.get(e)}function Me(e){try{if(S.has(e))return;let n=Fe(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 Ie=new WeakSet;function an(e){let n=[];for(let t of e){let r=O(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function un(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 ln(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&we(t.props))return true}return false}function cn(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(!ee(a)&&ge(o,a,i[a]))return true}return false}function L(e,n,t){let r=an(n),o=r.length,s=r.map(p=>p.key),i=t?Array.from(t.keys()):[],a=0;for(let p=0;p<s.length;p++){let b=s[p];(p>=i.length||i[p]!==b||!t?.has(b))&&a++;}let g=o>=128&&i.length>0&&a>Math.max(64,Math.floor(o*.1)),c=false,u=0;if(o>=128){let p=Array.from(e.children),b=r.map(({key:x})=>{let P=t?.get(x);return P?.parentElement===e?p.indexOf(P):-1});u=un(b),c=u<Math.floor(o*.5);}let d=ln(r),h=cn(r,t);return {useFastPath:(g||c)&&!h&&!d,totalKeyed:o,moveCount:a,lisLen:u,hasPropChanges:h}}var ye=false,V=null;function Pe(){ye=true,V=new WeakSet;try{let e=C.clearPendingSyncTasks?.()??0;}catch{}}function Oe(){ye=false,V=null;}function G(){return ye}function _e(e){if(V)try{V.add(e);}catch(n){}}function dn(e){return !!(V&&V.has(e))}function fn(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 mn(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 pn(e,n){let t=mn(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 m of i)if(typeof m=="object"&&m!==null&&"type"in m&&typeof m.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{Me(s);}catch{}let a=oe(s),l=L(s,i,a);return !l.useFastPath||l.totalKeyed<128?{...l,useFastPath:false,reason:"renderer-declined"}:{...l,useFastPath:true}}function hn(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;Pe();try{C.runWithSyncProgress(()=>{t(n,e.target);try{fn(e);}catch{}});let o=C.clearPendingSyncTasks?.()??0;return !0}finally{Oe();}}function gn(e,n){if(!pn(e,n).useFastPath)return false;try{return hn(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:G,enterBulkCommit:Pe,exitBulkCommit:Oe,tryRuntimeFastLaneSync:gn,markFastPathApplied:_e,isFastPathApplied:dn});var De=Symbol("__FOR_BOUNDARY__");function N(e){return typeof e=="object"&&e!==null&&"type"in e}function Ke(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{He(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Ve(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 F(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{Ke(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Ve(e,o=>{try{Ke(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 Ee(e,n){F(e);}var T=new WeakMap;function Le(e){let n=T.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);T.delete(e);}}function M(e){e&&(Le(e),Ve(e,Le));}var k=globalThis;function ie(e,n){}var _n=(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=z();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||_n,renderFn:n,parentInstance:o,mounted:false}}var Be=1;function Ue(e,n,t,r){let o=t,s=Object.assign(()=>o,{set(u){let d=typeof u=="function"?u(o):u;d!==o&&(o=d);}}),i=()=>null,a=ae(`for-item-${e}`,i,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let l=z();X(a);let m=je();a._currentRenderToken=Be++,a._pendingReadStates=new Set;let g=r.renderFn(n,()=>s());D(a),X(l);let c={key:e,item:n,indexSignal:s,componentInstance:a,vnode:g,_startStateIndex:m};return a._pendingFlushTask=()=>{let u=z();X(a),a.stateIndexCheck=-1;let d=a.stateValues;for(let f=0;f<d.length;f++){let p=d[f];p&&(p._hasBeenRead=false);}$e(m),a._currentRenderToken=Be++,a._pendingReadStates=new Set;try{let f=r.renderFn(n,()=>s());c.vnode=f,D(a);}finally{X(u);}let h=r.parentInstance;h&&h._enqueueRun?.();},c}function En(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 c=true;for(let u=0;u<i;u++)if(s(n[u],u)!==o[u]){c=false;break}if(c){let u=[];for(let d=0;d<i;d++){let h=n[d],f=o[d],p=r.get(f);let b=p.item!==h,x=p.indexSignal()!==d;if(b){p.item=h;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=p.componentInstance,p.vnode=e.renderFn(h,()=>p.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}x&&p.indexSignal.set(d),u.push(p.vnode);}for(let d=i;d<a;d++){let h=n[d],f=s(h,d),p=Ue(f,h,d,e);r.set(f,p),u.push(p.vnode),o[d]=f;}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),u}}if(a<=i){let c=true;for(let u=0;u<a;u++)if(s(n[u],u)!==o[u]){c=false;break}if(c){let u=[];for(let d=0;d<a;d++){let h=n[d],f=o[d],p=r.get(f);let b=p.item!==h,x=p.indexSignal()!==d;if(b){p.item=h;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=p.componentInstance,p.vnode=e.renderFn(h,()=>p.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}x&&p.indexSignal.set(d),u.push(p.vnode);}for(let d=a;d<i;d++){let h=o[d],f=r.get(h);if(f){let p=f.componentInstance;p.abortController.abort();for(let b of p.cleanupFns)try{b();}catch{}r.delete(h);}}return o.length=a,e.orderedKeys=o,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),u}}if(i===a){let c=true;for(let u=0;u<i;u++)if(s(n[u],u)!==o[u]){c=false;break}if(c){let u=[];for(let d=0;d<i;d++){let h=n[d],f=o[d],p=r.get(f);let b=p.item!==h,x=p.indexSignal()!==d;if(b){p.item=h;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=p.componentInstance,p.vnode=e.renderFn(h,()=>p.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}x&&p.indexSignal.set(d),u.push(p.vnode);}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),u}}let l=new Set(o),m=[],g=[];for(let c=0;c<n.length;c++){let u=n[c],d=s(u,c);l.delete(d),m.push(d);let h=r.get(d);if(h){let f=h.item!==u,p=h.indexSignal()!==c;if(f){h.item=u;let b=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(u,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=b;}p&&h.indexSignal.set(c),g.push(h.vnode);}else {let f=Ue(d,u,c,e);r.set(d,f),g.push(f.vnode);}}for(let c of l){let u=r.get(c);if(u){let d=u.componentInstance;d.abortController.abort();for(let h of d.cleanupFns)try{h();}catch{}r.delete(c);}}return e.orderedKeys=m,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),g}function qe(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return En(e,t)}var Sn=typeof document<"u",We=0;function kn(){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 We++,`comp-${We}`}function bn(e,n,t){let r=$(t,true),o=j(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),T.has(e)||T.set(e,new Map),T.get(e).set(n,{handler:r,original:t,options:o});}function An(e,n,t){for(let r in n){let o=n[r];if(he(r)||o==null||o===false)continue;if(r==="ref"){Tn(e,o);continue}let s=q(r);if(s){bn(e,s,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?Cn(e,r,o,t):e.setAttribute(r,String(o));}}function Tn(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function Cn(e,n,t,r){n==="value"?((J(r,"input")||J(r,"textarea")||J(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(J(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function Ge(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function _(e){if(!Sn)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 vn(e,n,t);if(typeof n=="function")return Nn(e,n,t);if(n===De)return wn(e,t);if(typeof n=="symbol"&&(n===b||String(n)==="Symbol(Fragment)"))return Rn(e,t)}return null}function vn(e,n,t){let r=document.createElement(n);Ge(r,e,t),An(r,t,n);let o=t.children||e.children;if(o)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 Nn(e,n,t){let o=e[ve]||Ne(),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=ae(kn(),s,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let l=U(o,()=>Je(a));if(l instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let m=U(o,()=>_(l));if(m instanceof Element)return ke(a,m),m;if(!m){let c=document.createComment("");return a._placeholder=c,a.mounted=true,a.notifyUpdate=a._enqueueRun,c}let g=document.createElement("div");return g.appendChild(m),ke(a,g),g}function Rn(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 wn(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=qe(t,r),s=[],i=false;for(let l=0;l<o.length;l++){let m=o[l],g=m.key,c=null;if(g!=null&&t.items.has(g)){let u=t.items.get(g);u._dom&&u.vnode===m&&(c=u._dom);}c||(c=_(m),i=true,g!=null&&t.items.has(g)&&(t.items.get(g)._dom=c??void 0)),s.push(c);}if(!i&&s.length!==t.orderedKeys.length&&(i=true),!i)return document.createDocumentFragment();let a=document.createDocumentFragment();for(let l of s)l&&a.appendChild(l);return a}function I(e,n,t=true){if(!N(n))return;let r=n.props||{};Ge(e,n,r);let o=T.get(e),s=null;for(let i in r){let a=r[i];if(he(i))continue;let l=q(i);if(a==null||a===false){if(i==="class"||i==="className")e.className="";else if(l&&o?.has(l)){let m=o.get(l);m.options!==void 0?e.removeEventListener(l,m.handler,m.options):e.removeEventListener(l,m.handler),o.delete(l);}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(l){o&&o.size>0&&(s??=new Set).add(l);let m=o?.get(l);if(m&&m.original===a)continue;m&&(m.options!==void 0?e.removeEventListener(l,m.handler,m.options):e.removeEventListener(l,m.handler));let g=$(a,false),c=j(l);c!==void 0?e.addEventListener(l,g,c):e.addEventListener(l,g),T.has(e)||T.set(e,new Map),T.get(e).set(l,{handler:g,original:a,options:c});}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);T.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&&T.delete(e);}if(t){let i=n.children||r.children;xn(e,i);}}function xn(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)){be(e,n);return}e.textContent="";let t=_(n);t&&e.appendChild(t);}function be(e,n){let t=Array.from(e.children);if(n.length===1&&t.length===0&&e.childNodes.length===1){let o=n[0],s=e.firstChild;if((typeof o=="string"||typeof o=="number")&&s?.nodeType===3){s.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 s=t[o],i=n[o];if(i===void 0&&s){F(s),s.remove();continue}if(!s&&i!==void 0){let a=_(i);a&&e.appendChild(a);continue}if(!(!s||i===void 0))if(typeof i=="string"||typeof i=="number")s.textContent=String(i);else if(N(i))if(typeof i.type=="string")if(Y(s.tagName,i.type))I(s,i);else {let a=_(i);a&&(s instanceof Element&&M(s),F(s),e.replaceChild(a,s));}else {let a=_(i);a&&(s instanceof Element&&M(s),F(s),e.replaceChild(a,s));}else {let a=_(i);a&&(s instanceof Element&&M(s),F(s),e.replaceChild(a,s));}}}function ue(e,n){let t=n.length,r=0,o=0,s=W(),i=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let m=0;m<t;m++){let{key:g,vnode:c}=n[m],u=e.children[m];if(u&&N(c)&&typeof c.type=="string"){let d=c.type;if(Y(u.tagName,d)){let h=c.children||c.props?.children;i&&re("positional idx",m,{chTag:u.tagName,vnodeType:d,chChildNodes:u.childNodes.length,childrenType:Array.isArray(h)?"array":typeof h}),Fn(u,h,c),In(u,g,()=>o++),r++;continue}else i&&re("positional tag mismatch",m,{chTag:u.tagName,vnodeType:d});}else i&&re("positional missing or invalid",m,{ch:!!u});On(e,m,c);}let a=W()-s;Dn(e,n);let l={n:t,reused:r,updatedKeys:o,t:a};return te(l,"bulkKeyedPositionalHits"),l}function Fn(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])):Mn(e,t)||I(e,t);}function Mn(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(!N(r)||!N(o)||typeof r.type!="string"||typeof o.type!="string")return false;let s=e.children[0],i=e.children[1];if(!s||!i||!Y(s.tagName,r.type)||!Y(i.tagName,o.type))return false;let a=r.children||r.props?.children,l=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 l=="string"||typeof l=="number")H(i,String(l));else if(Array.isArray(l)&&l.length===1&&(typeof l[0]=="string"||typeof l[0]=="number"))H(i,String(l[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 In(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Pn(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 J(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 Y(e,n){let t=Pn(n);return t!==null&&e===t?true:J(e,n)}function On(e,n,t){let r=_(t);if(r){let o=e.children[n];o?(F(o),e.replaceChild(r,o)):e.appendChild(r);}}function Dn(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 Xe(e,n){let t=W(),r=Array.from(e.childNodes),o=[],s=0,i=0;for(let g=0;g<n.length;g++){let c=Kn(n[g],r[g],o);c==="reused"?s++:c==="created"&&i++;}let a=W()-t,l=Hn(e,o);S.delete(e);let m={n:n.length,reused:s,created:i,tBuild:a,tCommit:l};return Bn(m),m}function Kn(e,n,t){return typeof e=="string"||typeof e=="number"?Ln(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?Vn(e,n,t):"skipped"}function Ln(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function Vn(e,n,t){let r=e;if(typeof r.type=="string"){let s=r.type;if(n&&n.nodeType===1&&Y(n.tagName,s))return I(n,e),t.push(n),"reused"}let o=_(e);return o?(t.push(o),"created"):"skipped"}function Hn(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),F(o),o=s;}}catch{}return ne("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Bn(e){try{A("__LAST_BULK_TEXT_FASTPATH_STATS",e),A("__LAST_FASTPATH_STATS",e),A("__LAST_FASTPATH_COMMIT_COUNT",1),v("bulkTextFastpathHits");}catch{}}function ze(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 Se({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let s=Un(n);if(s.componentFound!==void 0)return Se({phase:"bulk-unkeyed-eligible",reason:"component-child",index:s.componentFound}),false;let i=s.simple/o,a=i>=r&&e.childNodes.length>=o;return Se({phase:"bulk-unkeyed-eligible",total:o,simple:s.simple,fraction:i,requiredFraction:r,eligible:a}),a}function Un(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"&&qn(o)&&n++;}}return {simple:n}}function qn(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 Se(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{A("__BULK_DIAG",e);}catch{}}function Ye(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;Ce()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let s,i;if(o<=20)try{let c=e.children;s=new Array(c.length);for(let u=0;u<c.length;u++)s[u]=c[u];}catch(c){s=void 0;}else {i=new Map;try{for(let c=e.firstElementChild;c;c=c.nextElementSibling){let u=c.getAttribute("data-key");if(u!==null){i.set(u,c);let d=Number(u);Number.isNaN(d)||i.set(d,c);}}}catch(c){i=void 0;}}let a$1=[],l=0,m=0,g=0;for(let c=0;c<n.length;c++){let{key:u,vnode:d}=n[c];l++;let h;if(o<=20&&s){let f=String(u);for(let p=0;p<s.length;p++){let b=s[p],x=b.getAttribute("data-key");if(x!==null&&(x===f||Number(x)===u)){h=b;break}}h||(h=t?.get(u));}else h=i?.get(u)??t?.get(u);if(h)a$1.push(h),g++;else {let f=_(d);f&&(a$1.push(f),m++);}}if(r&&r.length)for(let c of r){let u=_(c);u&&(a$1.push(u),m++);}try{let c=Date.now(),u=document.createDocumentFragment(),d=0;for(let f=0;f<a$1.length;f++)u.appendChild(a$1[f]),d++;try{for(let f=e.firstChild;f;){let p=f.nextSibling;f instanceof Element&&M(f),F(f),f=p;}}catch(f){}try{v("__DOM_REPLACE_COUNT"),A("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(f){}e.replaceChildren(u);try{A("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(f){}try{G()&&_e(e);}catch(f){}let h=new Map;for(let f=0;f<n.length;f++){let p=n[f].key,b=a$1[f];b instanceof Element&&h.set(p,b);}try{let f={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-c,t_commit:0,t_bookkeeping:0,fragmentAppendCount:d,mapLookups:l,createdNodes:m,reusedCount:g};typeof globalThis<"u"&&(A("__LAST_FASTPATH_STATS",f),A("__LAST_FASTPATH_REUSED",g>0),v("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:m,reusedCount:g}));}catch(f){}try{Ie.add(e);}catch(f){}return h}catch(c){return null}}function le(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 ce(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=$n(n),s=t||jn(e),i=Wn(e,n,r,o,s);return i||Qn(e,n,r,s)}function jn(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 $n(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 Wn(e,n,t,r,o){try{let s=Gn(e,n,t,r,o);if(s)return s;let i=Xn(e,t);if(i)return i}catch{}return null}function Gn(e,n,t,r,o){if(L(e,n,o).useFastPath&&t.length>=128||G())try{let i=Ye(e,t,o,r);if(i)return S.set(e,i),i}catch{}return null}function Xn(e,n){let t=n.length;if(t<10||zn(e,n)/t<.9||Jn(e,n))return null;try{let o=ue(e,n);return te(o,"bulkKeyedPositionalHits"),Yn(e),S.get(e)}catch{return null}}function zn(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&&le(s.tagName,o.type)&&t++;}}catch{}return t}function Jn(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")&&xe(o,r.props||{}))return !0}}catch{return true}return false}function Yn(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 Qn(e,n,t,r){let o=new Map,s=[],i=new WeakSet,a=Zn(e,r,i);for(let l=0;l<n.length;l++){let m=n[l],g=nt(m,l,e,a,i,o);g&&s.push(g);}return typeof document>"u"||(at(e,s),S.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 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 l=n.get(a);if(l&&!t.has(l))return t.add(l),l}return et(e,r,s,t)}}function et(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 nt(e,n,t,r,o,s){let i=O(e);return i!==void 0?tt(e,i,t,r,s):rt(e,n,t,o)}function tt(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"&&le(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 rt(e,n,t,r){try{let s=t.children[n];if(s&&(typeof e=="string"||typeof e=="number")&&s.nodeType===1)return s.textContent=String(e),r.add(s),s;if(ot(s,e))return I(s,e),r.add(s),s;let i=st(t,r);if(i){let a=it(i,e,r);if(a)return a}}catch{}return _(e)}function ot(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"&&le(e.tagName,t.type)}function st(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function it(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"&&le(e.tagName,r.type))return I(e,n),t.add(e),e}return null}function at(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),F(r),r=o;}}catch{}ne("reconcile"),e.replaceChildren(t);}var Ae=new WeakMap;function Qe(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 ut(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 lt(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function Ze(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 ct(e){let n=S.get(e);return n||(n=Ze(e),n.size>0&&S.set(e,n)),n.size>0?n:void 0}function en(e){for(let n=0;n<e.length;n++)if(O(e[n])!==void 0)return true;return false}function dt(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&ft(e,n))return;let r=ce(e,n,t);S.set(e,r);}function ft(e,n){try{let t=[];for(let s of n)N(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=ue(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{A("__LAST_FASTPATH_STATS",r),A("__LAST_FASTPATH_COMMIT_COUNT",1),v("bulkKeyedPositionalForced");}catch{}let o=Ze(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 mt(e,n){if(ze(e,n)){Xe(e,n);}else be(e,n);S.delete(e);}function pt(e,n){if(!n){e.textContent="",S.delete(e);return}if(!Array.isArray(n)){e.textContent="";let t=_(n);t&&e.appendChild(t),S.delete(e);return}if(en(n)){let t=ct(e);try{dt(e,n,t);}catch{let r=ce(e,n,t);S.set(e,r);}}else mt(e,n);}function nn(e,n){let t=n.children||n.props?.children,r=ut(t);r.isSimple&&lt(e,r.text)||pt(e,t),I(e,n,false);}function ht(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&&N(o)&&typeof o.type=="string"&&Qe(t.tagName,o.type)){nn(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 gt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){yt(e,r);continue}let o=q(t);if(o){let s=$(r,false),i=j(o);i!==void 0?e.addEventListener(o,s,i):e.addEventListener(o,s),T.has(e)||T.set(e,new Map),T.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 yt(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function _t(e,n){let t=n.children;if(!Array.isArray(t)||!en(t))return false;let r=document.createElement(n.type);e.appendChild(r),gt(r,n.props||{});let o=ce(r,t,void 0);return S.set(r,o),true}function Et(e){return N(e)&&typeof e.type=="symbol"&&(e.type===b||String(e.type)==="Symbol(askr.fragment)")}function St(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function B(e,n,t){if(n&&!(typeof document>"u"))if(t&&Ae.has(t)){let r=Ae.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),Ae.set(t,{start:r,end:o});let s=_(e);s&&n.insertBefore(s,o);}else {let r=e;if(Et(r)){let s=St(r);if(s.length===1&&N(s[0])&&typeof s[0].type=="string")r=s[0];else {ht(n,s);return}}let o=n.children[0];if(o&&N(r)&&typeof r.type=="string"&&Qe(o.tagName,r.type))nn(o,r);else {if(n.textContent="",N(r)&&typeof r.type=="string"&&_t(n,r))return;let s=_(r);s&&n.appendChild(s);}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:B,isKeyedReorderFastPathEligible:L,getKeyMapForElement:oe};}function ae(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,on(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,C.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var w=null,de=0;function $r(){return w}function X(e){w=e;}function tn(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 ke(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&&tn(e);}var rn=0;function on(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++rn,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=sn(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){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=w;w=e;try{B(t,i),s.replaceChild(i,o),e.target=i,e._placeholder=void 0,i.__ASKR_INSTANCE=e,D(e);}finally{w=a$1;}return}if(e.target){let o=[];try{let s=!e.mounted,i=w;w=e,o=Array.from(e.target.childNodes);try{B(t,e.target);}catch(a$1){try{let l=Array.from(e.target.childNodes);for(let m of l)try{Ee(m);}catch(g){a.warn("[Askr] error cleaning up failed commit children:",g);}}catch(l){}try{v("__DOM_REPLACE_COUNT"),A("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(l){}throw e.target.replaceChildren(...o),a$1}finally{w=i;}D(e),e.mounted=!0,s&&e.mountOperations.length>0&&tn(e);}catch(s){try{let i=Array.from(e.target.childNodes);for(let a$1 of i)try{Ee(a$1);}catch(l){a.warn("[Askr] error cleaning up partial children during rollback:",l);}}catch(i){}try{try{v("__DOM_REPLACE_COUNT"),A("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(i){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw s}}});}}function Je(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++rn,e._pendingReadStates=new Set);try{let o=sn(e);return n||D(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function sn(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,w=e,de=0;try{let t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=U(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 l=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${l} 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{w=null;}}function kt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,C.enqueue(()=>on(e));}function z(){return w}function Gr(){if(!w)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return w.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 Xr(){return de++}function je(){return de}function $e(e){de=e;}function zr(e){kt(e);}function He(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{fe as a,C as b,Ct as c,Ne as d,G as e,De as f,M as g,Wt as h,ae as i,$r as j,X as k,z as l,Gr as m,Xr as n,zr as o,He as p};
@@ -1 +0,0 @@
1
- export{d as cleanupNavigation,c as initializeNavigation,b as navigate,a as registerAppInstance}from'./chunk-LMNN4PPU.js';import'./chunk-2T3T4RZC.js';import'./chunk-D2JSJKCW.js';import'./chunk-WGORSKNX.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';