what-core 0.12.4 → 0.13.0

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/src/render.js CHANGED
@@ -2,9 +2,9 @@
2
2
  // Solid-style rendering: components run once, signals create individual DOM effects.
3
3
  // No VDOM diffing — direct DOM manipulation with surgical signal-driven updates.
4
4
 
5
- import { effect, untrack, createRoot, _createItemScope, signal, memo, __DEV__ } from './reactive.js';
5
+ import { effect, untrack, _createItemScope, signal, memo, __DEV__ } from './reactive.js';
6
6
  import { __resetIdCounter } from './a11y.js';
7
- import { createDOM, disposeTree, getCurrentComponent, getComponentStack, addHydrationDisposer, addHydratedComponent, _setSelectValue, _isUnsafeAttr, _isEventProp, _installLazyChildren, _handleNavigationSignal } from './dom.js';
7
+ import { createDOM, disposeTree, getComponentStack, addHydrationDisposer, addHydratedComponent, _setSelectValue, _isUnsafeAttr, _isEventProp, _installLazyChildren, _handleNavigationSignal } from './dom.js';
8
8
  import { _injectIslandRuntime, reportError } from './components.js';
9
9
  export { effect, untrack };
10
10
  // Re-export memo for compiled output (branch memoization: the compiler emits
@@ -112,14 +112,14 @@ function _$templateImpl(html) {
112
112
  const t = document.createElement('template');
113
113
  t.innerHTML = tableInfo.wrap + trimmed + tableInfo.unwrap;
114
114
  // Pre-navigate to the target element once — avoids per-clone traversal.
115
- let target = t.content.firstChild;
116
- for (let i = 0; i < tableInfo.depth; i++) target = target.firstChild;
115
+ let target = /** @type {Node} */ (t.content.firstChild);
116
+ for (let i = 0; i < tableInfo.depth; i++) target = /** @type {Node} */ (target.firstChild);
117
117
  return () => target.cloneNode(true);
118
118
  }
119
119
 
120
120
  const t = document.createElement('template');
121
121
  t.innerHTML = trimmed;
122
- return () => t.content.firstChild.cloneNode(true);
122
+ return () => /** @type {Node} */ (t.content.firstChild).cloneNode(true);
123
123
  }
124
124
 
125
125
  // Public export — warns in dev mode that this is a compiler internal.
@@ -157,13 +157,13 @@ export function svgTemplate(html) {
157
157
  // Complete <svg> element — parse in a div (browsers handle the namespace)
158
158
  const t = document.createElement('template');
159
159
  t.innerHTML = trimmed;
160
- return () => t.content.firstChild.cloneNode(true);
160
+ return () => /** @type {Node} */ (t.content.firstChild).cloneNode(true);
161
161
  }
162
162
 
163
163
  // Inner SVG element (path, circle, g, etc.) — wrap in <svg> for namespace context
164
164
  const t = document.createElement('template');
165
165
  t.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg">${trimmed}</svg>`;
166
- return () => t.content.firstChild.firstChild.cloneNode(true);
166
+ return () => /** @type {Node} */ (/** @type {Node} */ (t.content.firstChild).firstChild).cloneNode(true);
167
167
  }
168
168
 
169
169
  // --- insert(parent, child, marker?) ---
@@ -1094,7 +1094,6 @@ function reconcileKeyed(parent, endMarker, oldItems, newItems, mappedNodes, disp
1094
1094
  // Backward move: old[from] = new[to], old[to..from-1] = new[to+1..from]
1095
1095
 
1096
1096
  const fromRel = mm1; // first mismatch - the moved item was here in old OR went here in new
1097
- let movedKey = null;
1098
1097
  let fromAbs = -1, toAbs = -1;
1099
1098
  let isMove = false;
1100
1099
 
@@ -1121,7 +1120,6 @@ function reconcileKeyed(parent, endMarker, oldItems, newItems, mappedNodes, disp
1121
1120
  isMove = true;
1122
1121
  fromAbs = start + fromRel;
1123
1122
  toAbs = start + destRel;
1124
- movedKey = candidateKey;
1125
1123
  }
1126
1124
  }
1127
1125
  }
@@ -1148,7 +1146,6 @@ function reconcileKeyed(parent, endMarker, oldItems, newItems, mappedNodes, disp
1148
1146
  isMove = true;
1149
1147
  fromAbs = start + srcRel;
1150
1148
  toAbs = start + fromRel;
1151
- movedKey = candidateKey2;
1152
1149
  }
1153
1150
  }
1154
1151
  }
@@ -1392,7 +1389,7 @@ export function spread(el, props) {
1392
1389
  // If a previous spread/setProp already registered an effect for this
1393
1390
  // key, dispose it first to avoid double-tracking.
1394
1391
  if (el._propEffects[key]) {
1395
- try { el._propEffects[key](); } catch (e) { /* already disposed */ }
1392
+ try { el._propEffects[key](); } catch { /* already disposed */ }
1396
1393
  }
1397
1394
  if (key === 'class' || key === 'className') {
1398
1395
  el._propEffects[key] = effect(() => {
@@ -1441,7 +1438,7 @@ export function setProp(el, key, value) {
1441
1438
  if (typeof value === 'function' && !_isEventProp(key)) {
1442
1439
  if (!el._propEffects) el._propEffects = {};
1443
1440
  if (el._propEffects[key]) {
1444
- try { el._propEffects[key](); } catch (e) { /* already disposed */ }
1441
+ try { el._propEffects[key](); } catch { /* already disposed */ }
1445
1442
  }
1446
1443
  el._propEffects[key] = effect(() => setProp(el, key, value()));
1447
1444
  return;
@@ -1494,7 +1491,7 @@ export function setProp(el, key, value) {
1494
1491
  // and property-reflected branches. Reflected props (e.g. el.title) are reset
1495
1492
  // first so removeAttribute() clears both the attribute and the property.
1496
1493
  if (key in el) {
1497
- try { el[key] = ''; } catch (e) { /* read-only reflected prop */ }
1494
+ try { el[key] = ''; } catch { /* read-only reflected prop */ }
1498
1495
  }
1499
1496
  el.removeAttribute(key);
1500
1497
  } else if (key.startsWith('data-') || key.startsWith('aria-')) {
@@ -1529,7 +1526,7 @@ export function setProp(el, key, value) {
1529
1526
  function _wrapPropAccessor(el, key, accessor, apply) {
1530
1527
  if (!el._propEffects) el._propEffects = {};
1531
1528
  if (el._propEffects[key]) {
1532
- try { el._propEffects[key](); } catch (e) { /* already disposed */ }
1529
+ try { el._propEffects[key](); } catch { /* already disposed */ }
1533
1530
  }
1534
1531
  el._propEffects[key] = effect(() => apply(el, accessor()));
1535
1532
  }
package/src/scheduler.js CHANGED
@@ -89,11 +89,11 @@ function schedule() {
89
89
  // Returns a promise that resolves with the value.
90
90
 
91
91
  export function measure(fn) {
92
- return new Promise(resolve => {
92
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
93
93
  scheduleRead(() => {
94
94
  resolve(fn());
95
95
  });
96
- });
96
+ }));
97
97
  }
98
98
 
99
99
  // --- Mutate helper ---
@@ -101,12 +101,12 @@ export function measure(fn) {
101
101
  // Returns a promise that resolves when the write is done.
102
102
 
103
103
  export function mutate(fn) {
104
- return new Promise(resolve => {
104
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
105
105
  scheduleWrite(() => {
106
106
  fn();
107
107
  resolve();
108
108
  });
109
- });
109
+ }));
110
110
  }
111
111
 
112
112
  // --- useScheduledEffect ---
@@ -142,7 +142,7 @@ export function nextFrame() {
142
142
  reject(new Error('Cancelled'));
143
143
  };
144
144
  });
145
- promise.cancel = cancel;
145
+ /** @type {any} */ (promise).cancel = cancel;
146
146
  return promise;
147
147
  }
148
148
 
@@ -228,7 +228,7 @@ export function onIntersect(element, callback, options = {}) {
228
228
  export function smoothScrollTo(element, options = {}) {
229
229
  const { duration = 300, easing = t => t * (2 - t) } = options;
230
230
 
231
- return new Promise(resolve => {
231
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
232
232
  let startY;
233
233
  let targetY;
234
234
  let startTime;
@@ -259,5 +259,5 @@ export function smoothScrollTo(element, options = {}) {
259
259
  });
260
260
  });
261
261
  }
262
- });
262
+ }));
263
263
  }
package/src/skeleton.js CHANGED
@@ -74,6 +74,16 @@ function injectStyles() {
74
74
 
75
75
  // --- Skeleton Component ---
76
76
 
77
+ /**
78
+ * @param {object} props
79
+ * @param {number|string} [props.width]
80
+ * @param {number|string} [props.height]
81
+ * @param {'shimmer'|'pulse'|'wave'} [props.variant]
82
+ * @param {boolean} [props.circle]
83
+ * @param {string} [props.class]
84
+ * @param {Record<string, any>} [props.style]
85
+ * @param {number} [props.count]
86
+ */
77
87
  export function Skeleton({
78
88
  width,
79
89
  height,
@@ -137,6 +147,11 @@ export function SkeletonText({
137
147
 
138
148
  // --- Skeleton Avatar ---
139
149
 
150
+ /**
151
+ * @param {object} props
152
+ * @param {number} [props.size]
153
+ * @param {'shimmer'|'pulse'|'wave'} [props.variant]
154
+ */
140
155
  export function SkeletonAvatar({
141
156
  size = 40,
142
157
  variant = 'shimmer',
@@ -251,7 +266,7 @@ export function IslandSkeleton({
251
266
  // --- useSkeleton Hook ---
252
267
  // Show skeleton while loading data
253
268
 
254
- export function useSkeleton(asyncFn, deps = []) {
269
+ export function useSkeleton(asyncFn, _deps = []) {
255
270
  const isLoading = signal(true);
256
271
  const data = signal(null);
257
272
  const error = signal(null);
package/src/store.js CHANGED
@@ -51,7 +51,6 @@ export function createStore(definition) {
51
51
  const signals = {};
52
52
  const computeds = {};
53
53
  const actions = {};
54
- const state = {};
55
54
 
56
55
  // Separate state, computeds, and actions
57
56
  // Use explicit _storeComputed marker instead of function.length heuristic
package/src/testing.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Helpers for testing components, similar to @testing-library/react
3
3
  // Works with Node.js test runner or any test framework
4
4
 
5
- import { signal, computed, effect, batch, flushSync, createRoot, untrack } from './reactive.js';
5
+ import { signal, effect, flushSync, createRoot, __DEV__, __devtools, __setDevToolsHooks } from './reactive.js';
6
6
  import { mount } from './dom.js';
7
7
  import { h } from './h.js';
8
8
 
@@ -125,42 +125,105 @@ export function flushEffects() {
125
125
  // Track signal reads and writes within a callback.
126
126
  // Returns { accessed: string[], written: string[] }
127
127
 
128
+ // --- trackSignals ---
129
+ //
130
+ // Reports which named signals a callback reads and writes.
131
+ //
132
+ // Reads are transitive: reading a computed reports the signals that computed
133
+ // depends on, not the computed itself. That is what "which signals does this
134
+ // depend on" means in a reactive graph, and it is the question worth asking of
135
+ // a callback under test.
136
+ //
137
+ // A signal created without a debug name has nothing to report, so it appears
138
+ // as the single entry UNNAMED rather than vanishing. A caller who sees it
139
+ // knows the answer is incomplete and which signal to name; silently returning
140
+ // a short list would let an assertion pass for the wrong reason.
141
+ const UNNAMED = '(unnamed)';
142
+
128
143
  export function trackSignals(fn) {
144
+ if (!__DEV__) {
145
+ throw new Error(
146
+ '[what] trackSignals() requires a development build. Signal debug names ' +
147
+ 'and subscriber back-references are stripped in production, so there is ' +
148
+ 'nothing to report. Run your tests with NODE_ENV !== "production".'
149
+ );
150
+ }
151
+
129
152
  const accessed = [];
130
153
  const written = [];
131
-
132
- // Intercept signal reads/writes by wrapping in an effect context
133
- // that captures the read calls, and monkey-patching .set temporarily.
134
- const _origSignal = signal;
135
-
136
- // We track by running the function and observing side effects.
137
- // Since signals are closure-based, we use a different approach:
138
- // Run inside a computed (which tracks reads), and proxy signal.set calls.
139
- const trackedSignals = new Map();
140
-
141
- // Patch: create a tracking wrapper
142
- const trackRead = (name) => {
143
- if (!accessed.includes(name)) accessed.push(name);
154
+ const addOnce = (list, name) => { if (!list.includes(name)) list.push(name); };
155
+
156
+ // --- Writes ---
157
+ //
158
+ // Every signal write calls __devtools.onSignalUpdate(sig) in dev, and
159
+ // __devtools is consulted at write time rather than at creation time, so
160
+ // this catches writes to signals that existed long before this call.
161
+ // Chain the previous hooks rather than replacing them: otherwise running a
162
+ // test would silently disable installed devtools for the duration.
163
+ const previousHooks = __devtools;
164
+ const trackingHooks = {
165
+ ...(previousHooks || {}),
166
+ onSignalUpdate(sig) {
167
+ addOnce(written, sig?._debugName || UNNAMED);
168
+ previousHooks?.onSignalUpdate?.(sig);
169
+ },
144
170
  };
145
- const trackWrite = (name) => {
146
- if (!written.includes(name)) written.push(name);
171
+ // A chained hook must not claim to be the pre-install buffer, or the real
172
+ // devtools would later try to drain it a second time.
173
+ delete trackingHooks.__isPreinstallBuffer;
174
+
175
+ // --- Reads ---
176
+ //
177
+ // Reading a signal inside an effect adds that effect to the signal's
178
+ // subscriber Set and pushes the Set onto effect.deps. effect() returns a
179
+ // dispose function rather than the effect, so the effect is reached through
180
+ // a probe signal: after the run, the probe's subscriber Set holds exactly
181
+ // the effect that read it.
182
+ const probe = signal(0, '__trackSignals_probe__');
183
+ // Held in a box rather than a `let`: the assignment happens inside
184
+ // createRoot's callback, and the finally below has to run it whether the
185
+ // tracked fn returned or threw.
186
+ /** @type {{ current: (() => void) | null }} */
187
+ const root = { current: null };
188
+ let thrown = null;
189
+
190
+ const collectReads = (depSets, seen) => {
191
+ for (const depSet of depSets || []) {
192
+ if (seen.has(depSet)) continue;
193
+ seen.add(depSet);
194
+ const sig = depSet._signalOwner;
195
+ if (sig) {
196
+ if (sig !== probe) addOnce(accessed, sig._debugName || UNNAMED);
197
+ continue;
198
+ }
199
+ // Not a signal's Set, so it belongs to a computed. `_owner` is that
200
+ // computed's inner effect; its own deps are the sources to follow.
201
+ const owner = depSet._owner;
202
+ if (owner?.deps) collectReads(owner.deps, seen);
203
+ }
147
204
  };
148
205
 
149
- // We run the function and rely on the reactive system's currentEffect tracking.
150
- // To detect reads, we run in an effect. To detect writes, we'd need instrumentation.
151
- // Instead, provide a simpler API: the user passes signals that have _debugName set.
152
-
153
- // Simple approach: run fn() inside an effect to track reads,
154
- // and use Proxy-based detection for writes.
155
- let dispose;
156
- createRoot((d) => {
157
- dispose = d;
158
- const e = effect(() => {
159
- fn();
206
+ __setDevToolsHooks(trackingHooks);
207
+ try {
208
+ createRoot((disposeRoot) => {
209
+ root.current = disposeRoot;
210
+ effect(() => {
211
+ probe();
212
+ fn();
213
+ });
160
214
  });
161
- });
162
- if (dispose) dispose();
163
215
 
216
+ const seen = new Set();
217
+ for (const tracked of probe._subs) collectReads(tracked.deps, seen);
218
+ } catch (err) {
219
+ thrown = err;
220
+ } finally {
221
+ // Deps are read before this: disposal clears them.
222
+ root.current?.();
223
+ __setDevToolsHooks(previousHooks);
224
+ }
225
+
226
+ if (thrown) throw thrown;
164
227
  return { accessed, written };
165
228
  }
166
229
 
@@ -229,18 +292,12 @@ export function mockSignal(name, initialValue) {
229
292
 
230
293
  function queryByText(container, text) {
231
294
  const regex = text instanceof RegExp ? text : null;
232
- const walker = document.createTreeWalker(
233
- container,
234
- NodeFilter.SHOW_TEXT,
235
- null,
236
- false
237
- );
295
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, null);
238
296
 
239
297
  while (walker.nextNode()) {
240
298
  const node = walker.currentNode;
241
- const matches = regex
242
- ? regex.test(node.textContent)
243
- : node.textContent.includes(text);
299
+ const content = node.textContent || '';
300
+ const matches = regex ? regex.test(content) : content.includes(text);
244
301
  if (matches) {
245
302
  return node.parentElement;
246
303
  }
@@ -251,18 +308,12 @@ function queryByText(container, text) {
251
308
  function queryAllByText(container, text) {
252
309
  const results = [];
253
310
  const regex = text instanceof RegExp ? text : null;
254
- const walker = document.createTreeWalker(
255
- container,
256
- NodeFilter.SHOW_TEXT,
257
- null,
258
- false
259
- );
311
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, null);
260
312
 
261
313
  while (walker.nextNode()) {
262
314
  const node = walker.currentNode;
263
- const matches = regex
264
- ? regex.test(node.textContent)
265
- : node.textContent.includes(text);
315
+ const content = node.textContent || '';
316
+ const matches = regex ? regex.test(content) : content.includes(text);
266
317
  if (matches) {
267
318
  results.push(node.parentElement);
268
319
  }
@@ -364,7 +415,7 @@ export async function waitFor(callback, options = {}) {
364
415
  try {
365
416
  const result = callback();
366
417
  if (result) return result;
367
- } catch (e) {
418
+ } catch {
368
419
  // Keep waiting
369
420
  }
370
421
  await new Promise(r => setTimeout(r, interval));
@@ -401,9 +452,9 @@ export async function act(callback) {
401
452
  // Synchronously flush all pending effects
402
453
  flushSync();
403
454
  // Wait for microtasks to flush
404
- await new Promise(r => queueMicrotask(r));
455
+ await /** @type {Promise<void>} */ (new Promise(r => queueMicrotask(() => r())));
405
456
  // Wait for any scheduled effects
406
- await new Promise(r => setTimeout(r, 0));
457
+ await /** @type {Promise<void>} */ (new Promise(r => setTimeout(() => r(), 0)));
407
458
  return result;
408
459
  }
409
460
 
package/testing.d.ts CHANGED
@@ -120,7 +120,23 @@ export function renderTest<P = {}>(Component: (props: P) => any, props?: P): Ren
120
120
  /** Run every pending effect synchronously, so assertions see settled DOM. */
121
121
  export function flushEffects(): void;
122
122
 
123
- /** Record which signals a callback reads and writes, by debug name. */
123
+ /**
124
+ * Record which signals a callback reads and writes, by debug name.
125
+ *
126
+ * Reads are transitive: reading a computed reports the signals that computed
127
+ * depends on, not the computed itself.
128
+ *
129
+ * `peek()` is not a read, and writing a value equal to the current one is not
130
+ * a write, matching the reactive system's own semantics.
131
+ *
132
+ * A signal created without a debug name has no name to report and appears as
133
+ * the single entry `'(unnamed)'`. Name your signals (`signal(0, 'count')`) to
134
+ * get anything more specific.
135
+ *
136
+ * Dev builds only. In production the debug names and subscriber
137
+ * back-references this reads are stripped, so it throws rather than reporting
138
+ * an empty result that would look like "nothing happened".
139
+ */
124
140
  export function trackSignals(fn: () => void): { accessed: string[]; written: string[] };
125
141
 
126
142
  // --- mockSignal ---
@@ -1 +0,0 @@
1
- import{a as M}from"./chunk-O3SKPRTY.min.js";var u=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),p=null;function Xe(e){u&&(p=e)}var C=null,S=null,v=null,H=!1,O=0,x=[],U=!1,V=Symbol("needs_upstream"),q=null;function k(e,t){let n=e,r=new Set,o=null,s=0;function c(f){u&&H&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;(n===l?n!==0||1/n===1/l:n!==n&&l!==l)||(n=l,o=null,u&&p&&p.onSignalUpdate(i),r.size>0&&ie(r))}function i(f){if(arguments.length===0){let l=C;return l!==null&&(l!==o||l._epoch!==s)&&(o=l,s=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>N(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&p&&p.onSignalCreate(i),i}function Qe(e){let t,n=!0,r=new Set,o=null,s=0,c=X(()=>{let f=H;u&&(H=!0);try{t=e(),n=!1}finally{u&&(H=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=C;return f!==null&&(f!==o||f._epoch!==s)&&(o=f,s=f._epoch,r.add(f),f.deps.push(r)),n&&ne(c),t}return c._onNotify=()=>{n=!0,o=null,r.size>0&&ie(r)},i._signal=!0,i.peek=()=>(n&&ne(c),t),i}function ne(e){if(q!==null)throw q.push(e),V;let t=[e];q=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,o=n.deps;for(let s=0;s<o.length;s++){let c=o[s]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let s=n.deps.length;Q(n),n.deps.length!==s&&F(n),t.pop()}catch(s){if(s===V)n._markDirty();else throw s}}}finally{q=null}}function F(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let o=n[r]._owner;if(o){let s=o._level;s>t&&(t=s)}}e._level=t+1}var ve=()=>{};function N(e,t){let n=X(e);n._level=1;let r=C;C=n;try{let s=n.fn();typeof s=="function"&&(n._cleanup=s)}finally{C=r}if(F(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&p&&p.onEffectDispose(n),ve;let o=()=>oe(n);return S&&S.disposals.push(o),o}function Ze(e){O++;try{e()}finally{O--,O===0&&Z()}}function X(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return u&&p&&p.onEffectCreate(n),n}function Q(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(o){u&&console.warn("[what] Error in effect cleanup:",o)}e._cleanup=null}let r=C;C=null;try{let o=e.fn();typeof o=="function"&&(e._cleanup=o)}catch(o){p?.onError&&p.onError(o,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",o)}finally{C=r}u&&p?.onEffectRun&&p.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(se(e),e._cleanup){try{e._cleanup()}catch(r){u&&p?.onError&&p.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=C;C=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===V||u&&p?.onError&&p.onError(r,{type:"effect",effect:e}),r}finally{C=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&p?.onEffectRun&&p.onEffectRun(e)}function oe(e){if(e.disposed=!0,u&&p&&p.onEffectDispose(e),se(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function se(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var J=0,D=null,T=0;function re(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(O===0&&e._stable){let t=C;C=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){u&&p?.onError&&p.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{C=t}}else{e._pending=!0;let t=e._level,n=x.length;n>0&&x[n-1]._level>t&&(U=!0),x.push(e)}}}function ie(e){if(J===0){J=1;try{for(let t of e)re(t);if(T>0){let t=0;for(;t<T;){let n=D[t];D[t]=null,t++;for(let r of n)re(r)}T=0}}finally{J=0}O===0&&x.length>0&&ke()}else D===null&&(D=[]),T>=D.length?D.push(e):D[T]=e,T++}var W=!1;function ke(){W||(W=!0,queueMicrotask(()=>{W=!1,Z()}))}var z=!1;function Z(){if(!z){z=!0;try{let e=0;for(;x.length>0&&e<25;){let t=x;x=[],t.length>1&&U&&t.sort((n,r)=>n._level-r._level),U=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;try{Q(r)}catch(s){if(s===V)throw s;u&&p?.onError&&p.onError(s,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",s)}catch{}continue}!r._computed&&r.deps.length!==o&&F(r)}}e++}if(e>=25){if(u){let n=x.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<x.length;t++)x[t]._pending=!1;x.length=0}}finally{z=!1}}}function Ye(e){let t,n=new Set,r=X(()=>{let s=e();if(!Object.is(t,s)){t=s;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=x.length;f>0&&x[f-1]._level>i&&(U=!0),x.push(c)}}}});r._level=1,Q(r),F(r),n._owner=r,S&&S.disposals.push(()=>oe(r));function o(){return C&&(n.add(C),C.deps.push(n)),t}return o._signal=!0,o.peek=()=>t,o}function et(){if(z){u&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(C){u&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}W=!1,Z()}function Y(e){let t=C;C=null;try{return e()}finally{C=t}}function tt(){return v}function nt(e,t){let n=v,r=S;v=e,S=e;try{return t()}finally{v=n,S=r}}function rt(e){let t=S,n=v,r={disposals:[],owner:v,children:[],_disposed:!1};v&&v.children.push(r),S=r,v=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();if(r.disposals.length=0,r.owner){let s=r.owner.children.indexOf(r);s>=0&&r.owner.children.splice(s,1)}}})}finally{S=t,v=n}}function ee(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)ee(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function ot(e){let t=S,n=v,r={disposals:[],owner:null,children:[],_disposed:!1};S=r,v=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();r.disposals.length=0}})}finally{S=t,v=n}}function st(e){S&&S.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};p={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function it(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof K<"u"?K:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var K=null;u&&p?.__isPreinstallBuffer&&(K=p.__buffer);var R=null,P=null;function ft(e){P||(P=e)}function Ae(){return P?.getStore()??R}function ce(){return typeof document>"u"||Ae()!=null}function lt(e){let t=R;return R=e,t}function at(e,t){if(P)return P.run(e,t);let n=R;R=e;try{return t()}finally{R=n}}function gt(e,t){let n=function(o){return e(o)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var fe=null;function le(e){fe=e}function Ct(e){let t=null,n=null,r=null,o=new Set;function s(c){if(r)throw r;if(t)return M(t,c);throw n||(n=e().then(i=>{t=i.default||i,o.forEach(f=>f()),o.clear()}).catch(i=>{r=i})),n}return s.displayName="Lazy",s._lazy=!0,s._onLoad=c=>{t?c():o.add(c)},s}function Ne({fallback:e,children:t}){let n=k(!1),r=new Set,o=!1;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(c){o||(n.set(!0),r.add(c),c.then(()=>{r.delete(c),r.size===0&&n.set(!1)},i=>{o=!0,r.delete(c),console.error("[what] Suspense: a suspended child rejected:",i)}))}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}Ne._deferChildren=!0;function Le({fallback:e,children:t,onError:n}){let r=k(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}Le._deferChildren=!0;function ae(e,t){let n=t||fe?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function wt({when:e,fallback:t=null,children:n}){return()=>(typeof e=="function"?e():e)?n:t}function bt({each:e,fallback:t=null,children:n}){let r=Array.isArray(n)?n[0]:n;return typeof r!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):()=>{let o=typeof e=="function"?e():e;return!o||o.length===0?t:o.map((s,c)=>{let i=r(s,c);return i&&typeof i=="object"&&i.key==null&&(s!=null&&typeof s=="object"?s.id!=null?i.key=s.id:s.key!=null&&(i.key=s.key):(typeof s=="string"||typeof s=="number")&&(i.key=s)),i})}}function St({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];return()=>{for(let r of n)if(r&&r.tag===De){let o=r.props.when;if(typeof o=="function"?o():o)return r.children}return e}}function De(e){return()=>(typeof e.when=="function"?e.when():e.when)?e.children:null}var I=null;function xt(e){I=e}function Me(e){let t={};for(let n in e){let r=e[n];typeof r=="function"||typeof r=="symbol"||r===void 0||(t[n]=r)}try{return JSON.stringify(t)}catch{return"{}"}}function Et({component:e,mode:t,mediaQuery:n,name:r,children:o,...s}){let c=r||e?.name||"Island",i=t||"idle",f={"data-island":c,"data-island-mode":i,"data-hydrate":i,"data-island-self":"1"},l=o==null?[]:Array.isArray(o)?o:[o];if(ce())return M("div",{...f,"data-island-props":Me(s)},M(e,s,...l));let _=!1;function y(a){if(_)return;_=!0;let d=M(e,s,...l);a.childNodes.length>0&&I?.hydrate?I.hydrate(d,a):I?.insert&&I.insert(a,d,null),a.removeAttribute("data-hydrate"),a.removeAttribute("data-island-self"),a.setAttribute("data-island-hydrated","");let m=a.ownerDocument?.defaultView??globalThis;typeof m.CustomEvent=="function"&&a.dispatchEvent(new m.CustomEvent("island:hydrated",{bubbles:!0,detail:{name:c,mode:i}}))}function b(a){let d=()=>y(a);switch(i){case"load":queueMicrotask(d);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(d):setTimeout(d,200);break;case"visible":{if(typeof IntersectionObserver>"u"){queueMicrotask(d);break}let m=new IntersectionObserver(w=>{w.some(E=>E.isIntersecting)&&(m.disconnect(),d())},{rootMargin:"200px"});m.observe(a);break}case"interaction":case"action":{let m=["click","focus","mouseenter","touchstart"],w=()=>{for(let E of m)a.removeEventListener(E,w);d()};for(let E of m)a.addEventListener(E,w,{once:!0});break}case"media":{if(!n||typeof window>"u"||!window.matchMedia){d();break}let m=window.matchMedia(n);if(m.matches){queueMicrotask(d);break}let w=()=>{m.matches&&(m.removeEventListener("change",w),d())};m.addEventListener("change",w);break}case"static":break;default:queueMicrotask(d)}}return M("div",{...f,ref:a=>{a&&b(a)}})}var ue=!1;function At(e,t,n){return ue||(ue=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,o)=>{let s=t(r,o);return n&&s&&typeof s=="object"&&(s.key=n(r,o)),s})}function Nt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,o]of Object.entries(n))o&&t.push(r)}return t.join(" ")}function Lt(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Te(t)}:${n}`).join(";")}function Te(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Dt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Mt(e,t){let n=0;return(...r)=>{let o=Date.now();o-n>=t&&(n=o,e(...r))}}var $=null;function pe(e){$=e}function Tt(e){if(typeof window>"u")return k(!1);let t=window.matchMedia(e),n=k(t.matches),r=s=>n.set(s.matches);t.addEventListener("change",r);let o=$?.();return o&&(o._cleanupCallbacks=o._cleanupCallbacks||[],o._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function Rt(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=k(n),o=N(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),s=null;typeof window<"u"&&(s=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",s));let c=$?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{o(),s&&window.removeEventListener("storage",s)})),r}function Bt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function Ot(e,t){if(typeof document>"u")return;let n=o=>{let s=e.current||e;!s||s.contains(o.target)||t(o)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=$?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function Pt(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var Re=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),Be="http://www.w3.org/2000/svg",de=new Set(["href","src","action","formaction","formAction","data","ping","xlink:href","xlinkHref"]),he=new Set(["srcdoc","srcDoc"]);function Oe(e){if(e==null)return!0;let t;try{t=String(e).trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase()}catch{return!1}return!(t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:"))}function _e(e){if(e.length<=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return(t===111||t===79)&&(n===110||n===78)}function Pe(e,t){let n=e.toLowerCase();return he.has(e)||he.has(n)?!0:!de.has(e)&&!de.has(n)?!1:!Oe(t)}function Ie(e){return e==="role"||e.startsWith("aria-")}var ye=new Set,G=new WeakMap;function je(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function me(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function te(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}u&&p?.onComponentUnmount&&p.onComponentUnmount(e),ye.delete(e)}}function qe(e,t){!e||typeof t!="function"||(e._hydrationDisposers?e._hydrationDisposers.push(t):e._hydrationDisposers=[t])}function Ut(e,t){qe(e,()=>te(t))}function L(e){if(!e)return;if(e._componentCtx&&te(e._componentCtx),e._hydrationDisposers){let n=e._hydrationDisposers;e._hydrationDisposers=null;for(let r=0;r<n.length;r++)try{n[r]()}catch{}}if(e.nodeType===8){let n=G.get(e);n&&te(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)L(t[n])}function Vt(e,t){typeof t=="string"&&(t=document.querySelector(t)),L(t),t.textContent="";let n=A(e,t);return n&&t.appendChild(n),()=>{L(t),t.textContent=""}}function A(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(je(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),o=document.createComment("/list-frag");return r.appendChild(o),e(r,o),r}if(typeof e=="function"&&e._lazyChildren)return A(e(),t,n);if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),s=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(o);let i=h[h.length-1]||null,f=N(()=>{let l=i!==null&&h[h.length-1]!==i;l&&h.push(i);try{let _=e(),y=_==null||_===!1||_===!0?[]:Array.isArray(_)?_:[_],b=o.parentNode;if(!b)return;for(let a of s)L(a),a.parentNode===b&&b.removeChild(a);s=[];for(let a of y){let d=A(a,b,t?._isSvg);if(d)if(d.nodeType===11){let m=Array.from(d.childNodes);b.insertBefore(d,o);for(let w of m)s.push(w)}else b.insertBefore(d,o),s.push(d)}}finally{l&&h.pop()}});return r._dispose=f,o._dispose=f,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let s=A(o,t,n);s&&r.appendChild(s)}return r}return me(e)&&typeof e.tag=="function"?Ve(e,t,n):me(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?Ce(e,t):e.tag==="__suspense"?we(e,t):e.tag==="__portal"?be(e,t):$e(e,t,n):document.createTextNode(String(e))}var He={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},h=[];function ge(){return h[h.length-1]}le(ge);pe(ge);function Ft(){return h}function $t(e){let t={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:e,_parentCtx:h[h.length-1]||null,_errorBoundary:null};return h.push(t),t}function Gt(e){h[h.length-1]===e&&h.pop(),e.disposed=!0}function We(e,t,n){if(e._deferChildren)return t.children=n,null;let r,o=!1,s=!0;return Object.defineProperty(t,"children",{get(){return s?(o||(o=!0,r=n()),r):n()},enumerable:!0,configurable:!0}),()=>{s=!1,o=!1,r=void 0}}var ze=Symbol.for("what.navigation.signal");function Ue(e){if(e==null)return!1;let t=e[ze];return typeof t!="function"?!1:(t(e),!0)}function Ve(e,t,n){let{tag:r,props:o,children:s}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(Ee){return new g(Ee).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Ce(e,t);if(r==="__suspense"||e.tag==="__suspense")return we(e,t);if(r==="__portal"||e.tag==="__portal")return be(e,t);let c=h[h.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),_=document.createComment("c:end");G.set(l,f),f._startComment=l,f._endComment=_;let y=document.createDocumentFragment();y._componentCtx=f,f._wrapper=l,ye.add(f),u&&p?.onComponentMount&&p.onComponentMount(f);let b=s.length===0?void 0:s.length===1?s[0]:s,a;b!==void 0?a=o?Object.assign({},o,{children:b}):{children:b}:a=o?Object.assign({},o):{};let d=o&&o._$lazyChildren,m=d?We(r,a,d):null,w=k(a);f._propsSignal=w;let E=new Proxy({_sig:w},He);h.push(f);let j;try{j=Y(()=>r(E))}catch(g){if(h.pop(),!Ue(g)&&!(g&&typeof g.then=="function"&&Fe(g,f))&&!ae(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return y.appendChild(l),y.appendChild(_),y}m&&m(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(B){console.error("[what] onMount error:",B)}}),y.appendChild(l);let xe=Array.isArray(j)?j:[j];try{for(let g of xe){let B=A(g,y,n);B&&y.appendChild(B)}}finally{h.pop()}return y.appendChild(_),y}function Fe(e,t){let n=t;for(;n;){if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(e),!0;n=n._parentCtx}return!1}function Ce(e,t){let{errorState:n,handleError:r,fallback:o,reset:s}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};G.set(i,l);let _=document.createDocumentFragment();_._componentCtx=l,_.appendChild(i),_.appendChild(f);let y=N(()=>{let b=n();if(h.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let d=i.nextSibling;L(d),d.parentNode.removeChild(d)}let a;b?a=typeof o=="function"?[o({error:b,reset:s})]:[o]:a=c,a=Array.isArray(a)?a:[a];for(let d of a){let m=A(d,t);m&&(f.parentNode?f.parentNode.insertBefore(m,f):_.insertBefore(m,f))}h.pop()});return l.effects.push(y),_}function we(e,t){let{boundary:n,fallback:r,loading:o}=e.props,s=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_suspenseBoundary:n,_startComment:c,_endComment:i};G.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let _=0,y=N(()=>{let a=o()?[r]:s,d=Array.isArray(a)?a:[a],m=++_;if(h.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let w=c.nextSibling;L(w),w.parentNode.removeChild(w)}try{for(let w of d){let E=A(w,t);if(m!==_){E&&L(E);break}E&&(i.parentNode?i.parentNode.insertBefore(E,i):l.insertBefore(E,i))}}finally{h.pop()}});return f.effects.push(y),l}function be(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null},s=document.createComment("portal");s._componentCtx=o;let c=[];for(let i of r){let f=A(i,n);f&&(n.appendChild(f),c.push(f))}return o._cleanupCallbacks=[()=>{for(let i of c)L(i),i.parentNode&&i.parentNode.removeChild(i)}],s}function $e(e,t,n){let{tag:r,props:o,children:s}=e,c=n||Re.has(r),i=c?document.createElementNS(Be,r):document.createElement(r);o&&Ge(i,o,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<s.length;l++){let _=A(s[l],i,f);_&&i.appendChild(_)}return i._vnode=e,i}function Ge(e,t,n,r){if(t){for(let o in t)if(!(o==="key"||o==="children")){if(o==="ref"){let s=t.ref;typeof s=="function"?s(e):s&&(s.current=e);continue}Se(e,o,t[o],r)}}}function Je(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function Se(e,t,n,r){if(typeof n=="function"&&!_e(t)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=N(()=>{let o=n();Se(e,t,o,r)});return}if(_e(t)){if(typeof n!="function"&&n!=null)return;let o=t.slice(2),s=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),s=!0);let c=o.toLowerCase(),i=s?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,s),n==null))return;e._events||(e._events={});let l=y=>(y.nativeEvent||(y.nativeEvent=y),Y(()=>l._handler(y)));l._handler=n,l._original=n,e._events[i]=l;let _=n._eventOpts;e.addEventListener(c,l,_||s||void 0);return}if(Pe(t,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${t}" attribute:`,n);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let o=e._prevStyle||{};for(let s in o)s in n||(e.style[s]="");for(let s in n)e.style[s]=n[s]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let o=n?.__html??"";u&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";u&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o}else{u&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(Ie(t)){e.setAttribute(t,typeof n=="boolean"?String(n):n);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Je(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,Xe as b,k as c,Qe as d,N as e,Ze as f,Ye as g,et as h,Y as i,tt as j,nt as k,rt as l,ot as m,st as n,it as o,ft as p,Ae as q,ce as r,lt as s,at as t,gt as u,Ct as v,Ne as w,Le as x,ae as y,wt as z,bt as A,St as B,De as C,xt as D,Et as E,At as F,Nt as G,Lt as H,Dt as I,Mt as J,Tt as K,Rt as L,Bt as M,Ot as N,Pt as O,_e as P,Pe as Q,Ie as R,qe as S,Ut as T,L as U,Vt as V,A as W,ge as X,Ft as Y,$t as Z,Gt as _,We as $,Ue as aa,Je as ba};
@@ -1,11 +0,0 @@
1
- import{$ as Mt,D as St,P as W,Q as Lt,S as Bt,T as ct,U as I,W as G,X as Nt,Y as Q,a as z,aa as Dt,ba as pt,c as O,e as j,i as wt,m as Y,q as Et,y as Tt}from"./chunk-M5GDJRVX.min.js";import{a as J}from"./chunk-O3SKPRTY.min.js";var Pt=O(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Pt.set(t.target)});function Te(){return{current:()=>Pt(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function Se(){let t={current:null};function e(r){typeof document>"u"||(t.current=r||document.activeElement||null)}function n(r){let o=t.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:e,restore:n,previous:()=>t.current}}function Qt(t){let e=null;function n(){if(typeof document>"u")return;e=document.activeElement;let o=t.current||t;if(!o||typeof o.querySelectorAll!="function")return;let i=Ht(o);if(i.length===0)return;i[0].focus();function y(f){if(f.key!=="Tab")return;let a=Ht(o),c=a[0],p=a[a.length-1];f.shiftKey?document.activeElement===c&&(f.preventDefault(),p.focus()):document.activeElement===p&&(f.preventDefault(),c.focus())}return o.addEventListener("keydown",y),()=>{o.removeEventListener("keydown",y)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function Ht(t){let e=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>n.offsetParent!==null)}function Le({children:t,active:e=!0}){let n={current:null},r=O(0),o=Qt(n),i=null,y=c=>{n.current=c,r.set(p=>p+1)},f=j(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),a=Nt?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{f(),i?.(),i=null,o.deactivate()})),J("div",{ref:y},t)}var U=null,gt=0;function vt(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
2
- position: absolute;
3
- width: 1px;
4
- height: 1px;
5
- padding: 0;
6
- margin: -1px;
7
- overflow: hidden;
8
- clip: rect(0, 0, 0, 0);
9
- white-space: nowrap;
10
- border: 0;
11
- `,document.body.appendChild(U)),U)}function Ft(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=vt();if(!o)return;o.setAttribute("aria-live",n);let i=++gt;o.textContent="",requestAnimationFrame(()=>{gt===i&&(o.textContent=t)}),setTimeout(()=>{gt===i&&(o.textContent="")},r)}function Be(t){return Ft(t,{priority:"assertive"})}function Ne({href:t="#main",children:e="Skip to content"}){return J("a",{href:t,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(t);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},e)}function yt(t){return t?"true":"false"}function Me(t=!1){let e=O(t);return{expanded:()=>e(),toggle:()=>e.set(!e.peek()),open:()=>e.set(!0),close:()=>e.set(!1),buttonProps:()=>({"aria-expanded":()=>yt(e()),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:()=>!e()})}}function De(t=null){let e=O(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":()=>yt(e()===n),onClick:()=>e.set(n)})}}function He(t=!1){let e=O(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":()=>yt(e()),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function Pe(t,e={}){let n=typeof t=="function"?t:()=>t,r=O(0),o=e?.role||null,i=[],y=[],f=[];function a(h){let s=y[h];return s||(s={get current(){return i[h]||null},set current(d){i[h]=d||null;let _=f[h];typeof _=="function"?_(d):_&&typeof _=="object"&&(_.current=d)}},y[h]=s),s}function c(h){let s=i[h];return s?s.isConnected===!1?null:s:null}function p(h){let s=c(h);return!s||typeof s.focus!="function"?null:((typeof document>"u"||document.activeElement!==s)&&s.focus(),s)}function u(){if(typeof document>"u")return!1;let h=document.activeElement;if(!h)return!1;for(let s=0;s<i.length;s++){let d=i[s];if(d&&(d===h||typeof d.contains=="function"&&d.contains(h)))return!0}return!1}function m(h,s){return!(s>0)||h<0?0:h>s-1?s-1:h}function x(){return m(r(),n())}function b(h){return Number.isInteger(h)&&h>=0&&h<n()}function C(h){let s=n();if(s<=0)return;let d=m(r.peek(),s),_=d;switch(h.key){case"ArrowDown":case"ArrowRight":_=(d+1)%s;break;case"ArrowUp":case"ArrowLeft":_=(d-1+s)%s;break;case"Home":_=0;break;case"End":_=s-1;break;default:return}h.preventDefault(),r.set(_),p(_)}return{focusIndex:()=>x(),setFocusIndex:h=>{b(h)&&(r.set(h),u()&&p(h))},focusItem:h=>b(h)?(r.set(h),p(h)):null,getItemProps:(h,s)=>{let{ref:d,..._}=s||{};return f[h]=d||null,{ref:a(h),tabIndex:()=>x()===h?0:-1,onKeyDown:C,onFocus:S=>{let D=S&&(S.currentTarget||S.target);D&&(i[h]=D),r.set(h)},..._}},containerProps:h=>o?{role:o,...h}:{...h}}}function je({children:t,as:e="span"}){return J(e,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},t)}function Ke({children:t,priority:e="polite",atomic:n=!0}){return J("div",{"aria-live":e,"aria-atomic":n},t)}var jt=0;function Kt(){let t=Et();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++jt}function Rt(){jt=0}function $t(t="what"){let e=`${t}-${Kt()}`;return()=>e}function Re(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${Kt()}`);return n}function $e(t){let e=$t("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>J("div",{id:e(),style:{display:"none"}},t)}}function Ie(t){let e=$t("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Oe={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function Ve(t,e){return n=>{n.key===t&&e(n)}}function ze(t,e){return n=>{t.includes(n.key)&&e(n)}}var et=null;function Ye(t){et=typeof t=="function"?t:null}function Qe(t,e,n){if(typeof n=="function"){let r=()=>{let o=n();return o.length===1?o[0]:o};return r._lazyChildren=!0,e||(e={}),Object.defineProperty(e,"_$lazyChildren",{value:r,configurable:!0}),G({tag:t,props:e,children:[],key:null,_vnode:!0})}if(n&&n.length>0){let r=n.length===1?n[0]:n;e?e.children=r:e={children:r}}return G({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var te={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},ee=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function Gt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function ne(t){let e=t.trim(),n=Gt(e);if(ee.has(n))return re(e);let r=te[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let y=i.content.firstChild;for(let f=0;f<r.depth;f++)y=y.firstChild;return()=>y.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}var It=!1;function ve(t){return z&&!It&&(It=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),ne(t)}function re(t){let e=t.trim();if(Gt(e)==="svg"){let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Ut(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Ut(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,y=!1,f=At();return j(()=>qt(f,()=>{let a=e(),c=typeof a;if(!y){y=!0,c==="string"||c==="number"?(i=document.createTextNode(String(a)),r?t.insertBefore(i,r):t.appendChild(i),et&&et(t,String(a)),o=i):o=st(t,a,null,r);return}if(i!==null&&(c==="string"||c==="number")){let p=String(a);i.data!==p&&(i.data=p),et&&et(t,p);return}i=null,o=st(t,a,o,r)})),o}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n?t.insertBefore(r,n):t.appendChild(r),r}return e!=null&&typeof e=="object"&&e.nodeType>0?(n?t.insertBefore(e,n):t.appendChild(e),e):st(t,e,null,n||null)}function kt(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function oe(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var at=typeof SVGElement<"u";function Ct(t){return at&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function At(){let t=Q();return t[t.length-1]||null}function qt(t,e){let n=Q(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function Ot(t){return t==null?[]:Array.isArray(t)?t:[t]}function Wt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)Wt(t[r],e,n);return n}if(typeof t=="function"){let r=G(t,e,Ct(e));if(r&&r.nodeType===11){let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}if(typeof t=="string"||typeof t=="number")return n.push(document.createTextNode(String(t))),n;if(kt(t)){if(t.nodeType===11&&t.childNodes.length>0){let r=Array.from(t.childNodes);for(let o=0;o<r.length;o++)n.push(r[o])}else n.push(t);return n}if(oe(t)){let r=G(t,e,Ct(e));if(r&&r.nodeType===11)if(r.childNodes.length===0)n.push(r);else{let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}return n.push(document.createTextNode(String(t))),n}function ie(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function st(t,e,n,r){if(!t||typeof t.insertBefore!="function")return z&&console.warn("[what] reconcileInsert called with invalid parent:",t),n;let o=r||null;if(e==null||typeof e=="boolean"){let c=Ot(n);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===t&&(I(u),t.removeChild(u))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let c=String(e);return n.data!==c&&(n.data=c),n}if(typeof e=="object"&&e!==null&&e.nodeType>0&&e.nodeType!==11&&!Array.isArray(e)){if(e===n)return n;if(n&&!Array.isArray(n)&&n.nodeType>0&&n.nodeType!==11)return n.parentNode===t?(I(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=Wt(e,t,[]),y=Ot(n);if(ie(y,i))return n;let f=i.length;for(let c=0;c<y.length;c++){let p=y[c];if(p.parentNode!==t)continue;let u=!1;for(let m=0;m<f;m++)if(i[m]===p){u=!0;break}u||(I(p),t.removeChild(p))}let a=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==t||p.nextSibling!==a)&&(a&&a.parentNode!==t&&(a=null),a?t.insertBefore(p,a):t.appendChild(p)),a=p}return i.length===0?null:i.length===1?i[0]:i}function Fe(t,e,n){let r=n?.key,o=n?.raw||!1,i=(y,f)=>{let a=[],c=[],p=[],u=r&&!o?new Map:null,m=document.createComment("/list");return y.insertBefore(m,f||null),j(()=>{let x=t()||[],b=m.parentNode||y;r?ue(b,m,a,x,c,p,e,r,u):fe(b,m,a,x,c,p,e),a=x.length>0?x.slice():x}),m};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function tn(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function fe(t,e,n,r,o,i,y){let f=r.length,a=n.length;if(f===0){if(a>0){for(let s=0;s<a;s++)i[s]&&i[s]();for(let s=a-1;s>=0;s--){let d=o[s];d&&(I(d),d.parentNode===t&&t.removeChild(d))}o.length=0,i.length=0}return}if(a===0){let s=document.createDocumentFragment();for(let d=0;d<f;d++){let _=r[d],S=Y(D=>(i[d]=D,y(_,d)));o[d]=S,s.appendChild(S)}t.insertBefore(s,e);return}let c=0,p=Math.min(a,f);for(;c<p&&n[c]===r[c];)c++;if(c===a&&c===f)return;let u=a-1,m=f-1;for(;u>=c&&m>=c&&n[u]===r[m];)u--,m--;let x=new Array(f),b=new Array(f);for(let s=0;s<c;s++)x[s]=o[s],b[s]=i[s];for(let s=m+1;s<f;s++){let d=u+1+(s-m-1);x[s]=o[d],b[s]=i[d]}let C=m-c+1,h=u-c+1;if(C===0)for(let s=c;s<=u;s++)i[s]?.(),o[s]&&I(o[s]),o[s]?.parentNode&&o[s].parentNode.removeChild(o[s]);else if(h===0){let s=c<f&&x[m+1]?x[m+1]:e,d=document.createDocumentFragment();for(let _=c;_<=m;_++){let S=r[_],D=_;x[_]=Y(L=>(b[D]=L,y(S,D))),d.appendChild(x[_])}t.insertBefore(d,s)}else ce(t,e,n,r,o,i,y,c,u,m,x,b);o.length=f,i.length=f;for(let s=0;s<f;s++)o[s]=x[s],i[s]=b[s]}function ce(t,e,n,r,o,i,y,f,a,c,p,u){let m=new Map;for(let d=f;d<=a;d++)m.set(n[d],d);let x=c-f+1,b=new Int32Array(x);b.fill(-1);for(let d=f;d<=c;d++){let _=m.get(r[d]);_!==void 0&&(m.delete(r[d]),p[d]=o[_],u[d]=i[_],b[d-f]=_)}for(let[,d]of m)i[d]?.(),o[d]&&I(o[d]),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);let C=x-se(b,x),h=new Uint8Array(x);if(C>1){let d=new Int32Array(C),_=new Int32Array(C),S=0;for(let L=0;L<x;L++)b[L]!==-1&&(d[S]=b[L],_[S]=L,S++);let D=Xt(d,C);for(let L=0;L<D.length;L++)h[_[D[L]]]=1}else if(C===1){for(let d=0;d<x;d++)if(b[d]!==-1){h[d]=1;break}}for(let d=f;d<=c;d++)if(!p[d]){let _=r[d],S=d;p[d]=Y(D=>(u[S]=D,y(_,S)))}let s=c+1<p.length&&p[c+1]?p[c+1]:e;for(let d=c;d>=f;d--){let _=d-f;(b[_]===-1||!h[_])&&(s&&s.parentNode!==t&&(s=e),t.insertBefore(p[d],s)),s=p[d]}}function se(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function Xt(t,e){if(e===0)return[];if(e===1)return[0];let n=new Int32Array(e),r=new Int32Array(e),o=1;n[0]=0,r[0]=-1;for(let f=1;f<e;f++)if(t[f]>t[n[o-1]])r[f]=n[o-1],n[o++]=f;else{let a=0,c=o-1;for(;a<c;){let p=a+c>>1;t[n[p]]<t[f]?a=p+1:c=p}n[a]=f,r[f]=a>0?n[a-1]:-1}let i=new Array(o),y=n[o-1];for(let f=o-1;f>=0;f--)i[f]=y,y=r[y];return i}function le(){return document.createComment("i")}function v(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function mt(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;I(r),t.removeChild(r),r=o}}function bt(t,e,n,r,o,i,y,f,a){let c;if(o){let m=r(e),x=a(e);c=x,o.set(m,{itemSig:x})}else c=e;let p=le();t.appendChild(p);let u=Y(m=>(f[n]=m,i(c,n)));t.appendChild(u),y[n]=p}function ue(t,e,n,r,o,i,y,f,a){let c=r.length,p=n.length;if(c===0){if(p>0){for(let l=0;l<p;l++)i[l]&&i[l]();o[0]&&mt(t,o[0],e),o.length=0,i.length=0,a&&a.clear()}return}if(p===0){let l=document.createDocumentFragment();for(let E=0;E<c;E++)bt(l,r[E],E,f,a,y,o,i,O);t.insertBefore(l,e);return}let u=0,m=Math.min(p,c);for(;u<m;){if(n[u]===r[u]){u++;continue}let l=f(n[u]),E=f(r[u]);if(l!==E)break;a&&a.get(l).itemSig.set(r[u]),u++}let x=p-1,b=c-1;for(;x>=u&&b>=u;){if(n[x]===r[b]){x--,b--;continue}let l=f(n[x]),E=f(r[b]);if(l!==E)break;a&&a.get(l).itemSig.set(r[b]),x--,b--}if(u>x&&u>b)return;let C=new Array(c),h=new Array(c);for(let l=0;l<u;l++)C[l]=o[l],h[l]=i[l];for(let l=b+1;l<c;l++){let E=x+1+(l-b-1);C[l]=o[E],h[l]=i[E]}let s=b-u+1,d=x-u+1;if(d===0){let l=b+1<c&&C[b+1]?C[b+1]:e,E=document.createDocumentFragment();for(let B=u;B<=b;B++)bt(E,r[B],B,f,a,y,C,h,O);t.insertBefore(E,l),F(o,i,C,h,c);return}if(s===0){for(let l=u;l<=x;l++){i[l]?.();let E=X(t,o[l],o,l,e);mt(t,o[l],E),a&&a.delete(f(n[l]))}F(o,i,C,h,c);return}if(s===d&&s>=2&&s<=Math.max(d,200)){let l=0,E=-1,B=-1;for(let w=0;w<s&&l<=4;w++){let T=f(n[u+w]),R=f(r[u+w]);T!==R&&(l===0?E=w:l===1&&(B=w),l++)}if(l===2){let w=u+E,T=u+B,R=f(n[w]),$=f(n[T]),Z=f(r[w]),it=f(r[T]);if(R===it&&$===Z){for(let g=0;g<u;g++)C[g]=o[g],h[g]=i[g];for(let g=u;g<=b;g++)C[g]=o[g],h[g]=i[g];for(let g=b+1;g<c;g++){let K=x+1+(g-b-1);C[g]=o[K],h[g]=i[K]}let q=C[w];C[w]=C[T],C[T]=q;let H=h[w];if(h[w]=h[T],h[T]=H,a){if(r[w]!==n[w]){let g=f(r[w]),K=a.get(g);K&&K.itemSig.set(r[w])}if(r[T]!==n[T]){let g=f(r[T]),K=a.get(g);K&&K.itemSig.set(r[T])}}let M=T===w+1||w===T+1,P=Math.min(w,T),N=Math.max(w,T);if(M){let g=X(t,o[N],o,N,e);v(t,o[N],g,o[P])}else{let g=X(t,o[T],o,T,e),K=document.createComment("tmp");t.insertBefore(K,o[T]),v(t,o[T],g,o[w]);let ft=X(t,o[w],o,w,e);v(t,o[w],ft,K),t.removeChild(K)}F(o,i,C,h,c);return}}if(l>=2&&l<=s){let w=E,T=null,R=-1,$=-1,Z=!1,it=f(n[u+w]),q=-1;for(let H=w;H<s;H++)if(f(r[u+H])===it){q=H;break}if(q>w){let H=!0;for(let M=w;M<q;M++)if(f(n[u+M+1])!==f(r[u+M])){H=!1;break}if(H){let M=!0;for(let P=q+1;P<s;P++)if(f(n[u+P])!==f(r[u+P])){M=!1;break}M&&(Z=!0,R=u+w,$=u+q,T=it)}}if(!Z){let H=f(r[u+w]),M=-1;for(let P=w;P<d;P++)if(f(n[u+P])===H){M=P;break}if(M>w){let P=!0;for(let N=w;N<M;N++)if(f(n[u+N])!==f(r[u+N+1])){P=!1;break}if(P){let N=!0;for(let g=M+1;g<s;g++)if(f(n[u+g])!==f(r[u+g])){N=!1;break}N&&(Z=!0,R=u+M,$=u+w,T=H)}}}if(Z){for(let g=u;g<=x;g++)C[g]=o[g],h[g]=i[g];let H=C[R],M=h[R];if(R<$)for(let g=R;g<$;g++)C[g]=C[g+1],h[g]=h[g+1];else for(let g=R;g>$;g--)C[g]=C[g-1],h[g]=h[g-1];if(C[$]=H,h[$]=M,a)for(let g=u;g<=b;g++){let K=f(r[g]);if(r[g]!==n[g]){let ft=a.get(K);ft&&ft.itemSig.set(r[g])}}let P=X(t,H,o,R,e),N;$+1<c?N=C[$+1]:N=e,($>=b+1||N&&N.parentNode!==t)&&(N=e),v(t,H,P,N),F(o,i,C,h,c);return}}}let _=new Map;for(let l=u;l<=x;l++)_.set(f(n[l]),l);let S=new Int32Array(s);S.fill(-1);for(let l=u;l<=b;l++){let E=f(r[l]),B=_.get(E);B!==void 0&&(_.delete(E),C[l]=o[B],h[l]=i[B],S[l-u]=B,a&&r[l]!==n[B]&&a.get(E).itemSig.set(r[l]))}let D=[..._.values()].sort((l,E)=>E-l);for(let l of D){i[l]?.();let E=X(t,o[l],o,l,e);mt(t,o[l],E),a&&a.delete(f(n[l]))}for(let l=u;l<=b;l++)if(!C[l]){let E=document.createDocumentFragment();bt(E,r[l],l,f,a,y,C,h,O),C[l]._frag=E}let L=0,rt=!0,ot=-1;for(let l=0;l<s;l++)S[l]!==-1&&(L++,S[l]<=ot&&(rt=!1),ot=S[l]);let V=new Uint8Array(s);if(rt)for(let l=0;l<s;l++)S[l]!==-1&&(V[l]=1);else if(L>1){let l=new Int32Array(L),E=new Int32Array(L),B=0;for(let T=0;T<s;T++)S[T]!==-1&&(l[B]=S[T],E[B]=T,B++);let w=Xt(l,L);for(let T=0;T<w.length;T++)V[E[w[T]]]=1}else if(L===1){for(let l=0;l<s;l++)if(S[l]!==-1){V[l]=1;break}}F(o,i,C,h,c);let ht=b+1<c&&o[b+1]?o[b+1]:e;for(let l=b;l>=u;l--){let E=l-u,B=o[l];if(S[E]===-1)B._frag&&(t.insertBefore(B._frag,ht),delete B._frag);else if(!V[E]){let w=X(t,B,o,l,e);v(t,B,w,ht)}ht=B}}function X(t,e,n,r,o){let i=e.nextSibling;for(;i&&i!==o;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return o}function F(t,e,n,r,o){t.length=o,e.length=o;for(let i=0;i<o;i++)t[i]=n[i],e[i]=r[i]}function en(t,e){for(let n in e){let r=e[n];if(n==="ref"){typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(typeof r=="function"&&!W(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=j(()=>{let o=r()||"";at&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=j(()=>{dt(t,r())}):t._propEffects[n]=j(()=>{lt(t,n,r())})}else lt(t,n,r)}}function lt(t,e,n){if(e==="ref"){typeof n=="function"?n(t):n&&typeof n=="object"&&(n.current=t);return}if(e==="key")return;if(typeof n=="function"&&!W(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>lt(t,e,n()));return}if(W(e))return;if(Lt(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=at&&t instanceof SVGElement;if(e==="class"||e==="className")r?t.setAttribute("class",n||""):t.className=n||"";else if(e==="dangerouslySetInnerHTML"){let o=n?.__html??"";typeof z<"u"&&z&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else if(e==="innerHTML")if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";typeof z<"u"&&z&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else typeof console<"u"&&n!=null&&n!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(e==="style")dt(t,n);else if(n==null){if(e in t)try{t[e]=""}catch{}t.removeAttribute(e)}else e.startsWith("data-")||e.startsWith("aria-")?t.setAttribute(e,n):typeof n=="boolean"?n?t.setAttribute(e,""):t.removeAttribute(e):r?t.setAttribute(e,n):e==="value"&&t.tagName==="SELECT"?pt(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function nt(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>r(t,n()))}function ae(t,e){if(typeof e=="function")return nt(t,"class",e,ae);at&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function dt(t,e){if(typeof e=="function")return nt(t,"style",e,dt);if(typeof e=="string")t.style.cssText=e,t._lastStyleObj=null;else if(e&&typeof e=="object"){let n=t.style,r=t._lastStyleObj;if(r)for(let o in r)o in e||(n[o]="");for(let o in e)n[o]=e[o]??"";t._lastStyleObj=e}else e==null&&(t.style.cssText="",t._lastStyleObj=null)}function de(t,e,n){if(typeof n=="function")return nt(t,e,n,(r,o)=>de(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function he(t,e){if(typeof e=="function")return nt(t,"value",e,he);if(t.tagName==="SELECT"){pt(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function pe(t,e){if(typeof e=="function")return nt(t,"checked",e,pe);t.checked=!!e}var Vt=new Set;function nn(t){for(let e of t)Vt.has(e)||(Vt.add(e),document.addEventListener(e,n=>{let r=n.target,o="$$"+e;for(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return r||document}});r;){let i=r[o];if(i&&(i(n),n.cancelBubble))return;r=r.parentNode}}))}function rn(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function on(t,e){j(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var ut=!1,A=null;function fn(){return ut}function ge(t,e){ut=!0,Rt(),A={parent:e,index:0};try{let n=k(t,e);return e!==document.body&&e!==document.documentElement&&Zt(e),n}finally{ut=!1,A=null}}function Zt(t){if(!(!A||A.parent!==t))for(;t.childNodes.length>A.index;){let e=t.lastChild;I(e),t.removeChild(e)}}var ye=new Set(["$","/$","[]","/[]","fn","/fn","eb:start","eb:end","sb:start","sb:end","portal","portal:empty"]);function Jt(t){return t.nodeType===8&&ye.has(t.textContent)}function xt(t){let e=t.childNodes;for(;A.index<e.length;){let n=e[A.index];if(Jt(n)){A.index++;continue}return A.index++,n}return null}function Yt(t){if(!A||A.parent!==t)return null;let e=t.childNodes;for(let n=A.index;n<e.length;n++){let r=e[n];if(!Jt(r))return r}return null}function tt(t,e){return A&&A.parent===t?(t.insertBefore(e,t.childNodes[A.index]||null),A.index++):t.appendChild(e),e}function _t(){return z}function k(t,e){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let n=String(t);if(n===""){let i=Yt(e);return i&&i.nodeType===3?(xt(e),i.textContent="",i):tt(e,document.createTextNode(""))}let r=xt(e);if(r&&r.nodeType===3)return r.textContent!==n&&(_t()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;_t()&&console.warn(`[what] Hydration mismatch: expected text node "${n}", got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createTextNode(n);return r?e.replaceChild(o,r):tt(e,o),o}if(typeof t=="function"&&t._lazyChildren)return k(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(A&&A.parent===e),r=n&&e.childNodes[A.index]||null,o=t(e,r);if(n){let i=Array.prototype.indexOf.call(e.childNodes,o);i>=0&&(A.index=i+1)}return o}if(typeof t=="function"){let n=!!(A&&A.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[A.index]||null),A.index++):e.appendChild(r),k(t(),e),n?(e.insertBefore(o,e.childNodes[A.index]||null),A.index++):e.appendChild(o);let i=[];for(let u=r.nextSibling;u&&u!==o;u=u.nextSibling)i.push(u);let y=i.length===0?null:i.length===1?i[0]:i,f=At(),a=j(()=>qt(f,()=>{let u=t();ut||(y=st(o.parentNode||e,u,y,o))})),c=!1,p=()=>{c||(c=!0,a())};return r._dispose=p,o._dispose=p,Bt(r,p),y}if(Array.isArray(t)){let n=[];for(let r of t){let o=k(r,e);o&&n.push(o)}return n.length===1?n[0]:n}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let i=Q(),y=t.tag,f=t.props||{},a=t.children||[],c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:y,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(c);let p,u=null;try{let m={...f};f._$lazyChildren?u=Mt(y,m,f._$lazyChildren):m.children=a.length===0?f.children:a.length===1?a[0]:a,p=y(m),u&&u()}catch(m){return i.pop(),!Dt(m)&&!(m&&typeof m.then=="function"&&me(m,c))&&!Tt(m,c)&&console.error("[what] Error in component during hydration:",y.name||"Anonymous",m),null}c.mounted=!0,c._mountCallbacks&&queueMicrotask(()=>{if(!c.disposed)for(let m of c._mountCallbacks)try{m()}catch(x){console.error("[what] onMount error:",x)}});try{let m=k(p,e),x=typeof p=="function"||Array.isArray(p)&&p.some(h=>typeof h=="function"),b=Array.isArray(m)?m[0]:m,C=!x&&b&&b.nodeType?b:e;return ct(C,c),m}finally{i.pop()}}if(t.tag==="__errorBoundary"){let{errorState:i,fallback:y,reset:f,handleError:a}=t.props;return zt(t,e,{startText:"eb:start",endText:"eb:end",ctxExtras:{_errorBoundary:a},state:i,contentFor:c=>c?typeof y=="function"?y({error:c,reset:f}):y:t.children||[]})}if(t.tag==="__suspense"){let{boundary:i,fallback:y,loading:f}=t.props;return zt(t,e,{startText:"sb:start",endText:"sb:end",ctxExtras:{_suspenseBoundary:i},state:f,contentFor:a=>a?y:t.children||[]})}if(t.tag==="__portal"){let i=G(t,e);return i?tt(e,i):null}let n=xt(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){_e(n,t.props||{});let i=A;if(A={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let f of t.children)k(f,n);t.children.length>0&&Zt(n)}return A=i,n}_t()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=G(t,e,Ct(e));return n?e.replaceChild(o,n):tt(e,o),o}return kt(t)?t:tt(e,document.createTextNode(String(t)))}function me(t,e){for(let n=e;n;n=n._parentCtx)if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(t),!0;return!1}function be(t,e){return typeof t=="string"||typeof t=="number"?e.nodeType!==3:t&&t._vnode&&typeof t.tag=="string"?e.nodeType!==1||e.nodeName.toLowerCase()!==t.tag.toLowerCase():!1}function xe(t,e,n){if(e<0||!A||A.parent!==t||A.index!==e)return!1;let r=Yt(t);if(!r)return!1;let o=n(),i=Array.isArray(o)?o:[o],y=i.find(f=>f!=null&&typeof f!="boolean");if(y===void 0)return!0;if(be(y,r))return!1;for(let f of i)k(f,t);return!0}function zt(t,e,{startText:n,endText:r,ctxExtras:o,state:i,contentFor:y}){let f=t.children||[],a=!!(A&&A.parent===e),c=document.createComment(n),p=document.createComment(r),u={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:At(),_startComment:c,_endComment:p,...o};a?(e.insertBefore(c,e.childNodes[A.index]||null),A.index++):e.appendChild(c);let m=a?A.index:-1,x=Q();x.push(u);try{for(let _ of f)k(_,e)}finally{x.pop()}let b=wt(i),C=!b;if(b){x.push(u);try{C=xe(e,m,()=>y(b))}finally{x.pop()}}a?(e.insertBefore(p,e.childNodes[A.index]||null),A.index++):e.appendChild(p);let h=!0,s=0,d=j(()=>{let _=i();if(h&&(h=!1,C&&_===b))return;let S=c.parentNode;if(!S)return;let D=++s;for(;c.nextSibling&&c.nextSibling!==p;){let L=c.nextSibling;I(L),S.removeChild(L)}x.push(u);try{let L=y(_),rt=Array.isArray(L)?L:[L];for(let ot of rt){let V=G(ot,S);if(D!==s){V&&I(V);break}V&&(p.parentNode?p.parentNode.insertBefore(V,p):I(V))}}finally{x.pop()}});if(a&&A&&A.parent===e){let _=Array.prototype.indexOf.call(e.childNodes,p);_>=0&&(A.index=_+1)}return u.effects.push(d),ct(c,u),ct(p,u),c}function _e(t,e){for(let n in e){if(n==="children"||n==="key"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;if(n==="ref"){let o=e.ref;typeof o=="function"?o(t):o&&typeof o=="object"&&(o.current=t);continue}let r=e[n];if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(n.startsWith("$$")){t[n]=r;continue}if(typeof r=="function"&&!W(n)){n==="class"||n==="className"?j(()=>{t.className=r()||""}):n==="style"&&typeof r()=="object"?j(()=>{dt(t,r())}):j(()=>{lt(t,n,r())});continue}}}St({hydrate:ge,insert:Ut});export{Te as a,Se as b,Qt as c,Le as d,Ft as e,Be as f,Ne as g,Me as h,De as i,He as j,Pe as k,je as l,Ke as m,$t as n,Re as o,$e as p,Ie as q,Oe as r,Ve as s,ze as t,Ye as u,Qe as v,ne as w,ve as x,re as y,Ut as z,Fe as A,tn as B,en as C,lt as D,ae as E,dt as F,de as G,he as H,pe as I,nn as J,rn as K,on as L,fn as M,ge as N};