@pie-element/venn-classification 0.1.1-next.14 → 0.1.1-next.16

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.
@@ -1,16 +1,16 @@
1
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/disclose-version.js
2
2
  if (typeof window !== "undefined") {
3
3
  var _window$__svelte, _window;
4
4
  ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
5
  }
6
6
  //#endregion
7
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/constants.js
8
8
  var HYDRATION_ERROR = {};
9
9
  var UNINITIALIZED = Symbol("uninitialized");
10
10
  var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
11
11
  var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
12
12
  //#endregion
13
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/utils.js
13
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/shared/utils.js
14
14
  var is_array = Array.isArray;
15
15
  var index_of = Array.prototype.indexOf;
16
16
  var includes = Array.prototype.includes;
@@ -121,13 +121,6 @@ var EFFECT_TRANSPARENT = 65536;
121
121
  var EFFECT_PRESERVED = 1 << 19;
122
122
  var USER_EFFECT = 1 << 20;
123
123
  var EFFECT_OFFSCREEN = 1 << 25;
124
- /**
125
- * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
126
- * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
127
- * because a derived might be checked but not executed). This is a pure performance optimization flag and
128
- * should not be used for any other purpose!
129
- */
130
- var WAS_MARKED = 65536;
131
124
  var REACTION_IS_UPDATING = 1 << 21;
132
125
  var ASYNC = 1 << 22;
133
126
  var ERROR_VALUE = 1 << 23;
@@ -170,7 +163,7 @@ function svelte_boundary_reset_noop() {
170
163
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
171
164
  }
172
165
  //#endregion
173
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/hydration.js
166
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/hydration.js
174
167
  /** @import { TemplateNode } from '#client' */
175
168
  /**
176
169
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -249,7 +242,7 @@ function read_hydration_instruction(node) {
249
242
  return node.data;
250
243
  }
251
244
  //#endregion
252
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/equality.js
245
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/equality.js
253
246
  /** @import { Equals } from '#client' */
254
247
  /** @type {Equals} */
255
248
  function equals(value) {
@@ -276,7 +269,7 @@ function lifecycle_outside_component(name) {
276
269
  throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
277
270
  }
278
271
  //#endregion
279
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/errors.js
272
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/errors.js
280
273
  /**
281
274
  * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
282
275
  * @returns {never}
@@ -368,13 +361,13 @@ function svelte_boundary_reset_onerror() {
368
361
  throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
369
362
  }
370
363
  //#endregion
371
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/flags/index.js
364
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/flags/index.js
372
365
  /** True if experimental.async=true */
373
366
  var async_mode_flag = false;
374
367
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
375
368
  var legacy_mode_flag = false;
376
369
  //#endregion
377
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/context.js
370
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/context.js
378
371
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
379
372
  /** @type {ComponentContext | null} */
380
373
  var component_context = null;
@@ -434,7 +427,7 @@ function is_runes() {
434
427
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
435
428
  }
436
429
  //#endregion
437
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/task.js
430
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/task.js
438
431
  /** @type {Array<() => void>} */
439
432
  var micro_tasks = [];
440
433
  function run_micro_tasks() {
@@ -461,7 +454,7 @@ function flush_tasks() {
461
454
  while (micro_tasks.length > 0) run_micro_tasks();
462
455
  }
463
456
  //#endregion
464
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/status.js
457
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/status.js
465
458
  /** @import { Derived, Signal } from '#client' */
466
459
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
467
460
  /**
@@ -480,22 +473,8 @@ function update_derived_status(derived) {
480
473
  else set_signal_status(derived, MAYBE_DIRTY);
481
474
  }
482
475
  //#endregion
483
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
484
- /** @import { Derived, Effect, Value } from '#client' */
485
- /**
486
- * @param {Value[] | null} deps
487
- */
488
- function clear_marked(deps) {
489
- if (deps === null) return;
490
- for (const dep of deps) {
491
- if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
492
- dep.f ^= WAS_MARKED;
493
- clear_marked(
494
- /** @type {Derived} */
495
- dep.deps
496
- );
497
- }
498
- }
476
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/utils.js
477
+ /** @import { Effect } from '#client' */
499
478
  /**
500
479
  * @param {Effect} effect
501
480
  * @param {Set<Effect>} dirty_effects
@@ -504,41 +483,10 @@ function clear_marked(deps) {
504
483
  function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
505
484
  if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
506
485
  else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
507
- clear_marked(effect.deps);
508
486
  set_signal_status(effect, CLEAN);
509
487
  }
510
488
  //#endregion
511
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/store.js
512
- /**
513
- * We set this to `true` when updating a store so that we correctly
514
- * schedule effects if the update takes place inside a `$:` effect
515
- */
516
- var legacy_is_updating_store = false;
517
- /**
518
- * Whether or not the prop currently being read is a store binding, as in
519
- * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
520
- * runes mode, and skip `binding_property_non_reactive` validation
521
- */
522
- var is_store_binding = false;
523
- /**
524
- * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
525
- * Used to prevent `binding_property_non_reactive` validation false positives and
526
- * ensure that these props are treated as mutable even in runes mode
527
- * @template T
528
- * @param {() => T} fn
529
- * @returns {[T, boolean]}
530
- */
531
- function capture_store_binding(fn) {
532
- var previous_is_store_binding = is_store_binding;
533
- try {
534
- is_store_binding = false;
535
- return [fn(), is_store_binding];
536
- } finally {
537
- is_store_binding = previous_is_store_binding;
538
- }
539
- }
540
- //#endregion
541
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/misc.js
489
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/misc.js
542
490
  var listening_to_form_reset = false;
543
491
  function add_form_reset_listener() {
544
492
  if (!listening_to_form_reset) {
@@ -552,7 +500,7 @@ function add_form_reset_listener() {
552
500
  }
553
501
  }
554
502
  //#endregion
555
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
503
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
556
504
  /**
557
505
  * @template T
558
506
  * @param {() => T} fn
@@ -570,7 +518,7 @@ function without_reactive_context(fn) {
570
518
  }
571
519
  }
572
520
  //#endregion
573
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/async.js
521
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/async.js
574
522
  /** @import { Blocker, Effect, Source, Value } from '#client' */
575
523
  /**
576
524
  * @param {Blocker[]} blockers
@@ -803,7 +751,6 @@ function execute_derived(derived) {
803
751
  }
804
752
  set_active_effect(parent);
805
753
  try {
806
- derived.f &= ~WAS_MARKED;
807
754
  destroy_derived_effects(derived);
808
755
  value = update_reaction(derived);
809
756
  } finally {
@@ -890,7 +837,7 @@ function _classPrivateFieldGet2(s, a) {
890
837
  return s.get(_assertClassBrand(s, a));
891
838
  }
892
839
  //#endregion
893
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/batch.js
840
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/batch.js
894
841
  /** @import { Fork } from 'svelte' */
895
842
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
896
843
  var _Batch;
@@ -941,7 +888,7 @@ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
941
888
  var _pending = /* @__PURE__ */ new WeakMap();
942
889
  var _blocking_pending = /* @__PURE__ */ new WeakMap();
943
890
  var _deferred = /* @__PURE__ */ new WeakMap();
944
- var _roots = /* @__PURE__ */ new WeakMap();
891
+ var _scheduled = /* @__PURE__ */ new WeakMap();
945
892
  var _new_effects = /* @__PURE__ */ new WeakMap();
946
893
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
947
894
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
@@ -989,7 +936,7 @@ var Batch = class Batch {
989
936
  _classPrivateFieldInitSpec(this, _pending, 0);
990
937
  _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
991
938
  _classPrivateFieldInitSpec(this, _deferred, null);
992
- _classPrivateFieldInitSpec(this, _roots, []);
939
+ _classPrivateFieldInitSpec(this, _scheduled, []);
993
940
  _classPrivateFieldInitSpec(this, _new_effects, []);
994
941
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
995
942
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
@@ -1178,20 +1125,7 @@ var Batch = class Batch {
1178
1125
  effect.b.defer_effect(effect);
1179
1126
  return;
1180
1127
  }
1181
- var e = effect;
1182
- while (e.parent !== null) {
1183
- e = e.parent;
1184
- var flags = e.f;
1185
- if (collected_effects !== null && e === active_effect) {
1186
- if (async_mode_flag) return;
1187
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1188
- }
1189
- if ((flags & 96) !== 0) {
1190
- if ((flags & 1024) === 0) return;
1191
- e.f ^= CLEAN;
1192
- }
1193
- }
1194
- _classPrivateFieldGet2(_roots, this).push(e);
1128
+ _classPrivateFieldGet2(_scheduled, this).push(effect);
1195
1129
  }
1196
1130
  };
1197
1131
  _Batch = Batch;
@@ -1211,12 +1145,40 @@ function _is_deferred() {
1211
1145
  }
1212
1146
  return false;
1213
1147
  }
1148
+ /**
1149
+ * Convert the effects that were scheduled in this batch into the root effects
1150
+ * that need to be traversed, marking the path to each effect (by clearing the
1151
+ * `CLEAN` flag on ancestor branches) so that the traversal can find them.
1152
+ * This happens right before traversal rather than at scheduling time, so that
1153
+ * the markers left on the (shared) effect tree are created and consumed within
1154
+ * a single traversal — scheduling into other batches can never observe them
1155
+ * @returns {Effect[]}
1156
+ */
1157
+ function _resolve$1() {
1158
+ /** @type {Effect[]} */
1159
+ var roots = [];
1160
+ for (const effect of _classPrivateFieldGet2(_scheduled, this)) {
1161
+ if ((effect.f & 16384) !== 0 || (effect.f & 6144) === 0) continue;
1162
+ var e = effect;
1163
+ var covered = false;
1164
+ while (e.parent !== null) {
1165
+ e = e.parent;
1166
+ var flags = e.f;
1167
+ if ((flags & 96) !== 0) {
1168
+ if ((flags & 1024) === 0) {
1169
+ covered = true;
1170
+ break;
1171
+ }
1172
+ e.f ^= CLEAN;
1173
+ }
1174
+ }
1175
+ if (!covered) roots.push(e);
1176
+ }
1177
+ _classPrivateFieldSet2(_scheduled, this, []);
1178
+ return roots;
1179
+ }
1214
1180
  function _process() {
1215
1181
  _classPrivateFieldSet2(_started, this, true);
1216
- if (flush_count++ > 1e3) {
1217
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1218
- infinite_loop_guard();
1219
- }
1220
1182
  for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
1221
1183
  _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
1222
1184
  set_signal_status(e, DIRTY);
@@ -1226,8 +1188,6 @@ function _process() {
1226
1188
  set_signal_status(e, MAYBE_DIRTY);
1227
1189
  this.schedule(e);
1228
1190
  }
1229
- const roots = _classPrivateFieldGet2(_roots, this);
1230
- _classPrivateFieldSet2(_roots, this, []);
1231
1191
  this.apply();
1232
1192
  /** @type {Effect[]} */
1233
1193
  var effects = collected_effects = [];
@@ -1238,12 +1198,18 @@ function _process() {
1238
1198
  * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1239
1199
  */
1240
1200
  var updates = legacy_updates = [];
1241
- for (const root of roots) try {
1242
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1243
- } catch (e) {
1244
- reset_all(root);
1245
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1246
- throw e;
1201
+ while (_classPrivateFieldGet2(_scheduled, this).length > 0) {
1202
+ if (flush_count++ > 1e3) {
1203
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1204
+ infinite_loop_guard();
1205
+ }
1206
+ for (const root of _assertClassBrand(_Batch_brand, this, _resolve$1).call(this)) try {
1207
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1208
+ } catch (e) {
1209
+ reset_all(root);
1210
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1211
+ throw e;
1212
+ }
1247
1213
  }
1248
1214
  current_batch = null;
1249
1215
  if (updates.length > 0) {
@@ -1277,16 +1243,16 @@ function _process() {
1277
1243
  previous_batch = null;
1278
1244
  _classPrivateFieldGet2(_deferred, this)?.resolve();
1279
1245
  var next_batch = current_batch;
1280
- if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
1246
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_scheduled, this).length === 0 || next_batch !== null)) {
1281
1247
  _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1282
1248
  if (async_mode_flag) {
1283
1249
  _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
1284
1250
  current_batch = next_batch;
1285
1251
  }
1286
1252
  }
1287
- if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1288
- const batch = next_batch;
1289
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1253
+ if (_classPrivateFieldGet2(_scheduled, this).length > 0) if (next_batch !== null) {
1254
+ for (const e of _classPrivateFieldGet2(_scheduled, this)) _classPrivateFieldGet2(_scheduled, next_batch).push(e);
1255
+ _classPrivateFieldSet2(_scheduled, this, []);
1290
1256
  } else next_batch = this;
1291
1257
  if (next_batch !== null) {
1292
1258
  old_values.clear();
@@ -1436,10 +1402,9 @@ function _commit$1() {
1436
1402
  batch.schedule(effect);
1437
1403
  } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1438
1404
  }
1439
- if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1405
+ if (_classPrivateFieldGet2(_scheduled, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1440
1406
  batch.apply();
1441
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1442
- _classPrivateFieldSet2(_roots, batch, []);
1407
+ for (var root of _assertClassBrand(_Batch_brand, batch, _resolve$1).call(batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1443
1408
  }
1444
1409
  batch.deactivate();
1445
1410
  }
@@ -1606,7 +1571,7 @@ function reset_all(effect) {
1606
1571
  }
1607
1572
  }
1608
1573
  //#endregion
1609
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1574
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1610
1575
  /** @import { Derived, Effect, Source, Value } from '#client' */
1611
1576
  /** @type {Set<Effect>} */
1612
1577
  var eager_effects = /* @__PURE__ */ new Set();
@@ -1668,6 +1633,16 @@ function set(source, value, should_proxy = false) {
1668
1633
  return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1669
1634
  }
1670
1635
  /**
1636
+ * A set of signals we have already seen while traversing in mark_reactions.
1637
+ * Not always set to balance the common case of sources only having a couple
1638
+ * of (transitive) dependencies (where always creating a Set would be bad for perf)
1639
+ * with the edge case of extremely deep or wide dependency arrays with cycles.
1640
+ * @type {Set<any> | null}
1641
+ */
1642
+ var seen = null;
1643
+ /** Number of transitive dependencies, see {@link seen} for more info */
1644
+ var count_deps = 0;
1645
+ /**
1671
1646
  * @template V
1672
1647
  * @param {Source<V>} source
1673
1648
  * @param {V} value
@@ -1686,7 +1661,10 @@ function internal_set(source, value, updated_during_traversal = null) {
1686
1661
  if (batch_values === null) update_derived_status(derived);
1687
1662
  }
1688
1663
  source.wv = increment_write_version();
1664
+ seen = null;
1665
+ count_deps = 0;
1689
1666
  mark_reactions(source, DIRTY, updated_during_traversal);
1667
+ seen = null;
1690
1668
  if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
1691
1669
  else untracked_writes.push(source);
1692
1670
  if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
@@ -1725,6 +1703,12 @@ function mark_reactions(signal, status, updated_during_traversal) {
1725
1703
  if (reactions === null) return;
1726
1704
  var runes = is_runes();
1727
1705
  var length = reactions.length;
1706
+ count_deps += length;
1707
+ if (count_deps > 1e5 && seen === null) seen = /* @__PURE__ */ new Set();
1708
+ if (seen !== null) {
1709
+ if (seen.has(signal)) return;
1710
+ seen.add(signal);
1711
+ }
1728
1712
  for (var i = 0; i < length; i++) {
1729
1713
  var reaction = reactions[i];
1730
1714
  var flags = reaction.f;
@@ -1735,10 +1719,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
1735
1719
  else if ((flags & 2) !== 0) {
1736
1720
  var derived = reaction;
1737
1721
  batch_values?.delete(derived);
1738
- if ((flags & 65536) === 0) {
1739
- if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1740
- mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1741
- }
1722
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1742
1723
  } else if (not_dirty) {
1743
1724
  var effect = reaction;
1744
1725
  if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
@@ -1826,14 +1807,14 @@ function proxy(value) {
1826
1807
  return Reflect.get(target, prop, receiver);
1827
1808
  },
1828
1809
  getOwnPropertyDescriptor(target, prop) {
1810
+ this.has?.(target, prop);
1829
1811
  var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1830
- if (descriptor && "value" in descriptor) {
1831
- var s = sources.get(prop);
1832
- if (s) descriptor.value = get$1(s);
1833
- } else if (descriptor === void 0) {
1834
- var source = sources.get(prop);
1835
- var value = source?.v;
1836
- if (source !== void 0 && value !== UNINITIALIZED) return {
1812
+ var s = sources.get(prop);
1813
+ if (s !== void 0) {
1814
+ var value = get$1(s);
1815
+ if (value === UNINITIALIZED) return;
1816
+ if (descriptor && "value" in descriptor) descriptor.value = value;
1817
+ else return {
1837
1818
  enumerable: true,
1838
1819
  configurable: true,
1839
1820
  value,
@@ -1906,7 +1887,7 @@ function proxy(value) {
1906
1887
  });
1907
1888
  }
1908
1889
  //#endregion
1909
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/operations.js
1890
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/operations.js
1910
1891
  /** @import { Effect, TemplateNode } from '#client' */
1911
1892
  /** @type {Window} */
1912
1893
  var $window;
@@ -2131,7 +2112,7 @@ function invoke_error_boundary(error, effect) {
2131
2112
  throw error;
2132
2113
  }
2133
2114
  //#endregion
2134
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/effects.js
2115
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/effects.js
2135
2116
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2136
2117
  /**
2137
2118
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2531,14 +2512,14 @@ function move_effect(effect, fragment) {
2531
2512
  }
2532
2513
  }
2533
2514
  //#endregion
2534
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/legacy.js
2515
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/legacy.js
2535
2516
  /**
2536
2517
  * @type {Set<Value> | null}
2537
2518
  * @deprecated
2538
2519
  */
2539
2520
  var captured_signals = null;
2540
2521
  //#endregion
2541
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
2522
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/runtime.js
2542
2523
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2543
2524
  /**
2544
2525
  * True if updating in an effect context that is reactive (i.e. not branch/root effects)
@@ -2570,7 +2551,7 @@ function set_active_effect(effect) {
2570
2551
  var current_sources = null;
2571
2552
  /** @param {Value} value */
2572
2553
  function push_reaction_value(value) {
2573
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2554
+ if (active_reaction !== null && (!async_mode_flag && (active_reaction.f & 2097152) !== 0 || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2574
2555
  }
2575
2556
  /**
2576
2557
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2614,7 +2595,6 @@ function increment_write_version() {
2614
2595
  function is_dirty(reaction) {
2615
2596
  var flags = reaction.f;
2616
2597
  if ((flags & 2048) !== 0) return true;
2617
- if (flags & 2) reaction.f &= ~WAS_MARKED;
2618
2598
  if ((flags & 4096) !== 0) {
2619
2599
  var dependencies = reaction.deps;
2620
2600
  var length = dependencies.length;
@@ -2746,10 +2726,7 @@ function remove_reaction(signal, dependency) {
2746
2726
  }
2747
2727
  if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2748
2728
  var derived = dependency;
2749
- if ((derived.f & 512) !== 0) {
2750
- derived.f ^= 512;
2751
- derived.f &= ~WAS_MARKED;
2752
- }
2729
+ if ((derived.f & 512) !== 0) derived.f ^= 512;
2753
2730
  if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2754
2731
  if (derived.ac !== null) without_reactive_context(() => {
2755
2732
  /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
@@ -2910,7 +2887,7 @@ function untrack(fn) {
2910
2887
  }
2911
2888
  }
2912
2889
  //#endregion
2913
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/events.js
2890
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/events.js
2914
2891
  /**
2915
2892
  * Used on elements, as a map of event type -> event handler,
2916
2893
  * and on events themselves to track which element handled an event
@@ -2936,10 +2913,12 @@ function create_event(event_name, dom, handler, options = {}) {
2936
2913
  return handler?.call(this, event);
2937
2914
  });
2938
2915
  }
2939
- if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") queue_micro_task(() => {
2940
- dom.addEventListener(event_name, target_handler, options);
2941
- });
2942
- else dom.addEventListener(event_name, target_handler, options);
2916
+ if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") {
2917
+ target_handler.__removed = false;
2918
+ queue_micro_task(() => {
2919
+ if (!target_handler.__removed) dom.addEventListener(event_name, target_handler, options);
2920
+ });
2921
+ } else dom.addEventListener(event_name, target_handler, options);
2943
2922
  return target_handler;
2944
2923
  }
2945
2924
  /**
@@ -2957,6 +2936,7 @@ function event(event_name, dom, handler, capture, passive) {
2957
2936
  };
2958
2937
  var target_handler = create_event(event_name, dom, handler, options);
2959
2938
  if (dom === document.body || dom === window || dom === document || dom instanceof HTMLMediaElement) teardown(() => {
2939
+ target_handler.__removed = true;
2960
2940
  dom.removeEventListener(event_name, target_handler, options);
2961
2941
  });
2962
2942
  }
@@ -3058,7 +3038,7 @@ function handle_event_propagation(event) {
3058
3038
  }
3059
3039
  }
3060
3040
  //#endregion
3061
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/reconciler.js
3041
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3062
3042
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3063
3043
  /** @param {string} html */
3064
3044
  createHTML: (html) => {
@@ -3077,7 +3057,7 @@ function create_fragment_from_html(html) {
3077
3057
  return elem.content;
3078
3058
  }
3079
3059
  //#endregion
3080
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/template.js
3060
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/template.js
3081
3061
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3082
3062
  /** @import { TemplateStructure } from './types' */
3083
3063
  /**
@@ -3222,7 +3202,7 @@ function is_passive_event(name) {
3222
3202
  return PASSIVE_EVENTS.includes(name);
3223
3203
  }
3224
3204
  //#endregion
3225
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/reactivity/create-subscriber.js
3205
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/reactivity/create-subscriber.js
3226
3206
  /**
3227
3207
  * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
3228
3208
  * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
@@ -3295,7 +3275,7 @@ function createSubscriber(start) {
3295
3275
  };
3296
3276
  }
3297
3277
  //#endregion
3298
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
3278
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
3299
3279
  /** @import { Effect, Source, TemplateNode, } from '#client' */
3300
3280
  /**
3301
3281
  * @typedef {{
@@ -3865,7 +3845,7 @@ function unmount(component, options) {
3865
3845
  return Promise.resolve();
3866
3846
  }
3867
3847
  //#endregion
3868
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3848
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3869
3849
  /** @import { Effect, TemplateNode } from '#client' */
3870
3850
  var _batches = /* @__PURE__ */ new WeakMap();
3871
3851
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3988,7 +3968,7 @@ var BranchManager = class {
3988
3968
  }
3989
3969
  };
3990
3970
  //#endregion
3991
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/snippet.js
3971
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/snippet.js
3992
3972
  /** @import { Snippet } from 'svelte' */
3993
3973
  /** @import { TemplateNode } from '#client' */
3994
3974
  /** @import { Getters } from '#shared' */
@@ -4054,7 +4034,7 @@ function init_update_callbacks(context) {
4054
4034
  });
4055
4035
  }
4056
4036
  //#endregion
4057
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/if.js
4037
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
4058
4038
  /** @import { TemplateNode } from '#client' */
4059
4039
  /**
4060
4040
  * @param {TemplateNode} node
@@ -4100,7 +4080,7 @@ function if_block(node, fn, elseif = false) {
4100
4080
  }, flags);
4101
4081
  }
4102
4082
  //#endregion
4103
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/each.js
4083
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/each.js
4104
4084
  /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
4105
4085
  /** @import { Batch } from '../../reactivity/batch.js'; */
4106
4086
  /**
@@ -4572,7 +4552,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
4572
4552
  });
4573
4553
  }
4574
4554
  //#endregion
4575
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/css.js
4555
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/css.js
4576
4556
  /**
4577
4557
  * @param {Node} anchor
4578
4558
  * @param {{ hash: string, code: string }} css
@@ -4591,7 +4571,7 @@ function append_styles$1(anchor, css) {
4591
4571
  });
4592
4572
  }
4593
4573
  //#endregion
4594
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/attributes.js
4574
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/shared/attributes.js
4595
4575
  var whitespace$1 = [..." \n\r\f\xA0\v"];
4596
4576
  /**
4597
4577
  * @param {any} value
@@ -4701,7 +4681,7 @@ function to_style(value, styles) {
4701
4681
  return value == null ? null : String(value);
4702
4682
  }
4703
4683
  //#endregion
4704
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/class.js
4684
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/class.js
4705
4685
  /**
4706
4686
  * @param {Element} dom
4707
4687
  * @param {boolean | number} is_html
@@ -4726,7 +4706,7 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4726
4706
  return next_classes;
4727
4707
  }
4728
4708
  //#endregion
4729
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/style.js
4709
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/style.js
4730
4710
  /**
4731
4711
  * @param {Element & ElementCSSInlineStyle} dom
4732
4712
  * @param {Record<string, any>} prev
@@ -4760,7 +4740,7 @@ function set_style(dom, value, prev_styles, next_styles) {
4760
4740
  return next_styles;
4761
4741
  }
4762
4742
  //#endregion
4763
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4743
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4764
4744
  /** @import { Blocker, Effect } from '#client' */
4765
4745
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
4766
4746
  var IS_HTML = Symbol("is html");
@@ -4861,7 +4841,7 @@ function get_setters(element) {
4861
4841
  return setters;
4862
4842
  }
4863
4843
  //#endregion
4864
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4844
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4865
4845
  var _ResizeObserverSingleton;
4866
4846
  var _listeners = /* @__PURE__ */ new WeakMap();
4867
4847
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -4926,7 +4906,7 @@ function bind_element_size(element, type, set) {
4926
4906
  });
4927
4907
  }
4928
4908
  //#endregion
4929
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
4909
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
4930
4910
  /** @import { ComponentContext, Effect } from '#client' */
4931
4911
  /**
4932
4912
  * @param {any} bound_value
@@ -4977,6 +4957,31 @@ function bind_this(element_or_component = mark_as_component(), update, get_value
4977
4957
  });
4978
4958
  return element_or_component;
4979
4959
  }
4960
+ //#endregion
4961
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/store.js
4962
+ /**
4963
+ * Whether or not the prop currently being read is a store binding, as in
4964
+ * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
4965
+ * runes mode, and skip `binding_property_non_reactive` validation
4966
+ */
4967
+ var is_store_binding = false;
4968
+ /**
4969
+ * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
4970
+ * Used to prevent `binding_property_non_reactive` validation false positives and
4971
+ * ensure that these props are treated as mutable even in runes mode
4972
+ * @template T
4973
+ * @param {() => T} fn
4974
+ * @returns {[T, boolean]}
4975
+ */
4976
+ function capture_store_binding(fn) {
4977
+ var previous_is_store_binding = is_store_binding;
4978
+ try {
4979
+ is_store_binding = false;
4980
+ return [fn(), is_store_binding];
4981
+ } finally {
4982
+ is_store_binding = previous_is_store_binding;
4983
+ }
4984
+ }
4980
4985
  /**
4981
4986
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
4982
4987
  * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
@@ -5068,7 +5073,7 @@ function prop(props, key, flags, fallback) {
5068
5073
  });
5069
5074
  }
5070
5075
  //#endregion
5071
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/legacy/legacy-client.js
5076
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/legacy/legacy-client.js
5072
5077
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
5073
5078
  /**
5074
5079
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -5187,7 +5192,7 @@ var Svelte4Component = class {
5187
5192
  }
5188
5193
  };
5189
5194
  //#endregion
5190
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
5195
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
5191
5196
  /**
5192
5197
  * @typedef {Object} CustomElementPropDefinition
5193
5198
  * @property {string} [attribute]
@@ -5599,12 +5604,12 @@ var p$1 = /* @__PURE__ */ from_html("<label class=\"pie-settings-choice-row svel
5599
5604
  var m$1 = /* @__PURE__ */ from_html("<fieldset class=\"pie-settings-choice svelte-1ang3sw\"><legend class=\"svelte-1ang3sw\"> </legend> <!></fieldset>");
5600
5605
  var h$2 = /* @__PURE__ */ from_html("<fieldset class=\"pie-settings-group svelte-1ang3sw\"><legend class=\"pie-settings-group-name svelte-1ang3sw\"> </legend> <!></fieldset>");
5601
5606
  var g$1 = /* @__PURE__ */ from_html("<div class=\"pie-settings-panel svelte-1ang3sw\"></div>");
5602
- var _ = {
5607
+ var _$1 = {
5603
5608
  hash: "svelte-1ang3sw",
5604
5609
  code: ".pie-settings-panel.svelte-1ang3sw {display:flex;flex-direction:column;gap:16px;padding:16px;border:1px solid var(--pie-border-light, #ccc);border-radius:4px;color:var(--pie-text, #212121);}fieldset.svelte-1ang3sw {margin:0;padding:0;border:0;min-width:0;}.pie-settings-group.svelte-1ang3sw {display:flex;flex-direction:column;gap:8px;}.pie-settings-group-name.svelte-1ang3sw {margin-bottom:8px;font-weight:600;}.pie-settings-toggle.svelte-1ang3sw {display:flex;align-items:center;justify-content:space-between;gap:12px;}.pie-settings-choice.svelte-1ang3sw legend:where(.svelte-1ang3sw) {margin-bottom:4px;}.pie-settings-choice-row.svelte-1ang3sw {display:flex;align-items:center;gap:8px;}input.svelte-1ang3sw {accent-color:var(--pie-primary, #3f51b5);}input.svelte-1ang3sw:focus-visible {outline:2px solid var(--pie-focus-outline, #1a73e8);outline-offset:2px;}"
5605
5610
  };
5606
5611
  function v$1(t, n) {
5607
- push(n, !0), append_styles$1(t, _);
5612
+ push(n, !0), append_styles$1(t, _$1);
5608
5613
  let r = prop(n, "configuration", 19, () => ({})), i = Math.random().toString(36).slice(2, 10), a = /* @__PURE__ */ user_derived(() => Object.entries(n.groups).map(([e, t]) => [e, Object.entries(t).filter((e) => !!e[1])]).filter(([, e]) => e.length > 0)), o = (e, t) => u$1(t.isConfigProperty ? r() : n.model, e);
5609
5614
  function s(e, t, i) {
5610
5615
  t.isConfigProperty ? n.onChangeConfiguration?.(d$1(r(), e, i), e) : n.onChangeModel(d$1(n.model, e, i), e);
@@ -5737,7 +5742,7 @@ OrderedMap.from = function(value) {
5737
5742
  return new OrderedMap(content);
5738
5743
  };
5739
5744
  //#endregion
5740
- //#region ../../../node_modules/.bun/prosemirror-model@1.25.11/node_modules/prosemirror-model/dist/index.js
5745
+ //#region ../../../node_modules/.bun/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js
5741
5746
  function findDiffStart(a, b, pos) {
5742
5747
  for (let i = 0;; i++) {
5743
5748
  if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
@@ -6183,9 +6188,7 @@ var Mark$1 = class Mark$1 {
6183
6188
  if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
6184
6189
  let type = schema.marks[json.type];
6185
6190
  if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
6186
- let mark = type.create(json.attrs);
6187
- type.checkAttrs(mark.attrs);
6188
- return mark;
6191
+ return type.create(json.attrs);
6189
6192
  }
6190
6193
  /**
6191
6194
  Test whether two sets of marks are identical.
@@ -7082,11 +7085,11 @@ var Node$2 = class Node$2 {
7082
7085
  */
7083
7086
  check() {
7084
7087
  this.type.checkContent(this.content);
7085
- this.type.checkAttrs(this.attrs);
7088
+ checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
7086
7089
  let copy = Mark$1.none;
7087
7090
  for (let i = 0; i < this.marks.length; i++) {
7088
7091
  let mark = this.marks[i];
7089
- mark.type.checkAttrs(mark.attrs);
7092
+ checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
7090
7093
  copy = mark.addToSet(copy);
7091
7094
  }
7092
7095
  if (!Mark$1.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
@@ -7120,9 +7123,7 @@ var Node$2 = class Node$2 {
7120
7123
  return schema.text(json.text, marks);
7121
7124
  }
7122
7125
  let content = Fragment.fromJSON(schema, json.content);
7123
- let node = schema.nodeType(json.type).create(json.attrs, content, marks);
7124
- node.type.checkAttrs(node.attrs);
7125
- return node;
7126
+ return schema.nodeType(json.type).create(json.attrs, content, marks);
7126
7127
  }
7127
7128
  };
7128
7129
  Node$2.prototype.text = void 0;
@@ -7172,6 +7173,10 @@ function wrapMarks(marks, str) {
7172
7173
  for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
7173
7174
  return str;
7174
7175
  }
7176
+ function checkAttrs(attrs, values, type, name) {
7177
+ for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
7178
+ for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
7179
+ }
7175
7180
  /**
7176
7181
  Instances of this class represent a match state of a node type's
7177
7182
  [content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
@@ -7580,20 +7585,15 @@ function defaultAttrs(attrs) {
7580
7585
  function computeAttrs(attrs, value) {
7581
7586
  let built = Object.create(null);
7582
7587
  for (let name in attrs) {
7588
+ let attr = attrs[name];
7583
7589
  let given = value && value[name];
7584
- if (given === void 0) {
7585
- let attr = attrs[name];
7586
- if (attr.hasDefault) given = attr.default;
7587
- else throw new RangeError("No value supplied for attribute " + name);
7588
- }
7590
+ if (given === void 0) if (attr.hasDefault) given = attr.default;
7591
+ else throw new RangeError("No value supplied for attribute " + name);
7592
+ else if (attr.validate) attr.validate(given);
7589
7593
  built[name] = given;
7590
7594
  }
7591
7595
  return built;
7592
7596
  }
7593
- function checkAttrs(attrs, values, type, name) {
7594
- for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
7595
- for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
7596
- }
7597
7597
  function initAttrs(typeName, attrs) {
7598
7598
  let result = Object.create(null);
7599
7599
  if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
@@ -7748,11 +7748,9 @@ var NodeType$1 = class NodeType$1 {
7748
7748
  if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
7749
7749
  }
7750
7750
  /**
7751
- @internal
7751
+ @internal no longer useful, but called by old prosemirror-view versions
7752
7752
  */
7753
- checkAttrs(attrs) {
7754
- checkAttrs(this.attrs, attrs, "node", this.name);
7755
- }
7753
+ checkAttrs(attrs) {}
7756
7754
  /**
7757
7755
  Check whether the given mark type is allowed in this node.
7758
7756
  */
@@ -7863,12 +7861,6 @@ var MarkType = class MarkType {
7863
7861
  for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
7864
7862
  }
7865
7863
  /**
7866
- @internal
7867
- */
7868
- checkAttrs(attrs) {
7869
- checkAttrs(this.attrs, attrs, "mark", this.name);
7870
- }
7871
- /**
7872
7864
  Queries whether a given mark type is
7873
7865
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
7874
7866
  */
@@ -8727,7 +8719,7 @@ function renderSpec(doc, structure, xmlNS, blockArraysIn) {
8727
8719
  };
8728
8720
  }
8729
8721
  //#endregion
8730
- //#region ../../../node_modules/.bun/prosemirror-transform@1.12.0/node_modules/prosemirror-transform/dist/index.js
8722
+ //#region ../../../node_modules/.bun/prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js
8731
8723
  var lower16 = 65535;
8732
8724
  var factor16 = Math.pow(2, 16);
8733
8725
  function makeRecover(index, offset) {
@@ -8830,8 +8822,11 @@ var StepMap = class StepMap {
8830
8822
  let result = start + diff + (side < 0 ? 0 : newSize);
8831
8823
  if (simple) return result;
8832
8824
  let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
8833
- let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
8834
- if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8825
+ let del = 0;
8826
+ if (oldSize) {
8827
+ del |= pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
8828
+ if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8829
+ }
8835
8830
  return new MapResult(result, del, recover);
8836
8831
  }
8837
8832
  diff += newSize - oldSize;
@@ -9952,9 +9947,9 @@ var Fitter = class {
9952
9947
  }
9953
9948
  openMore() {
9954
9949
  let { content, openStart, openEnd } = this.unplaced;
9955
- let inner = contentAt(content, openStart);
9956
- if (!inner.childCount || inner.firstChild.isLeaf) return false;
9957
- this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
9950
+ if (maxOpen(content, -1) <= openStart) return false;
9951
+ if (this.unplaced.size > 1 && maxOpen(content, 1) > openEnd) openEnd++;
9952
+ this.unplaced = new Slice(content, openStart + 1, openEnd);
9958
9953
  return true;
9959
9954
  }
9960
9955
  dropNode() {
@@ -10088,6 +10083,13 @@ function invalidMarks(type, fragment, start) {
10088
10083
  function definesContent(type) {
10089
10084
  return type.spec.defining || type.spec.definingForContent;
10090
10085
  }
10086
+ function maxOpen(frag, side) {
10087
+ for (let count = 0;; count++) {
10088
+ let ch = side < 0 ? frag.firstChild : frag.lastChild;
10089
+ if (!ch || ch.isAtom) return count;
10090
+ frag = ch.content;
10091
+ }
10092
+ }
10091
10093
  function replaceRange(tr, from, to, slice) {
10092
10094
  if (!slice.size) return tr.deleteRange(from, to);
10093
10095
  let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
@@ -11533,7 +11535,7 @@ var PluginKey = class {
11533
11535
  }
11534
11536
  };
11535
11537
  //#endregion
11536
- //#region ../../../node_modules/.bun/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js
11538
+ //#region ../../../node_modules/.bun/prosemirror-commands@1.7.2/node_modules/prosemirror-commands/dist/index.js
11537
11539
  /**
11538
11540
  Delete the selection, if there is one.
11539
11541
  */
@@ -11855,20 +11857,23 @@ a custom function to determine the type of the newly split off block.
11855
11857
  */
11856
11858
  function splitBlockAs(splitNode) {
11857
11859
  return (state, dispatch) => {
11858
- let { $from, $to } = state.selection;
11859
11860
  if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {
11861
+ let { $from } = state.selection;
11860
11862
  if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;
11861
11863
  if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());
11862
11864
  return true;
11863
11865
  }
11864
- if (!$from.depth) return false;
11866
+ if (!state.selection.$from.depth) return false;
11867
+ let tr = state.tr;
11868
+ if (!state.selection.empty && (state.selection instanceof TextSelection || state.selection instanceof AllSelection)) tr.deleteSelection();
11869
+ let { $from } = tr.selection, mapFrom = tr.steps.length;
11865
11870
  let types = [];
11866
11871
  let splitDepth, deflt, atEnd = false, atStart = false;
11867
11872
  for (let d = $from.depth;; d--) if ($from.node(d).isBlock) {
11868
11873
  atEnd = $from.end(d) == $from.pos + ($from.depth - d);
11869
11874
  atStart = $from.start(d) == $from.pos - ($from.depth - d);
11870
11875
  deflt = defaultBlockAt$1($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
11871
- let splitType = splitNode && splitNode($to.parent, atEnd, $from);
11876
+ let splitType = splitNode && splitNode($from.parent, atEnd, $from);
11872
11877
  types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));
11873
11878
  splitDepth = d;
11874
11879
  break;
@@ -11876,9 +11881,7 @@ function splitBlockAs(splitNode) {
11876
11881
  if (d == 1) return false;
11877
11882
  types.unshift(null);
11878
11883
  }
11879
- let tr = state.tr;
11880
- if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();
11881
- let splitPos = tr.mapping.map($from.pos);
11884
+ let splitPos = $from.pos;
11882
11885
  let can = canSplit(tr.doc, splitPos, types.length, types);
11883
11886
  if (!can) {
11884
11887
  types[0] = deflt ? { type: deflt } : null;
@@ -11887,8 +11890,9 @@ function splitBlockAs(splitNode) {
11887
11890
  if (!can) return false;
11888
11891
  tr.split(splitPos, types.length, types);
11889
11892
  if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
11890
- let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
11891
- if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
11893
+ let mapping = tr.mapping.slice(mapFrom);
11894
+ let first = mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
11895
+ if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(mapping.map($from.before(splitDepth)), deflt);
11892
11896
  }
11893
11897
  if (dispatch) dispatch(tr.scrollIntoView());
11894
11898
  return true;
@@ -12214,7 +12218,7 @@ function sinkListItem(itemType) {
12214
12218
  };
12215
12219
  }
12216
12220
  //#endregion
12217
- //#region ../../../node_modules/.bun/prosemirror-view@1.42.3/node_modules/prosemirror-view/dist/index.js
12221
+ //#region ../../../node_modules/.bun/prosemirror-view@1.42.6/node_modules/prosemirror-view/dist/index.js
12218
12222
  var domIndex = function(node) {
12219
12223
  for (var index = 0;; index++) {
12220
12224
  node = node.previousSibling;
@@ -12245,12 +12249,12 @@ function scanFor(node, off, targetNode, targetOff, dir) {
12245
12249
  if (node == targetNode && off == targetOff) return true;
12246
12250
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
12247
12251
  let parent = node.parentNode;
12248
- if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
12252
+ if (!parent || !isElt(parent) || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
12249
12253
  off = domIndex(node) + (dir < 0 ? 0 : 1);
12250
12254
  node = parent;
12251
- } else if (node.nodeType == 1) {
12255
+ } else if (isElt(node)) {
12252
12256
  let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
12253
- if (child.nodeType == 1 && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
12257
+ if (isElt(child) && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
12254
12258
  else return false;
12255
12259
  else {
12256
12260
  node = child;
@@ -12262,10 +12266,19 @@ function scanFor(node, off, targetNode, targetOff, dir) {
12262
12266
  function nodeSize(node) {
12263
12267
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
12264
12268
  }
12269
+ function isElt(node) {
12270
+ return node.nodeType == 1;
12271
+ }
12272
+ function isText(node) {
12273
+ return node.nodeType == 3;
12274
+ }
12275
+ function contains(parent, child) {
12276
+ return child ? parent.contains(isElt(child) ? child : child.parentNode) : false;
12277
+ }
12265
12278
  function textNodeBefore$1(node, offset) {
12266
12279
  for (;;) {
12267
- if (node.nodeType == 3 && offset) return node;
12268
- if (node.nodeType == 1 && offset > 0) {
12280
+ if (isText(node) && offset) return node;
12281
+ if (isElt(node) && offset > 0) {
12269
12282
  if (node.contentEditable == "false") return null;
12270
12283
  node = node.childNodes[offset - 1];
12271
12284
  offset = nodeSize(node);
@@ -12277,8 +12290,8 @@ function textNodeBefore$1(node, offset) {
12277
12290
  }
12278
12291
  function textNodeAfter$1(node, offset) {
12279
12292
  for (;;) {
12280
- if (node.nodeType == 3 && offset < node.nodeValue.length) return node;
12281
- if (node.nodeType == 1 && offset < node.childNodes.length) {
12293
+ if (isText(node) && offset < node.nodeValue.length) return node;
12294
+ if (isElt(node) && offset < node.childNodes.length) {
12282
12295
  if (node.contentEditable == "false") return null;
12283
12296
  node = node.childNodes[offset];
12284
12297
  offset = 0;
@@ -12389,13 +12402,12 @@ function scrollRectIntoView(view, rect, startDOM) {
12389
12402
  let doc = view.dom.ownerDocument;
12390
12403
  for (let parent = startDOM || view.dom;;) {
12391
12404
  if (!parent) break;
12392
- if (parent.nodeType != 1) {
12405
+ if (!isElt(parent)) {
12393
12406
  parent = parentNode(parent);
12394
12407
  continue;
12395
12408
  }
12396
- let elt = parent;
12397
- let atTop = elt == doc.body;
12398
- let bounding = atTop ? windowRect(doc) : clientRect(elt);
12409
+ let atTop = parent == doc.body;
12410
+ let bounding = atTop ? windowRect(doc) : clientRect(parent);
12399
12411
  let moveX = 0, moveY = 0;
12400
12412
  if (rect.top < bounding.top + getSide(scrollThreshold, "top")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
12401
12413
  else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
@@ -12403,10 +12415,10 @@ function scrollRectIntoView(view, rect, startDOM) {
12403
12415
  else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
12404
12416
  if (moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY);
12405
12417
  else {
12406
- let startX = elt.scrollLeft, startY = elt.scrollTop;
12407
- if (moveY) elt.scrollTop += moveY;
12408
- if (moveX) elt.scrollLeft += moveX;
12409
- let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;
12418
+ let startX = parent.scrollLeft, startY = parent.scrollTop;
12419
+ if (moveY) parent.scrollTop += moveY;
12420
+ if (moveX) parent.scrollLeft += moveX;
12421
+ let dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;
12410
12422
  rect = {
12411
12423
  left: rect.left - dX,
12412
12424
  top: rect.top - dY,
@@ -12476,13 +12488,14 @@ function focusPreventScroll(dom) {
12476
12488
  }
12477
12489
  }
12478
12490
  function findOffsetInNode(node, coords) {
12479
- let closest, dxClosest = 2e8, coordsClosest, offset = 0;
12491
+ let closest;
12492
+ let dxClosest = 2e8, coordsClosest, offset = 0;
12480
12493
  let rowBot = coords.top, rowTop = coords.top;
12481
12494
  let firstBelow, coordsBelow;
12482
12495
  for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
12483
12496
  let rects;
12484
- if (child.nodeType == 1) rects = child.getClientRects();
12485
- else if (child.nodeType == 3) rects = textRange(child).getClientRects();
12497
+ if (isElt(child)) rects = child.getClientRects();
12498
+ else if (isText(child)) rects = textRange(child).getClientRects();
12486
12499
  else continue;
12487
12500
  for (let i = 0; i < rects.length; i++) {
12488
12501
  let rect = rects[i];
@@ -12493,11 +12506,11 @@ function findOffsetInNode(node, coords) {
12493
12506
  if (dx < dxClosest) {
12494
12507
  closest = child;
12495
12508
  dxClosest = dx;
12496
- coordsClosest = dx && closest.nodeType == 3 ? {
12509
+ coordsClosest = dx && isText(closest) ? {
12497
12510
  left: rect.right < coords.left ? rect.right : rect.left,
12498
12511
  top: coords.top
12499
12512
  } : coords;
12500
- if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
12513
+ if (isElt(child) && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
12501
12514
  continue;
12502
12515
  }
12503
12516
  } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
@@ -12515,8 +12528,8 @@ function findOffsetInNode(node, coords) {
12515
12528
  coordsClosest = coordsBelow;
12516
12529
  dxClosest = 0;
12517
12530
  }
12518
- if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);
12519
- if (!closest || dxClosest && closest.nodeType == 1) return {
12531
+ if (closest && isText(closest)) return findOffsetInText(closest, coordsClosest);
12532
+ if (!closest || dxClosest) return {
12520
12533
  node,
12521
12534
  offset
12522
12535
  };
@@ -12554,7 +12567,7 @@ function targetKludge(dom, coords) {
12554
12567
  }
12555
12568
  function posFromElement(view, elt, coords) {
12556
12569
  let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
12557
- if (node.nodeType == 1 && !node.firstChild) {
12570
+ if (isElt(node) && !node.firstChild) {
12558
12571
  let rect = node.getBoundingClientRect();
12559
12572
  bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
12560
12573
  }
@@ -12566,7 +12579,7 @@ function posFromCaret(view, node, offset, coords) {
12566
12579
  if (cur == view.dom) break;
12567
12580
  let desc = view.docView.nearestDesc(cur, true), rect;
12568
12581
  if (!desc) return null;
12569
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
12582
+ if (isElt(desc.dom) && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
12570
12583
  if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
12571
12584
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;
12572
12585
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;
@@ -12582,7 +12595,7 @@ function elementFromPoint(element, coords, box) {
12582
12595
  let len = element.childNodes.length;
12583
12596
  if (len && box.top < box.bottom) for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {
12584
12597
  let child = element.childNodes[i];
12585
- if (child.nodeType == 1) {
12598
+ if (isElt(child)) {
12586
12599
  let rects = child.getClientRects();
12587
12600
  for (let j = 0; j < rects.length; j++) {
12588
12601
  let rect = rects[j];
@@ -12599,7 +12612,7 @@ function posAtCoords(view, coords) {
12599
12612
  if (caret) ({node, offset} = caret);
12600
12613
  let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
12601
12614
  let pos;
12602
- if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
12615
+ if (!elt || !view.dom.contains(elt)) {
12603
12616
  let box = view.dom.getBoundingClientRect();
12604
12617
  if (!inRect(coords, box)) return null;
12605
12618
  elt = elementFromPoint(view.dom, coords, box);
@@ -12610,7 +12623,7 @@ function posAtCoords(view, coords) {
12610
12623
  }
12611
12624
  elt = targetKludge(elt, coords);
12612
12625
  if (node) {
12613
- if (gecko && node.nodeType == 1) {
12626
+ if (gecko && isElt(node)) {
12614
12627
  offset = Math.min(offset, node.childNodes.length);
12615
12628
  if (offset < node.childNodes.length) {
12616
12629
  let next = node.childNodes[offset], box;
@@ -12618,9 +12631,9 @@ function posAtCoords(view, coords) {
12618
12631
  }
12619
12632
  }
12620
12633
  let prev;
12621
- if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
12622
- if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
12623
- else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
12634
+ if (webkit && offset && isElt(node) && isElt(prev = node.childNodes[offset - 1]) && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
12635
+ if (node == view.dom && offset == node.childNodes.length - 1 && isElt(node.lastChild) && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
12636
+ else if (offset == 0 || !isElt(node) || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
12624
12637
  }
12625
12638
  if (pos == null) pos = posFromElement(view, elt, coords);
12626
12639
  let desc = view.docView.nearestDesc(elt, true);
@@ -12644,7 +12657,7 @@ var BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
12644
12657
  function coordsAtPos(view, pos, side) {
12645
12658
  let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
12646
12659
  let supportEmptyRange = webkit || gecko;
12647
- if (node.nodeType == 3) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
12660
+ if (isText(node)) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
12648
12661
  let rect = singleRect(textRange(node, offset, offset), side);
12649
12662
  if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
12650
12663
  let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
@@ -12669,26 +12682,26 @@ function coordsAtPos(view, pos, side) {
12669
12682
  if (!view.state.doc.resolve(pos - (atom || 0)).parent.inlineContent) {
12670
12683
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
12671
12684
  let before = node.childNodes[offset - 1];
12672
- if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);
12685
+ if (isElt(before)) return flattenH(before.getBoundingClientRect(), false);
12673
12686
  }
12674
12687
  if (atom == null && offset < nodeSize(node)) {
12675
12688
  let after = node.childNodes[offset];
12676
- if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);
12689
+ if (isElt(after)) return flattenH(after.getBoundingClientRect(), true);
12677
12690
  }
12678
12691
  return flattenH(node.getBoundingClientRect(), side >= 0);
12679
12692
  }
12680
12693
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
12681
12694
  let before = node.childNodes[offset - 1];
12682
- let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
12695
+ let target = isText(before) ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : isElt(before) && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
12683
12696
  if (target) return flattenV(singleRect(target, 1), false);
12684
12697
  }
12685
12698
  if (atom == null && offset < nodeSize(node)) {
12686
12699
  let after = node.childNodes[offset];
12687
12700
  while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;
12688
- let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;
12701
+ let target = !after ? null : isText(after) ? textRange(after, 0, supportEmptyRange ? 0 : 1) : isElt(after) ? after : null;
12689
12702
  if (target) return flattenV(singleRect(target, -1), true);
12690
12703
  }
12691
- return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
12704
+ return flattenV(singleRect(isText(node) ? textRange(node) : node, -side), side >= 0);
12692
12705
  }
12693
12706
  function flattenV(rect, left) {
12694
12707
  if (rect.width == 0) return rect;
@@ -12738,8 +12751,8 @@ function endOfTextblockVertical(view, state, dir) {
12738
12751
  let coords = coordsAtPos(view, $pos.pos, 1);
12739
12752
  for (let child = dom.firstChild; child; child = child.nextSibling) {
12740
12753
  let boxes;
12741
- if (child.nodeType == 1) boxes = child.getClientRects();
12742
- else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
12754
+ if (isElt(child)) boxes = child.getClientRects();
12755
+ else if (isText(child)) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
12743
12756
  else continue;
12744
12757
  for (let i = 0; i < boxes.length; i++) {
12745
12758
  let box = boxes[i];
@@ -12763,7 +12776,7 @@ function endOfTextblockHorizontal(view, state, dir) {
12763
12776
  sel.modify("move", dir, "character");
12764
12777
  let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
12765
12778
  let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
12766
- let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;
12779
+ let result = newNode && !contains(parentDOM, newNode) || oldNode == newNode && oldOff == newOff;
12767
12780
  try {
12768
12781
  sel.collapse(anchorNode, anchorOffset);
12769
12782
  if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);
@@ -12845,7 +12858,7 @@ var ViewDesc = class {
12845
12858
  return this.posAtStart + this.size - 2 * this.border;
12846
12859
  }
12847
12860
  localPosFromDOM(dom, offset, bias) {
12848
- if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) if (bias < 0) {
12861
+ if (this.contentDOM && contains(this.contentDOM, dom)) if (bias < 0) {
12849
12862
  let domBefore, desc;
12850
12863
  if (dom == this.contentDOM) domBefore = dom.childNodes[offset - 1];
12851
12864
  else {
@@ -12866,7 +12879,7 @@ var ViewDesc = class {
12866
12879
  }
12867
12880
  let atEnd;
12868
12881
  if (dom == this.dom && this.contentDOM) atEnd = offset > domIndex(this.contentDOM);
12869
- else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
12882
+ else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = !!(dom.compareDocumentPosition(this.contentDOM) & 4);
12870
12883
  else if (this.dom.firstChild) {
12871
12884
  if (offset == 0) for (let search = dom;; search = search.parentNode) {
12872
12885
  if (search == this.dom) {
@@ -12888,7 +12901,7 @@ var ViewDesc = class {
12888
12901
  nearestDesc(dom, onlyNodes = false) {
12889
12902
  for (let first = true, cur = dom; cur; cur = cur.parentNode) {
12890
12903
  let desc = this.getDesc(cur), nodeDOM;
12891
- if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;
12904
+ if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(isElt(nodeDOM) ? contains(nodeDOM, dom) : nodeDOM == dom)) first = false;
12892
12905
  else return desc;
12893
12906
  }
12894
12907
  }
@@ -12929,14 +12942,17 @@ var ViewDesc = class {
12929
12942
  let i = 0, offset = 0;
12930
12943
  for (let curPos = 0; i < this.children.length; i++) {
12931
12944
  let child = this.children[i], end = curPos + child.size;
12932
- if (end > pos || child instanceof TrailingHackViewDesc) {
12945
+ if (end > pos) {
12933
12946
  offset = pos - curPos;
12934
12947
  break;
12935
12948
  }
12936
12949
  curPos = end;
12937
12950
  }
12938
12951
  if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);
12939
- for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--);
12952
+ for (; i > 0; i--) {
12953
+ let prev = this.children[i - 1];
12954
+ if (prev.size || !(prev instanceof BufferHackViewDesc || prev instanceof WidgetViewDesc && prev.side >= 0)) break;
12955
+ }
12940
12956
  if (side <= 0) {
12941
12957
  let prev, enter = true;
12942
12958
  for (;; i--, enter = false) {
@@ -13016,7 +13032,7 @@ var ViewDesc = class {
13016
13032
  }
13017
13033
  domAfterPos(pos) {
13018
13034
  let { node, offset } = this.domFromPos(pos, 0);
13019
- if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
13035
+ if (!isElt(node) || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
13020
13036
  return node.childNodes[offset];
13021
13037
  }
13022
13038
  setSelection(anchor, head, view, force = false) {
@@ -13033,7 +13049,7 @@ var ViewDesc = class {
13033
13049
  let brKludge = false;
13034
13050
  if ((gecko || safari) && anchor == head) {
13035
13051
  let { node, offset } = anchorDOM;
13036
- if (node.nodeType == 3) {
13052
+ if (isText(node)) {
13037
13053
  brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
13038
13054
  if (brKludge && offset == node.nodeValue.length) for (let scan = node, after; scan; scan = scan.parentNode) {
13039
13055
  if (after = scan.nextSibling) {
@@ -13051,7 +13067,7 @@ var ViewDesc = class {
13051
13067
  brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
13052
13068
  }
13053
13069
  }
13054
- if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
13070
+ if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && isElt(selRange.focusNode)) {
13055
13071
  let after = selRange.focusNode.childNodes[selRange.focusOffset];
13056
13072
  if (after && after.contentEditable == "false") force = true;
13057
13073
  }
@@ -13127,13 +13143,10 @@ var WidgetViewDesc = class extends ViewDesc {
13127
13143
  if (self.parent) return self.parent.posBeforeChild(self);
13128
13144
  });
13129
13145
  if (!widget.type.spec.raw) {
13130
- if (dom.nodeType != 1) {
13131
- let wrap = document.createElement("span");
13132
- wrap.appendChild(dom);
13133
- dom = wrap;
13134
- }
13135
- if (!dom.hasAttribute("contenteditable")) dom.contentEditable = "false";
13136
- dom.classList.add("ProseMirror-widget");
13146
+ let elt = isElt(dom) ? dom : document.createElement("span");
13147
+ if (elt != dom) elt.appendChild(dom);
13148
+ if (!elt.hasAttribute("contenteditable")) elt.contentEditable = "false";
13149
+ elt.classList.add("ProseMirror-widget");
13137
13150
  }
13138
13151
  super(parent, [], dom, null);
13139
13152
  this.widget = widget;
@@ -13256,7 +13269,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
13256
13269
  let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;
13257
13270
  if (node.isText) {
13258
13271
  if (!dom) dom = document.createTextNode(node.text);
13259
- else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
13272
+ else if (!isText(dom)) throw new RangeError("Text must be rendered as a DOM text node");
13260
13273
  } else if (!dom) {
13261
13274
  let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
13262
13275
  ({dom, contentDOM} = spec);
@@ -13289,7 +13302,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
13289
13302
  }
13290
13303
  }
13291
13304
  if (!rule.contentElement) {
13292
- let found = addedNodes && addedNodes.find((n) => n.nodeType == 1 && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
13305
+ let found = addedNodes && addedNodes.find((n) => isElt(n) && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
13293
13306
  if (found) rule.contentElement = found;
13294
13307
  else rule.getContent = () => Fragment.empty;
13295
13308
  }
@@ -13311,18 +13324,21 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
13311
13324
  let localComposition = composition && composition.pos > -1 ? composition : null;
13312
13325
  let compositionInChild = composition && composition.pos < 0;
13313
13326
  let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
13327
+ let addBuffers = this.node.inlineContent, atBufferPos = addBuffers && this.node.isBlock;
13314
13328
  iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
13315
13329
  if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view, i);
13316
13330
  else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark$1.none : this.node.child(i).marks, inline, view, i);
13317
13331
  updater.placeWidget(widget, view, off);
13318
13332
  }, (child, outerDeco, innerDeco, i) => {
13319
13333
  updater.syncToMarks(child.marks, inline, view, i);
13334
+ if (atBufferPos && child.isAtom && !child.isText) updater.addHackNode("IMG", updater.top);
13320
13335
  let compIndex;
13321
13336
  if (updater.findNodeMatch(child, outerDeco, innerDeco, i));
13322
13337
  else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view));
13323
13338
  else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off));
13324
13339
  else updater.addNode(child, outerDeco, innerDeco, view, off);
13325
13340
  off += child.nodeSize;
13341
+ if (addBuffers) atBufferPos = child.isAtom && !child.isText;
13326
13342
  });
13327
13343
  updater.syncToMarks([], inline, view, 0);
13328
13344
  if (this.node.isTextblock) updater.addTextblockHacks();
@@ -13379,7 +13395,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
13379
13395
  }
13380
13396
  updateOuterDeco(outerDeco) {
13381
13397
  if (sameOuterDeco(outerDeco, this.outerDeco)) return;
13382
- let needsWrap = this.nodeDOM.nodeType != 1;
13398
+ let needsWrap = !isElt(this.nodeDOM);
13383
13399
  let oldDOM = this.dom;
13384
13400
  this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
13385
13401
  if (this.dom != oldDOM) {
@@ -13389,13 +13405,13 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
13389
13405
  this.outerDeco = outerDeco;
13390
13406
  }
13391
13407
  selectNode() {
13392
- if (this.nodeDOM.nodeType == 1) {
13408
+ if (isElt(this.nodeDOM)) {
13393
13409
  this.nodeDOM.classList.add("ProseMirror-selectednode");
13394
13410
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
13395
13411
  }
13396
13412
  }
13397
13413
  deselectNode() {
13398
- if (this.nodeDOM.nodeType == 1) {
13414
+ if (isElt(this.nodeDOM)) {
13399
13415
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
13400
13416
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
13401
13417
  }
@@ -13463,7 +13479,7 @@ var TextViewDesc = class TextViewDesc extends NodeViewDesc {
13463
13479
  return this.node.text == text;
13464
13480
  }
13465
13481
  };
13466
- var TrailingHackViewDesc = class extends ViewDesc {
13482
+ var BufferHackViewDesc = class extends ViewDesc {
13467
13483
  parseRule() {
13468
13484
  return { ignore: true };
13469
13485
  }
@@ -13599,7 +13615,7 @@ function patchAttributes(dom, prev, cur) {
13599
13615
  }
13600
13616
  }
13601
13617
  function applyOuterDeco(dom, deco, node) {
13602
- return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
13618
+ return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, !isElt(dom)));
13603
13619
  }
13604
13620
  function sameOuterDeco(a, b) {
13605
13621
  if (a.length != b.length) return false;
@@ -13789,14 +13805,14 @@ var ViewTreeUpdater = class {
13789
13805
  dom.alt = "";
13790
13806
  }
13791
13807
  if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak";
13792
- let hack = new TrailingHackViewDesc(this.top, [], dom, null);
13808
+ let hack = new BufferHackViewDesc(this.top, [], dom, null);
13793
13809
  if (parent != this.top) parent.children.push(hack);
13794
13810
  else parent.children.splice(this.index++, 0, hack);
13795
13811
  this.changed = true;
13796
13812
  }
13797
13813
  }
13798
13814
  isLocked(node) {
13799
- return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
13815
+ return this.lock && (node == this.lock || isElt(node) && node.contains(this.lock.parentNode));
13800
13816
  }
13801
13817
  };
13802
13818
  function preMatch(frag, parentDesc) {
@@ -13940,10 +13956,15 @@ function selectionFromDOM(view, origin = null) {
13940
13956
  if (selectionCollapsed(domSel)) {
13941
13957
  anchor = head;
13942
13958
  while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;
13943
- let nearestDescNode = nearestDesc.node;
13944
- if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13959
+ if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13945
13960
  let pos = nearestDesc.posBefore;
13946
13961
  selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));
13962
+ } else if (gecko && origin == "key" && head > view.state.selection.to && isElt(domSel.focusNode) && domSel.focusOffset == domSel.focusNode.childNodes.length && nearestDesc && nearestDesc.posAtStart > view.state.selection.to) for (let scan = domSel.focusNode;; scan = scan.parentNode) {
13963
+ if (getComputedStyle(scan).overflow != "visible") {
13964
+ selection = Selection$1.findFrom(doc.resolve(nearestDesc.posAtStart), 1);
13965
+ break;
13966
+ }
13967
+ if (scan == nearestDesc.dom || scan.nextSibling || !scan.parentNode || !isElt(scan.parentNode)) break;
13947
13968
  }
13948
13969
  } else {
13949
13970
  if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
@@ -14081,7 +14102,7 @@ function hasSelection(view) {
14081
14102
  let sel = view.domSelectionRange();
14082
14103
  if (!sel.anchorNode) return false;
14083
14104
  try {
14084
- return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));
14105
+ return contains(view.dom, sel.anchorNode) && (view.editable || contains(view.dom, sel.focusNode));
14085
14106
  } catch (_) {
14086
14107
  return false;
14087
14108
  }
@@ -14120,8 +14141,7 @@ function selectHorizontally(view, dir, mods) {
14120
14141
  let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
14121
14142
  if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;
14122
14143
  if (NodeSelection.isSelectable(node)) return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
14123
- else if (webkit) return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
14124
- else return false;
14144
+ else return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
14125
14145
  }
14126
14146
  } else if (sel instanceof NodeSelection && sel.node.isInline) return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));
14127
14147
  else {
@@ -14130,12 +14150,9 @@ function selectHorizontally(view, dir, mods) {
14130
14150
  return false;
14131
14151
  }
14132
14152
  }
14133
- function nodeLen(node) {
14134
- return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
14135
- }
14136
14153
  function isIgnorable(dom, dir) {
14137
14154
  let desc = dom.pmViewDesc;
14138
- return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
14155
+ return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR") : isElt(dom) && dom.contentEditable == "false";
14139
14156
  }
14140
14157
  function skipIgnoredNodes(view, dir) {
14141
14158
  return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
@@ -14145,19 +14162,18 @@ function skipIgnoredNodesBefore(view) {
14145
14162
  let node = sel.focusNode, offset = sel.focusOffset;
14146
14163
  if (!node) return;
14147
14164
  let moveNode, moveOffset, force = false;
14148
- if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
14149
- for (;;) if (offset > 0) if (node.nodeType != 1) break;
14150
- else {
14165
+ if (gecko && isElt(node) && offset < nodeSize(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
14166
+ for (;;) if (offset > 0) {
14167
+ if (!isElt(node)) break;
14151
14168
  let before = node.childNodes[offset - 1];
14152
14169
  if (isIgnorable(before, -1)) {
14153
14170
  moveNode = node;
14154
14171
  moveOffset = --offset;
14155
- } else if (before.nodeType == 3) {
14172
+ } else if (isText(before)) {
14156
14173
  node = before;
14157
14174
  offset = node.nodeValue.length;
14158
14175
  } else break;
14159
- }
14160
- else if (isBlockNode(node)) break;
14176
+ } else if (isBlockNode(node)) break;
14161
14177
  else {
14162
14178
  let prev = node.previousSibling;
14163
14179
  while (prev && isIgnorable(prev, -1)) {
@@ -14171,7 +14187,7 @@ function skipIgnoredNodesBefore(view) {
14171
14187
  offset = 0;
14172
14188
  } else {
14173
14189
  node = prev;
14174
- offset = nodeLen(node);
14190
+ offset = nodeSize(node);
14175
14191
  }
14176
14192
  }
14177
14193
  if (force) setSelFocus(view, node, offset);
@@ -14181,10 +14197,10 @@ function skipIgnoredNodesAfter(view) {
14181
14197
  let sel = view.domSelectionRange();
14182
14198
  let node = sel.focusNode, offset = sel.focusOffset;
14183
14199
  if (!node) return;
14184
- let len = nodeLen(node);
14200
+ let len = nodeSize(node);
14185
14201
  let moveNode, moveOffset;
14186
14202
  for (;;) if (offset < len) {
14187
- if (node.nodeType != 1) break;
14203
+ if (!isElt(node)) break;
14188
14204
  let after = node.childNodes[offset];
14189
14205
  if (isIgnorable(after, 1)) {
14190
14206
  moveNode = node;
@@ -14205,7 +14221,7 @@ function skipIgnoredNodesAfter(view) {
14205
14221
  } else {
14206
14222
  node = next;
14207
14223
  offset = 0;
14208
- len = nodeLen(node);
14224
+ len = nodeSize(node);
14209
14225
  }
14210
14226
  }
14211
14227
  if (moveNode) setSelFocus(view, moveNode, moveOffset);
@@ -14221,8 +14237,8 @@ function textNodeAfter(node, offset) {
14221
14237
  }
14222
14238
  while (node && offset < node.childNodes.length) {
14223
14239
  let next = node.childNodes[offset];
14224
- if (next.nodeType == 3) return next;
14225
- if (next.nodeType == 1 && next.contentEditable == "false") break;
14240
+ if (isText(next)) return next;
14241
+ if (isElt(next) && next.contentEditable == "false") break;
14226
14242
  node = next;
14227
14243
  offset = 0;
14228
14244
  }
@@ -14234,14 +14250,14 @@ function textNodeBefore(node, offset) {
14234
14250
  }
14235
14251
  while (node && offset) {
14236
14252
  let next = node.childNodes[offset - 1];
14237
- if (next.nodeType == 3) return next;
14238
- if (next.nodeType == 1 && next.contentEditable == "false") break;
14253
+ if (isText(next)) return next;
14254
+ if (isElt(next) && next.contentEditable == "false") break;
14239
14255
  node = next;
14240
14256
  offset = node.childNodes.length;
14241
14257
  }
14242
14258
  }
14243
14259
  function setSelFocus(view, node, offset) {
14244
- if (node.nodeType != 3) {
14260
+ if (!isText(node)) {
14245
14261
  let before, after;
14246
14262
  if (after = textNodeAfter(node, offset)) {
14247
14263
  node = after;
@@ -14323,7 +14339,7 @@ function switchEditable(view, node, state) {
14323
14339
  function safariDownArrowBug(view) {
14324
14340
  if (!safari || view.state.selection.$head.parentOffset > 0) return false;
14325
14341
  let { focusNode, focusOffset } = view.domSelectionRange();
14326
- if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
14342
+ if (focusNode && isElt(focusNode) && focusOffset == 0 && focusNode.firstChild && isElt(focusNode.firstChild) && focusNode.firstChild.contentEditable == "false") {
14327
14343
  let child = focusNode.firstChild;
14328
14344
  switchEditable(view, child, "true");
14329
14345
  setTimeout(() => switchEditable(view, child, "false"), 20);
@@ -14370,7 +14386,7 @@ function serializeForClipboard(view, slice) {
14370
14386
  let doc = detachedDoc(), wrap = doc.createElement("div");
14371
14387
  wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
14372
14388
  let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
14373
- while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
14389
+ while (firstChild && isElt(firstChild) && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
14374
14390
  for (let i = needsWrap.length - 1; i >= 0; i--) {
14375
14391
  let wrapper = doc.createElement(needsWrap[i]);
14376
14392
  while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
@@ -14379,7 +14395,7 @@ function serializeForClipboard(view, slice) {
14379
14395
  }
14380
14396
  firstChild = wrap.firstChild;
14381
14397
  }
14382
- if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
14398
+ if (firstChild && isElt(firstChild)) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
14383
14399
  return {
14384
14400
  dom: wrap,
14385
14401
  text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
@@ -14424,7 +14440,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
14424
14440
  let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
14425
14441
  if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {
14426
14442
  let child = dom.firstChild;
14427
- while (child && child.nodeType != 1) child = child.nextSibling;
14443
+ while (child && !isElt(child)) child = child.nextSibling;
14428
14444
  if (!child) break;
14429
14445
  dom = child;
14430
14446
  }
@@ -14577,11 +14593,10 @@ function addContext(slice, context) {
14577
14593
  let type = schema.nodes[array[i]];
14578
14594
  if (!type || type.hasRequiredAttrs()) break;
14579
14595
  try {
14580
- type.checkAttrs(array[i + 1]);
14596
+ content = Fragment.from(type.create(array[i + 1], content));
14581
14597
  } catch (e) {
14582
14598
  break;
14583
14599
  }
14584
- content = Fragment.from(type.create(array[i + 1], content));
14585
14600
  openStart++;
14586
14601
  openEnd++;
14587
14602
  }
@@ -14725,14 +14740,14 @@ function updateSelection(view, selection, origin) {
14725
14740
  if (!view.focused) view.focus();
14726
14741
  if (view.state.selection.eq(selection)) return;
14727
14742
  let tr = view.state.tr.setSelection(selection);
14728
- if (origin == "pointer") tr.setMeta("pointer", true);
14743
+ tr.setMeta("pointer", true);
14729
14744
  view.dispatch(tr);
14730
14745
  }
14731
14746
  function selectClickedLeaf(view, inside) {
14732
14747
  if (inside == -1) return false;
14733
14748
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
14734
14749
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
14735
- updateSelection(view, new NodeSelection($pos), "pointer");
14750
+ updateSelection(view, new NodeSelection($pos));
14736
14751
  return true;
14737
14752
  }
14738
14753
  return false;
@@ -14751,7 +14766,7 @@ function selectClickedNode(view, inside) {
14751
14766
  }
14752
14767
  }
14753
14768
  if (selectAt != null) {
14754
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
14769
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
14755
14770
  return true;
14756
14771
  } else return false;
14757
14772
  }
@@ -14768,7 +14783,7 @@ function defaultTripleClick(view, inside, event) {
14768
14783
  if (event.button != 0) return false;
14769
14784
  let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;
14770
14785
  if (!selection) return false;
14771
- updateSelection(view, selection, "pointer");
14786
+ updateSelection(view, selection);
14772
14787
  if (selection instanceof TextSelection && doc.eq(view.state.doc)) view.input.mouseDown = new TripleClickDrag(view, selection);
14773
14788
  return true;
14774
14789
  }
@@ -14854,7 +14869,7 @@ var LeftMouseDown = class extends MouseDown {
14854
14869
  }
14855
14870
  const target = flushed ? null : event.target;
14856
14871
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
14857
- this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
14872
+ this.target = targetDesc && isElt(targetDesc.nodeDOM) ? targetDesc.nodeDOM : null;
14858
14873
  let { selection } = view.state;
14859
14874
  if (event.button == 0 && (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)) this.mightDrag = {
14860
14875
  node: targetNode,
@@ -14893,7 +14908,7 @@ var LeftMouseDown = class extends MouseDown {
14893
14908
  if (this.allowDefault || !pos) setSelectionOrigin(this.view, "pointer");
14894
14909
  else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) event.preventDefault();
14895
14910
  else if (event.button == 0 && (this.flushed || safari && this.mightDrag && !this.mightDrag.node.isAtom || chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
14896
- updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)), "pointer");
14911
+ updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
14897
14912
  event.preventDefault();
14898
14913
  } else setSelectionOrigin(this.view, "pointer");
14899
14914
  }
@@ -14929,7 +14944,7 @@ var TripleClickDrag = class extends MouseDown {
14929
14944
  if (!target) return;
14930
14945
  let { doc } = this.view.state, start = this.startSelection;
14931
14946
  let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];
14932
- updateSelection(this.view, TextSelection.create(doc, anchor, head), "pointer");
14947
+ updateSelection(this.view, TextSelection.create(doc, anchor, head));
14933
14948
  }
14934
14949
  };
14935
14950
  handlers.touchstart = (view) => {
@@ -14955,7 +14970,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14955
14970
  if (!view.composing) {
14956
14971
  view.domObserver.flush();
14957
14972
  let { state } = view, $pos = state.selection.$to;
14958
- if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
14973
+ if (state.selection instanceof TextSelection && state.selection.empty && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
14959
14974
  view.markCursor = view.state.storedMarks || $pos.marks();
14960
14975
  endComposition(view, true);
14961
14976
  view.markCursor = null;
@@ -14963,10 +14978,10 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14963
14978
  endComposition(view, !state.selection.empty);
14964
14979
  if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
14965
14980
  let sel = view.domSelectionRange();
14966
- for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
14981
+ for (let node = sel.focusNode, offset = sel.focusOffset; node && isElt(node) && offset != 0;) {
14967
14982
  let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
14968
14983
  if (!before) break;
14969
- if (before.nodeType == 3) {
14984
+ if (isText(before)) {
14970
14985
  let sel = view.domSelection();
14971
14986
  if (sel) sel.collapse(before, before.nodeValue.length);
14972
14987
  break;
@@ -14983,9 +14998,9 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14983
14998
  };
14984
14999
  function selectionBeforeUneditable(view) {
14985
15000
  let { focusNode, focusOffset } = view.domSelectionRange();
14986
- if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length) return false;
15001
+ if (!focusNode || !isElt(focusNode) || focusOffset >= focusNode.childNodes.length) return false;
14987
15002
  let next = focusNode.childNodes[focusOffset];
14988
- return next.nodeType == 1 && next.contentEditable == "false";
15003
+ return isElt(next) && next.contentEditable == "false";
14989
15004
  }
14990
15005
  editHandlers.compositionend = (view, event) => {
14991
15006
  if (view.composing) {
@@ -15138,7 +15153,7 @@ handlers.dragstart = (view, _event) => {
15138
15153
  let node;
15139
15154
  if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to));
15140
15155
  else if (mouseDown && mouseDown.mightDrag) node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);
15141
- else if (event.target && event.target.nodeType == 1) {
15156
+ else if (event.target && isElt(event.target)) {
15142
15157
  let desc = view.docView.nearestDesc(event.target, true);
15143
15158
  if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);
15144
15159
  }
@@ -15911,7 +15926,7 @@ var DOMObserver = class {
15911
15926
  let desc = container && this.view.docView.nearestDesc(container);
15912
15927
  if (desc && desc.ignoreMutation({
15913
15928
  type: "selection",
15914
- target: container.nodeType == 3 ? container.parentNode : container
15929
+ target: isText(container) ? container.parentNode : container
15915
15930
  })) {
15916
15931
  this.setCurSelection();
15917
15932
  return true;
@@ -15940,7 +15955,7 @@ var DOMObserver = class {
15940
15955
  if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46 || chrome && (view.composing || view.input.compositionEndedAt > Date.now() - 50) && mutations.some((m) => m.type == "childList" && m.removedNodes.length))) {
15941
15956
  for (let node of added) if (node.nodeName == "BR" && node.parentNode) {
15942
15957
  let after = node.nextSibling;
15943
- while (after && after.nodeType == 1) {
15958
+ while (after && isElt(after)) {
15944
15959
  if (after.contentEditable == "false") {
15945
15960
  node.parentNode.removeChild(node);
15946
15961
  break;
@@ -15992,7 +16007,7 @@ var DOMObserver = class {
15992
16007
  for (let i = 0; i < mut.addedNodes.length; i++) {
15993
16008
  let node = mut.addedNodes[i];
15994
16009
  added.push(node);
15995
- if (node.nodeType == 3) this.lastChangedTextNode = node;
16010
+ if (isText(node)) this.lastChangedTextNode = node;
15996
16011
  }
15997
16012
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {
15998
16013
  from: desc.posBefore,
@@ -16091,7 +16106,7 @@ function fixUpBadSafariComposition(view, addedNodes) {
16091
16106
  let parent = nextCell;
16092
16107
  for (;;) {
16093
16108
  let first = parent.firstChild;
16094
- if (!first || first.nodeType != 1 || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
16109
+ if (!first || !isElt(first) || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
16095
16110
  parent = first;
16096
16111
  }
16097
16112
  parent.insertBefore(node, parent.firstChild);
@@ -16104,7 +16119,7 @@ function parseBetween(view, from_, to_, addedNodes) {
16104
16119
  let domSel = view.domSelectionRange();
16105
16120
  let find;
16106
16121
  let anchor = domSel.anchorNode;
16107
- if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
16122
+ if (anchor && contains(view.dom, anchor)) {
16108
16123
  find = [{
16109
16124
  node: anchor,
16110
16125
  offset: domSel.anchorOffset
@@ -16198,7 +16213,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
16198
16213
  view.input.lastKeyCode = null;
16199
16214
  let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
16200
16215
  if (change) view.input.domChangeCount++;
16201
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
16216
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => isElt(n) && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
16202
16217
  view.input.lastIOSEnter = 0;
16203
16218
  return;
16204
16219
  }
@@ -16234,7 +16249,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
16234
16249
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
16235
16250
  let $fromA = doc.resolve(change.start);
16236
16251
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
16237
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
16252
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && looksLikeEnter(parse.doc, $from.pos, $to.pos)) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
16238
16253
  view.input.lastIOSEnter = 0;
16239
16254
  return;
16240
16255
  }
@@ -16321,6 +16336,14 @@ function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
16321
16336
  if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;
16322
16337
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
16323
16338
  }
16339
+ function looksLikeEnter(content, from, to) {
16340
+ let newTextlines = 0, newLeaves = 0;
16341
+ content.nodesBetween(from, to, (node, pos) => {
16342
+ if (node.isTextblock && pos >= from && pos < to) newTextlines++;
16343
+ else if (node.isText ? /\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf) newLeaves++;
16344
+ });
16345
+ return newLeaves == 0 && newTextlines == 1;
16346
+ }
16324
16347
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
16325
16348
  let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
16326
16349
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
@@ -16545,11 +16568,11 @@ var EditorView = class {
16545
16568
  */
16546
16569
  scrollToSelection() {
16547
16570
  let startDOM = this.domSelectionRange().focusNode;
16548
- if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode));
16571
+ if (!startDOM || !contains(this.dom, startDOM));
16549
16572
  else if (this.someProp("handleScrollToSelection", (f) => f(this)));
16550
16573
  else if (this.state.selection instanceof NodeSelection) {
16551
16574
  let target = this.docView.domAfterPos(this.state.selection.from);
16552
- if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
16575
+ if (isElt(target)) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
16553
16576
  } else scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
16554
16577
  }
16555
16578
  destroyPluginViews() {
@@ -16778,7 +16801,7 @@ var EditorView = class {
16778
16801
  @internal
16779
16802
  */
16780
16803
  domSelectionRange() {
16781
- let sel = this.domSelection();
16804
+ let sel = this.dom.isConnected !== false && this.domSelection();
16782
16805
  if (!sel) return {
16783
16806
  focusNode: null,
16784
16807
  focusOffset: 0,
@@ -27356,7 +27379,7 @@ var Underline = Mark.create({
27356
27379
  }
27357
27380
  });
27358
27381
  //#endregion
27359
- //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
27382
+ //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.4/node_modules/prosemirror-dropcursor/dist/index.js
27360
27383
  /**
27361
27384
  Create a plugin that, when added to a ProseMirror instance,
27362
27385
  causes a decoration to show up at the drop position when something
@@ -27379,6 +27402,7 @@ var DropCursorView = class {
27379
27402
  this.cursorPos = null;
27380
27403
  this.element = null;
27381
27404
  this.timeout = -1;
27405
+ this.lastDragEvent = null;
27382
27406
  this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
27383
27407
  this.color = options.color === false ? void 0 : options.color || "black";
27384
27408
  this.class = options.class;
@@ -27399,11 +27423,15 @@ var DropCursorView = class {
27399
27423
  });
27400
27424
  }
27401
27425
  destroy() {
27426
+ this.setCursor(null);
27402
27427
  this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));
27403
27428
  }
27404
27429
  update(editorView, prevState) {
27405
- if (this.cursorPos != null && prevState.doc != editorView.state.doc) if (this.cursorPos > editorView.state.doc.content.size) this.setCursor(null);
27406
- else this.updateOverlay();
27430
+ if (this.cursorPos != null && prevState.doc != editorView.state.doc) if (this.lastDragEvent) {
27431
+ let target = this.computeTarget(this.lastDragEvent);
27432
+ if (target == this.cursorPos) this.updateOverlay();
27433
+ else this.setCursor(target);
27434
+ } else this.updateOverlay();
27407
27435
  }
27408
27436
  setCursor(pos) {
27409
27437
  if (pos == this.cursorPos) return;
@@ -27474,8 +27502,7 @@ var DropCursorView = class {
27474
27502
  clearTimeout(this.timeout);
27475
27503
  this.timeout = setTimeout(() => this.setCursor(null), timeout);
27476
27504
  }
27477
- dragover(event) {
27478
- if (!this.editorView.editable) return;
27505
+ computeTarget(event) {
27479
27506
  let pos = this.editorView.posAtCoords({
27480
27507
  left: event.clientX,
27481
27508
  top: event.clientY
@@ -27483,12 +27510,19 @@ var DropCursorView = class {
27483
27510
  let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
27484
27511
  let disableDropCursor = node && node.type.spec.disableDropCursor;
27485
27512
  let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
27486
- if (pos && !disabled) {
27487
- let target = pos.pos;
27488
- if (this.editorView.dragging && this.editorView.dragging.slice) {
27489
- let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
27490
- if (point != null) target = point;
27491
- }
27513
+ if (!pos || disabled) return null;
27514
+ let target = pos.pos;
27515
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
27516
+ let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
27517
+ if (point != null) target = point;
27518
+ }
27519
+ return target;
27520
+ }
27521
+ dragover(event) {
27522
+ if (!this.editorView.editable) return;
27523
+ this.lastDragEvent = event;
27524
+ let target = this.computeTarget(event);
27525
+ if (target != null) {
27492
27526
  this.setCursor(target);
27493
27527
  this.scheduleRemoval(5e3);
27494
27528
  }
@@ -35081,131 +35115,212 @@ create_custom_element(RegionPicker, {
35081
35115
  }, [], [], { mode: "open" });
35082
35116
  //#endregion
35083
35117
  //#region ../../shared/math-rendering-mathjax/dist/index.js
35084
- var e = {
35118
+ var e = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page";
35119
+ var t = "pie-mathjax-version-conflict";
35120
+ var n = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
35121
+ function r(r, i) {
35122
+ if (typeof window > "u") return;
35123
+ let a = globalThis;
35124
+ a[n] ?? (a[n] = {
35125
+ logged: !1,
35126
+ conditions: []
35127
+ });
35128
+ let o = a[n];
35129
+ if (o.conditions.includes(r)) return;
35130
+ o.conditions.push(r);
35131
+ let s = `[math-rendering] Unsupported page (${r}): ${i}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${e}`;
35132
+ o.logged || (o.logged = !0, console.error(s)), window.dispatchEvent(new CustomEvent(t, { detail: {
35133
+ condition: r,
35134
+ message: s,
35135
+ docsUrl: e
35136
+ } }));
35137
+ }
35138
+ function i() {
35139
+ let e = window.MathJax?.version;
35140
+ return typeof e == "string" && e.startsWith("3.") ? e : void 0;
35141
+ }
35142
+ var a = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js";
35143
+ var o = {
35085
35144
  parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
35086
35145
  overarc: "\\overparen",
35087
35146
  napprox: "\\not\\approx",
35088
35147
  longdiv: "\\enclose{longdiv}",
35089
35148
  abs: ["\\left|#1\\right|", 1]
35090
35149
  };
35091
- var t = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
35092
- var n = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
35093
- var r = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
35094
- var i = /\\embed\{newLine\}\[\]/g;
35095
- var a = [
35150
+ var s = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
35151
+ var c = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
35152
+ var l = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
35153
+ var u = /\\embed\{newLine\}\[\]/g;
35154
+ var d = [
35096
35155
  ["$$", "$$"],
35097
35156
  ["$", "$"],
35098
35157
  ["\\[", "\\]"],
35099
35158
  ["\\(", "\\)"]
35100
35159
  ];
35101
- var o = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
35102
- function s() {
35160
+ var f = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
35161
+ var p = "PIE-MJX-CHTML-styles";
35162
+ var m = "MJX-CHTML-styles";
35163
+ var h = [m, "MJX-SVG-styles"];
35164
+ var g = 201;
35165
+ function _(e) {
35166
+ let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
35167
+ for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
35168
+ }
35169
+ function v() {
35103
35170
  return window.MathJax;
35104
35171
  }
35105
- function c(e) {
35172
+ function y(e) {
35106
35173
  let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
35107
- for (let [e, n] of a) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
35174
+ for (let [e, n] of d) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
35108
35175
  return t;
35109
35176
  }
35110
- function l(e) {
35177
+ function b(e) {
35111
35178
  for (let t of e.querySelectorAll("[data-latex]")) {
35112
35179
  if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
35113
35180
  let e = t.textContent;
35114
- e && (t.textContent = `\\(${c(e)}\\)`.replace(i, "\\newline "), t.dataset.mathHandled = "true");
35181
+ e && (t.textContent = `\\(${y(e)}\\)`.replace(u, "\\newline "), t.dataset.mathHandled = "true");
35115
35182
  }
35116
35183
  }
35117
- function u(e, t) {
35184
+ function x(e, t) {
35118
35185
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
35119
- return (t ? r : n).test(e.textContent ?? "");
35186
+ return (t ? l : c).test(e.textContent ?? "");
35120
35187
  }
35121
- function d(n) {
35122
- return new Promise((r, i) => {
35123
- let { useSingleDollar: a = !1, accessibility: o = !0, loadFonts: c = !0, srcUrl: l } = n, u = {
35188
+ function S(e) {
35189
+ return new Promise((t, n) => {
35190
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
35124
35191
  loader: {
35125
- load: o ? ["a11y/assistive-mml"] : [],
35126
- failed: (e) => i(e)
35192
+ load: i ? ["a11y/assistive-mml"] : [],
35193
+ failed: (e) => n(e)
35127
35194
  },
35128
35195
  startup: {
35129
35196
  typeset: !1,
35130
35197
  ready: () => {
35131
- let e = s()?.startup;
35132
- e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => r(), i);
35198
+ let e = v(), r = e?.startup, i = !!e?.version?.startsWith("4.");
35199
+ i && C(e), r?.defaultReady?.(), i && w(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
35133
35200
  }
35134
35201
  },
35135
- tex: { macros: { ...e } },
35202
+ tex: { macros: { ...o } },
35136
35203
  options: {
35137
- enableMenu: o,
35204
+ enableMenu: i,
35138
35205
  menuOptions: { settings: {
35139
- assistiveMml: o,
35206
+ assistiveMml: i,
35140
35207
  enrich: !1,
35141
35208
  inTabOrder: !1
35142
35209
  } }
35143
35210
  }
35144
35211
  };
35145
- a && u.tex && (console.warn(t), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
35212
+ r && u.tex && (console.warn(s), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
35146
35213
  let d = document.createElement("script");
35147
- d.src = l || "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", d.async = !0, d.onerror = () => i(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
35214
+ d.src = l || a, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
35215
+ });
35216
+ }
35217
+ function C(e) {
35218
+ let t = e?._?.output?.chtml_ts?.CHTML;
35219
+ t && (t.STYLESHEETID = p);
35220
+ }
35221
+ function w(e) {
35222
+ if (!e) return;
35223
+ let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
35224
+ let n = e.typesetRoot;
35225
+ !n || t.has(n) || (_(n), t.add(n));
35226
+ };
35227
+ e.addRenderAction?.("pie-strip-latex", g, (e) => {
35228
+ for (let t of e.math ?? []) n(t);
35229
+ return !1;
35230
+ }, (e) => {
35231
+ let t = e.typesetRoot;
35232
+ return t && _(t), !1;
35148
35233
  });
35234
+ let r = e.outputJax?.chtmlStyles;
35235
+ r?.id === m && (r.id = p), D();
35149
35236
  }
35150
- function f(e) {
35237
+ function T(e) {
35238
+ return e instanceof HTMLStyleElement && h.includes(e.id);
35239
+ }
35240
+ function E(e) {
35241
+ r("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
35242
+ }
35243
+ function D() {
35244
+ let e = document.head, t = [...e.children].find(T);
35245
+ if (t) {
35246
+ E(t);
35247
+ return;
35248
+ }
35249
+ let n = new MutationObserver((e) => {
35250
+ for (let t of e) {
35251
+ let e = [...t.addedNodes].find(T);
35252
+ if (e) {
35253
+ E(e), n.disconnect();
35254
+ return;
35255
+ }
35256
+ }
35257
+ });
35258
+ n.observe(e, { childList: !0 });
35259
+ }
35260
+ function O(e) {
35151
35261
  return new Promise((t, n) => {
35152
35262
  let r = e.startup ?? {};
35153
35263
  e.startup = r;
35154
35264
  let i = r.ready;
35155
35265
  r.ready = () => {
35156
- let e = s()?.startup;
35266
+ let e = v()?.startup;
35157
35267
  i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
35158
35268
  };
35159
35269
  });
35160
35270
  }
35161
- function p(e) {
35162
- let t = s();
35163
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : f(t) : d(e);
35271
+ function k(e) {
35272
+ let t = v();
35273
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : O(t) : S(e);
35164
35274
  }
35165
- function m(e) {
35166
- return p(e).then(() => {
35167
- typeof s()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
35275
+ function A(e) {
35276
+ return k(e).then(() => {
35277
+ typeof v()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
35168
35278
  });
35169
35279
  }
35170
- function h(e) {
35171
- let t = globalThis, n = t[o];
35172
- return n || (n = m(e), t[o] = n), n;
35280
+ function j(e) {
35281
+ let t = globalThis, n = t[f];
35282
+ return n || (n = A(e), t[f] = n), n;
35173
35283
  }
35174
- function g(e = {}) {
35284
+ function M(e = {}) {
35175
35285
  let t = e.useSingleDollar ?? !1;
35176
35286
  return async (n) => {
35177
35287
  if (typeof window > "u") return;
35178
- l(n);
35179
- let r = h(e);
35180
- if (!u(n, t)) {
35181
- r.catch(() => {});
35288
+ let a = i();
35289
+ a && r("mathjax-3-global", `window.MathJax is MathJax ${a}`), b(n);
35290
+ let o = j(e);
35291
+ if (!x(n, t)) {
35292
+ o.catch(() => {});
35182
35293
  return;
35183
35294
  }
35184
- await r;
35185
- let i = s();
35186
- await i?.startup?.promise, typeof i?.typesetPromise == "function" && await i.typesetPromise([n]);
35295
+ await o;
35296
+ let s = v();
35297
+ await s?.startup?.promise, typeof s?.typesetPromise == "function" && (await s.typesetPromise([n]), _(n));
35187
35298
  };
35188
35299
  }
35189
- var v = "@pie-lib/math-rendering";
35190
- var y = "@pie-lib/math-rendering@2";
35191
- var b = null;
35192
- function x() {
35193
- return !!window[y]?.opts?.useSingleDollar;
35300
+ var P = "@pie-lib/math-rendering";
35301
+ var F = "@pie-lib/math-rendering@2";
35302
+ var I = null;
35303
+ function L() {
35304
+ return !!window[F]?.opts?.useSingleDollar;
35194
35305
  }
35195
- function S() {
35196
- return b || (b = g({ useSingleDollar: x() })), b;
35306
+ function R() {
35307
+ return I || (I = M({ useSingleDollar: L() })), I;
35197
35308
  }
35198
- function C() {
35309
+ function z() {
35199
35310
  if (typeof window > "u") return null;
35200
- let e = window[v];
35311
+ let e = window[P];
35201
35312
  return typeof e?.renderMath == "function" ? e : null;
35202
35313
  }
35203
- var w = async (e) => {
35314
+ function B() {
35315
+ let e = i();
35316
+ e && r("legacy-renderer-delegation", `window['${P}'] renders this element's math with MathJax ${e}`);
35317
+ }
35318
+ var V = async (e) => {
35204
35319
  if (typeof window > "u") return;
35205
35320
  let t = typeof e == "string", n;
35206
35321
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
35207
- let r = C();
35208
- return r ? await r.renderMath?.(n) : await S()(n), t ? n.innerHTML : void 0;
35322
+ let r = z();
35323
+ return r ? (B(), await r.renderMath?.(n)) : await R()(n), t ? n.innerHTML : void 0;
35209
35324
  };
35210
35325
  //#endregion
35211
35326
  //#region src/delivery/tile-accessible-name.ts
@@ -36526,7 +36641,7 @@ function VennClassification($$anchor, $$props) {
36526
36641
  if (!containerEl) return;
36527
36642
  const warn = (err) => console.warn("venn-classification: MathJax render failed", err);
36528
36643
  try {
36529
- Promise.resolve(w(containerEl)).catch(warn);
36644
+ Promise.resolve(V(containerEl)).catch(warn);
36530
36645
  } catch (err) {
36531
36646
  warn(err);
36532
36647
  }