@pie-element/mc-populated-blank 0.2.13 → 0.3.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +9 -6
  2. package/author.js +2 -0
  3. package/configure.js +2 -0
  4. package/dist/author/defaults.d.ts +74 -0
  5. package/dist/author/index.d.ts +0 -1
  6. package/dist/author/index.js +1732 -1553
  7. package/dist/author/index.js.map +1 -1
  8. package/dist/browser/McPopulatedBlank-DbmR6UWn.js +2542 -0
  9. package/dist/browser/McPopulatedBlank-DbmR6UWn.js.map +1 -0
  10. package/dist/browser/author/index.js +41 -0
  11. package/dist/browser/author/index.js.map +1 -0
  12. package/dist/browser/client-CWh3mUUV.js +2385 -0
  13. package/dist/browser/client-CWh3mUUV.js.map +1 -0
  14. package/dist/browser/controller/index.js +2 -0
  15. package/dist/browser/controller-D_ITRCYG.js +209 -0
  16. package/dist/browser/controller-D_ITRCYG.js.map +1 -0
  17. package/dist/browser/delivery/index.js +124 -0
  18. package/dist/browser/delivery/index.js.map +1 -0
  19. package/dist/browser/layoutLimits-Bp17YP2V.js +42 -0
  20. package/dist/browser/layoutLimits-Bp17YP2V.js.map +1 -0
  21. package/dist/browser/print/index.js +129 -0
  22. package/dist/browser/print/index.js.map +1 -0
  23. package/dist/controller/defaults.d.ts +8 -30
  24. package/dist/controller/index.d.ts +79 -63
  25. package/dist/controller/index.js +108 -85
  26. package/dist/controller/index.js.map +1 -1
  27. package/dist/delivery/computeAudioMode.d.ts +0 -1
  28. package/dist/delivery/computeChoiceCorrectness.d.ts +0 -1
  29. package/dist/delivery/computeDisplayState.d.ts +7 -8
  30. package/dist/delivery/computeLayoutProfile.d.ts +0 -1
  31. package/dist/delivery/computeLayoutStyle.d.ts +0 -2
  32. package/dist/delivery/i18n.d.ts +8 -0
  33. package/dist/delivery/index.d.ts +8 -17
  34. package/dist/delivery/index.js +6138 -3662
  35. package/dist/delivery/index.js.map +1 -1
  36. package/dist/delivery/variant-css-map.d.ts +15 -2
  37. package/dist/index.d.ts +0 -1
  38. package/dist/index.iife.d.ts +0 -156
  39. package/dist/index.iife.js +139 -38
  40. package/dist/index.js +2 -6811
  41. package/dist/print/index.d.ts +4 -1
  42. package/dist/print/index.js +8158 -3655
  43. package/dist/print/index.js.map +1 -1
  44. package/dist/print/preparePrint.d.ts +15 -0
  45. package/dist/runtime-support.d.ts +12 -0
  46. package/dist/runtime-support.js +14 -0
  47. package/dist/runtime-support.js.map +1 -0
  48. package/dist/shared/layoutLimits.d.ts +1 -2
  49. package/dist/shared/types.d.ts +21 -19
  50. package/module/print.js +5192 -0
  51. package/module/print.js.map +1 -0
  52. package/package.json +42 -14
  53. package/print.js +2 -0
  54. package/dist/author/index.d.ts.map +0 -1
  55. package/dist/controller/defaults.d.ts.map +0 -1
  56. package/dist/controller/index.d.ts.map +0 -1
  57. package/dist/delivery/computeAudioMode.d.ts.map +0 -1
  58. package/dist/delivery/computeChoiceCorrectness.d.ts.map +0 -1
  59. package/dist/delivery/computeDisplayState.d.ts.map +0 -1
  60. package/dist/delivery/computeLayoutProfile.d.ts.map +0 -1
  61. package/dist/delivery/computeLayoutStyle.d.ts.map +0 -1
  62. package/dist/delivery/index.d.ts.map +0 -1
  63. package/dist/delivery/variant-css-map.d.ts.map +0 -1
  64. package/dist/index.d.ts.map +0 -1
  65. package/dist/index.iife.d.ts.map +0 -1
  66. package/dist/index.js.map +0 -1
  67. package/dist/print/index.d.ts.map +0 -1
  68. package/dist/shared/layoutLimits.d.ts.map +0 -1
  69. package/dist/shared/types.d.ts.map +0 -1
@@ -1,14 +1,14 @@
1
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/disclose-version.js
2
2
  if (typeof window !== "undefined") {
3
3
  var _window$__svelte, _window;
4
4
  ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
5
  }
6
6
  //#endregion
7
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/constants.js
8
8
  var HYDRATION_ERROR = {};
9
- var UNINITIALIZED = Symbol();
9
+ var UNINITIALIZED = Symbol("uninitialized");
10
10
  //#endregion
11
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/shared/utils.js
11
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/utils.js
12
12
  var is_array = Array.isArray;
13
13
  var index_of = Array.prototype.indexOf;
14
14
  var includes = Array.prototype.includes;
@@ -44,7 +44,7 @@ function deferred() {
44
44
  };
45
45
  }
46
46
  //#endregion
47
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
47
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
48
48
  function _typeof(o) {
49
49
  "@babel/helpers - typeof";
50
50
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -54,7 +54,7 @@ function _typeof(o) {
54
54
  }, _typeof(o);
55
55
  }
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
57
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
58
58
  function toPrimitive(t, r) {
59
59
  if ("object" != _typeof(t) || !t) return t;
60
60
  var e = t[Symbol.toPrimitive];
@@ -66,13 +66,13 @@ function toPrimitive(t, r) {
66
66
  return ("string" === r ? String : Number)(t);
67
67
  }
68
68
  //#endregion
69
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
70
70
  function toPropertyKey(t) {
71
71
  var i = toPrimitive(t, "string");
72
72
  return "symbol" == _typeof(i) ? i : i + "";
73
73
  }
74
74
  //#endregion
75
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
75
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
76
76
  function _defineProperty(e, r, t) {
77
77
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
78
78
  value: t,
@@ -107,7 +107,13 @@ var WAS_MARKED = 65536;
107
107
  var REACTION_IS_UPDATING = 1 << 21;
108
108
  var ERROR_VALUE = 1 << 23;
109
109
  var STATE_SYMBOL = Symbol("$state");
110
+ /** Marks component export objects, so that `proxy(...)` leaves them untouched */
111
+ var COMPONENT_SYMBOL = Symbol("component");
110
112
  var LEGACY_PROPS = Symbol("legacy props");
113
+ var ATTRIBUTES_CACHE = Symbol("attributes");
114
+ var CLASS_CACHE = Symbol("class");
115
+ var STYLE_CACHE = Symbol("style");
116
+ var TEXT_CACHE = Symbol("text");
111
117
  /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
112
118
  var STALE_REACTION = new class StaleReactionError extends Error {
113
119
  constructor(..._args) {
@@ -118,56 +124,6 @@ var STALE_REACTION = new class StaleReactionError extends Error {
118
124
  }();
119
125
  globalThis.document?.contentType;
120
126
  /**
121
- * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
122
- * @returns {never}
123
- */
124
- function effect_update_depth_exceeded() {
125
- throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
126
- }
127
- /**
128
- * Failed to hydrate the application
129
- * @returns {never}
130
- */
131
- function hydration_failed() {
132
- throw new Error(`https://svelte.dev/e/hydration_failed`);
133
- }
134
- /**
135
- * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
136
- * @param {string} key
137
- * @returns {never}
138
- */
139
- function props_invalid_value(key) {
140
- throw new Error(`https://svelte.dev/e/props_invalid_value`);
141
- }
142
- /**
143
- * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
144
- * @returns {never}
145
- */
146
- function state_descriptors_fixed() {
147
- throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
148
- }
149
- /**
150
- * Cannot set prototype of `$state` object
151
- * @returns {never}
152
- */
153
- function state_prototype_fixed() {
154
- throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
155
- }
156
- /**
157
- * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
158
- * @returns {never}
159
- */
160
- function state_unsafe_mutation() {
161
- throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
162
- }
163
- /**
164
- * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
165
- * @returns {never}
166
- */
167
- function svelte_boundary_reset_onerror() {
168
- throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
169
- }
170
- /**
171
127
  * Reading a derived belonging to a now-destroyed effect may result in stale values
172
128
  */
173
129
  function derived_inert() {
@@ -187,7 +143,7 @@ function svelte_boundary_reset_noop() {
187
143
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
188
144
  }
189
145
  //#endregion
190
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/hydration.js
146
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/hydration.js
191
147
  /** @import { TemplateNode } from '#client' */
192
148
  /**
193
149
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -246,7 +202,7 @@ function skip_nodes(remove = true) {
246
202
  }
247
203
  }
248
204
  //#endregion
249
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/equality.js
205
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/equality.js
250
206
  /** @import { Equals } from '#client' */
251
207
  /** @type {Equals} */
252
208
  function equals(value) {
@@ -264,14 +220,64 @@ function safe_not_equal(a, b) {
264
220
  function safe_equals(value) {
265
221
  return !safe_not_equal(value, this.v);
266
222
  }
223
+ /**
224
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
225
+ * @returns {never}
226
+ */
227
+ function effect_update_depth_exceeded() {
228
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
229
+ }
230
+ /**
231
+ * Failed to hydrate the application
232
+ * @returns {never}
233
+ */
234
+ function hydration_failed() {
235
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
236
+ }
237
+ /**
238
+ * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
239
+ * @param {string} key
240
+ * @returns {never}
241
+ */
242
+ function props_invalid_value(key) {
243
+ throw new Error(`https://svelte.dev/e/props_invalid_value`);
244
+ }
245
+ /**
246
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
247
+ * @returns {never}
248
+ */
249
+ function state_descriptors_fixed() {
250
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
251
+ }
252
+ /**
253
+ * Cannot set prototype of `$state` object
254
+ * @returns {never}
255
+ */
256
+ function state_prototype_fixed() {
257
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
258
+ }
259
+ /**
260
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
261
+ * @returns {never}
262
+ */
263
+ function state_unsafe_mutation() {
264
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
265
+ }
266
+ /**
267
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
268
+ * @returns {never}
269
+ */
270
+ function svelte_boundary_reset_onerror() {
271
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
272
+ }
267
273
  //#endregion
268
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/flags/index.js
274
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/flags/index.js
269
275
  /** True if experimental.async=true */
270
276
  var async_mode_flag = false;
271
277
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
272
278
  var legacy_mode_flag = false;
273
279
  //#endregion
274
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/context.js
280
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/context.js
275
281
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
276
282
  /** @type {ComponentContext | null} */
277
283
  var component_context = null;
@@ -316,14 +322,22 @@ function pop(component) {
316
322
  if (component !== void 0) context.x = component;
317
323
  context.i = true;
318
324
  component_context = context.p;
319
- return component ?? {};
325
+ return mark_as_component(component);
326
+ }
327
+ /**
328
+ * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.
329
+ * @param {any} component
330
+ */
331
+ function mark_as_component(component = {}) {
332
+ define_property(component, COMPONENT_SYMBOL, { value: true });
333
+ return component;
320
334
  }
321
335
  /** @returns {boolean} */
322
336
  function is_runes() {
323
337
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
324
338
  }
325
339
  //#endregion
326
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/task.js
340
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/task.js
327
341
  /** @type {Array<() => void>} */
328
342
  var micro_tasks = [];
329
343
  function run_micro_tasks() {
@@ -349,39 +363,8 @@ function queue_micro_task(fn) {
349
363
  function flush_tasks() {
350
364
  while (micro_tasks.length > 0) run_micro_tasks();
351
365
  }
352
- /**
353
- * @param {unknown} error
354
- */
355
- function handle_error(error) {
356
- var effect = active_effect;
357
- if (effect === null) {
358
- /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
359
- return error;
360
- }
361
- if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
362
- invoke_error_boundary(error, effect);
363
- }
364
- /**
365
- * @param {unknown} error
366
- * @param {Effect | null} effect
367
- */
368
- function invoke_error_boundary(error, effect) {
369
- while (effect !== null) {
370
- if ((effect.f & 128) !== 0) {
371
- if ((effect.f & 32768) === 0) throw error;
372
- try {
373
- /** @type {Boundary} */ effect.b.error(error);
374
- return;
375
- } catch (e) {
376
- error = e;
377
- }
378
- }
379
- effect = effect.parent;
380
- }
381
- throw error;
382
- }
383
366
  //#endregion
384
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/status.js
367
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/status.js
385
368
  /** @import { Derived, Signal } from '#client' */
386
369
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
387
370
  /**
@@ -400,7 +383,7 @@ function update_derived_status(derived) {
400
383
  else set_signal_status(derived, MAYBE_DIRTY);
401
384
  }
402
385
  //#endregion
403
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/utils.js
386
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
404
387
  /** @import { Derived, Effect, Value } from '#client' */
405
388
  /**
406
389
  * @param {Value[] | null} deps
@@ -428,7 +411,7 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
428
411
  set_signal_status(effect, CLEAN);
429
412
  }
430
413
  //#endregion
431
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/store.js
414
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/store.js
432
415
  /**
433
416
  * We set this to `true` when updating a store so that we correctly
434
417
  * schedule effects if the update takes place inside a `$:` effect
@@ -458,46 +441,188 @@ function capture_store_binding(fn) {
458
441
  }
459
442
  }
460
443
  //#endregion
461
- //#region \0@oxc-project+runtime@0.129.0/helpers/checkPrivateRedeclaration.js
444
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
445
+ /**
446
+ * @template T
447
+ * @param {() => T} fn
448
+ */
449
+ function without_reactive_context(fn) {
450
+ var previous_reaction = active_reaction;
451
+ var previous_effect = active_effect;
452
+ set_active_reaction(null);
453
+ set_active_effect(null);
454
+ try {
455
+ return fn();
456
+ } finally {
457
+ set_active_reaction(previous_reaction);
458
+ set_active_effect(previous_effect);
459
+ }
460
+ }
461
+ /**
462
+ * @template V
463
+ * @param {() => V} fn
464
+ * @returns {Derived<V>}
465
+ */
466
+ /*#__NO_SIDE_EFFECTS__*/
467
+ function derived(fn) {
468
+ var flags = 2 | DIRTY;
469
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
470
+ return {
471
+ ctx: component_context,
472
+ deps: null,
473
+ effects: null,
474
+ equals,
475
+ f: flags,
476
+ fn,
477
+ reactions: null,
478
+ rv: 0,
479
+ v: UNINITIALIZED,
480
+ wv: 0,
481
+ parent: active_effect,
482
+ ac: null
483
+ };
484
+ }
485
+ var OBSOLETE = Symbol("obsolete");
486
+ /**
487
+ * @template V
488
+ * @param {() => V} fn
489
+ * @returns {Derived<V>}
490
+ */
491
+ /*#__NO_SIDE_EFFECTS__*/
492
+ function derived_safe_equal(fn) {
493
+ const signal = /* @__PURE__ */ derived(fn);
494
+ signal.equals = safe_equals;
495
+ return signal;
496
+ }
497
+ /**
498
+ * @param {Derived} derived
499
+ * @returns {void}
500
+ */
501
+ function destroy_derived_effects(derived) {
502
+ var effects = derived.effects;
503
+ if (effects !== null) {
504
+ derived.effects = null;
505
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
506
+ }
507
+ }
508
+ /**
509
+ * @template T
510
+ * @param {Derived} derived
511
+ * @returns {T}
512
+ */
513
+ function execute_derived(derived) {
514
+ var value;
515
+ var prev_active_effect = active_effect;
516
+ var parent = derived.parent;
517
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
518
+ derived_inert();
519
+ return derived.v;
520
+ }
521
+ set_active_effect(parent);
522
+ try {
523
+ derived.f &= ~WAS_MARKED;
524
+ destroy_derived_effects(derived);
525
+ value = update_reaction(derived);
526
+ } finally {
527
+ set_active_effect(prev_active_effect);
528
+ }
529
+ return value;
530
+ }
531
+ /**
532
+ * @param {Derived} derived
533
+ * @returns {void}
534
+ */
535
+ function update_derived(derived) {
536
+ var value = execute_derived(derived);
537
+ if (!derived.equals(value)) {
538
+ derived.wv = increment_write_version();
539
+ if (!current_batch?.is_fork || derived.deps === null) {
540
+ if (current_batch !== null) {
541
+ current_batch.capture(derived, value, true);
542
+ previous_batch?.capture(derived, value, true);
543
+ } else derived.v = value;
544
+ if (derived.deps === null) {
545
+ set_signal_status(derived, CLEAN);
546
+ return;
547
+ }
548
+ }
549
+ }
550
+ if (is_destroying_effect) return;
551
+ if (batch_values !== null) {
552
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
553
+ } else update_derived_status(derived);
554
+ }
555
+ /**
556
+ * @param {Derived} derived
557
+ */
558
+ function freeze_derived_effects(derived) {
559
+ if (derived.effects === null) return;
560
+ for (const e of derived.effects) if (e.teardown || e.ac) {
561
+ e.teardown?.();
562
+ if (e.ac !== null) without_reactive_context(() => {
563
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
564
+ e.ac = null;
565
+ });
566
+ if (e.fn !== null) e.teardown = noop;
567
+ remove_reactions(e, 0);
568
+ destroy_effect_children(e);
569
+ }
570
+ }
571
+ /**
572
+ * @param {Derived} derived
573
+ */
574
+ function unfreeze_derived_effects(derived) {
575
+ if (derived.effects === null) return;
576
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
577
+ }
578
+ //#endregion
579
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/checkPrivateRedeclaration.js
462
580
  function _checkPrivateRedeclaration(e, t) {
463
581
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
464
582
  }
465
583
  //#endregion
466
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateMethodInitSpec.js
584
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
467
585
  function _classPrivateMethodInitSpec(e, a) {
468
586
  _checkPrivateRedeclaration(e, a), a.add(e);
469
587
  }
470
588
  //#endregion
471
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldInitSpec.js
589
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
472
590
  function _classPrivateFieldInitSpec(e, t, a) {
473
591
  _checkPrivateRedeclaration(e, t), t.set(e, a);
474
592
  }
475
593
  //#endregion
476
- //#region \0@oxc-project+runtime@0.129.0/helpers/assertClassBrand.js
594
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
477
595
  function _assertClassBrand(e, t, n) {
478
596
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
479
597
  throw new TypeError("Private element is not present on this object");
480
598
  }
481
599
  //#endregion
482
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldGet2.js
483
- function _classPrivateFieldGet2(s, a) {
484
- return s.get(_assertClassBrand(s, a));
485
- }
486
- //#endregion
487
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldSet2.js
600
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
488
601
  function _classPrivateFieldSet2(s, a, r) {
489
602
  return s.set(_assertClassBrand(s, a), r), r;
490
603
  }
491
604
  //#endregion
492
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/batch.js
605
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
606
+ function _classPrivateFieldGet2(s, a) {
607
+ return s.get(_assertClassBrand(s, a));
608
+ }
609
+ //#endregion
610
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/batch.js
493
611
  /** @import { Fork } from 'svelte' */
494
612
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
495
613
  var _Batch;
496
- /** @type {Set<Batch>} */
497
- var batches = /* @__PURE__ */ new Set();
614
+ /** @type {Batch | null} */
615
+ var first_batch = null;
616
+ /** @type {Batch | null} */
617
+ var last_batch = null;
498
618
  /** @type {Batch | null} */
499
619
  var current_batch = null;
500
620
  /**
621
+ * This is needed to avoid overwriting inputs
622
+ * @type {Batch | null}
623
+ */
624
+ var previous_batch = null;
625
+ /**
501
626
  * When time travelling (i.e. working in one batch, while other batches
502
627
  * still have ongoing work), we ignore the real values of affected
503
628
  * signals in favour of their values within the batch
@@ -525,9 +650,11 @@ var collected_effects = null;
525
650
  var legacy_updates = null;
526
651
  var flush_count = 0;
527
652
  var uid = 1;
653
+ var _started = /* @__PURE__ */ new WeakMap();
654
+ var _prev = /* @__PURE__ */ new WeakMap();
655
+ var _next = /* @__PURE__ */ new WeakMap();
528
656
  var _commit_callbacks = /* @__PURE__ */ new WeakMap();
529
657
  var _discard_callbacks = /* @__PURE__ */ new WeakMap();
530
- var _fork_commit_callbacks = /* @__PURE__ */ new WeakMap();
531
658
  var _pending = /* @__PURE__ */ new WeakMap();
532
659
  var _blocking_pending = /* @__PURE__ */ new WeakMap();
533
660
  var _deferred = /* @__PURE__ */ new WeakMap();
@@ -538,12 +665,21 @@ var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
538
665
  var _skipped_branches = /* @__PURE__ */ new WeakMap();
539
666
  var _unskipped_branches = /* @__PURE__ */ new WeakMap();
540
667
  var _decrement_queued = /* @__PURE__ */ new WeakMap();
541
- var _blockers = /* @__PURE__ */ new WeakMap();
542
668
  var _Batch_brand = /* @__PURE__ */ new WeakSet();
543
669
  var Batch = class Batch {
544
670
  constructor() {
545
671
  _classPrivateMethodInitSpec(this, _Batch_brand);
546
672
  _defineProperty(this, "id", uid++);
673
+ _classPrivateFieldInitSpec(this, _started, false);
674
+ _defineProperty(this, "linked", true);
675
+ _classPrivateFieldInitSpec(this, _prev, null);
676
+ _classPrivateFieldInitSpec(this, _next, null);
677
+ _defineProperty(
678
+ this,
679
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
680
+ "async_deriveds",
681
+ /* @__PURE__ */ new Map()
682
+ );
547
683
  _defineProperty(
548
684
  this,
549
685
  /**
@@ -567,8 +703,7 @@ var Batch = class Batch {
567
703
  );
568
704
  _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
569
705
  _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
570
- _classPrivateFieldInitSpec(this, _fork_commit_callbacks, /* @__PURE__ */ new Set());
571
- _classPrivateFieldInitSpec(this, _pending, /* @__PURE__ */ new Map());
706
+ _classPrivateFieldInitSpec(this, _pending, 0);
572
707
  _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
573
708
  _classPrivateFieldInitSpec(this, _deferred, null);
574
709
  _classPrivateFieldInitSpec(this, _roots, []);
@@ -579,7 +714,12 @@ var Batch = class Batch {
579
714
  _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
580
715
  _defineProperty(this, "is_fork", false);
581
716
  _classPrivateFieldInitSpec(this, _decrement_queued, false);
582
- _classPrivateFieldInitSpec(this, _blockers, /* @__PURE__ */ new Set());
717
+ if (last_batch === null) first_batch = last_batch = this;
718
+ else {
719
+ _classPrivateFieldSet2(_next, last_batch, this);
720
+ _classPrivateFieldSet2(_prev, this, last_batch);
721
+ }
722
+ last_batch = this;
583
723
  }
584
724
  /**
585
725
  * Add an effect to the #skipped_branches map and reset its children
@@ -654,8 +794,9 @@ var Batch = class Batch {
654
794
  discard() {
655
795
  for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
656
796
  _classPrivateFieldGet2(_discard_callbacks, this).clear();
657
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
658
- batches.delete(this);
797
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
798
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
799
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
659
800
  }
660
801
  /**
661
802
  * @param {Effect} effect
@@ -668,8 +809,7 @@ var Batch = class Batch {
668
809
  * @param {Effect} effect
669
810
  */
670
811
  increment(blocking, effect) {
671
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
672
- _classPrivateFieldGet2(_pending, this).set(effect, pending_count + 1);
812
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
673
813
  if (blocking) {
674
814
  let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
675
815
  _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
@@ -678,22 +818,19 @@ var Batch = class Batch {
678
818
  /**
679
819
  * @param {boolean} blocking
680
820
  * @param {Effect} effect
681
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
682
821
  */
683
- decrement(blocking, effect, skip) {
684
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
685
- if (pending_count === 1) _classPrivateFieldGet2(_pending, this).delete(effect);
686
- else _classPrivateFieldGet2(_pending, this).set(effect, pending_count - 1);
822
+ decrement(blocking, effect) {
823
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
687
824
  if (blocking) {
688
825
  let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
689
826
  if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
690
827
  else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
691
828
  }
692
- if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
829
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
693
830
  _classPrivateFieldSet2(_decrement_queued, this, true);
694
831
  queue_micro_task(() => {
695
832
  _classPrivateFieldSet2(_decrement_queued, this, false);
696
- this.flush();
833
+ if (this.linked) this.flush();
697
834
  });
698
835
  }
699
836
  /**
@@ -714,48 +851,38 @@ var Batch = class Batch {
714
851
  ondiscard(fn) {
715
852
  _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
716
853
  }
717
- /** @param {(batch: Batch) => void} fn */
718
- on_fork_commit(fn) {
719
- _classPrivateFieldGet2(_fork_commit_callbacks, this).add(fn);
720
- }
721
- run_fork_commit_callbacks() {
722
- for (const fn of _classPrivateFieldGet2(_fork_commit_callbacks, this)) fn(this);
723
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
724
- }
725
854
  settled() {
726
855
  return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
727
856
  }
728
857
  static ensure() {
729
858
  if (current_batch === null) {
730
859
  const batch = current_batch = new Batch();
731
- if (!is_processing) {
732
- batches.add(current_batch);
733
- if (!is_flushing_sync) queue_micro_task(() => {
734
- if (current_batch !== batch) return;
735
- batch.flush();
736
- });
737
- }
860
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
861
+ if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
862
+ });
738
863
  }
739
864
  return current_batch;
740
865
  }
741
866
  apply() {
742
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
867
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
743
868
  batch_values = null;
744
869
  return;
745
870
  }
746
871
  batch_values = /* @__PURE__ */ new Map();
747
872
  for (const [source, [value]] of this.current) batch_values.set(source, value);
748
- for (const batch of batches) {
873
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
749
874
  if (batch === this || batch.is_fork) continue;
750
875
  var intersects = false;
751
- var differs = false;
752
876
  if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
753
877
  if (is_derived) continue;
754
- intersects || (intersects = this.current.has(source));
755
- differs || (differs = !this.current.has(source));
878
+ if (this.current.has(source)) {
879
+ intersects = true;
880
+ break;
881
+ }
882
+ }
883
+ if (!intersects) {
884
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
756
885
  }
757
- if (intersects && differs) _classPrivateFieldGet2(_blockers, this).add(batch);
758
- else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
759
886
  }
760
887
  }
761
888
  /**
@@ -786,12 +913,10 @@ var Batch = class Batch {
786
913
  };
787
914
  _Batch = Batch;
788
915
  function _is_deferred() {
789
- return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this).size > 0;
790
- }
791
- function _is_blocked() {
792
- for (const batch of _classPrivateFieldGet2(_blockers, this)) for (const effect of _classPrivateFieldGet2(_blocking_pending, batch).keys()) {
793
- var skipped = false;
916
+ if (this.is_fork) return true;
917
+ for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
794
918
  var e = effect;
919
+ var skipped = false;
795
920
  while (e.parent !== null) {
796
921
  if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
797
922
  skipped = true;
@@ -804,20 +929,19 @@ function _is_blocked() {
804
929
  return false;
805
930
  }
806
931
  function _process() {
932
+ _classPrivateFieldSet2(_started, this, true);
807
933
  if (flush_count++ > 1e3) {
808
- batches.delete(this);
934
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
809
935
  infinite_loop_guard();
810
936
  }
811
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
812
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
813
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
814
- set_signal_status(e, DIRTY);
815
- this.schedule(e);
816
- }
817
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
818
- set_signal_status(e, MAYBE_DIRTY);
819
- this.schedule(e);
820
- }
937
+ for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
938
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
939
+ set_signal_status(e, DIRTY);
940
+ this.schedule(e);
941
+ }
942
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
943
+ set_signal_status(e, MAYBE_DIRTY);
944
+ this.schedule(e);
821
945
  }
822
946
  const roots = _classPrivateFieldGet2(_roots, this);
823
947
  _classPrivateFieldSet2(_roots, this, []);
@@ -835,6 +959,7 @@ function _process() {
835
959
  _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
836
960
  } catch (e) {
837
961
  reset_all(root);
962
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
838
963
  throw e;
839
964
  }
840
965
  current_batch = null;
@@ -844,30 +969,46 @@ function _process() {
844
969
  }
845
970
  collected_effects = null;
846
971
  legacy_updates = null;
847
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this) || _assertClassBrand(_Batch_brand, this, _is_blocked).call(this)) {
972
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
848
973
  _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
849
974
  _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
850
975
  for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
851
- } else {
852
- if (_classPrivateFieldGet2(_pending, this).size === 0) batches.delete(this);
853
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
854
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
855
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
856
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
857
- flush_queued_effects(render_effects);
858
- flush_queued_effects(effects);
859
- _classPrivateFieldGet2(_deferred, this)?.resolve();
976
+ if (updates.length > 0)
977
+ /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
978
+ return;
979
+ }
980
+ const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
981
+ if (earlier_batch) {
982
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
983
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
984
+ _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
985
+ return;
860
986
  }
987
+ _classPrivateFieldGet2(_dirty_effects$1, this).clear();
988
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
989
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
990
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
991
+ previous_batch = this;
992
+ flush_queued_effects(render_effects);
993
+ flush_queued_effects(effects);
994
+ previous_batch = null;
995
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
861
996
  var next_batch = current_batch;
862
- if (_classPrivateFieldGet2(_roots, this).length > 0) {
863
- const batch = next_batch ?? (next_batch = this);
864
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
997
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
998
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
999
+ if (async_mode_flag) {
1000
+ _assertClassBrand(_Batch_brand, this, _commit).call(this);
1001
+ current_batch = next_batch;
1002
+ }
865
1003
  }
1004
+ if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1005
+ const batch = next_batch;
1006
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1007
+ } else next_batch = this;
866
1008
  if (next_batch !== null) {
867
- batches.add(next_batch);
1009
+ old_values.clear();
868
1010
  _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
869
1011
  }
870
- if (async_mode_flag && !batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit).call(this);
871
1012
  }
872
1013
  /**
873
1014
  * Traverse the effect tree, executing effects or stashing
@@ -906,6 +1047,61 @@ function _traverse(root, effects, render_effects) {
906
1047
  }
907
1048
  }
908
1049
  }
1050
+ function _find_earlier_batch() {
1051
+ var batch = _classPrivateFieldGet2(_prev, this);
1052
+ while (batch !== null) {
1053
+ if (!batch.is_fork) {
1054
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
1055
+ }
1056
+ batch = _classPrivateFieldGet2(_prev, batch);
1057
+ }
1058
+ return null;
1059
+ }
1060
+ /**
1061
+ * @param {Batch} batch
1062
+ */
1063
+ function _merge(batch) {
1064
+ for (const [source, value] of batch.current) {
1065
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1066
+ this.current.set(source, value);
1067
+ }
1068
+ for (const [effect, deferred] of batch.async_deriveds) {
1069
+ const d = this.async_deriveds.get(effect);
1070
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1071
+ }
1072
+ batch.async_deriveds.clear();
1073
+ this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
1074
+ /**
1075
+ * mark all effects that depend on `batch.current`, except the
1076
+ * async effects that we just resolved (TODO unless they depend
1077
+ * on values in this batch that are NOT in the later batch?).
1078
+ * Through this we also will populate the correct #skipped_branches,
1079
+ * oncommit callbacks etc, so we don't need to merge them separately.
1080
+ * @param {Value} value
1081
+ */
1082
+ const mark = (value) => {
1083
+ var reactions = value.reactions;
1084
+ if (reactions === null) return;
1085
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
1086
+ for (const reaction of reactions) {
1087
+ var flags = reaction.f;
1088
+ if ((flags & 2) !== 0) mark(reaction);
1089
+ else {
1090
+ var effect = reaction;
1091
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1092
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
1093
+ set_signal_status(effect, DIRTY);
1094
+ this.schedule(effect);
1095
+ }
1096
+ }
1097
+ }
1098
+ };
1099
+ for (const source of this.current.keys()) mark(source);
1100
+ this.oncommit(() => batch.discard());
1101
+ _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1102
+ current_batch = this;
1103
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1104
+ }
909
1105
  /**
910
1106
  * @param {Effect[]} effects
911
1107
  */
@@ -913,7 +1109,7 @@ function _defer_effects(effects) {
913
1109
  for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
914
1110
  }
915
1111
  function _commit() {
916
- for (const batch of batches) {
1112
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
917
1113
  var is_earlier = batch.id < this.id;
918
1114
  /** @type {Source[]} */
919
1115
  var sources = [];
@@ -925,7 +1121,13 @@ function _commit() {
925
1121
  }
926
1122
  sources.push(source);
927
1123
  }
928
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
1124
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1125
+ const d = batch.async_deriveds.get(effect);
1126
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1127
+ }
1128
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
1129
+ if (!_classPrivateFieldGet2(_started, batch) || current.length === 0) continue;
1130
+ var others = current.filter((source) => !this.current.has(source));
929
1131
  if (others.length === 0) {
930
1132
  if (is_earlier) batch.discard();
931
1133
  } else if (sources.length > 0) {
@@ -940,12 +1142,18 @@ function _commit() {
940
1142
  var checked = /* @__PURE__ */ new Map();
941
1143
  for (var source of sources) mark_effects(source, others, marked, checked);
942
1144
  checked = /* @__PURE__ */ new Map();
943
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
944
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
945
- set_signal_status(effect, DIRTY);
946
- batch.schedule(effect);
947
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
948
- if (_classPrivateFieldGet2(_roots, batch).length > 0) {
1145
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1146
+ const v2 = this.current.get(c);
1147
+ if (!v2) return true;
1148
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1149
+ }).map(([c]) => c);
1150
+ if (current_unequal.length > 0) {
1151
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1152
+ set_signal_status(effect, DIRTY);
1153
+ batch.schedule(effect);
1154
+ } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1155
+ }
1156
+ if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
949
1157
  batch.apply();
950
1158
  for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
951
1159
  _classPrivateFieldSet2(_roots, batch, []);
@@ -953,13 +1161,16 @@ function _commit() {
953
1161
  batch.deactivate();
954
1162
  }
955
1163
  }
956
- for (const batch of batches) if (_classPrivateFieldGet2(_blockers, batch).has(this)) {
957
- _classPrivateFieldGet2(_blockers, batch).delete(this);
958
- if (_classPrivateFieldGet2(_blockers, batch).size === 0 && !_assertClassBrand(_Batch_brand, batch, _is_deferred).call(batch)) {
959
- batch.activate();
960
- _assertClassBrand(_Batch_brand, batch, _process).call(batch);
961
- }
962
- }
1164
+ }
1165
+ function _unlink() {
1166
+ if (!this.linked) return;
1167
+ var prev = _classPrivateFieldGet2(_prev, this);
1168
+ var next = _classPrivateFieldGet2(_next, this);
1169
+ if (prev === null) first_batch = next;
1170
+ else _classPrivateFieldSet2(_next, prev, next);
1171
+ if (next === null) last_batch = prev;
1172
+ else _classPrivateFieldSet2(_prev, next, prev);
1173
+ this.linked = false;
963
1174
  }
964
1175
  /**
965
1176
  * Synchronously flush any pending updates.
@@ -1112,1116 +1323,608 @@ function reset_all(effect) {
1112
1323
  }
1113
1324
  }
1114
1325
  //#endregion
1115
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/reactivity/create-subscriber.js
1326
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1327
+ /** @import { Derived, Effect, Source, Value } from '#client' */
1328
+ /** @type {Set<Effect>} */
1329
+ var eager_effects = /* @__PURE__ */ new Set();
1330
+ /** @type {Map<Source, any>} */
1331
+ var old_values = /* @__PURE__ */ new Map();
1332
+ var eager_effects_deferred = false;
1116
1333
  /**
1117
- * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1118
- * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1119
- *
1120
- * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1121
- * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1122
- *
1123
- * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1124
- *
1125
- * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1126
- * are active, and the returned teardown function will only be called when all effects are destroyed.
1127
- *
1128
- * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1129
- *
1130
- * ```js
1131
- * import { createSubscriber } from 'svelte/reactivity';
1132
- * import { on } from 'svelte/events';
1133
- *
1134
- * export class MediaQuery {
1135
- * #query;
1136
- * #subscribe;
1137
- *
1138
- * constructor(query) {
1139
- * this.#query = window.matchMedia(`(${query})`);
1140
- *
1141
- * this.#subscribe = createSubscriber((update) => {
1142
- * // when the `change` event occurs, re-run any effects that read `this.current`
1143
- * const off = on(this.#query, 'change', update);
1144
- *
1145
- * // stop listening when all the effects are destroyed
1146
- * return () => off();
1147
- * });
1148
- * }
1149
- *
1150
- * get current() {
1151
- * // This makes the getter reactive, if read in an effect
1152
- * this.#subscribe();
1153
- *
1154
- * // Return the current state of the query, whether or not we're in an effect
1155
- * return this.#query.matches;
1156
- * }
1157
- * }
1158
- * ```
1159
- * @param {(update: () => void) => (() => void) | void} start
1160
- * @since 5.7.0
1334
+ * @template V
1335
+ * @param {V} v
1336
+ * @param {Error | null} [stack]
1337
+ * @returns {Source<V>}
1161
1338
  */
1162
- function createSubscriber(start) {
1163
- let subscribers = 0;
1164
- let version = source(0);
1165
- /** @type {(() => void) | void} */
1166
- let stop;
1167
- return () => {
1168
- if (effect_tracking()) {
1169
- get(version);
1170
- render_effect(() => {
1171
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1172
- subscribers += 1;
1173
- return () => {
1174
- queue_micro_task(() => {
1175
- subscribers -= 1;
1176
- if (subscribers === 0) {
1177
- stop?.();
1178
- stop = void 0;
1179
- increment(version);
1180
- }
1181
- });
1182
- };
1183
- });
1184
- }
1339
+ function source(v, stack) {
1340
+ return {
1341
+ f: 0,
1342
+ v,
1343
+ reactions: null,
1344
+ equals,
1345
+ rv: 0,
1346
+ wv: 0
1185
1347
  };
1186
1348
  }
1187
- //#endregion
1188
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1189
- /** @import { Effect, Source, TemplateNode, } from '#client' */
1190
1349
  /**
1191
- * @typedef {{
1192
- * onerror?: (error: unknown, reset: () => void) => void;
1193
- * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1194
- * pending?: (anchor: Node) => void;
1195
- * }} BoundaryProps
1350
+ * @template V
1351
+ * @param {V} v
1352
+ * @param {Error | null} [stack]
1196
1353
  */
1197
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1354
+ /*#__NO_SIDE_EFFECTS__*/
1355
+ function state(v, stack) {
1356
+ const s = source(v, stack);
1357
+ push_reaction_value(s);
1358
+ return s;
1359
+ }
1198
1360
  /**
1199
- * @param {TemplateNode} node
1200
- * @param {BoundaryProps} props
1201
- * @param {((anchor: Node) => void)} children
1202
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1203
- * @returns {void}
1361
+ * @template V
1362
+ * @param {V} initial_value
1363
+ * @param {boolean} [immutable]
1364
+ * @returns {Source<V>}
1204
1365
  */
1205
- function boundary(node, props, children, transform_error) {
1206
- new Boundary(node, props, children, transform_error);
1207
- }
1208
- var _anchor = /* @__PURE__ */ new WeakMap();
1209
- var _hydrate_open = /* @__PURE__ */ new WeakMap();
1210
- var _props = /* @__PURE__ */ new WeakMap();
1211
- var _children = /* @__PURE__ */ new WeakMap();
1212
- var _effect = /* @__PURE__ */ new WeakMap();
1213
- var _main_effect = /* @__PURE__ */ new WeakMap();
1214
- var _pending_effect = /* @__PURE__ */ new WeakMap();
1215
- var _failed_effect = /* @__PURE__ */ new WeakMap();
1216
- var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1217
- var _local_pending_count = /* @__PURE__ */ new WeakMap();
1218
- var _pending_count = /* @__PURE__ */ new WeakMap();
1219
- var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1220
- var _dirty_effects = /* @__PURE__ */ new WeakMap();
1221
- var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1222
- var _effect_pending = /* @__PURE__ */ new WeakMap();
1223
- var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1224
- var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1225
- var Boundary = class {
1226
- /**
1227
- * @param {TemplateNode} node
1228
- * @param {BoundaryProps} props
1229
- * @param {((anchor: Node) => void)} children
1230
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1231
- */
1232
- constructor(node, props, children, transform_error) {
1233
- _classPrivateMethodInitSpec(this, _Boundary_brand);
1234
- _defineProperty(
1235
- this,
1236
- /** @type {Boundary | null} */
1237
- "parent",
1238
- void 0
1239
- );
1240
- _defineProperty(this, "is_pending", false);
1241
- _defineProperty(
1242
- this,
1243
- /**
1244
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1245
- * Inherited from parent boundary, or defaults to identity.
1246
- * @type {(error: unknown) => unknown}
1247
- */
1248
- "transform_error",
1249
- void 0
1250
- );
1251
- _classPrivateFieldInitSpec(this, _anchor, void 0);
1252
- _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1253
- _classPrivateFieldInitSpec(this, _props, void 0);
1254
- _classPrivateFieldInitSpec(this, _children, void 0);
1255
- _classPrivateFieldInitSpec(this, _effect, void 0);
1256
- _classPrivateFieldInitSpec(this, _main_effect, null);
1257
- _classPrivateFieldInitSpec(this, _pending_effect, null);
1258
- _classPrivateFieldInitSpec(this, _failed_effect, null);
1259
- _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1260
- _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1261
- _classPrivateFieldInitSpec(this, _pending_count, 0);
1262
- _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1263
- _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1264
- _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1265
- _classPrivateFieldInitSpec(this, _effect_pending, null);
1266
- _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1267
- _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1268
- return () => {
1269
- _classPrivateFieldSet2(_effect_pending, this, null);
1270
- };
1271
- }));
1272
- _classPrivateFieldSet2(_anchor, this, node);
1273
- _classPrivateFieldSet2(_props, this, props);
1274
- _classPrivateFieldSet2(_children, this, (anchor) => {
1275
- var effect = active_effect;
1276
- effect.b = this;
1277
- effect.f |= 128;
1278
- children(anchor);
1279
- });
1280
- this.parent = active_effect.b;
1281
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1282
- _classPrivateFieldSet2(_effect, this, block(() => {
1283
- if (hydrating) {
1284
- const comment = _classPrivateFieldGet2(_hydrate_open, this);
1285
- hydrate_next();
1286
- const server_rendered_pending = comment.data === "[!";
1287
- if (comment.data.startsWith("[?")) {
1288
- const serialized_error = JSON.parse(comment.data.slice(2));
1289
- _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1290
- } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1291
- else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1292
- } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1293
- }, flags));
1294
- if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
1295
- }
1296
- /**
1297
- * Defer an effect inside a pending boundary until the boundary resolves
1298
- * @param {Effect} effect
1299
- */
1300
- defer_effect(effect) {
1301
- defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1302
- }
1303
- /**
1304
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1305
- * @returns {boolean}
1306
- */
1307
- is_rendered() {
1308
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1309
- }
1310
- has_pending_snippet() {
1311
- return !!_classPrivateFieldGet2(_props, this).pending;
1312
- }
1313
- /**
1314
- * Update the source that powers `$effect.pending()` inside this boundary,
1315
- * and controls when the current `pending` snippet (if any) is removed.
1316
- * Do not call from inside the class
1317
- * @param {1 | -1} d
1318
- * @param {Batch} batch
1319
- */
1320
- update_pending_count(d, batch) {
1321
- _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1322
- _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1323
- if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1324
- _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1325
- queue_micro_task(() => {
1326
- _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1327
- if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1328
- });
1329
- }
1330
- get_effect_pending() {
1331
- _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1332
- return get(_classPrivateFieldGet2(_effect_pending, this));
1333
- }
1334
- /** @param {unknown} error */
1335
- error(error) {
1336
- if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1337
- if (current_batch?.is_fork) {
1338
- if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1339
- if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1340
- if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1341
- current_batch.on_fork_commit(() => {
1342
- _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1343
- });
1344
- } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1345
- }
1346
- };
1347
- function _hydrate_resolved_content() {
1348
- try {
1349
- _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1350
- } catch (error) {
1351
- this.error(error);
1352
- }
1366
+ /*#__NO_SIDE_EFFECTS__*/
1367
+ function mutable_source(initial_value, immutable = false, trackable = true) {
1368
+ const s = source(initial_value);
1369
+ if (!immutable) s.equals = safe_equals;
1370
+ if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
1371
+ var _component_context$l;
1372
+ ((_component_context$l = component_context.l).s ?? (_component_context$l.s = [])).push(s);
1373
+ }
1374
+ return s;
1353
1375
  }
1354
1376
  /**
1355
- * @param {unknown} error The deserialized error from the server's hydration comment
1377
+ * @template V
1378
+ * @param {Source<V>} source
1379
+ * @param {V} value
1380
+ * @param {boolean} [should_proxy]
1381
+ * @returns {V}
1356
1382
  */
1357
- function _hydrate_failed_content(error) {
1358
- const failed = _classPrivateFieldGet2(_props, this).failed;
1359
- if (!failed) return;
1360
- _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1361
- failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1362
- }));
1383
+ function set(source, value, should_proxy = false) {
1384
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation();
1385
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1363
1386
  }
1364
- function _hydrate_pending_content() {
1365
- const pending = _classPrivateFieldGet2(_props, this).pending;
1366
- if (!pending) return;
1367
- this.is_pending = true;
1368
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1369
- queue_micro_task(() => {
1370
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1371
- var anchor = create_text();
1372
- fragment.append(anchor);
1373
- _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1374
- return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1375
- }));
1376
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1377
- _classPrivateFieldGet2(_anchor, this).before(fragment);
1378
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1379
- pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1380
- _classPrivateFieldSet2(_pending_effect, this, null);
1381
- });
1382
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1387
+ /**
1388
+ * @template V
1389
+ * @param {Source<V>} source
1390
+ * @param {V} value
1391
+ * @param {Effect[] | null} [updated_during_traversal]
1392
+ * @returns {V}
1393
+ */
1394
+ function internal_set(source, value, updated_during_traversal = null) {
1395
+ if (!source.equals(value)) {
1396
+ if (is_destroying_effect) old_values.set(source, value);
1397
+ else if (!old_values.has(source)) old_values.set(source, source.v);
1398
+ var batch = Batch.ensure();
1399
+ batch.capture(source, value);
1400
+ if ((source.f & 2) !== 0) {
1401
+ const derived = source;
1402
+ if ((source.f & 2048) !== 0) execute_derived(derived);
1403
+ if (batch_values === null) update_derived_status(derived);
1383
1404
  }
1384
- });
1385
- }
1386
- function _render() {
1387
- try {
1388
- this.is_pending = this.has_pending_snippet();
1389
- _classPrivateFieldSet2(_pending_count, this, 0);
1390
- _classPrivateFieldSet2(_local_pending_count, this, 0);
1391
- _classPrivateFieldSet2(_main_effect, this, branch(() => {
1392
- _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1393
- }));
1394
- if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1395
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1396
- move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1397
- const pending = _classPrivateFieldGet2(_props, this).pending;
1398
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1399
- } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1400
- } catch (error) {
1401
- this.error(error);
1405
+ source.wv = increment_write_version();
1406
+ mark_reactions(source, DIRTY, updated_during_traversal);
1407
+ if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
1408
+ else untracked_writes.push(source);
1409
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1402
1410
  }
1411
+ return value;
1403
1412
  }
1404
- /**
1405
- * @param {Batch} batch
1406
- */
1407
- function _resolve(batch) {
1408
- this.is_pending = false;
1409
- batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1413
+ function flush_eager_effects() {
1414
+ eager_effects_deferred = false;
1415
+ for (const effect of eager_effects) {
1416
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1417
+ let dirty;
1418
+ try {
1419
+ dirty = is_dirty(effect);
1420
+ } catch {
1421
+ dirty = true;
1422
+ }
1423
+ if (dirty) update_effect(effect);
1424
+ }
1425
+ eager_effects.clear();
1410
1426
  }
1411
1427
  /**
1412
- * @template T
1413
- * @param {() => T} fn
1428
+ * Silently (without using `get`) increment a source
1429
+ * @param {Source<number>} source
1414
1430
  */
1415
- function _run(fn) {
1416
- var previous_effect = active_effect;
1417
- var previous_reaction = active_reaction;
1418
- var previous_ctx = component_context;
1419
- set_active_effect(_classPrivateFieldGet2(_effect, this));
1420
- set_active_reaction(_classPrivateFieldGet2(_effect, this));
1421
- set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1422
- try {
1423
- Batch.ensure();
1424
- return fn();
1425
- } catch (e) {
1426
- handle_error(e);
1427
- return null;
1428
- } finally {
1429
- set_active_effect(previous_effect);
1430
- set_active_reaction(previous_reaction);
1431
- set_component_context(previous_ctx);
1432
- }
1431
+ function increment(source) {
1432
+ set(source, source.v + 1);
1433
1433
  }
1434
1434
  /**
1435
- * Updates the pending count associated with the currently visible pending snippet,
1436
- * if any, such that we can replace the snippet with content once work is done
1437
- * @param {1 | -1} d
1438
- * @param {Batch} batch
1435
+ * @param {Value} signal
1436
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
1437
+ * @param {Effect[] | null} updated_during_traversal
1438
+ * @returns {void}
1439
1439
  */
1440
- function _update_pending_count(d, batch) {
1441
- if (!this.has_pending_snippet()) {
1442
- if (this.parent) {
1443
- var _this$parent;
1444
- _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1445
- }
1446
- return;
1447
- }
1448
- _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1449
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1450
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1451
- if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1452
- _classPrivateFieldSet2(_pending_effect, this, null);
1453
- });
1454
- if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1455
- _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1456
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1440
+ function mark_reactions(signal, status, updated_during_traversal) {
1441
+ var reactions = signal.reactions;
1442
+ if (reactions === null) return;
1443
+ var runes = is_runes();
1444
+ var length = reactions.length;
1445
+ for (var i = 0; i < length; i++) {
1446
+ var reaction = reactions[i];
1447
+ var flags = reaction.f;
1448
+ if (!runes && reaction === active_effect) continue;
1449
+ var not_dirty = (flags & DIRTY) === 0;
1450
+ if (not_dirty) set_signal_status(reaction, status);
1451
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
1452
+ else if ((flags & 2) !== 0) {
1453
+ var derived = reaction;
1454
+ batch_values?.delete(derived);
1455
+ if ((flags & 65536) === 0) {
1456
+ if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1457
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1458
+ }
1459
+ } else if (not_dirty) {
1460
+ var effect = reaction;
1461
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1462
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1463
+ else schedule_effect(effect);
1457
1464
  }
1458
1465
  }
1459
1466
  }
1460
1467
  /**
1461
- * @param {unknown} error
1468
+ * @template T
1469
+ * @param {T} value
1470
+ * @returns {T}
1462
1471
  */
1463
- function _handle_error(error) {
1464
- if (_classPrivateFieldGet2(_main_effect, this)) {
1465
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1466
- _classPrivateFieldSet2(_main_effect, this, null);
1467
- }
1468
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1469
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1470
- _classPrivateFieldSet2(_pending_effect, this, null);
1471
- }
1472
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1473
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1474
- _classPrivateFieldSet2(_failed_effect, this, null);
1475
- }
1476
- if (hydrating) {
1477
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1478
- next();
1479
- set_hydrate_node(skip_nodes());
1480
- }
1481
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1482
- let failed = _classPrivateFieldGet2(_props, this).failed;
1483
- var did_reset = false;
1484
- var calling_on_error = false;
1485
- const reset = () => {
1486
- if (did_reset) {
1487
- svelte_boundary_reset_noop();
1488
- return;
1489
- }
1490
- did_reset = true;
1491
- if (calling_on_error) svelte_boundary_reset_onerror();
1492
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1493
- _classPrivateFieldSet2(_failed_effect, this, null);
1494
- });
1495
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1496
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1497
- });
1472
+ function proxy(value) {
1473
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value || COMPONENT_SYMBOL in value) return value;
1474
+ const prototype = get_prototype_of(value);
1475
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
1476
+ /** @type {Map<any, Source<any>>} */
1477
+ var sources = /* @__PURE__ */ new Map();
1478
+ var is_proxied_array = is_array(value);
1479
+ var version = /* @__PURE__ */ state(0);
1480
+ var stack = null;
1481
+ var parent_version = update_version;
1482
+ /**
1483
+ * Executes the proxy in the context of the reaction it was originally created in, if any
1484
+ * @template T
1485
+ * @param {() => T} fn
1486
+ */
1487
+ var with_parent = (fn) => {
1488
+ if (update_version === parent_version) return fn();
1489
+ var reaction = active_reaction;
1490
+ var version = update_version;
1491
+ set_active_reaction(null);
1492
+ set_update_version(parent_version);
1493
+ var result = fn();
1494
+ set_active_reaction(reaction);
1495
+ set_update_version(version);
1496
+ return result;
1498
1497
  };
1499
- /** @param {unknown} transformed_error */
1500
- const handle_error_result = (transformed_error) => {
1501
- try {
1502
- calling_on_error = true;
1503
- onerror?.(transformed_error, reset);
1504
- calling_on_error = false;
1505
- } catch (error) {
1506
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1507
- }
1508
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1509
- try {
1510
- return branch(() => {
1511
- var effect = active_effect;
1512
- effect.b = this;
1513
- effect.f |= 128;
1514
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1498
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
1499
+ /** @type {any[]} */
1500
+ value.length,
1501
+ stack
1502
+ ));
1503
+ return new Proxy(value, {
1504
+ defineProperty(_, prop, descriptor) {
1505
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
1506
+ var s = sources.get(prop);
1507
+ if (s === void 0) with_parent(() => {
1508
+ var s = /* @__PURE__ */ state(descriptor.value, stack);
1509
+ sources.set(prop, s);
1510
+ return s;
1511
+ });
1512
+ else set(s, descriptor.value, true);
1513
+ return true;
1514
+ },
1515
+ deleteProperty(target, prop) {
1516
+ var s = sources.get(prop);
1517
+ if (s === void 0) {
1518
+ if (prop in target) {
1519
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1520
+ sources.set(prop, s);
1521
+ increment(version);
1522
+ }
1523
+ } else {
1524
+ set(s, UNINITIALIZED);
1525
+ increment(version);
1526
+ }
1527
+ return true;
1528
+ },
1529
+ get(target, prop, receiver) {
1530
+ if (prop === STATE_SYMBOL) return value;
1531
+ var s = sources.get(prop);
1532
+ var exists = prop in target;
1533
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
1534
+ s = with_parent(() => {
1535
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
1515
1536
  });
1516
- } catch (error) {
1517
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1518
- return null;
1537
+ sources.set(prop, s);
1519
1538
  }
1520
- }));
1521
- };
1522
- queue_micro_task(() => {
1523
- /** @type {unknown} */
1524
- var result;
1525
- try {
1526
- result = this.transform_error(error);
1527
- } catch (e) {
1528
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1529
- return;
1539
+ if (s !== void 0) {
1540
+ var v = get(s);
1541
+ return v === UNINITIALIZED ? void 0 : v;
1542
+ }
1543
+ return Reflect.get(target, prop, receiver);
1544
+ },
1545
+ getOwnPropertyDescriptor(target, prop) {
1546
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1547
+ if (descriptor && "value" in descriptor) {
1548
+ var s = sources.get(prop);
1549
+ if (s) descriptor.value = get(s);
1550
+ } else if (descriptor === void 0) {
1551
+ var source = sources.get(prop);
1552
+ var value = source?.v;
1553
+ if (source !== void 0 && value !== UNINITIALIZED) return {
1554
+ enumerable: true,
1555
+ configurable: true,
1556
+ value,
1557
+ writable: true
1558
+ };
1559
+ }
1560
+ return descriptor;
1561
+ },
1562
+ has(target, prop) {
1563
+ if (prop === STATE_SYMBOL) return true;
1564
+ var s = sources.get(prop);
1565
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
1566
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
1567
+ if (s === void 0) {
1568
+ s = with_parent(() => {
1569
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
1570
+ });
1571
+ sources.set(prop, s);
1572
+ }
1573
+ if (get(s) === UNINITIALIZED) return false;
1574
+ }
1575
+ return has;
1576
+ },
1577
+ set(target, prop, value, receiver) {
1578
+ var s = sources.get(prop);
1579
+ var has = prop in target;
1580
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
1581
+ var other_s = sources.get(i + "");
1582
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
1583
+ else if (i in target) {
1584
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1585
+ sources.set(i + "", other_s);
1586
+ }
1587
+ }
1588
+ if (s === void 0) {
1589
+ if (!has || get_descriptor(target, prop)?.writable) {
1590
+ s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
1591
+ set(s, proxy(value));
1592
+ sources.set(prop, s);
1593
+ }
1594
+ } else {
1595
+ has = s.v !== UNINITIALIZED;
1596
+ var p = with_parent(() => proxy(value));
1597
+ set(s, p);
1598
+ }
1599
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1600
+ if (descriptor?.set) descriptor.set.call(receiver, value);
1601
+ if (!has) {
1602
+ if (is_proxied_array && typeof prop === "string") {
1603
+ var ls = sources.get("length");
1604
+ var n = Number(prop);
1605
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
1606
+ }
1607
+ increment(version);
1608
+ }
1609
+ return true;
1610
+ },
1611
+ ownKeys(target) {
1612
+ get(version);
1613
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
1614
+ var source = sources.get(key);
1615
+ return source === void 0 || source.v !== UNINITIALIZED;
1616
+ });
1617
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
1618
+ return own_keys;
1619
+ },
1620
+ setPrototypeOf() {
1621
+ state_prototype_fixed();
1530
1622
  }
1531
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1532
- /** @type {any} */ result.then(
1533
- handle_error_result,
1534
- /** @param {unknown} e */
1535
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1536
- );
1537
- else handle_error_result(result);
1538
1623
  });
1539
1624
  }
1625
+ //#endregion
1626
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/operations.js
1627
+ /** @type {Window} */
1628
+ var $window;
1629
+ /** @type {boolean} */
1630
+ var is_firefox;
1631
+ /** @type {() => Node | null} */
1632
+ var first_child_getter;
1633
+ /** @type {() => Node | null} */
1634
+ var next_sibling_getter;
1540
1635
  /**
1541
- * @template V
1542
- * @param {() => V} fn
1543
- * @returns {Derived<V>}
1636
+ * Initialize these lazily to avoid issues when using the runtime in a server context
1637
+ * where these globals are not available while avoiding a separate server entry point
1544
1638
  */
1545
- /* @__NO_SIDE_EFFECTS__ */
1546
- function derived(fn) {
1547
- var flags = 2 | DIRTY;
1548
- if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1549
- return {
1550
- ctx: component_context,
1551
- deps: null,
1552
- effects: null,
1553
- equals,
1554
- f: flags,
1555
- fn,
1556
- reactions: null,
1557
- rv: 0,
1558
- v: UNINITIALIZED,
1559
- wv: 0,
1560
- parent: active_effect,
1561
- ac: null
1562
- };
1639
+ function init_operations() {
1640
+ if ($window !== void 0) return;
1641
+ $window = window;
1642
+ is_firefox = /Firefox/.test(navigator.userAgent);
1643
+ var element_prototype = Element.prototype;
1644
+ var node_prototype = Node.prototype;
1645
+ var text_prototype = Text.prototype;
1646
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1647
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1648
+ if (is_extensible(element_prototype)) {
1649
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
1650
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
1651
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
1652
+ element_prototype.__e = void 0;
1653
+ }
1654
+ if (is_extensible(text_prototype))
1655
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
1563
1656
  }
1564
1657
  /**
1565
- * @template V
1566
- * @param {() => V} fn
1567
- * @returns {Derived<V>}
1658
+ * @param {string} value
1659
+ * @returns {Text}
1568
1660
  */
1569
- /* @__NO_SIDE_EFFECTS__ */
1570
- function derived_safe_equal(fn) {
1571
- const signal = /* @__PURE__ */ derived(fn);
1572
- signal.equals = safe_equals;
1573
- return signal;
1661
+ function create_text(value = "") {
1662
+ return document.createTextNode(value);
1574
1663
  }
1575
1664
  /**
1576
- * @param {Derived} derived
1577
- * @returns {void}
1665
+ * @template {Node} N
1666
+ * @param {N} node
1578
1667
  */
1579
- function destroy_derived_effects(derived) {
1580
- var effects = derived.effects;
1581
- if (effects !== null) {
1582
- derived.effects = null;
1583
- for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1584
- }
1668
+ /*@__NO_SIDE_EFFECTS__*/
1669
+ function get_first_child(node) {
1670
+ return first_child_getter.call(node);
1585
1671
  }
1586
1672
  /**
1587
- * @template T
1588
- * @param {Derived} derived
1589
- * @returns {T}
1673
+ * @template {Node} N
1674
+ * @param {N} node
1590
1675
  */
1591
- function execute_derived(derived) {
1592
- var value;
1593
- var prev_active_effect = active_effect;
1594
- var parent = derived.parent;
1595
- if (!is_destroying_effect && parent !== null && (parent.f & 24576) !== 0) {
1596
- derived_inert();
1597
- return derived.v;
1598
- }
1599
- set_active_effect(parent);
1600
- try {
1601
- derived.f &= ~WAS_MARKED;
1602
- destroy_derived_effects(derived);
1603
- value = update_reaction(derived);
1604
- } finally {
1605
- set_active_effect(prev_active_effect);
1606
- }
1607
- return value;
1676
+ /*@__NO_SIDE_EFFECTS__*/
1677
+ function get_next_sibling(node) {
1678
+ return next_sibling_getter.call(node);
1608
1679
  }
1609
1680
  /**
1610
- * @param {Derived} derived
1681
+ * @template {Node} N
1682
+ * @param {N} node
1611
1683
  * @returns {void}
1612
1684
  */
1613
- function update_derived(derived) {
1614
- var value = execute_derived(derived);
1615
- if (!derived.equals(value)) {
1616
- derived.wv = increment_write_version();
1617
- if (!current_batch?.is_fork || derived.deps === null) {
1618
- if (current_batch !== null) current_batch.capture(derived, value, true);
1619
- else derived.v = value;
1620
- if (derived.deps === null) {
1621
- set_signal_status(derived, CLEAN);
1685
+ function clear_text_content(node) {
1686
+ node.textContent = "";
1687
+ }
1688
+ /**
1689
+ * Branching here is intentional and load-bearing for perf. `createElement(tag)`
1690
+ * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,
1691
+ * and passing an explicit `undefined` as the trailing options arg measurably
1692
+ * slows both APIs. Funnelling every case through a single `createElementNS(ns,
1693
+ * tag, options)` call would be smaller but slower on the HTML path.
1694
+ *
1695
+ * @template {keyof HTMLElementTagNameMap | string} T
1696
+ * @param {T} tag
1697
+ * @param {string} [namespace]
1698
+ * @param {string} [is]
1699
+ * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
1700
+ */
1701
+ function create_element(tag, namespace, is) {
1702
+ if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag);
1703
+ return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag);
1704
+ }
1705
+ /**
1706
+ * @param {unknown} error
1707
+ */
1708
+ function handle_error(error) {
1709
+ var effect = active_effect;
1710
+ if (effect === null) {
1711
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
1712
+ return error;
1713
+ }
1714
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
1715
+ invoke_error_boundary(error, effect);
1716
+ }
1717
+ /**
1718
+ * @param {unknown} error
1719
+ * @param {Effect | null} effect
1720
+ */
1721
+ function invoke_error_boundary(error, effect) {
1722
+ if (effect !== null && (effect.f & 16384) !== 0) return;
1723
+ while (effect !== null) {
1724
+ if ((effect.f & 128) !== 0 && (effect.f & 33570816) === 0) {
1725
+ if ((effect.f & 32768) === 0) throw error;
1726
+ try {
1727
+ /** @type {Boundary} */ effect.b.error(error);
1622
1728
  return;
1729
+ } catch (e) {
1730
+ error = e;
1623
1731
  }
1624
1732
  }
1733
+ effect = effect.parent;
1625
1734
  }
1626
- if (is_destroying_effect) return;
1627
- if (batch_values !== null) {
1628
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1629
- } else update_derived_status(derived);
1735
+ throw error;
1630
1736
  }
1737
+ //#endregion
1738
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/effects.js
1739
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
1631
1740
  /**
1632
- * @param {Derived} derived
1741
+ * @param {Effect} effect
1742
+ * @param {Effect} parent_effect
1633
1743
  */
1634
- function freeze_derived_effects(derived) {
1635
- if (derived.effects === null) return;
1636
- for (const e of derived.effects) if (e.teardown || e.ac) {
1637
- e.teardown?.();
1638
- e.ac?.abort(STALE_REACTION);
1639
- e.teardown = noop;
1640
- e.ac = null;
1641
- remove_reactions(e, 0);
1642
- destroy_effect_children(e);
1744
+ function push_effect(effect, parent_effect) {
1745
+ var parent_last = parent_effect.last;
1746
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
1747
+ else {
1748
+ parent_last.next = effect;
1749
+ effect.prev = parent_last;
1750
+ parent_effect.last = effect;
1643
1751
  }
1644
1752
  }
1645
1753
  /**
1646
- * @param {Derived} derived
1754
+ * @param {number} type
1755
+ * @param {null | (() => void | (() => void))} fn
1756
+ * @returns {Effect}
1647
1757
  */
1648
- function unfreeze_derived_effects(derived) {
1649
- if (derived.effects === null) return;
1650
- for (const e of derived.effects) if (e.teardown) update_effect(e);
1758
+ function create_effect(type, fn) {
1759
+ var parent = active_effect;
1760
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
1761
+ /** @type {Effect} */
1762
+ var effect = {
1763
+ ctx: component_context,
1764
+ deps: null,
1765
+ nodes: null,
1766
+ f: type | DIRTY | 512,
1767
+ first: null,
1768
+ fn,
1769
+ last: null,
1770
+ next: null,
1771
+ parent,
1772
+ b: parent && parent.b,
1773
+ prev: null,
1774
+ teardown: null,
1775
+ wv: 0,
1776
+ ac: null
1777
+ };
1778
+ current_batch?.register_created_effect(effect);
1779
+ /** @type {Effect | null} */
1780
+ var e = effect;
1781
+ if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
1782
+ else Batch.ensure().schedule(effect);
1783
+ else if (fn !== null) {
1784
+ try {
1785
+ update_effect(effect);
1786
+ } catch (e) {
1787
+ destroy_effect(effect);
1788
+ throw e;
1789
+ }
1790
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
1791
+ e = e.first;
1792
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
1793
+ }
1794
+ }
1795
+ if (e !== null) {
1796
+ e.parent = parent;
1797
+ if (parent !== null) push_effect(e, parent);
1798
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
1799
+ var derived = active_reaction;
1800
+ (derived.effects ?? (derived.effects = [])).push(e);
1801
+ }
1802
+ }
1803
+ return effect;
1651
1804
  }
1652
- //#endregion
1653
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/sources.js
1654
- /** @import { Derived, Effect, Source, Value } from '#client' */
1655
- /** @type {Set<any>} */
1656
- var eager_effects = /* @__PURE__ */ new Set();
1657
- /** @type {Map<Source, any>} */
1658
- var old_values = /* @__PURE__ */ new Map();
1659
- var eager_effects_deferred = false;
1660
1805
  /**
1661
- * @template V
1662
- * @param {V} v
1663
- * @param {Error | null} [stack]
1664
- * @returns {Source<V>}
1806
+ * Internal representation of `$effect.tracking()`
1807
+ * @returns {boolean}
1665
1808
  */
1666
- function source(v, stack) {
1667
- return {
1668
- f: 0,
1669
- v,
1670
- reactions: null,
1671
- equals,
1672
- rv: 0,
1673
- wv: 0
1674
- };
1809
+ function effect_tracking() {
1810
+ return active_reaction !== null && !untracking;
1675
1811
  }
1676
1812
  /**
1677
- * @template V
1678
- * @param {V} v
1679
- * @param {Error | null} [stack]
1813
+ * @param {() => void | (() => void)} fn
1680
1814
  */
1681
- /* @__NO_SIDE_EFFECTS__ */
1682
- function state(v, stack) {
1683
- const s = source(v, stack);
1684
- push_reaction_value(s);
1685
- return s;
1815
+ function create_user_effect(fn) {
1816
+ return create_effect(4 | USER_EFFECT, fn);
1686
1817
  }
1687
1818
  /**
1688
- * @template V
1689
- * @param {V} initial_value
1690
- * @param {boolean} [immutable]
1691
- * @returns {Source<V>}
1819
+ * Internal representation of `$effect.root(...)`
1820
+ * @param {() => void | (() => void)} fn
1821
+ * @returns {() => void}
1692
1822
  */
1693
- /* @__NO_SIDE_EFFECTS__ */
1694
- function mutable_source(initial_value, immutable = false, trackable = true) {
1695
- const s = source(initial_value);
1696
- if (!immutable) s.equals = safe_equals;
1697
- if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
1698
- var _component_context$l;
1699
- ((_component_context$l = component_context.l).s ?? (_component_context$l.s = [])).push(s);
1700
- }
1701
- return s;
1823
+ function effect_root(fn) {
1824
+ Batch.ensure();
1825
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
1826
+ return () => {
1827
+ destroy_effect(effect);
1828
+ };
1702
1829
  }
1703
1830
  /**
1704
- * @template V
1705
- * @param {Source<V>} source
1706
- * @param {V} value
1707
- * @param {boolean} [should_proxy]
1708
- * @returns {V}
1831
+ * An effect root whose children can transition out
1832
+ * @param {() => void} fn
1833
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
1709
1834
  */
1710
- function set(source, value, should_proxy = false) {
1711
- if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
1712
- return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1835
+ function component_root(fn) {
1836
+ Batch.ensure();
1837
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
1838
+ return (options = {}) => {
1839
+ return new Promise((fulfil) => {
1840
+ if (options.outro) pause_effect(effect, () => {
1841
+ destroy_effect(effect);
1842
+ fulfil(void 0);
1843
+ });
1844
+ else {
1845
+ destroy_effect(effect);
1846
+ fulfil(void 0);
1847
+ }
1848
+ });
1849
+ };
1713
1850
  }
1714
1851
  /**
1715
- * @template V
1716
- * @param {Source<V>} source
1717
- * @param {V} value
1718
- * @param {Effect[] | null} [updated_during_traversal]
1719
- * @returns {V}
1852
+ * @param {() => void | (() => void)} fn
1853
+ * @returns {Effect}
1720
1854
  */
1721
- function internal_set(source, value, updated_during_traversal = null) {
1722
- if (!source.equals(value)) {
1723
- old_values.set(source, is_destroying_effect ? value : source.v);
1724
- var batch = Batch.ensure();
1725
- batch.capture(source, value);
1726
- if ((source.f & 2) !== 0) {
1727
- const derived = source;
1728
- if ((source.f & 2048) !== 0) execute_derived(derived);
1729
- if (batch_values === null) update_derived_status(derived);
1730
- }
1731
- source.wv = increment_write_version();
1732
- mark_reactions(source, DIRTY, updated_during_traversal);
1733
- if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
1734
- else untracked_writes.push(source);
1735
- if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1736
- }
1737
- return value;
1738
- }
1739
- function flush_eager_effects() {
1740
- eager_effects_deferred = false;
1741
- for (const effect of eager_effects) {
1742
- if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1743
- if (is_dirty(effect)) update_effect(effect);
1744
- }
1745
- eager_effects.clear();
1855
+ function effect(fn) {
1856
+ return create_effect(4, fn);
1746
1857
  }
1747
1858
  /**
1748
- * Silently (without using `get`) increment a source
1749
- * @param {Source<number>} source
1859
+ * @param {() => void | (() => void)} fn
1860
+ * @returns {Effect}
1750
1861
  */
1751
- function increment(source) {
1752
- set(source, source.v + 1);
1862
+ function render_effect(fn, flags = 0) {
1863
+ return create_effect(8 | flags, fn);
1753
1864
  }
1754
1865
  /**
1755
- * @param {Value} signal
1756
- * @param {number} status should be DIRTY or MAYBE_DIRTY
1757
- * @param {Effect[] | null} updated_during_traversal
1758
- * @returns {void}
1866
+ * @param {(() => void)} fn
1867
+ * @param {number} flags
1759
1868
  */
1760
- function mark_reactions(signal, status, updated_during_traversal) {
1761
- var reactions = signal.reactions;
1762
- if (reactions === null) return;
1763
- var runes = is_runes();
1764
- var length = reactions.length;
1765
- for (var i = 0; i < length; i++) {
1766
- var reaction = reactions[i];
1767
- var flags = reaction.f;
1768
- if (!runes && reaction === active_effect) continue;
1769
- var not_dirty = (flags & DIRTY) === 0;
1770
- if (not_dirty) set_signal_status(reaction, status);
1771
- if ((flags & 2) !== 0) {
1772
- var derived = reaction;
1773
- batch_values?.delete(derived);
1774
- if ((flags & 65536) === 0) {
1775
- if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1776
- mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1777
- }
1778
- } else if (not_dirty) {
1779
- var effect = reaction;
1780
- if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1781
- if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1782
- else schedule_effect(effect);
1783
- }
1784
- }
1869
+ function block(fn, flags = 0) {
1870
+ return create_effect(16 | flags, fn);
1785
1871
  }
1786
1872
  /**
1787
- * @template T
1788
- * @param {T} value
1789
- * @returns {T}
1873
+ * @param {(() => void)} fn
1790
1874
  */
1791
- function proxy(value) {
1792
- if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
1793
- const prototype = get_prototype_of(value);
1794
- if (prototype !== object_prototype && prototype !== array_prototype) return value;
1795
- /** @type {Map<any, Source<any>>} */
1796
- var sources = /* @__PURE__ */ new Map();
1797
- var is_proxied_array = is_array(value);
1798
- var version = /* @__PURE__ */ state(0);
1799
- var stack = null;
1800
- var parent_version = update_version;
1801
- /**
1802
- * Executes the proxy in the context of the reaction it was originally created in, if any
1803
- * @template T
1804
- * @param {() => T} fn
1805
- */
1806
- var with_parent = (fn) => {
1807
- if (update_version === parent_version) return fn();
1808
- var reaction = active_reaction;
1809
- var version = update_version;
1875
+ function branch(fn) {
1876
+ return create_effect(32 | EFFECT_PRESERVED, fn);
1877
+ }
1878
+ /**
1879
+ * @param {Effect} effect
1880
+ */
1881
+ function execute_effect_teardown(effect) {
1882
+ var teardown = effect.teardown;
1883
+ if (teardown !== null) {
1884
+ const previously_destroying_effect = is_destroying_effect;
1885
+ const previous_reaction = active_reaction;
1886
+ set_is_destroying_effect(true);
1810
1887
  set_active_reaction(null);
1811
- set_update_version(parent_version);
1812
- var result = fn();
1813
- set_active_reaction(reaction);
1814
- set_update_version(version);
1815
- return result;
1816
- };
1817
- if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
1818
- /** @type {any[]} */
1819
- value.length,
1820
- stack
1821
- ));
1822
- return new Proxy(value, {
1823
- defineProperty(_, prop, descriptor) {
1824
- if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
1825
- var s = sources.get(prop);
1826
- if (s === void 0) with_parent(() => {
1827
- var s = /* @__PURE__ */ state(descriptor.value, stack);
1828
- sources.set(prop, s);
1829
- return s;
1830
- });
1831
- else set(s, descriptor.value, true);
1832
- return true;
1833
- },
1834
- deleteProperty(target, prop) {
1835
- var s = sources.get(prop);
1836
- if (s === void 0) {
1837
- if (prop in target) {
1838
- const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1839
- sources.set(prop, s);
1840
- increment(version);
1841
- }
1842
- } else {
1843
- set(s, UNINITIALIZED);
1844
- increment(version);
1845
- }
1846
- return true;
1847
- },
1848
- get(target, prop, receiver) {
1849
- if (prop === STATE_SYMBOL) return value;
1850
- var s = sources.get(prop);
1851
- var exists = prop in target;
1852
- if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
1853
- s = with_parent(() => {
1854
- return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
1855
- });
1856
- sources.set(prop, s);
1857
- }
1858
- if (s !== void 0) {
1859
- var v = get(s);
1860
- return v === UNINITIALIZED ? void 0 : v;
1861
- }
1862
- return Reflect.get(target, prop, receiver);
1863
- },
1864
- getOwnPropertyDescriptor(target, prop) {
1865
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1866
- if (descriptor && "value" in descriptor) {
1867
- var s = sources.get(prop);
1868
- if (s) descriptor.value = get(s);
1869
- } else if (descriptor === void 0) {
1870
- var source = sources.get(prop);
1871
- var value = source?.v;
1872
- if (source !== void 0 && value !== UNINITIALIZED) return {
1873
- enumerable: true,
1874
- configurable: true,
1875
- value,
1876
- writable: true
1877
- };
1878
- }
1879
- return descriptor;
1880
- },
1881
- has(target, prop) {
1882
- if (prop === STATE_SYMBOL) return true;
1883
- var s = sources.get(prop);
1884
- var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
1885
- if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
1886
- if (s === void 0) {
1887
- s = with_parent(() => {
1888
- return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
1889
- });
1890
- sources.set(prop, s);
1891
- }
1892
- if (get(s) === UNINITIALIZED) return false;
1893
- }
1894
- return has;
1895
- },
1896
- set(target, prop, value, receiver) {
1897
- var s = sources.get(prop);
1898
- var has = prop in target;
1899
- if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
1900
- var other_s = sources.get(i + "");
1901
- if (other_s !== void 0) set(other_s, UNINITIALIZED);
1902
- else if (i in target) {
1903
- other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1904
- sources.set(i + "", other_s);
1905
- }
1906
- }
1907
- if (s === void 0) {
1908
- if (!has || get_descriptor(target, prop)?.writable) {
1909
- s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
1910
- set(s, proxy(value));
1911
- sources.set(prop, s);
1912
- }
1913
- } else {
1914
- has = s.v !== UNINITIALIZED;
1915
- var p = with_parent(() => proxy(value));
1916
- set(s, p);
1917
- }
1918
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1919
- if (descriptor?.set) descriptor.set.call(receiver, value);
1920
- if (!has) {
1921
- if (is_proxied_array && typeof prop === "string") {
1922
- var ls = sources.get("length");
1923
- var n = Number(prop);
1924
- if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
1925
- }
1926
- increment(version);
1927
- }
1928
- return true;
1929
- },
1930
- ownKeys(target) {
1931
- get(version);
1932
- var own_keys = Reflect.ownKeys(target).filter((key) => {
1933
- var source = sources.get(key);
1934
- return source === void 0 || source.v !== UNINITIALIZED;
1935
- });
1936
- for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
1937
- return own_keys;
1938
- },
1939
- setPrototypeOf() {
1940
- state_prototype_fixed();
1888
+ try {
1889
+ teardown.call(null);
1890
+ } catch (error) {
1891
+ invoke_error_boundary(error, effect.parent);
1892
+ } finally {
1893
+ set_is_destroying_effect(previously_destroying_effect);
1894
+ set_active_reaction(previous_reaction);
1941
1895
  }
1942
- });
1896
+ }
1943
1897
  }
1944
- //#endregion
1945
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/operations.js
1946
- /** @type {Window} */
1947
- var $window;
1948
- /** @type {boolean} */
1949
- var is_firefox;
1950
- /** @type {() => Node | null} */
1951
- var first_child_getter;
1952
- /** @type {() => Node | null} */
1953
- var next_sibling_getter;
1954
1898
  /**
1955
- * Initialize these lazily to avoid issues when using the runtime in a server context
1956
- * where these globals are not available while avoiding a separate server entry point
1899
+ * @param {Effect} signal
1900
+ * @param {boolean} remove_dom
1901
+ * @returns {void}
1957
1902
  */
1958
- function init_operations() {
1959
- if ($window !== void 0) return;
1960
- $window = window;
1961
- is_firefox = /Firefox/.test(navigator.userAgent);
1962
- var element_prototype = Element.prototype;
1963
- var node_prototype = Node.prototype;
1964
- var text_prototype = Text.prototype;
1965
- first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1966
- next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1967
- if (is_extensible(element_prototype)) {
1968
- element_prototype.__click = void 0;
1969
- element_prototype.__className = void 0;
1970
- element_prototype.__attributes = null;
1971
- element_prototype.__style = void 0;
1972
- element_prototype.__e = void 0;
1903
+ function destroy_effect_children(signal, remove_dom = false) {
1904
+ var effect = signal.first;
1905
+ signal.first = signal.last = null;
1906
+ while (effect !== null) {
1907
+ const controller = effect.ac;
1908
+ if (controller !== null) without_reactive_context(() => {
1909
+ controller.abort(STALE_REACTION);
1910
+ });
1911
+ var next = effect.next;
1912
+ if ((effect.f & 64) !== 0) effect.parent = null;
1913
+ else destroy_effect(effect, remove_dom);
1914
+ effect = next;
1973
1915
  }
1974
- if (is_extensible(text_prototype)) text_prototype.__t = void 0;
1975
1916
  }
1976
1917
  /**
1977
- * @param {string} value
1978
- * @returns {Text}
1918
+ * @param {Effect} signal
1919
+ * @returns {void}
1979
1920
  */
1980
- function create_text(value = "") {
1981
- return document.createTextNode(value);
1982
- }
1983
- /**
1984
- * @template {Node} N
1985
- * @param {N} node
1986
- */
1987
- /* @__NO_SIDE_EFFECTS__ */
1988
- function get_first_child(node) {
1989
- return first_child_getter.call(node);
1990
- }
1991
- /**
1992
- * @template {Node} N
1993
- * @param {N} node
1994
- */
1995
- /* @__NO_SIDE_EFFECTS__ */
1996
- function get_next_sibling(node) {
1997
- return next_sibling_getter.call(node);
1998
- }
1999
- /**
2000
- * @template {Node} N
2001
- * @param {N} node
2002
- * @returns {void}
2003
- */
2004
- function clear_text_content(node) {
2005
- node.textContent = "";
2006
- }
2007
- /**
2008
- * @template {keyof HTMLElementTagNameMap | string} T
2009
- * @param {T} tag
2010
- * @param {string} [namespace]
2011
- * @param {string} [is]
2012
- * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2013
- */
2014
- function create_element(tag, namespace, is) {
2015
- let options = is ? { is } : void 0;
2016
- return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2017
- }
2018
- //#endregion
2019
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2020
- /**
2021
- * @template T
2022
- * @param {() => T} fn
2023
- */
2024
- function without_reactive_context(fn) {
2025
- var previous_reaction = active_reaction;
2026
- var previous_effect = active_effect;
2027
- set_active_reaction(null);
2028
- set_active_effect(null);
2029
- try {
2030
- return fn();
2031
- } finally {
2032
- set_active_reaction(previous_reaction);
2033
- set_active_effect(previous_effect);
2034
- }
2035
- }
2036
- //#endregion
2037
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/effects.js
2038
- /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2039
- /**
2040
- * @param {Effect} effect
2041
- * @param {Effect} parent_effect
2042
- */
2043
- function push_effect(effect, parent_effect) {
2044
- var parent_last = parent_effect.last;
2045
- if (parent_last === null) parent_effect.last = parent_effect.first = effect;
2046
- else {
2047
- parent_last.next = effect;
2048
- effect.prev = parent_last;
2049
- parent_effect.last = effect;
2050
- }
2051
- }
2052
- /**
2053
- * @param {number} type
2054
- * @param {null | (() => void | (() => void))} fn
2055
- * @returns {Effect}
2056
- */
2057
- function create_effect(type, fn) {
2058
- var parent = active_effect;
2059
- if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
2060
- /** @type {Effect} */
2061
- var effect = {
2062
- ctx: component_context,
2063
- deps: null,
2064
- nodes: null,
2065
- f: type | DIRTY | 512,
2066
- first: null,
2067
- fn,
2068
- last: null,
2069
- next: null,
2070
- parent,
2071
- b: parent && parent.b,
2072
- prev: null,
2073
- teardown: null,
2074
- wv: 0,
2075
- ac: null
2076
- };
2077
- current_batch?.register_created_effect(effect);
2078
- /** @type {Effect | null} */
2079
- var e = effect;
2080
- if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
2081
- else Batch.ensure().schedule(effect);
2082
- else if (fn !== null) {
2083
- try {
2084
- update_effect(effect);
2085
- } catch (e) {
2086
- destroy_effect(effect);
2087
- throw e;
2088
- }
2089
- if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
2090
- e = e.first;
2091
- if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
2092
- }
2093
- }
2094
- if (e !== null) {
2095
- e.parent = parent;
2096
- if (parent !== null) push_effect(e, parent);
2097
- if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
2098
- var derived = active_reaction;
2099
- (derived.effects ?? (derived.effects = [])).push(e);
2100
- }
2101
- }
2102
- return effect;
2103
- }
2104
- /**
2105
- * Internal representation of `$effect.tracking()`
2106
- * @returns {boolean}
2107
- */
2108
- function effect_tracking() {
2109
- return active_reaction !== null && !untracking;
2110
- }
2111
- /**
2112
- * @param {() => void | (() => void)} fn
2113
- */
2114
- function create_user_effect(fn) {
2115
- return create_effect(4 | USER_EFFECT, fn);
2116
- }
2117
- /**
2118
- * Internal representation of `$effect.root(...)`
2119
- * @param {() => void | (() => void)} fn
2120
- * @returns {() => void}
2121
- */
2122
- function effect_root(fn) {
2123
- Batch.ensure();
2124
- const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2125
- return () => {
2126
- destroy_effect(effect);
2127
- };
2128
- }
2129
- /**
2130
- * An effect root whose children can transition out
2131
- * @param {() => void} fn
2132
- * @returns {(options?: { outro?: boolean }) => Promise<void>}
2133
- */
2134
- function component_root(fn) {
2135
- Batch.ensure();
2136
- const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2137
- return (options = {}) => {
2138
- return new Promise((fulfil) => {
2139
- if (options.outro) pause_effect(effect, () => {
2140
- destroy_effect(effect);
2141
- fulfil(void 0);
2142
- });
2143
- else {
2144
- destroy_effect(effect);
2145
- fulfil(void 0);
2146
- }
2147
- });
2148
- };
2149
- }
2150
- /**
2151
- * @param {() => void | (() => void)} fn
2152
- * @returns {Effect}
2153
- */
2154
- function effect(fn) {
2155
- return create_effect(4, fn);
2156
- }
2157
- /**
2158
- * @param {() => void | (() => void)} fn
2159
- * @returns {Effect}
2160
- */
2161
- function render_effect(fn, flags = 0) {
2162
- return create_effect(8 | flags, fn);
2163
- }
2164
- /**
2165
- * @param {(() => void)} fn
2166
- * @param {number} flags
2167
- */
2168
- function block(fn, flags = 0) {
2169
- return create_effect(16 | flags, fn);
2170
- }
2171
- /**
2172
- * @param {(() => void)} fn
2173
- */
2174
- function branch(fn) {
2175
- return create_effect(32 | EFFECT_PRESERVED, fn);
2176
- }
2177
- /**
2178
- * @param {Effect} effect
2179
- */
2180
- function execute_effect_teardown(effect) {
2181
- var teardown = effect.teardown;
2182
- if (teardown !== null) {
2183
- const previously_destroying_effect = is_destroying_effect;
2184
- const previous_reaction = active_reaction;
2185
- set_is_destroying_effect(true);
2186
- set_active_reaction(null);
2187
- try {
2188
- teardown.call(null);
2189
- } finally {
2190
- set_is_destroying_effect(previously_destroying_effect);
2191
- set_active_reaction(previous_reaction);
2192
- }
2193
- }
2194
- }
2195
- /**
2196
- * @param {Effect} signal
2197
- * @param {boolean} remove_dom
2198
- * @returns {void}
2199
- */
2200
- function destroy_effect_children(signal, remove_dom = false) {
2201
- var effect = signal.first;
2202
- signal.first = signal.last = null;
2203
- while (effect !== null) {
2204
- const controller = effect.ac;
2205
- if (controller !== null) without_reactive_context(() => {
2206
- controller.abort(STALE_REACTION);
2207
- });
2208
- var next = effect.next;
2209
- if ((effect.f & 64) !== 0) effect.parent = null;
2210
- else destroy_effect(effect, remove_dom);
2211
- effect = next;
2212
- }
2213
- }
2214
- /**
2215
- * @param {Effect} signal
2216
- * @returns {void}
2217
- */
2218
- function destroy_block_effect_children(signal) {
2219
- var effect = signal.first;
2220
- while (effect !== null) {
2221
- var next = effect.next;
2222
- if ((effect.f & 32) === 0) destroy_effect(effect);
2223
- effect = next;
2224
- }
1921
+ function destroy_block_effect_children(signal) {
1922
+ var effect = signal.first;
1923
+ while (effect !== null) {
1924
+ var next = effect.next;
1925
+ if ((effect.f & 32) === 0) destroy_effect(effect);
1926
+ effect = next;
1927
+ }
2225
1928
  }
2226
1929
  /**
2227
1930
  * @param {Effect} effect
@@ -2234,7 +1937,7 @@ function destroy_effect(effect, remove_dom = true) {
2234
1937
  remove_effect_dom(effect.nodes.start, effect.nodes.end);
2235
1938
  removed = true;
2236
1939
  }
2237
- set_signal_status(effect, DESTROYING);
1940
+ effect.f |= DESTROYING;
2238
1941
  destroy_effect_children(effect, remove_dom && !removed);
2239
1942
  remove_reactions(effect, 0);
2240
1943
  var transitions = effect.nodes && effect.nodes.t;
@@ -2288,6 +1991,7 @@ function unlink_effect(effect) {
2288
1991
  function pause_effect(effect, callback, destroy = true) {
2289
1992
  /** @type {TransitionManager[]} */
2290
1993
  var transitions = [];
1994
+ effect.f |= 256;
2291
1995
  pause_children(effect, transitions, true);
2292
1996
  var fn = () => {
2293
1997
  if (destroy) destroy_effect(effect);
@@ -2338,15 +2042,18 @@ function move_effect(effect, fragment) {
2338
2042
  }
2339
2043
  }
2340
2044
  //#endregion
2341
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/legacy.js
2045
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/legacy.js
2342
2046
  /**
2343
2047
  * @type {Set<Value> | null}
2344
2048
  * @deprecated
2345
2049
  */
2346
2050
  var captured_signals = null;
2347
2051
  //#endregion
2348
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/runtime.js
2052
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
2349
2053
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2054
+ /**
2055
+ * True if updating in an effect context that is reactive (i.e. not branch/root effects)
2056
+ */
2350
2057
  var is_updating_effect = false;
2351
2058
  var is_destroying_effect = false;
2352
2059
  /** @param {boolean} value */
@@ -2369,13 +2076,12 @@ function set_active_effect(effect) {
2369
2076
  /**
2370
2077
  * When sources are created within a reaction, reading and writing
2371
2078
  * them within that reaction should not cause a re-run
2372
- * @type {null | Source[]}
2079
+ * @type {null | Set<Source>}
2373
2080
  */
2374
2081
  var current_sources = null;
2375
2082
  /** @param {Value} value */
2376
2083
  function push_reaction_value(value) {
2377
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2378
- else current_sources.push(value);
2084
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2379
2085
  }
2380
2086
  /**
2381
2087
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2400,7 +2106,7 @@ function set_untracked_writes(value) {
2400
2106
  * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
2401
2107
  **/
2402
2108
  var write_version = 1;
2403
- /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
2109
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */
2404
2110
  var read_version = 0;
2405
2111
  var update_version = read_version;
2406
2112
  /** @param {number} value */
@@ -2440,7 +2146,7 @@ function is_dirty(reaction) {
2440
2146
  function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2441
2147
  var reactions = signal.reactions;
2442
2148
  if (reactions === null) return;
2443
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2149
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
2444
2150
  for (var i = 0; i < reactions.length; i++) {
2445
2151
  var reaction = reactions[i];
2446
2152
  if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
@@ -2481,24 +2187,8 @@ function update_reaction(reaction) {
2481
2187
  var fn = reaction.fn;
2482
2188
  var result = fn();
2483
2189
  reaction.f |= REACTION_RAN;
2484
- var deps = reaction.deps;
2485
- var is_fork = current_batch?.is_fork;
2486
- if (new_deps !== null) {
2487
- var i;
2488
- if (!is_fork) remove_reactions(reaction, skipped_deps);
2489
- if (deps !== null && skipped_deps > 0) {
2490
- deps.length = skipped_deps + new_deps.length;
2491
- for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2492
- } else reaction.deps = deps = new_deps;
2493
- if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2494
- var _deps$i;
2495
- ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2496
- }
2497
- } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2498
- remove_reactions(reaction, skipped_deps);
2499
- deps.length = skipped_deps;
2500
- }
2501
- if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2190
+ var deps = update_dependencies(reaction);
2191
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (var i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2502
2192
  if (previous_reaction !== null && previous_reaction !== reaction) {
2503
2193
  read_version++;
2504
2194
  if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
@@ -2509,6 +2199,7 @@ function update_reaction(reaction) {
2509
2199
  if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2510
2200
  return result;
2511
2201
  } catch (error) {
2202
+ update_dependencies(reaction);
2512
2203
  return handle_error(error);
2513
2204
  } finally {
2514
2205
  reaction.f ^= REACTION_IS_UPDATING;
@@ -2523,6 +2214,29 @@ function update_reaction(reaction) {
2523
2214
  }
2524
2215
  }
2525
2216
  /**
2217
+ * @param {Reaction} reaction
2218
+ */
2219
+ function update_dependencies(reaction) {
2220
+ var deps = reaction.deps;
2221
+ var is_fork = current_batch?.is_fork;
2222
+ if (new_deps !== null) {
2223
+ var i;
2224
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2225
+ if (deps !== null && skipped_deps > 0) {
2226
+ deps.length = skipped_deps + new_deps.length;
2227
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2228
+ } else reaction.deps = deps = new_deps;
2229
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2230
+ var _deps$i;
2231
+ ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2232
+ }
2233
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2234
+ remove_reactions(reaction, skipped_deps);
2235
+ deps.length = skipped_deps;
2236
+ }
2237
+ return deps;
2238
+ }
2239
+ /**
2526
2240
  * @template V
2527
2241
  * @param {Reaction} signal
2528
2242
  * @param {Value<V>} dependency
@@ -2541,338 +2255,808 @@ function remove_reaction(signal, dependency) {
2541
2255
  }
2542
2256
  }
2543
2257
  }
2544
- if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2545
- var derived = dependency;
2546
- if ((derived.f & 512) !== 0) {
2547
- derived.f ^= 512;
2548
- derived.f &= ~WAS_MARKED;
2549
- }
2550
- if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2551
- freeze_derived_effects(derived);
2552
- remove_reactions(derived, 0);
2258
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2259
+ var derived = dependency;
2260
+ if ((derived.f & 512) !== 0) {
2261
+ derived.f ^= 512;
2262
+ derived.f &= ~WAS_MARKED;
2263
+ }
2264
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2265
+ if (derived.ac !== null) without_reactive_context(() => {
2266
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
2267
+ derived.ac = null;
2268
+ set_signal_status(derived, DIRTY);
2269
+ });
2270
+ freeze_derived_effects(derived);
2271
+ remove_reactions(derived, 0);
2272
+ }
2273
+ }
2274
+ /**
2275
+ * @param {Reaction} signal
2276
+ * @param {number} start_index
2277
+ * @returns {void}
2278
+ */
2279
+ function remove_reactions(signal, start_index) {
2280
+ var dependencies = signal.deps;
2281
+ if (dependencies === null) return;
2282
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2283
+ }
2284
+ /**
2285
+ * @param {Effect} effect
2286
+ * @returns {void}
2287
+ */
2288
+ function update_effect(effect) {
2289
+ var flags = effect.f;
2290
+ if ((flags & 16384) !== 0) return;
2291
+ set_signal_status(effect, CLEAN);
2292
+ var previous_effect = active_effect;
2293
+ var was_updating_effect = is_updating_effect;
2294
+ active_effect = effect;
2295
+ is_updating_effect = (flags & 96) === 0;
2296
+ try {
2297
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2298
+ else destroy_effect_children(effect);
2299
+ execute_effect_teardown(effect);
2300
+ var teardown = update_reaction(effect);
2301
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2302
+ effect.wv = write_version;
2303
+ } finally {
2304
+ is_updating_effect = was_updating_effect;
2305
+ active_effect = previous_effect;
2306
+ }
2307
+ }
2308
+ /**
2309
+ * @template V
2310
+ * @param {Value<V>} signal
2311
+ * @returns {V}
2312
+ */
2313
+ function get(signal) {
2314
+ var is_derived = (signal.f & 2) !== 0;
2315
+ captured_signals?.add(signal);
2316
+ if (active_reaction !== null && !untracking) {
2317
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2318
+ var deps = active_reaction.deps;
2319
+ if ((active_reaction.f & 2097152) !== 0) {
2320
+ if (signal.rv < read_version) {
2321
+ signal.rv = read_version;
2322
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2323
+ else if (new_deps === null) new_deps = [signal];
2324
+ else new_deps.push(signal);
2325
+ }
2326
+ } else {
2327
+ var _active_reaction;
2328
+ (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
2329
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2330
+ var reactions = signal.reactions;
2331
+ if (reactions === null) signal.reactions = [active_reaction];
2332
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2333
+ }
2334
+ }
2335
+ }
2336
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2337
+ if (is_derived) {
2338
+ var derived = signal;
2339
+ if (is_destroying_effect) {
2340
+ var value = derived.v;
2341
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2342
+ old_values.set(derived, value);
2343
+ return value;
2344
+ }
2345
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
2346
+ var is_new = (derived.f & REACTION_RAN) === 0;
2347
+ if (is_dirty(derived)) {
2348
+ if (should_connect) derived.f |= 512;
2349
+ update_derived(derived);
2350
+ }
2351
+ if (should_connect && !is_new) {
2352
+ unfreeze_derived_effects(derived);
2353
+ reconnect(derived);
2354
+ }
2355
+ }
2356
+ if (batch_values?.has(signal)) return batch_values.get(signal);
2357
+ if ((signal.f & 8388608) !== 0) throw signal.v;
2358
+ return signal.v;
2359
+ }
2360
+ /**
2361
+ * (Re)connect a disconnected derived, so that it is notified
2362
+ * of changes in `mark_reactions`
2363
+ * @param {Derived} derived
2364
+ */
2365
+ function reconnect(derived) {
2366
+ derived.f |= 512;
2367
+ if (derived.deps === null) return;
2368
+ for (const dep of derived.deps) {
2369
+ (dep.reactions ?? (dep.reactions = [])).push(derived);
2370
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2371
+ unfreeze_derived_effects(dep);
2372
+ reconnect(dep);
2373
+ }
2374
+ }
2375
+ }
2376
+ /** @param {Derived} derived */
2377
+ function depends_on_old_values(derived) {
2378
+ if (derived.v === UNINITIALIZED) return true;
2379
+ if (derived.deps === null) return false;
2380
+ for (const dep of derived.deps) {
2381
+ if (old_values.has(dep)) return true;
2382
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2383
+ }
2384
+ return false;
2385
+ }
2386
+ /**
2387
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2388
+ * any state read inside `fn` will not be treated as a dependency.
2389
+ *
2390
+ * ```ts
2391
+ * $effect(() => {
2392
+ * // this will run when `data` changes, but not when `time` changes
2393
+ * save(data, {
2394
+ * timestamp: untrack(() => time)
2395
+ * });
2396
+ * });
2397
+ * ```
2398
+ * @template T
2399
+ * @param {() => T} fn
2400
+ * @returns {T}
2401
+ */
2402
+ function untrack(fn) {
2403
+ var previous_untracking = untracking;
2404
+ try {
2405
+ untracking = true;
2406
+ return fn();
2407
+ } finally {
2408
+ untracking = previous_untracking;
2409
+ }
2410
+ }
2411
+ //#endregion
2412
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/events.js
2413
+ /**
2414
+ * Used on elements, as a map of event type -> event handler,
2415
+ * and on events themselves to track which element handled an event
2416
+ */
2417
+ var event_symbol = Symbol("events");
2418
+ /** @type {Set<string>} */
2419
+ var all_registered_events = /* @__PURE__ */ new Set();
2420
+ /** @type {Set<(events: Array<string>) => void>} */
2421
+ var root_event_handles = /* @__PURE__ */ new Set();
2422
+ var last_propagated_event = null;
2423
+ var last_propagated_event_clear_scheduled = false;
2424
+ /**
2425
+ * @this {EventTarget}
2426
+ * @param {Event} event
2427
+ * @returns {void}
2428
+ */
2429
+ function handle_event_propagation(event) {
2430
+ var handler_element = this;
2431
+ var owner_document = handler_element.ownerDocument;
2432
+ var event_name = event.type;
2433
+ var path = event.composedPath?.() || [];
2434
+ var current_target = path[0] || event.target;
2435
+ last_propagated_event = event;
2436
+ if (!last_propagated_event_clear_scheduled) {
2437
+ last_propagated_event_clear_scheduled = true;
2438
+ setTimeout(() => {
2439
+ last_propagated_event_clear_scheduled = false;
2440
+ last_propagated_event = null;
2441
+ });
2442
+ }
2443
+ var path_idx = 0;
2444
+ var handled_at = last_propagated_event === event && event[event_symbol];
2445
+ if (handled_at) {
2446
+ var at_idx = path.indexOf(handled_at);
2447
+ if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
2448
+ event[event_symbol] = handler_element;
2449
+ return;
2450
+ }
2451
+ var handler_idx = path.indexOf(handler_element);
2452
+ if (handler_idx === -1) return;
2453
+ if (at_idx <= handler_idx) path_idx = at_idx;
2454
+ }
2455
+ current_target = path[path_idx] || event.target;
2456
+ if (current_target === handler_element) return;
2457
+ define_property(event, "currentTarget", {
2458
+ configurable: true,
2459
+ get() {
2460
+ return current_target || owner_document;
2461
+ }
2462
+ });
2463
+ var previous_reaction = active_reaction;
2464
+ var previous_effect = active_effect;
2465
+ set_active_reaction(null);
2466
+ set_active_effect(null);
2467
+ try {
2468
+ /**
2469
+ * @type {unknown}
2470
+ */
2471
+ var throw_error;
2472
+ /**
2473
+ * @type {unknown[]}
2474
+ */
2475
+ var other_errors = [];
2476
+ while (current_target !== null) {
2477
+ if (current_target === handler_element) break;
2478
+ try {
2479
+ var delegated = current_target[event_symbol]?.[event_name];
2480
+ if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
2481
+ } catch (error) {
2482
+ if (throw_error) other_errors.push(error);
2483
+ else throw_error = error;
2484
+ }
2485
+ if (event.cancelBubble) break;
2486
+ path_idx++;
2487
+ current_target = path_idx < path.length ? path[path_idx] : null;
2488
+ }
2489
+ if (throw_error) {
2490
+ for (let error of other_errors) queueMicrotask(() => {
2491
+ throw error;
2492
+ });
2493
+ throw throw_error;
2494
+ }
2495
+ } finally {
2496
+ event[event_symbol] = handler_element;
2497
+ delete event.currentTarget;
2498
+ set_active_reaction(previous_reaction);
2499
+ set_active_effect(previous_effect);
2500
+ }
2501
+ }
2502
+ //#endregion
2503
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/reconciler.js
2504
+ var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
2505
+ /** @param {string} html */
2506
+ createHTML: (html) => {
2507
+ return html;
2508
+ } });
2509
+ /** @param {string} html */
2510
+ function create_trusted_html(html) {
2511
+ return policy?.createHTML(html) ?? html;
2512
+ }
2513
+ /**
2514
+ * @param {string} html
2515
+ */
2516
+ function create_fragment_from_html(html) {
2517
+ var elem = create_element("template");
2518
+ elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
2519
+ return elem.content;
2520
+ }
2521
+ //#endregion
2522
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/template.js
2523
+ /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
2524
+ /** @import { TemplateStructure } from './types' */
2525
+ /**
2526
+ * @param {TemplateNode} start
2527
+ * @param {TemplateNode | null} end
2528
+ */
2529
+ function assign_nodes(start, end) {
2530
+ var effect = active_effect;
2531
+ if (effect.nodes === null) effect.nodes = {
2532
+ start,
2533
+ end,
2534
+ a: null,
2535
+ t: null
2536
+ };
2537
+ }
2538
+ /**
2539
+ * @param {string} content
2540
+ * @param {number} flags
2541
+ * @returns {() => Node | Node[]}
2542
+ */
2543
+ /*#__NO_SIDE_EFFECTS__*/
2544
+ function from_html(content, flags) {
2545
+ var is_fragment = (flags & 1) !== 0;
2546
+ var use_import_node = (flags & 2) !== 0;
2547
+ /** @type {Node} */
2548
+ var node;
2549
+ /**
2550
+ * Whether or not the first item is a text/element node. If not, we need to
2551
+ * create an additional comment node to act as `effect.nodes.start`
2552
+ */
2553
+ var has_start = !content.startsWith("<!>");
2554
+ return () => {
2555
+ if (hydrating) {
2556
+ assign_nodes(hydrate_node, null);
2557
+ return hydrate_node;
2558
+ }
2559
+ if (node === void 0) {
2560
+ node = create_fragment_from_html(has_start ? content : "<!>" + content);
2561
+ if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
2562
+ }
2563
+ var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
2564
+ if (is_fragment) {
2565
+ var start = /* @__PURE__ */ get_first_child(clone);
2566
+ var end = clone.lastChild;
2567
+ assign_nodes(start, end);
2568
+ } else assign_nodes(clone, clone);
2569
+ return clone;
2570
+ };
2571
+ }
2572
+ /**
2573
+ * Assign the created (or in hydration mode, traversed) dom elements to the current block
2574
+ * and insert the elements into the dom (in client mode).
2575
+ * @param {Text | Comment | Element} anchor
2576
+ * @param {DocumentFragment | Element} dom
2577
+ */
2578
+ function append(anchor, dom) {
2579
+ if (hydrating) {
2580
+ var effect = active_effect;
2581
+ if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
2582
+ hydrate_next();
2583
+ return;
2584
+ }
2585
+ if (anchor === null) return;
2586
+ anchor.before(dom);
2587
+ }
2588
+ /**
2589
+ * Subset of delegated events which should be passive by default.
2590
+ * These two are already passive via browser defaults on window, document and body.
2591
+ * But since
2592
+ * - we're delegating them
2593
+ * - they happen often
2594
+ * - they apply to mobile which is generally less performant
2595
+ * we're marking them as passive by default for other elements, too.
2596
+ */
2597
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
2598
+ /**
2599
+ * Returns `true` if `name` is a passive event
2600
+ * @param {string} name
2601
+ */
2602
+ function is_passive_event(name) {
2603
+ return PASSIVE_EVENTS.includes(name);
2604
+ }
2605
+ //#endregion
2606
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/reactivity/create-subscriber.js
2607
+ /**
2608
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
2609
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
2610
+ *
2611
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
2612
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
2613
+ *
2614
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
2615
+ *
2616
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
2617
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
2618
+ *
2619
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
2620
+ *
2621
+ * ```js
2622
+ * import { createSubscriber } from 'svelte/reactivity';
2623
+ * import { on } from 'svelte/events';
2624
+ *
2625
+ * export class MediaQuery {
2626
+ * #query;
2627
+ * #subscribe;
2628
+ *
2629
+ * constructor(query) {
2630
+ * this.#query = window.matchMedia(`(${query})`);
2631
+ *
2632
+ * this.#subscribe = createSubscriber((update) => {
2633
+ * // when the `change` event occurs, re-run any effects that read `this.current`
2634
+ * const off = on(this.#query, 'change', update);
2635
+ *
2636
+ * // stop listening when all the effects are destroyed
2637
+ * return () => off();
2638
+ * });
2639
+ * }
2640
+ *
2641
+ * get current() {
2642
+ * // This makes the getter reactive, if read in an effect
2643
+ * this.#subscribe();
2644
+ *
2645
+ * // Return the current state of the query, whether or not we're in an effect
2646
+ * return this.#query.matches;
2647
+ * }
2648
+ * }
2649
+ * ```
2650
+ * @param {(update: () => void) => (() => void) | void} start
2651
+ * @since 5.7.0
2652
+ */
2653
+ function createSubscriber(start) {
2654
+ let subscribers = 0;
2655
+ let version = source(0);
2656
+ /** @type {(() => void) | void} */
2657
+ let stop;
2658
+ return () => {
2659
+ if (effect_tracking()) {
2660
+ get(version);
2661
+ render_effect(() => {
2662
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
2663
+ subscribers += 1;
2664
+ return () => {
2665
+ queue_micro_task(() => {
2666
+ subscribers -= 1;
2667
+ if (subscribers === 0) {
2668
+ stop?.();
2669
+ stop = void 0;
2670
+ increment(version);
2671
+ }
2672
+ });
2673
+ };
2674
+ });
2675
+ }
2676
+ };
2677
+ }
2678
+ //#endregion
2679
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
2680
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
2681
+ /**
2682
+ * @typedef {{
2683
+ * onerror?: ((error: unknown, reset: () => void) => void) | null;
2684
+ * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
2685
+ * pending?: ((anchor: Node) => void) | null;
2686
+ * }} BoundaryProps
2687
+ */
2688
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
2689
+ /**
2690
+ * @param {TemplateNode} node
2691
+ * @param {BoundaryProps} props
2692
+ * @param {((anchor: Node) => void)} children
2693
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
2694
+ * @returns {void}
2695
+ */
2696
+ function boundary(node, props, children, transform_error) {
2697
+ new Boundary(node, props, children, transform_error);
2698
+ }
2699
+ var _anchor = /* @__PURE__ */ new WeakMap();
2700
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
2701
+ var _props = /* @__PURE__ */ new WeakMap();
2702
+ var _children = /* @__PURE__ */ new WeakMap();
2703
+ var _effect = /* @__PURE__ */ new WeakMap();
2704
+ var _main_effect = /* @__PURE__ */ new WeakMap();
2705
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
2706
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
2707
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
2708
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
2709
+ var _pending_count = /* @__PURE__ */ new WeakMap();
2710
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
2711
+ var _dirty_effects = /* @__PURE__ */ new WeakMap();
2712
+ var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
2713
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
2714
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
2715
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
2716
+ var Boundary = class {
2717
+ /**
2718
+ * @param {TemplateNode} node
2719
+ * @param {BoundaryProps} props
2720
+ * @param {((anchor: Node) => void)} children
2721
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
2722
+ */
2723
+ constructor(node, props, children, transform_error) {
2724
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
2725
+ _defineProperty(
2726
+ this,
2727
+ /** @type {Boundary | null} */
2728
+ "parent",
2729
+ void 0
2730
+ );
2731
+ _defineProperty(this, "is_pending", false);
2732
+ _defineProperty(
2733
+ this,
2734
+ /**
2735
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
2736
+ * Inherited from parent boundary, or defaults to identity.
2737
+ * @type {(error: unknown) => unknown}
2738
+ */
2739
+ "transform_error",
2740
+ void 0
2741
+ );
2742
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
2743
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
2744
+ _classPrivateFieldInitSpec(this, _props, void 0);
2745
+ _classPrivateFieldInitSpec(this, _children, void 0);
2746
+ _classPrivateFieldInitSpec(this, _effect, void 0);
2747
+ _classPrivateFieldInitSpec(this, _main_effect, null);
2748
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
2749
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
2750
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
2751
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
2752
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
2753
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
2754
+ _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
2755
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
2756
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
2757
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
2758
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
2759
+ return () => {
2760
+ _classPrivateFieldSet2(_effect_pending, this, null);
2761
+ };
2762
+ }));
2763
+ _classPrivateFieldSet2(_anchor, this, node);
2764
+ _classPrivateFieldSet2(_props, this, props);
2765
+ _classPrivateFieldSet2(_children, this, (anchor) => {
2766
+ var effect = active_effect;
2767
+ effect.b = this;
2768
+ effect.f |= 128;
2769
+ children(anchor);
2770
+ });
2771
+ this.parent = active_effect.b;
2772
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
2773
+ _classPrivateFieldSet2(_effect, this, block(() => {
2774
+ if (hydrating) {
2775
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
2776
+ hydrate_next();
2777
+ const server_rendered_pending = comment.data === "[!";
2778
+ if (comment.data.startsWith("[?")) {
2779
+ const serialized_error = JSON.parse(comment.data.slice(2));
2780
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
2781
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
2782
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
2783
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
2784
+ }, flags));
2785
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
2786
+ }
2787
+ /**
2788
+ * Defer an effect inside a pending boundary until the boundary resolves
2789
+ * @param {Effect} effect
2790
+ */
2791
+ defer_effect(effect) {
2792
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
2553
2793
  }
2554
- }
2555
- /**
2556
- * @param {Reaction} signal
2557
- * @param {number} start_index
2558
- * @returns {void}
2559
- */
2560
- function remove_reactions(signal, start_index) {
2561
- var dependencies = signal.deps;
2562
- if (dependencies === null) return;
2563
- for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2564
- }
2565
- /**
2566
- * @param {Effect} effect
2567
- * @returns {void}
2568
- */
2569
- function update_effect(effect) {
2570
- var flags = effect.f;
2571
- if ((flags & 16384) !== 0) return;
2572
- set_signal_status(effect, CLEAN);
2573
- var previous_effect = active_effect;
2574
- var was_updating_effect = is_updating_effect;
2575
- active_effect = effect;
2576
- is_updating_effect = true;
2577
- try {
2578
- if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2579
- else destroy_effect_children(effect);
2580
- execute_effect_teardown(effect);
2581
- var teardown = update_reaction(effect);
2582
- effect.teardown = typeof teardown === "function" ? teardown : null;
2583
- effect.wv = write_version;
2584
- } finally {
2585
- is_updating_effect = was_updating_effect;
2586
- active_effect = previous_effect;
2794
+ /**
2795
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
2796
+ * @returns {boolean}
2797
+ */
2798
+ is_rendered() {
2799
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
2587
2800
  }
2588
- }
2589
- /**
2590
- * @template V
2591
- * @param {Value<V>} signal
2592
- * @returns {V}
2593
- */
2594
- function get(signal) {
2595
- var is_derived = (signal.f & 2) !== 0;
2596
- captured_signals?.add(signal);
2597
- if (active_reaction !== null && !untracking) {
2598
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
2599
- var deps = active_reaction.deps;
2600
- if ((active_reaction.f & 2097152) !== 0) {
2601
- if (signal.rv < read_version) {
2602
- signal.rv = read_version;
2603
- if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2604
- else if (new_deps === null) new_deps = [signal];
2605
- else new_deps.push(signal);
2606
- }
2607
- } else {
2608
- var _active_reaction;
2609
- ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
2610
- var reactions = signal.reactions;
2611
- if (reactions === null) signal.reactions = [active_reaction];
2612
- else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2613
- }
2614
- }
2801
+ has_pending_snippet() {
2802
+ return !!_classPrivateFieldGet2(_props, this).pending;
2615
2803
  }
2616
- if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2617
- if (is_derived) {
2618
- var derived = signal;
2619
- if (is_destroying_effect) {
2620
- var value = derived.v;
2621
- if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2622
- old_values.set(derived, value);
2623
- return value;
2624
- }
2625
- var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
2626
- var is_new = (derived.f & REACTION_RAN) === 0;
2627
- if (is_dirty(derived)) {
2628
- if (should_connect) derived.f |= 512;
2629
- update_derived(derived);
2630
- }
2631
- if (should_connect && !is_new) {
2632
- unfreeze_derived_effects(derived);
2633
- reconnect(derived);
2634
- }
2804
+ /**
2805
+ * Update the source that powers `$effect.pending()` inside this boundary,
2806
+ * and controls when the current `pending` snippet (if any) is removed.
2807
+ * Do not call from inside the class
2808
+ * @param {1 | -1} d
2809
+ * @param {Batch} batch
2810
+ */
2811
+ update_pending_count(d, batch) {
2812
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
2813
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
2814
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
2815
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
2816
+ queue_micro_task(() => {
2817
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
2818
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
2819
+ });
2635
2820
  }
2636
- if (batch_values?.has(signal)) return batch_values.get(signal);
2637
- if ((signal.f & 8388608) !== 0) throw signal.v;
2638
- return signal.v;
2639
- }
2640
- /**
2641
- * (Re)connect a disconnected derived, so that it is notified
2642
- * of changes in `mark_reactions`
2643
- * @param {Derived} derived
2644
- */
2645
- function reconnect(derived) {
2646
- derived.f |= 512;
2647
- if (derived.deps === null) return;
2648
- for (const dep of derived.deps) {
2649
- (dep.reactions ?? (dep.reactions = [])).push(derived);
2650
- if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2651
- unfreeze_derived_effects(dep);
2652
- reconnect(dep);
2653
- }
2821
+ get_effect_pending() {
2822
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
2823
+ return get(_classPrivateFieldGet2(_effect_pending, this));
2654
2824
  }
2655
- }
2656
- /** @param {Derived} derived */
2657
- function depends_on_old_values(derived) {
2658
- if (derived.v === UNINITIALIZED) return true;
2659
- if (derived.deps === null) return false;
2660
- for (const dep of derived.deps) {
2661
- if (old_values.has(dep)) return true;
2662
- if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2825
+ /** @param {unknown} error */
2826
+ error(error) {
2827
+ if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
2828
+ if (current_batch?.is_fork) {
2829
+ if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
2830
+ if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
2831
+ if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
2832
+ current_batch.oncommit(() => {
2833
+ _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
2834
+ });
2835
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
2663
2836
  }
2664
- return false;
2665
- }
2666
- /**
2667
- * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2668
- * any state read inside `fn` will not be treated as a dependency.
2669
- *
2670
- * ```ts
2671
- * $effect(() => {
2672
- * // this will run when `data` changes, but not when `time` changes
2673
- * save(data, {
2674
- * timestamp: untrack(() => time)
2675
- * });
2676
- * });
2677
- * ```
2678
- * @template T
2679
- * @param {() => T} fn
2680
- * @returns {T}
2681
- */
2682
- function untrack(fn) {
2683
- var previous_untracking = untracking;
2837
+ };
2838
+ function _hydrate_resolved_content() {
2684
2839
  try {
2685
- untracking = true;
2686
- return fn();
2687
- } finally {
2688
- untracking = previous_untracking;
2840
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
2841
+ } catch (error) {
2842
+ this.error(error);
2689
2843
  }
2690
2844
  }
2691
- //#endregion
2692
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/events.js
2693
2845
  /**
2694
- * Used on elements, as a map of event type -> event handler,
2695
- * and on events themselves to track which element handled an event
2846
+ * @param {unknown} error The deserialized error from the server's hydration comment
2696
2847
  */
2697
- var event_symbol = Symbol("events");
2698
- /** @type {Set<string>} */
2699
- var all_registered_events = /* @__PURE__ */ new Set();
2700
- /** @type {Set<(events: Array<string>) => void>} */
2701
- var root_event_handles = /* @__PURE__ */ new Set();
2702
- var last_propagated_event = null;
2848
+ function _hydrate_failed_content(error) {
2849
+ const failed = _classPrivateFieldGet2(_props, this).failed;
2850
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, error);
2851
+ queue_micro_task(invoke_onerror);
2852
+ if (!failed) return;
2853
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
2854
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => reset);
2855
+ }));
2856
+ }
2703
2857
  /**
2704
- * @this {EventTarget}
2705
- * @param {Event} event
2706
- * @returns {void}
2858
+ * Creates the `reset` function for a failed boundary, along with a function
2859
+ * that invokes `onerror` with it (if provided)
2860
+ * @param {unknown} error
2861
+ * @returns {{ reset: () => void, invoke_onerror: () => void }}
2707
2862
  */
2708
- function handle_event_propagation(event) {
2709
- var handler_element = this;
2710
- var owner_document = handler_element.ownerDocument;
2711
- var event_name = event.type;
2712
- var path = event.composedPath?.() || [];
2713
- var current_target = path[0] || event.target;
2714
- last_propagated_event = event;
2715
- var path_idx = 0;
2716
- var handled_at = last_propagated_event === event && event[event_symbol];
2717
- if (handled_at) {
2718
- var at_idx = path.indexOf(handled_at);
2719
- if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
2720
- event[event_symbol] = handler_element;
2863
+ function _create_reset(error) {
2864
+ var did_reset = false;
2865
+ var calling_on_error = false;
2866
+ const reset = () => {
2867
+ if (did_reset) {
2868
+ svelte_boundary_reset_noop();
2721
2869
  return;
2722
2870
  }
2723
- var handler_idx = path.indexOf(handler_element);
2724
- if (handler_idx === -1) return;
2725
- if (at_idx <= handler_idx) path_idx = at_idx;
2726
- }
2727
- current_target = path[path_idx] || event.target;
2728
- if (current_target === handler_element) return;
2729
- define_property(event, "currentTarget", {
2730
- configurable: true,
2731
- get() {
2732
- return current_target || owner_document;
2871
+ did_reset = true;
2872
+ if (calling_on_error) svelte_boundary_reset_onerror();
2873
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
2874
+ _classPrivateFieldSet2(_failed_effect, this, null);
2875
+ });
2876
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
2877
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
2878
+ });
2879
+ };
2880
+ const invoke_onerror = () => {
2881
+ try {
2882
+ calling_on_error = true;
2883
+ _classPrivateFieldGet2(_props, this).onerror?.(error, reset);
2884
+ calling_on_error = false;
2885
+ } catch (err) {
2886
+ invoke_error_boundary(err, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
2733
2887
  }
2734
- });
2735
- var previous_reaction = active_reaction;
2736
- var previous_effect = active_effect;
2737
- set_active_reaction(null);
2738
- set_active_effect(null);
2739
- try {
2740
- /**
2741
- * @type {unknown}
2742
- */
2743
- var throw_error;
2744
- /**
2745
- * @type {unknown[]}
2746
- */
2747
- var other_errors = [];
2748
- while (current_target !== null) {
2749
- /** @type {null | Element} */
2750
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
2888
+ };
2889
+ return {
2890
+ reset,
2891
+ invoke_onerror
2892
+ };
2893
+ }
2894
+ function _hydrate_pending_content() {
2895
+ const pending = _classPrivateFieldGet2(_props, this).pending;
2896
+ if (!pending) return;
2897
+ this.is_pending = true;
2898
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
2899
+ queue_micro_task(() => {
2900
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
2901
+ var anchor = create_text();
2902
+ var handled = false;
2903
+ fragment.append(anchor);
2904
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
2751
2905
  try {
2752
- var delegated = current_target[event_symbol]?.[event_name];
2753
- if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
2906
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
2754
2907
  } catch (error) {
2755
- if (throw_error) other_errors.push(error);
2756
- else throw_error = error;
2908
+ try {
2909
+ this.error(error);
2910
+ handled = true;
2911
+ } catch (error) {
2912
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
2913
+ }
2914
+ return null;
2757
2915
  }
2758
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
2759
- current_target = parent_element;
2916
+ }));
2917
+ if (_classPrivateFieldGet2(_main_effect, this) === null) {
2918
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
2919
+ if (handled) _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
2920
+ return;
2760
2921
  }
2761
- if (throw_error) {
2762
- for (let error of other_errors) queueMicrotask(() => {
2763
- throw error;
2922
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
2923
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
2924
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
2925
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
2926
+ _classPrivateFieldSet2(_pending_effect, this, null);
2764
2927
  });
2765
- throw throw_error;
2928
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
2766
2929
  }
2767
- } finally {
2768
- event[event_symbol] = handler_element;
2769
- delete event.currentTarget;
2770
- set_active_reaction(previous_reaction);
2771
- set_active_effect(previous_effect);
2772
- }
2930
+ });
2773
2931
  }
2774
- //#endregion
2775
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/reconciler.js
2776
- var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
2777
- /** @param {string} html */
2778
- createHTML: (html) => {
2779
- return html;
2780
- } });
2781
- /** @param {string} html */
2782
- function create_trusted_html(html) {
2783
- return policy?.createHTML(html) ?? html;
2932
+ function _render() {
2933
+ try {
2934
+ this.is_pending = this.has_pending_snippet();
2935
+ _classPrivateFieldSet2(_pending_count, this, 0);
2936
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
2937
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
2938
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
2939
+ }));
2940
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
2941
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
2942
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
2943
+ const pending = _classPrivateFieldGet2(_props, this).pending;
2944
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
2945
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
2946
+ } catch (error) {
2947
+ this.error(error);
2948
+ }
2784
2949
  }
2785
2950
  /**
2786
- * @param {string} html
2951
+ * @param {Batch} batch
2787
2952
  */
2788
- function create_fragment_from_html(html) {
2789
- var elem = create_element("template");
2790
- elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
2791
- return elem.content;
2953
+ function _resolve(batch) {
2954
+ this.is_pending = false;
2955
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
2792
2956
  }
2793
- //#endregion
2794
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/template.js
2795
- /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
2796
- /** @import { TemplateStructure } from './types' */
2797
2957
  /**
2798
- * @param {TemplateNode} start
2799
- * @param {TemplateNode | null} end
2958
+ * @template T
2959
+ * @param {() => T} fn
2800
2960
  */
2801
- function assign_nodes(start, end) {
2802
- var effect = active_effect;
2803
- if (effect.nodes === null) effect.nodes = {
2804
- start,
2805
- end,
2806
- a: null,
2807
- t: null
2808
- };
2961
+ function _run(fn) {
2962
+ var previous_effect = active_effect;
2963
+ var previous_reaction = active_reaction;
2964
+ var previous_ctx = component_context;
2965
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
2966
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
2967
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
2968
+ try {
2969
+ Batch.ensure();
2970
+ return fn();
2971
+ } finally {
2972
+ set_active_effect(previous_effect);
2973
+ set_active_reaction(previous_reaction);
2974
+ set_component_context(previous_ctx);
2975
+ }
2809
2976
  }
2810
2977
  /**
2811
- * @param {string} content
2812
- * @param {number} flags
2813
- * @returns {() => Node | Node[]}
2978
+ * Updates the pending count associated with the currently visible pending snippet,
2979
+ * if any, such that we can replace the snippet with content once work is done
2980
+ * @param {1 | -1} d
2981
+ * @param {Batch} batch
2814
2982
  */
2815
- /* @__NO_SIDE_EFFECTS__ */
2816
- function from_html(content, flags) {
2817
- var is_fragment = (flags & 1) !== 0;
2818
- var use_import_node = (flags & 2) !== 0;
2819
- /** @type {Node} */
2820
- var node;
2821
- /**
2822
- * Whether or not the first item is a text/element node. If not, we need to
2823
- * create an additional comment node to act as `effect.nodes.start`
2824
- */
2825
- var has_start = !content.startsWith("<!>");
2826
- return () => {
2827
- if (hydrating) {
2828
- assign_nodes(hydrate_node, null);
2829
- return hydrate_node;
2983
+ function _update_pending_count(d, batch) {
2984
+ if (!this.has_pending_snippet()) {
2985
+ if (this.parent) {
2986
+ var _this$parent;
2987
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
2830
2988
  }
2831
- if (node === void 0) {
2832
- node = create_fragment_from_html(has_start ? content : "<!>" + content);
2833
- if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
2989
+ return;
2990
+ }
2991
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
2992
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
2993
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
2994
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
2995
+ _classPrivateFieldSet2(_pending_effect, this, null);
2996
+ });
2997
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
2998
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
2999
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
2834
3000
  }
2835
- var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
2836
- if (is_fragment) {
2837
- var start = /* @__PURE__ */ get_first_child(clone);
2838
- var end = clone.lastChild;
2839
- assign_nodes(start, end);
2840
- } else assign_nodes(clone, clone);
2841
- return clone;
2842
- };
3001
+ }
2843
3002
  }
2844
3003
  /**
2845
- * Assign the created (or in hydration mode, traversed) dom elements to the current block
2846
- * and insert the elements into the dom (in client mode).
2847
- * @param {Text | Comment | Element} anchor
2848
- * @param {DocumentFragment | Element} dom
3004
+ * @param {unknown} error
2849
3005
  */
2850
- function append(anchor, dom) {
3006
+ function _handle_error(error) {
3007
+ if (_classPrivateFieldGet2(_main_effect, this)) {
3008
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
3009
+ _classPrivateFieldSet2(_main_effect, this, null);
3010
+ }
3011
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
3012
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
3013
+ _classPrivateFieldSet2(_pending_effect, this, null);
3014
+ }
3015
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
3016
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
3017
+ _classPrivateFieldSet2(_failed_effect, this, null);
3018
+ }
2851
3019
  if (hydrating) {
2852
- var effect = active_effect;
2853
- if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
2854
- hydrate_next();
2855
- return;
3020
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
3021
+ next();
3022
+ set_hydrate_node(skip_nodes());
2856
3023
  }
2857
- if (anchor === null) return;
2858
- anchor.before(dom);
2859
- }
2860
- /**
2861
- * Subset of delegated events which should be passive by default.
2862
- * These two are already passive via browser defaults on window, document and body.
2863
- * But since
2864
- * - we're delegating them
2865
- * - they happen often
2866
- * - they apply to mobile which is generally less performant
2867
- * we're marking them as passive by default for other elements, too.
2868
- */
2869
- var PASSIVE_EVENTS = ["touchstart", "touchmove"];
2870
- /**
2871
- * Returns `true` if `name` is a passive event
2872
- * @param {string} name
2873
- */
2874
- function is_passive_event(name) {
2875
- return PASSIVE_EVENTS.includes(name);
3024
+ let failed = _classPrivateFieldGet2(_props, this).failed;
3025
+ /** @param {unknown} transformed_error */
3026
+ const handle_error_result = (transformed_error) => {
3027
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, transformed_error);
3028
+ invoke_onerror();
3029
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
3030
+ try {
3031
+ return branch(() => {
3032
+ var effect = active_effect;
3033
+ effect.b = this;
3034
+ effect.f |= 128;
3035
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
3036
+ });
3037
+ } catch (error) {
3038
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
3039
+ return null;
3040
+ }
3041
+ }));
3042
+ };
3043
+ queue_micro_task(() => {
3044
+ /** @type {unknown} */
3045
+ var result;
3046
+ try {
3047
+ result = this.transform_error(error);
3048
+ } catch (e) {
3049
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
3050
+ return;
3051
+ }
3052
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
3053
+ /** @type {any} */ result.then(
3054
+ handle_error_result,
3055
+ /** @param {unknown} e */
3056
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
3057
+ );
3058
+ else handle_error_result(result);
3059
+ });
2876
3060
  }
2877
3061
  /**
2878
3062
  * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
@@ -2964,7 +3148,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
2964
3148
  if (events)
2965
3149
  /** @type {any} */ props.$$events = events;
2966
3150
  if (hydrating) assign_nodes(anchor_node, null);
2967
- component = Component(anchor_node, props) || {};
3151
+ component = Component(anchor_node, props) || mark_as_component();
2968
3152
  if (hydrating) {
2969
3153
  /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
2970
3154
  if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
@@ -3050,13 +3234,14 @@ function unmount(component, options) {
3050
3234
  return Promise.resolve();
3051
3235
  }
3052
3236
  //#endregion
3053
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/css.js
3237
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/css.js
3054
3238
  /**
3055
3239
  * @param {Node} anchor
3056
3240
  * @param {{ hash: string, code: string }} css
3057
3241
  */
3058
3242
  function append_styles(anchor, css) {
3059
3243
  effect(() => {
3244
+ anchor = active_effect?.parent?.nodes?.start ?? anchor;
3060
3245
  var root = anchor.getRootNode();
3061
3246
  var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head;
3062
3247
  if (!target.querySelector("#" + css.hash)) {
@@ -3068,7 +3253,7 @@ function append_styles(anchor, css) {
3068
3253
  });
3069
3254
  }
3070
3255
  //#endregion
3071
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3256
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3072
3257
  var _ResizeObserverSingleton;
3073
3258
  var _listeners = /* @__PURE__ */ new WeakMap();
3074
3259
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -3120,8 +3305,8 @@ function _getObserver() {
3120
3305
  }
3121
3306
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
3122
3307
  //#endregion
3123
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/props.js
3124
- /** @import { Effect, Source } from './types.js' */
3308
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/props.js
3309
+ /** @import { Derived, Effect, Source } from './types.js' */
3125
3310
  /**
3126
3311
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
3127
3312
  * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
@@ -3138,7 +3323,12 @@ function prop(props, key, flags, fallback) {
3138
3323
  var lazy = (flags & 16) !== 0;
3139
3324
  var fallback_value = fallback;
3140
3325
  var fallback_dirty = true;
3326
+ var fallback_signal = void 0;
3141
3327
  var get_fallback = () => {
3328
+ if (lazy && runes) {
3329
+ fallback_signal ?? (fallback_signal = /* @__PURE__ */ derived(fallback));
3330
+ return get(fallback_signal);
3331
+ }
3142
3332
  if (fallback_dirty) {
3143
3333
  fallback_dirty = false;
3144
3334
  fallback_value = lazy ? untrack(fallback) : fallback;
@@ -3208,7 +3398,7 @@ function prop(props, key, flags, fallback) {
3208
3398
  });
3209
3399
  }
3210
3400
  //#endregion
3211
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/legacy/legacy-client.js
3401
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/legacy/legacy-client.js
3212
3402
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
3213
3403
  /**
3214
3404
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -3327,7 +3517,7 @@ var Svelte4Component = class {
3327
3517
  }
3328
3518
  };
3329
3519
  //#endregion
3330
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3520
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3331
3521
  /**
3332
3522
  * @typedef {Object} CustomElementPropDefinition
3333
3523
  * @property {string} [attribute]
@@ -3621,7 +3811,7 @@ var $$css = {
3621
3811
  function Author($$anchor, $$props) {
3622
3812
  push($$props, true);
3623
3813
  append_styles($$anchor, $$css);
3624
- let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7);
3814
+ let model = prop($$props, "model", 15);
3625
3815
  var $$exports = {
3626
3816
  get model() {
3627
3817
  return model();
@@ -3629,22 +3819,12 @@ function Author($$anchor, $$props) {
3629
3819
  set model($$value) {
3630
3820
  model($$value);
3631
3821
  flushSync();
3632
- },
3633
- get onChange() {
3634
- return onChange();
3635
- },
3636
- set onChange($$value) {
3637
- onChange($$value);
3638
- flushSync();
3639
3822
  }
3640
3823
  };
3641
3824
  append($$anchor, root());
3642
3825
  return pop($$exports);
3643
3826
  }
3644
- create_custom_element(Author, {
3645
- model: { type: "Object" },
3646
- onChange: {}
3647
- }, [], []);
3827
+ create_custom_element(Author, { model: { type: "Object" } }, [], []);
3648
3828
  //#endregion
3649
3829
  //#region src/author/index.ts
3650
3830
  var SvelteElementClass = Author.element;
@@ -3663,7 +3843,6 @@ var McPopulatedBlankAuthor = class extends SvelteElementClass {
3663
3843
  }
3664
3844
  set onChange(fn) {
3665
3845
  this._onChange = fn;
3666
- this.onChange = fn;
3667
3846
  }
3668
3847
  get onChange() {
3669
3848
  return this._onChange || (() => {});