@pie-players/pie-assessment-toolkit 0.3.44 → 0.3.46

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 (191) hide show
  1. package/README.md +59 -70
  2. package/dist/components/ItemToolBar.custom-element.js +776 -357
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +19501 -3591
  4. package/dist/components/SectionToolBar.custom-element.js +1058 -540
  5. package/dist/index.d.ts +3 -6
  6. package/dist/index.js +1 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/policy/core/ToolPolicyEngine.d.ts +1 -2
  9. package/dist/policy/core/ToolPolicyEngine.js +1 -2
  10. package/dist/policy/core/ToolPolicyEngine.js.map +1 -1
  11. package/dist/policy/core/pnp-policy-inputs.d.ts +2 -3
  12. package/dist/policy/core/pnp-policy-inputs.js +2 -3
  13. package/dist/policy/core/pnp-policy-inputs.js.map +1 -1
  14. package/dist/policy/core/provenance.d.ts +7 -34
  15. package/dist/policy/core/provenance.js +4 -21
  16. package/dist/policy/core/provenance.js.map +1 -1
  17. package/dist/policy/sources/PnpPolicySource.d.ts +6 -19
  18. package/dist/policy/sources/PnpPolicySource.js +6 -19
  19. package/dist/policy/sources/PnpPolicySource.js.map +1 -1
  20. package/dist/runtime/SectionRuntimeEngine.d.ts +13 -28
  21. package/dist/runtime/SectionRuntimeEngine.js +13 -27
  22. package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
  23. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +2 -2
  24. package/dist/runtime/adapter/SectionEngineAdapter.js +2 -2
  25. package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -1
  26. package/dist/runtime/adapter/coordinator-bridge.d.ts +1 -1
  27. package/dist/runtime/adapter/coordinator-bridge.js +1 -1
  28. package/dist/runtime/adapter/coordinator-bridge.js.map +1 -1
  29. package/dist/runtime/adapter/dom-event-bridge.d.ts +1 -1
  30. package/dist/runtime/adapter/dom-event-bridge.js +1 -1
  31. package/dist/runtime/adapter/dom-event-bridge.js.map +1 -1
  32. package/dist/runtime/catalog-registration.d.ts +12 -0
  33. package/dist/runtime/catalog-registration.js +54 -0
  34. package/dist/runtime/catalog-registration.js.map +1 -0
  35. package/dist/runtime/core/engine-output.d.ts +2 -2
  36. package/dist/runtime/core/engine-output.js +2 -2
  37. package/dist/runtime/core/engine-output.js.map +1 -1
  38. package/dist/runtime/core/engine-readiness.d.ts +2 -2
  39. package/dist/runtime/core/engine-readiness.js.map +1 -1
  40. package/dist/runtime/core/engine-resolver.d.ts +13 -41
  41. package/dist/runtime/core/engine-resolver.js +19 -76
  42. package/dist/runtime/core/engine-resolver.js.map +1 -1
  43. package/dist/runtime/core/engine-transition.d.ts +1 -1
  44. package/dist/runtime/core/engine-transition.js +1 -1
  45. package/dist/runtime/core/engine-transition.js.map +1 -1
  46. package/dist/runtime/engine.d.ts +1 -1
  47. package/dist/runtime/engine.js.map +1 -1
  48. package/dist/runtime/section-runtime-engine-host-context.d.ts +22 -15
  49. package/dist/runtime/section-runtime-engine-host-context.js +10 -10
  50. package/dist/runtime/section-runtime-engine-host-context.js.map +1 -1
  51. package/dist/runtime/stage-emit-gate.d.ts +4 -4
  52. package/dist/runtime/stage-emit-gate.js +3 -3
  53. package/dist/runtime/stage-emit-gate.js.map +1 -1
  54. package/dist/services/AccessibilityCatalogResolver.d.ts +23 -0
  55. package/dist/services/AccessibilityCatalogResolver.js +200 -28
  56. package/dist/services/AccessibilityCatalogResolver.js.map +1 -1
  57. package/dist/services/HighlightCoordinator.d.ts +25 -0
  58. package/dist/services/HighlightCoordinator.js +125 -0
  59. package/dist/services/HighlightCoordinator.js.map +1 -1
  60. package/dist/services/SSMLExtractor.d.ts +16 -1
  61. package/dist/services/SSMLExtractor.js +86 -7
  62. package/dist/services/SSMLExtractor.js.map +1 -1
  63. package/dist/services/TTSService.d.ts +30 -4
  64. package/dist/services/TTSService.js +652 -159
  65. package/dist/services/TTSService.js.map +1 -1
  66. package/dist/services/ToolRegistry.d.ts +11 -2
  67. package/dist/services/ToolRegistry.js +1 -1
  68. package/dist/services/ToolRegistry.js.map +1 -1
  69. package/dist/services/ToolkitCoordinator.d.ts +16 -73
  70. package/dist/services/ToolkitCoordinator.js +34 -113
  71. package/dist/services/ToolkitCoordinator.js.map +1 -1
  72. package/dist/services/interfaces.d.ts +20 -2
  73. package/dist/services/interfaces.js.map +1 -1
  74. package/dist/services/tool-config-validation.d.ts +1 -1
  75. package/dist/services/tool-config-validation.js +7 -7
  76. package/dist/services/tool-config-validation.js.map +1 -1
  77. package/dist/services/tool-instance-id.js +1 -1
  78. package/dist/services/tool-instance-id.js.map +1 -1
  79. package/dist/services/tool-providers/TTSToolProvider.js +3 -3
  80. package/dist/services/tool-providers/TTSToolProvider.js.map +1 -1
  81. package/dist/services/tools-config-normalizer.d.ts +13 -2
  82. package/dist/services/tools-config-normalizer.js +3 -8
  83. package/dist/services/tools-config-normalizer.js.map +1 -1
  84. package/dist/services/tts/browser-provider.js +2 -0
  85. package/dist/services/tts/browser-provider.js.map +1 -1
  86. package/dist/services/tts/catalog-span-alignment.d.ts +39 -0
  87. package/dist/services/tts/catalog-span-alignment.js +300 -0
  88. package/dist/services/tts/catalog-span-alignment.js.map +1 -0
  89. package/dist/services/tts/generated-speech/assemble-plan.d.ts +33 -0
  90. package/dist/services/tts/generated-speech/assemble-plan.js +111 -0
  91. package/dist/services/tts/generated-speech/assemble-plan.js.map +1 -0
  92. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +25 -0
  93. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +66 -0
  94. package/dist/services/tts/generated-speech/dom/build-dom-plan.js.map +1 -0
  95. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +19 -0
  96. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js +71 -0
  97. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js.map +1 -0
  98. package/dist/services/tts/generated-speech/dom/types.d.ts +37 -0
  99. package/dist/services/tts/generated-speech/dom/types.js +2 -0
  100. package/dist/services/tts/generated-speech/dom/types.js.map +1 -0
  101. package/dist/services/tts/generated-speech/index.d.ts +17 -0
  102. package/dist/services/tts/generated-speech/index.js +17 -0
  103. package/dist/services/tts/generated-speech/index.js.map +1 -0
  104. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +15 -0
  105. package/dist/services/tts/generated-speech/math-speech-cache.js +78 -0
  106. package/dist/services/tts/generated-speech/math-speech-cache.js.map +1 -0
  107. package/dist/services/tts/generated-speech/types.d.ts +104 -0
  108. package/dist/services/tts/generated-speech/types.js +18 -0
  109. package/dist/services/tts/generated-speech/types.js.map +1 -0
  110. package/dist/services/tts/highlight-pipeline/boundary-normalizer.d.ts +2 -0
  111. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +106 -0
  112. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js.map +1 -0
  113. package/dist/services/tts/highlight-pipeline/create-highlight-plan.d.ts +6 -0
  114. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +217 -0
  115. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js.map +1 -0
  116. package/dist/services/tts/highlight-pipeline/highlight-policy.d.ts +2 -0
  117. package/dist/services/tts/highlight-pipeline/highlight-policy.js +32 -0
  118. package/dist/services/tts/highlight-pipeline/highlight-policy.js.map +1 -0
  119. package/dist/services/tts/highlight-pipeline/index.d.ts +9 -0
  120. package/dist/services/tts/highlight-pipeline/index.js +9 -0
  121. package/dist/services/tts/highlight-pipeline/index.js.map +1 -0
  122. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.d.ts +3 -0
  123. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js +32 -0
  124. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js.map +1 -0
  125. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.d.ts +29 -0
  126. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +44 -0
  127. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js.map +1 -0
  128. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.d.ts +2 -0
  129. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +20 -0
  130. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js.map +1 -0
  131. package/dist/services/tts/highlight-pipeline/readable-region.d.ts +1 -0
  132. package/dist/services/tts/highlight-pipeline/readable-region.js +19 -0
  133. package/dist/services/tts/highlight-pipeline/readable-region.js.map +1 -0
  134. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.d.ts +6 -0
  135. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js +198 -0
  136. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js.map +1 -0
  137. package/dist/services/tts/highlight-pipeline/types.d.ts +72 -0
  138. package/dist/services/tts/highlight-pipeline/types.js +2 -0
  139. package/dist/services/tts/highlight-pipeline/types.js.map +1 -0
  140. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +2 -0
  141. package/dist/services/tts/highlight-pipeline/visible-map-range.js +22 -0
  142. package/dist/services/tts/highlight-pipeline/visible-map-range.js.map +1 -0
  143. package/dist/services/tts/math-alignment/index.d.ts +30 -0
  144. package/dist/services/tts/math-alignment/index.js +66 -0
  145. package/dist/services/tts/math-alignment/index.js.map +1 -0
  146. package/dist/services/tts/math-alignment/mathml-tokenizer.d.ts +2 -0
  147. package/dist/services/tts/math-alignment/mathml-tokenizer.js +317 -0
  148. package/dist/services/tts/math-alignment/mathml-tokenizer.js.map +1 -0
  149. package/dist/services/tts/math-alignment/range-resolver.d.ts +10 -0
  150. package/dist/services/tts/math-alignment/range-resolver.js +13 -0
  151. package/dist/services/tts/math-alignment/range-resolver.js.map +1 -0
  152. package/dist/services/tts/math-alignment/sequence-aligner.d.ts +7 -0
  153. package/dist/services/tts/math-alignment/sequence-aligner.js +119 -0
  154. package/dist/services/tts/math-alignment/sequence-aligner.js.map +1 -0
  155. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +31 -0
  156. package/dist/services/tts/math-alignment/speech-tokenizer.js +143 -0
  157. package/dist/services/tts/math-alignment/speech-tokenizer.js.map +1 -0
  158. package/dist/services/tts/math-alignment/types.d.ts +58 -0
  159. package/dist/services/tts/math-alignment/types.js +2 -0
  160. package/dist/services/tts/math-alignment/types.js.map +1 -0
  161. package/dist/services/tts/math-aware-text-processing.d.ts +18 -0
  162. package/dist/services/tts/math-aware-text-processing.js +348 -0
  163. package/dist/services/tts/math-aware-text-processing.js.map +1 -0
  164. package/dist/services/tts/math-speech.d.ts +44 -0
  165. package/dist/services/tts/math-speech.js +147 -0
  166. package/dist/services/tts/math-speech.js.map +1 -0
  167. package/dist/services/tts/mathml-sanitization.d.ts +1 -0
  168. package/dist/services/tts/mathml-sanitization.js +170 -0
  169. package/dist/services/tts/mathml-sanitization.js.map +1 -0
  170. package/dist/services/tts/ssml/spoken-text.d.ts +33 -0
  171. package/dist/services/tts/ssml/spoken-text.js +159 -0
  172. package/dist/services/tts/ssml/spoken-text.js.map +1 -0
  173. package/dist/services/tts/text-processing.d.ts +3 -0
  174. package/dist/services/tts/text-processing.js +30 -4
  175. package/dist/services/tts/text-processing.js.map +1 -1
  176. package/dist/services/tts-runtime-config.d.ts +17 -1
  177. package/dist/services/tts-runtime-config.js +11 -1
  178. package/dist/services/tts-runtime-config.js.map +1 -1
  179. package/dist/tools/registrations/accessibility-tools.js +0 -1
  180. package/dist/tools/registrations/accessibility-tools.js.map +1 -1
  181. package/dist/tools/registrations/calculator.js +46 -5
  182. package/dist/tools/registrations/calculator.js.map +1 -1
  183. package/dist/tools/tool-tag-map.js +0 -1
  184. package/dist/tools/tool-tag-map.js.map +1 -1
  185. package/package.json +8 -11
  186. package/dist/services/PNPToolResolver.d.ts +0 -280
  187. package/dist/services/PNPToolResolver.js +0 -514
  188. package/dist/services/PNPToolResolver.js.map +0 -1
  189. package/dist/services/pnp-provenance.d.ts +0 -166
  190. package/dist/services/pnp-provenance.js +0 -231
  191. package/dist/services/pnp-provenance.js.map +0 -1
@@ -6,15 +6,15 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
8
 
9
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/version.js
9
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/version.js
10
10
  var PUBLIC_VERSION = "5";
11
11
 
12
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/disclose-version.js
12
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/disclose-version.js
13
13
  if (typeof window !== "undefined") {
14
14
  ((window.__svelte ??= {}).v ??= new Set).add(PUBLIC_VERSION);
15
15
  }
16
16
 
17
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/constants.js
17
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/constants.js
18
18
  var EACH_INDEX_REACTIVE = 1 << 1;
19
19
  var EACH_IS_CONTROLLED = 1 << 2;
20
20
  var EACH_IS_ANIMATED = 1 << 3;
@@ -37,14 +37,14 @@ var HYDRATION_END = "]";
37
37
  var HYDRATION_ERROR = {};
38
38
  var ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
39
39
  var ELEMENT_IS_INPUT = 1 << 2;
40
- var UNINITIALIZED = Symbol();
40
+ var UNINITIALIZED = Symbol("uninitialized");
41
41
  var FILENAME = Symbol("filename");
42
42
  var HMR = Symbol("hmr");
43
43
  var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
44
44
 
45
45
  // ../../node_modules/.bun/esm-env@1.2.2/node_modules/esm-env/true.js
46
46
  var true_default = true;
47
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/utils.js
47
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/utils.js
48
48
  var is_array = Array.isArray;
49
49
  var index_of = Array.prototype.indexOf;
50
50
  var includes = Array.prototype.includes;
@@ -73,7 +73,7 @@ function deferred() {
73
73
  return { promise, resolve, reject };
74
74
  }
75
75
 
76
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/constants.js
76
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/constants.js
77
77
  var DERIVED = 1 << 1;
78
78
  var EFFECT = 1 << 2;
79
79
  var RENDER_EFFECT = 1 << 3;
@@ -104,6 +104,11 @@ var STATE_SYMBOL = Symbol("$state");
104
104
  var LEGACY_PROPS = Symbol("legacy props");
105
105
  var LOADING_ATTR_SYMBOL = Symbol("");
106
106
  var PROXY_PATH_SYMBOL = Symbol("proxy path");
107
+ var ATTRIBUTES_CACHE = Symbol("attributes");
108
+ var CLASS_CACHE = Symbol("class");
109
+ var STYLE_CACHE = Symbol("style");
110
+ var TEXT_CACHE = Symbol("text");
111
+ var FORM_RESET_HANDLER = Symbol("form reset");
107
112
  var HMR_ANCHOR = Symbol("hmr anchor");
108
113
  var STALE_REACTION = new class StaleReactionError extends Error {
109
114
  name = "StaleReactionError";
@@ -112,7 +117,7 @@ var STALE_REACTION = new class StaleReactionError extends Error {
112
117
  var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
113
118
  var COMMENT_NODE = 8;
114
119
 
115
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/errors.js
120
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/errors.js
116
121
  function invariant_violation(message) {
117
122
  if (true_default) {
118
123
  const error = new Error(`invariant_violation
@@ -125,7 +130,7 @@ https://svelte.dev/e/invariant_violation`);
125
130
  }
126
131
  }
127
132
 
128
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/errors.js
133
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/errors.js
129
134
  function async_derived_orphan() {
130
135
  if (true_default) {
131
136
  const error = new Error(`async_derived_orphan
@@ -237,7 +242,7 @@ https://svelte.dev/e/svelte_boundary_reset_onerror`);
237
242
  }
238
243
  }
239
244
 
240
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/warnings.js
245
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/warnings.js
241
246
  var bold = "font-weight: bold";
242
247
  var normal = "font-weight: normal";
243
248
  function await_reactivity_loss(name) {
@@ -322,7 +327,7 @@ https://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);
322
327
  }
323
328
  }
324
329
 
325
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/hydration.js
330
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/hydration.js
326
331
  var hydrating = false;
327
332
  function set_hydrating(value) {
328
333
  hydrating = value;
@@ -369,7 +374,7 @@ function skip_nodes(remove = true) {
369
374
  }
370
375
  }
371
376
 
372
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/equality.js
377
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/equality.js
373
378
  function equals(value) {
374
379
  return value === this.v;
375
380
  }
@@ -380,12 +385,12 @@ function safe_equals(value) {
380
385
  return !safe_not_equal(value, this.v);
381
386
  }
382
387
 
383
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/flags/index.js
388
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/flags/index.js
384
389
  var async_mode_flag = false;
385
390
  var legacy_mode_flag = false;
386
391
  var tracing_mode_flag = false;
387
392
 
388
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/tracing.js
393
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/tracing.js
389
394
  var tracing_expressions = null;
390
395
  function tag(source, label) {
391
396
  source.label = label;
@@ -397,7 +402,7 @@ function tag_proxy(value, label) {
397
402
  return value;
398
403
  }
399
404
 
400
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/dev.js
405
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/dev.js
401
406
  function get_error(label) {
402
407
  const error = new Error;
403
408
  const stack = get_stack();
@@ -449,7 +454,7 @@ function invariant(condition, message) {
449
454
  invariant_violation(message);
450
455
  }
451
456
 
452
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/context.js
457
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/context.js
453
458
  var component_context = null;
454
459
  function set_component_context(context) {
455
460
  component_context = context;
@@ -501,7 +506,7 @@ function is_runes() {
501
506
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
502
507
  }
503
508
 
504
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/task.js
509
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/task.js
505
510
  var micro_tasks = [];
506
511
  function run_micro_tasks() {
507
512
  var tasks = micro_tasks;
@@ -524,7 +529,7 @@ function flush_tasks() {
524
529
  }
525
530
  }
526
531
 
527
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/error-handling.js
532
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/error-handling.js
528
533
  var adjustments = new WeakMap;
529
534
  function handle_error(error) {
530
535
  var effect = active_effect;
@@ -597,7 +602,7 @@ function apply_adjustments(error) {
597
602
  }
598
603
  }
599
604
 
600
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/status.js
605
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/status.js
601
606
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
602
607
  function set_signal_status(signal, status) {
603
608
  signal.f = signal.f & STATUS_MASK | status;
@@ -610,7 +615,7 @@ function update_derived_status(derived) {
610
615
  }
611
616
  }
612
617
 
613
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/utils.js
618
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/utils.js
614
619
  function clear_marked(deps) {
615
620
  if (deps === null)
616
621
  return;
@@ -632,10 +637,10 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
632
637
  set_signal_status(effect, CLEAN);
633
638
  }
634
639
 
635
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/store.js
640
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/store.js
636
641
  var legacy_is_updating_store = false;
637
642
  var is_store_binding = false;
638
- var IS_UNMOUNTED = Symbol();
643
+ var IS_UNMOUNTED = Symbol("unmounted");
639
644
  function capture_store_binding(fn) {
640
645
  var previous_is_store_binding = is_store_binding;
641
646
  try {
@@ -646,8 +651,9 @@ function capture_store_binding(fn) {
646
651
  }
647
652
  }
648
653
 
649
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/batch.js
650
- var batches = new Set;
654
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/batch.js
655
+ var first_batch = null;
656
+ var last_batch = null;
651
657
  var current_batch = null;
652
658
  var previous_batch = null;
653
659
  var batch_values = null;
@@ -657,17 +663,21 @@ var is_processing = false;
657
663
  var collected_effects = null;
658
664
  var legacy_updates = null;
659
665
  var flush_count = 0;
660
- var source_stacks = true_default ? new Set : null;
666
+ var source_stacks = new Set;
661
667
  var uid = 1;
662
668
 
663
669
  class Batch {
664
670
  id = uid++;
671
+ #started = false;
672
+ linked = true;
673
+ #prev = null;
674
+ #next = null;
675
+ async_deriveds = new Map;
665
676
  current = new Map;
666
677
  previous = new Map;
667
678
  #commit_callbacks = new Set;
668
679
  #discard_callbacks = new Set;
669
- #fork_commit_callbacks = new Set;
670
- #pending = new Map;
680
+ #pending = 0;
671
681
  #blocking_pending = new Map;
672
682
  #deferred = null;
673
683
  #roots = [];
@@ -678,25 +688,30 @@ class Batch {
678
688
  #unskipped_branches = new Set;
679
689
  is_fork = false;
680
690
  #decrement_queued = false;
681
- #blockers = new Set;
691
+ constructor() {
692
+ if (last_batch === null) {
693
+ first_batch = last_batch = this;
694
+ } else {
695
+ last_batch.#next = this;
696
+ this.#prev = last_batch;
697
+ }
698
+ last_batch = this;
699
+ }
682
700
  #is_deferred() {
683
- return this.is_fork || this.#blocking_pending.size > 0;
684
- }
685
- #is_blocked() {
686
- for (const batch of this.#blockers) {
687
- for (const effect of batch.#blocking_pending.keys()) {
688
- var skipped = false;
689
- var e = effect;
690
- while (e.parent !== null) {
691
- if (this.#skipped_branches.has(e)) {
692
- skipped = true;
693
- break;
694
- }
695
- e = e.parent;
696
- }
697
- if (!skipped) {
698
- return true;
701
+ if (this.is_fork)
702
+ return true;
703
+ for (const effect of this.#blocking_pending.keys()) {
704
+ var e = effect;
705
+ var skipped = false;
706
+ while (e.parent !== null) {
707
+ if (this.#skipped_branches.has(e)) {
708
+ skipped = true;
709
+ break;
699
710
  }
711
+ e = e.parent;
712
+ }
713
+ if (!skipped) {
714
+ return true;
700
715
  }
701
716
  }
702
717
  return false;
@@ -723,21 +738,25 @@ class Batch {
723
738
  this.#unskipped_branches.add(effect);
724
739
  }
725
740
  #process() {
741
+ this.#started = true;
726
742
  if (flush_count++ > 1000) {
727
- batches.delete(this);
743
+ this.#unlink();
728
744
  infinite_loop_guard();
729
745
  }
730
- if (!this.#is_deferred()) {
731
- for (const e of this.#dirty_effects) {
732
- this.#maybe_dirty_effects.delete(e);
733
- set_signal_status(e, DIRTY);
734
- this.schedule(e);
735
- }
736
- for (const e of this.#maybe_dirty_effects) {
737
- set_signal_status(e, MAYBE_DIRTY);
738
- this.schedule(e);
746
+ if (true_default) {
747
+ for (const value of this.current.keys()) {
748
+ source_stacks.add(value);
739
749
  }
740
750
  }
751
+ for (const e of this.#dirty_effects) {
752
+ this.#maybe_dirty_effects.delete(e);
753
+ set_signal_status(e, DIRTY);
754
+ this.schedule(e);
755
+ }
756
+ for (const e of this.#maybe_dirty_effects) {
757
+ set_signal_status(e, MAYBE_DIRTY);
758
+ this.schedule(e);
759
+ }
741
760
  const roots = this.#roots;
742
761
  this.#roots = [];
743
762
  this.apply();
@@ -749,6 +768,8 @@ class Batch {
749
768
  this.#traverse(root, effects, render_effects);
750
769
  } catch (e) {
751
770
  reset_all(root);
771
+ if (!this.#is_deferred())
772
+ this.discard();
752
773
  throw e;
753
774
  }
754
775
  }
@@ -761,44 +782,53 @@ class Batch {
761
782
  }
762
783
  collected_effects = null;
763
784
  legacy_updates = null;
764
- if (this.#is_deferred() || this.#is_blocked()) {
785
+ if (this.#is_deferred()) {
765
786
  this.#defer_effects(render_effects);
766
787
  this.#defer_effects(effects);
767
788
  for (const [e, t] of this.#skipped_branches) {
768
789
  reset_branch(e, t);
769
790
  }
770
- } else {
771
- if (this.#pending.size === 0) {
772
- batches.delete(this);
773
- }
774
- this.#dirty_effects.clear();
775
- this.#maybe_dirty_effects.clear();
776
- for (const fn of this.#commit_callbacks)
777
- fn(this);
778
- this.#commit_callbacks.clear();
779
- previous_batch = this;
780
- flush_queued_effects(render_effects);
781
- flush_queued_effects(effects);
782
- previous_batch = null;
783
- this.#deferred?.resolve();
791
+ if (updates.length > 0) {
792
+ current_batch.#process();
793
+ }
794
+ return;
784
795
  }
796
+ const earlier_batch = this.#find_earlier_batch();
797
+ if (earlier_batch) {
798
+ this.#defer_effects(render_effects);
799
+ this.#defer_effects(effects);
800
+ earlier_batch.#merge(this);
801
+ return;
802
+ }
803
+ this.#dirty_effects.clear();
804
+ this.#maybe_dirty_effects.clear();
805
+ for (const fn of this.#commit_callbacks)
806
+ fn(this);
807
+ this.#commit_callbacks.clear();
808
+ previous_batch = this;
809
+ flush_queued_effects(render_effects);
810
+ flush_queued_effects(effects);
811
+ previous_batch = null;
812
+ this.#deferred?.resolve();
785
813
  var next_batch = current_batch;
814
+ if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
815
+ this.#unlink();
816
+ if (async_mode_flag) {
817
+ this.#commit();
818
+ current_batch = next_batch;
819
+ }
820
+ }
786
821
  if (this.#roots.length > 0) {
787
- const batch2 = next_batch ??= this;
788
- batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
822
+ if (next_batch !== null) {
823
+ const batch2 = next_batch;
824
+ batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
825
+ } else {
826
+ next_batch = this;
827
+ }
789
828
  }
790
829
  if (next_batch !== null) {
791
- batches.add(next_batch);
792
- if (true_default) {
793
- for (const source2 of this.current.keys()) {
794
- source_stacks.add(source2);
795
- }
796
- }
797
830
  next_batch.#process();
798
831
  }
799
- if (async_mode_flag && !batches.has(this)) {
800
- this.#commit();
801
- }
802
832
  }
803
833
  #traverse(root, effects, render_effects) {
804
834
  root.f ^= CLEAN;
@@ -836,6 +866,59 @@ class Batch {
836
866
  }
837
867
  }
838
868
  }
869
+ #find_earlier_batch() {
870
+ var batch = this.#prev;
871
+ while (batch !== null) {
872
+ if (!batch.is_fork) {
873
+ for (const [value, [, is_derived]] of this.current) {
874
+ if (batch.current.has(value) && !is_derived) {
875
+ return batch;
876
+ }
877
+ }
878
+ }
879
+ batch = batch.#prev;
880
+ }
881
+ return null;
882
+ }
883
+ #merge(batch) {
884
+ for (const [source2, value] of batch.current) {
885
+ if (!this.previous.has(source2) && batch.previous.has(source2)) {
886
+ this.previous.set(source2, batch.previous.get(source2));
887
+ }
888
+ this.current.set(source2, value);
889
+ }
890
+ for (const [effect, deferred2] of batch.async_deriveds) {
891
+ const d = this.async_deriveds.get(effect);
892
+ if (d)
893
+ deferred2.promise.then(d.resolve).catch(d.reject);
894
+ }
895
+ this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
896
+ const mark = (value) => {
897
+ var reactions = value.reactions;
898
+ if (reactions === null)
899
+ return;
900
+ for (const reaction of reactions) {
901
+ var flags = reaction.f;
902
+ if ((flags & DERIVED) !== 0) {
903
+ mark(reaction);
904
+ } else {
905
+ var effect = reaction;
906
+ if (flags & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect)) {
907
+ this.#maybe_dirty_effects.delete(effect);
908
+ set_signal_status(effect, DIRTY);
909
+ this.schedule(effect);
910
+ }
911
+ }
912
+ }
913
+ };
914
+ for (const source2 of this.current.keys()) {
915
+ mark(source2);
916
+ }
917
+ this.oncommit(() => batch.discard());
918
+ batch.#unlink();
919
+ current_batch = this;
920
+ this.#process();
921
+ }
839
922
  #defer_effects(effects) {
840
923
  for (var i = 0;i < effects.length; i += 1) {
841
924
  defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
@@ -861,8 +944,10 @@ class Batch {
861
944
  batch_values = null;
862
945
  }
863
946
  flush() {
864
- var source_stacks2 = true_default ? new Set : null;
865
947
  try {
948
+ if (true_default) {
949
+ source_stacks.clear();
950
+ }
866
951
  is_processing = true;
867
952
  current_batch = this;
868
953
  this.#process();
@@ -876,7 +961,7 @@ class Batch {
876
961
  batch_values = null;
877
962
  old_values.clear();
878
963
  if (true_default) {
879
- for (const source2 of source_stacks2) {
964
+ for (const source2 of source_stacks) {
880
965
  source2.updated = null;
881
966
  }
882
967
  }
@@ -886,14 +971,14 @@ class Batch {
886
971
  for (const fn of this.#discard_callbacks)
887
972
  fn(this);
888
973
  this.#discard_callbacks.clear();
889
- this.#fork_commit_callbacks.clear();
890
- batches.delete(this);
974
+ this.#unlink();
975
+ this.#deferred?.resolve();
891
976
  }
892
977
  register_created_effect(effect) {
893
978
  this.#new_effects.push(effect);
894
979
  }
895
980
  #commit() {
896
- for (const batch of batches) {
981
+ for (let batch = first_batch;batch !== null; batch = batch.#next) {
897
982
  var is_earlier = batch.id < this.id;
898
983
  var sources = [];
899
984
  for (const [source3, [value, is_derived]] of this.current) {
@@ -907,13 +992,22 @@ class Batch {
907
992
  }
908
993
  sources.push(source3);
909
994
  }
910
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
995
+ if (is_earlier) {
996
+ for (const [effect, deferred2] of this.async_deriveds) {
997
+ const d = batch.async_deriveds.get(effect);
998
+ if (d)
999
+ deferred2.promise.then(d.resolve).catch(d.reject);
1000
+ }
1001
+ }
1002
+ if (!batch.#started)
1003
+ continue;
1004
+ var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
911
1005
  if (others.length === 0) {
912
1006
  if (is_earlier) {
913
1007
  batch.discard();
914
1008
  }
915
1009
  } else if (sources.length > 0) {
916
- if (true_default) {
1010
+ if (true_default && !batch.#decrement_queued) {
917
1011
  invariant(batch.#roots.length === 0, "Batch has scheduled roots");
918
1012
  }
919
1013
  if (is_earlier) {
@@ -934,18 +1028,25 @@ class Batch {
934
1028
  mark_effects(source2, others, marked, checked);
935
1029
  }
936
1030
  checked = new Map;
937
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
938
- for (const effect of this.#new_effects) {
939
- if ((effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect, current_unequal, checked)) {
940
- if ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
941
- set_signal_status(effect, DIRTY);
942
- batch.schedule(effect);
943
- } else {
944
- batch.#dirty_effects.add(effect);
1031
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1032
+ const v2 = this.current.get(c);
1033
+ if (!v2)
1034
+ return true;
1035
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1036
+ }).map(([c]) => c);
1037
+ if (current_unequal.length > 0) {
1038
+ for (const effect of this.#new_effects) {
1039
+ if ((effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect, current_unequal, checked)) {
1040
+ if ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
1041
+ set_signal_status(effect, DIRTY);
1042
+ batch.schedule(effect);
1043
+ } else {
1044
+ batch.#dirty_effects.add(effect);
1045
+ }
945
1046
  }
946
1047
  }
947
1048
  }
948
- if (batch.#roots.length > 0) {
1049
+ if (batch.#roots.length > 0 && !batch.#decrement_queued) {
949
1050
  batch.apply();
950
1051
  for (var root of batch.#roots) {
951
1052
  batch.#traverse(root, [], []);
@@ -955,31 +1056,16 @@ class Batch {
955
1056
  batch.deactivate();
956
1057
  }
957
1058
  }
958
- for (const batch of batches) {
959
- if (batch.#blockers.has(this)) {
960
- batch.#blockers.delete(this);
961
- if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
962
- batch.activate();
963
- batch.#process();
964
- }
965
- }
966
- }
967
1059
  }
968
1060
  increment(blocking, effect) {
969
- let pending_count = this.#pending.get(effect) ?? 0;
970
- this.#pending.set(effect, pending_count + 1);
1061
+ this.#pending += 1;
971
1062
  if (blocking) {
972
1063
  let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
973
1064
  this.#blocking_pending.set(effect, blocking_pending_count + 1);
974
1065
  }
975
1066
  }
976
- decrement(blocking, effect, skip) {
977
- let pending_count = this.#pending.get(effect) ?? 0;
978
- if (pending_count === 1) {
979
- this.#pending.delete(effect);
980
- } else {
981
- this.#pending.set(effect, pending_count - 1);
982
- }
1067
+ decrement(blocking, effect) {
1068
+ this.#pending -= 1;
983
1069
  if (blocking) {
984
1070
  let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
985
1071
  if (blocking_pending_count === 1) {
@@ -988,12 +1074,14 @@ class Batch {
988
1074
  this.#blocking_pending.set(effect, blocking_pending_count - 1);
989
1075
  }
990
1076
  }
991
- if (this.#decrement_queued || skip)
1077
+ if (this.#decrement_queued)
992
1078
  return;
993
1079
  this.#decrement_queued = true;
994
1080
  queue_micro_task(() => {
995
1081
  this.#decrement_queued = false;
996
- this.flush();
1082
+ if (this.linked) {
1083
+ this.flush();
1084
+ }
997
1085
  });
998
1086
  }
999
1087
  transfer_effects(dirty_effects, maybe_dirty_effects) {
@@ -1012,36 +1100,24 @@ class Batch {
1012
1100
  ondiscard(fn) {
1013
1101
  this.#discard_callbacks.add(fn);
1014
1102
  }
1015
- on_fork_commit(fn) {
1016
- this.#fork_commit_callbacks.add(fn);
1017
- }
1018
- run_fork_commit_callbacks() {
1019
- for (const fn of this.#fork_commit_callbacks)
1020
- fn(this);
1021
- this.#fork_commit_callbacks.clear();
1022
- }
1023
1103
  settled() {
1024
1104
  return (this.#deferred ??= deferred()).promise;
1025
1105
  }
1026
1106
  static ensure() {
1027
1107
  if (current_batch === null) {
1028
1108
  const batch = current_batch = new Batch;
1029
- if (!is_processing) {
1030
- batches.add(current_batch);
1031
- if (!is_flushing_sync) {
1032
- queue_micro_task(() => {
1033
- if (current_batch !== batch) {
1034
- return;
1035
- }
1109
+ if (!is_processing && !is_flushing_sync) {
1110
+ queue_micro_task(() => {
1111
+ if (!batch.#started) {
1036
1112
  batch.flush();
1037
- });
1038
- }
1113
+ }
1114
+ });
1039
1115
  }
1040
1116
  }
1041
1117
  return current_batch;
1042
1118
  }
1043
1119
  apply() {
1044
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
1120
+ if (!async_mode_flag || !this.is_fork && this.#prev === null && this.#next === null) {
1045
1121
  batch_values = null;
1046
1122
  return;
1047
1123
  }
@@ -1049,22 +1125,21 @@ class Batch {
1049
1125
  for (const [source2, [value]] of this.current) {
1050
1126
  batch_values.set(source2, value);
1051
1127
  }
1052
- for (const batch of batches) {
1128
+ for (let batch = first_batch;batch !== null; batch = batch.#next) {
1053
1129
  if (batch === this || batch.is_fork)
1054
1130
  continue;
1055
1131
  var intersects = false;
1056
- var differs = false;
1057
1132
  if (batch.id < this.id) {
1058
1133
  for (const [source2, [, is_derived]] of batch.current) {
1059
1134
  if (is_derived)
1060
1135
  continue;
1061
- intersects ||= this.current.has(source2);
1062
- differs ||= !this.current.has(source2);
1136
+ if (this.current.has(source2)) {
1137
+ intersects = true;
1138
+ break;
1139
+ }
1063
1140
  }
1064
1141
  }
1065
- if (intersects && differs) {
1066
- this.#blockers.add(batch);
1067
- } else {
1142
+ if (!intersects) {
1068
1143
  for (const [source2, previous] of batch.previous) {
1069
1144
  if (!batch_values.has(source2)) {
1070
1145
  batch_values.set(source2, previous);
@@ -1099,6 +1174,23 @@ class Batch {
1099
1174
  }
1100
1175
  this.#roots.push(e);
1101
1176
  }
1177
+ #unlink() {
1178
+ if (!this.linked)
1179
+ return;
1180
+ var prev = this.#prev;
1181
+ var next2 = this.#next;
1182
+ if (prev === null) {
1183
+ first_batch = next2;
1184
+ } else {
1185
+ prev.#next = next2;
1186
+ }
1187
+ if (next2 === null) {
1188
+ last_batch = prev;
1189
+ } else {
1190
+ next2.#prev = prev;
1191
+ }
1192
+ this.linked = false;
1193
+ }
1102
1194
  }
1103
1195
  function flushSync(fn) {
1104
1196
  var was_flushing_sync = is_flushing_sync;
@@ -1228,6 +1320,7 @@ function depends_on(reaction, sources, checked) {
1228
1320
  function schedule_effect(effect) {
1229
1321
  current_batch.schedule(effect);
1230
1322
  }
1323
+ var version_map = new Map;
1231
1324
  function reset_branch(effect, tracked) {
1232
1325
  if ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {
1233
1326
  return;
@@ -1253,7 +1346,7 @@ function reset_all(effect) {
1253
1346
  }
1254
1347
  }
1255
1348
 
1256
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/reactivity/create-subscriber.js
1349
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/reactivity/create-subscriber.js
1257
1350
  function createSubscriber(start) {
1258
1351
  let subscribers = 0;
1259
1352
  let version = source(0);
@@ -1284,7 +1377,7 @@ function createSubscriber(start) {
1284
1377
  };
1285
1378
  }
1286
1379
 
1287
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1380
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1288
1381
  var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1289
1382
  function boundary(node, props, children, transform_error) {
1290
1383
  new Boundary(node, props, children, transform_error);
@@ -1490,7 +1583,7 @@ class Boundary {
1490
1583
  current_batch.skip_effect(this.#pending_effect);
1491
1584
  if (this.#failed_effect)
1492
1585
  current_batch.skip_effect(this.#failed_effect);
1493
- current_batch.on_fork_commit(() => {
1586
+ current_batch.oncommit(() => {
1494
1587
  this.#handle_error(error);
1495
1588
  });
1496
1589
  } else {
@@ -1578,7 +1671,7 @@ class Boundary {
1578
1671
  }
1579
1672
  }
1580
1673
 
1581
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/async.js
1674
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/async.js
1582
1675
  function flatten(blockers, sync, async, fn) {
1583
1676
  const d = is_runes() ? derived : derived_safe_equal;
1584
1677
  var pending = blockers.filter((b) => !b.settled);
@@ -1590,23 +1683,24 @@ function flatten(blockers, sync, async, fn) {
1590
1683
  var restore = capture();
1591
1684
  var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1592
1685
  function finish(values) {
1686
+ if ((parent.f & DESTROYED) !== 0) {
1687
+ return;
1688
+ }
1593
1689
  restore();
1594
1690
  try {
1595
1691
  fn(values);
1596
1692
  } catch (error) {
1597
- if ((parent.f & DESTROYED) === 0) {
1598
- invoke_error_boundary(error, parent);
1599
- }
1693
+ invoke_error_boundary(error, parent);
1600
1694
  }
1601
1695
  unset_context();
1602
1696
  }
1697
+ var decrement_pending = increment_pending();
1603
1698
  if (async.length === 0) {
1604
- blocker_promise.then(() => finish(sync.map(d)));
1699
+ blocker_promise.then(() => finish(sync.map(d))).finally(decrement_pending);
1605
1700
  return;
1606
1701
  }
1607
- var decrement_pending = increment_pending();
1608
1702
  function run() {
1609
- Promise.all(async.map((expression) => async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1703
+ Promise.all(async.map((expression) => async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
1610
1704
  }
1611
1705
  if (blocker_promise) {
1612
1706
  blocker_promise.then(() => {
@@ -1655,16 +1749,16 @@ function increment_pending() {
1655
1749
  var effect = active_effect;
1656
1750
  var boundary2 = effect.b;
1657
1751
  var batch = current_batch;
1658
- var blocking = boundary2.is_rendered();
1659
- boundary2.update_pending_count(1, batch);
1752
+ var blocking = !!boundary2?.is_rendered();
1753
+ boundary2?.update_pending_count(1, batch);
1660
1754
  batch.increment(blocking, effect);
1661
- return (skip = false) => {
1662
- boundary2.update_pending_count(-1, batch);
1663
- batch.decrement(blocking, effect, skip);
1755
+ return () => {
1756
+ boundary2?.update_pending_count(-1, batch);
1757
+ batch.decrement(blocking, effect);
1664
1758
  };
1665
1759
  }
1666
1760
 
1667
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/deriveds.js
1761
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/deriveds.js
1668
1762
  var reactivity_loss_tracker = null;
1669
1763
  function set_reactivity_loss_tracker(v) {
1670
1764
  reactivity_loss_tracker = v;
@@ -1694,6 +1788,7 @@ function derived(fn) {
1694
1788
  }
1695
1789
  return signal;
1696
1790
  }
1791
+ var OBSOLETE = Symbol("obsolete");
1697
1792
  function async_derived(fn, label, location) {
1698
1793
  let parent = active_effect;
1699
1794
  if (parent === null) {
@@ -1702,9 +1797,9 @@ function async_derived(fn, label, location) {
1702
1797
  var promise = undefined;
1703
1798
  var signal = source(UNINITIALIZED);
1704
1799
  if (true_default)
1705
- signal.label = label;
1800
+ signal.label = label ?? fn.toString();
1706
1801
  var should_suspend = !active_reaction;
1707
- var deferreds = new Map;
1802
+ var deferreds = new Set;
1708
1803
  async_effect(() => {
1709
1804
  var effect = active_effect;
1710
1805
  if (true_default) {
@@ -1713,7 +1808,10 @@ function async_derived(fn, label, location) {
1713
1808
  var d = deferred();
1714
1809
  promise = d.promise;
1715
1810
  try {
1716
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1811
+ Promise.resolve(fn()).then(d.resolve, (e) => {
1812
+ if (e !== STALE_REACTION)
1813
+ d.reject(e);
1814
+ }).finally(unset_context);
1717
1815
  } catch (error) {
1718
1816
  d.reject(error);
1719
1817
  unset_context();
@@ -1738,28 +1836,24 @@ function async_derived(fn, label, location) {
1738
1836
  if ((effect.f & REACTION_RAN) !== 0) {
1739
1837
  var decrement_pending = increment_pending();
1740
1838
  }
1741
- if (parent.b.is_rendered()) {
1742
- deferreds.get(batch)?.reject(STALE_REACTION);
1743
- deferreds.delete(batch);
1839
+ if (parent.b?.is_rendered()) {
1840
+ batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1744
1841
  } else {
1745
1842
  for (const d2 of deferreds.values()) {
1746
- d2.reject(STALE_REACTION);
1843
+ d2.reject(OBSOLETE);
1747
1844
  }
1748
- deferreds.clear();
1749
1845
  }
1750
- deferreds.set(batch, d);
1846
+ deferreds.add(d);
1847
+ batch.async_deriveds.set(effect, d);
1751
1848
  }
1752
1849
  const handler = (value, error = undefined) => {
1753
1850
  if (true_default) {
1754
1851
  reactivity_loss_tracker = null;
1755
1852
  }
1756
- if (decrement_pending) {
1757
- var skip = error === STALE_REACTION;
1758
- decrement_pending(skip);
1759
- }
1760
- if (error === STALE_REACTION || (effect.f & DESTROYED) !== 0) {
1853
+ decrement_pending?.();
1854
+ deferreds.delete(d);
1855
+ if (error === OBSOLETE)
1761
1856
  return;
1762
- }
1763
1857
  batch.activate();
1764
1858
  if (error) {
1765
1859
  signal.f |= ERROR_VALUE;
@@ -1768,30 +1862,24 @@ function async_derived(fn, label, location) {
1768
1862
  if ((signal.f & ERROR_VALUE) !== 0) {
1769
1863
  signal.f ^= ERROR_VALUE;
1770
1864
  }
1771
- internal_set(signal, value);
1772
- for (const [b, d2] of deferreds) {
1773
- deferreds.delete(b);
1774
- if (b === batch)
1775
- break;
1776
- d2.reject(STALE_REACTION);
1777
- }
1778
- if (true_default && location !== undefined) {
1865
+ if (true_default && location !== undefined && !signal.equals(value)) {
1779
1866
  recent_async_deriveds.add(signal);
1780
1867
  setTimeout(() => {
1781
- if (recent_async_deriveds.has(signal)) {
1868
+ if (recent_async_deriveds.has(signal) && (effect.f & DESTROYED) === 0) {
1782
1869
  await_waterfall(signal.label, location);
1783
1870
  recent_async_deriveds.delete(signal);
1784
1871
  }
1785
1872
  });
1786
1873
  }
1874
+ internal_set(signal, value);
1787
1875
  }
1788
1876
  batch.deactivate();
1789
1877
  };
1790
1878
  d.promise.then(handler, (e) => handler(null, e || "unknown"));
1791
1879
  });
1792
1880
  teardown(() => {
1793
- for (const d of deferreds.values()) {
1794
- d.reject(STALE_REACTION);
1881
+ for (const d of deferreds) {
1882
+ d.reject(OBSOLETE);
1795
1883
  }
1796
1884
  });
1797
1885
  if (true_default) {
@@ -1830,7 +1918,7 @@ function execute_derived(derived2) {
1830
1918
  var value;
1831
1919
  var prev_active_effect = active_effect;
1832
1920
  var parent = derived2.parent;
1833
- if (!is_destroying_effect && parent !== null && (parent.f & (DESTROYED | INERT)) !== 0) {
1921
+ if (!is_destroying_effect && parent !== null && derived2.v !== UNINITIALIZED && (parent.f & (DESTROYED | INERT)) !== 0) {
1834
1922
  derived_inert();
1835
1923
  return derived2.v;
1836
1924
  }
@@ -1869,6 +1957,7 @@ function update_derived(derived2) {
1869
1957
  if (!current_batch?.is_fork || derived2.deps === null) {
1870
1958
  if (current_batch !== null) {
1871
1959
  current_batch.capture(derived2, value, true);
1960
+ previous_batch?.capture(derived2, value, true);
1872
1961
  } else {
1873
1962
  derived2.v = value;
1874
1963
  }
@@ -1896,7 +1985,8 @@ function freeze_derived_effects(derived2) {
1896
1985
  if (e.teardown || e.ac) {
1897
1986
  e.teardown?.();
1898
1987
  e.ac?.abort(STALE_REACTION);
1899
- e.teardown = noop;
1988
+ if (e.fn !== null)
1989
+ e.teardown = noop;
1900
1990
  e.ac = null;
1901
1991
  remove_reactions(e, 0);
1902
1992
  destroy_effect_children(e);
@@ -1907,13 +1997,13 @@ function unfreeze_derived_effects(derived2) {
1907
1997
  if (derived2.effects === null)
1908
1998
  return;
1909
1999
  for (const e of derived2.effects) {
1910
- if (e.teardown) {
2000
+ if (e.teardown && e.fn !== null) {
1911
2001
  update_effect(e);
1912
2002
  }
1913
2003
  }
1914
2004
  }
1915
2005
 
1916
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/sources.js
2006
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1917
2007
  var eager_effects = new Set;
1918
2008
  var old_values = new Map;
1919
2009
  function set_eager_effects(v) {
@@ -1956,7 +2046,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
1956
2046
  return s;
1957
2047
  }
1958
2048
  function set(source2, value, should_proxy = false) {
1959
- if (active_reaction !== null && (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
2049
+ if (active_reaction !== null && (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !current_sources.has(source2))) {
1960
2050
  state_unsafe_mutation();
1961
2051
  }
1962
2052
  let new_value = should_proxy ? proxy(value) : value;
@@ -2021,7 +2111,13 @@ function flush_eager_effects() {
2021
2111
  if ((effect.f & CLEAN) !== 0) {
2022
2112
  set_signal_status(effect, MAYBE_DIRTY);
2023
2113
  }
2024
- if (is_dirty(effect)) {
2114
+ let dirty;
2115
+ try {
2116
+ dirty = is_dirty(effect);
2117
+ } catch {
2118
+ dirty = true;
2119
+ }
2120
+ if (dirty) {
2025
2121
  update_effect(effect);
2026
2122
  }
2027
2123
  }
@@ -2041,19 +2137,17 @@ function mark_reactions(signal, status, updated_during_traversal) {
2041
2137
  var flags2 = reaction.f;
2042
2138
  if (!runes && reaction === active_effect)
2043
2139
  continue;
2044
- if (true_default && (flags2 & EAGER_EFFECT) !== 0) {
2045
- eager_effects.add(reaction);
2046
- continue;
2047
- }
2048
2140
  var not_dirty = (flags2 & DIRTY) === 0;
2049
2141
  if (not_dirty) {
2050
2142
  set_signal_status(reaction, status);
2051
2143
  }
2052
- if ((flags2 & DERIVED) !== 0) {
2144
+ if ((flags2 & EAGER_EFFECT) !== 0) {
2145
+ eager_effects.add(reaction);
2146
+ } else if ((flags2 & DERIVED) !== 0) {
2053
2147
  var derived2 = reaction;
2054
2148
  batch_values?.delete(derived2);
2055
2149
  if ((flags2 & WAS_MARKED) === 0) {
2056
- if (flags2 & CONNECTED) {
2150
+ if (flags2 & CONNECTED && (active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)) {
2057
2151
  reaction.f |= WAS_MARKED;
2058
2152
  }
2059
2153
  mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
@@ -2072,7 +2166,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
2072
2166
  }
2073
2167
  }
2074
2168
 
2075
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/proxy.js
2169
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/proxy.js
2076
2170
  var regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
2077
2171
  function proxy(value) {
2078
2172
  if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
@@ -2335,7 +2429,7 @@ function inspectable_array(array) {
2335
2429
  });
2336
2430
  }
2337
2431
 
2338
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/equality.js
2432
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/equality.js
2339
2433
  function init_array_prototype_warnings() {
2340
2434
  const array_prototype2 = Array.prototype;
2341
2435
  const cleanup = Array.__svelte_cleanup;
@@ -2386,7 +2480,7 @@ function init_array_prototype_warnings() {
2386
2480
  };
2387
2481
  }
2388
2482
 
2389
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/operations.js
2483
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/operations.js
2390
2484
  var $window;
2391
2485
  var $document;
2392
2486
  var is_firefox;
@@ -2405,14 +2499,13 @@ function init_operations() {
2405
2499
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2406
2500
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2407
2501
  if (is_extensible(element_prototype)) {
2408
- element_prototype.__click = undefined;
2409
- element_prototype.__className = undefined;
2410
- element_prototype.__attributes = null;
2411
- element_prototype.__style = undefined;
2502
+ element_prototype[CLASS_CACHE] = undefined;
2503
+ element_prototype[ATTRIBUTES_CACHE] = null;
2504
+ element_prototype[STYLE_CACHE] = undefined;
2412
2505
  element_prototype.__e = undefined;
2413
2506
  }
2414
2507
  if (is_extensible(text_prototype)) {
2415
- text_prototype.__t = undefined;
2508
+ text_prototype[TEXT_CACHE] = undefined;
2416
2509
  }
2417
2510
  if (true_default) {
2418
2511
  element_prototype.__svelte_meta = null;
@@ -2440,11 +2533,13 @@ function should_defer_append() {
2440
2533
  return (flags2 & REACTION_RAN) !== 0;
2441
2534
  }
2442
2535
  function create_element(tag2, namespace, is) {
2443
- let options = is ? { is } : undefined;
2444
- return document.createElementNS(namespace ?? NAMESPACE_HTML, tag2, options);
2536
+ if (namespace == null || namespace === NAMESPACE_HTML) {
2537
+ return is ? document.createElement(tag2, { is }) : document.createElement(tag2);
2538
+ }
2539
+ return is ? document.createElementNS(namespace, tag2, { is }) : document.createElementNS(namespace, tag2);
2445
2540
  }
2446
2541
 
2447
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2542
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2448
2543
  function without_reactive_context(fn) {
2449
2544
  var previous_reaction = active_reaction;
2450
2545
  var previous_effect = active_effect;
@@ -2458,7 +2553,7 @@ function without_reactive_context(fn) {
2458
2553
  }
2459
2554
  }
2460
2555
 
2461
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/effects.js
2556
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/effects.js
2462
2557
  function push_effect(effect, parent_effect) {
2463
2558
  var parent_last = parent_effect.last;
2464
2559
  if (parent_last === null) {
@@ -2762,10 +2857,10 @@ function move_effect(effect, fragment) {
2762
2857
  }
2763
2858
  }
2764
2859
 
2765
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/legacy.js
2860
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/legacy.js
2766
2861
  var captured_signals = null;
2767
2862
 
2768
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/runtime.js
2863
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/runtime.js
2769
2864
  var is_updating_effect = false;
2770
2865
  var is_destroying_effect = false;
2771
2866
  function set_is_destroying_effect(value) {
@@ -2783,11 +2878,7 @@ function set_active_effect(effect) {
2783
2878
  var current_sources = null;
2784
2879
  function push_reaction_value(value) {
2785
2880
  if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {
2786
- if (current_sources === null) {
2787
- current_sources = [value];
2788
- } else {
2789
- current_sources.push(value);
2790
- }
2881
+ (current_sources ??= new Set).add(value);
2791
2882
  }
2792
2883
  }
2793
2884
  var new_deps = null;
@@ -2835,7 +2926,7 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
2835
2926
  var reactions = signal.reactions;
2836
2927
  if (reactions === null)
2837
2928
  return;
2838
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) {
2929
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) {
2839
2930
  return;
2840
2931
  }
2841
2932
  for (var i = 0;i < reactions.length; i++) {
@@ -3032,7 +3123,7 @@ function get2(signal) {
3032
3123
  captured_signals?.add(signal);
3033
3124
  if (active_reaction !== null && !untracking) {
3034
3125
  var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
3035
- if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
3126
+ if (!destroyed && (current_sources === null || !current_sources.has(signal))) {
3036
3127
  var deps = active_reaction.deps;
3037
3128
  if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
3038
3129
  if (signal.rv < read_version) {
@@ -3046,7 +3137,10 @@ function get2(signal) {
3046
3137
  }
3047
3138
  }
3048
3139
  } else {
3049
- (active_reaction.deps ??= []).push(signal);
3140
+ active_reaction.deps ??= [];
3141
+ if (!includes.call(active_reaction.deps, signal)) {
3142
+ active_reaction.deps.push(signal);
3143
+ }
3050
3144
  var reactions = signal.reactions;
3051
3145
  if (reactions === null) {
3052
3146
  signal.reactions = [active_reaction];
@@ -3154,7 +3248,7 @@ function untrack(fn) {
3154
3248
  untracking = previous_untracking;
3155
3249
  }
3156
3250
  }
3157
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/events.js
3251
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/events.js
3158
3252
  var event_symbol = Symbol("events");
3159
3253
  var all_registered_events = new Set;
3160
3254
  var root_event_handles = new Set;
@@ -3199,7 +3293,8 @@ function handle_event_propagation(event) {
3199
3293
  var throw_error;
3200
3294
  var other_errors = [];
3201
3295
  while (current_target !== null) {
3202
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3296
+ if (current_target === handler_element)
3297
+ break;
3203
3298
  try {
3204
3299
  var delegated = current_target[event_symbol]?.[event_name];
3205
3300
  if (delegated != null && (!current_target.disabled || event.target === current_target)) {
@@ -3212,10 +3307,10 @@ function handle_event_propagation(event) {
3212
3307
  throw_error = error;
3213
3308
  }
3214
3309
  }
3215
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
3310
+ if (event.cancelBubble)
3216
3311
  break;
3217
- }
3218
- current_target = parent_element;
3312
+ path_idx++;
3313
+ current_target = path_idx < path.length ? path[path_idx] : null;
3219
3314
  }
3220
3315
  if (throw_error) {
3221
3316
  for (let error of other_errors) {
@@ -3233,7 +3328,7 @@ function handle_event_propagation(event) {
3233
3328
  }
3234
3329
  }
3235
3330
 
3236
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/reconciler.js
3331
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/reconciler.js
3237
3332
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3238
3333
  createHTML: (html) => {
3239
3334
  return html;
@@ -3248,7 +3343,7 @@ function create_fragment_from_html(html) {
3248
3343
  return elem.content;
3249
3344
  }
3250
3345
 
3251
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/template.js
3346
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/template.js
3252
3347
  function assign_nodes(start, end) {
3253
3348
  var effect = active_effect;
3254
3349
  if (effect.nodes === null) {
@@ -3296,7 +3391,7 @@ function append(anchor, dom) {
3296
3391
  anchor.before(dom);
3297
3392
  }
3298
3393
 
3299
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/utils.js
3394
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/utils.js
3300
3395
  var DOM_BOOLEAN_ATTRIBUTES = [
3301
3396
  "allowfullscreen",
3302
3397
  "async",
@@ -3372,7 +3467,7 @@ var RUNES = [
3372
3467
  "$host"
3373
3468
  ];
3374
3469
 
3375
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/render.js
3470
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/render.js
3376
3471
  var should_intro = true;
3377
3472
  function mount(component, options) {
3378
3473
  return _mount(component, options);
@@ -3514,7 +3609,7 @@ function unmount(component, options) {
3514
3609
  }
3515
3610
  return Promise.resolve();
3516
3611
  }
3517
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3612
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3518
3613
  class BranchManager {
3519
3614
  anchor;
3520
3615
  #batches = new Map;
@@ -3537,6 +3632,7 @@ class BranchManager {
3537
3632
  } else {
3538
3633
  var offscreen = this.#offscreen.get(key);
3539
3634
  if (offscreen) {
3635
+ resume_effect(offscreen.effect);
3540
3636
  this.#onscreen.set(key, offscreen.effect);
3541
3637
  this.#offscreen.delete(key);
3542
3638
  if (true_default) {
@@ -3635,7 +3731,7 @@ class BranchManager {
3635
3731
  }
3636
3732
  }
3637
3733
 
3638
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/index-client.js
3734
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/index-client.js
3639
3735
  if (true_default) {
3640
3736
  let throw_rune_error = function(rune) {
3641
3737
  if (!(rune in globalThis)) {
@@ -3661,18 +3757,18 @@ if (true_default) {
3661
3757
  throw_rune_error("$props");
3662
3758
  throw_rune_error("$bindable");
3663
3759
  }
3664
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/css.js
3760
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/css.js
3665
3761
  var all_styles = new Map;
3666
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/key.js
3762
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/key.js
3667
3763
  var NAN = Symbol("NaN");
3668
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/timing.js
3764
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/timing.js
3669
3765
  var now = true_default ? () => performance.now() : () => Date.now();
3670
3766
  var raf = {
3671
3767
  tick: (_) => (true_default ? requestAnimationFrame : noop)(_),
3672
3768
  now: () => now(),
3673
3769
  tasks: new Set
3674
3770
  };
3675
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/attributes.js
3771
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/attributes.js
3676
3772
  var replacements = {
3677
3773
  translate: new Map([
3678
3774
  [true, "yes"],
@@ -3682,7 +3778,7 @@ var replacements = {
3682
3778
  var whitespace = [...`
3683
3779
  \r\f \v\uFEFF`];
3684
3780
 
3685
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/attributes.js
3781
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
3686
3782
  var CLASS = Symbol("class");
3687
3783
  var STYLE = Symbol("style");
3688
3784
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
@@ -3736,7 +3832,7 @@ function set_custom_element_data(node, prop, value) {
3736
3832
  }
3737
3833
  }
3738
3834
  function get_attributes(element) {
3739
- return element.__attributes ??= {
3835
+ return element[ATTRIBUTES_CACHE] ??= {
3740
3836
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
3741
3837
  [IS_HTML]: element.namespaceURI === NAMESPACE_HTML
3742
3838
  };
@@ -3754,7 +3850,7 @@ function get_setters(element) {
3754
3850
  while (element_proto !== proto) {
3755
3851
  descriptors = get_descriptors(proto);
3756
3852
  for (var key in descriptors) {
3757
- if (descriptors[key].set) {
3853
+ if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") {
3758
3854
  setters.push(key);
3759
3855
  }
3760
3856
  }
@@ -3784,9 +3880,9 @@ function srcset_url_equal(element, srcset) {
3784
3880
  var urls = split_srcset(srcset);
3785
3881
  return urls.length === element_urls.length && urls.every(([url, width], i) => width === element_urls[i][1] && (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0])));
3786
3882
  }
3787
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
3883
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
3788
3884
  var pending = new Set;
3789
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3885
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3790
3886
  class ResizeObserverSingleton {
3791
3887
  #listeners = new WeakMap;
3792
3888
  #observer;
@@ -3820,14 +3916,19 @@ class ResizeObserverSingleton {
3820
3916
  }));
3821
3917
  }
3822
3918
  }
3823
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/props.js
3919
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/props.js
3824
3920
  function prop(props, key, flags2, fallback) {
3825
3921
  var runes = !legacy_mode_flag || (flags2 & PROPS_IS_RUNES) !== 0;
3826
3922
  var bindable = (flags2 & PROPS_IS_BINDABLE) !== 0;
3827
3923
  var lazy = (flags2 & PROPS_IS_LAZY_INITIAL) !== 0;
3828
3924
  var fallback_value = fallback;
3829
3925
  var fallback_dirty = true;
3926
+ var fallback_signal = undefined;
3830
3927
  var get_fallback = () => {
3928
+ if (lazy && runes) {
3929
+ fallback_signal ??= derived(fallback);
3930
+ return get2(fallback_signal);
3931
+ }
3831
3932
  if (fallback_dirty) {
3832
3933
  fallback_dirty = false;
3833
3934
  fallback_value = lazy ? untrack(fallback) : fallback;
@@ -3914,7 +4015,7 @@ function prop(props, key, flags2, fallback) {
3914
4015
  return get2(d);
3915
4016
  };
3916
4017
  }
3917
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/legacy/legacy-client.js
4018
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/legacy/legacy-client.js
3918
4019
  function createClassComponent(options) {
3919
4020
  return new Svelte4Component(options);
3920
4021
  }
@@ -3992,7 +4093,7 @@ class Svelte4Component {
3992
4093
  }
3993
4094
  }
3994
4095
 
3995
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4096
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3996
4097
  var SvelteElement;
3997
4098
  if (typeof HTMLElement === "function") {
3998
4099
  SvelteElement = class extends HTMLElement {
@@ -4215,7 +4316,11 @@ function create_custom_element(Component, props_definition, slots, exports, shad
4215
4316
  import { ContextConsumer } from "@pie-players/pie-context";
4216
4317
  import { createContext as createContext2 } from "@pie-players/pie-context";
4217
4318
  import { sanitizeSvgIcon } from "@pie-players/pie-players-shared/security";
4218
- import { createFocusTrap } from "@pie-players/pie-players-shared";
4319
+ import {
4320
+ createFocusTrap,
4321
+ FOCUSABLE_SELECTOR,
4322
+ isProgrammaticFocusTarget
4323
+ } from "@pie-players/pie-players-shared";
4219
4324
  import { validateCustomElementTag } from "@pie-players/pie-players-shared/pie/tag-names";
4220
4325
  var PUBLIC_VERSION2 = "5";
4221
4326
  if (typeof window !== "undefined") {
@@ -4244,7 +4349,7 @@ var HYDRATION_END2 = "]";
4244
4349
  var HYDRATION_ERROR2 = {};
4245
4350
  var ELEMENT_PRESERVE_ATTRIBUTE_CASE2 = 1 << 1;
4246
4351
  var ELEMENT_IS_INPUT2 = 1 << 2;
4247
- var UNINITIALIZED2 = Symbol();
4352
+ var UNINITIALIZED2 = Symbol("uninitialized");
4248
4353
  var FILENAME2 = Symbol("filename");
4249
4354
  var HMR2 = Symbol("hmr");
4250
4355
  var NAMESPACE_HTML2 = "http://www.w3.org/1999/xhtml";
@@ -4308,6 +4413,11 @@ var STATE_SYMBOL2 = Symbol("$state");
4308
4413
  var LEGACY_PROPS2 = Symbol("legacy props");
4309
4414
  var LOADING_ATTR_SYMBOL2 = Symbol("");
4310
4415
  var PROXY_PATH_SYMBOL2 = Symbol("proxy path");
4416
+ var ATTRIBUTES_CACHE2 = Symbol("attributes");
4417
+ var CLASS_CACHE2 = Symbol("class");
4418
+ var STYLE_CACHE2 = Symbol("style");
4419
+ var TEXT_CACHE2 = Symbol("text");
4420
+ var FORM_RESET_HANDLER2 = Symbol("form reset");
4311
4421
  var HMR_ANCHOR2 = Symbol("hmr anchor");
4312
4422
  var STALE_REACTION2 = new class StaleReactionError2 extends Error {
4313
4423
  name = "StaleReactionError";
@@ -4892,7 +5002,7 @@ function defer_effect2(effect2, dirty_effects, maybe_dirty_effects) {
4892
5002
  }
4893
5003
  var legacy_is_updating_store2 = false;
4894
5004
  var is_store_binding2 = false;
4895
- var IS_UNMOUNTED2 = Symbol();
5005
+ var IS_UNMOUNTED2 = Symbol("unmounted");
4896
5006
  function capture_store_binding2(fn) {
4897
5007
  var previous_is_store_binding = is_store_binding2;
4898
5008
  try {
@@ -4902,7 +5012,8 @@ function capture_store_binding2(fn) {
4902
5012
  is_store_binding2 = previous_is_store_binding;
4903
5013
  }
4904
5014
  }
4905
- var batches2 = new Set;
5015
+ var first_batch2 = null;
5016
+ var last_batch2 = null;
4906
5017
  var current_batch2 = null;
4907
5018
  var previous_batch2 = null;
4908
5019
  var batch_values2 = null;
@@ -4912,17 +5023,21 @@ var is_processing2 = false;
4912
5023
  var collected_effects2 = null;
4913
5024
  var legacy_updates2 = null;
4914
5025
  var flush_count2 = 0;
4915
- var source_stacks2 = true_default2 ? new Set : null;
5026
+ var source_stacks2 = new Set;
4916
5027
  var uid2 = 1;
4917
5028
 
4918
5029
  class Batch2 {
4919
5030
  id = uid2++;
5031
+ #started = false;
5032
+ linked = true;
5033
+ #prev = null;
5034
+ #next = null;
5035
+ async_deriveds = new Map;
4920
5036
  current = new Map;
4921
5037
  previous = new Map;
4922
5038
  #commit_callbacks = new Set;
4923
5039
  #discard_callbacks = new Set;
4924
- #fork_commit_callbacks = new Set;
4925
- #pending = new Map;
5040
+ #pending = 0;
4926
5041
  #blocking_pending = new Map;
4927
5042
  #deferred = null;
4928
5043
  #roots = [];
@@ -4933,25 +5048,30 @@ class Batch2 {
4933
5048
  #unskipped_branches = new Set;
4934
5049
  is_fork = false;
4935
5050
  #decrement_queued = false;
4936
- #blockers = new Set;
5051
+ constructor() {
5052
+ if (last_batch2 === null) {
5053
+ first_batch2 = last_batch2 = this;
5054
+ } else {
5055
+ last_batch2.#next = this;
5056
+ this.#prev = last_batch2;
5057
+ }
5058
+ last_batch2 = this;
5059
+ }
4937
5060
  #is_deferred() {
4938
- return this.is_fork || this.#blocking_pending.size > 0;
4939
- }
4940
- #is_blocked() {
4941
- for (const batch of this.#blockers) {
4942
- for (const effect2 of batch.#blocking_pending.keys()) {
4943
- var skipped = false;
4944
- var e = effect2;
4945
- while (e.parent !== null) {
4946
- if (this.#skipped_branches.has(e)) {
4947
- skipped = true;
4948
- break;
4949
- }
4950
- e = e.parent;
4951
- }
4952
- if (!skipped) {
4953
- return true;
5061
+ if (this.is_fork)
5062
+ return true;
5063
+ for (const effect2 of this.#blocking_pending.keys()) {
5064
+ var e = effect2;
5065
+ var skipped = false;
5066
+ while (e.parent !== null) {
5067
+ if (this.#skipped_branches.has(e)) {
5068
+ skipped = true;
5069
+ break;
4954
5070
  }
5071
+ e = e.parent;
5072
+ }
5073
+ if (!skipped) {
5074
+ return true;
4955
5075
  }
4956
5076
  }
4957
5077
  return false;
@@ -4978,21 +5098,25 @@ class Batch2 {
4978
5098
  this.#unskipped_branches.add(effect2);
4979
5099
  }
4980
5100
  #process() {
5101
+ this.#started = true;
4981
5102
  if (flush_count2++ > 1000) {
4982
- batches2.delete(this);
5103
+ this.#unlink();
4983
5104
  infinite_loop_guard2();
4984
5105
  }
4985
- if (!this.#is_deferred()) {
4986
- for (const e of this.#dirty_effects) {
4987
- this.#maybe_dirty_effects.delete(e);
4988
- set_signal_status2(e, DIRTY2);
4989
- this.schedule(e);
4990
- }
4991
- for (const e of this.#maybe_dirty_effects) {
4992
- set_signal_status2(e, MAYBE_DIRTY2);
4993
- this.schedule(e);
5106
+ if (true_default2) {
5107
+ for (const value of this.current.keys()) {
5108
+ source_stacks2.add(value);
4994
5109
  }
4995
5110
  }
5111
+ for (const e of this.#dirty_effects) {
5112
+ this.#maybe_dirty_effects.delete(e);
5113
+ set_signal_status2(e, DIRTY2);
5114
+ this.schedule(e);
5115
+ }
5116
+ for (const e of this.#maybe_dirty_effects) {
5117
+ set_signal_status2(e, MAYBE_DIRTY2);
5118
+ this.schedule(e);
5119
+ }
4996
5120
  const roots = this.#roots;
4997
5121
  this.#roots = [];
4998
5122
  this.apply();
@@ -5004,6 +5128,8 @@ class Batch2 {
5004
5128
  this.#traverse(root, effects, render_effects);
5005
5129
  } catch (e) {
5006
5130
  reset_all2(root);
5131
+ if (!this.#is_deferred())
5132
+ this.discard();
5007
5133
  throw e;
5008
5134
  }
5009
5135
  }
@@ -5016,44 +5142,53 @@ class Batch2 {
5016
5142
  }
5017
5143
  collected_effects2 = null;
5018
5144
  legacy_updates2 = null;
5019
- if (this.#is_deferred() || this.#is_blocked()) {
5145
+ if (this.#is_deferred()) {
5020
5146
  this.#defer_effects(render_effects);
5021
5147
  this.#defer_effects(effects);
5022
5148
  for (const [e, t] of this.#skipped_branches) {
5023
5149
  reset_branch2(e, t);
5024
5150
  }
5025
- } else {
5026
- if (this.#pending.size === 0) {
5027
- batches2.delete(this);
5028
- }
5029
- this.#dirty_effects.clear();
5030
- this.#maybe_dirty_effects.clear();
5031
- for (const fn of this.#commit_callbacks)
5032
- fn(this);
5033
- this.#commit_callbacks.clear();
5034
- previous_batch2 = this;
5035
- flush_queued_effects2(render_effects);
5036
- flush_queued_effects2(effects);
5037
- previous_batch2 = null;
5038
- this.#deferred?.resolve();
5151
+ if (updates.length > 0) {
5152
+ current_batch2.#process();
5153
+ }
5154
+ return;
5155
+ }
5156
+ const earlier_batch = this.#find_earlier_batch();
5157
+ if (earlier_batch) {
5158
+ this.#defer_effects(render_effects);
5159
+ this.#defer_effects(effects);
5160
+ earlier_batch.#merge(this);
5161
+ return;
5039
5162
  }
5163
+ this.#dirty_effects.clear();
5164
+ this.#maybe_dirty_effects.clear();
5165
+ for (const fn of this.#commit_callbacks)
5166
+ fn(this);
5167
+ this.#commit_callbacks.clear();
5168
+ previous_batch2 = this;
5169
+ flush_queued_effects2(render_effects);
5170
+ flush_queued_effects2(effects);
5171
+ previous_batch2 = null;
5172
+ this.#deferred?.resolve();
5040
5173
  var next_batch = current_batch2;
5174
+ if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
5175
+ this.#unlink();
5176
+ if (async_mode_flag2) {
5177
+ this.#commit();
5178
+ current_batch2 = next_batch;
5179
+ }
5180
+ }
5041
5181
  if (this.#roots.length > 0) {
5042
- const batch2 = next_batch ??= this;
5043
- batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
5182
+ if (next_batch !== null) {
5183
+ const batch2 = next_batch;
5184
+ batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
5185
+ } else {
5186
+ next_batch = this;
5187
+ }
5044
5188
  }
5045
5189
  if (next_batch !== null) {
5046
- batches2.add(next_batch);
5047
- if (true_default2) {
5048
- for (const source2 of this.current.keys()) {
5049
- source_stacks2.add(source2);
5050
- }
5051
- }
5052
5190
  next_batch.#process();
5053
5191
  }
5054
- if (async_mode_flag2 && !batches2.has(this)) {
5055
- this.#commit();
5056
- }
5057
5192
  }
5058
5193
  #traverse(root, effects, render_effects) {
5059
5194
  root.f ^= CLEAN2;
@@ -5091,6 +5226,59 @@ class Batch2 {
5091
5226
  }
5092
5227
  }
5093
5228
  }
5229
+ #find_earlier_batch() {
5230
+ var batch = this.#prev;
5231
+ while (batch !== null) {
5232
+ if (!batch.is_fork) {
5233
+ for (const [value, [, is_derived]] of this.current) {
5234
+ if (batch.current.has(value) && !is_derived) {
5235
+ return batch;
5236
+ }
5237
+ }
5238
+ }
5239
+ batch = batch.#prev;
5240
+ }
5241
+ return null;
5242
+ }
5243
+ #merge(batch) {
5244
+ for (const [source2, value] of batch.current) {
5245
+ if (!this.previous.has(source2) && batch.previous.has(source2)) {
5246
+ this.previous.set(source2, batch.previous.get(source2));
5247
+ }
5248
+ this.current.set(source2, value);
5249
+ }
5250
+ for (const [effect2, deferred22] of batch.async_deriveds) {
5251
+ const d = this.async_deriveds.get(effect2);
5252
+ if (d)
5253
+ deferred22.promise.then(d.resolve).catch(d.reject);
5254
+ }
5255
+ this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
5256
+ const mark = (value) => {
5257
+ var reactions = value.reactions;
5258
+ if (reactions === null)
5259
+ return;
5260
+ for (const reaction of reactions) {
5261
+ var flags2 = reaction.f;
5262
+ if ((flags2 & DERIVED2) !== 0) {
5263
+ mark(reaction);
5264
+ } else {
5265
+ var effect2 = reaction;
5266
+ if (flags2 & (ASYNC2 | BLOCK_EFFECT2) && !this.async_deriveds.has(effect2)) {
5267
+ this.#maybe_dirty_effects.delete(effect2);
5268
+ set_signal_status2(effect2, DIRTY2);
5269
+ this.schedule(effect2);
5270
+ }
5271
+ }
5272
+ }
5273
+ };
5274
+ for (const source2 of this.current.keys()) {
5275
+ mark(source2);
5276
+ }
5277
+ this.oncommit(() => batch.discard());
5278
+ batch.#unlink();
5279
+ current_batch2 = this;
5280
+ this.#process();
5281
+ }
5094
5282
  #defer_effects(effects) {
5095
5283
  for (var i = 0;i < effects.length; i += 1) {
5096
5284
  defer_effect2(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
@@ -5116,8 +5304,10 @@ class Batch2 {
5116
5304
  batch_values2 = null;
5117
5305
  }
5118
5306
  flush() {
5119
- var source_stacks22 = true_default2 ? new Set : null;
5120
5307
  try {
5308
+ if (true_default2) {
5309
+ source_stacks2.clear();
5310
+ }
5121
5311
  is_processing2 = true;
5122
5312
  current_batch2 = this;
5123
5313
  this.#process();
@@ -5131,7 +5321,7 @@ class Batch2 {
5131
5321
  batch_values2 = null;
5132
5322
  old_values2.clear();
5133
5323
  if (true_default2) {
5134
- for (const source2 of source_stacks22) {
5324
+ for (const source2 of source_stacks2) {
5135
5325
  source2.updated = null;
5136
5326
  }
5137
5327
  }
@@ -5141,14 +5331,14 @@ class Batch2 {
5141
5331
  for (const fn of this.#discard_callbacks)
5142
5332
  fn(this);
5143
5333
  this.#discard_callbacks.clear();
5144
- this.#fork_commit_callbacks.clear();
5145
- batches2.delete(this);
5334
+ this.#unlink();
5335
+ this.#deferred?.resolve();
5146
5336
  }
5147
5337
  register_created_effect(effect2) {
5148
5338
  this.#new_effects.push(effect2);
5149
5339
  }
5150
5340
  #commit() {
5151
- for (const batch of batches2) {
5341
+ for (let batch = first_batch2;batch !== null; batch = batch.#next) {
5152
5342
  var is_earlier = batch.id < this.id;
5153
5343
  var sources = [];
5154
5344
  for (const [source3, [value, is_derived]] of this.current) {
@@ -5162,13 +5352,22 @@ class Batch2 {
5162
5352
  }
5163
5353
  sources.push(source3);
5164
5354
  }
5165
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
5355
+ if (is_earlier) {
5356
+ for (const [effect2, deferred22] of this.async_deriveds) {
5357
+ const d = batch.async_deriveds.get(effect2);
5358
+ if (d)
5359
+ deferred22.promise.then(d.resolve).catch(d.reject);
5360
+ }
5361
+ }
5362
+ if (!batch.#started)
5363
+ continue;
5364
+ var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
5166
5365
  if (others.length === 0) {
5167
5366
  if (is_earlier) {
5168
5367
  batch.discard();
5169
5368
  }
5170
5369
  } else if (sources.length > 0) {
5171
- if (true_default2) {
5370
+ if (true_default2 && !batch.#decrement_queued) {
5172
5371
  invariant2(batch.#roots.length === 0, "Batch has scheduled roots");
5173
5372
  }
5174
5373
  if (is_earlier) {
@@ -5189,18 +5388,25 @@ class Batch2 {
5189
5388
  mark_effects2(source2, others, marked, checked);
5190
5389
  }
5191
5390
  checked = new Map;
5192
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
5193
- for (const effect2 of this.#new_effects) {
5194
- if ((effect2.f & (DESTROYED2 | INERT2 | EAGER_EFFECT2)) === 0 && depends_on2(effect2, current_unequal, checked)) {
5195
- if ((effect2.f & (ASYNC2 | BLOCK_EFFECT2)) !== 0) {
5196
- set_signal_status2(effect2, DIRTY2);
5197
- batch.schedule(effect2);
5198
- } else {
5199
- batch.#dirty_effects.add(effect2);
5391
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
5392
+ const v2 = this.current.get(c);
5393
+ if (!v2)
5394
+ return true;
5395
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
5396
+ }).map(([c]) => c);
5397
+ if (current_unequal.length > 0) {
5398
+ for (const effect2 of this.#new_effects) {
5399
+ if ((effect2.f & (DESTROYED2 | INERT2 | EAGER_EFFECT2)) === 0 && depends_on2(effect2, current_unequal, checked)) {
5400
+ if ((effect2.f & (ASYNC2 | BLOCK_EFFECT2)) !== 0) {
5401
+ set_signal_status2(effect2, DIRTY2);
5402
+ batch.schedule(effect2);
5403
+ } else {
5404
+ batch.#dirty_effects.add(effect2);
5405
+ }
5200
5406
  }
5201
5407
  }
5202
5408
  }
5203
- if (batch.#roots.length > 0) {
5409
+ if (batch.#roots.length > 0 && !batch.#decrement_queued) {
5204
5410
  batch.apply();
5205
5411
  for (var root of batch.#roots) {
5206
5412
  batch.#traverse(root, [], []);
@@ -5210,31 +5416,16 @@ class Batch2 {
5210
5416
  batch.deactivate();
5211
5417
  }
5212
5418
  }
5213
- for (const batch of batches2) {
5214
- if (batch.#blockers.has(this)) {
5215
- batch.#blockers.delete(this);
5216
- if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
5217
- batch.activate();
5218
- batch.#process();
5219
- }
5220
- }
5221
- }
5222
5419
  }
5223
5420
  increment(blocking, effect2) {
5224
- let pending_count = this.#pending.get(effect2) ?? 0;
5225
- this.#pending.set(effect2, pending_count + 1);
5421
+ this.#pending += 1;
5226
5422
  if (blocking) {
5227
5423
  let blocking_pending_count = this.#blocking_pending.get(effect2) ?? 0;
5228
5424
  this.#blocking_pending.set(effect2, blocking_pending_count + 1);
5229
5425
  }
5230
5426
  }
5231
- decrement(blocking, effect2, skip) {
5232
- let pending_count = this.#pending.get(effect2) ?? 0;
5233
- if (pending_count === 1) {
5234
- this.#pending.delete(effect2);
5235
- } else {
5236
- this.#pending.set(effect2, pending_count - 1);
5237
- }
5427
+ decrement(blocking, effect2) {
5428
+ this.#pending -= 1;
5238
5429
  if (blocking) {
5239
5430
  let blocking_pending_count = this.#blocking_pending.get(effect2) ?? 0;
5240
5431
  if (blocking_pending_count === 1) {
@@ -5243,12 +5434,14 @@ class Batch2 {
5243
5434
  this.#blocking_pending.set(effect2, blocking_pending_count - 1);
5244
5435
  }
5245
5436
  }
5246
- if (this.#decrement_queued || skip)
5437
+ if (this.#decrement_queued)
5247
5438
  return;
5248
5439
  this.#decrement_queued = true;
5249
5440
  queue_micro_task2(() => {
5250
5441
  this.#decrement_queued = false;
5251
- this.flush();
5442
+ if (this.linked) {
5443
+ this.flush();
5444
+ }
5252
5445
  });
5253
5446
  }
5254
5447
  transfer_effects(dirty_effects, maybe_dirty_effects) {
@@ -5267,36 +5460,24 @@ class Batch2 {
5267
5460
  ondiscard(fn) {
5268
5461
  this.#discard_callbacks.add(fn);
5269
5462
  }
5270
- on_fork_commit(fn) {
5271
- this.#fork_commit_callbacks.add(fn);
5272
- }
5273
- run_fork_commit_callbacks() {
5274
- for (const fn of this.#fork_commit_callbacks)
5275
- fn(this);
5276
- this.#fork_commit_callbacks.clear();
5277
- }
5278
5463
  settled() {
5279
5464
  return (this.#deferred ??= deferred2()).promise;
5280
5465
  }
5281
5466
  static ensure() {
5282
5467
  if (current_batch2 === null) {
5283
5468
  const batch = current_batch2 = new Batch2;
5284
- if (!is_processing2) {
5285
- batches2.add(current_batch2);
5286
- if (!is_flushing_sync2) {
5287
- queue_micro_task2(() => {
5288
- if (current_batch2 !== batch) {
5289
- return;
5290
- }
5469
+ if (!is_processing2 && !is_flushing_sync2) {
5470
+ queue_micro_task2(() => {
5471
+ if (!batch.#started) {
5291
5472
  batch.flush();
5292
- });
5293
- }
5473
+ }
5474
+ });
5294
5475
  }
5295
5476
  }
5296
5477
  return current_batch2;
5297
5478
  }
5298
5479
  apply() {
5299
- if (!async_mode_flag2 || !this.is_fork && batches2.size === 1) {
5480
+ if (!async_mode_flag2 || !this.is_fork && this.#prev === null && this.#next === null) {
5300
5481
  batch_values2 = null;
5301
5482
  return;
5302
5483
  }
@@ -5304,22 +5485,21 @@ class Batch2 {
5304
5485
  for (const [source2, [value]] of this.current) {
5305
5486
  batch_values2.set(source2, value);
5306
5487
  }
5307
- for (const batch of batches2) {
5488
+ for (let batch = first_batch2;batch !== null; batch = batch.#next) {
5308
5489
  if (batch === this || batch.is_fork)
5309
5490
  continue;
5310
5491
  var intersects = false;
5311
- var differs = false;
5312
5492
  if (batch.id < this.id) {
5313
5493
  for (const [source2, [, is_derived]] of batch.current) {
5314
5494
  if (is_derived)
5315
5495
  continue;
5316
- intersects ||= this.current.has(source2);
5317
- differs ||= !this.current.has(source2);
5496
+ if (this.current.has(source2)) {
5497
+ intersects = true;
5498
+ break;
5499
+ }
5318
5500
  }
5319
5501
  }
5320
- if (intersects && differs) {
5321
- this.#blockers.add(batch);
5322
- } else {
5502
+ if (!intersects) {
5323
5503
  for (const [source2, previous] of batch.previous) {
5324
5504
  if (!batch_values2.has(source2)) {
5325
5505
  batch_values2.set(source2, previous);
@@ -5354,6 +5534,23 @@ class Batch2 {
5354
5534
  }
5355
5535
  this.#roots.push(e);
5356
5536
  }
5537
+ #unlink() {
5538
+ if (!this.linked)
5539
+ return;
5540
+ var prev = this.#prev;
5541
+ var next22 = this.#next;
5542
+ if (prev === null) {
5543
+ first_batch2 = next22;
5544
+ } else {
5545
+ prev.#next = next22;
5546
+ }
5547
+ if (next22 === null) {
5548
+ last_batch2 = prev;
5549
+ } else {
5550
+ next22.#prev = prev;
5551
+ }
5552
+ this.linked = false;
5553
+ }
5357
5554
  }
5358
5555
  function flushSync2(fn) {
5359
5556
  var was_flushing_sync = is_flushing_sync2;
@@ -5483,6 +5680,7 @@ function depends_on2(reaction, sources, checked) {
5483
5680
  function schedule_effect2(effect2) {
5484
5681
  current_batch2.schedule(effect2);
5485
5682
  }
5683
+ var version_map2 = new Map;
5486
5684
  function reset_branch2(effect2, tracked) {
5487
5685
  if ((effect2.f & BRANCH_EFFECT2) !== 0 && (effect2.f & CLEAN2) !== 0) {
5488
5686
  return;
@@ -5741,7 +5939,7 @@ class Boundary2 {
5741
5939
  current_batch2.skip_effect(this.#pending_effect);
5742
5940
  if (this.#failed_effect)
5743
5941
  current_batch2.skip_effect(this.#failed_effect);
5744
- current_batch2.on_fork_commit(() => {
5942
+ current_batch2.oncommit(() => {
5745
5943
  this.#handle_error(error);
5746
5944
  });
5747
5945
  } else {
@@ -5839,23 +6037,24 @@ function flatten2(blockers, sync, async2, fn) {
5839
6037
  var restore = capture2();
5840
6038
  var blocker_promise = pending3.length === 1 ? pending3[0].promise : pending3.length > 1 ? Promise.all(pending3.map((b) => b.promise)) : null;
5841
6039
  function finish(values) {
6040
+ if ((parent.f & DESTROYED2) !== 0) {
6041
+ return;
6042
+ }
5842
6043
  restore();
5843
6044
  try {
5844
6045
  fn(values);
5845
6046
  } catch (error) {
5846
- if ((parent.f & DESTROYED2) === 0) {
5847
- invoke_error_boundary2(error, parent);
5848
- }
6047
+ invoke_error_boundary2(error, parent);
5849
6048
  }
5850
6049
  unset_context2();
5851
6050
  }
6051
+ var decrement_pending = increment_pending2();
5852
6052
  if (async2.length === 0) {
5853
- blocker_promise.then(() => finish(sync.map(d)));
6053
+ blocker_promise.then(() => finish(sync.map(d))).finally(decrement_pending);
5854
6054
  return;
5855
6055
  }
5856
- var decrement_pending = increment_pending2();
5857
6056
  function run3() {
5858
- Promise.all(async2.map((expression) => async_derived2(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary2(error, parent)).finally(() => decrement_pending());
6057
+ Promise.all(async2.map((expression) => async_derived2(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary2(error, parent)).finally(decrement_pending);
5859
6058
  }
5860
6059
  if (blocker_promise) {
5861
6060
  blocker_promise.then(() => {
@@ -5904,12 +6103,12 @@ function increment_pending2() {
5904
6103
  var effect2 = active_effect2;
5905
6104
  var boundary22 = effect2.b;
5906
6105
  var batch = current_batch2;
5907
- var blocking = boundary22.is_rendered();
5908
- boundary22.update_pending_count(1, batch);
6106
+ var blocking = !!boundary22?.is_rendered();
6107
+ boundary22?.update_pending_count(1, batch);
5909
6108
  batch.increment(blocking, effect2);
5910
- return (skip = false) => {
5911
- boundary22.update_pending_count(-1, batch);
5912
- batch.decrement(blocking, effect2, skip);
6109
+ return () => {
6110
+ boundary22?.update_pending_count(-1, batch);
6111
+ batch.decrement(blocking, effect2);
5913
6112
  };
5914
6113
  }
5915
6114
  var reactivity_loss_tracker2 = null;
@@ -5941,6 +6140,7 @@ function derived2(fn) {
5941
6140
  }
5942
6141
  return signal;
5943
6142
  }
6143
+ var OBSOLETE2 = Symbol("obsolete");
5944
6144
  function async_derived2(fn, label, location) {
5945
6145
  let parent = active_effect2;
5946
6146
  if (parent === null) {
@@ -5949,9 +6149,9 @@ function async_derived2(fn, label, location) {
5949
6149
  var promise = undefined;
5950
6150
  var signal = source2(UNINITIALIZED2);
5951
6151
  if (true_default2)
5952
- signal.label = label;
6152
+ signal.label = label ?? fn.toString();
5953
6153
  var should_suspend = !active_reaction2;
5954
- var deferreds = new Map;
6154
+ var deferreds = new Set;
5955
6155
  async_effect2(() => {
5956
6156
  var effect2 = active_effect2;
5957
6157
  if (true_default2) {
@@ -5960,7 +6160,10 @@ function async_derived2(fn, label, location) {
5960
6160
  var d = deferred2();
5961
6161
  promise = d.promise;
5962
6162
  try {
5963
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context2);
6163
+ Promise.resolve(fn()).then(d.resolve, (e) => {
6164
+ if (e !== STALE_REACTION2)
6165
+ d.reject(e);
6166
+ }).finally(unset_context2);
5964
6167
  } catch (error) {
5965
6168
  d.reject(error);
5966
6169
  unset_context2();
@@ -5985,28 +6188,24 @@ function async_derived2(fn, label, location) {
5985
6188
  if ((effect2.f & REACTION_RAN2) !== 0) {
5986
6189
  var decrement_pending = increment_pending2();
5987
6190
  }
5988
- if (parent.b.is_rendered()) {
5989
- deferreds.get(batch)?.reject(STALE_REACTION2);
5990
- deferreds.delete(batch);
6191
+ if (parent.b?.is_rendered()) {
6192
+ batch.async_deriveds.get(effect2)?.reject(OBSOLETE2);
5991
6193
  } else {
5992
6194
  for (const d2 of deferreds.values()) {
5993
- d2.reject(STALE_REACTION2);
6195
+ d2.reject(OBSOLETE2);
5994
6196
  }
5995
- deferreds.clear();
5996
6197
  }
5997
- deferreds.set(batch, d);
6198
+ deferreds.add(d);
6199
+ batch.async_deriveds.set(effect2, d);
5998
6200
  }
5999
6201
  const handler = (value, error = undefined) => {
6000
6202
  if (true_default2) {
6001
6203
  reactivity_loss_tracker2 = null;
6002
6204
  }
6003
- if (decrement_pending) {
6004
- var skip = error === STALE_REACTION2;
6005
- decrement_pending(skip);
6006
- }
6007
- if (error === STALE_REACTION2 || (effect2.f & DESTROYED2) !== 0) {
6205
+ decrement_pending?.();
6206
+ deferreds.delete(d);
6207
+ if (error === OBSOLETE2)
6008
6208
  return;
6009
- }
6010
6209
  batch.activate();
6011
6210
  if (error) {
6012
6211
  signal.f |= ERROR_VALUE2;
@@ -6015,30 +6214,24 @@ function async_derived2(fn, label, location) {
6015
6214
  if ((signal.f & ERROR_VALUE2) !== 0) {
6016
6215
  signal.f ^= ERROR_VALUE2;
6017
6216
  }
6018
- internal_set2(signal, value);
6019
- for (const [b, d2] of deferreds) {
6020
- deferreds.delete(b);
6021
- if (b === batch)
6022
- break;
6023
- d2.reject(STALE_REACTION2);
6024
- }
6025
- if (true_default2 && location !== undefined) {
6217
+ if (true_default2 && location !== undefined && !signal.equals(value)) {
6026
6218
  recent_async_deriveds2.add(signal);
6027
6219
  setTimeout(() => {
6028
- if (recent_async_deriveds2.has(signal)) {
6220
+ if (recent_async_deriveds2.has(signal) && (effect2.f & DESTROYED2) === 0) {
6029
6221
  await_waterfall2(signal.label, location);
6030
6222
  recent_async_deriveds2.delete(signal);
6031
6223
  }
6032
6224
  });
6033
6225
  }
6226
+ internal_set2(signal, value);
6034
6227
  }
6035
6228
  batch.deactivate();
6036
6229
  };
6037
6230
  d.promise.then(handler, (e) => handler(null, e || "unknown"));
6038
6231
  });
6039
6232
  teardown2(() => {
6040
- for (const d of deferreds.values()) {
6041
- d.reject(STALE_REACTION2);
6233
+ for (const d of deferreds) {
6234
+ d.reject(OBSOLETE2);
6042
6235
  }
6043
6236
  });
6044
6237
  if (true_default2) {
@@ -6083,7 +6276,7 @@ function execute_derived2(derived22) {
6083
6276
  var value;
6084
6277
  var prev_active_effect = active_effect2;
6085
6278
  var parent = derived22.parent;
6086
- if (!is_destroying_effect2 && parent !== null && (parent.f & (DESTROYED2 | INERT2)) !== 0) {
6279
+ if (!is_destroying_effect2 && parent !== null && derived22.v !== UNINITIALIZED2 && (parent.f & (DESTROYED2 | INERT2)) !== 0) {
6087
6280
  derived_inert2();
6088
6281
  return derived22.v;
6089
6282
  }
@@ -6122,6 +6315,7 @@ function update_derived2(derived22) {
6122
6315
  if (!current_batch2?.is_fork || derived22.deps === null) {
6123
6316
  if (current_batch2 !== null) {
6124
6317
  current_batch2.capture(derived22, value, true);
6318
+ previous_batch2?.capture(derived22, value, true);
6125
6319
  } else {
6126
6320
  derived22.v = value;
6127
6321
  }
@@ -6149,7 +6343,8 @@ function freeze_derived_effects2(derived22) {
6149
6343
  if (e.teardown || e.ac) {
6150
6344
  e.teardown?.();
6151
6345
  e.ac?.abort(STALE_REACTION2);
6152
- e.teardown = noop2;
6346
+ if (e.fn !== null)
6347
+ e.teardown = noop2;
6153
6348
  e.ac = null;
6154
6349
  remove_reactions2(e, 0);
6155
6350
  destroy_effect_children2(e);
@@ -6160,7 +6355,7 @@ function unfreeze_derived_effects2(derived22) {
6160
6355
  if (derived22.effects === null)
6161
6356
  return;
6162
6357
  for (const e of derived22.effects) {
6163
- if (e.teardown) {
6358
+ if (e.teardown && e.fn !== null) {
6164
6359
  update_effect2(e);
6165
6360
  }
6166
6361
  }
@@ -6207,7 +6402,7 @@ function mutable_source2(initial_value, immutable = false, trackable = true) {
6207
6402
  return s;
6208
6403
  }
6209
6404
  function set2(source22, value, should_proxy = false) {
6210
- if (active_reaction2 !== null && (!untracking2 || (active_reaction2.f & EAGER_EFFECT2) !== 0) && is_runes2() && (active_reaction2.f & (DERIVED2 | BLOCK_EFFECT2 | ASYNC2 | EAGER_EFFECT2)) !== 0 && (current_sources2 === null || !includes2.call(current_sources2, source22))) {
6405
+ if (active_reaction2 !== null && (!untracking2 || (active_reaction2.f & EAGER_EFFECT2) !== 0) && is_runes2() && (active_reaction2.f & (DERIVED2 | BLOCK_EFFECT2 | ASYNC2 | EAGER_EFFECT2)) !== 0 && (current_sources2 === null || !current_sources2.has(source22))) {
6211
6406
  state_unsafe_mutation2();
6212
6407
  }
6213
6408
  let new_value = should_proxy ? proxy2(value) : value;
@@ -6272,7 +6467,13 @@ function flush_eager_effects2() {
6272
6467
  if ((effect2.f & CLEAN2) !== 0) {
6273
6468
  set_signal_status2(effect2, MAYBE_DIRTY2);
6274
6469
  }
6275
- if (is_dirty2(effect2)) {
6470
+ let dirty;
6471
+ try {
6472
+ dirty = is_dirty2(effect2);
6473
+ } catch {
6474
+ dirty = true;
6475
+ }
6476
+ if (dirty) {
6276
6477
  update_effect2(effect2);
6277
6478
  }
6278
6479
  }
@@ -6292,19 +6493,17 @@ function mark_reactions2(signal, status, updated_during_traversal) {
6292
6493
  var flags22 = reaction.f;
6293
6494
  if (!runes && reaction === active_effect2)
6294
6495
  continue;
6295
- if (true_default2 && (flags22 & EAGER_EFFECT2) !== 0) {
6296
- eager_effects2.add(reaction);
6297
- continue;
6298
- }
6299
6496
  var not_dirty = (flags22 & DIRTY2) === 0;
6300
6497
  if (not_dirty) {
6301
6498
  set_signal_status2(reaction, status);
6302
6499
  }
6303
- if ((flags22 & DERIVED2) !== 0) {
6500
+ if ((flags22 & EAGER_EFFECT2) !== 0) {
6501
+ eager_effects2.add(reaction);
6502
+ } else if ((flags22 & DERIVED2) !== 0) {
6304
6503
  var derived22 = reaction;
6305
6504
  batch_values2?.delete(derived22);
6306
6505
  if ((flags22 & WAS_MARKED2) === 0) {
6307
- if (flags22 & CONNECTED2) {
6506
+ if (flags22 & CONNECTED2 && (active_effect2 === null || (active_effect2.f & REACTION_IS_UPDATING2) === 0)) {
6308
6507
  reaction.f |= WAS_MARKED2;
6309
6508
  }
6310
6509
  mark_reactions2(derived22, MAYBE_DIRTY2, updated_during_traversal);
@@ -6650,14 +6849,13 @@ function init_operations2() {
6650
6849
  first_child_getter2 = get_descriptor2(node_prototype, "firstChild").get;
6651
6850
  next_sibling_getter2 = get_descriptor2(node_prototype, "nextSibling").get;
6652
6851
  if (is_extensible2(element_prototype)) {
6653
- element_prototype.__click = undefined;
6654
- element_prototype.__className = undefined;
6655
- element_prototype.__attributes = null;
6656
- element_prototype.__style = undefined;
6852
+ element_prototype[CLASS_CACHE2] = undefined;
6853
+ element_prototype[ATTRIBUTES_CACHE2] = null;
6854
+ element_prototype[STYLE_CACHE2] = undefined;
6657
6855
  element_prototype.__e = undefined;
6658
6856
  }
6659
6857
  if (is_extensible2(text_prototype)) {
6660
- text_prototype.__t = undefined;
6858
+ text_prototype[TEXT_CACHE2] = undefined;
6661
6859
  }
6662
6860
  if (true_default2) {
6663
6861
  element_prototype.__svelte_meta = null;
@@ -6748,8 +6946,10 @@ function should_defer_append2() {
6748
6946
  return (flags22 & REACTION_RAN2) !== 0;
6749
6947
  }
6750
6948
  function create_element2(tag22, namespace, is2) {
6751
- let options = is2 ? { is: is2 } : undefined;
6752
- return document.createElementNS(namespace ?? NAMESPACE_HTML2, tag22, options);
6949
+ if (namespace == null || namespace === NAMESPACE_HTML2) {
6950
+ return is2 ? document.createElement(tag22, { is: is2 }) : document.createElement(tag22);
6951
+ }
6952
+ return is2 ? document.createElementNS(namespace, tag22, { is: is2 }) : document.createElementNS(namespace, tag22);
6753
6953
  }
6754
6954
  function merge_text_nodes2(text2) {
6755
6955
  if (text2.nodeValue.length < 65536) {
@@ -6875,7 +7075,7 @@ function user_effect2(fn) {
6875
7075
  });
6876
7076
  }
6877
7077
  var flags22 = active_effect2.f;
6878
- var defer = !active_reaction2 && (flags22 & BRANCH_EFFECT2) !== 0 && (flags22 & REACTION_RAN2) === 0;
7078
+ var defer = !active_reaction2 && (flags22 & BRANCH_EFFECT2) !== 0 && component_context2 !== null && !component_context2.i;
6879
7079
  if (defer) {
6880
7080
  var context = component_context2;
6881
7081
  (context.e ??= []).push(fn);
@@ -7124,11 +7324,7 @@ function set_active_effect2(effect22) {
7124
7324
  var current_sources2 = null;
7125
7325
  function push_reaction_value2(value) {
7126
7326
  if (active_reaction2 !== null && (!async_mode_flag2 || (active_reaction2.f & DERIVED2) !== 0)) {
7127
- if (current_sources2 === null) {
7128
- current_sources2 = [value];
7129
- } else {
7130
- current_sources2.push(value);
7131
- }
7327
+ (current_sources2 ??= new Set).add(value);
7132
7328
  }
7133
7329
  }
7134
7330
  var new_deps2 = null;
@@ -7176,7 +7372,7 @@ function schedule_possible_effect_self_invalidation2(signal, effect22, root = tr
7176
7372
  var reactions = signal.reactions;
7177
7373
  if (reactions === null)
7178
7374
  return;
7179
- if (!async_mode_flag2 && current_sources2 !== null && includes2.call(current_sources2, signal)) {
7375
+ if (!async_mode_flag2 && current_sources2 !== null && current_sources2.has(signal)) {
7180
7376
  return;
7181
7377
  }
7182
7378
  for (var i = 0;i < reactions.length; i++) {
@@ -7373,7 +7569,7 @@ function get22(signal) {
7373
7569
  captured_signals2?.add(signal);
7374
7570
  if (active_reaction2 !== null && !untracking2) {
7375
7571
  var destroyed = active_effect2 !== null && (active_effect2.f & DESTROYED2) !== 0;
7376
- if (!destroyed && (current_sources2 === null || !includes2.call(current_sources2, signal))) {
7572
+ if (!destroyed && (current_sources2 === null || !current_sources2.has(signal))) {
7377
7573
  var deps = active_reaction2.deps;
7378
7574
  if ((active_reaction2.f & REACTION_IS_UPDATING2) !== 0) {
7379
7575
  if (signal.rv < read_version2) {
@@ -7387,7 +7583,10 @@ function get22(signal) {
7387
7583
  }
7388
7584
  }
7389
7585
  } else {
7390
- (active_reaction2.deps ??= []).push(signal);
7586
+ active_reaction2.deps ??= [];
7587
+ if (!includes2.call(active_reaction2.deps, signal)) {
7588
+ active_reaction2.deps.push(signal);
7589
+ }
7391
7590
  var reactions = signal.reactions;
7392
7591
  if (reactions === null) {
7393
7592
  signal.reactions = [active_reaction2];
@@ -7590,7 +7789,8 @@ function handle_event_propagation2(event2) {
7590
7789
  var throw_error;
7591
7790
  var other_errors = [];
7592
7791
  while (current_target !== null) {
7593
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
7792
+ if (current_target === handler_element)
7793
+ break;
7594
7794
  try {
7595
7795
  var delegated22 = current_target[event_symbol2]?.[event_name];
7596
7796
  if (delegated22 != null && (!current_target.disabled || event2.target === current_target)) {
@@ -7603,10 +7803,10 @@ function handle_event_propagation2(event2) {
7603
7803
  throw_error = error;
7604
7804
  }
7605
7805
  }
7606
- if (event2.cancelBubble || parent_element === handler_element || parent_element === null) {
7806
+ if (event2.cancelBubble)
7607
7807
  break;
7608
- }
7609
- current_target = parent_element;
7808
+ path_idx++;
7809
+ current_target = path_idx < path.length ? path[path_idx] : null;
7610
7810
  }
7611
7811
  if (throw_error) {
7612
7812
  for (let error of other_errors) {
@@ -7944,6 +8144,7 @@ class BranchManager2 {
7944
8144
  } else {
7945
8145
  var offscreen = this.#offscreen.get(key2);
7946
8146
  if (offscreen) {
8147
+ resume_effect2(offscreen.effect);
7947
8148
  this.#onscreen.set(key2, offscreen.effect);
7948
8149
  this.#offscreen.delete(key2);
7949
8150
  if (true_default2) {
@@ -8695,7 +8896,7 @@ function to_class2(value, hash22, directives) {
8695
8896
  return classname === "" ? null : classname;
8696
8897
  }
8697
8898
  function set_class2(dom, is_html, value, hash22, prev_classes, next_classes) {
8698
- var prev = dom.__className;
8899
+ var prev = dom[CLASS_CACHE2];
8699
8900
  if (hydrating2 || prev !== value || prev === undefined) {
8700
8901
  var next_class_name = to_class2(value, hash22, next_classes);
8701
8902
  if (!hydrating2 || next_class_name !== dom.getAttribute("class")) {
@@ -8707,7 +8908,7 @@ function set_class2(dom, is_html, value, hash22, prev_classes, next_classes) {
8707
8908
  dom.setAttribute("class", next_class_name);
8708
8909
  }
8709
8910
  }
8710
- dom.__className = value;
8911
+ dom[CLASS_CACHE2] = value;
8711
8912
  } else if (next_classes && prev_classes !== next_classes) {
8712
8913
  for (var key2 in next_classes) {
8713
8914
  var is_present = !!next_classes[key2];
@@ -8748,7 +8949,7 @@ function set_attribute22(element2, attribute, value, skip_warning) {
8748
8949
  }
8749
8950
  }
8750
8951
  function get_attributes2(element2) {
8751
- return element2.__attributes ??= {
8952
+ return element2[ATTRIBUTES_CACHE2] ??= {
8752
8953
  [IS_CUSTOM_ELEMENT2]: element2.nodeName.includes("-"),
8753
8954
  [IS_HTML2]: element2.namespaceURI === NAMESPACE_HTML2
8754
8955
  };
@@ -8766,7 +8967,7 @@ function get_setters2(element2) {
8766
8967
  while (element_proto !== proto) {
8767
8968
  descriptors = get_descriptors2(proto);
8768
8969
  for (var key2 in descriptors) {
8769
- if (descriptors[key2].set) {
8970
+ if (descriptors[key2].set && key2 !== "innerHTML" && key2 !== "textContent" && key2 !== "innerText") {
8770
8971
  setters.push(key2);
8771
8972
  }
8772
8973
  }
@@ -8844,7 +9045,7 @@ function bind_this2(element_or_component = {}, update2, get_value, get_parts) {
8844
9045
  old_parts = parts;
8845
9046
  parts = get_parts?.() || [];
8846
9047
  untrack2(() => {
8847
- if (element_or_component !== get_value(...parts)) {
9048
+ if (!is_bound_this(get_value(...parts), element_or_component)) {
8848
9049
  update2(element_or_component, ...parts);
8849
9050
  if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {
8850
9051
  update2(null, ...old_parts);
@@ -8877,7 +9078,12 @@ function prop2(props, key2, flags22, fallback2) {
8877
9078
  var lazy = (flags22 & PROPS_IS_LAZY_INITIAL2) !== 0;
8878
9079
  var fallback_value = fallback2;
8879
9080
  var fallback_dirty = true;
9081
+ var fallback_signal = undefined;
8880
9082
  var get_fallback = () => {
9083
+ if (lazy && runes) {
9084
+ fallback_signal ??= derived2(fallback2);
9085
+ return get22(fallback_signal);
9086
+ }
8881
9087
  if (fallback_dirty) {
8882
9088
  fallback_dirty = false;
8883
9089
  fallback_value = lazy ? untrack2(fallback2) : fallback2;
@@ -9881,7 +10087,7 @@ function createScopedToolId(baseToolId, scopeLevel, scopeId) {
9881
10087
  }
9882
10088
  function parseScopedToolId(id) {
9883
10089
  const parts = id.split(":");
9884
- if (parts.length !== 3 && parts.length !== 4)
10090
+ if (parts.length !== 3)
9885
10091
  return null;
9886
10092
  const [baseToolId, scopeLevelRaw, scopeId] = parts;
9887
10093
  if (!baseToolId || !scopeId)
@@ -10233,7 +10439,8 @@ class BrowserTTSProvider {
10233
10439
  supportsWordBoundary: true,
10234
10440
  supportsVoiceSelection: true,
10235
10441
  supportsRateControl: true,
10236
- supportsPitchControl: true
10442
+ supportsPitchControl: true,
10443
+ supportsSSML: false
10237
10444
  };
10238
10445
  }
10239
10446
  destroy() {}
@@ -10531,7 +10738,7 @@ class TTSToolProvider {
10531
10738
  }
10532
10739
  const moduleLoadStartedAt = Date.now();
10533
10740
  await this.emitTelemetry("pie-tool-library-load-start", {
10534
- toolId: "tts",
10741
+ toolId: "textToSpeech",
10535
10742
  operation: "server-provider-module-import",
10536
10743
  backend: config.serverProvider || config.backend
10537
10744
  });
@@ -10539,7 +10746,7 @@ class TTSToolProvider {
10539
10746
  try {
10540
10747
  const loaded = await import("@pie-players/tts-client-server");
10541
10748
  await this.emitTelemetry("pie-tool-library-load-success", {
10542
- toolId: "tts",
10749
+ toolId: "textToSpeech",
10543
10750
  operation: "server-provider-module-import",
10544
10751
  backend: config.serverProvider || config.backend,
10545
10752
  duration: Date.now() - moduleLoadStartedAt
@@ -10547,7 +10754,7 @@ class TTSToolProvider {
10547
10754
  return loaded;
10548
10755
  } catch (error) {
10549
10756
  await this.emitTelemetry("pie-tool-library-load-error", {
10550
- toolId: "tts",
10757
+ toolId: "textToSpeech",
10551
10758
  operation: "server-provider-module-import",
10552
10759
  backend: config.serverProvider || config.backend,
10553
10760
  duration: Date.now() - moduleLoadStartedAt,
@@ -10603,7 +10810,6 @@ var DEFAULT_TOOL_TAG_MAP = {
10603
10810
  highlighter: "pie-tool-annotation-toolbar",
10604
10811
  lineReader: "pie-tool-line-reader",
10605
10812
  theme: "pie-tool-theme",
10606
- colorScheme: "pie-tool-theme",
10607
10813
  annotationToolbar: "pie-tool-annotation-toolbar",
10608
10814
  graph: "pie-tool-graph",
10609
10815
  periodicTable: "pie-tool-periodic-table"
@@ -10619,6 +10825,30 @@ var createToolElement = (toolId, context, toolbarContext, overrides) => {
10619
10825
  const factory = factoryForTool ?? overrides?.toolComponentFactory;
10620
10826
  return factory ? factory({ toolId, tagName, context, toolbarContext }) : createDefaultToolElement(tagName);
10621
10827
  };
10828
+ var overlayElementCache = new WeakMap;
10829
+ function getCachedOverlay(coordinator, fullToolId) {
10830
+ if (!coordinator)
10831
+ return null;
10832
+ const scoped = overlayElementCache.get(coordinator);
10833
+ const element2 = scoped?.get(fullToolId);
10834
+ if (!element2)
10835
+ return null;
10836
+ if (!element2.isConnected) {
10837
+ scoped?.delete(fullToolId);
10838
+ return null;
10839
+ }
10840
+ return element2;
10841
+ }
10842
+ function setCachedOverlay(coordinator, fullToolId, element2) {
10843
+ if (!coordinator)
10844
+ return;
10845
+ let scoped = overlayElementCache.get(coordinator);
10846
+ if (!scoped) {
10847
+ scoped = new Map;
10848
+ overlayElementCache.set(coordinator, scoped);
10849
+ }
10850
+ scoped.set(fullToolId, element2);
10851
+ }
10622
10852
  function normalizeCalculatorType(value) {
10623
10853
  return value === "basic" || value === "scientific" ? value : null;
10624
10854
  }
@@ -10688,7 +10918,11 @@ var calculatorToolRegistration = {
10688
10918
  const { calculatorType, availableTypes, displayName } = getCalculatorRenderParams(toolbarContext);
10689
10919
  const fullToolId = createScopedToolId(this.toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
10690
10920
  const componentOverrides = toolbarContext.componentOverrides;
10691
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
10921
+ const cachedOverlay = getCachedOverlay(toolbarContext.toolCoordinator, fullToolId);
10922
+ const overlay = cachedOverlay ?? createToolElement(this.toolId, context, toolbarContext, componentOverrides);
10923
+ if (!cachedOverlay) {
10924
+ setCachedOverlay(toolbarContext.toolCoordinator, fullToolId, overlay);
10925
+ }
10692
10926
  overlay.setAttribute("tool-id", fullToolId);
10693
10927
  overlay.toolkitCoordinator = toolbarContext.toolkitCoordinator;
10694
10928
  applyCalculatorParamsToElement(overlay, calculatorType, availableTypes);
@@ -10705,7 +10939,9 @@ var calculatorToolRegistration = {
10705
10939
  active: toolbarContext.isToolVisible(fullToolId)
10706
10940
  };
10707
10941
  let lastVisibleState = button.active;
10708
- overlay.visible = button.active;
10942
+ if (overlay.visible !== button.active) {
10943
+ overlay.visible = button.active;
10944
+ }
10709
10945
  return {
10710
10946
  toolId: this.toolId,
10711
10947
  elements: [
@@ -10717,10 +10953,12 @@ var calculatorToolRegistration = {
10717
10953
  draggable: true,
10718
10954
  resizable: true,
10719
10955
  closeable: true,
10720
- initialWidth: 720,
10721
- initialHeight: 620,
10722
- minWidth: 360,
10723
- minHeight: 420
10956
+ initialWidth: 380,
10957
+ initialHeight: 420,
10958
+ minWidth: 380,
10959
+ minHeight: 420,
10960
+ initialAlign: "bottom-right",
10961
+ initialMargin: 16
10724
10962
  }
10725
10963
  }
10726
10964
  ],
@@ -10750,6 +10988,23 @@ var calculatorToolRegistration = {
10750
10988
  };
10751
10989
  }
10752
10990
  };
10991
+ var sreOperationQueue = Promise.resolve();
10992
+ var isPlainRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
10993
+ var trimOption = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
10994
+ var normalizeSREMathSpeechOptions = (options) => {
10995
+ if (!isPlainRecord(options))
10996
+ return;
10997
+ const domain = trimOption(options.domain);
10998
+ const style = trimOption(options.style);
10999
+ const engineOptions = isPlainRecord(options.engineOptions) ? options.engineOptions : undefined;
11000
+ if (!domain && !style && !engineOptions)
11001
+ return;
11002
+ return {
11003
+ ...domain ? { domain } : {},
11004
+ ...style ? { style } : {},
11005
+ ...engineOptions ? { engineOptions } : {}
11006
+ };
11007
+ };
10753
11008
  var VALID_TTS_LAYOUT_MODES = new Set([
10754
11009
  "reserved-row",
10755
11010
  "expanding-row",
@@ -10814,7 +11069,7 @@ var applyRuntimeDefaults = (config) => {
10814
11069
  };
10815
11070
  var resolveTTSRuntimeSettings = (config) => {
10816
11071
  const configRecord = toRecord(config);
10817
- const settingsRecord = toRecord(config?.settings);
11072
+ const settingsRecord = toRecord(configRecord.settings);
10818
11073
  return applyRuntimeDefaults({
10819
11074
  ...configRecord,
10820
11075
  ...settingsRecord
@@ -10834,6 +11089,7 @@ var buildRuntimeTTSConfig = (config) => {
10834
11089
  const backend = resolveTTSBackend(config);
10835
11090
  const runtimeProvider = resolveRuntimeProvider(config, backend);
10836
11091
  const transportMode = resolveTransportMode(config, runtimeProvider);
11092
+ const mathSpeech = normalizeSREMathSpeechOptions(config.mathSpeech);
10837
11093
  return {
10838
11094
  voice: config.defaultVoice,
10839
11095
  rate: config.rate,
@@ -10848,7 +11104,8 @@ var buildRuntimeTTSConfig = (config) => {
10848
11104
  } : {},
10849
11105
  ...transportMode === "custom" && typeof config.cache === "boolean" ? { cache: config.cache } : {},
10850
11106
  ...transportMode === "custom" && config.speedRate ? { speedRate: config.speedRate } : {},
10851
- ...transportMode === "custom" && config.lang_id ? { lang_id: config.lang_id } : {}
11107
+ ...transportMode === "custom" && config.lang_id ? { lang_id: config.lang_id } : {},
11108
+ ...mathSpeech ? { mathSpeech } : {}
10852
11109
  },
10853
11110
  apiEndpoint: config.apiEndpoint,
10854
11111
  provider: runtimeProvider,
@@ -10857,7 +11114,8 @@ var buildRuntimeTTSConfig = (config) => {
10857
11114
  endpointMode: config.endpointMode,
10858
11115
  endpointValidationMode: config.endpointValidationMode,
10859
11116
  includeAuthOnAssetFetch: config.includeAuthOnAssetFetch,
10860
- validateEndpoint: config.validateEndpoint
11117
+ validateEndpoint: config.validateEndpoint,
11118
+ ...typeof config.mathTokenHighlighting === "boolean" ? { mathTokenHighlighting: config.mathTokenHighlighting } : {}
10861
11119
  };
10862
11120
  };
10863
11121
  var resolveTTSLayoutMode = (config) => normalizeTTSLayoutMode(config.layoutMode);
@@ -11313,7 +11571,6 @@ var themeToolRegistration = {
11313
11571
  "highContrastDisplay",
11314
11572
  "colorContrast",
11315
11573
  "invertColors",
11316
- "colorScheme",
11317
11574
  "theme",
11318
11575
  "highContrast",
11319
11576
  "customColors"
@@ -12487,26 +12744,16 @@ var __pieDefineSafely = (tagName, ctor) => {
12487
12744
  }
12488
12745
  }
12489
12746
  };
12490
- var root_4 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12491
- var root_5 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12492
- var root_9 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-light fa-calculator"></i></span>`);
12493
- var root_10 = from_html2(`<span aria-hidden="true"></span>`);
12494
- var root_11 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12495
- var root_13 = from_html2(`<span aria-hidden="true"></span>`);
12496
- var root_14 = from_html2(`<i aria-hidden="true"></i>`);
12497
- var root_7 = from_html2(`<a><!></a>`);
12498
- var root_17 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-light fa-calculator"></i></span>`);
12499
- var root_18 = from_html2(`<span aria-hidden="true"></span>`);
12500
- var root_19 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12501
- var root_21 = from_html2(`<span aria-hidden="true"></span>`);
12502
- var root_22 = from_html2(`<i aria-hidden="true"></i>`);
12503
- var root_15 = from_html2(`<button type="button"><!></button>`);
12504
- var root_24 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12505
- var root_25 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12506
- var root_28 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12507
- var root_29 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12508
- var root_26 = from_html2(`<div></div>`);
12509
- var root_2 = from_html2(`<div><div class="item-toolbar__tools-row svelte-rnx3ie"><!> <!> <!></div> <!></div>`);
12747
+ var root_1 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12748
+ var root_2 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-regular fa-calculator svelte-rnx3ie"></i></span>`);
12749
+ var root_3 = from_html2(`<span aria-hidden="true"></span>`);
12750
+ var root_4 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12751
+ var root_5 = from_html2(`<i aria-hidden="true"></i>`);
12752
+ var root_6 = from_html2(`<a><!></a>`);
12753
+ var root_7 = from_html2(`<button type="button"><!></button>`);
12754
+ var root_8 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12755
+ var root_9 = from_html2(`<div></div>`);
12756
+ var root_10 = from_html2(`<div><div class="item-toolbar__tools-row svelte-rnx3ie"><!> <!> <!></div> <!></div>`);
12510
12757
  var $$css = {
12511
12758
  hash: "svelte-rnx3ie",
12512
12759
  code: `.item-toolbar.svelte-rnx3ie {display:flex;flex-direction:column;align-items:flex-end;gap:0;--pie-toolbar-tools-row-height: 2rem;--pie-tts-controls-row-height: 2.875rem;}.item-toolbar__tools-row.svelte-rnx3ie {display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;gap:0.5rem;min-height:var(--pie-toolbar-tools-row-height);}.item-toolbar__controls-row.svelte-rnx3ie {display:flex;align-items:center;justify-content:flex-end;width:100%;min-height:0;height:auto;}.item-toolbar__controls-row--reserve.svelte-rnx3ie {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--active.svelte-rnx3ie {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--align-start.svelte-rnx3ie {justify-content:flex-start;}.item-toolbar__controls-host.svelte-rnx3ie {display:inline-flex;align-items:center;justify-content:flex-end;width:100%;}.item-toolbar--top.svelte-rnx3ie,
@@ -12515,7 +12762,10 @@ var $$css = {
12515
12762
  .item-toolbar--right.svelte-rnx3ie .item-toolbar__tools-row:where(.svelte-rnx3ie) {flex-direction:column;align-items:center;justify-content:flex-start;flex-wrap:nowrap;}.item-toolbar--left.svelte-rnx3ie .item-toolbar__controls-row:where(.svelte-rnx3ie),
12516
12763
  .item-toolbar--right.svelte-rnx3ie .item-toolbar__controls-row:where(.svelte-rnx3ie) {justify-content:flex-start;width:auto;min-height:0;height:auto;}.item-toolbar__button.svelte-rnx3ie {display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:1px solid var(--pie-button-border, var(--pie-border, #ccc));border-radius:0.25rem;background-color:var(--pie-button-bg, var(--pie-background, white));color:var(--pie-button-color, var(--pie-text, #333));cursor:pointer;transition:all 0.15s ease;text-decoration:none;}.item-toolbar__element-host.svelte-rnx3ie {display:contents;}.item-toolbar--sm.svelte-rnx3ie .item-toolbar__button:where(.svelte-rnx3ie) {width:2.75rem;height:2.75rem;}.item-toolbar--sm.svelte-rnx3ie {--pie-toolbar-tools-row-height: 2.75rem;--pie-tts-controls-row-height: 3.625rem;}.item-toolbar--lg.svelte-rnx3ie .item-toolbar__button:where(.svelte-rnx3ie) {width:2.5rem;height:2.5rem;}.item-toolbar--lg.svelte-rnx3ie {--pie-toolbar-tools-row-height: 2.5rem;--pie-tts-controls-row-height: 3.375rem;}.item-toolbar__button.svelte-rnx3ie:hover:not(:disabled) {background-color:var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5));border-color:var(--pie-button-hover-border, var(--pie-button-border, var(--pie-border, #ccc)));color:var(--pie-button-hover-color, var(--pie-button-color, var(--pie-text, #333)));transform:translateY(-1px);box-shadow:0 2px 4px color-mix(in srgb, var(--pie-black, #000) 10%, transparent);}.item-toolbar__button.svelte-rnx3ie:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.item-toolbar__button--active.svelte-rnx3ie {background-color:var(--pie-primary, #1976d2);color:var(--pie-white, #fff);border-color:var(--pie-primary, #1976d2);}.item-toolbar__button--active.svelte-rnx3ie:hover:not(:disabled) {background-color:var(--pie-primary-dark, #1565c0);}.item-toolbar__button.svelte-rnx3ie:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #1976d2));outline-offset:2px;}.item-toolbar__button.svelte-rnx3ie:disabled {opacity:0.5;cursor:not-allowed;}.item-toolbar__button.svelte-rnx3ie svg {width:100%;height:100%;}.item-toolbar__icon-image.svelte-rnx3ie {width:100%;height:100%;object-fit:contain;}
12517
12764
 
12518
- /* Decorative only — the outer link/button owns focus and aria semantics. */.item-toolbar__calculator-icon.svelte-rnx3ie {pointer-events:none;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;}`
12765
+ /* Decorative only — the outer link/button owns focus and aria semantics. */.item-toolbar__calculator-icon.svelte-rnx3ie {pointer-events:none;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;}
12766
+
12767
+ /* Defensive: if FA fails to load (shadow injection misses, CSP blocks the
12768
+ stylesheet, etc.), the <i> would otherwise render as italic text. */.item-toolbar__calculator-icon.svelte-rnx3ie > i:where(.svelte-rnx3ie) {font-style:normal;}`
12519
12769
  };
12520
12770
  function ItemToolBar($$anchor, $$props) {
12521
12771
  push2($$props, true);
@@ -12524,7 +12774,6 @@ function ItemToolBar($$anchor, $$props) {
12524
12774
  const FA_PRO_HREFS = ["/_fa-pro/fontawesome.min.css", "/_fa-pro/light.min.css"];
12525
12775
  const FA_FREE_HREF = "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css";
12526
12776
  const ROBOTO_HREF = "https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap";
12527
- const FA_LIGHT_SHIM_ID = "pie-nds-fa-light-shim";
12528
12777
  let ndsAssetsInstalled = false;
12529
12778
  const ensureNdsAssets = () => {
12530
12779
  if (!isBrowser || ndsAssetsInstalled)
@@ -12550,14 +12799,9 @@ function ItemToolBar($$anchor, $$props) {
12550
12799
  link2.href = href;
12551
12800
  document.head.appendChild(link2);
12552
12801
  }
12553
- if (!document.getElementById(FA_LIGHT_SHIM_ID)) {
12554
- const style = document.createElement("style");
12555
- style.id = FA_LIGHT_SHIM_ID;
12556
- style.textContent = '.fa-light{font-family:"Font Awesome 6 Free";font-weight:900;}';
12557
- document.head.appendChild(style);
12558
- }
12559
12802
  };
12560
12803
  const FA_TOOLBAR_SHADOW_INSTALLED = "__pieFaToolbarShadowInstalled";
12804
+ const FA_HREF_PATTERN = /font.?awesome|fa-?pro/i;
12561
12805
  const installFaInToolbarShadow = (root) => {
12562
12806
  const shadow = root.getRootNode();
12563
12807
  if (!(shadow instanceof ShadowRoot))
@@ -12566,15 +12810,19 @@ function ItemToolBar($$anchor, $$props) {
12566
12810
  if (marker[FA_TOOLBAR_SHADOW_INSTALLED])
12567
12811
  return;
12568
12812
  marker[FA_TOOLBAR_SHADOW_INSTALLED] = true;
12813
+ const seenHrefs = new Set;
12569
12814
  const appendLink = (href) => {
12815
+ if (!href || seenHrefs.has(href))
12816
+ return;
12817
+ seenHrefs.add(href);
12570
12818
  const link2 = document.createElement("link");
12571
12819
  link2.rel = "stylesheet";
12572
12820
  link2.href = href;
12573
12821
  shadow.appendChild(link2);
12574
12822
  };
12575
- appendLink(FA_FREE_HREF);
12576
- for (const href of FA_PRO_HREFS)
12577
- appendLink(href);
12823
+ const documentFaLinks = Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).filter((link2) => FA_HREF_PATTERN.test(link2.href));
12824
+ for (const link2 of documentFaLinks)
12825
+ appendLink(link2.href);
12578
12826
  const shim = document.createElement("style");
12579
12827
  shim.textContent = '.fa-light{font-family:"Font Awesome 6 Free";font-weight:900;}';
12580
12828
  shadow.appendChild(shim);
@@ -13154,6 +13402,10 @@ function ItemToolBar($$anchor, $$props) {
13154
13402
  let controlsEl = null;
13155
13403
  let closeButtonEl = null;
13156
13404
  let resizeHandleEl = null;
13405
+ let startFocusGuardEl = null;
13406
+ let endFocusGuardEl = null;
13407
+ let focusGuardRedirecting = false;
13408
+ let calculatorBridgeAttached = false;
13157
13409
  let mountedContentElement = null;
13158
13410
  let dragPointerId = null;
13159
13411
  let resizePointerId = null;
@@ -13163,6 +13415,10 @@ function ItemToolBar($$anchor, $$props) {
13163
13415
  let resizeStartHeight = 0;
13164
13416
  let resizeStartX = 0;
13165
13417
  let resizeStartY = 0;
13418
+ let resizeStartShellX = 0;
13419
+ let resizeStartShellY = 0;
13420
+ let resizeCorner = null;
13421
+ const resizeHandleEls = [];
13166
13422
  let x2 = 0;
13167
13423
  let y2 = 0;
13168
13424
  let width = currentArgs.mounted.entry.shell?.initialWidth ?? 720;
@@ -13237,7 +13493,7 @@ function ItemToolBar($$anchor, $$props) {
13237
13493
  height += dh;
13238
13494
  applyPositionAndSize();
13239
13495
  };
13240
- const createShellIconButton = (label, iconName, onActivate) => {
13496
+ const createShellIconButton = (label, iconName, onActivate, faVariant = "fa-regular") => {
13241
13497
  const button = document.createElement("nds-icon-button");
13242
13498
  button.setAttribute("variant", "tertiary");
13243
13499
  button.setAttribute("size", "small");
@@ -13250,6 +13506,25 @@ function ItemToolBar($$anchor, $$props) {
13250
13506
  onActivate();
13251
13507
  bringToFront();
13252
13508
  });
13509
+ if (faVariant !== "fa-light") {
13510
+ const swapVariant = (icon) => {
13511
+ icon.classList.remove("fa-light");
13512
+ icon.classList.add(faVariant);
13513
+ };
13514
+ const existing = button.querySelector("i.fa-light");
13515
+ if (existing) {
13516
+ swapVariant(existing);
13517
+ } else {
13518
+ const observer = new MutationObserver(() => {
13519
+ const target = button.querySelector("i.fa-light");
13520
+ if (target) {
13521
+ swapVariant(target);
13522
+ observer.disconnect();
13523
+ }
13524
+ });
13525
+ observer.observe(button, { childList: true, subtree: true });
13526
+ }
13527
+ }
13253
13528
  return button;
13254
13529
  };
13255
13530
  const createShellControlButton = (label, glyph, onActivate) => {
@@ -13330,8 +13605,31 @@ function ItemToolBar($$anchor, $$props) {
13330
13605
  const centerShell = () => {
13331
13606
  const viewportW = window.innerWidth;
13332
13607
  const viewportH = window.innerHeight;
13333
- x2 = Math.max(0, Math.round((viewportW - width) / 2));
13334
- y2 = Math.max(0, Math.round((viewportH - height) / 2));
13608
+ const shellConfig = currentArgs.mounted.entry.shell;
13609
+ const align = shellConfig?.initialAlign ?? "center";
13610
+ const margin = shellConfig?.initialMargin ?? 16;
13611
+ const verticalMargin = margin + 60;
13612
+ switch (align) {
13613
+ case "top-left":
13614
+ x2 = margin;
13615
+ y2 = verticalMargin;
13616
+ break;
13617
+ case "top-right":
13618
+ x2 = Math.max(0, viewportW - width - margin);
13619
+ y2 = verticalMargin;
13620
+ break;
13621
+ case "bottom-left":
13622
+ x2 = margin;
13623
+ y2 = Math.max(0, viewportH - height - verticalMargin);
13624
+ break;
13625
+ case "bottom-right":
13626
+ x2 = Math.max(0, viewportW - width - margin);
13627
+ y2 = Math.max(0, viewportH - height - verticalMargin);
13628
+ break;
13629
+ default:
13630
+ x2 = Math.max(0, Math.round((viewportW - width) / 2));
13631
+ y2 = Math.max(0, Math.round((viewportH - height) / 2));
13632
+ }
13335
13633
  applyPositionAndSize();
13336
13634
  };
13337
13635
  const restoreOpenerFocus = () => {
@@ -13367,14 +13665,113 @@ function ItemToolBar($$anchor, $$props) {
13367
13665
  if (!openerEl && active && !shellEl.contains(active)) {
13368
13666
  openerEl = active;
13369
13667
  }
13668
+ const isCalculatorShellTrap = currentArgs.mounted.toolId === "calculator";
13669
+ if (isCalculatorShellTrap && !calculatorBridgeAttached) {
13670
+ document.addEventListener("keydown", onCalculatorBridgeKeydown, true);
13671
+ calculatorBridgeAttached = true;
13672
+ }
13370
13673
  focusTrapCleanup = createFocusTrap(shellEl, {
13371
13674
  initialFocus: closeButtonEl,
13372
13675
  onEscape: () => {
13373
13676
  closeShell();
13374
- }
13677
+ },
13678
+ wrap: !isCalculatorShellTrap,
13679
+ onTabExit: isCalculatorShellTrap ? (direction, event2) => {
13680
+ if (direction === "backward") {
13681
+ if (openerEl?.isConnected) {
13682
+ event2.preventDefault();
13683
+ try {
13684
+ openerEl.focus();
13685
+ } catch {}
13686
+ }
13687
+ return;
13688
+ }
13689
+ const next22 = findFirstQuestionFocusable();
13690
+ if (next22) {
13691
+ event2.preventDefault();
13692
+ try {
13693
+ next22.focus();
13694
+ } catch {}
13695
+ }
13696
+ } : undefined
13375
13697
  });
13376
13698
  };
13699
+ const findFirstQuestionFocusable = () => {
13700
+ const scope = get22(toolbarContext).getScopeElement?.() ?? null;
13701
+ if (!scope)
13702
+ return null;
13703
+ const isExcluded = (el) => {
13704
+ if (get22(toolbarRootElement) && get22(toolbarRootElement).contains(el))
13705
+ return true;
13706
+ if (shellEl && shellEl.contains(el))
13707
+ return true;
13708
+ return false;
13709
+ };
13710
+ const visit = (node2) => {
13711
+ if (node2 instanceof HTMLElement) {
13712
+ if (isExcluded(node2))
13713
+ return null;
13714
+ if (node2.matches?.(FOCUSABLE_SELECTOR) && isProgrammaticFocusTarget(node2)) {
13715
+ return node2;
13716
+ }
13717
+ }
13718
+ const shadow = node2.shadowRoot;
13719
+ if (shadow) {
13720
+ for (let i = 0;i < shadow.children.length; i++) {
13721
+ const found = visit(shadow.children[i]);
13722
+ if (found)
13723
+ return found;
13724
+ }
13725
+ }
13726
+ for (let i = 0;i < node2.children.length; i++) {
13727
+ const found = visit(node2.children[i]);
13728
+ if (found)
13729
+ return found;
13730
+ }
13731
+ return null;
13732
+ };
13733
+ return visit(scope);
13734
+ };
13735
+ const getShellFocusables = () => {
13736
+ if (!shellEl)
13737
+ return [];
13738
+ return Array.from(shellEl.querySelectorAll(FOCUSABLE_SELECTOR)).filter((el) => el !== startFocusGuardEl && el !== endFocusGuardEl).filter(isProgrammaticFocusTarget);
13739
+ };
13740
+ const onCalculatorBridgeKeydown = (event2) => {
13741
+ if (event2.key !== "Tab")
13742
+ return;
13743
+ if (!shellEl || !currentArgs.active)
13744
+ return;
13745
+ const active = getDeepActiveElement();
13746
+ if (!active)
13747
+ return;
13748
+ if (shellEl.contains(active))
13749
+ return;
13750
+ const focusables = getShellFocusables();
13751
+ if (focusables.length === 0)
13752
+ return;
13753
+ if (event2.shiftKey) {
13754
+ const firstQuestion = findFirstQuestionFocusable();
13755
+ if (active !== firstQuestion)
13756
+ return;
13757
+ event2.preventDefault();
13758
+ try {
13759
+ focusables[focusables.length - 1].focus();
13760
+ } catch {}
13761
+ return;
13762
+ }
13763
+ if (active !== openerEl)
13764
+ return;
13765
+ event2.preventDefault();
13766
+ try {
13767
+ focusables[0].focus();
13768
+ } catch {}
13769
+ };
13377
13770
  const removeFocusTrap = () => {
13771
+ if (calculatorBridgeAttached) {
13772
+ document.removeEventListener("keydown", onCalculatorBridgeKeydown, true);
13773
+ calculatorBridgeAttached = false;
13774
+ }
13378
13775
  if (!focusTrapCleanup)
13379
13776
  return;
13380
13777
  const cleanup = focusTrapCleanup;
@@ -13392,25 +13789,28 @@ function ItemToolBar($$anchor, $$props) {
13392
13789
  if (!currentArgs.mounted.entry.shell?.draggable)
13393
13790
  return;
13394
13791
  const target = event2.target;
13395
- if (target.closest("button"))
13396
- return;
13397
- if (!shellEl)
13792
+ if (target.closest("button") || !shellEl)
13398
13793
  return;
13794
+ event2.preventDefault();
13399
13795
  dragPointerId = event2.pointerId;
13400
13796
  dragOffsetX = event2.clientX - x2;
13401
13797
  dragOffsetY = event2.clientY - y2;
13402
13798
  shellEl.setPointerCapture(event2.pointerId);
13403
13799
  bringToFront();
13404
13800
  };
13405
- const onResizePointerDown = (event2) => {
13801
+ const createResizePointerDownHandler = (corner) => (event2) => {
13406
13802
  if (!shellEl || !currentArgs.mounted.entry.shell?.resizable)
13407
13803
  return;
13804
+ event2.preventDefault();
13408
13805
  event2.stopPropagation();
13409
13806
  resizePointerId = event2.pointerId;
13807
+ resizeCorner = corner;
13410
13808
  resizeStartWidth = width;
13411
13809
  resizeStartHeight = height;
13412
13810
  resizeStartX = event2.clientX;
13413
13811
  resizeStartY = event2.clientY;
13812
+ resizeStartShellX = x2;
13813
+ resizeStartShellY = y2;
13414
13814
  shellEl.setPointerCapture(event2.pointerId);
13415
13815
  bringToFront();
13416
13816
  };
@@ -13418,6 +13818,7 @@ function ItemToolBar($$anchor, $$props) {
13418
13818
  if (!shellEl)
13419
13819
  return;
13420
13820
  if (dragPointerId === event2.pointerId) {
13821
+ event2.preventDefault();
13421
13822
  const maxX = Math.max(0, window.innerWidth - width);
13422
13823
  const maxY = Math.max(0, window.innerHeight - height);
13423
13824
  x2 = clamp(event2.clientX - dragOffsetX, 0, maxX);
@@ -13426,13 +13827,39 @@ function ItemToolBar($$anchor, $$props) {
13426
13827
  return;
13427
13828
  }
13428
13829
  if (resizePointerId === event2.pointerId) {
13830
+ event2.preventDefault();
13429
13831
  const shellConfig = currentArgs.mounted.entry.shell;
13430
13832
  const minWidth = shellConfig?.minWidth ?? 320;
13431
13833
  const minHeight = shellConfig?.minHeight ?? 240;
13432
13834
  const maxWidth = shellConfig?.maxWidth ?? window.innerWidth;
13433
13835
  const maxHeight = shellConfig?.maxHeight ?? window.innerHeight;
13434
- width = clamp(resizeStartWidth + (event2.clientX - resizeStartX), minWidth, Math.max(minWidth, Math.min(maxWidth, window.innerWidth - x2)));
13435
- height = clamp(resizeStartHeight + (event2.clientY - resizeStartY), minHeight, Math.max(minHeight, Math.min(maxHeight, window.innerHeight - y2)));
13836
+ const dx = event2.clientX - resizeStartX;
13837
+ const dy = event2.clientY - resizeStartY;
13838
+ if (resizeCorner === "se") {
13839
+ width = clamp(resizeStartWidth + dx, minWidth, Math.max(minWidth, Math.min(maxWidth, window.innerWidth - x2)));
13840
+ height = clamp(resizeStartHeight + dy, minHeight, Math.max(minHeight, Math.min(maxHeight, window.innerHeight - y2)));
13841
+ } else if (resizeCorner === "sw") {
13842
+ const rightEdge = resizeStartShellX + resizeStartWidth;
13843
+ const newWidth = clamp(resizeStartWidth - dx, minWidth, Math.min(maxWidth, rightEdge));
13844
+ x2 = rightEdge - newWidth;
13845
+ width = newWidth;
13846
+ height = clamp(resizeStartHeight + dy, minHeight, Math.max(minHeight, Math.min(maxHeight, window.innerHeight - y2)));
13847
+ } else if (resizeCorner === "ne") {
13848
+ const bottomEdge = resizeStartShellY + resizeStartHeight;
13849
+ width = clamp(resizeStartWidth + dx, minWidth, Math.max(minWidth, Math.min(maxWidth, window.innerWidth - x2)));
13850
+ const newHeight = clamp(resizeStartHeight - dy, minHeight, Math.min(maxHeight, bottomEdge));
13851
+ y2 = bottomEdge - newHeight;
13852
+ height = newHeight;
13853
+ } else if (resizeCorner === "nw") {
13854
+ const rightEdge = resizeStartShellX + resizeStartWidth;
13855
+ const bottomEdge = resizeStartShellY + resizeStartHeight;
13856
+ const newWidth = clamp(resizeStartWidth - dx, minWidth, Math.min(maxWidth, rightEdge));
13857
+ x2 = rightEdge - newWidth;
13858
+ width = newWidth;
13859
+ const newHeight = clamp(resizeStartHeight - dy, minHeight, Math.min(maxHeight, bottomEdge));
13860
+ y2 = bottomEdge - newHeight;
13861
+ height = newHeight;
13862
+ }
13436
13863
  applyShellStyle();
13437
13864
  notifyHostedResize();
13438
13865
  }
@@ -13465,14 +13892,20 @@ function ItemToolBar($$anchor, $$props) {
13465
13892
  shellEl.style.border = "1px solid var(--pie-border-light, #d1d5db)";
13466
13893
  shellEl.style.borderRadius = "12px";
13467
13894
  shellEl.style.boxShadow = "0 10px 40px color-mix(in srgb, var(--pie-black, #000) 25%, transparent)";
13468
- shellEl.style.overflow = "hidden";
13895
+ shellEl.style.overflow = "visible";
13469
13896
  shellEl.style.display = currentArgs.active ? "flex" : "none";
13470
13897
  shellEl.style.flexDirection = "column";
13898
+ shellEl.style.userSelect = "none";
13899
+ shellEl.style.webkitUserSelect = "none";
13900
+ shellEl.style.touchAction = "none";
13901
+ shellEl.setAttribute("draggable", "false");
13902
+ shellEl.addEventListener("dragstart", (e) => e.preventDefault());
13471
13903
  headerEl = document.createElement("div");
13472
13904
  headerEl.className = "pie-tool-shell__header";
13473
13905
  headerEl.style.display = "flex";
13474
13906
  headerEl.style.alignItems = "center";
13475
13907
  headerEl.style.justifyContent = "space-between";
13908
+ headerEl.style.gap = "6px";
13476
13909
  headerEl.style.padding = isCalculatorShell ? "12px 12px 12px 28px" : "10px 12px";
13477
13910
  if (isCalculatorShell) {
13478
13911
  headerEl.style.minHeight = "48px";
@@ -13487,6 +13920,13 @@ function ItemToolBar($$anchor, $$props) {
13487
13920
  }
13488
13921
  headerEl.style.cursor = currentArgs.mounted.entry.shell.draggable === false ? "default" : "move";
13489
13922
  headerEl.style.flex = "0 0 auto";
13923
+ headerEl.style.borderRadius = "12px 12px 0 0";
13924
+ headerEl.style.overflow = "hidden";
13925
+ headerEl.style.userSelect = "none";
13926
+ headerEl.style.webkitUserSelect = "none";
13927
+ headerEl.style.touchAction = "none";
13928
+ headerEl.setAttribute("draggable", "false");
13929
+ headerEl.addEventListener("dragstart", (e) => e.preventDefault());
13490
13930
  titleEl = document.createElement("span");
13491
13931
  titleEl.className = "pie-tool-shell__title";
13492
13932
  titleEl.textContent = currentArgs.mounted.entry.shell.title || currentArgs.mounted.toolId;
@@ -13497,10 +13937,10 @@ function ItemToolBar($$anchor, $$props) {
13497
13937
  controlsEl.style.alignItems = "center";
13498
13938
  controlsEl.style.gap = isCalculatorShell ? "6px" : "4px";
13499
13939
  const shellConfig = currentArgs.mounted.entry.shell;
13500
- const appendControl = (label, glyph, iconName, onActivate) => {
13940
+ const appendControl = (label, glyph, iconName, onActivate, faVariant = "fa-regular") => {
13501
13941
  if (!controlsEl)
13502
13942
  return;
13503
- controlsEl.appendChild(isCalculatorShell ? createShellIconButton(label, iconName, onActivate) : createShellControlButton(label, glyph, onActivate));
13943
+ controlsEl.appendChild(isCalculatorShell ? createShellIconButton(label, iconName, onActivate, faVariant) : createShellControlButton(label, glyph, onActivate));
13504
13944
  };
13505
13945
  if (shellConfig?.draggable !== false) {
13506
13946
  appendControl("Move tool left", "←", "chevron-left", () => moveBy(-24, 0));
@@ -13528,15 +13968,8 @@ function ItemToolBar($$anchor, $$props) {
13528
13968
  headerEl.appendChild(controlsEl);
13529
13969
  }
13530
13970
  if (isCalculatorShell) {
13531
- closeButtonEl = document.createElement("nds-icon-button");
13532
- closeButtonEl.setAttribute("variant", "tertiary");
13533
- closeButtonEl.setAttribute("size", "small");
13534
- closeButtonEl.setAttribute("type", "circle");
13535
- closeButtonEl.setAttribute("icon-name", "xmark");
13536
- closeButtonEl.setAttribute("button-aria-label", "Close tool");
13537
- closeButtonEl.title = "Close tool";
13971
+ closeButtonEl = createShellIconButton("Close tool", "xmark", closeShell, "fa-regular");
13538
13972
  closeButtonEl.style.display = currentArgs.mounted.entry.shell.closeable === false ? "none" : "inline-block";
13539
- closeButtonEl.addEventListener("click", closeShell);
13540
13973
  } else {
13541
13974
  const closeButton = document.createElement("button");
13542
13975
  closeButton.type = "button";
@@ -13640,20 +14073,100 @@ function ItemToolBar($$anchor, $$props) {
13640
14073
  contentEl.style.width = "100%";
13641
14074
  contentEl.style.flex = "1 1 auto";
13642
14075
  contentEl.style.minHeight = "0";
14076
+ contentEl.style.overflow = "hidden";
14077
+ contentEl.style.borderRadius = "0 0 12px 12px";
14078
+ if (isCalculatorShell) {
14079
+ const makeFocusGuard = (label) => {
14080
+ const el = document.createElement("div");
14081
+ el.tabIndex = 0;
14082
+ el.setAttribute("aria-hidden", "true");
14083
+ el.setAttribute("data-pie-tool-shell-focus-guard", label);
14084
+ el.style.position = "absolute";
14085
+ el.style.width = "1px";
14086
+ el.style.height = "1px";
14087
+ el.style.padding = "0";
14088
+ el.style.margin = "-1px";
14089
+ el.style.overflow = "hidden";
14090
+ el.style.clipPath = "inset(50%)";
14091
+ el.style.whiteSpace = "nowrap";
14092
+ el.style.border = "0";
14093
+ return el;
14094
+ };
14095
+ startFocusGuardEl = makeFocusGuard("start");
14096
+ endFocusGuardEl = makeFocusGuard("end");
14097
+ startFocusGuardEl.addEventListener("focus", (event2) => {
14098
+ if (focusGuardRedirecting)
14099
+ return;
14100
+ focusGuardRedirecting = true;
14101
+ try {
14102
+ event2.stopPropagation();
14103
+ if (openerEl?.isConnected) {
14104
+ try {
14105
+ openerEl.focus();
14106
+ } catch {}
14107
+ }
14108
+ } finally {
14109
+ queueMicrotask(() => {
14110
+ focusGuardRedirecting = false;
14111
+ });
14112
+ }
14113
+ });
14114
+ endFocusGuardEl.addEventListener("focus", (event2) => {
14115
+ if (focusGuardRedirecting)
14116
+ return;
14117
+ focusGuardRedirecting = true;
14118
+ try {
14119
+ event2.stopPropagation();
14120
+ const next22 = findFirstQuestionFocusable();
14121
+ if (next22) {
14122
+ try {
14123
+ next22.focus();
14124
+ } catch {}
14125
+ }
14126
+ } finally {
14127
+ queueMicrotask(() => {
14128
+ focusGuardRedirecting = false;
14129
+ });
14130
+ }
14131
+ });
14132
+ shellEl.appendChild(startFocusGuardEl);
14133
+ }
13643
14134
  shellEl.appendChild(headerEl);
13644
14135
  shellEl.appendChild(contentEl);
14136
+ if (isCalculatorShell && endFocusGuardEl) {
14137
+ shellEl.appendChild(endFocusGuardEl);
14138
+ }
13645
14139
  if (currentArgs.mounted.entry.shell.resizable !== false) {
13646
- resizeHandleEl = document.createElement("div");
13647
- resizeHandleEl.className = "pie-tool-shell__resize";
13648
- resizeHandleEl.style.position = "absolute";
13649
- resizeHandleEl.style.right = "0";
13650
- resizeHandleEl.style.bottom = "0";
13651
- resizeHandleEl.style.width = "24px";
13652
- resizeHandleEl.style.height = "24px";
13653
- resizeHandleEl.style.cursor = "nwse-resize";
13654
- resizeHandleEl.style.background = "linear-gradient(135deg, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)";
13655
- shellEl.appendChild(resizeHandleEl);
13656
- resizeHandleEl.addEventListener("pointerdown", onResizePointerDown);
14140
+ const addResizeHandle = (corner, top, right, bottom, left, cursor, gradientAngle) => {
14141
+ const el = document.createElement("div");
14142
+ el.className = "pie-tool-shell__resize";
14143
+ el.style.position = "absolute";
14144
+ el.style.width = "24px";
14145
+ el.style.height = "24px";
14146
+ el.style.cursor = cursor;
14147
+ el.style.zIndex = "10";
14148
+ el.style.touchAction = "none";
14149
+ el.setAttribute("draggable", "false");
14150
+ if (top !== null)
14151
+ el.style.top = top;
14152
+ if (right !== null)
14153
+ el.style.right = right;
14154
+ if (bottom !== null)
14155
+ el.style.bottom = bottom;
14156
+ if (left !== null)
14157
+ el.style.left = left;
14158
+ if (gradientAngle !== null) {
14159
+ el.style.background = `linear-gradient(${gradientAngle}, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)`;
14160
+ }
14161
+ const handler = createResizePointerDownHandler(corner);
14162
+ el.addEventListener("pointerdown", handler);
14163
+ shellEl.appendChild(el);
14164
+ resizeHandleEls.push({ el, handler });
14165
+ };
14166
+ addResizeHandle("se", null, "0", "0", null, "nwse-resize", null);
14167
+ addResizeHandle("nw", "0", null, null, "0", "nwse-resize", "135deg");
14168
+ addResizeHandle("ne", "0", "0", null, null, "nesw-resize", null);
14169
+ addResizeHandle("sw", null, null, "0", "0", "nesw-resize", null);
13657
14170
  }
13658
14171
  headerEl.addEventListener("pointerdown", onHeaderPointerDown);
13659
14172
  shellEl.addEventListener("pointermove", onShellPointerMove);
@@ -13694,10 +14207,15 @@ function ItemToolBar($$anchor, $$props) {
13694
14207
  if (focusTrapCleanup) {
13695
14208
  removeFocusTrap();
13696
14209
  }
13697
- openerEl = null;
13698
- if (resizeHandleEl) {
13699
- resizeHandleEl.removeEventListener("pointerdown", onResizePointerDown);
14210
+ if (calculatorBridgeAttached) {
14211
+ document.removeEventListener("keydown", onCalculatorBridgeKeydown, true);
14212
+ calculatorBridgeAttached = false;
14213
+ }
14214
+ for (const { el, handler } of resizeHandleEls) {
14215
+ el.removeEventListener("pointerdown", handler);
13700
14216
  }
14217
+ openerEl = null;
14218
+ resizeHandleEls.length = 0;
13701
14219
  if (headerEl) {
13702
14220
  headerEl.removeEventListener("pointerdown", onHeaderPointerDown);
13703
14221
  headerEl.onkeydown = null;
@@ -13830,7 +14348,7 @@ function ItemToolBar($$anchor, $$props) {
13830
14348
  var node_1 = first_child2(fragment);
13831
14349
  {
13832
14350
  var consequent_15 = ($$anchor2) => {
13833
- var div = root_2();
14351
+ var div = root_10();
13834
14352
  let classes;
13835
14353
  var div_1 = child2(div);
13836
14354
  var node_2 = child2(div_1);
@@ -13839,7 +14357,7 @@ function ItemToolBar($$anchor, $$props) {
13839
14357
  var node_3 = first_child2(fragment_1);
13840
14358
  {
13841
14359
  var consequent = ($$anchor4) => {
13842
- var span = root_4();
14360
+ var span = root_1();
13843
14361
  action2(span, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
13844
14362
  mounted: get22(mounted),
13845
14363
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -13847,7 +14365,7 @@ function ItemToolBar($$anchor, $$props) {
13847
14365
  append2($$anchor4, span);
13848
14366
  };
13849
14367
  var alternate = ($$anchor4) => {
13850
- var span_1 = root_5();
14368
+ var span_1 = root_1();
13851
14369
  action2(span_1, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
13852
14370
  append2($$anchor4, span_1);
13853
14371
  };
@@ -13866,7 +14384,7 @@ function ItemToolBar($$anchor, $$props) {
13866
14384
  var node_5 = first_child2(fragment_2);
13867
14385
  {
13868
14386
  var consequent_6 = ($$anchor4) => {
13869
- var a = root_7();
14387
+ var a = root_6();
13870
14388
  let classes_1;
13871
14389
  var node_6 = child2(a);
13872
14390
  {
@@ -13875,19 +14393,19 @@ function ItemToolBar($$anchor, $$props) {
13875
14393
  var node_7 = first_child2(fragment_3);
13876
14394
  {
13877
14395
  var consequent_1 = ($$anchor6) => {
13878
- var span_2 = root_9();
14396
+ var span_2 = root_2();
13879
14397
  action2(span_2, ($$node) => ndsIconButtonAction?.($$node));
13880
14398
  append2($$anchor6, span_2);
13881
14399
  };
13882
14400
  var consequent_2 = ($$anchor6) => {
13883
- var span_3 = root_10();
14401
+ var span_3 = root_3();
13884
14402
  html2(span_3, () => sanitizeSvgIcon(get22(item2).icon), true);
13885
14403
  reset2(span_3);
13886
14404
  append2($$anchor6, span_3);
13887
14405
  };
13888
14406
  var d2 = user_derived2(() => isInlineSvgIcon(get22(item2).icon));
13889
14407
  var consequent_3 = ($$anchor6) => {
13890
- var img = root_11();
14408
+ var img = root_4();
13891
14409
  template_effect2(() => set_attribute22(img, "src", get22(item2).icon));
13892
14410
  append2($$anchor6, img);
13893
14411
  };
@@ -13898,15 +14416,15 @@ function ItemToolBar($$anchor, $$props) {
13898
14416
  var node_8 = first_child2(fragment_4);
13899
14417
  {
13900
14418
  var consequent_4 = ($$anchor7) => {
13901
- var span_4 = root_13();
14419
+ var span_4 = root_3();
13902
14420
  html2(span_4, () => sanitizeSvgIcon(get22(fallbackIcon)), true);
13903
14421
  reset2(span_4);
13904
14422
  append2($$anchor7, span_4);
13905
14423
  };
13906
14424
  var alternate_1 = ($$anchor7) => {
13907
- var i = root_14();
13908
- template_effect2(() => set_class2(i, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
13909
- append2($$anchor7, i);
14425
+ var i_1 = root_5();
14426
+ template_effect2(() => set_class2(i_1, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
14427
+ append2($$anchor7, i_1);
13910
14428
  };
13911
14429
  if_block2(node_8, ($$render) => {
13912
14430
  if (get22(fallbackIcon))
@@ -13958,7 +14476,7 @@ function ItemToolBar($$anchor, $$props) {
13958
14476
  };
13959
14477
  var d_2 = user_derived2(() => isToolbarLinkItem(get22(item2)));
13960
14478
  var alternate_5 = ($$anchor4) => {
13961
- var button_1 = root_15();
14479
+ var button_1 = root_7();
13962
14480
  let classes_2;
13963
14481
  var node_9 = child2(button_1);
13964
14482
  {
@@ -13967,19 +14485,19 @@ function ItemToolBar($$anchor, $$props) {
13967
14485
  var node_10 = first_child2(fragment_5);
13968
14486
  {
13969
14487
  var consequent_7 = ($$anchor6) => {
13970
- var span_5 = root_17();
14488
+ var span_5 = root_2();
13971
14489
  action2(span_5, ($$node) => ndsIconButtonAction?.($$node));
13972
14490
  append2($$anchor6, span_5);
13973
14491
  };
13974
14492
  var consequent_8 = ($$anchor6) => {
13975
- var span_6 = root_18();
14493
+ var span_6 = root_3();
13976
14494
  html2(span_6, () => sanitizeSvgIcon(get22(item2).icon), true);
13977
14495
  reset2(span_6);
13978
14496
  append2($$anchor6, span_6);
13979
14497
  };
13980
14498
  var d_3 = user_derived2(() => isInlineSvgIcon(get22(item2).icon));
13981
14499
  var consequent_9 = ($$anchor6) => {
13982
- var img_1 = root_19();
14500
+ var img_1 = root_4();
13983
14501
  template_effect2(() => set_attribute22(img_1, "src", get22(item2).icon));
13984
14502
  append2($$anchor6, img_1);
13985
14503
  };
@@ -13990,15 +14508,15 @@ function ItemToolBar($$anchor, $$props) {
13990
14508
  var node_11 = first_child2(fragment_6);
13991
14509
  {
13992
14510
  var consequent_10 = ($$anchor7) => {
13993
- var span_7 = root_21();
14511
+ var span_7 = root_3();
13994
14512
  html2(span_7, () => sanitizeSvgIcon(get22(fallbackIcon)), true);
13995
14513
  reset2(span_7);
13996
14514
  append2($$anchor7, span_7);
13997
14515
  };
13998
14516
  var alternate_3 = ($$anchor7) => {
13999
- var i_1 = root_22();
14000
- template_effect2(() => set_class2(i_1, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
14001
- append2($$anchor7, i_1);
14517
+ var i_2 = root_5();
14518
+ template_effect2(() => set_class2(i_2, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
14519
+ append2($$anchor7, i_2);
14002
14520
  };
14003
14521
  if_block2(node_11, ($$render) => {
14004
14522
  if (get22(fallbackIcon))
@@ -14060,7 +14578,7 @@ function ItemToolBar($$anchor, $$props) {
14060
14578
  var node_13 = first_child2(fragment_7);
14061
14579
  {
14062
14580
  var consequent_12 = ($$anchor4) => {
14063
- var span_8 = root_24();
14581
+ var span_8 = root_1();
14064
14582
  action2(span_8, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
14065
14583
  mounted: get22(mounted),
14066
14584
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -14068,7 +14586,7 @@ function ItemToolBar($$anchor, $$props) {
14068
14586
  append2($$anchor4, span_8);
14069
14587
  };
14070
14588
  var alternate_6 = ($$anchor4) => {
14071
- var span_9 = root_25();
14589
+ var span_9 = root_1();
14072
14590
  action2(span_9, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
14073
14591
  append2($$anchor4, span_9);
14074
14592
  };
@@ -14085,14 +14603,14 @@ function ItemToolBar($$anchor, $$props) {
14085
14603
  var node_14 = sibling2(div_1, 2);
14086
14604
  {
14087
14605
  var consequent_14 = ($$anchor3) => {
14088
- var div_2 = root_26();
14606
+ var div_2 = root_9();
14089
14607
  let classes_3;
14090
14608
  each2(div_2, 21, () => get22(mountedElementsControlsRow), (mounted) => mounted.key, ($$anchor4, mounted) => {
14091
14609
  var fragment_8 = comment2();
14092
14610
  var node_15 = first_child2(fragment_8);
14093
14611
  {
14094
14612
  var consequent_13 = ($$anchor5) => {
14095
- var span_10 = root_28();
14613
+ var span_10 = root_8();
14096
14614
  action2(span_10, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
14097
14615
  mounted: get22(mounted),
14098
14616
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -14100,7 +14618,7 @@ function ItemToolBar($$anchor, $$props) {
14100
14618
  append2($$anchor5, span_10);
14101
14619
  };
14102
14620
  var alternate_7 = ($$anchor5) => {
14103
- var span_11 = root_29();
14621
+ var span_11 = root_8();
14104
14622
  action2(span_11, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
14105
14623
  append2($$anchor5, span_11);
14106
14624
  };