@pie-element/simple-cloze 0.1.4-next.8 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/author/index.d.ts +2 -18
  2. package/dist/author/index.js +1151 -456
  3. package/dist/author/index.js.map +1 -1
  4. package/dist/browser/author/index.js +3764 -3612
  5. package/dist/browser/author/index.js.map +1 -1
  6. package/dist/browser/{client-BSTc3boO.js → client-e4ZTphpa.js} +874 -680
  7. package/dist/browser/client-e4ZTphpa.js.map +1 -0
  8. package/dist/browser/controller/index.js +2 -62
  9. package/dist/browser/controller-1IBOQFFL.js +69 -0
  10. package/dist/browser/controller-1IBOQFFL.js.map +1 -0
  11. package/dist/browser/delivery/index.js +82 -82
  12. package/dist/browser/delivery/index.js.map +1 -1
  13. package/dist/browser/editor-runtime/author/index.js +634 -0
  14. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  15. package/dist/browser/editor-runtime/client-e4ZTphpa.js +2370 -0
  16. package/dist/browser/editor-runtime/client-e4ZTphpa.js.map +1 -0
  17. package/dist/browser/editor-runtime/controller/index.js +2 -0
  18. package/dist/browser/editor-runtime/controller-1IBOQFFL.js +69 -0
  19. package/dist/browser/editor-runtime/controller-1IBOQFFL.js.map +1 -0
  20. package/dist/browser/editor-runtime/delivery/index.js +243 -0
  21. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  22. package/dist/browser/{i18n-BaF24Jzw.js → editor-runtime/i18n-BTsdzpBv.js} +397 -252
  23. package/dist/browser/editor-runtime/i18n-BTsdzpBv.js.map +1 -0
  24. package/dist/browser/editor-runtime/plain-text-iaQZhkGe.js +53 -0
  25. package/dist/browser/editor-runtime/plain-text-iaQZhkGe.js.map +1 -0
  26. package/dist/browser/editor-runtime/print/index.js +71 -0
  27. package/dist/browser/editor-runtime/print/index.js.map +1 -0
  28. package/dist/browser/i18n-BTsdzpBv.js +1755 -0
  29. package/dist/browser/i18n-BTsdzpBv.js.map +1 -0
  30. package/dist/browser/print/index.js +37 -52
  31. package/dist/browser/print/index.js.map +1 -1
  32. package/dist/controller/defaults.d.ts +5 -0
  33. package/dist/controller/index.js +11 -4
  34. package/dist/controller/index.js.map +1 -1
  35. package/dist/delivery/index.js +366 -200
  36. package/dist/delivery/index.js.map +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.iife.d.ts +1 -1
  39. package/dist/index.iife.js +4 -4
  40. package/dist/print/index.d.ts +2 -10
  41. package/dist/print/index.js +366 -221
  42. package/dist/print/index.js.map +1 -1
  43. package/module/print.js +928 -783
  44. package/module/print.js.map +1 -1
  45. package/package.json +22 -4
  46. package/dist/browser/client-BSTc3boO.js.map +0 -1
  47. package/dist/browser/controller/index.js.map +0 -1
  48. package/dist/browser/i18n-BaF24Jzw.js.map +0 -1
@@ -1,72 +1,16 @@
1
- //#region ../../shared/configure-events/dist/index.js
2
- var _e;
3
- var _e2;
4
- var _e3;
5
- var _e4;
6
- var _e5;
7
- var e = (_e = class e extends CustomEvent {
8
- constructor(t, n = !1) {
9
- super(e.TYPE, {
10
- bubbles: !0,
11
- detail: {
12
- update: t,
13
- reset: n
14
- }
15
- }), this.update = t, this.reset = n;
16
- }
17
- }, _e.TYPE = "model.updated", _e);
18
- _e2 = class e extends CustomEvent {
19
- constructor(t, n) {
20
- super(e.TYPE, {
21
- bubbles: !0,
22
- detail: {
23
- src: t,
24
- done: n
25
- }
26
- }), this.src = t, this.done = n;
27
- }
28
- }, _e2.TYPE = "delete.image";
29
- _e3 = class e extends CustomEvent {
30
- constructor(t) {
31
- super(e.TYPE, {
32
- bubbles: !0,
33
- detail: t
34
- }), this.handler = t;
35
- }
36
- }, _e3.TYPE = "insert.image";
37
- _e4 = class e extends CustomEvent {
38
- constructor(t, n) {
39
- super(e.TYPE, {
40
- bubbles: !0,
41
- detail: {
42
- src: t,
43
- done: n
44
- }
45
- }), this.src = t, this.done = n;
46
- }
47
- }, _e4.TYPE = "delete.sound";
48
- _e5 = class e extends CustomEvent {
49
- constructor(t) {
50
- super(e.TYPE, {
51
- bubbles: !0,
52
- detail: t
53
- }), this.handler = t;
54
- }
55
- }, _e5.TYPE = "insert.sound";
56
- //#endregion
57
- //#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
58
2
  if (typeof window !== "undefined") {
59
3
  var _window$__svelte, _window;
60
4
  ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
61
5
  }
62
6
  //#endregion
63
- //#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
64
8
  var HYDRATION_ERROR = {};
65
9
  var UNINITIALIZED = Symbol("uninitialized");
66
10
  var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
67
11
  var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
68
12
  //#endregion
69
- //#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
70
14
  var is_array = Array.isArray;
71
15
  var index_of = Array.prototype.indexOf;
72
16
  var includes = Array.prototype.includes;
@@ -102,6 +46,26 @@ function deferred() {
102
46
  reject
103
47
  };
104
48
  }
49
+ /**
50
+ * When encountering a situation like `let [a, b, c] = $derived(blah())`,
51
+ * we need to stash an intermediate value that `a`, `b`, and `c` derive
52
+ * from, in case it's an iterable
53
+ * @template T
54
+ * @param {ArrayLike<T> | Iterable<T>} value
55
+ * @param {number} [n]
56
+ * @returns {Array<T>}
57
+ */
58
+ function to_array(value, n) {
59
+ if (Array.isArray(value)) return value;
60
+ if (n === void 0 || !(Symbol.iterator in value)) return Array.from(value);
61
+ /** @type {T[]} */
62
+ const array = [];
63
+ for (const element of value) {
64
+ array.push(element);
65
+ if (array.length === n) break;
66
+ }
67
+ return array;
68
+ }
105
69
  //#endregion
106
70
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
107
71
  function _typeof(o) {
@@ -156,13 +120,7 @@ var DESTROYING = 1 << 25;
156
120
  var EFFECT_TRANSPARENT = 65536;
157
121
  var EFFECT_PRESERVED = 1 << 19;
158
122
  var USER_EFFECT = 1 << 20;
159
- /**
160
- * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
161
- * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
162
- * because a derived might be checked but not executed). This is a pure performance optimization flag and
163
- * should not be used for any other purpose!
164
- */
165
- var WAS_MARKED = 65536;
123
+ var EFFECT_OFFSCREEN = 1 << 25;
166
124
  var REACTION_IS_UPDATING = 1 << 21;
167
125
  var ASYNC = 1 << 22;
168
126
  var ERROR_VALUE = 1 << 23;
@@ -205,7 +163,7 @@ function svelte_boundary_reset_noop() {
205
163
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
206
164
  }
207
165
  //#endregion
208
- //#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
209
167
  /** @import { TemplateNode } from '#client' */
210
168
  /**
211
169
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -284,7 +242,7 @@ function read_hydration_instruction(node) {
284
242
  return node.data;
285
243
  }
286
244
  //#endregion
287
- //#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
288
246
  /** @import { Equals } from '#client' */
289
247
  /** @type {Equals} */
290
248
  function equals(value) {
@@ -311,7 +269,7 @@ function lifecycle_outside_component(name) {
311
269
  throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
312
270
  }
313
271
  //#endregion
314
- //#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
315
273
  /**
316
274
  * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
317
275
  * @returns {never}
@@ -320,6 +278,16 @@ function async_derived_orphan() {
320
278
  throw new Error(`https://svelte.dev/e/async_derived_orphan`);
321
279
  }
322
280
  /**
281
+ * Keyed each block has duplicate key `%value%` at indexes %a% and %b%
282
+ * @param {string} a
283
+ * @param {string} b
284
+ * @param {string | undefined | null} [value]
285
+ * @returns {never}
286
+ */
287
+ function each_key_duplicate(a, b, value) {
288
+ throw new Error(`https://svelte.dev/e/each_key_duplicate`);
289
+ }
290
+ /**
323
291
  * `%rune%` cannot be used inside an effect cleanup function
324
292
  * @param {string} rune
325
293
  * @returns {never}
@@ -393,13 +361,13 @@ function svelte_boundary_reset_onerror() {
393
361
  throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
394
362
  }
395
363
  //#endregion
396
- //#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
397
365
  /** True if experimental.async=true */
398
366
  var async_mode_flag = false;
399
367
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
400
368
  var legacy_mode_flag = false;
401
369
  //#endregion
402
- //#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
403
371
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
404
372
  /** @type {ComponentContext | null} */
405
373
  var component_context = null;
@@ -459,7 +427,7 @@ function is_runes() {
459
427
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
460
428
  }
461
429
  //#endregion
462
- //#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
463
431
  /** @type {Array<() => void>} */
464
432
  var micro_tasks = [];
465
433
  function run_micro_tasks() {
@@ -486,7 +454,7 @@ function flush_tasks() {
486
454
  while (micro_tasks.length > 0) run_micro_tasks();
487
455
  }
488
456
  //#endregion
489
- //#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
490
458
  /** @import { Derived, Signal } from '#client' */
491
459
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
492
460
  /**
@@ -505,22 +473,8 @@ function update_derived_status(derived) {
505
473
  else set_signal_status(derived, MAYBE_DIRTY);
506
474
  }
507
475
  //#endregion
508
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
509
- /** @import { Derived, Effect, Value } from '#client' */
510
- /**
511
- * @param {Value[] | null} deps
512
- */
513
- function clear_marked(deps) {
514
- if (deps === null) return;
515
- for (const dep of deps) {
516
- if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
517
- dep.f ^= WAS_MARKED;
518
- clear_marked(
519
- /** @type {Derived} */
520
- dep.deps
521
- );
522
- }
523
- }
476
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/utils.js
477
+ /** @import { Effect } from '#client' */
524
478
  /**
525
479
  * @param {Effect} effect
526
480
  * @param {Set<Effect>} dirty_effects
@@ -529,41 +483,10 @@ function clear_marked(deps) {
529
483
  function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
530
484
  if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
531
485
  else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
532
- clear_marked(effect.deps);
533
486
  set_signal_status(effect, CLEAN);
534
487
  }
535
488
  //#endregion
536
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/store.js
537
- /**
538
- * We set this to `true` when updating a store so that we correctly
539
- * schedule effects if the update takes place inside a `$:` effect
540
- */
541
- var legacy_is_updating_store = false;
542
- /**
543
- * Whether or not the prop currently being read is a store binding, as in
544
- * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
545
- * runes mode, and skip `binding_property_non_reactive` validation
546
- */
547
- var is_store_binding = false;
548
- /**
549
- * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
550
- * Used to prevent `binding_property_non_reactive` validation false positives and
551
- * ensure that these props are treated as mutable even in runes mode
552
- * @template T
553
- * @param {() => T} fn
554
- * @returns {[T, boolean]}
555
- */
556
- function capture_store_binding(fn) {
557
- var previous_is_store_binding = is_store_binding;
558
- try {
559
- is_store_binding = false;
560
- return [fn(), is_store_binding];
561
- } finally {
562
- is_store_binding = previous_is_store_binding;
563
- }
564
- }
565
- //#endregion
566
- //#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
567
490
  var listening_to_form_reset = false;
568
491
  function add_form_reset_listener() {
569
492
  if (!listening_to_form_reset) {
@@ -577,7 +500,7 @@ function add_form_reset_listener() {
577
500
  }
578
501
  }
579
502
  //#endregion
580
- //#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
581
504
  /**
582
505
  * @template T
583
506
  * @param {() => T} fn
@@ -595,7 +518,7 @@ function without_reactive_context(fn) {
595
518
  }
596
519
  }
597
520
  //#endregion
598
- //#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
599
522
  /** @import { Blocker, Effect, Source, Value } from '#client' */
600
523
  /**
601
524
  * @param {Blocker[]} blockers
@@ -828,7 +751,6 @@ function execute_derived(derived) {
828
751
  }
829
752
  set_active_effect(parent);
830
753
  try {
831
- derived.f &= ~WAS_MARKED;
832
754
  destroy_derived_effects(derived);
833
755
  value = update_reaction(derived);
834
756
  } finally {
@@ -915,7 +837,7 @@ function _classPrivateFieldGet2(s, a) {
915
837
  return s.get(_assertClassBrand(s, a));
916
838
  }
917
839
  //#endregion
918
- //#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
919
841
  /** @import { Fork } from 'svelte' */
920
842
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
921
843
  var _Batch;
@@ -966,7 +888,7 @@ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
966
888
  var _pending = /* @__PURE__ */ new WeakMap();
967
889
  var _blocking_pending = /* @__PURE__ */ new WeakMap();
968
890
  var _deferred = /* @__PURE__ */ new WeakMap();
969
- var _roots = /* @__PURE__ */ new WeakMap();
891
+ var _scheduled = /* @__PURE__ */ new WeakMap();
970
892
  var _new_effects = /* @__PURE__ */ new WeakMap();
971
893
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
972
894
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
@@ -1014,7 +936,7 @@ var Batch = class Batch {
1014
936
  _classPrivateFieldInitSpec(this, _pending, 0);
1015
937
  _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
1016
938
  _classPrivateFieldInitSpec(this, _deferred, null);
1017
- _classPrivateFieldInitSpec(this, _roots, []);
939
+ _classPrivateFieldInitSpec(this, _scheduled, []);
1018
940
  _classPrivateFieldInitSpec(this, _new_effects, []);
1019
941
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
1020
942
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
@@ -1203,20 +1125,7 @@ var Batch = class Batch {
1203
1125
  effect.b.defer_effect(effect);
1204
1126
  return;
1205
1127
  }
1206
- var e = effect;
1207
- while (e.parent !== null) {
1208
- e = e.parent;
1209
- var flags = e.f;
1210
- if (collected_effects !== null && e === active_effect) {
1211
- if (async_mode_flag) return;
1212
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1213
- }
1214
- if ((flags & 96) !== 0) {
1215
- if ((flags & 1024) === 0) return;
1216
- e.f ^= CLEAN;
1217
- }
1218
- }
1219
- _classPrivateFieldGet2(_roots, this).push(e);
1128
+ _classPrivateFieldGet2(_scheduled, this).push(effect);
1220
1129
  }
1221
1130
  };
1222
1131
  _Batch = Batch;
@@ -1236,12 +1145,40 @@ function _is_deferred() {
1236
1145
  }
1237
1146
  return false;
1238
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
+ }
1239
1180
  function _process() {
1240
1181
  _classPrivateFieldSet2(_started, this, true);
1241
- if (flush_count++ > 1e3) {
1242
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1243
- infinite_loop_guard();
1244
- }
1245
1182
  for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
1246
1183
  _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
1247
1184
  set_signal_status(e, DIRTY);
@@ -1251,8 +1188,6 @@ function _process() {
1251
1188
  set_signal_status(e, MAYBE_DIRTY);
1252
1189
  this.schedule(e);
1253
1190
  }
1254
- const roots = _classPrivateFieldGet2(_roots, this);
1255
- _classPrivateFieldSet2(_roots, this, []);
1256
1191
  this.apply();
1257
1192
  /** @type {Effect[]} */
1258
1193
  var effects = collected_effects = [];
@@ -1263,12 +1198,18 @@ function _process() {
1263
1198
  * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1264
1199
  */
1265
1200
  var updates = legacy_updates = [];
1266
- for (const root of roots) try {
1267
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1268
- } catch (e) {
1269
- reset_all(root);
1270
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1271
- 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
+ }
1272
1213
  }
1273
1214
  current_batch = null;
1274
1215
  if (updates.length > 0) {
@@ -1302,16 +1243,16 @@ function _process() {
1302
1243
  previous_batch = null;
1303
1244
  _classPrivateFieldGet2(_deferred, this)?.resolve();
1304
1245
  var next_batch = current_batch;
1305
- 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)) {
1306
1247
  _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1307
1248
  if (async_mode_flag) {
1308
1249
  _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
1309
1250
  current_batch = next_batch;
1310
1251
  }
1311
1252
  }
1312
- if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1313
- const batch = next_batch;
1314
- _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, []);
1315
1256
  } else next_batch = this;
1316
1257
  if (next_batch !== null) {
1317
1258
  old_values.clear();
@@ -1461,10 +1402,9 @@ function _commit$1() {
1461
1402
  batch.schedule(effect);
1462
1403
  } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1463
1404
  }
1464
- if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1405
+ if (_classPrivateFieldGet2(_scheduled, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1465
1406
  batch.apply();
1466
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1467
- _classPrivateFieldSet2(_roots, batch, []);
1407
+ for (var root of _assertClassBrand(_Batch_brand, batch, _resolve$1).call(batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1468
1408
  }
1469
1409
  batch.deactivate();
1470
1410
  }
@@ -1631,7 +1571,7 @@ function reset_all(effect) {
1631
1571
  }
1632
1572
  }
1633
1573
  //#endregion
1634
- //#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
1635
1575
  /** @import { Derived, Effect, Source, Value } from '#client' */
1636
1576
  /** @type {Set<Effect>} */
1637
1577
  var eager_effects = /* @__PURE__ */ new Set();
@@ -1693,6 +1633,16 @@ function set(source, value, should_proxy = false) {
1693
1633
  return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1694
1634
  }
1695
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
+ /**
1696
1646
  * @template V
1697
1647
  * @param {Source<V>} source
1698
1648
  * @param {V} value
@@ -1711,7 +1661,10 @@ function internal_set(source, value, updated_during_traversal = null) {
1711
1661
  if (batch_values === null) update_derived_status(derived);
1712
1662
  }
1713
1663
  source.wv = increment_write_version();
1664
+ seen = null;
1665
+ count_deps = 0;
1714
1666
  mark_reactions(source, DIRTY, updated_during_traversal);
1667
+ seen = null;
1715
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]);
1716
1669
  else untracked_writes.push(source);
1717
1670
  if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
@@ -1750,6 +1703,12 @@ function mark_reactions(signal, status, updated_during_traversal) {
1750
1703
  if (reactions === null) return;
1751
1704
  var runes = is_runes();
1752
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
+ }
1753
1712
  for (var i = 0; i < length; i++) {
1754
1713
  var reaction = reactions[i];
1755
1714
  var flags = reaction.f;
@@ -1760,10 +1719,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
1760
1719
  else if ((flags & 2) !== 0) {
1761
1720
  var derived = reaction;
1762
1721
  batch_values?.delete(derived);
1763
- if ((flags & 65536) === 0) {
1764
- if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1765
- mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1766
- }
1722
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1767
1723
  } else if (not_dirty) {
1768
1724
  var effect = reaction;
1769
1725
  if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
@@ -1851,14 +1807,14 @@ function proxy(value) {
1851
1807
  return Reflect.get(target, prop, receiver);
1852
1808
  },
1853
1809
  getOwnPropertyDescriptor(target, prop) {
1810
+ this.has?.(target, prop);
1854
1811
  var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1855
- if (descriptor && "value" in descriptor) {
1856
- var s = sources.get(prop);
1857
- if (s) descriptor.value = get(s);
1858
- } else if (descriptor === void 0) {
1859
- var source = sources.get(prop);
1860
- var value = source?.v;
1861
- if (source !== void 0 && value !== UNINITIALIZED) return {
1812
+ var s = sources.get(prop);
1813
+ if (s !== void 0) {
1814
+ var value = get(s);
1815
+ if (value === UNINITIALIZED) return;
1816
+ if (descriptor && "value" in descriptor) descriptor.value = value;
1817
+ else return {
1862
1818
  enumerable: true,
1863
1819
  configurable: true,
1864
1820
  value,
@@ -1931,7 +1887,7 @@ function proxy(value) {
1931
1887
  });
1932
1888
  }
1933
1889
  //#endregion
1934
- //#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
1935
1891
  /** @import { Effect, TemplateNode } from '#client' */
1936
1892
  /** @type {Window} */
1937
1893
  var $window;
@@ -2031,6 +1987,21 @@ function first_child(node, is_text = false) {
2031
1987
  return hydrate_node;
2032
1988
  }
2033
1989
  /**
1990
+ * `child`, for the very common case of an element with exactly one child. Resetting the
1991
+ * hydration cursor is part of the same step, so the compiler doesn't have to emit a
1992
+ * separate `reset` call for every `<p>{text}</p>` in an app.
1993
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
1994
+ * @param {TemplateNode} node
1995
+ * @param {boolean} [is_text]
1996
+ * @returns {TemplateNode | null}
1997
+ */
1998
+ function only_child(node, is_text = false) {
1999
+ if (!hydrating) return /* @__PURE__ */ get_first_child(node);
2000
+ var first = child(node, is_text);
2001
+ reset$1(node);
2002
+ return first;
2003
+ }
2004
+ /**
2034
2005
  * Don't mark this as side-effect-free, hydration needs to walk all nodes
2035
2006
  * @param {TemplateNode} node
2036
2007
  * @param {number} count
@@ -2141,7 +2112,7 @@ function invoke_error_boundary(error, effect) {
2141
2112
  throw error;
2142
2113
  }
2143
2114
  //#endregion
2144
- //#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
2145
2116
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2146
2117
  /**
2147
2118
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2532,14 +2503,14 @@ function move_effect(effect, fragment) {
2532
2503
  }
2533
2504
  }
2534
2505
  //#endregion
2535
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/legacy.js
2506
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/legacy.js
2536
2507
  /**
2537
2508
  * @type {Set<Value> | null}
2538
2509
  * @deprecated
2539
2510
  */
2540
2511
  var captured_signals = null;
2541
2512
  //#endregion
2542
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
2513
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/runtime.js
2543
2514
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2544
2515
  /**
2545
2516
  * True if updating in an effect context that is reactive (i.e. not branch/root effects)
@@ -2571,7 +2542,7 @@ function set_active_effect(effect) {
2571
2542
  var current_sources = null;
2572
2543
  /** @param {Value} value */
2573
2544
  function push_reaction_value(value) {
2574
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2545
+ 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);
2575
2546
  }
2576
2547
  /**
2577
2548
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2615,7 +2586,6 @@ function increment_write_version() {
2615
2586
  function is_dirty(reaction) {
2616
2587
  var flags = reaction.f;
2617
2588
  if ((flags & 2048) !== 0) return true;
2618
- if (flags & 2) reaction.f &= ~WAS_MARKED;
2619
2589
  if ((flags & 4096) !== 0) {
2620
2590
  var dependencies = reaction.deps;
2621
2591
  var length = dependencies.length;
@@ -2747,10 +2717,7 @@ function remove_reaction(signal, dependency) {
2747
2717
  }
2748
2718
  if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2749
2719
  var derived = dependency;
2750
- if ((derived.f & 512) !== 0) {
2751
- derived.f ^= 512;
2752
- derived.f &= ~WAS_MARKED;
2753
- }
2720
+ if ((derived.f & 512) !== 0) derived.f ^= 512;
2754
2721
  if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2755
2722
  if (derived.ac !== null) without_reactive_context(() => {
2756
2723
  /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
@@ -2899,7 +2866,7 @@ function untrack(fn) {
2899
2866
  }
2900
2867
  }
2901
2868
  //#endregion
2902
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/events.js
2869
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/events.js
2903
2870
  /**
2904
2871
  * Used on elements, as a map of event type -> event handler,
2905
2872
  * and on events themselves to track which element handled an event
@@ -3007,7 +2974,7 @@ function handle_event_propagation(event) {
3007
2974
  }
3008
2975
  }
3009
2976
  //#endregion
3010
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/reconciler.js
2977
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3011
2978
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3012
2979
  /** @param {string} html */
3013
2980
  createHTML: (html) => {
@@ -3026,7 +2993,7 @@ function create_fragment_from_html(html) {
3026
2993
  return elem.content;
3027
2994
  }
3028
2995
  //#endregion
3029
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/template.js
2996
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/template.js
3030
2997
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3031
2998
  /** @import { TemplateStructure } from './types' */
3032
2999
  /**
@@ -3125,7 +3092,7 @@ function is_passive_event(name) {
3125
3092
  return PASSIVE_EVENTS.includes(name);
3126
3093
  }
3127
3094
  //#endregion
3128
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/reactivity/create-subscriber.js
3095
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/reactivity/create-subscriber.js
3129
3096
  /**
3130
3097
  * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
3131
3098
  * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
@@ -3198,7 +3165,7 @@ function createSubscriber(start) {
3198
3165
  };
3199
3166
  }
3200
3167
  //#endregion
3201
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
3168
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
3202
3169
  /** @import { Effect, Source, TemplateNode, } from '#client' */
3203
3170
  /**
3204
3171
  * @typedef {{
@@ -3581,6 +3548,18 @@ function _handle_error(error) {
3581
3548
  });
3582
3549
  }
3583
3550
  /**
3551
+ * @param {Element} text
3552
+ * @param {string} value
3553
+ * @returns {void}
3554
+ */
3555
+ function set_text(text, value) {
3556
+ var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3557
+ if (str !== (text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
3558
+ /** @type {any} */ text[TEXT_CACHE] = str;
3559
+ text.nodeValue = `${str}`;
3560
+ }
3561
+ }
3562
+ /**
3584
3563
  * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
3585
3564
  * Transitions will play during the initial render unless the `intro` option is set to `false`.
3586
3565
  *
@@ -3756,7 +3735,7 @@ function unmount(component, options) {
3756
3735
  return Promise.resolve();
3757
3736
  }
3758
3737
  //#endregion
3759
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3738
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3760
3739
  /** @import { Effect, TemplateNode } from '#client' */
3761
3740
  var _batches = /* @__PURE__ */ new WeakMap();
3762
3741
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3878,6 +3857,25 @@ var BranchManager = class {
3878
3857
  }
3879
3858
  }
3880
3859
  };
3860
+ //#endregion
3861
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/snippet.js
3862
+ /** @import { Snippet } from 'svelte' */
3863
+ /** @import { TemplateNode } from '#client' */
3864
+ /** @import { Getters } from '#shared' */
3865
+ /**
3866
+ * @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn
3867
+ * @param {TemplateNode} node
3868
+ * @param {() => SnippetFn | null | undefined} get_snippet
3869
+ * @param {(() => any)[]} args
3870
+ * @returns {void}
3871
+ */
3872
+ function snippet(node, get_snippet, ...args) {
3873
+ var branches = new BranchManager(node);
3874
+ block(() => {
3875
+ const snippet = get_snippet() ?? null;
3876
+ branches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));
3877
+ }, EFFECT_TRANSPARENT);
3878
+ }
3881
3879
  /**
3882
3880
  * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.
3883
3881
  * Unlike `$effect`, the provided function only runs once.
@@ -3926,7 +3924,7 @@ function init_update_callbacks(context) {
3926
3924
  });
3927
3925
  }
3928
3926
  //#endregion
3929
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/if.js
3927
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
3930
3928
  /** @import { TemplateNode } from '#client' */
3931
3929
  /**
3932
3930
  * @param {TemplateNode} node
@@ -3971,6 +3969,411 @@ function if_block(node, fn, elseif = false) {
3971
3969
  if (!has_branch) update_branch(-1, null);
3972
3970
  }, flags);
3973
3971
  }
3972
+ //#endregion
3973
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/blocks/each.js
3974
+ /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
3975
+ /** @import { Batch } from '../../reactivity/batch.js'; */
3976
+ /**
3977
+ * Pause multiple effects simultaneously, and coordinate their
3978
+ * subsequent destruction. Used in each blocks
3979
+ * @param {EachState} state
3980
+ * @param {Effect[]} to_destroy
3981
+ * @param {null | Node} controlled_anchor
3982
+ */
3983
+ function pause_effects(state, to_destroy, controlled_anchor) {
3984
+ /** @type {TransitionManager[]} */
3985
+ var transitions = [];
3986
+ var length = to_destroy.length;
3987
+ /** @type {EachOutroGroup} */
3988
+ var group;
3989
+ var remaining = to_destroy.length;
3990
+ for (var i = 0; i < length; i++) {
3991
+ let effect = to_destroy[i];
3992
+ pause_effect(effect, () => {
3993
+ if (group) {
3994
+ group.pending.delete(effect);
3995
+ group.done.add(effect);
3996
+ if (group.pending.size === 0) {
3997
+ var groups = state.outrogroups;
3998
+ destroy_effects(state, array_from(group.done));
3999
+ groups.delete(group);
4000
+ if (groups.size === 0) state.outrogroups = null;
4001
+ }
4002
+ } else remaining -= 1;
4003
+ }, false);
4004
+ }
4005
+ if (remaining === 0) {
4006
+ var fast_path = transitions.length === 0 && controlled_anchor !== null && state.pending.size === 0;
4007
+ if (fast_path) {
4008
+ var anchor = controlled_anchor;
4009
+ var parent_node = anchor.parentNode;
4010
+ clear_text_content(parent_node);
4011
+ parent_node.append(anchor);
4012
+ state.items.clear();
4013
+ }
4014
+ destroy_effects(state, to_destroy, !fast_path);
4015
+ } else {
4016
+ group = {
4017
+ pending: new Set(to_destroy),
4018
+ done: /* @__PURE__ */ new Set()
4019
+ };
4020
+ (state.outrogroups ?? (state.outrogroups = /* @__PURE__ */ new Set())).add(group);
4021
+ }
4022
+ }
4023
+ /**
4024
+ * @param {EachState} state
4025
+ * @param {Effect[]} to_destroy
4026
+ * @param {boolean} remove_dom
4027
+ */
4028
+ function destroy_effects(state, to_destroy, remove_dom = true) {
4029
+ /** @type {Set<Effect> | undefined} */
4030
+ var preserved_effects;
4031
+ if (state.pending.size > 0) {
4032
+ preserved_effects = /* @__PURE__ */ new Set();
4033
+ for (const keys of state.pending.values()) for (const key of keys) preserved_effects.add(
4034
+ /** @type {EachItem} */
4035
+ state.items.get(key).e
4036
+ );
4037
+ }
4038
+ for (var i = 0; i < to_destroy.length; i++) {
4039
+ var e = to_destroy[i];
4040
+ if (preserved_effects?.has(e)) {
4041
+ e.f |= EFFECT_OFFSCREEN;
4042
+ move_effect(e, document.createDocumentFragment());
4043
+ } else destroy_effect(to_destroy[i], remove_dom);
4044
+ }
4045
+ }
4046
+ /** @type {TemplateNode} */
4047
+ var offscreen_anchor;
4048
+ /**
4049
+ * @template V
4050
+ * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block
4051
+ * @param {number} flags
4052
+ * @param {() => V[]} get_collection
4053
+ * @param {(value: V, index: number) => any} get_key
4054
+ * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn
4055
+ * @param {null | ((anchor: Node) => void)} fallback_fn
4056
+ * @returns {void}
4057
+ */
4058
+ function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {
4059
+ var anchor = node;
4060
+ /** @type {Map<any, EachItem>} */
4061
+ var items = /* @__PURE__ */ new Map();
4062
+ if ((flags & 4) !== 0) {
4063
+ var parent_node = node;
4064
+ anchor = hydrating ? set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node)) : parent_node.appendChild(create_text());
4065
+ }
4066
+ if (hydrating) hydrate_next();
4067
+ /** @type {Effect | null} */
4068
+ var fallback = null;
4069
+ var each_array = /* @__PURE__ */ derived_safe_equal(() => {
4070
+ var collection = get_collection();
4071
+ return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
4072
+ });
4073
+ /** @type {V[]} */
4074
+ var array;
4075
+ /** @type {Map<Batch, Set<any>>} */
4076
+ var pending = /* @__PURE__ */ new Map();
4077
+ var first_run = true;
4078
+ /**
4079
+ * @param {Batch} batch
4080
+ */
4081
+ function commit(batch) {
4082
+ if ((state.effect.f & 16384) !== 0) return;
4083
+ state.pending.delete(batch);
4084
+ state.fallback = fallback;
4085
+ reconcile(state, array, anchor, flags, get_key);
4086
+ if (fallback !== null) if (array.length === 0) if ((fallback.f & 33554432) === 0) resume_effect(fallback);
4087
+ else {
4088
+ fallback.f ^= EFFECT_OFFSCREEN;
4089
+ move(fallback, null, anchor);
4090
+ }
4091
+ else pause_effect(fallback, () => {
4092
+ fallback = null;
4093
+ });
4094
+ }
4095
+ /**
4096
+ * @param {Batch} batch
4097
+ */
4098
+ function discard(batch) {
4099
+ state.pending.delete(batch);
4100
+ }
4101
+ /** @type {EachState} */
4102
+ var state = {
4103
+ effect: block(() => {
4104
+ array = get(each_array);
4105
+ var length = array.length;
4106
+ /** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */
4107
+ let mismatch = false;
4108
+ if (hydrating) {
4109
+ if (read_hydration_instruction(anchor) === "[!" !== (length === 0)) {
4110
+ anchor = skip_nodes();
4111
+ set_hydrate_node(anchor);
4112
+ set_hydrating(false);
4113
+ mismatch = true;
4114
+ }
4115
+ }
4116
+ var keys = /* @__PURE__ */ new Set();
4117
+ var batch = current_batch;
4118
+ var defer = should_defer_append();
4119
+ for (var index = 0; index < length; index += 1) {
4120
+ if (hydrating && hydrate_node.nodeType === 8 && hydrate_node.data === "]") {
4121
+ anchor = hydrate_node;
4122
+ mismatch = true;
4123
+ set_hydrating(false);
4124
+ }
4125
+ var value = array[index];
4126
+ var key = get_key(value, index);
4127
+ var item = first_run ? null : items.get(key);
4128
+ if (item) {
4129
+ if (item.v) internal_set(item.v, value);
4130
+ if (item.i) internal_set(item.i, index);
4131
+ if (defer) batch.unskip_effect(item.e);
4132
+ } else {
4133
+ item = create_item(items, first_run ? anchor : offscreen_anchor ?? (offscreen_anchor = create_text()), value, key, index, render_fn, flags, get_collection);
4134
+ if (!first_run) item.e.f |= EFFECT_OFFSCREEN;
4135
+ items.set(key, item);
4136
+ }
4137
+ keys.add(key);
4138
+ }
4139
+ if (length === 0 && fallback_fn && !fallback) if (first_run) fallback = branch(() => fallback_fn(anchor));
4140
+ else {
4141
+ fallback = branch(() => fallback_fn(offscreen_anchor ?? (offscreen_anchor = create_text())));
4142
+ fallback.f |= EFFECT_OFFSCREEN;
4143
+ }
4144
+ if (length > keys.size) each_key_duplicate("", "", "");
4145
+ if (hydrating && length > 0) set_hydrate_node(skip_nodes());
4146
+ if (!first_run) {
4147
+ pending.set(batch, keys);
4148
+ if (defer) {
4149
+ for (const [key, item] of items) if (!keys.has(key)) batch.skip_effect(item.e);
4150
+ batch.oncommit(commit);
4151
+ batch.ondiscard(discard);
4152
+ } else commit(batch);
4153
+ }
4154
+ if (mismatch) set_hydrating(true);
4155
+ get(each_array);
4156
+ }),
4157
+ flags,
4158
+ items,
4159
+ pending,
4160
+ outrogroups: null,
4161
+ fallback
4162
+ };
4163
+ first_run = false;
4164
+ if (hydrating) anchor = hydrate_node;
4165
+ }
4166
+ /**
4167
+ * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect
4168
+ * @param {Effect | null} effect
4169
+ * @returns {Effect | null}
4170
+ */
4171
+ function skip_to_branch(effect) {
4172
+ while (effect !== null && (effect.f & 32) === 0) effect = effect.next;
4173
+ return effect;
4174
+ }
4175
+ /**
4176
+ * Add, remove, or reorder items output by an each block as its input changes
4177
+ * @template V
4178
+ * @param {EachState} state
4179
+ * @param {Array<V>} array
4180
+ * @param {Element | Comment | Text} anchor
4181
+ * @param {number} flags
4182
+ * @param {(value: V, index: number) => any} get_key
4183
+ * @returns {void}
4184
+ */
4185
+ function reconcile(state, array, anchor, flags, get_key) {
4186
+ var is_animated = (flags & 8) !== 0;
4187
+ var length = array.length;
4188
+ var items = state.items;
4189
+ var current = skip_to_branch(state.effect.first);
4190
+ /** @type {undefined | Set<Effect>} */
4191
+ var seen;
4192
+ /** @type {Effect | null} */
4193
+ var prev = null;
4194
+ /** @type {undefined | Set<Effect>} */
4195
+ var to_animate;
4196
+ /** @type {Effect[]} */
4197
+ var matched = [];
4198
+ /** @type {Effect[]} */
4199
+ var stashed = [];
4200
+ /** @type {V} */
4201
+ var value;
4202
+ /** @type {any} */
4203
+ var key;
4204
+ /** @type {Effect | undefined} */
4205
+ var effect;
4206
+ /** @type {number} */
4207
+ var i;
4208
+ if (is_animated) for (i = 0; i < length; i += 1) {
4209
+ value = array[i];
4210
+ key = get_key(value, i);
4211
+ effect = items.get(key).e;
4212
+ if ((effect.f & 33554432) === 0) {
4213
+ effect.nodes?.a?.measure();
4214
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).add(effect);
4215
+ }
4216
+ }
4217
+ for (i = 0; i < length; i += 1) {
4218
+ value = array[i];
4219
+ key = get_key(value, i);
4220
+ effect = items.get(key).e;
4221
+ if (state.outrogroups !== null) for (const group of state.outrogroups) {
4222
+ group.pending.delete(effect);
4223
+ group.done.delete(effect);
4224
+ }
4225
+ if ((effect.f & 8192) !== 0) {
4226
+ resume_effect(effect);
4227
+ if (is_animated) {
4228
+ effect.nodes?.a?.unfix();
4229
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).delete(effect);
4230
+ }
4231
+ }
4232
+ if ((effect.f & 33554432) !== 0) {
4233
+ effect.f ^= EFFECT_OFFSCREEN;
4234
+ if (effect === current) move(effect, null, anchor);
4235
+ else {
4236
+ var next = prev ? prev.next : current;
4237
+ if (effect === state.effect.last) state.effect.last = effect.prev;
4238
+ if (effect.prev) effect.prev.next = effect.next;
4239
+ if (effect.next) effect.next.prev = effect.prev;
4240
+ link(state, prev, effect);
4241
+ link(state, effect, next);
4242
+ move(effect, next, anchor);
4243
+ prev = effect;
4244
+ matched = [];
4245
+ stashed = [];
4246
+ current = skip_to_branch(prev.next);
4247
+ continue;
4248
+ }
4249
+ }
4250
+ if (effect !== current) {
4251
+ if (seen !== void 0 && seen.has(effect)) {
4252
+ if (matched.length < stashed.length) {
4253
+ var start = stashed[0];
4254
+ var j;
4255
+ prev = start.prev;
4256
+ var a = matched[0];
4257
+ var b = matched[matched.length - 1];
4258
+ for (j = 0; j < matched.length; j += 1) move(matched[j], start, anchor);
4259
+ for (j = 0; j < stashed.length; j += 1) seen.delete(stashed[j]);
4260
+ link(state, a.prev, b.next);
4261
+ link(state, prev, a);
4262
+ link(state, b, start);
4263
+ current = start;
4264
+ prev = b;
4265
+ i -= 1;
4266
+ matched = [];
4267
+ stashed = [];
4268
+ } else {
4269
+ seen.delete(effect);
4270
+ move(effect, current, anchor);
4271
+ link(state, effect.prev, effect.next);
4272
+ link(state, effect, prev === null ? state.effect.first : prev.next);
4273
+ link(state, prev, effect);
4274
+ prev = effect;
4275
+ }
4276
+ continue;
4277
+ }
4278
+ matched = [];
4279
+ stashed = [];
4280
+ while (current !== null && current !== effect) {
4281
+ (seen ?? (seen = /* @__PURE__ */ new Set())).add(current);
4282
+ stashed.push(current);
4283
+ current = skip_to_branch(current.next);
4284
+ }
4285
+ if (current === null) continue;
4286
+ }
4287
+ if ((effect.f & 33554432) === 0) matched.push(effect);
4288
+ prev = effect;
4289
+ current = skip_to_branch(effect.next);
4290
+ }
4291
+ if (state.outrogroups !== null) {
4292
+ for (const group of state.outrogroups) if (group.pending.size === 0) {
4293
+ destroy_effects(state, array_from(group.done));
4294
+ state.outrogroups?.delete(group);
4295
+ }
4296
+ if (state.outrogroups.size === 0) state.outrogroups = null;
4297
+ }
4298
+ if (current !== null || seen !== void 0) {
4299
+ /** @type {Effect[]} */
4300
+ var to_destroy = [];
4301
+ if (seen !== void 0) {
4302
+ for (effect of seen) if ((effect.f & 8192) === 0) to_destroy.push(effect);
4303
+ }
4304
+ while (current !== null) {
4305
+ if ((current.f & 8192) === 0 && current !== state.fallback) to_destroy.push(current);
4306
+ current = skip_to_branch(current.next);
4307
+ }
4308
+ var destroy_length = to_destroy.length;
4309
+ if (destroy_length > 0) {
4310
+ var controlled_anchor = (flags & 4) !== 0 && length === 0 ? anchor : null;
4311
+ if (is_animated) {
4312
+ for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure();
4313
+ for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix();
4314
+ }
4315
+ pause_effects(state, to_destroy, controlled_anchor);
4316
+ }
4317
+ }
4318
+ if (is_animated) queue_micro_task(() => {
4319
+ if (to_animate === void 0) return;
4320
+ for (effect of to_animate) effect.nodes?.a?.apply();
4321
+ });
4322
+ }
4323
+ /**
4324
+ * @template V
4325
+ * @param {Map<any, EachItem>} items
4326
+ * @param {Node} anchor
4327
+ * @param {V} value
4328
+ * @param {unknown} key
4329
+ * @param {number} index
4330
+ * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn
4331
+ * @param {number} flags
4332
+ * @param {() => V[]} get_collection
4333
+ * @returns {EachItem}
4334
+ */
4335
+ function create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {
4336
+ var v = (flags & 1) !== 0 ? (flags & 16) === 0 ? /* @__PURE__ */ mutable_source(value, false, false) : source(value) : null;
4337
+ var i = (flags & 2) !== 0 ? source(index) : null;
4338
+ return {
4339
+ v,
4340
+ i,
4341
+ e: branch(() => {
4342
+ render_fn(anchor, v ?? value, i ?? index, get_collection);
4343
+ return () => {
4344
+ items.delete(key);
4345
+ };
4346
+ })
4347
+ };
4348
+ }
4349
+ /**
4350
+ * @param {Effect} effect
4351
+ * @param {Effect | null} next
4352
+ * @param {Text | Element | Comment} anchor
4353
+ */
4354
+ function move(effect, next, anchor) {
4355
+ if (!effect.nodes) return;
4356
+ var node = effect.nodes.start;
4357
+ var end = effect.nodes.end;
4358
+ var dest = next && (next.f & 33554432) === 0 ? next.nodes.start : anchor;
4359
+ while (node !== null) {
4360
+ var next_node = /* @__PURE__ */ get_next_sibling(node);
4361
+ dest.before(node);
4362
+ if (node === end) return;
4363
+ node = next_node;
4364
+ }
4365
+ }
4366
+ /**
4367
+ * @param {EachState} state
4368
+ * @param {Effect | null} prev
4369
+ * @param {Effect | null} next
4370
+ */
4371
+ function link(state, prev, next) {
4372
+ if (prev === null) state.effect.first = next;
4373
+ else prev.next = next;
4374
+ if (next === null) state.effect.last = prev;
4375
+ else next.prev = prev;
4376
+ }
3974
4377
  /**
3975
4378
  * @param {Element | Text | Comment} node
3976
4379
  * @param {() => string | TrustedHTML} get_value
@@ -4032,7 +4435,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
4032
4435
  });
4033
4436
  }
4034
4437
  //#endregion
4035
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/css.js
4438
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/css.js
4036
4439
  /**
4037
4440
  * @param {Node} anchor
4038
4441
  * @param {{ hash: string, code: string }} css
@@ -4051,7 +4454,7 @@ function append_styles(anchor, css) {
4051
4454
  });
4052
4455
  }
4053
4456
  //#endregion
4054
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/attributes.js
4457
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/shared/attributes.js
4055
4458
  var whitespace$1 = [..." \n\r\f\xA0\v"];
4056
4459
  /**
4057
4460
  * @param {any} value
@@ -4077,7 +4480,7 @@ function to_class(value, hash, directives) {
4077
4480
  return classname === "" ? null : classname;
4078
4481
  }
4079
4482
  //#endregion
4080
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/class.js
4483
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/class.js
4081
4484
  /**
4082
4485
  * @param {Element} dom
4083
4486
  * @param {boolean | number} is_html
@@ -4102,7 +4505,7 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4102
4505
  return next_classes;
4103
4506
  }
4104
4507
  //#endregion
4105
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4508
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4106
4509
  /** @import { Blocker, Effect } from '#client' */
4107
4510
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
4108
4511
  var IS_HTML = Symbol("is html");
@@ -4146,6 +4549,15 @@ function set_value(element, value) {
4146
4549
  }
4147
4550
  /**
4148
4551
  * @param {Element} element
4552
+ * @param {boolean} checked
4553
+ */
4554
+ function set_checked(element, checked) {
4555
+ var attributes = get_attributes(element);
4556
+ if (attributes.checked === (attributes.checked = checked ?? void 0)) return;
4557
+ element.checked = checked;
4558
+ }
4559
+ /**
4560
+ * @param {Element} element
4149
4561
  * @param {string} attribute
4150
4562
  * @param {string | null} value
4151
4563
  * @param {boolean} [skip_warning]
@@ -4194,7 +4606,7 @@ function get_setters(element) {
4194
4606
  return setters;
4195
4607
  }
4196
4608
  //#endregion
4197
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4609
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4198
4610
  var _ResizeObserverSingleton;
4199
4611
  var _listeners = /* @__PURE__ */ new WeakMap();
4200
4612
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -4246,7 +4658,7 @@ function _getObserver() {
4246
4658
  }
4247
4659
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
4248
4660
  //#endregion
4249
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
4661
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
4250
4662
  /** @import { ComponentContext, Effect } from '#client' */
4251
4663
  /**
4252
4664
  * @param {any} bound_value
@@ -4298,7 +4710,32 @@ function bind_this(element_or_component = mark_as_component(), update, get_value
4298
4710
  return element_or_component;
4299
4711
  }
4300
4712
  //#endregion
4301
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/props.js
4713
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/store.js
4714
+ /**
4715
+ * Whether or not the prop currently being read is a store binding, as in
4716
+ * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
4717
+ * runes mode, and skip `binding_property_non_reactive` validation
4718
+ */
4719
+ var is_store_binding = false;
4720
+ /**
4721
+ * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
4722
+ * Used to prevent `binding_property_non_reactive` validation false positives and
4723
+ * ensure that these props are treated as mutable even in runes mode
4724
+ * @template T
4725
+ * @param {() => T} fn
4726
+ * @returns {[T, boolean]}
4727
+ */
4728
+ function capture_store_binding(fn) {
4729
+ var previous_is_store_binding = is_store_binding;
4730
+ try {
4731
+ is_store_binding = false;
4732
+ return [fn(), is_store_binding];
4733
+ } finally {
4734
+ is_store_binding = previous_is_store_binding;
4735
+ }
4736
+ }
4737
+ //#endregion
4738
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/reactivity/props.js
4302
4739
  /** @import { Derived, Effect, Source } from './types.js' */
4303
4740
  /**
4304
4741
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
@@ -4391,7 +4828,7 @@ function prop(props, key, flags, fallback) {
4391
4828
  });
4392
4829
  }
4393
4830
  //#endregion
4394
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/legacy/legacy-client.js
4831
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/legacy/legacy-client.js
4395
4832
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
4396
4833
  /**
4397
4834
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -4510,7 +4947,7 @@ var Svelte4Component = class {
4510
4947
  }
4511
4948
  };
4512
4949
  //#endregion
4513
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4950
+ //#region ../../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4514
4951
  /**
4515
4952
  * @typedef {Object} CustomElementPropDefinition
4516
4953
  * @property {string} [attribute]
@@ -4795,6 +5232,168 @@ function create_custom_element(Component, props_definition, slots, exports, shad
4795
5232
  return Class;
4796
5233
  }
4797
5234
  //#endregion
5235
+ //#region ../../shared/configure-events/dist/index.js
5236
+ var _e;
5237
+ var _e2;
5238
+ var _e3;
5239
+ var _e4;
5240
+ var _e5;
5241
+ var e = (_e = class e extends CustomEvent {
5242
+ constructor(t, n = !1) {
5243
+ super(e.TYPE, {
5244
+ bubbles: !0,
5245
+ detail: {
5246
+ update: t,
5247
+ reset: n
5248
+ }
5249
+ }), this.update = t, this.reset = n;
5250
+ }
5251
+ }, _e.TYPE = "model.updated", _e);
5252
+ _e2 = class e extends CustomEvent {
5253
+ constructor(t, n) {
5254
+ super(e.TYPE, {
5255
+ bubbles: !0,
5256
+ detail: {
5257
+ src: t,
5258
+ done: n
5259
+ }
5260
+ }), this.src = t, this.done = n;
5261
+ }
5262
+ }, _e2.TYPE = "delete.image";
5263
+ _e3 = class e extends CustomEvent {
5264
+ constructor(t) {
5265
+ super(e.TYPE, {
5266
+ bubbles: !0,
5267
+ detail: t
5268
+ }), this.handler = t;
5269
+ }
5270
+ }, _e3.TYPE = "insert.image";
5271
+ _e4 = class e extends CustomEvent {
5272
+ constructor(t, n) {
5273
+ super(e.TYPE, {
5274
+ bubbles: !0,
5275
+ detail: {
5276
+ src: t,
5277
+ done: n
5278
+ }
5279
+ }), this.src = t, this.done = n;
5280
+ }
5281
+ }, _e4.TYPE = "delete.sound";
5282
+ _e5 = class e extends CustomEvent {
5283
+ constructor(t) {
5284
+ super(e.TYPE, {
5285
+ bubbles: !0,
5286
+ detail: t
5287
+ }), this.handler = t;
5288
+ }
5289
+ }, _e5.TYPE = "insert.sound";
5290
+ //#endregion
5291
+ //#region ../../lib-svelte/config-ui-svelte/dist/index.js
5292
+ var t = /* @__PURE__ */ from_html("<aside class=\"pie-config-layout-settings svelte-9dr0jr\" aria-label=\"Settings\"><!></aside>");
5293
+ var n = /* @__PURE__ */ from_html("<div class=\"pie-config-layout svelte-9dr0jr\"><div class=\"pie-config-layout-contents svelte-9dr0jr\"><div class=\"pie-config-layout-design svelte-9dr0jr\"><!></div> <!></div></div>");
5294
+ var r = {
5295
+ hash: "svelte-9dr0jr",
5296
+ code: ".pie-config-layout.svelte-9dr0jr {container-type:inline-size;}.pie-config-layout-contents.svelte-9dr0jr {display:flex;flex-direction:column;gap:16px;}.pie-config-layout-design.svelte-9dr0jr {flex:1 1 auto;min-width:0;}\n\n @container (min-width: 1135px) {.pie-config-layout-contents.svelte-9dr0jr {flex-direction:row;align-items:flex-start;}.pie-config-layout-settings.svelte-9dr0jr {flex:0 0 300px;position:sticky;top:0;}\n }"
5297
+ };
5298
+ function i$1(i, a) {
5299
+ append_styles(i, r);
5300
+ let o = prop(a, "hideSettings", 3, !1);
5301
+ var s = n(), c = child(s), l = child(c);
5302
+ snippet(child(l), () => a.children), reset$1(l);
5303
+ var d = sibling(l, 2), f = (n) => {
5304
+ var r = t();
5305
+ snippet(child(r), () => a.settings), reset$1(r), append(n, r);
5306
+ };
5307
+ if_block(d, (e) => {
5308
+ a.settings && !o() && e(f);
5309
+ }), reset$1(c), reset$1(s), append(i, s);
5310
+ }
5311
+ var a = (e) => typeof e == "object" && !!e && !Array.isArray(e);
5312
+ function o(e, t) {
5313
+ if (!a(t)) return e;
5314
+ let n = { ...e };
5315
+ for (let [r, i] of Object.entries(t)) {
5316
+ let t = e[r];
5317
+ n[r] = a(t) && a(i) ? {
5318
+ ...t,
5319
+ ...i
5320
+ } : i;
5321
+ }
5322
+ return n;
5323
+ }
5324
+ function s(e) {
5325
+ return a(e) ? Object.values(e).some((e) => a(e) && (e.settings === !0 || s(e))) : !1;
5326
+ }
5327
+ var c = (e, t = !1, n = !1) => ({
5328
+ type: "toggle",
5329
+ label: e,
5330
+ isConfigProperty: t,
5331
+ disabled: n
5332
+ });
5333
+ function u(e, t) {
5334
+ let n = e;
5335
+ for (let e of t.split(".")) {
5336
+ if (!a(n)) return;
5337
+ n = n[e];
5338
+ }
5339
+ return n;
5340
+ }
5341
+ function d(e, t, n) {
5342
+ let [r, ...i] = t.split("."), o = e[r], s = i.length === 0 ? n : d(a(o) ? o : {}, i.join("."), n);
5343
+ return {
5344
+ ...e,
5345
+ [r]: s
5346
+ };
5347
+ }
5348
+ var f = /* @__PURE__ */ from_html("<label class=\"pie-settings-toggle svelte-1ang3sw\"><span> </span> <input type=\"checkbox\" role=\"switch\" class=\"svelte-1ang3sw\"/></label>");
5349
+ var p = /* @__PURE__ */ from_html("<label class=\"pie-settings-choice-row svelte-1ang3sw\"><input type=\"radio\" class=\"svelte-1ang3sw\"/> <span> </span></label>");
5350
+ var m = /* @__PURE__ */ from_html("<fieldset class=\"pie-settings-choice svelte-1ang3sw\"><legend class=\"svelte-1ang3sw\"> </legend> <!></fieldset>");
5351
+ var h$1 = /* @__PURE__ */ from_html("<fieldset class=\"pie-settings-group svelte-1ang3sw\"><legend class=\"pie-settings-group-name svelte-1ang3sw\"> </legend> <!></fieldset>");
5352
+ var g = /* @__PURE__ */ from_html("<div class=\"pie-settings-panel svelte-1ang3sw\"></div>");
5353
+ var _ = {
5354
+ hash: "svelte-1ang3sw",
5355
+ 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;}"
5356
+ };
5357
+ function v(t, n) {
5358
+ push(n, !0), append_styles(t, _);
5359
+ 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(t.isConfigProperty ? r() : n.model, e);
5360
+ function s(e, t, i) {
5361
+ t.isConfigProperty ? n.onChangeConfiguration?.(d(r(), e, i), e) : n.onChangeModel(d(n.model, e, i), e);
5362
+ }
5363
+ var c = g();
5364
+ each(c, 21, () => get(a), ([e, t]) => e, (t, n) => {
5365
+ var r = /* @__PURE__ */ user_derived(() => to_array(get(n), 2));
5366
+ let a = () => get(r)[0], c = () => get(r)[1];
5367
+ var l = h$1(), u = child(l), d = only_child(u, !0);
5368
+ each(sibling(u, 2), 17, c, ([e, t]) => e, (t, n) => {
5369
+ var r = /* @__PURE__ */ user_derived(() => to_array(get(n), 2));
5370
+ let a = () => get(r)[0], c = () => get(r)[1];
5371
+ var l = comment(), u = first_child(l), d = (t) => {
5372
+ var n = f(), r = child(n), i = only_child(r, !0), l = sibling(r, 2);
5373
+ remove_input_defaults(l), reset$1(n), template_effect((t) => {
5374
+ set_text(i, c().label), set_checked(l, t), l.disabled = c().disabled;
5375
+ }, [() => !!o(a(), c())]), delegated("change", l, (e) => s(a(), c(), e.currentTarget.checked)), append(t, n);
5376
+ }, h = (t) => {
5377
+ var n = m(), r = child(n), l = only_child(r, !0);
5378
+ each(sibling(r, 2), 17, () => c().choices, (e) => e.value, (t, n) => {
5379
+ var r = p(), l = child(r);
5380
+ remove_input_defaults(l);
5381
+ var d = only_child(sibling(l, 2), !0);
5382
+ reset$1(r), template_effect((t) => {
5383
+ set_attribute(l, "name", `${i}-${a()}`), set_value(l, get(n).value), set_checked(l, t), set_text(d, get(n).label);
5384
+ }, [() => o(a(), c()) === get(n).value]), delegated("change", l, () => s(a(), c(), get(n).value)), append(t, r);
5385
+ }), reset$1(n), template_effect(() => set_text(l, c().label)), append(t, n);
5386
+ };
5387
+ if_block(u, (e) => {
5388
+ c().type === "toggle" ? e(d) : c().type === "radio" && e(h, 1);
5389
+ }), append(t, l);
5390
+ }), reset$1(l), template_effect(() => set_text(d, a())), append(t, l);
5391
+ }), reset$1(c), append(t, c), pop();
5392
+ }
5393
+ delegate(["change"]);
5394
+ var y = i$1;
5395
+ var b = v;
5396
+ //#endregion
4798
5397
  //#region ../../../node_modules/.bun/@tiptap+core@3.31.3+ef29727eaaf819d3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
4799
5398
  var __defProp = Object.defineProperty;
4800
5399
  var __exportAll = (all, no_symbols) => {
@@ -4889,7 +5488,7 @@ OrderedMap.from = function(value) {
4889
5488
  return new OrderedMap(content);
4890
5489
  };
4891
5490
  //#endregion
4892
- //#region ../../../node_modules/.bun/prosemirror-model@1.25.11/node_modules/prosemirror-model/dist/index.js
5491
+ //#region ../../../node_modules/.bun/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js
4893
5492
  function findDiffStart(a, b, pos) {
4894
5493
  for (let i = 0;; i++) {
4895
5494
  if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
@@ -5335,9 +5934,7 @@ var Mark$1 = class Mark$1 {
5335
5934
  if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
5336
5935
  let type = schema.marks[json.type];
5337
5936
  if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
5338
- let mark = type.create(json.attrs);
5339
- type.checkAttrs(mark.attrs);
5340
- return mark;
5937
+ return type.create(json.attrs);
5341
5938
  }
5342
5939
  /**
5343
5940
  Test whether two sets of marks are identical.
@@ -6234,11 +6831,11 @@ var Node$2 = class Node$2 {
6234
6831
  */
6235
6832
  check() {
6236
6833
  this.type.checkContent(this.content);
6237
- this.type.checkAttrs(this.attrs);
6834
+ checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
6238
6835
  let copy = Mark$1.none;
6239
6836
  for (let i = 0; i < this.marks.length; i++) {
6240
6837
  let mark = this.marks[i];
6241
- mark.type.checkAttrs(mark.attrs);
6838
+ checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
6242
6839
  copy = mark.addToSet(copy);
6243
6840
  }
6244
6841
  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)}`);
@@ -6272,9 +6869,7 @@ var Node$2 = class Node$2 {
6272
6869
  return schema.text(json.text, marks);
6273
6870
  }
6274
6871
  let content = Fragment.fromJSON(schema, json.content);
6275
- let node = schema.nodeType(json.type).create(json.attrs, content, marks);
6276
- node.type.checkAttrs(node.attrs);
6277
- return node;
6872
+ return schema.nodeType(json.type).create(json.attrs, content, marks);
6278
6873
  }
6279
6874
  };
6280
6875
  Node$2.prototype.text = void 0;
@@ -6324,6 +6919,10 @@ function wrapMarks(marks, str) {
6324
6919
  for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
6325
6920
  return str;
6326
6921
  }
6922
+ function checkAttrs(attrs, values, type, name) {
6923
+ for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
6924
+ for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
6925
+ }
6327
6926
  /**
6328
6927
  Instances of this class represent a match state of a node type's
6329
6928
  [content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
@@ -6732,20 +7331,15 @@ function defaultAttrs(attrs) {
6732
7331
  function computeAttrs(attrs, value) {
6733
7332
  let built = Object.create(null);
6734
7333
  for (let name in attrs) {
7334
+ let attr = attrs[name];
6735
7335
  let given = value && value[name];
6736
- if (given === void 0) {
6737
- let attr = attrs[name];
6738
- if (attr.hasDefault) given = attr.default;
6739
- else throw new RangeError("No value supplied for attribute " + name);
6740
- }
7336
+ if (given === void 0) if (attr.hasDefault) given = attr.default;
7337
+ else throw new RangeError("No value supplied for attribute " + name);
7338
+ else if (attr.validate) attr.validate(given);
6741
7339
  built[name] = given;
6742
7340
  }
6743
7341
  return built;
6744
7342
  }
6745
- function checkAttrs(attrs, values, type, name) {
6746
- for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
6747
- for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
6748
- }
6749
7343
  function initAttrs(typeName, attrs) {
6750
7344
  let result = Object.create(null);
6751
7345
  if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
@@ -6900,11 +7494,9 @@ var NodeType$1 = class NodeType$1 {
6900
7494
  if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
6901
7495
  }
6902
7496
  /**
6903
- @internal
7497
+ @internal no longer useful, but called by old prosemirror-view versions
6904
7498
  */
6905
- checkAttrs(attrs) {
6906
- checkAttrs(this.attrs, attrs, "node", this.name);
6907
- }
7499
+ checkAttrs(attrs) {}
6908
7500
  /**
6909
7501
  Check whether the given mark type is allowed in this node.
6910
7502
  */
@@ -7015,12 +7607,6 @@ var MarkType = class MarkType {
7015
7607
  for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
7016
7608
  }
7017
7609
  /**
7018
- @internal
7019
- */
7020
- checkAttrs(attrs) {
7021
- checkAttrs(this.attrs, attrs, "mark", this.name);
7022
- }
7023
- /**
7024
7610
  Queries whether a given mark type is
7025
7611
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
7026
7612
  */
@@ -7879,7 +8465,7 @@ function renderSpec(doc, structure, xmlNS, blockArraysIn) {
7879
8465
  };
7880
8466
  }
7881
8467
  //#endregion
7882
- //#region ../../../node_modules/.bun/prosemirror-transform@1.12.0/node_modules/prosemirror-transform/dist/index.js
8468
+ //#region ../../../node_modules/.bun/prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js
7883
8469
  var lower16 = 65535;
7884
8470
  var factor16 = Math.pow(2, 16);
7885
8471
  function makeRecover(index, offset) {
@@ -7982,8 +8568,11 @@ var StepMap = class StepMap {
7982
8568
  let result = start + diff + (side < 0 ? 0 : newSize);
7983
8569
  if (simple) return result;
7984
8570
  let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
7985
- let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
7986
- if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8571
+ let del = 0;
8572
+ if (oldSize) {
8573
+ del |= pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
8574
+ if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8575
+ }
7987
8576
  return new MapResult(result, del, recover);
7988
8577
  }
7989
8578
  diff += newSize - oldSize;
@@ -9104,9 +9693,9 @@ var Fitter = class {
9104
9693
  }
9105
9694
  openMore() {
9106
9695
  let { content, openStart, openEnd } = this.unplaced;
9107
- let inner = contentAt(content, openStart);
9108
- if (!inner.childCount || inner.firstChild.isLeaf) return false;
9109
- this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
9696
+ if (maxOpen(content, -1) <= openStart) return false;
9697
+ if (this.unplaced.size > 1 && maxOpen(content, 1) > openEnd) openEnd++;
9698
+ this.unplaced = new Slice(content, openStart + 1, openEnd);
9110
9699
  return true;
9111
9700
  }
9112
9701
  dropNode() {
@@ -9240,6 +9829,13 @@ function invalidMarks(type, fragment, start) {
9240
9829
  function definesContent(type) {
9241
9830
  return type.spec.defining || type.spec.definingForContent;
9242
9831
  }
9832
+ function maxOpen(frag, side) {
9833
+ for (let count = 0;; count++) {
9834
+ let ch = side < 0 ? frag.firstChild : frag.lastChild;
9835
+ if (!ch || ch.isAtom) return count;
9836
+ frag = ch.content;
9837
+ }
9838
+ }
9243
9839
  function replaceRange(tr, from, to, slice) {
9244
9840
  if (!slice.size) return tr.deleteRange(from, to);
9245
9841
  let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
@@ -10685,7 +11281,7 @@ var PluginKey = class {
10685
11281
  }
10686
11282
  };
10687
11283
  //#endregion
10688
- //#region ../../../node_modules/.bun/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js
11284
+ //#region ../../../node_modules/.bun/prosemirror-commands@1.7.2/node_modules/prosemirror-commands/dist/index.js
10689
11285
  /**
10690
11286
  Delete the selection, if there is one.
10691
11287
  */
@@ -11007,20 +11603,23 @@ a custom function to determine the type of the newly split off block.
11007
11603
  */
11008
11604
  function splitBlockAs(splitNode) {
11009
11605
  return (state, dispatch) => {
11010
- let { $from, $to } = state.selection;
11011
11606
  if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {
11607
+ let { $from } = state.selection;
11012
11608
  if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;
11013
11609
  if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());
11014
11610
  return true;
11015
11611
  }
11016
- if (!$from.depth) return false;
11612
+ if (!state.selection.$from.depth) return false;
11613
+ let tr = state.tr;
11614
+ if (!state.selection.empty && (state.selection instanceof TextSelection || state.selection instanceof AllSelection)) tr.deleteSelection();
11615
+ let { $from } = tr.selection, mapFrom = tr.steps.length;
11017
11616
  let types = [];
11018
11617
  let splitDepth, deflt, atEnd = false, atStart = false;
11019
11618
  for (let d = $from.depth;; d--) if ($from.node(d).isBlock) {
11020
11619
  atEnd = $from.end(d) == $from.pos + ($from.depth - d);
11021
11620
  atStart = $from.start(d) == $from.pos - ($from.depth - d);
11022
11621
  deflt = defaultBlockAt$1($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
11023
- let splitType = splitNode && splitNode($to.parent, atEnd, $from);
11622
+ let splitType = splitNode && splitNode($from.parent, atEnd, $from);
11024
11623
  types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));
11025
11624
  splitDepth = d;
11026
11625
  break;
@@ -11028,9 +11627,7 @@ function splitBlockAs(splitNode) {
11028
11627
  if (d == 1) return false;
11029
11628
  types.unshift(null);
11030
11629
  }
11031
- let tr = state.tr;
11032
- if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();
11033
- let splitPos = tr.mapping.map($from.pos);
11630
+ let splitPos = $from.pos;
11034
11631
  let can = canSplit(tr.doc, splitPos, types.length, types);
11035
11632
  if (!can) {
11036
11633
  types[0] = deflt ? { type: deflt } : null;
@@ -11039,8 +11636,9 @@ function splitBlockAs(splitNode) {
11039
11636
  if (!can) return false;
11040
11637
  tr.split(splitPos, types.length, types);
11041
11638
  if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
11042
- let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
11043
- if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
11639
+ let mapping = tr.mapping.slice(mapFrom);
11640
+ let first = mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
11641
+ if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(mapping.map($from.before(splitDepth)), deflt);
11044
11642
  }
11045
11643
  if (dispatch) dispatch(tr.scrollIntoView());
11046
11644
  return true;
@@ -11366,7 +11964,7 @@ function sinkListItem(itemType) {
11366
11964
  };
11367
11965
  }
11368
11966
  //#endregion
11369
- //#region ../../../node_modules/.bun/prosemirror-view@1.42.3/node_modules/prosemirror-view/dist/index.js
11967
+ //#region ../../../node_modules/.bun/prosemirror-view@1.42.6/node_modules/prosemirror-view/dist/index.js
11370
11968
  var domIndex = function(node) {
11371
11969
  for (var index = 0;; index++) {
11372
11970
  node = node.previousSibling;
@@ -11397,12 +11995,12 @@ function scanFor(node, off, targetNode, targetOff, dir) {
11397
11995
  if (node == targetNode && off == targetOff) return true;
11398
11996
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
11399
11997
  let parent = node.parentNode;
11400
- if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
11998
+ if (!parent || !isElt(parent) || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
11401
11999
  off = domIndex(node) + (dir < 0 ? 0 : 1);
11402
12000
  node = parent;
11403
- } else if (node.nodeType == 1) {
12001
+ } else if (isElt(node)) {
11404
12002
  let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
11405
- if (child.nodeType == 1 && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
12003
+ if (isElt(child) && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
11406
12004
  else return false;
11407
12005
  else {
11408
12006
  node = child;
@@ -11414,10 +12012,19 @@ function scanFor(node, off, targetNode, targetOff, dir) {
11414
12012
  function nodeSize(node) {
11415
12013
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
11416
12014
  }
12015
+ function isElt(node) {
12016
+ return node.nodeType == 1;
12017
+ }
12018
+ function isText(node) {
12019
+ return node.nodeType == 3;
12020
+ }
12021
+ function contains(parent, child) {
12022
+ return child ? parent.contains(isElt(child) ? child : child.parentNode) : false;
12023
+ }
11417
12024
  function textNodeBefore$1(node, offset) {
11418
12025
  for (;;) {
11419
- if (node.nodeType == 3 && offset) return node;
11420
- if (node.nodeType == 1 && offset > 0) {
12026
+ if (isText(node) && offset) return node;
12027
+ if (isElt(node) && offset > 0) {
11421
12028
  if (node.contentEditable == "false") return null;
11422
12029
  node = node.childNodes[offset - 1];
11423
12030
  offset = nodeSize(node);
@@ -11429,8 +12036,8 @@ function textNodeBefore$1(node, offset) {
11429
12036
  }
11430
12037
  function textNodeAfter$1(node, offset) {
11431
12038
  for (;;) {
11432
- if (node.nodeType == 3 && offset < node.nodeValue.length) return node;
11433
- if (node.nodeType == 1 && offset < node.childNodes.length) {
12039
+ if (isText(node) && offset < node.nodeValue.length) return node;
12040
+ if (isElt(node) && offset < node.childNodes.length) {
11434
12041
  if (node.contentEditable == "false") return null;
11435
12042
  node = node.childNodes[offset];
11436
12043
  offset = 0;
@@ -11541,13 +12148,12 @@ function scrollRectIntoView(view, rect, startDOM) {
11541
12148
  let doc = view.dom.ownerDocument;
11542
12149
  for (let parent = startDOM || view.dom;;) {
11543
12150
  if (!parent) break;
11544
- if (parent.nodeType != 1) {
12151
+ if (!isElt(parent)) {
11545
12152
  parent = parentNode(parent);
11546
12153
  continue;
11547
12154
  }
11548
- let elt = parent;
11549
- let atTop = elt == doc.body;
11550
- let bounding = atTop ? windowRect(doc) : clientRect(elt);
12155
+ let atTop = parent == doc.body;
12156
+ let bounding = atTop ? windowRect(doc) : clientRect(parent);
11551
12157
  let moveX = 0, moveY = 0;
11552
12158
  if (rect.top < bounding.top + getSide(scrollThreshold, "top")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
11553
12159
  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");
@@ -11555,10 +12161,10 @@ function scrollRectIntoView(view, rect, startDOM) {
11555
12161
  else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
11556
12162
  if (moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY);
11557
12163
  else {
11558
- let startX = elt.scrollLeft, startY = elt.scrollTop;
11559
- if (moveY) elt.scrollTop += moveY;
11560
- if (moveX) elt.scrollLeft += moveX;
11561
- let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;
12164
+ let startX = parent.scrollLeft, startY = parent.scrollTop;
12165
+ if (moveY) parent.scrollTop += moveY;
12166
+ if (moveX) parent.scrollLeft += moveX;
12167
+ let dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;
11562
12168
  rect = {
11563
12169
  left: rect.left - dX,
11564
12170
  top: rect.top - dY,
@@ -11628,13 +12234,14 @@ function focusPreventScroll(dom) {
11628
12234
  }
11629
12235
  }
11630
12236
  function findOffsetInNode(node, coords) {
11631
- let closest, dxClosest = 2e8, coordsClosest, offset = 0;
12237
+ let closest;
12238
+ let dxClosest = 2e8, coordsClosest, offset = 0;
11632
12239
  let rowBot = coords.top, rowTop = coords.top;
11633
12240
  let firstBelow, coordsBelow;
11634
12241
  for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
11635
12242
  let rects;
11636
- if (child.nodeType == 1) rects = child.getClientRects();
11637
- else if (child.nodeType == 3) rects = textRange(child).getClientRects();
12243
+ if (isElt(child)) rects = child.getClientRects();
12244
+ else if (isText(child)) rects = textRange(child).getClientRects();
11638
12245
  else continue;
11639
12246
  for (let i = 0; i < rects.length; i++) {
11640
12247
  let rect = rects[i];
@@ -11645,11 +12252,11 @@ function findOffsetInNode(node, coords) {
11645
12252
  if (dx < dxClosest) {
11646
12253
  closest = child;
11647
12254
  dxClosest = dx;
11648
- coordsClosest = dx && closest.nodeType == 3 ? {
12255
+ coordsClosest = dx && isText(closest) ? {
11649
12256
  left: rect.right < coords.left ? rect.right : rect.left,
11650
12257
  top: coords.top
11651
12258
  } : coords;
11652
- if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
12259
+ if (isElt(child) && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
11653
12260
  continue;
11654
12261
  }
11655
12262
  } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
@@ -11667,8 +12274,8 @@ function findOffsetInNode(node, coords) {
11667
12274
  coordsClosest = coordsBelow;
11668
12275
  dxClosest = 0;
11669
12276
  }
11670
- if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);
11671
- if (!closest || dxClosest && closest.nodeType == 1) return {
12277
+ if (closest && isText(closest)) return findOffsetInText(closest, coordsClosest);
12278
+ if (!closest || dxClosest) return {
11672
12279
  node,
11673
12280
  offset
11674
12281
  };
@@ -11706,7 +12313,7 @@ function targetKludge(dom, coords) {
11706
12313
  }
11707
12314
  function posFromElement(view, elt, coords) {
11708
12315
  let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
11709
- if (node.nodeType == 1 && !node.firstChild) {
12316
+ if (isElt(node) && !node.firstChild) {
11710
12317
  let rect = node.getBoundingClientRect();
11711
12318
  bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
11712
12319
  }
@@ -11718,7 +12325,7 @@ function posFromCaret(view, node, offset, coords) {
11718
12325
  if (cur == view.dom) break;
11719
12326
  let desc = view.docView.nearestDesc(cur, true), rect;
11720
12327
  if (!desc) return null;
11721
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
12328
+ if (isElt(desc.dom) && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
11722
12329
  if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
11723
12330
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;
11724
12331
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;
@@ -11734,7 +12341,7 @@ function elementFromPoint(element, coords, box) {
11734
12341
  let len = element.childNodes.length;
11735
12342
  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;;) {
11736
12343
  let child = element.childNodes[i];
11737
- if (child.nodeType == 1) {
12344
+ if (isElt(child)) {
11738
12345
  let rects = child.getClientRects();
11739
12346
  for (let j = 0; j < rects.length; j++) {
11740
12347
  let rect = rects[j];
@@ -11751,7 +12358,7 @@ function posAtCoords(view, coords) {
11751
12358
  if (caret) ({node, offset} = caret);
11752
12359
  let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
11753
12360
  let pos;
11754
- if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
12361
+ if (!elt || !view.dom.contains(elt)) {
11755
12362
  let box = view.dom.getBoundingClientRect();
11756
12363
  if (!inRect(coords, box)) return null;
11757
12364
  elt = elementFromPoint(view.dom, coords, box);
@@ -11762,7 +12369,7 @@ function posAtCoords(view, coords) {
11762
12369
  }
11763
12370
  elt = targetKludge(elt, coords);
11764
12371
  if (node) {
11765
- if (gecko && node.nodeType == 1) {
12372
+ if (gecko && isElt(node)) {
11766
12373
  offset = Math.min(offset, node.childNodes.length);
11767
12374
  if (offset < node.childNodes.length) {
11768
12375
  let next = node.childNodes[offset], box;
@@ -11770,9 +12377,9 @@ function posAtCoords(view, coords) {
11770
12377
  }
11771
12378
  }
11772
12379
  let prev;
11773
- if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
11774
- 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;
11775
- else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
12380
+ if (webkit && offset && isElt(node) && isElt(prev = node.childNodes[offset - 1]) && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
12381
+ if (node == view.dom && offset == node.childNodes.length - 1 && isElt(node.lastChild) && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
12382
+ else if (offset == 0 || !isElt(node) || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
11776
12383
  }
11777
12384
  if (pos == null) pos = posFromElement(view, elt, coords);
11778
12385
  let desc = view.docView.nearestDesc(elt, true);
@@ -11796,7 +12403,7 @@ var BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
11796
12403
  function coordsAtPos(view, pos, side) {
11797
12404
  let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
11798
12405
  let supportEmptyRange = webkit || gecko;
11799
- if (node.nodeType == 3) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
12406
+ if (isText(node)) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
11800
12407
  let rect = singleRect(textRange(node, offset, offset), side);
11801
12408
  if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
11802
12409
  let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
@@ -11821,26 +12428,26 @@ function coordsAtPos(view, pos, side) {
11821
12428
  if (!view.state.doc.resolve(pos - (atom || 0)).parent.inlineContent) {
11822
12429
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
11823
12430
  let before = node.childNodes[offset - 1];
11824
- if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);
12431
+ if (isElt(before)) return flattenH(before.getBoundingClientRect(), false);
11825
12432
  }
11826
12433
  if (atom == null && offset < nodeSize(node)) {
11827
12434
  let after = node.childNodes[offset];
11828
- if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);
12435
+ if (isElt(after)) return flattenH(after.getBoundingClientRect(), true);
11829
12436
  }
11830
12437
  return flattenH(node.getBoundingClientRect(), side >= 0);
11831
12438
  }
11832
12439
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
11833
12440
  let before = node.childNodes[offset - 1];
11834
- let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
12441
+ let target = isText(before) ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : isElt(before) && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
11835
12442
  if (target) return flattenV(singleRect(target, 1), false);
11836
12443
  }
11837
12444
  if (atom == null && offset < nodeSize(node)) {
11838
12445
  let after = node.childNodes[offset];
11839
12446
  while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;
11840
- let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;
12447
+ let target = !after ? null : isText(after) ? textRange(after, 0, supportEmptyRange ? 0 : 1) : isElt(after) ? after : null;
11841
12448
  if (target) return flattenV(singleRect(target, -1), true);
11842
12449
  }
11843
- return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
12450
+ return flattenV(singleRect(isText(node) ? textRange(node) : node, -side), side >= 0);
11844
12451
  }
11845
12452
  function flattenV(rect, left) {
11846
12453
  if (rect.width == 0) return rect;
@@ -11890,8 +12497,8 @@ function endOfTextblockVertical(view, state, dir) {
11890
12497
  let coords = coordsAtPos(view, $pos.pos, 1);
11891
12498
  for (let child = dom.firstChild; child; child = child.nextSibling) {
11892
12499
  let boxes;
11893
- if (child.nodeType == 1) boxes = child.getClientRects();
11894
- else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
12500
+ if (isElt(child)) boxes = child.getClientRects();
12501
+ else if (isText(child)) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
11895
12502
  else continue;
11896
12503
  for (let i = 0; i < boxes.length; i++) {
11897
12504
  let box = boxes[i];
@@ -11915,7 +12522,7 @@ function endOfTextblockHorizontal(view, state, dir) {
11915
12522
  sel.modify("move", dir, "character");
11916
12523
  let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
11917
12524
  let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
11918
- let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;
12525
+ let result = newNode && !contains(parentDOM, newNode) || oldNode == newNode && oldOff == newOff;
11919
12526
  try {
11920
12527
  sel.collapse(anchorNode, anchorOffset);
11921
12528
  if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);
@@ -11997,7 +12604,7 @@ var ViewDesc = class {
11997
12604
  return this.posAtStart + this.size - 2 * this.border;
11998
12605
  }
11999
12606
  localPosFromDOM(dom, offset, bias) {
12000
- if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) if (bias < 0) {
12607
+ if (this.contentDOM && contains(this.contentDOM, dom)) if (bias < 0) {
12001
12608
  let domBefore, desc;
12002
12609
  if (dom == this.contentDOM) domBefore = dom.childNodes[offset - 1];
12003
12610
  else {
@@ -12018,7 +12625,7 @@ var ViewDesc = class {
12018
12625
  }
12019
12626
  let atEnd;
12020
12627
  if (dom == this.dom && this.contentDOM) atEnd = offset > domIndex(this.contentDOM);
12021
- else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
12628
+ else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = !!(dom.compareDocumentPosition(this.contentDOM) & 4);
12022
12629
  else if (this.dom.firstChild) {
12023
12630
  if (offset == 0) for (let search = dom;; search = search.parentNode) {
12024
12631
  if (search == this.dom) {
@@ -12040,7 +12647,7 @@ var ViewDesc = class {
12040
12647
  nearestDesc(dom, onlyNodes = false) {
12041
12648
  for (let first = true, cur = dom; cur; cur = cur.parentNode) {
12042
12649
  let desc = this.getDesc(cur), nodeDOM;
12043
- 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;
12650
+ if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(isElt(nodeDOM) ? contains(nodeDOM, dom) : nodeDOM == dom)) first = false;
12044
12651
  else return desc;
12045
12652
  }
12046
12653
  }
@@ -12081,14 +12688,17 @@ var ViewDesc = class {
12081
12688
  let i = 0, offset = 0;
12082
12689
  for (let curPos = 0; i < this.children.length; i++) {
12083
12690
  let child = this.children[i], end = curPos + child.size;
12084
- if (end > pos || child instanceof TrailingHackViewDesc) {
12691
+ if (end > pos) {
12085
12692
  offset = pos - curPos;
12086
12693
  break;
12087
12694
  }
12088
12695
  curPos = end;
12089
12696
  }
12090
12697
  if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);
12091
- for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--);
12698
+ for (; i > 0; i--) {
12699
+ let prev = this.children[i - 1];
12700
+ if (prev.size || !(prev instanceof BufferHackViewDesc || prev instanceof WidgetViewDesc && prev.side >= 0)) break;
12701
+ }
12092
12702
  if (side <= 0) {
12093
12703
  let prev, enter = true;
12094
12704
  for (;; i--, enter = false) {
@@ -12168,7 +12778,7 @@ var ViewDesc = class {
12168
12778
  }
12169
12779
  domAfterPos(pos) {
12170
12780
  let { node, offset } = this.domFromPos(pos, 0);
12171
- if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
12781
+ if (!isElt(node) || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
12172
12782
  return node.childNodes[offset];
12173
12783
  }
12174
12784
  setSelection(anchor, head, view, force = false) {
@@ -12185,7 +12795,7 @@ var ViewDesc = class {
12185
12795
  let brKludge = false;
12186
12796
  if ((gecko || safari) && anchor == head) {
12187
12797
  let { node, offset } = anchorDOM;
12188
- if (node.nodeType == 3) {
12798
+ if (isText(node)) {
12189
12799
  brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
12190
12800
  if (brKludge && offset == node.nodeValue.length) for (let scan = node, after; scan; scan = scan.parentNode) {
12191
12801
  if (after = scan.nextSibling) {
@@ -12203,7 +12813,7 @@ var ViewDesc = class {
12203
12813
  brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
12204
12814
  }
12205
12815
  }
12206
- if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
12816
+ if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && isElt(selRange.focusNode)) {
12207
12817
  let after = selRange.focusNode.childNodes[selRange.focusOffset];
12208
12818
  if (after && after.contentEditable == "false") force = true;
12209
12819
  }
@@ -12279,13 +12889,10 @@ var WidgetViewDesc = class extends ViewDesc {
12279
12889
  if (self.parent) return self.parent.posBeforeChild(self);
12280
12890
  });
12281
12891
  if (!widget.type.spec.raw) {
12282
- if (dom.nodeType != 1) {
12283
- let wrap = document.createElement("span");
12284
- wrap.appendChild(dom);
12285
- dom = wrap;
12286
- }
12287
- if (!dom.hasAttribute("contenteditable")) dom.contentEditable = "false";
12288
- dom.classList.add("ProseMirror-widget");
12892
+ let elt = isElt(dom) ? dom : document.createElement("span");
12893
+ if (elt != dom) elt.appendChild(dom);
12894
+ if (!elt.hasAttribute("contenteditable")) elt.contentEditable = "false";
12895
+ elt.classList.add("ProseMirror-widget");
12289
12896
  }
12290
12897
  super(parent, [], dom, null);
12291
12898
  this.widget = widget;
@@ -12408,7 +13015,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
12408
13015
  let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;
12409
13016
  if (node.isText) {
12410
13017
  if (!dom) dom = document.createTextNode(node.text);
12411
- else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
13018
+ else if (!isText(dom)) throw new RangeError("Text must be rendered as a DOM text node");
12412
13019
  } else if (!dom) {
12413
13020
  let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
12414
13021
  ({dom, contentDOM} = spec);
@@ -12441,7 +13048,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
12441
13048
  }
12442
13049
  }
12443
13050
  if (!rule.contentElement) {
12444
- let found = addedNodes && addedNodes.find((n) => n.nodeType == 1 && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
13051
+ let found = addedNodes && addedNodes.find((n) => isElt(n) && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
12445
13052
  if (found) rule.contentElement = found;
12446
13053
  else rule.getContent = () => Fragment.empty;
12447
13054
  }
@@ -12463,18 +13070,21 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
12463
13070
  let localComposition = composition && composition.pos > -1 ? composition : null;
12464
13071
  let compositionInChild = composition && composition.pos < 0;
12465
13072
  let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
13073
+ let addBuffers = this.node.inlineContent, atBufferPos = addBuffers && this.node.isBlock;
12466
13074
  iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
12467
13075
  if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view, i);
12468
13076
  else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark$1.none : this.node.child(i).marks, inline, view, i);
12469
13077
  updater.placeWidget(widget, view, off);
12470
13078
  }, (child, outerDeco, innerDeco, i) => {
12471
13079
  updater.syncToMarks(child.marks, inline, view, i);
13080
+ if (atBufferPos && child.isAtom && !child.isText) updater.addHackNode("IMG", updater.top);
12472
13081
  let compIndex;
12473
13082
  if (updater.findNodeMatch(child, outerDeco, innerDeco, i));
12474
13083
  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));
12475
13084
  else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off));
12476
13085
  else updater.addNode(child, outerDeco, innerDeco, view, off);
12477
13086
  off += child.nodeSize;
13087
+ if (addBuffers) atBufferPos = child.isAtom && !child.isText;
12478
13088
  });
12479
13089
  updater.syncToMarks([], inline, view, 0);
12480
13090
  if (this.node.isTextblock) updater.addTextblockHacks();
@@ -12531,7 +13141,7 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
12531
13141
  }
12532
13142
  updateOuterDeco(outerDeco) {
12533
13143
  if (sameOuterDeco(outerDeco, this.outerDeco)) return;
12534
- let needsWrap = this.nodeDOM.nodeType != 1;
13144
+ let needsWrap = !isElt(this.nodeDOM);
12535
13145
  let oldDOM = this.dom;
12536
13146
  this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
12537
13147
  if (this.dom != oldDOM) {
@@ -12541,13 +13151,13 @@ var NodeViewDesc = class NodeViewDesc extends ViewDesc {
12541
13151
  this.outerDeco = outerDeco;
12542
13152
  }
12543
13153
  selectNode() {
12544
- if (this.nodeDOM.nodeType == 1) {
13154
+ if (isElt(this.nodeDOM)) {
12545
13155
  this.nodeDOM.classList.add("ProseMirror-selectednode");
12546
13156
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
12547
13157
  }
12548
13158
  }
12549
13159
  deselectNode() {
12550
- if (this.nodeDOM.nodeType == 1) {
13160
+ if (isElt(this.nodeDOM)) {
12551
13161
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
12552
13162
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
12553
13163
  }
@@ -12615,7 +13225,7 @@ var TextViewDesc = class TextViewDesc extends NodeViewDesc {
12615
13225
  return this.node.text == text;
12616
13226
  }
12617
13227
  };
12618
- var TrailingHackViewDesc = class extends ViewDesc {
13228
+ var BufferHackViewDesc = class extends ViewDesc {
12619
13229
  parseRule() {
12620
13230
  return { ignore: true };
12621
13231
  }
@@ -12751,7 +13361,7 @@ function patchAttributes(dom, prev, cur) {
12751
13361
  }
12752
13362
  }
12753
13363
  function applyOuterDeco(dom, deco, node) {
12754
- return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
13364
+ return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, !isElt(dom)));
12755
13365
  }
12756
13366
  function sameOuterDeco(a, b) {
12757
13367
  if (a.length != b.length) return false;
@@ -12941,14 +13551,14 @@ var ViewTreeUpdater = class {
12941
13551
  dom.alt = "";
12942
13552
  }
12943
13553
  if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak";
12944
- let hack = new TrailingHackViewDesc(this.top, [], dom, null);
13554
+ let hack = new BufferHackViewDesc(this.top, [], dom, null);
12945
13555
  if (parent != this.top) parent.children.push(hack);
12946
13556
  else parent.children.splice(this.index++, 0, hack);
12947
13557
  this.changed = true;
12948
13558
  }
12949
13559
  }
12950
13560
  isLocked(node) {
12951
- return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
13561
+ return this.lock && (node == this.lock || isElt(node) && node.contains(this.lock.parentNode));
12952
13562
  }
12953
13563
  };
12954
13564
  function preMatch(frag, parentDesc) {
@@ -13092,10 +13702,15 @@ function selectionFromDOM(view, origin = null) {
13092
13702
  if (selectionCollapsed(domSel)) {
13093
13703
  anchor = head;
13094
13704
  while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;
13095
- let nearestDescNode = nearestDesc.node;
13096
- if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13705
+ if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13097
13706
  let pos = nearestDesc.posBefore;
13098
13707
  selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));
13708
+ } 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) {
13709
+ if (getComputedStyle(scan).overflow != "visible") {
13710
+ selection = Selection$1.findFrom(doc.resolve(nearestDesc.posAtStart), 1);
13711
+ break;
13712
+ }
13713
+ if (scan == nearestDesc.dom || scan.nextSibling || !scan.parentNode || !isElt(scan.parentNode)) break;
13099
13714
  }
13100
13715
  } else {
13101
13716
  if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
@@ -13233,7 +13848,7 @@ function hasSelection(view) {
13233
13848
  let sel = view.domSelectionRange();
13234
13849
  if (!sel.anchorNode) return false;
13235
13850
  try {
13236
- 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));
13851
+ return contains(view.dom, sel.anchorNode) && (view.editable || contains(view.dom, sel.focusNode));
13237
13852
  } catch (_) {
13238
13853
  return false;
13239
13854
  }
@@ -13272,8 +13887,7 @@ function selectHorizontally(view, dir, mods) {
13272
13887
  let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
13273
13888
  if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;
13274
13889
  if (NodeSelection.isSelectable(node)) return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
13275
- else if (webkit) return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
13276
- else return false;
13890
+ else return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
13277
13891
  }
13278
13892
  } else if (sel instanceof NodeSelection && sel.node.isInline) return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));
13279
13893
  else {
@@ -13282,12 +13896,9 @@ function selectHorizontally(view, dir, mods) {
13282
13896
  return false;
13283
13897
  }
13284
13898
  }
13285
- function nodeLen(node) {
13286
- return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
13287
- }
13288
13899
  function isIgnorable(dom, dir) {
13289
13900
  let desc = dom.pmViewDesc;
13290
- return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
13901
+ return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR") : isElt(dom) && dom.contentEditable == "false";
13291
13902
  }
13292
13903
  function skipIgnoredNodes(view, dir) {
13293
13904
  return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
@@ -13297,19 +13908,18 @@ function skipIgnoredNodesBefore(view) {
13297
13908
  let node = sel.focusNode, offset = sel.focusOffset;
13298
13909
  if (!node) return;
13299
13910
  let moveNode, moveOffset, force = false;
13300
- if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
13301
- for (;;) if (offset > 0) if (node.nodeType != 1) break;
13302
- else {
13911
+ if (gecko && isElt(node) && offset < nodeSize(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
13912
+ for (;;) if (offset > 0) {
13913
+ if (!isElt(node)) break;
13303
13914
  let before = node.childNodes[offset - 1];
13304
13915
  if (isIgnorable(before, -1)) {
13305
13916
  moveNode = node;
13306
13917
  moveOffset = --offset;
13307
- } else if (before.nodeType == 3) {
13918
+ } else if (isText(before)) {
13308
13919
  node = before;
13309
13920
  offset = node.nodeValue.length;
13310
13921
  } else break;
13311
- }
13312
- else if (isBlockNode(node)) break;
13922
+ } else if (isBlockNode(node)) break;
13313
13923
  else {
13314
13924
  let prev = node.previousSibling;
13315
13925
  while (prev && isIgnorable(prev, -1)) {
@@ -13323,7 +13933,7 @@ function skipIgnoredNodesBefore(view) {
13323
13933
  offset = 0;
13324
13934
  } else {
13325
13935
  node = prev;
13326
- offset = nodeLen(node);
13936
+ offset = nodeSize(node);
13327
13937
  }
13328
13938
  }
13329
13939
  if (force) setSelFocus(view, node, offset);
@@ -13333,10 +13943,10 @@ function skipIgnoredNodesAfter(view) {
13333
13943
  let sel = view.domSelectionRange();
13334
13944
  let node = sel.focusNode, offset = sel.focusOffset;
13335
13945
  if (!node) return;
13336
- let len = nodeLen(node);
13946
+ let len = nodeSize(node);
13337
13947
  let moveNode, moveOffset;
13338
13948
  for (;;) if (offset < len) {
13339
- if (node.nodeType != 1) break;
13949
+ if (!isElt(node)) break;
13340
13950
  let after = node.childNodes[offset];
13341
13951
  if (isIgnorable(after, 1)) {
13342
13952
  moveNode = node;
@@ -13357,7 +13967,7 @@ function skipIgnoredNodesAfter(view) {
13357
13967
  } else {
13358
13968
  node = next;
13359
13969
  offset = 0;
13360
- len = nodeLen(node);
13970
+ len = nodeSize(node);
13361
13971
  }
13362
13972
  }
13363
13973
  if (moveNode) setSelFocus(view, moveNode, moveOffset);
@@ -13373,8 +13983,8 @@ function textNodeAfter(node, offset) {
13373
13983
  }
13374
13984
  while (node && offset < node.childNodes.length) {
13375
13985
  let next = node.childNodes[offset];
13376
- if (next.nodeType == 3) return next;
13377
- if (next.nodeType == 1 && next.contentEditable == "false") break;
13986
+ if (isText(next)) return next;
13987
+ if (isElt(next) && next.contentEditable == "false") break;
13378
13988
  node = next;
13379
13989
  offset = 0;
13380
13990
  }
@@ -13386,14 +13996,14 @@ function textNodeBefore(node, offset) {
13386
13996
  }
13387
13997
  while (node && offset) {
13388
13998
  let next = node.childNodes[offset - 1];
13389
- if (next.nodeType == 3) return next;
13390
- if (next.nodeType == 1 && next.contentEditable == "false") break;
13999
+ if (isText(next)) return next;
14000
+ if (isElt(next) && next.contentEditable == "false") break;
13391
14001
  node = next;
13392
14002
  offset = node.childNodes.length;
13393
14003
  }
13394
14004
  }
13395
14005
  function setSelFocus(view, node, offset) {
13396
- if (node.nodeType != 3) {
14006
+ if (!isText(node)) {
13397
14007
  let before, after;
13398
14008
  if (after = textNodeAfter(node, offset)) {
13399
14009
  node = after;
@@ -13475,7 +14085,7 @@ function switchEditable(view, node, state) {
13475
14085
  function safariDownArrowBug(view) {
13476
14086
  if (!safari || view.state.selection.$head.parentOffset > 0) return false;
13477
14087
  let { focusNode, focusOffset } = view.domSelectionRange();
13478
- if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
14088
+ if (focusNode && isElt(focusNode) && focusOffset == 0 && focusNode.firstChild && isElt(focusNode.firstChild) && focusNode.firstChild.contentEditable == "false") {
13479
14089
  let child = focusNode.firstChild;
13480
14090
  switchEditable(view, child, "true");
13481
14091
  setTimeout(() => switchEditable(view, child, "false"), 20);
@@ -13522,7 +14132,7 @@ function serializeForClipboard(view, slice) {
13522
14132
  let doc = detachedDoc(), wrap = doc.createElement("div");
13523
14133
  wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
13524
14134
  let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
13525
- while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
14135
+ while (firstChild && isElt(firstChild) && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
13526
14136
  for (let i = needsWrap.length - 1; i >= 0; i--) {
13527
14137
  let wrapper = doc.createElement(needsWrap[i]);
13528
14138
  while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
@@ -13531,7 +14141,7 @@ function serializeForClipboard(view, slice) {
13531
14141
  }
13532
14142
  firstChild = wrap.firstChild;
13533
14143
  }
13534
- if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
14144
+ if (firstChild && isElt(firstChild)) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
13535
14145
  return {
13536
14146
  dom: wrap,
13537
14147
  text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
@@ -13576,7 +14186,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
13576
14186
  let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
13577
14187
  if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {
13578
14188
  let child = dom.firstChild;
13579
- while (child && child.nodeType != 1) child = child.nextSibling;
14189
+ while (child && !isElt(child)) child = child.nextSibling;
13580
14190
  if (!child) break;
13581
14191
  dom = child;
13582
14192
  }
@@ -13729,11 +14339,10 @@ function addContext(slice, context) {
13729
14339
  let type = schema.nodes[array[i]];
13730
14340
  if (!type || type.hasRequiredAttrs()) break;
13731
14341
  try {
13732
- type.checkAttrs(array[i + 1]);
14342
+ content = Fragment.from(type.create(array[i + 1], content));
13733
14343
  } catch (e) {
13734
14344
  break;
13735
14345
  }
13736
- content = Fragment.from(type.create(array[i + 1], content));
13737
14346
  openStart++;
13738
14347
  openEnd++;
13739
14348
  }
@@ -13877,14 +14486,14 @@ function updateSelection(view, selection, origin) {
13877
14486
  if (!view.focused) view.focus();
13878
14487
  if (view.state.selection.eq(selection)) return;
13879
14488
  let tr = view.state.tr.setSelection(selection);
13880
- if (origin == "pointer") tr.setMeta("pointer", true);
14489
+ tr.setMeta("pointer", true);
13881
14490
  view.dispatch(tr);
13882
14491
  }
13883
14492
  function selectClickedLeaf(view, inside) {
13884
14493
  if (inside == -1) return false;
13885
14494
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
13886
14495
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
13887
- updateSelection(view, new NodeSelection($pos), "pointer");
14496
+ updateSelection(view, new NodeSelection($pos));
13888
14497
  return true;
13889
14498
  }
13890
14499
  return false;
@@ -13903,7 +14512,7 @@ function selectClickedNode(view, inside) {
13903
14512
  }
13904
14513
  }
13905
14514
  if (selectAt != null) {
13906
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
14515
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
13907
14516
  return true;
13908
14517
  } else return false;
13909
14518
  }
@@ -13920,7 +14529,7 @@ function defaultTripleClick(view, inside, event) {
13920
14529
  if (event.button != 0) return false;
13921
14530
  let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;
13922
14531
  if (!selection) return false;
13923
- updateSelection(view, selection, "pointer");
14532
+ updateSelection(view, selection);
13924
14533
  if (selection instanceof TextSelection && doc.eq(view.state.doc)) view.input.mouseDown = new TripleClickDrag(view, selection);
13925
14534
  return true;
13926
14535
  }
@@ -14006,7 +14615,7 @@ var LeftMouseDown = class extends MouseDown {
14006
14615
  }
14007
14616
  const target = flushed ? null : event.target;
14008
14617
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
14009
- this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
14618
+ this.target = targetDesc && isElt(targetDesc.nodeDOM) ? targetDesc.nodeDOM : null;
14010
14619
  let { selection } = view.state;
14011
14620
  if (event.button == 0 && (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)) this.mightDrag = {
14012
14621
  node: targetNode,
@@ -14045,7 +14654,7 @@ var LeftMouseDown = class extends MouseDown {
14045
14654
  if (this.allowDefault || !pos) setSelectionOrigin(this.view, "pointer");
14046
14655
  else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) event.preventDefault();
14047
14656
  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)) {
14048
- updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)), "pointer");
14657
+ updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
14049
14658
  event.preventDefault();
14050
14659
  } else setSelectionOrigin(this.view, "pointer");
14051
14660
  }
@@ -14081,7 +14690,7 @@ var TripleClickDrag = class extends MouseDown {
14081
14690
  if (!target) return;
14082
14691
  let { doc } = this.view.state, start = this.startSelection;
14083
14692
  let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];
14084
- updateSelection(this.view, TextSelection.create(doc, anchor, head), "pointer");
14693
+ updateSelection(this.view, TextSelection.create(doc, anchor, head));
14085
14694
  }
14086
14695
  };
14087
14696
  handlers.touchstart = (view) => {
@@ -14107,7 +14716,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14107
14716
  if (!view.composing) {
14108
14717
  view.domObserver.flush();
14109
14718
  let { state } = view, $pos = state.selection.$to;
14110
- 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))) {
14719
+ 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))) {
14111
14720
  view.markCursor = view.state.storedMarks || $pos.marks();
14112
14721
  endComposition(view, true);
14113
14722
  view.markCursor = null;
@@ -14115,10 +14724,10 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14115
14724
  endComposition(view, !state.selection.empty);
14116
14725
  if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
14117
14726
  let sel = view.domSelectionRange();
14118
- for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
14727
+ for (let node = sel.focusNode, offset = sel.focusOffset; node && isElt(node) && offset != 0;) {
14119
14728
  let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
14120
14729
  if (!before) break;
14121
- if (before.nodeType == 3) {
14730
+ if (isText(before)) {
14122
14731
  let sel = view.domSelection();
14123
14732
  if (sel) sel.collapse(before, before.nodeValue.length);
14124
14733
  break;
@@ -14135,9 +14744,9 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
14135
14744
  };
14136
14745
  function selectionBeforeUneditable(view) {
14137
14746
  let { focusNode, focusOffset } = view.domSelectionRange();
14138
- if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length) return false;
14747
+ if (!focusNode || !isElt(focusNode) || focusOffset >= focusNode.childNodes.length) return false;
14139
14748
  let next = focusNode.childNodes[focusOffset];
14140
- return next.nodeType == 1 && next.contentEditable == "false";
14749
+ return isElt(next) && next.contentEditable == "false";
14141
14750
  }
14142
14751
  editHandlers.compositionend = (view, event) => {
14143
14752
  if (view.composing) {
@@ -14290,7 +14899,7 @@ handlers.dragstart = (view, _event) => {
14290
14899
  let node;
14291
14900
  if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to));
14292
14901
  else if (mouseDown && mouseDown.mightDrag) node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);
14293
- else if (event.target && event.target.nodeType == 1) {
14902
+ else if (event.target && isElt(event.target)) {
14294
14903
  let desc = view.docView.nearestDesc(event.target, true);
14295
14904
  if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);
14296
14905
  }
@@ -15063,7 +15672,7 @@ var DOMObserver = class {
15063
15672
  let desc = container && this.view.docView.nearestDesc(container);
15064
15673
  if (desc && desc.ignoreMutation({
15065
15674
  type: "selection",
15066
- target: container.nodeType == 3 ? container.parentNode : container
15675
+ target: isText(container) ? container.parentNode : container
15067
15676
  })) {
15068
15677
  this.setCurSelection();
15069
15678
  return true;
@@ -15092,7 +15701,7 @@ var DOMObserver = class {
15092
15701
  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))) {
15093
15702
  for (let node of added) if (node.nodeName == "BR" && node.parentNode) {
15094
15703
  let after = node.nextSibling;
15095
- while (after && after.nodeType == 1) {
15704
+ while (after && isElt(after)) {
15096
15705
  if (after.contentEditable == "false") {
15097
15706
  node.parentNode.removeChild(node);
15098
15707
  break;
@@ -15144,7 +15753,7 @@ var DOMObserver = class {
15144
15753
  for (let i = 0; i < mut.addedNodes.length; i++) {
15145
15754
  let node = mut.addedNodes[i];
15146
15755
  added.push(node);
15147
- if (node.nodeType == 3) this.lastChangedTextNode = node;
15756
+ if (isText(node)) this.lastChangedTextNode = node;
15148
15757
  }
15149
15758
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {
15150
15759
  from: desc.posBefore,
@@ -15243,7 +15852,7 @@ function fixUpBadSafariComposition(view, addedNodes) {
15243
15852
  let parent = nextCell;
15244
15853
  for (;;) {
15245
15854
  let first = parent.firstChild;
15246
- if (!first || first.nodeType != 1 || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
15855
+ if (!first || !isElt(first) || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
15247
15856
  parent = first;
15248
15857
  }
15249
15858
  parent.insertBefore(node, parent.firstChild);
@@ -15256,7 +15865,7 @@ function parseBetween(view, from_, to_, addedNodes) {
15256
15865
  let domSel = view.domSelectionRange();
15257
15866
  let find;
15258
15867
  let anchor = domSel.anchorNode;
15259
- if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
15868
+ if (anchor && contains(view.dom, anchor)) {
15260
15869
  find = [{
15261
15870
  node: anchor,
15262
15871
  offset: domSel.anchorOffset
@@ -15350,7 +15959,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
15350
15959
  view.input.lastKeyCode = null;
15351
15960
  let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
15352
15961
  if (change) view.input.domChangeCount++;
15353
- 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")))) {
15962
+ 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")))) {
15354
15963
  view.input.lastIOSEnter = 0;
15355
15964
  return;
15356
15965
  }
@@ -15386,7 +15995,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
15386
15995
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
15387
15996
  let $fromA = doc.resolve(change.start);
15388
15997
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
15389
- 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")))) {
15998
+ 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")))) {
15390
15999
  view.input.lastIOSEnter = 0;
15391
16000
  return;
15392
16001
  }
@@ -15473,6 +16082,14 @@ function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
15473
16082
  if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;
15474
16083
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
15475
16084
  }
16085
+ function looksLikeEnter(content, from, to) {
16086
+ let newTextlines = 0, newLeaves = 0;
16087
+ content.nodesBetween(from, to, (node, pos) => {
16088
+ if (node.isTextblock && pos >= from && pos < to) newTextlines++;
16089
+ else if (node.isText ? /\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf) newLeaves++;
16090
+ });
16091
+ return newLeaves == 0 && newTextlines == 1;
16092
+ }
15476
16093
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
15477
16094
  let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
15478
16095
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
@@ -15697,11 +16314,11 @@ var EditorView = class {
15697
16314
  */
15698
16315
  scrollToSelection() {
15699
16316
  let startDOM = this.domSelectionRange().focusNode;
15700
- if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode));
16317
+ if (!startDOM || !contains(this.dom, startDOM));
15701
16318
  else if (this.someProp("handleScrollToSelection", (f) => f(this)));
15702
16319
  else if (this.state.selection instanceof NodeSelection) {
15703
16320
  let target = this.docView.domAfterPos(this.state.selection.from);
15704
- if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
16321
+ if (isElt(target)) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
15705
16322
  } else scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
15706
16323
  }
15707
16324
  destroyPluginViews() {
@@ -15930,7 +16547,7 @@ var EditorView = class {
15930
16547
  @internal
15931
16548
  */
15932
16549
  domSelectionRange() {
15933
- let sel = this.domSelection();
16550
+ let sel = this.dom.isConnected !== false && this.domSelection();
15934
16551
  if (!sel) return {
15935
16552
  focusNode: null,
15936
16553
  focusOffset: 0,
@@ -26508,7 +27125,7 @@ var Underline = Mark.create({
26508
27125
  }
26509
27126
  });
26510
27127
  //#endregion
26511
- //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
27128
+ //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.4/node_modules/prosemirror-dropcursor/dist/index.js
26512
27129
  /**
26513
27130
  Create a plugin that, when added to a ProseMirror instance,
26514
27131
  causes a decoration to show up at the drop position when something
@@ -26531,6 +27148,7 @@ var DropCursorView = class {
26531
27148
  this.cursorPos = null;
26532
27149
  this.element = null;
26533
27150
  this.timeout = -1;
27151
+ this.lastDragEvent = null;
26534
27152
  this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
26535
27153
  this.color = options.color === false ? void 0 : options.color || "black";
26536
27154
  this.class = options.class;
@@ -26551,11 +27169,15 @@ var DropCursorView = class {
26551
27169
  });
26552
27170
  }
26553
27171
  destroy() {
27172
+ this.setCursor(null);
26554
27173
  this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));
26555
27174
  }
26556
27175
  update(editorView, prevState) {
26557
- if (this.cursorPos != null && prevState.doc != editorView.state.doc) if (this.cursorPos > editorView.state.doc.content.size) this.setCursor(null);
26558
- else this.updateOverlay();
27176
+ if (this.cursorPos != null && prevState.doc != editorView.state.doc) if (this.lastDragEvent) {
27177
+ let target = this.computeTarget(this.lastDragEvent);
27178
+ if (target == this.cursorPos) this.updateOverlay();
27179
+ else this.setCursor(target);
27180
+ } else this.updateOverlay();
26559
27181
  }
26560
27182
  setCursor(pos) {
26561
27183
  if (pos == this.cursorPos) return;
@@ -26626,8 +27248,7 @@ var DropCursorView = class {
26626
27248
  clearTimeout(this.timeout);
26627
27249
  this.timeout = setTimeout(() => this.setCursor(null), timeout);
26628
27250
  }
26629
- dragover(event) {
26630
- if (!this.editorView.editable) return;
27251
+ computeTarget(event) {
26631
27252
  let pos = this.editorView.posAtCoords({
26632
27253
  left: event.clientX,
26633
27254
  top: event.clientY
@@ -26635,12 +27256,19 @@ var DropCursorView = class {
26635
27256
  let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
26636
27257
  let disableDropCursor = node && node.type.spec.disableDropCursor;
26637
27258
  let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
26638
- if (pos && !disabled) {
26639
- let target = pos.pos;
26640
- if (this.editorView.dragging && this.editorView.dragging.slice) {
26641
- let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
26642
- if (point != null) target = point;
26643
- }
27259
+ if (!pos || disabled) return null;
27260
+ let target = pos.pos;
27261
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
27262
+ let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
27263
+ if (point != null) target = point;
27264
+ }
27265
+ return target;
27266
+ }
27267
+ dragover(event) {
27268
+ if (!this.editorView.editable) return;
27269
+ this.lastDragEvent = event;
27270
+ let target = this.computeTarget(event);
27271
+ if (target != null) {
26644
27272
  this.setCursor(target);
26645
27273
  this.scheduleRemoval(5e3);
26646
27274
  }
@@ -31236,8 +31864,8 @@ Extension.create({
31236
31864
  //#endregion
31237
31865
  //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index2.js
31238
31866
  var root$1 = /* @__PURE__ */ from_html(`<button type="button" class="pie-toolbar-btn" title="Insert Table"></button>`);
31239
- var root_1 = /* @__PURE__ */ from_html(`<button type="button" title="Add Row"></button> <button type="button" title="Delete Row"></button> <button type="button" title="Add Column"></button> <button type="button" title="Delete Column"></button> <button type="button" title="Delete Table"></button> <button type="button" title="Toggle Table Border"></button>`, 1);
31240
- var root_2 = /* @__PURE__ */ from_html(`<div class="align-menu"><button type="button" class="align-menu-btn" title="Align Left"></button> <button type="button" class="align-menu-btn" title="Align Center"></button> <button type="button" class="align-menu-btn" title="Align Right"></button></div>`);
31867
+ var root_1$1 = /* @__PURE__ */ from_html(`<button type="button" title="Add Row"></button> <button type="button" title="Delete Row"></button> <button type="button" title="Add Column"></button> <button type="button" title="Delete Column"></button> <button type="button" title="Delete Table"></button> <button type="button" title="Toggle Table Border"></button>`, 1);
31868
+ var root_2$1 = /* @__PURE__ */ from_html(`<div class="align-menu"><button type="button" class="align-menu-btn" title="Align Left"></button> <button type="button" class="align-menu-btn" title="Align Center"></button> <button type="button" class="align-menu-btn" title="Align Right"></button></div>`);
31241
31869
  var root_3 = /* @__PURE__ */ from_html(`<button type="button" title="Bold"></button> <button type="button" title="Italic"></button> <button type="button" title="Strikethrough"></button> <button type="button" title="Code"></button> <button type="button" title="Underline"></button> <button type="button" title="Subscript"></button> <button type="button" title="Superscript"></button> <button type="button" title="Heading"></button> <button type="button" class="pie-toolbar-btn" title="Insert Image"></button> <div class="align-dropdown"><button type="button" class="pie-toolbar-btn" title="Text Alignment"><!> <span class="dropdown-arrow">▼</span></button> <!></div> <button type="button" title="Bullet List"></button> <button type="button" title="Numbered List"></button> <button type="button" class="pie-toolbar-btn" title="Undo"></button> <button type="button" class="pie-toolbar-btn" title="Redo"></button>`, 1);
31242
31870
  var root_4 = /* @__PURE__ */ from_html(`<div role="toolbar" tabindex="-1"><div class="toolbar-content"><div class="toolbar-buttons"><!> <!> <!></div> <button type="button" class="done-btn" title="Done"></button></div></div>`);
31243
31871
  var root_5 = /* @__PURE__ */ from_html(`<div class="pie-editable-html editor-container editable-html svelte-rx7so6"><div><div class="editor-children"><div class="editor"></div></div></div> <!></div>`);
@@ -31257,6 +31885,7 @@ function EditableHtml$1($$anchor, $$props) {
31257
31885
  return {
31258
31886
  role: "textbox",
31259
31887
  "aria-multiline": "true",
31888
+ class: "mathjax_ignore",
31260
31889
  ...$$props.ariaLabel ? { "aria-label": $$props.ariaLabel } : {}
31261
31890
  };
31262
31891
  }
@@ -31501,7 +32130,7 @@ function EditableHtml$1($$anchor, $$props) {
31501
32130
  });
31502
32131
  var node_2 = sibling(node_1, 2);
31503
32132
  var consequent_1 = ($$anchor) => {
31504
- var fragment = root_1();
32133
+ var fragment = root_1$1();
31505
32134
  var button_1 = first_child(fragment);
31506
32135
  let classes_2;
31507
32136
  html(button_1, () => "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z\"/></svg>", true);
@@ -31616,7 +32245,7 @@ function EditableHtml$1($$anchor, $$props) {
31616
32245
  reset$1(button_16);
31617
32246
  var node_8 = sibling(button_16, 2);
31618
32247
  var consequent_4 = ($$anchor) => {
31619
- var div_8 = root_2();
32248
+ var div_8 = root_2$1();
31620
32249
  var button_17 = child(div_8);
31621
32250
  html(button_17, () => "<svg width=\"20\" height=\"20\" viewBox=\"0 0 66 66\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z\"/></svg>", true);
31622
32251
  reset$1(button_17);
@@ -31721,35 +32350,63 @@ delegate([
31721
32350
  //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index.js
31722
32351
  var EditableHtml = EditableHtml$1;
31723
32352
  //#endregion
32353
+ //#region src/controller/defaults.ts
32354
+ var defaults_default = {
32355
+ model: {
32356
+ prompt: "<p>Enter your answer:</p>",
32357
+ promptEnabled: true,
32358
+ correctAnswer: "",
32359
+ teacherInstructionsEnabled: true
32360
+ },
32361
+ configuration: {
32362
+ prompt: {
32363
+ label: "Prompt",
32364
+ settings: true
32365
+ },
32366
+ teacherInstructions: {
32367
+ label: "Teacher Instructions",
32368
+ settings: true
32369
+ },
32370
+ settingsPanelDisabled: false
32371
+ }
32372
+ };
32373
+ //#endregion
32374
+ //#region src/controller/index.ts
32375
+ var createDefaultModel = (model = {}) => ({
32376
+ ...defaults_default.model,
32377
+ ...model
32378
+ });
32379
+ //#endregion
31724
32380
  //#region src/author/Author.svelte
31725
- var root = /* @__PURE__ */ from_html(`<div class="simple-cloze-author svelte-13ppn6m"><div class="input-container svelte-13ppn6m"><span class="input-label svelte-13ppn6m">Prompt</span> <!></div> <div class="mb-6"><label class="block text-sm text-gray-600 mb-2">Correct Answer</label> <input type="text" class="input input-bordered w-full" placeholder="Enter the correct answer"/></div></div>`);
32381
+ var root = /* @__PURE__ */ from_html(`<div class="input-container svelte-13ppn6m"><span class="input-label svelte-13ppn6m"> </span> <!></div>`);
32382
+ var root_1 = /* @__PURE__ */ from_html(`<div class="design-fields svelte-13ppn6m"><!> <!> <div class="answer-container svelte-13ppn6m"><label class="answer-label svelte-13ppn6m">Correct Answer</label> <input type="text" class="answer-input svelte-13ppn6m" placeholder="Enter the correct answer"/></div></div>`);
32383
+ var root_2 = /* @__PURE__ */ from_html(`<div class="simple-cloze-author svelte-13ppn6m"><!></div>`);
31726
32384
  var $$css = {
31727
32385
  hash: "svelte-13ppn6m",
31728
- code: ".simple-cloze-author.svelte-13ppn6m {max-width:56rem;margin:0 auto;padding:24px;}.input-container.svelte-13ppn6m {position:relative;padding-top:16px;margin-bottom:24px;width:100%;}.input-label.svelte-13ppn6m {position:absolute;top:0;left:0;transform-origin:top left;transform:scale(0.75) translate(0, -0.75em);color:var(--pie-text, rgba(0, 0, 0, 0.6));pointer-events:none;}.simple-cloze-author .editor-container {border-color:var(--pie-border-light, #ccc);border-radius:4px;}.simple-cloze-author .editor-holder {min-height:140px;}"
32386
+ code: ".simple-cloze-author.svelte-13ppn6m {padding:24px;}.design-fields.svelte-13ppn6m {max-width:56rem;}.input-container.svelte-13ppn6m {position:relative;padding-top:16px;margin-bottom:24px;width:100%;}.input-label.svelte-13ppn6m {position:absolute;top:0;left:0;transform-origin:top left;transform:scale(0.75) translate(0, -0.75em);color:var(--pie-text, rgba(0, 0, 0, 0.6));pointer-events:none;}.answer-container.svelte-13ppn6m {margin-bottom:24px;}.answer-label.svelte-13ppn6m {display:block;margin-bottom:8px;font-size:0.875rem;color:var(--pie-text, rgba(0, 0, 0, 0.6));}.answer-input.svelte-13ppn6m {box-sizing:border-box;width:100%;height:2.5rem;padding:0 12px;border:1px solid var(--pie-border-light, #ccc);border-radius:4px;font:inherit;}.simple-cloze-author .editor-container {border-color:var(--pie-border-light, #ccc);border-radius:4px;}.simple-cloze-author .editor-holder {min-height:140px;}"
31729
32387
  };
31730
32388
  function Author($$anchor, $$props) {
31731
32389
  push($$props, true);
31732
32390
  append_styles($$anchor, $$css);
31733
- let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7), onModelChange = prop($$props, "onModelChange", 7);
32391
+ let model = prop($$props, "model", 7), configuration = prop($$props, "configuration", 7);
31734
32392
  const answerInputId = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`;
32393
+ /** The model with the controller's defaults filled in, which delivery renders too. */
32394
+ const m = /* @__PURE__ */ user_derived(() => createDefaultModel(model() || void 0));
32395
+ const config = /* @__PURE__ */ user_derived(() => o(defaults_default.configuration, configuration()));
31735
32396
  /**
31736
- * The wrapper owns the model and announces the edit; `onChange` serves a
31737
- * component mounted without one. The update spreads the whole model, so fields
31738
- * this form does not edit survive.
32397
+ * Keeps the edit as the element's model, so the next edit builds on it,
32398
+ * assigning it through the host: a remount after a detach starts from the
32399
+ * host's property. Announces it as a bubbling `model.updated` for the player
32400
+ * listening at its root. The update spreads the whole model, so fields this
32401
+ * form does not edit survive.
31739
32402
  */
31740
32403
  function emitModelUpdate(patch) {
31741
32404
  const nextModel = {
31742
- ...model() || {},
32405
+ ...get(m),
31743
32406
  ...patch
31744
32407
  };
31745
- if (onModelChange()) onModelChange()(nextModel);
31746
- else {
31747
- model(nextModel);
31748
- onChange()?.(nextModel);
31749
- }
31750
- }
31751
- function handlePromptChange(html) {
31752
- emitModelUpdate({ prompt: html });
32408
+ $$props.$$host.model = nextModel;
32409
+ $$props.$$host.dispatchEvent(new e(nextModel));
31753
32410
  }
31754
32411
  function handleAnswerChange(e) {
31755
32412
  emitModelUpdate({ correctAnswer: e.target.value });
@@ -31762,93 +32419,131 @@ function Author($$anchor, $$props) {
31762
32419
  model($$value);
31763
32420
  flushSync();
31764
32421
  },
31765
- get onChange() {
31766
- return onChange();
32422
+ get configuration() {
32423
+ return configuration();
31767
32424
  },
31768
- set onChange($$value) {
31769
- onChange($$value);
31770
- flushSync();
31771
- },
31772
- get onModelChange() {
31773
- return onModelChange();
31774
- },
31775
- set onModelChange($$value) {
31776
- onModelChange($$value);
32425
+ set configuration($$value) {
32426
+ configuration($$value);
31777
32427
  flushSync();
31778
32428
  }
31779
32429
  };
31780
- var div = root();
31781
- var div_1 = child(div);
31782
- var node = sibling(child(div_1), 2);
32430
+ var div = root_2();
32431
+ var node = child(div);
31783
32432
  {
31784
- let $0 = /* @__PURE__ */ user_derived(() => model()?.prompt || "");
31785
- EditableHtml(node, {
31786
- get markup() {
32433
+ const settings = ($$anchor) => {
32434
+ {
32435
+ let $0 = /* @__PURE__ */ user_derived(() => ({
32436
+ Settings: { promptEnabled: get(config).prompt?.settings && c(get(config).prompt.label) },
32437
+ Properties: { teacherInstructionsEnabled: get(config).teacherInstructions?.settings && c(get(config).teacherInstructions.label) }
32438
+ }));
32439
+ b($$anchor, {
32440
+ get model() {
32441
+ return get(m);
32442
+ },
32443
+ get configuration() {
32444
+ return get(config);
32445
+ },
32446
+ get groups() {
32447
+ return get($0);
32448
+ },
32449
+ onChangeModel: (next) => emitModelUpdate(next)
32450
+ });
32451
+ }
32452
+ };
32453
+ let $0 = /* @__PURE__ */ user_derived(() => get(config).settingsPanelDisabled === true || !s(get(config)));
32454
+ y(node, {
32455
+ get hideSettings() {
31787
32456
  return get($0);
31788
32457
  },
31789
- onChange: handlePromptChange,
31790
- placeholder: "Enter your question here...",
31791
- ariaLabel: "Prompt"
32458
+ settings,
32459
+ children: ($$anchor, $$slotProps) => {
32460
+ var div_1 = root_1();
32461
+ var node_1 = child(div_1);
32462
+ var consequent = ($$anchor) => {
32463
+ var div_2 = root();
32464
+ var span = child(div_2);
32465
+ var text = only_child(span, true);
32466
+ var node_2 = sibling(span, 2);
32467
+ {
32468
+ let $0 = /* @__PURE__ */ user_derived(() => get(m).teacherInstructions || "");
32469
+ let $1 = /* @__PURE__ */ user_derived(() => get(config).teacherInstructions?.label);
32470
+ EditableHtml(node_2, {
32471
+ get markup() {
32472
+ return get($0);
32473
+ },
32474
+ onChange: (html) => emitModelUpdate({ teacherInstructions: html }),
32475
+ get ariaLabel() {
32476
+ return get($1);
32477
+ }
32478
+ });
32479
+ }
32480
+ reset$1(div_2);
32481
+ template_effect(() => set_text(text, get(config).teacherInstructions?.label));
32482
+ append($$anchor, div_2);
32483
+ };
32484
+ if_block(node_1, ($$render) => {
32485
+ if (get(m).teacherInstructionsEnabled) $$render(consequent);
32486
+ });
32487
+ var node_3 = sibling(node_1, 2);
32488
+ var consequent_1 = ($$anchor) => {
32489
+ var div_3 = root();
32490
+ var span_1 = child(div_3);
32491
+ var text_1 = only_child(span_1, true);
32492
+ var node_4 = sibling(span_1, 2);
32493
+ {
32494
+ let $0 = /* @__PURE__ */ user_derived(() => get(m).prompt || "");
32495
+ let $1 = /* @__PURE__ */ user_derived(() => get(config).prompt?.label);
32496
+ EditableHtml(node_4, {
32497
+ get markup() {
32498
+ return get($0);
32499
+ },
32500
+ onChange: (html) => emitModelUpdate({ prompt: html }),
32501
+ placeholder: "Enter your question here...",
32502
+ get ariaLabel() {
32503
+ return get($1);
32504
+ }
32505
+ });
32506
+ }
32507
+ reset$1(div_3);
32508
+ template_effect(() => set_text(text_1, get(config).prompt?.label));
32509
+ append($$anchor, div_3);
32510
+ };
32511
+ if_block(node_3, ($$render) => {
32512
+ if (get(m).promptEnabled) $$render(consequent_1);
32513
+ });
32514
+ var div_4 = sibling(node_3, 2);
32515
+ var label = child(div_4);
32516
+ var input = sibling(label, 2);
32517
+ remove_input_defaults(input);
32518
+ reset$1(div_4);
32519
+ reset$1(div_1);
32520
+ template_effect(() => {
32521
+ set_attribute(label, "for", answerInputId);
32522
+ set_attribute(input, "id", answerInputId);
32523
+ set_value(input, get(m).correctAnswer || "");
32524
+ });
32525
+ delegated("input", input, handleAnswerChange);
32526
+ append($$anchor, div_1);
32527
+ },
32528
+ $$slots: {
32529
+ settings: true,
32530
+ default: true
32531
+ }
31792
32532
  });
31793
32533
  }
31794
- reset$1(div_1);
31795
- var div_2 = sibling(div_1, 2);
31796
- var label = child(div_2);
31797
- var input = sibling(label, 2);
31798
- remove_input_defaults(input);
31799
- reset$1(div_2);
31800
32534
  reset$1(div);
31801
- template_effect(() => {
31802
- set_attribute(label, "for", answerInputId);
31803
- set_attribute(input, "id", answerInputId);
31804
- set_value(input, model()?.correctAnswer || "");
31805
- });
31806
- delegated("input", input, handleAnswerChange);
31807
32535
  append($$anchor, div);
31808
32536
  return pop($$exports);
31809
32537
  }
31810
32538
  delegate(["input"]);
31811
32539
  create_custom_element(Author, {
31812
32540
  model: { type: "Object" },
31813
- onModelChange: {},
31814
- onChange: {}
32541
+ configuration: { type: "Object" }
31815
32542
  }, [], []);
31816
32543
  //#endregion
31817
32544
  //#region src/author/index.ts
31818
- var SvelteElementClass = Author.element;
31819
- var SimpleClozeAuthor = class extends SvelteElementClass {
31820
- /**
31821
- * The component reports each edit through its `onModelChange` prop, assigned
31822
- * here through the accessor Svelte generates for it. The host keeps the
31823
- * edited model, renders from it, and announces it as `model.updated`, which
31824
- * bubbles to the listener an authoring player registers at its root.
31825
- */
31826
- constructor() {
31827
- super();
31828
- _defineProperty(this, "_model", null);
31829
- _defineProperty(this, "_onChange", null);
31830
- this.onModelChange = (update) => {
31831
- this._model = update;
31832
- super.model = update;
31833
- this._onChange?.(update);
31834
- this.dispatchEvent(new e(update, false));
31835
- };
31836
- }
31837
- set model(m) {
31838
- this._model = m;
31839
- super.model = m;
31840
- }
31841
- get model() {
31842
- return this._model;
31843
- }
31844
- set onChange(fn) {
31845
- this._onChange = fn;
31846
- }
31847
- get onChange() {
31848
- return this._onChange || (() => {});
31849
- }
31850
- };
32545
+ var author_default = Author.element;
31851
32546
  //#endregion
31852
- export { SimpleClozeAuthor as default };
32547
+ export { author_default as default };
31853
32548
 
31854
32549
  //# sourceMappingURL=index.js.map