@farm.js/react 0.1.0-beta.7 → 0.1.0-beta.9

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.
@@ -25,6 +25,9 @@ function materializeIterable(source) {
25
25
  }
26
26
 
27
27
  // src/compiler-runtime.tsx
28
+ function reversedCompilerKeyedArrayOrder(order) {
29
+ return order === 0 /* Reverse */ ? void 0 : order ?? 0 /* Reverse */;
30
+ }
28
31
  var COMPILER_KEYED_COLLECTION_TOKENS = /* @__PURE__ */ new WeakMap();
29
32
  var COMPILER_KEYED_MAP_UPDATES = /* @__PURE__ */ new WeakMap();
30
33
  var COMPILER_KEYED_ARRAY_APPENDS = /* @__PURE__ */ new WeakMap();
@@ -32,13 +35,17 @@ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
32
35
  var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
33
36
  var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
34
37
  var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
38
+ var COMPILER_KEYED_ARRAY_BATCH_INSERTS = /* @__PURE__ */ new WeakMap();
39
+ var COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS = /* @__PURE__ */ new WeakMap();
35
40
  var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
36
41
  var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
37
42
  var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
38
43
  var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
44
+ var COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS = /* @__PURE__ */ new WeakMap();
39
45
  var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
40
46
  var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
41
47
  var NATIVE_ARRAY_FILTER = Array.prototype.filter;
48
+ var NATIVE_ARRAY_MAP = Array.prototype.map;
42
49
  var NATIVE_ARRAY_SLICE = Array.prototype.slice;
43
50
  var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
44
51
  var NATIVE_ARRAY_WITH = Array.prototype.with;
@@ -64,6 +71,26 @@ function commitCompilerKeyedCollection(value) {
64
71
  COMPILER_KEYED_COMMITTED_COLLECTIONS.add(target);
65
72
  return compilerKeyedCollectionToken(target);
66
73
  }
74
+ function commitCompilerKeyedCollectionWithItemSnapshot(value, instances) {
75
+ const token = commitCompilerKeyedCollection(value);
76
+ if (!token) return void 0;
77
+ if (!instances) {
78
+ COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.delete(token);
79
+ return token;
80
+ }
81
+ const items = [];
82
+ let index = 0;
83
+ for (const instance of instances.values()) {
84
+ if (instance.index !== index) {
85
+ COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.delete(token);
86
+ return token;
87
+ }
88
+ items.push(instance.item);
89
+ index += 1;
90
+ }
91
+ COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.set(token, items);
92
+ return token;
93
+ }
67
94
  function compilerKeyedMapChangedIndices(value, sourceToken) {
68
95
  const target = compilerObject(value);
69
96
  if (!target || !sourceToken) return void 0;
@@ -93,11 +120,52 @@ function compilerKeyedArrayAppendStart(value, sourceToken, expectedStart) {
93
120
  }
94
121
  return length === value.length ? expectedStart : void 0;
95
122
  }
123
+ function compilerKeyedArrayStructuralAppendUpdate(value, sourceToken, expectedStart) {
124
+ const target = compilerObject(value);
125
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
126
+ const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
127
+ if (!update || update.sourceToken !== sourceToken) return void 0;
128
+ const updates = [];
129
+ for (let current = update; current; current = current.previous) {
130
+ if (current.sourceToken !== sourceToken) return void 0;
131
+ updates.push(current);
132
+ }
133
+ updates.reverse();
134
+ const structuralUpdate = update.structuralUpdate;
135
+ const first = updates[0];
136
+ const survivorResult = structuralUpdate ? compilerKeyedArrayFilterSurvivorsFromUpdate(
137
+ structuralUpdate,
138
+ sourceToken,
139
+ expectedStart,
140
+ first.startIndex
141
+ ) : void 0;
142
+ if (structuralUpdate && !survivorResult) return void 0;
143
+ let length = structuralUpdate ? first.startIndex : expectedStart;
144
+ const startIndex = length;
145
+ for (const current of updates) {
146
+ if (current.startIndex !== length || current.resultLength < length) return void 0;
147
+ length = current.resultLength;
148
+ }
149
+ return length === value.length ? {
150
+ startIndex,
151
+ structuralUpdate,
152
+ ...survivorResult ? { structuralSurvivors: survivorResult } : {}
153
+ } : void 0;
154
+ }
96
155
  function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
97
156
  const target = compilerObject(value);
98
157
  if (!target || !sourceToken || !Array.isArray(value)) return void 0;
99
158
  const update = COMPILER_KEYED_ARRAY_FILTERS.get(target);
100
159
  if (!update || update.sourceToken !== sourceToken) return void 0;
160
+ return compilerKeyedArrayFilterSurvivorsFromUpdate(
161
+ update,
162
+ sourceToken,
163
+ expectedLength,
164
+ value.length
165
+ );
166
+ }
167
+ function compilerKeyedArrayFilterSurvivorsFromUpdate(update, sourceToken, expectedLength, resultLength) {
168
+ if (!sourceToken || update.sourceToken !== sourceToken) return void 0;
101
169
  const updates = [];
102
170
  for (let current = update; current; current = current.previous) {
103
171
  if (current.sourceToken !== sourceToken) return void 0;
@@ -127,7 +195,80 @@ function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
127
195
  if (current.resultLength !== current.sourceLength - removed.size) return void 0;
128
196
  survivors = survivors.filter((_sourceIndex, index) => !removed.has(index));
129
197
  }
130
- return survivors.length === value.length ? { indices: survivors, keysStable } : void 0;
198
+ return survivors.length === resultLength ? { indices: survivors, keysStable } : void 0;
199
+ }
200
+ function compilerKeyedArraySliceSurvivorRangeFromUpdate(update, sourceToken, expectedLength, resultLength) {
201
+ if (!sourceToken || update.sourceToken !== sourceToken) return void 0;
202
+ const updates = [];
203
+ for (let current = update; current; current = current.previous) {
204
+ if (current.sourceToken !== sourceToken || current.kind !== "slice") return void 0;
205
+ updates.push(current);
206
+ }
207
+ let length = expectedLength;
208
+ let start = 0;
209
+ for (let index = updates.length - 1; index >= 0; index -= 1) {
210
+ const current = updates[index];
211
+ const retainedStart = current.retainedStart;
212
+ const retainedEnd = current.retainedEnd;
213
+ if (current.sourceLength !== length || retainedStart === void 0 || retainedEnd === void 0 || !Number.isSafeInteger(retainedStart) || !Number.isSafeInteger(retainedEnd) || retainedStart < 0 || retainedEnd < retainedStart || retainedEnd > current.sourceLength || current.resultLength !== retainedEnd - retainedStart) {
214
+ return void 0;
215
+ }
216
+ start += retainedStart;
217
+ length = current.resultLength;
218
+ }
219
+ return length === resultLength ? { end: start + length, start } : void 0;
220
+ }
221
+ function compilerKeyedArrayStructuralAppendMapUpdate(value, sourceToken, expectedStart, requireMappedUpdate = false) {
222
+ const target = compilerObject(value);
223
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
224
+ const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
225
+ if (!update || update.sourceToken !== sourceToken || !update.structuralUpdate || requireMappedUpdate && !update.mappedItemSources) {
226
+ return void 0;
227
+ }
228
+ const updates = [];
229
+ for (let current = update; current; current = current.previous) {
230
+ if (current.sourceToken !== sourceToken) return void 0;
231
+ updates.push(current);
232
+ }
233
+ updates.reverse();
234
+ const first = updates[0];
235
+ const structuralSurvivorRange = compilerKeyedArraySliceSurvivorRangeFromUpdate(
236
+ update.structuralUpdate,
237
+ sourceToken,
238
+ expectedStart,
239
+ first.startIndex
240
+ );
241
+ const structuralSurvivors = structuralSurvivorRange ? void 0 : compilerKeyedArrayFilterSurvivorsFromUpdate(
242
+ update.structuralUpdate,
243
+ sourceToken,
244
+ expectedStart,
245
+ first.startIndex
246
+ )?.indices;
247
+ if (!structuralSurvivorRange && !structuralSurvivors) return void 0;
248
+ let length = first.startIndex;
249
+ const startIndex = length;
250
+ for (const current of updates) {
251
+ if (current.startIndex !== length || current.resultLength < length) return void 0;
252
+ length = current.resultLength;
253
+ }
254
+ return length === value.length ? {
255
+ startIndex,
256
+ ...structuralSurvivorRange ? { structuralSurvivorRange } : {},
257
+ ...structuralSurvivors ? { structuralSurvivors } : {},
258
+ ...update.mappedItemSources ? { mappedItemSources: update.mappedItemSources } : {},
259
+ ...update.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {}
260
+ } : void 0;
261
+ }
262
+ function compilerKeyedArrayFilterSource(update, resultLength) {
263
+ if (update.resultLength !== resultLength) return void 0;
264
+ let current = update;
265
+ while (current.previous) {
266
+ if (current.sourceToken !== current.previous.sourceToken || current.sourceLength !== current.previous.resultLength) {
267
+ return void 0;
268
+ }
269
+ current = current.previous;
270
+ }
271
+ return { sourceLength: current.sourceLength, sourceToken: current.sourceToken };
131
272
  }
132
273
  function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
133
274
  const target = compilerObject(value);
@@ -151,29 +292,148 @@ function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
151
292
  }
152
293
  return length === value.length ? prefixLength : void 0;
153
294
  }
154
- function compilerKeyedArrayRollingWindow(value, sourceToken, expectedLength) {
295
+ function compilerKeyedArrayStructuralPrependUpdate(value, sourceToken, expectedLength) {
155
296
  const target = compilerObject(value);
156
297
  if (!target || !sourceToken || !Array.isArray(value)) return void 0;
157
- const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
158
- if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.retainedStart < 1 || update.retainedEnd !== update.sourceLength || update.resultLength <= update.retainedEnd - update.retainedStart) {
298
+ const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
299
+ if (!update || update.sourceToken !== sourceToken) return void 0;
300
+ const updates = [];
301
+ for (let current = update; current; current = current.previous) {
302
+ if (current.sourceToken !== sourceToken) return void 0;
303
+ updates.push(current);
304
+ }
305
+ updates.reverse();
306
+ const structuralUpdate = update.structuralUpdate;
307
+ const first = updates[0];
308
+ const survivorResult = structuralUpdate ? compilerKeyedArrayFilterSurvivorsFromUpdate(
309
+ structuralUpdate,
310
+ sourceToken,
311
+ expectedLength,
312
+ first.sourceLength
313
+ ) : void 0;
314
+ if (structuralUpdate && !survivorResult) return void 0;
315
+ let length = structuralUpdate ? first.sourceLength : expectedLength;
316
+ let prefixLength = 0;
317
+ for (const current of updates) {
318
+ if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
319
+ return void 0;
320
+ }
321
+ length = current.resultLength;
322
+ prefixLength += current.prefixLength;
323
+ }
324
+ return length === value.length ? {
325
+ prefixLength,
326
+ structuralUpdate,
327
+ ...survivorResult ? { structuralSurvivors: survivorResult } : {}
328
+ } : void 0;
329
+ }
330
+ function compilerKeyedArrayStructuralPrependMapUpdate(value, sourceToken, expectedLength, requireMappedUpdate = false) {
331
+ const target = compilerObject(value);
332
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
333
+ const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
334
+ if (!update || update.sourceToken !== sourceToken || !update.structuralUpdate || requireMappedUpdate && !update.mappedItemSources) {
159
335
  return void 0;
160
336
  }
161
- return update;
337
+ const updates = [];
338
+ for (let current = update; current; current = current.previous) {
339
+ if (current.sourceToken !== sourceToken) return void 0;
340
+ updates.push(current);
341
+ }
342
+ updates.reverse();
343
+ const first = updates[0];
344
+ const structuralSurvivorRange = compilerKeyedArraySliceSurvivorRangeFromUpdate(
345
+ update.structuralUpdate,
346
+ sourceToken,
347
+ expectedLength,
348
+ first.sourceLength
349
+ );
350
+ const structuralSurvivors = structuralSurvivorRange ? void 0 : compilerKeyedArrayFilterSurvivorsFromUpdate(
351
+ update.structuralUpdate,
352
+ sourceToken,
353
+ expectedLength,
354
+ first.sourceLength
355
+ )?.indices;
356
+ if (!structuralSurvivorRange && !structuralSurvivors) return void 0;
357
+ let length = first.sourceLength;
358
+ let prefixLength = 0;
359
+ for (const current of updates) {
360
+ if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
361
+ return void 0;
362
+ }
363
+ length = current.resultLength;
364
+ prefixLength += current.prefixLength;
365
+ }
366
+ return length === value.length ? {
367
+ prefixLength,
368
+ ...structuralSurvivorRange ? { structuralSurvivorRange } : {},
369
+ ...structuralSurvivors ? { structuralSurvivors } : {},
370
+ ...update.mappedItemSources ? { mappedItemSources: update.mappedItemSources } : {},
371
+ ...update.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {}
372
+ } : void 0;
373
+ }
374
+ function compilerKeyedArrayRollingWindows(value, sourceToken, expectedLength) {
375
+ const target = compilerObject(value);
376
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
377
+ const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
378
+ if (!update || update.sourceToken !== sourceToken) return void 0;
379
+ const updates = [];
380
+ for (let current = update; current; current = current.previous) {
381
+ if (current.sourceToken !== sourceToken) return void 0;
382
+ updates.push(current);
383
+ }
384
+ updates.reverse();
385
+ let length = expectedLength;
386
+ for (const current of updates) {
387
+ if (current.sourceLength !== length || current.retainedStart < 1 || current.retainedStart > current.sourceLength || current.retainedEnd !== current.sourceLength || current.resultLength <= current.retainedEnd - current.retainedStart) {
388
+ return void 0;
389
+ }
390
+ length = current.resultLength;
391
+ }
392
+ return length === value.length ? updates : void 0;
162
393
  }
163
394
  function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
164
395
  const target = compilerObject(value);
165
396
  if (!target || !sourceToken || !Array.isArray(value)) return void 0;
166
397
  const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
167
- if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.position >= expectedLength || update.resultLength !== expectedLength - 1) || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
398
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.resultLength >= expectedLength || update.position > update.resultLength) || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
399
+ return void 0;
400
+ }
401
+ return update;
402
+ }
403
+ function compilerKeyedArrayBatchInsert(value, sourceToken, expectedLength) {
404
+ const target = compilerObject(value);
405
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
406
+ const update = COMPILER_KEYED_ARRAY_BATCH_INSERTS.get(target);
407
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.resultLength < expectedLength + 2 || update.position < 0 || update.position > expectedLength) {
168
408
  return void 0;
169
409
  }
170
410
  return update;
171
411
  }
412
+ function compilerKeyedArrayWindowReplacements(value, sourceToken, expectedLength) {
413
+ const target = compilerObject(value);
414
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
415
+ const update = COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(target);
416
+ if (!update || update.sourceToken !== sourceToken) return void 0;
417
+ const updates = [];
418
+ for (let current = update; current; current = current.previous) {
419
+ if (current.sourceToken !== sourceToken) return void 0;
420
+ updates.push(current);
421
+ }
422
+ updates.reverse();
423
+ let length = expectedLength;
424
+ for (const current of updates) {
425
+ if (current.sourceLength !== length || current.position < 0 || current.position >= current.sourceLength || current.removedCount < 1 || current.position + current.removedCount > current.sourceLength || current.insertedCount < 0 || current.resultLength !== current.sourceLength - current.removedCount + current.insertedCount) {
426
+ return void 0;
427
+ }
428
+ length = current.resultLength;
429
+ }
430
+ return length === value.length ? updates : void 0;
431
+ }
172
432
  function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
173
433
  const target = compilerObject(value);
174
434
  if (!target || !sourceToken || !Array.isArray(value)) return void 0;
175
435
  const update = COMPILER_KEYED_ARRAY_REORDERS.get(target);
176
- if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== expectedLength || update.resultLength !== value.length) {
436
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || !update.structuralUpdate && update.resultLength !== expectedLength || update.resultLength !== value.length) {
177
437
  return void 0;
178
438
  }
179
439
  return update;
@@ -190,7 +450,7 @@ function compilerKeyedCollectionChangedKeys(value, sourceToken, kind) {
190
450
  }
191
451
  return changedKeys;
192
452
  }
193
- function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
453
+ function recordCompilerKeyedMapUpdate(previous, value, changedIndices) {
194
454
  const previousTarget = compilerObject(previous);
195
455
  const valueTarget = compilerObject(value);
196
456
  const sourceToken = compilerKeyedCollectionToken(previousTarget);
@@ -204,6 +464,212 @@ function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
204
464
  }
205
465
  return value;
206
466
  }
467
+ function executeCompilerKeyedMapPipeline(previous, pipeline, record) {
468
+ let eligible = true;
469
+ const applyMap = (collection, method, callback) => {
470
+ const value2 = NATIVE_REFLECT_APPLY(
471
+ method,
472
+ collection,
473
+ [callback]
474
+ );
475
+ if (method !== NATIVE_ARRAY_MAP) {
476
+ eligible = false;
477
+ return value2;
478
+ }
479
+ try {
480
+ if (!Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE) {
481
+ eligible = false;
482
+ }
483
+ } catch {
484
+ eligible = false;
485
+ }
486
+ return value2;
487
+ };
488
+ const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
489
+ return eligible ? record(previous, value) : value;
490
+ }
491
+ function recordCompilerKeyedMapPipelineUpdate(previous, value) {
492
+ try {
493
+ if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
494
+ return value;
495
+ }
496
+ const finalChangedIndices = [];
497
+ for (let index = 0; index < previous.length; index += 1) {
498
+ const previousDescriptor = Object.getOwnPropertyDescriptor(previous, index);
499
+ const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
500
+ if (!previousDescriptor || !("value" in previousDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
501
+ return value;
502
+ }
503
+ if (mappedDescriptor.value !== previousDescriptor.value) finalChangedIndices.push(index);
504
+ }
505
+ return recordCompilerKeyedMapUpdate(previous, value, finalChangedIndices);
506
+ } catch {
507
+ return value;
508
+ }
509
+ }
510
+ function createCompilerKeyedMapUpdate(previous, valueOrPipeline, changedIndices) {
511
+ if (Array.isArray(changedIndices)) {
512
+ return recordCompilerKeyedMapUpdate(previous, valueOrPipeline, changedIndices);
513
+ }
514
+ if (changedIndices !== void 0 || typeof valueOrPipeline !== "function") {
515
+ return valueOrPipeline;
516
+ }
517
+ return executeCompilerKeyedMapPipeline(
518
+ previous,
519
+ valueOrPipeline,
520
+ recordCompilerKeyedMapPipelineUpdate
521
+ );
522
+ }
523
+ function recordCompilerKeyedArrayMapPipeline(previous, value) {
524
+ try {
525
+ const previousTarget = compilerObject(previous);
526
+ const valueTarget = compilerObject(value);
527
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
528
+ return value;
529
+ }
530
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
531
+ const previousReorder = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
532
+ const structuralUpdate = previousReorder?.structuralUpdate || (!previousReorder ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0);
533
+ const structuralSource = structuralUpdate ? compilerKeyedArrayFilterSource(structuralUpdate, previous.length) : void 0;
534
+ const previousSource = previousReorder && !previousReorder.structuralUpdate ? previousReorder : void 0;
535
+ if (!committedSource && (!previousSource || previousSource.resultLength !== previous.length) && !structuralSource) {
536
+ return value;
537
+ }
538
+ const sourceToken = previousSource?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
539
+ if (!sourceToken) return value;
540
+ const previousMappedItemSources = previousReorder?.mappedItemSources || structuralUpdate?.mappedItemSources;
541
+ const mappedItemSources = /* @__PURE__ */ new Map();
542
+ for (let index = 0; index < value.length; index += 1) {
543
+ const previousDescriptor = Object.getOwnPropertyDescriptor(previous, index);
544
+ const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
545
+ if (!previousDescriptor || !("value" in previousDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
546
+ return value;
547
+ }
548
+ const previousItem = previousDescriptor.value;
549
+ const sourceItem = previousMappedItemSources?.has(previousItem) ? previousMappedItemSources.get(previousItem) : previousItem;
550
+ const mappedItem = mappedDescriptor.value;
551
+ if (!Object.is(mappedItem, sourceItem)) mappedItemSources.set(mappedItem, sourceItem);
552
+ }
553
+ const hint = {
554
+ kind: committedSource ? void 0 : previousReorder?.kind,
555
+ sourceToken,
556
+ sourceLength: previousSource?.sourceLength ?? structuralSource?.sourceLength ?? previous.length,
557
+ resultLength: value.length,
558
+ mapped: true,
559
+ mappedItemSources,
560
+ ...structuralUpdate ? { structuralUpdate } : {}
561
+ };
562
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, hint);
563
+ } catch {
564
+ }
565
+ return value;
566
+ }
567
+ function createCompilerKeyedArrayMapPipeline(previous, methodOrPipeline, callback) {
568
+ if (callback !== void 0) {
569
+ const value = NATIVE_REFLECT_APPLY(
570
+ methodOrPipeline,
571
+ previous,
572
+ [callback]
573
+ );
574
+ if (methodOrPipeline !== NATIVE_ARRAY_MAP) return value;
575
+ return recordCompilerKeyedArrayMapPipeline(previous, value);
576
+ }
577
+ return executeCompilerKeyedMapPipeline(
578
+ previous,
579
+ methodOrPipeline,
580
+ recordCompilerKeyedArrayMapPipeline
581
+ );
582
+ }
583
+ function recordCompilerKeyedArrayQueuedMapPipeline(previous, value) {
584
+ try {
585
+ const previousTarget = compilerObject(previous);
586
+ const valueTarget = compilerObject(value);
587
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
588
+ return value;
589
+ }
590
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
591
+ const previousReorder = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
592
+ if (!committedSource && (!previousReorder || previousReorder.structuralUpdate || previousReorder.resultLength !== previous.length)) {
593
+ return value;
594
+ }
595
+ const sourceToken = previousReorder?.sourceToken || compilerKeyedCollectionToken(previousTarget);
596
+ if (!sourceToken) return value;
597
+ const sourceItems = previousReorder?.mappedItemSources?.queuedSourceItems || previous;
598
+ let mappedItemSources;
599
+ const readMappedItemSources = () => {
600
+ if (mappedItemSources) return mappedItemSources;
601
+ const sources = /* @__PURE__ */ new Map();
602
+ for (let index = 0; index < value.length; index += 1) {
603
+ const sourceDescriptor = Object.getOwnPropertyDescriptor(sourceItems, index);
604
+ const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
605
+ if (!sourceDescriptor || !("value" in sourceDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
606
+ throw new TypeError();
607
+ }
608
+ if (!Object.is(sourceDescriptor.value, mappedDescriptor.value)) {
609
+ sources.set(mappedDescriptor.value, sourceDescriptor.value);
610
+ }
611
+ }
612
+ mappedItemSources = sources;
613
+ return sources;
614
+ };
615
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
616
+ kind: previousReorder?.kind,
617
+ sourceToken,
618
+ sourceLength: previousReorder?.sourceLength ?? previous.length,
619
+ resultLength: value.length,
620
+ mapped: true,
621
+ // Array.map preserves positions. Retain the first queued source collection and validate its
622
+ // data properties against the final collection once, immediately before the DOM commit.
623
+ // This avoids rescanning every intermediate Array produced by separately queued setters.
624
+ mappedItemSources: {
625
+ queuedSourceItems: sourceItems,
626
+ get: (item) => readMappedItemSources().get(item),
627
+ has: (item) => readMappedItemSources().has(item)
628
+ }
629
+ });
630
+ } catch {
631
+ }
632
+ return value;
633
+ }
634
+ function createCompilerKeyedArrayQueuedMapPipeline(previous, pipeline) {
635
+ return executeCompilerKeyedMapPipeline(
636
+ previous,
637
+ pipeline,
638
+ recordCompilerKeyedArrayQueuedMapPipeline
639
+ );
640
+ }
641
+ function createCompilerKeyedArrayMapReorder(previous, method, ...args) {
642
+ const value = NATIVE_REFLECT_APPLY(
643
+ method,
644
+ previous,
645
+ args
646
+ );
647
+ try {
648
+ const previousTarget = compilerObject(previous);
649
+ const valueTarget = compilerObject(value);
650
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length || method !== NATIVE_ARRAY_TO_REVERSED && method !== NATIVE_ARRAY_TO_SORTED || method === NATIVE_ARRAY_TO_REVERSED && args.length !== 0 || method === NATIVE_ARRAY_TO_SORTED && (args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function")) {
651
+ return value;
652
+ }
653
+ for (let index = 0; index < previous.length; index += 1) {
654
+ if (!Object.prototype.hasOwnProperty.call(previous, index) || !Object.prototype.hasOwnProperty.call(value, index)) {
655
+ return value;
656
+ }
657
+ }
658
+ const previousReorder = COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
659
+ const source = previousReorder?.mapped ? previousReorder : void 0;
660
+ if (!source || source.resultLength !== previous.length) return value;
661
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
662
+ kind: method !== NATIVE_ARRAY_TO_REVERSED ? 1 /* Permutation */ : reversedCompilerKeyedArrayOrder(source.kind),
663
+ sourceToken: source.sourceToken,
664
+ sourceLength: source.sourceLength,
665
+ resultLength: value.length,
666
+ mapped: true,
667
+ mappedItemSources: source.mappedItemSources
668
+ });
669
+ } catch {
670
+ }
671
+ return value;
672
+ }
207
673
  function createCompilerKeyedArrayAppend(previous, value) {
208
674
  try {
209
675
  const previousTarget = compilerObject(previous);
@@ -227,24 +693,27 @@ function createCompilerKeyedArrayAppend(previous, value) {
227
693
  return value;
228
694
  }
229
695
  }
230
- function createCompilerKeyedArrayPrepend(previous, value) {
696
+ function createCompilerKeyedArrayStructuralAppend(previous, value) {
231
697
  try {
232
698
  const previousTarget = compilerObject(previous);
233
699
  const valueTarget = compilerObject(value);
234
700
  if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
235
701
  return value;
236
702
  }
237
- const sourceLength = previous.length;
238
- const prefixLength = value.length - sourceLength;
239
- if (prefixLength < 1) return value;
240
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
703
+ const startIndex = previous.length;
704
+ if (value.length < startIndex) return value;
705
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
706
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget);
707
+ const directStructuralUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
708
+ const structuralSource = directStructuralUpdate ? compilerKeyedArrayFilterSource(directStructuralUpdate, previous.length) : void 0;
709
+ const structuralUpdate = previousUpdate?.structuralUpdate || (structuralSource ? directStructuralUpdate : void 0);
710
+ const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
241
711
  if (!sourceToken) return value;
242
- const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
243
- COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
244
- sourceToken: previousUpdate?.sourceToken || sourceToken,
245
- sourceLength,
712
+ COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
713
+ sourceToken,
714
+ startIndex,
246
715
  resultLength: value.length,
247
- prefixLength,
716
+ ...structuralUpdate ? { structuralUpdate } : {},
248
717
  ...previousUpdate ? { previous: previousUpdate } : {}
249
718
  });
250
719
  return value;
@@ -252,48 +721,395 @@ function createCompilerKeyedArrayPrepend(previous, value) {
252
721
  return value;
253
722
  }
254
723
  }
255
- function createCompilerKeyedArrayFilter(previous, method, predicate) {
256
- let canHint = false;
257
- let sourceLength = 0;
258
- try {
259
- canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
260
- if (canHint) sourceLength = previous.length;
261
- } catch {
262
- canHint = false;
263
- }
264
- if (!canHint) {
265
- return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
266
- }
267
- const removedIndices = [];
268
- let visited = 0;
269
- const wrappedPredicate = function(item, index, collection) {
270
- visited += 1;
271
- const keep = NATIVE_REFLECT_APPLY(predicate, this, [
272
- item,
273
- index,
274
- collection
275
- ]);
276
- if (!keep) removedIndices.push(index);
277
- return keep;
278
- };
279
- const value = NATIVE_REFLECT_APPLY(method, previous, [
280
- wrappedPredicate
281
- ]);
724
+ function createCompilerKeyedArrayMappedStructuralAppend(previous, value) {
282
725
  try {
283
726
  const previousTarget = compilerObject(previous);
284
727
  const valueTarget = compilerObject(value);
285
- if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
728
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
286
729
  return value;
287
730
  }
288
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
289
- if (!sourceToken) return value;
290
- const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
291
- COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
292
- kind: "filter",
293
- sourceToken: previousUpdate?.sourceToken || sourceToken,
294
- sourceLength,
295
- resultLength: value.length,
296
- removedIndices,
731
+ const startIndex = previous.length;
732
+ if (value.length < startIndex) return value;
733
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
734
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget);
735
+ const previousMappedUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget) : void 0;
736
+ const mappedStructuralUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.structuralUpdate && previousMappedUpdate.resultLength === previous.length ? previousMappedUpdate : void 0;
737
+ const structuralUpdate = previousUpdate?.structuralUpdate || mappedStructuralUpdate?.structuralUpdate;
738
+ const sourceToken = previousUpdate?.sourceToken || mappedStructuralUpdate?.sourceToken;
739
+ const mappedItemSources = previousUpdate?.mappedItemSources || mappedStructuralUpdate?.mappedItemSources;
740
+ if (!sourceToken || !structuralUpdate || !mappedItemSources) return value;
741
+ COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
742
+ sourceToken,
743
+ startIndex,
744
+ resultLength: value.length,
745
+ structuralUpdate,
746
+ mappedItemSources,
747
+ ...previousUpdate?.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {},
748
+ ...previousUpdate?.mappedItemValues ? { mappedItemValues: previousUpdate.mappedItemValues } : {},
749
+ ...previousUpdate ? { previous: previousUpdate } : {}
750
+ });
751
+ return value;
752
+ } catch {
753
+ return value;
754
+ }
755
+ }
756
+ function createCompilerKeyedArrayStructuralAppendMapPipeline(previous, pipeline) {
757
+ let appendUpdate;
758
+ let committedItems;
759
+ let survivorRange;
760
+ let survivorIndices;
761
+ let mappedItemSources = /* @__PURE__ */ new Map();
762
+ let mappedItemValues = /* @__PURE__ */ new Map();
763
+ try {
764
+ const previousTarget = compilerObject(previous);
765
+ if (!previousTarget || !Array.isArray(previous) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || !(appendUpdate = COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget)) || !appendUpdate.structuralUpdate || appendUpdate.resultLength !== previous.length) {
766
+ appendUpdate = void 0;
767
+ } else {
768
+ committedItems = COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.get(appendUpdate.sourceToken);
769
+ const structuralAppend = committedItems ? compilerKeyedArrayStructuralAppendMapUpdate(
770
+ previous,
771
+ appendUpdate.sourceToken,
772
+ committedItems.length
773
+ ) : void 0;
774
+ survivorRange = structuralAppend?.structuralSurvivorRange;
775
+ survivorIndices = structuralAppend?.structuralSurvivors;
776
+ if (!survivorRange && !survivorIndices) {
777
+ appendUpdate = void 0;
778
+ } else {
779
+ if (appendUpdate.mappedSurvivorsValidated && appendUpdate.mappedItemSources) {
780
+ mappedItemSources = new Map(
781
+ appendUpdate.mappedItemSources
782
+ );
783
+ }
784
+ if (appendUpdate.mappedItemValues) {
785
+ mappedItemValues = new Map(appendUpdate.mappedItemValues);
786
+ }
787
+ }
788
+ }
789
+ } catch {
790
+ appendUpdate = void 0;
791
+ }
792
+ let eligible = appendUpdate !== void 0;
793
+ const applyMap = (collection, method, callback) => {
794
+ if (method !== NATIVE_ARRAY_MAP || !eligible) {
795
+ const value3 = NATIVE_REFLECT_APPLY(
796
+ method,
797
+ collection,
798
+ [callback]
799
+ );
800
+ if (method !== NATIVE_ARRAY_MAP) eligible = false;
801
+ return value3;
802
+ }
803
+ let expectedIndex = 0;
804
+ let expectedLength = -1;
805
+ try {
806
+ if (!Array.isArray(collection) || Object.getPrototypeOf(collection) !== NATIVE_ARRAY_PROTOTYPE) {
807
+ eligible = false;
808
+ } else {
809
+ expectedLength = collection.length;
810
+ }
811
+ } catch {
812
+ eligible = false;
813
+ }
814
+ const wrappedCallback = (item, index, source) => {
815
+ if (index !== expectedIndex) eligible = false;
816
+ expectedIndex = index + 1;
817
+ const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
818
+ let committedItem;
819
+ if (index < survivorCount) {
820
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices?.[index];
821
+ committedItem = sourceIndex === void 0 ? void 0 : committedItems?.[sourceIndex];
822
+ if (mappedItemValues.has(index)) {
823
+ if (!Object.is(item, mappedItemValues.get(index))) eligible = false;
824
+ } else if (appendUpdate?.mappedItemSources && !appendUpdate.mappedSurvivorsValidated) {
825
+ const mappedStructuralSources = appendUpdate.mappedItemSources;
826
+ const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
827
+ if (!Object.is(sourceItem, committedItem)) eligible = false;
828
+ } else if (!Object.is(item, committedItem)) {
829
+ eligible = false;
830
+ }
831
+ }
832
+ const mappedItem = NATIVE_REFLECT_APPLY(
833
+ callback,
834
+ void 0,
835
+ [item, index, source]
836
+ );
837
+ if (index < survivorCount) {
838
+ if (Object.is(mappedItem, committedItem)) {
839
+ mappedItemSources.delete(index);
840
+ mappedItemValues.delete(index);
841
+ } else {
842
+ mappedItemSources.set(index, committedItem);
843
+ mappedItemValues.set(index, mappedItem);
844
+ }
845
+ }
846
+ return mappedItem;
847
+ };
848
+ const value2 = NATIVE_REFLECT_APPLY(
849
+ method,
850
+ collection,
851
+ [wrappedCallback]
852
+ );
853
+ try {
854
+ if (expectedIndex !== expectedLength || !Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE || value2.length !== expectedLength) {
855
+ eligible = false;
856
+ }
857
+ } catch {
858
+ eligible = false;
859
+ }
860
+ return value2;
861
+ };
862
+ const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
863
+ if (!eligible || !appendUpdate) return value;
864
+ try {
865
+ const valueTarget = compilerObject(value);
866
+ if (!valueTarget) return value;
867
+ COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
868
+ ...appendUpdate,
869
+ mappedItemSources,
870
+ mappedItemValues,
871
+ mappedSurvivorsValidated: true
872
+ });
873
+ } catch {
874
+ }
875
+ return value;
876
+ }
877
+ function createCompilerKeyedArrayPrepend(previous, value) {
878
+ try {
879
+ const previousTarget = compilerObject(previous);
880
+ const valueTarget = compilerObject(value);
881
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
882
+ return value;
883
+ }
884
+ const sourceLength = previous.length;
885
+ const prefixLength = value.length - sourceLength;
886
+ if (prefixLength < 1) return value;
887
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
888
+ if (!sourceToken) return value;
889
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
890
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
891
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
892
+ sourceLength,
893
+ resultLength: value.length,
894
+ prefixLength,
895
+ ...previousUpdate ? { previous: previousUpdate } : {}
896
+ });
897
+ return value;
898
+ } catch {
899
+ return value;
900
+ }
901
+ }
902
+ function createCompilerKeyedArrayStructuralPrepend(previous, value) {
903
+ try {
904
+ const previousTarget = compilerObject(previous);
905
+ const valueTarget = compilerObject(value);
906
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
907
+ return value;
908
+ }
909
+ const sourceLength = previous.length;
910
+ const prefixLength = value.length - sourceLength;
911
+ if (prefixLength < 1) return value;
912
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
913
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget);
914
+ const directStructuralUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
915
+ const structuralSource = directStructuralUpdate ? compilerKeyedArrayFilterSource(directStructuralUpdate, previous.length) : void 0;
916
+ const structuralUpdate = previousUpdate?.structuralUpdate || (structuralSource ? directStructuralUpdate : void 0);
917
+ const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
918
+ if (!sourceToken) return value;
919
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
920
+ sourceToken,
921
+ sourceLength,
922
+ resultLength: value.length,
923
+ prefixLength,
924
+ ...structuralUpdate ? { structuralUpdate } : {},
925
+ ...previousUpdate ? { previous: previousUpdate } : {}
926
+ });
927
+ return value;
928
+ } catch {
929
+ return value;
930
+ }
931
+ }
932
+ function createCompilerKeyedArrayMappedStructuralPrepend(previous, value) {
933
+ try {
934
+ const previousTarget = compilerObject(previous);
935
+ const valueTarget = compilerObject(value);
936
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
937
+ return value;
938
+ }
939
+ const sourceLength = previous.length;
940
+ const prefixLength = value.length - sourceLength;
941
+ if (prefixLength < 1) return value;
942
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
943
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget);
944
+ const previousMappedUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget) : void 0;
945
+ const mappedStructuralUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.structuralUpdate && previousMappedUpdate.resultLength === previous.length ? previousMappedUpdate : void 0;
946
+ const structuralUpdate = previousUpdate?.structuralUpdate || mappedStructuralUpdate?.structuralUpdate;
947
+ const sourceToken = previousUpdate?.sourceToken || mappedStructuralUpdate?.sourceToken;
948
+ const mappedItemSources = previousUpdate?.mappedItemSources || mappedStructuralUpdate?.mappedItemSources;
949
+ if (!sourceToken || !structuralUpdate || !mappedItemSources) return value;
950
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
951
+ sourceToken,
952
+ sourceLength,
953
+ resultLength: value.length,
954
+ prefixLength,
955
+ structuralUpdate,
956
+ mappedItemSources,
957
+ ...previousUpdate?.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {},
958
+ ...previousUpdate?.mappedItemValues ? { mappedItemValues: previousUpdate.mappedItemValues } : {},
959
+ ...previousUpdate ? { previous: previousUpdate } : {}
960
+ });
961
+ return value;
962
+ } catch {
963
+ return value;
964
+ }
965
+ }
966
+ function createCompilerKeyedArrayStructuralPrependMapPipeline(previous, pipeline) {
967
+ let prependUpdate;
968
+ let committedItems;
969
+ let survivorRange;
970
+ let survivorIndices;
971
+ let prefixLength = 0;
972
+ try {
973
+ const previousTarget = compilerObject(previous);
974
+ if (!previousTarget || !Array.isArray(previous) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || !(prependUpdate = COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget)) || !prependUpdate.structuralUpdate || prependUpdate.resultLength !== previous.length) {
975
+ prependUpdate = void 0;
976
+ } else {
977
+ committedItems = COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.get(prependUpdate.sourceToken);
978
+ const structuralPrepend = committedItems ? compilerKeyedArrayStructuralPrependMapUpdate(
979
+ previous,
980
+ prependUpdate.sourceToken,
981
+ committedItems.length
982
+ ) : void 0;
983
+ survivorRange = structuralPrepend?.structuralSurvivorRange;
984
+ survivorIndices = structuralPrepend?.structuralSurvivors;
985
+ prefixLength = structuralPrepend?.prefixLength || 0;
986
+ if (!survivorRange && !survivorIndices) {
987
+ prependUpdate = void 0;
988
+ }
989
+ }
990
+ } catch {
991
+ prependUpdate = void 0;
992
+ }
993
+ let eligible = prependUpdate !== void 0;
994
+ const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
995
+ const applyMap = (collection, method, callback) => {
996
+ if (method !== NATIVE_ARRAY_MAP || !eligible) {
997
+ const value3 = NATIVE_REFLECT_APPLY(
998
+ method,
999
+ collection,
1000
+ [callback]
1001
+ );
1002
+ if (method !== NATIVE_ARRAY_MAP) eligible = false;
1003
+ return value3;
1004
+ }
1005
+ let expectedIndex = 0;
1006
+ let expectedLength = -1;
1007
+ try {
1008
+ if (!Array.isArray(collection) || Object.getPrototypeOf(collection) !== NATIVE_ARRAY_PROTOTYPE) {
1009
+ eligible = false;
1010
+ } else {
1011
+ expectedLength = collection.length;
1012
+ }
1013
+ } catch {
1014
+ eligible = false;
1015
+ }
1016
+ const wrappedCallback = (item, index, source) => {
1017
+ if (index !== expectedIndex) eligible = false;
1018
+ expectedIndex = index + 1;
1019
+ return NATIVE_REFLECT_APPLY(
1020
+ callback,
1021
+ void 0,
1022
+ [item, index, source]
1023
+ );
1024
+ };
1025
+ const value2 = NATIVE_REFLECT_APPLY(
1026
+ method,
1027
+ collection,
1028
+ [wrappedCallback]
1029
+ );
1030
+ try {
1031
+ if (expectedIndex !== expectedLength || !Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE || value2.length !== expectedLength) {
1032
+ eligible = false;
1033
+ }
1034
+ } catch {
1035
+ eligible = false;
1036
+ }
1037
+ return value2;
1038
+ };
1039
+ const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
1040
+ if (!eligible || !prependUpdate) return value;
1041
+ try {
1042
+ const valueTarget = compilerObject(value);
1043
+ if (!valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== prefixLength + survivorCount) {
1044
+ return value;
1045
+ }
1046
+ const mappedItemSources = /* @__PURE__ */ new Map();
1047
+ const mappedItemValues = /* @__PURE__ */ new Map();
1048
+ for (let index = 0; index < survivorCount; index += 1) {
1049
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
1050
+ const committedItem = committedItems[sourceIndex];
1051
+ const mappedItem = value[prefixLength + index];
1052
+ if (Object.is(mappedItem, committedItem)) continue;
1053
+ mappedItemSources.set(index, committedItem);
1054
+ mappedItemValues.set(index, mappedItem);
1055
+ }
1056
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
1057
+ ...prependUpdate,
1058
+ mappedItemSources,
1059
+ mappedItemValues,
1060
+ mappedSurvivorsValidated: true
1061
+ });
1062
+ } catch {
1063
+ }
1064
+ return value;
1065
+ }
1066
+ function createCompilerKeyedArrayFilter(previous, method, predicate) {
1067
+ let canHint = false;
1068
+ let sourceLength = 0;
1069
+ try {
1070
+ canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
1071
+ if (canHint) sourceLength = previous.length;
1072
+ } catch {
1073
+ canHint = false;
1074
+ }
1075
+ if (!canHint) {
1076
+ return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
1077
+ }
1078
+ const removedIndices = [];
1079
+ let visited = 0;
1080
+ const wrappedPredicate = function(item, index, collection) {
1081
+ visited += 1;
1082
+ const keep = NATIVE_REFLECT_APPLY(predicate, this, [
1083
+ item,
1084
+ index,
1085
+ collection
1086
+ ]);
1087
+ if (!keep) removedIndices.push(index);
1088
+ return keep;
1089
+ };
1090
+ const value = NATIVE_REFLECT_APPLY(method, previous, [
1091
+ wrappedPredicate
1092
+ ]);
1093
+ try {
1094
+ const previousTarget = compilerObject(previous);
1095
+ const valueTarget = compilerObject(value);
1096
+ if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
1097
+ return value;
1098
+ }
1099
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1100
+ const previousMappedUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
1101
+ const mappedUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.resultLength === sourceLength ? previousMappedUpdate : void 0;
1102
+ const sourceToken = mappedUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
1103
+ if (!sourceToken) return value;
1104
+ const previousUpdate = !committedSource ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) || mappedUpdate?.structuralUpdate : void 0;
1105
+ const mappedItemSources = mappedUpdate?.mappedItemSources || previousUpdate?.mappedItemSources;
1106
+ COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
1107
+ kind: "filter",
1108
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
1109
+ sourceLength,
1110
+ resultLength: value.length,
1111
+ removedIndices,
1112
+ ...mappedItemSources ? { mappedItemSources } : {},
297
1113
  ...previousUpdate ? { previous: previousUpdate } : {}
298
1114
  });
299
1115
  } catch {
@@ -322,9 +1138,13 @@ function createCompilerKeyedArraySlice(previous, method, ...args) {
322
1138
  const retainedEnd = args.length === 2 ? normalize(args[1]) : sourceLength;
323
1139
  const resultLength = Math.max(retainedEnd - retainedStart, 0);
324
1140
  if (value.length !== resultLength || resultLength >= sourceLength) return value;
325
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
1141
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1142
+ const previousMappedUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
1143
+ const mappedUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.resultLength === sourceLength ? previousMappedUpdate : void 0;
1144
+ const sourceToken = mappedUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
326
1145
  if (!sourceToken) return value;
327
- const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
1146
+ const previousUpdate = !committedSource ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) || mappedUpdate?.structuralUpdate : void 0;
1147
+ const mappedItemSources = mappedUpdate?.mappedItemSources || previousUpdate?.mappedItemSources;
328
1148
  COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
329
1149
  kind: "slice",
330
1150
  sourceToken: previousUpdate?.sourceToken || sourceToken,
@@ -332,23 +1152,48 @@ function createCompilerKeyedArraySlice(previous, method, ...args) {
332
1152
  resultLength,
333
1153
  retainedEnd: Math.max(retainedEnd, retainedStart),
334
1154
  retainedStart,
1155
+ ...mappedItemSources ? { mappedItemSources } : {},
335
1156
  ...previousUpdate ? { previous: previousUpdate } : {}
336
1157
  });
337
1158
  } catch {
338
1159
  }
339
1160
  return value;
340
1161
  }
1162
+ function finalizeCompilerKeyedArrayMappedStructuralUpdate(value) {
1163
+ try {
1164
+ const valueTarget = compilerObject(value);
1165
+ const structuralUpdate = valueTarget ? COMPILER_KEYED_ARRAY_FILTERS.get(valueTarget) : void 0;
1166
+ const mappedItemSources = structuralUpdate?.mappedItemSources;
1167
+ if (!valueTarget || !structuralUpdate || !mappedItemSources) return value;
1168
+ const source = compilerKeyedArrayFilterSource(structuralUpdate, structuralUpdate.resultLength);
1169
+ if (!source) return value;
1170
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
1171
+ sourceToken: source.sourceToken,
1172
+ sourceLength: source.sourceLength,
1173
+ resultLength: structuralUpdate.resultLength,
1174
+ mapped: true,
1175
+ mappedItemSources,
1176
+ structuralUpdate
1177
+ });
1178
+ } catch {
1179
+ }
1180
+ return value;
1181
+ }
341
1182
  function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
342
1183
  try {
343
1184
  const previousTarget = compilerObject(previous);
344
1185
  const retainedTarget = compilerObject(retained);
345
1186
  const valueTarget = compilerObject(value);
346
- if (!previousTarget || !retainedTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(retained) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(retained) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
1187
+ if (!previousTarget || !retainedTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(retained) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(retained) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
347
1188
  return value;
348
1189
  }
349
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
1190
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1191
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(previousTarget);
1192
+ if (!committedSource && !previousUpdate) return value;
1193
+ const immediateSourceToken = compilerKeyedCollectionToken(previousTarget);
1194
+ const sourceToken = previousUpdate?.sourceToken || immediateSourceToken;
350
1195
  const slice = COMPILER_KEYED_ARRAY_FILTERS.get(retainedTarget);
351
- if (!sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !== sourceToken || slice.sourceLength !== previous.length || slice.retainedStart === void 0 || slice.retainedEnd !== previous.length || slice.retainedStart < 1 || slice.resultLength !== retained.length || value.length <= retained.length) {
1196
+ if (!immediateSourceToken || !sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !== immediateSourceToken || slice.sourceLength !== previous.length || slice.retainedStart === void 0 || slice.retainedEnd !== previous.length || slice.retainedStart < 1 || slice.resultLength !== retained.length || previousUpdate && previousUpdate.resultLength !== previous.length || value.length <= retained.length) {
352
1197
  return value;
353
1198
  }
354
1199
  for (let index = 0; index < retained.length; index += 1) {
@@ -359,7 +1204,8 @@ function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
359
1204
  sourceLength: previous.length,
360
1205
  resultLength: value.length,
361
1206
  retainedEnd: slice.retainedEnd,
362
- retainedStart: slice.retainedStart
1207
+ retainedStart: slice.retainedStart,
1208
+ ...previousUpdate ? { previous: previousUpdate } : {}
363
1209
  });
364
1210
  } catch {
365
1211
  }
@@ -380,9 +1226,11 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
380
1226
  }
381
1227
  const sourceLength = previous.length;
382
1228
  const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
1229
+ const deleteCount = args[0];
1230
+ const removedCount = sourceLength - value.length;
383
1231
  const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
384
- const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Object.is(args[0], 1) && normalizedPosition < sourceLength && value.length === sourceLength - 1;
385
- const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength && value.length === sourceLength;
1232
+ const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Number.isSafeInteger(deleteCount) && deleteCount > 0 && normalizedPosition < sourceLength && removedCount === Math.min(deleteCount, sourceLength - normalizedPosition);
1233
+ const validReplace = kind === "replace" && value.length === sourceLength && (method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength || method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 1) && normalizedPosition < sourceLength);
386
1234
  if (!validInsert && !validRemove && !validReplace) return value;
387
1235
  const sourceToken = compilerKeyedCollectionToken(previousTarget);
388
1236
  if (!sourceToken) return value;
@@ -397,6 +1245,71 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
397
1245
  }
398
1246
  return value;
399
1247
  }
1248
+ function createCompilerKeyedArrayBatchInsert(previous, method, position, ...items) {
1249
+ const value = NATIVE_REFLECT_APPLY(
1250
+ method,
1251
+ previous,
1252
+ [position, 0, ...items]
1253
+ );
1254
+ try {
1255
+ const previousTarget = compilerObject(previous);
1256
+ const valueTarget = compilerObject(value);
1257
+ if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SPLICED || !Number.isSafeInteger(position) || items.length < 2 || value.length !== previous.length + items.length) {
1258
+ return value;
1259
+ }
1260
+ for (let index = 0; index < previous.length; index += 1) {
1261
+ if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
1262
+ }
1263
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
1264
+ if (!sourceToken) return value;
1265
+ COMPILER_KEYED_ARRAY_BATCH_INSERTS.set(valueTarget, {
1266
+ sourceToken,
1267
+ sourceLength: previous.length,
1268
+ resultLength: value.length,
1269
+ position: position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length)
1270
+ });
1271
+ } catch {
1272
+ }
1273
+ return value;
1274
+ }
1275
+ function createCompilerKeyedArrayWindowReplace(previous, method, position, deleteCount, ...items) {
1276
+ const value = NATIVE_REFLECT_APPLY(
1277
+ method,
1278
+ previous,
1279
+ [position, deleteCount, ...items]
1280
+ );
1281
+ try {
1282
+ const previousTarget = compilerObject(previous);
1283
+ const valueTarget = compilerObject(value);
1284
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SPLICED || !Number.isSafeInteger(position) || !Number.isSafeInteger(deleteCount) || deleteCount <= 0) {
1285
+ return value;
1286
+ }
1287
+ for (let index = 0; index < previous.length; index += 1) {
1288
+ if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
1289
+ }
1290
+ const normalizedPosition = position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length);
1291
+ const removedCount = Math.min(deleteCount, previous.length - normalizedPosition);
1292
+ if (removedCount < 1 || value.length !== previous.length - removedCount + items.length) {
1293
+ return value;
1294
+ }
1295
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1296
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(previousTarget);
1297
+ if (!committedSource && !previousUpdate) return value;
1298
+ const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
1299
+ if (!sourceToken) return value;
1300
+ COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.set(valueTarget, {
1301
+ sourceToken,
1302
+ sourceLength: previous.length,
1303
+ resultLength: value.length,
1304
+ position: normalizedPosition,
1305
+ removedCount,
1306
+ insertedCount: items.length,
1307
+ ...previousUpdate ? { previous: previousUpdate } : {}
1308
+ });
1309
+ } catch {
1310
+ }
1311
+ return value;
1312
+ }
400
1313
  function createCompilerKeyedArrayReorder(previous, method) {
401
1314
  const value = NATIVE_REFLECT_APPLY(
402
1315
  method,
@@ -406,13 +1319,18 @@ function createCompilerKeyedArrayReorder(previous, method) {
406
1319
  try {
407
1320
  const previousTarget = compilerObject(previous);
408
1321
  const valueTarget = compilerObject(value);
409
- if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
1322
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
410
1323
  return value;
411
1324
  }
412
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
1325
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1326
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
1327
+ if (!committedSource && (!previousUpdate || previousUpdate.sourceLength !== previous.length || previousUpdate.resultLength !== previous.length)) {
1328
+ return value;
1329
+ }
1330
+ const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
413
1331
  if (!sourceToken) return value;
414
1332
  COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
415
- kind: "reverse",
1333
+ kind: reversedCompilerKeyedArrayOrder(previousUpdate?.kind),
416
1334
  sourceToken,
417
1335
  sourceLength: previous.length,
418
1336
  resultLength: value.length
@@ -430,16 +1348,21 @@ function createCompilerKeyedArraySort(previous, method, ...args) {
430
1348
  try {
431
1349
  const previousTarget = compilerObject(previous);
432
1350
  const valueTarget = compilerObject(value);
433
- if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
1351
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
434
1352
  return value;
435
1353
  }
436
1354
  for (let index = 0; index < previous.length; index += 1) {
437
1355
  if (!(index in previous)) return value;
438
1356
  }
439
- const sourceToken = compilerKeyedCollectionToken(previousTarget);
1357
+ const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
1358
+ const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
1359
+ if (!committedSource && (!previousUpdate || previousUpdate.sourceLength !== previous.length || previousUpdate.resultLength !== previous.length)) {
1360
+ return value;
1361
+ }
1362
+ const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
440
1363
  if (!sourceToken) return value;
441
1364
  COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
442
- kind: "sort",
1365
+ kind: 1 /* Permutation */,
443
1366
  sourceToken,
444
1367
  sourceLength: previous.length,
445
1368
  resultLength: value.length
@@ -448,11 +1371,80 @@ function createCompilerKeyedArraySort(previous, method, ...args) {
448
1371
  }
449
1372
  return value;
450
1373
  }
451
- function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
452
- const args = operation === "map-set" ? [key, value] : [key];
453
- const result = NATIVE_REFLECT_APPLY(method, collection, args);
454
- const target = compilerObject(collection);
455
- if (!target) return result;
1374
+ function recordCompilerKeyedArrayStructuralReorder(previous, value, kind) {
1375
+ try {
1376
+ const previousTarget = compilerObject(previous);
1377
+ const valueTarget = compilerObject(value);
1378
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value)) {
1379
+ return value;
1380
+ }
1381
+ const previousUpdate = COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
1382
+ const structuralUpdate = previousUpdate?.structuralUpdate || (!previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0);
1383
+ const structuralSource = structuralUpdate ? compilerKeyedArrayFilterSource(structuralUpdate, previous.length) : void 0;
1384
+ if (!structuralUpdate || !structuralSource || previousUpdate && previousUpdate.resultLength !== previous.length) {
1385
+ return value;
1386
+ }
1387
+ const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken;
1388
+ if (!sourceToken) return value;
1389
+ const mappedItemSources = previousUpdate?.mappedItemSources || structuralUpdate.mappedItemSources;
1390
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
1391
+ kind: kind === 0 /* Reverse */ ? reversedCompilerKeyedArrayOrder(previousUpdate?.kind) : 1 /* Permutation */,
1392
+ sourceToken,
1393
+ sourceLength: previousUpdate?.sourceLength || structuralSource.sourceLength,
1394
+ resultLength: value.length,
1395
+ structuralUpdate,
1396
+ ...mappedItemSources ? { mappedItemSources } : {}
1397
+ });
1398
+ } catch {
1399
+ }
1400
+ return value;
1401
+ }
1402
+ function createCompilerKeyedArrayStructuralReorder(previous, method) {
1403
+ const value = NATIVE_REFLECT_APPLY(
1404
+ method,
1405
+ previous,
1406
+ []
1407
+ );
1408
+ try {
1409
+ if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
1410
+ return value;
1411
+ }
1412
+ } catch {
1413
+ return value;
1414
+ }
1415
+ return recordCompilerKeyedArrayStructuralReorder(
1416
+ previous,
1417
+ value,
1418
+ 0 /* Reverse */
1419
+ );
1420
+ }
1421
+ function createCompilerKeyedArrayStructuralSort(previous, method, ...args) {
1422
+ const value = NATIVE_REFLECT_APPLY(
1423
+ method,
1424
+ previous,
1425
+ args
1426
+ );
1427
+ try {
1428
+ if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
1429
+ return value;
1430
+ }
1431
+ for (let index = 0; index < previous.length; index += 1) {
1432
+ if (!(index in previous)) return value;
1433
+ }
1434
+ } catch {
1435
+ return value;
1436
+ }
1437
+ return recordCompilerKeyedArrayStructuralReorder(
1438
+ previous,
1439
+ value,
1440
+ 1 /* Permutation */
1441
+ );
1442
+ }
1443
+ function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
1444
+ const args = operation === "map-set" ? [key, value] : [key];
1445
+ const result = NATIVE_REFLECT_APPLY(method, collection, args);
1446
+ const target = compilerObject(collection);
1447
+ if (!target) return result;
456
1448
  const kind = operation.startsWith("set-") ? "set" : "map";
457
1449
  const nativeMethod = operation === "set-add" ? NATIVE_SET_ADD : operation === "set-delete" ? NATIVE_SET_DELETE : operation === "map-set" ? NATIVE_MAP_SET : NATIVE_MAP_DELETE;
458
1450
  const nativePrototype = kind === "set" ? NATIVE_SET_PROTOTYPE : NATIVE_MAP_PROTOTYPE;
@@ -865,6 +1857,9 @@ function applyStaticRangeBindings(bindings, segments, values) {
865
1857
  }
866
1858
  return true;
867
1859
  }
1860
+ function keyedRowInstancesByKey(instances) {
1861
+ return new Map(instances.map((instance) => [instance.key, instance]));
1862
+ }
868
1863
  var UNSET_KEYED_ROW_BINDING = /* @__PURE__ */ Symbol("unset interactive keyed-row binding");
869
1864
  function keyedRowIdentity(key) {
870
1865
  return String(key);
@@ -1132,6 +2127,32 @@ function applyKeyedRowBinding(props, instance, item, index, bindingIndex) {
1132
2127
  updateAttribute(target, binding.name, rawValue);
1133
2128
  }
1134
2129
  }
2130
+ function prepareKeyedRowBindingUpdates(props, instance, item, index) {
2131
+ const updates = [];
2132
+ for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
2133
+ const binding = props.bindings[bindingIndex];
2134
+ const rawValue = binding.read(item, index);
2135
+ const value = normalizedKeyedRowBindingValue(binding, rawValue);
2136
+ if (Object.is(instance.values[bindingIndex], value)) continue;
2137
+ const target = findCompilerHostTarget(instance.element, binding.path);
2138
+ if (!target || binding.kind !== "text" && !binding.name) return void 0;
2139
+ updates.push([bindingIndex, rawValue, target, value]);
2140
+ }
2141
+ return updates;
2142
+ }
2143
+ function applyPreparedKeyedRowBindingUpdates(props, instance, updates) {
2144
+ for (const [bindingIndex, rawValue, target, value] of updates) {
2145
+ const binding = props.bindings[bindingIndex];
2146
+ instance.values[bindingIndex] = value;
2147
+ if (binding.kind === "text") {
2148
+ target.textContent = value;
2149
+ } else if (binding.kind === "style") {
2150
+ updateStyle(target, binding.name, rawValue);
2151
+ } else {
2152
+ updateAttribute(target, binding.name, rawValue);
2153
+ }
2154
+ }
2155
+ }
1135
2156
  function keyedRowConditionalSnapshot(conditional, item, index) {
1136
2157
  const test = conditional.test(item, index);
1137
2158
  if (conditional.logical && !test) {
@@ -1691,7 +2712,7 @@ var CompilerNestedKeyedRanges = class {
1691
2712
  }
1692
2713
  anchor = instance.element;
1693
2714
  }
1694
- this.instances[rangeIndex] = new Map(nextInstances.map((instance) => [instance.key, instance]));
2715
+ this.instances[rangeIndex] = keyedRowInstancesByKey(nextInstances);
1695
2716
  return true;
1696
2717
  }
1697
2718
  updateStaticScopes(descriptor, rowsByRange) {
@@ -2019,7 +3040,7 @@ var CompilerNestedMixedRanges = class {
2019
3040
  }
2020
3041
  anchor = row.element;
2021
3042
  }
2022
- instance.value = new Map(nextInstances.map((row) => [row.key, row]));
3043
+ instance.value = keyedRowInstancesByKey(nextInstances);
2023
3044
  return true;
2024
3045
  }
2025
3046
  reconcileRange(rangeIndex, snapshot) {
@@ -2574,6 +3595,53 @@ function longestIncreasingSubsequencePositions(sequence) {
2574
3595
  }
2575
3596
  return positions;
2576
3597
  }
3598
+ function reorderCompilerKeyedRows(root, instances, sequence, anchor) {
3599
+ const activeElement = compilerFocusedElement(root);
3600
+ const stablePositions = longestIncreasingSubsequencePositions(sequence);
3601
+ for (let index = instances.length - 1; index >= 0; index -= 1) {
3602
+ const instance = instances[index];
3603
+ if (sequence[index] < 0) {
3604
+ let start = index;
3605
+ while (start > 0 && sequence[start - 1] < 0) start -= 1;
3606
+ const fragment = root.ownerDocument.createDocumentFragment();
3607
+ for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
3608
+ fragment.append(instances[itemIndex].element);
3609
+ }
3610
+ root.insertBefore(fragment, anchor);
3611
+ anchor = instances[start].element;
3612
+ index = start;
3613
+ } else {
3614
+ if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
3615
+ root.insertBefore(instance.element, anchor);
3616
+ }
3617
+ anchor = instance.element;
3618
+ }
3619
+ }
3620
+ restoreCompilerFocus(activeElement);
3621
+ }
3622
+ function compilerFocusedElement(root) {
3623
+ const activeElement = root.ownerDocument.activeElement;
3624
+ return activeElement && root.contains(activeElement) ? activeElement : null;
3625
+ }
3626
+ function restoreCompilerFocus(activeElement) {
3627
+ if (activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
3628
+ activeElement.focus({ preventScroll: true });
3629
+ }
3630
+ }
3631
+ function reverseCompilerKeyedRows(root, instances) {
3632
+ const activeElement = compilerFocusedElement(root);
3633
+ let anchor = instances[0]?.element || null;
3634
+ for (let sourceIndex = 1; sourceIndex < instances.length; sourceIndex += 1) {
3635
+ const element = instances[sourceIndex].element;
3636
+ root.insertBefore(element, anchor);
3637
+ anchor = element;
3638
+ }
3639
+ instances.reverse();
3640
+ for (let index = 0; index < instances.length; index += 1) {
3641
+ instances[index].index = index;
3642
+ }
3643
+ restoreCompilerFocus(activeElement);
3644
+ }
2577
3645
  var keyedUpdateRuntime = {
2578
3646
  append: reconcileCompilerKeyedArrayAppend,
2579
3647
  commit: commitCompilerKeyedCollection,
@@ -2591,14 +3659,30 @@ var keyedFilterPrependUpdateRuntime = {
2591
3659
  ...keyedFilterUpdateRuntime,
2592
3660
  prepend: reconcileCompilerKeyedArrayPrepend
2593
3661
  };
3662
+ var keyedStructuralPrependUpdateRuntime = {
3663
+ ...keyedFilterPrependUpdateRuntime,
3664
+ prepend: reconcileCompilerKeyedArrayPrependWithStructural
3665
+ };
2594
3666
  var keyedPositionUpdateRuntime = {
2595
3667
  ...keyedUpdateRuntime,
2596
3668
  position: reconcileCompilerKeyedArrayPosition
2597
3669
  };
3670
+ var keyedBatchPositionUpdateRuntime = {
3671
+ ...keyedUpdateRuntime,
3672
+ position: reconcileCompilerKeyedArrayPositionWithBatch
3673
+ };
3674
+ var keyedWindowPositionUpdateRuntime = {
3675
+ ...keyedUpdateRuntime,
3676
+ position: reconcileCompilerKeyedArrayPositionWithWindow
3677
+ };
2598
3678
  var keyedReorderUpdateRuntime = {
2599
3679
  ...keyedUpdateRuntime,
2600
3680
  reorder: reconcileCompilerKeyedArrayReorder
2601
3681
  };
3682
+ var keyedMapReorderUpdateRuntime = {
3683
+ ...keyedUpdateRuntime,
3684
+ reorder: reconcileCompilerKeyedArrayReorderWithMap
3685
+ };
2602
3686
  var keyedCompleteUpdateRuntime = {
2603
3687
  ...keyedFilterPrependUpdateRuntime,
2604
3688
  rollingWindow: reconcileCompilerKeyedArrayRollingWindow
@@ -2606,7 +3690,32 @@ var keyedCompleteUpdateRuntime = {
2606
3690
  var keyedEveryUpdateRuntime = {
2607
3691
  ...keyedCompleteUpdateRuntime,
2608
3692
  position: reconcileCompilerKeyedArrayPosition,
2609
- reorder: reconcileCompilerKeyedArrayReorder
3693
+ reorder: reconcileCompilerKeyedArrayReorderWithMapAndStructural
3694
+ };
3695
+ var keyedBatchEveryUpdateRuntime = {
3696
+ ...keyedEveryUpdateRuntime,
3697
+ position: reconcileCompilerKeyedArrayPositionWithBatch
3698
+ };
3699
+ var keyedWindowEveryUpdateRuntime = {
3700
+ ...keyedEveryUpdateRuntime,
3701
+ position: reconcileCompilerKeyedArrayPositionWithWindow
3702
+ };
3703
+ var keyedWindowEveryStructuralAppendUpdateRuntime = {
3704
+ ...keyedWindowEveryUpdateRuntime,
3705
+ append: reconcileCompilerKeyedArrayAppendWithStructural
3706
+ };
3707
+ var keyedWindowEveryStructuralAppendMapUpdateRuntime = {
3708
+ ...keyedWindowEveryStructuralAppendUpdateRuntime,
3709
+ append: reconcileCompilerKeyedArrayAppendMapWithStructural,
3710
+ commit: commitCompilerKeyedCollectionWithItemSnapshot
3711
+ };
3712
+ var keyedCompleteCompatibilityUpdateRuntime = {
3713
+ ...keyedWindowEveryStructuralAppendMapUpdateRuntime,
3714
+ prepend: reconcileCompilerKeyedArrayPrependWithStructural
3715
+ };
3716
+ var keyedCompleteStructuralPrependMapUpdateRuntime = {
3717
+ ...keyedCompleteCompatibilityUpdateRuntime,
3718
+ prepend: reconcileCompilerKeyedArrayPrependMapWithStructural
2610
3719
  };
2611
3720
  function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
2612
3721
  const dependency = props.collectionDependency;
@@ -2657,6 +3766,86 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
2657
3766
  fallback: false
2658
3767
  };
2659
3768
  }
3769
+ function reconcileCompilerKeyedArrayMapReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
3770
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
3771
+ return void 0;
3772
+ }
3773
+ const collectionDependency = props.collectionDependency;
3774
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
3775
+ return void 0;
3776
+ }
3777
+ const dependencies = props.dependencies || props.structureDependencies;
3778
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
3779
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
3780
+ return void 0;
3781
+ }
3782
+ const finalValue = preparedReorder?.value ?? props.items();
3783
+ const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
3784
+ if (!update?.mapped || !update.mappedItemSources || update.structuralUpdate || !Array.isArray(finalValue)) {
3785
+ return void 0;
3786
+ }
3787
+ const previousInstances = [...instances.values()];
3788
+ const reverse = update.kind === 0 /* Reverse */;
3789
+ const prepared = (() => {
3790
+ const changed = [];
3791
+ try {
3792
+ const instancesByItem = update.kind === 1 /* Permutation */ ? /* @__PURE__ */ new Map() : void 0;
3793
+ if (instancesByItem) {
3794
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
3795
+ const instance = previousInstances[sourceIndex];
3796
+ if (instance.index !== sourceIndex || instancesByItem.has(instance.item))
3797
+ return void 0;
3798
+ instancesByItem.set(instance.item, instance);
3799
+ }
3800
+ }
3801
+ const nextInstances = instancesByItem ? [] : previousInstances;
3802
+ const sequence = instancesByItem ? [] : void 0;
3803
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
3804
+ const item = finalValue[targetIndex];
3805
+ let instance;
3806
+ if (!instancesByItem) {
3807
+ const sourceIndex = reverse ? finalValue.length - targetIndex - 1 : targetIndex;
3808
+ instance = previousInstances[sourceIndex];
3809
+ if (!instance || instance.index !== sourceIndex) return void 0;
3810
+ if (Object.is(instance.item, item)) continue;
3811
+ if (!update.mappedItemSources.has(item) || !Object.is(instance.item, update.mappedItemSources.get(item))) {
3812
+ return void 0;
3813
+ }
3814
+ } else {
3815
+ const sourceItem = update.mappedItemSources.has(item) ? update.mappedItemSources.get(item) : item;
3816
+ instance = instancesByItem.get(sourceItem);
3817
+ if (!instance) return void 0;
3818
+ instancesByItem.delete(sourceItem);
3819
+ nextInstances.push(instance);
3820
+ sequence.push(instance.index);
3821
+ if (Object.is(instance.item, item)) continue;
3822
+ }
3823
+ if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
3824
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, targetIndex);
3825
+ if (!bindingUpdates) return void 0;
3826
+ changed.push({ bindingUpdates, instance, item });
3827
+ }
3828
+ if (instancesByItem?.size) return void 0;
3829
+ return { changed, nextInstances, sequence };
3830
+ } catch {
3831
+ return void 0;
3832
+ }
3833
+ })();
3834
+ if (!prepared) return void 0;
3835
+ if (prepared.sequence) {
3836
+ reorderCompilerKeyedRows(root, prepared.nextInstances, prepared.sequence, null);
3837
+ } else if (reverse) {
3838
+ reverseCompilerKeyedRows(root, prepared.nextInstances);
3839
+ }
3840
+ for (const { bindingUpdates, instance, item } of prepared.changed) {
3841
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
3842
+ instance.item = item;
3843
+ }
3844
+ for (let index = 0; index < prepared.nextInstances.length; index += 1) {
3845
+ prepared.nextInstances[index].index = index;
3846
+ }
3847
+ return reverse || prepared.sequence ? keyedRowInstancesByKey(prepared.nextInstances) : instances;
3848
+ }
2660
3849
  function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2661
3850
  if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || props.collectionDependency === void 0) {
2662
3851
  return void 0;
@@ -2702,7 +3891,7 @@ function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, i
2702
3891
  }
2703
3892
  return nextInstances;
2704
3893
  }
2705
- function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
3894
+ function reconcileCompilerKeyedArrayStructuralAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2706
3895
  if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
2707
3896
  return void 0;
2708
3897
  }
@@ -2716,33 +3905,37 @@ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionT
2716
3905
  return void 0;
2717
3906
  }
2718
3907
  const finalValue = props.items();
2719
- const update = compilerKeyedArrayRollingWindow(finalValue, collectionToken, instances.size);
2720
- if (!update || !Array.isArray(finalValue)) return void 0;
3908
+ const update = compilerKeyedArrayStructuralAppendUpdate(
3909
+ finalValue,
3910
+ collectionToken,
3911
+ instances.size
3912
+ );
3913
+ const structuralUpdate = update?.structuralUpdate;
3914
+ const survivorResult = update?.structuralSurvivors;
3915
+ if (!update || !structuralUpdate || !survivorResult || structuralUpdate.mappedItemSources || !Array.isArray(finalValue)) {
3916
+ return void 0;
3917
+ }
2721
3918
  const previousInstances = [...instances.values()];
2722
- const retainedLength = update.retainedEnd - update.retainedStart;
2723
3919
  const survivors = [];
3920
+ const knownKeys = new Set(instances.keys());
3921
+ const appended = [];
2724
3922
  try {
2725
- for (let index = 0; index < retainedLength; index += 1) {
2726
- const sourceIndex = update.retainedStart + index;
3923
+ for (let index = 0; index < survivorResult.indices.length; index += 1) {
3924
+ const sourceIndex = survivorResult.indices[index];
2727
3925
  const instance = previousInstances[sourceIndex];
2728
- if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
3926
+ const item = finalValue[index];
3927
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !survivorResult.keysStable && keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
2729
3928
  return void 0;
2730
3929
  }
2731
3930
  survivors.push(instance);
2732
3931
  }
2733
- } catch {
2734
- return void 0;
2735
- }
2736
- const knownKeys = new Set(instances.keys());
2737
- const incoming = [];
2738
- try {
2739
- for (let index = retainedLength; index < finalValue.length; index += 1) {
3932
+ for (let index = update.startIndex; index < finalValue.length; index += 1) {
2740
3933
  const item = finalValue[index];
2741
3934
  const key = keyedRowIdentity(props.rowKey(item, index));
2742
3935
  if (knownKeys.has(key)) return void 0;
2743
3936
  knownKeys.add(key);
2744
3937
  const descriptor = props.create(item, index);
2745
- incoming.push({
3938
+ appended.push({
2746
3939
  key,
2747
3940
  element: createCompilerHostElement(root.ownerDocument, descriptor),
2748
3941
  values: readKeyedRowBindingValues(props, item, index),
@@ -2754,23 +3947,22 @@ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionT
2754
3947
  } catch {
2755
3948
  return void 0;
2756
3949
  }
2757
- for (let index = 0; index < update.retainedStart; index += 1) {
3950
+ const survivorSet = new Set(survivorResult.indices);
3951
+ for (let index = 0; index < previousInstances.length; index += 1) {
3952
+ if (survivorSet.has(index)) continue;
2758
3953
  previousInstances[index].scope?.cleanup();
2759
3954
  previousInstances[index].element.remove();
2760
3955
  }
2761
3956
  for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
2762
- if (incoming.length > 0) {
3957
+ if (appended.length > 0) {
2763
3958
  const fragment = root.ownerDocument.createDocumentFragment();
2764
- for (const instance of incoming) fragment.append(instance.element);
3959
+ for (const instance of appended) fragment.append(instance.element);
2765
3960
  root.append(fragment);
2766
3961
  }
2767
- const nextInstances = new Map(
2768
- [...survivors, ...incoming].map((instance) => [instance.key, instance])
2769
- );
2770
- return nextInstances;
3962
+ return keyedRowInstancesByKey([...survivors, ...appended]);
2771
3963
  }
2772
- function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2773
- if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
3964
+ function reconcileCompilerKeyedArrayStructuralAppendMap(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
3965
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
2774
3966
  return void 0;
2775
3967
  }
2776
3968
  const collectionDependency = props.collectionDependency;
@@ -2783,70 +3975,292 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
2783
3975
  return void 0;
2784
3976
  }
2785
3977
  const finalValue = props.items();
2786
- const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
2787
- if (!update || !Array.isArray(finalValue)) return void 0;
3978
+ const update = compilerKeyedArrayStructuralAppendMapUpdate(
3979
+ finalValue,
3980
+ collectionToken,
3981
+ instances.size,
3982
+ true
3983
+ );
3984
+ if (!update || !update.mappedItemSources || !Array.isArray(finalValue)) return void 0;
3985
+ const mappedItemSources = update.mappedSurvivorsValidated ? update.mappedItemSources : void 0;
3986
+ const mappedStructuralSources = update.mappedSurvivorsValidated ? void 0 : update.mappedItemSources;
2788
3987
  const previousInstances = [...instances.values()];
2789
- const previous = previousInstances[update.position];
2790
- if (update.kind === "remove") {
2791
- if (!previous || previous.index !== update.position) return void 0;
2792
- previous.scope?.cleanup();
2793
- previous.element.remove();
2794
- previousInstances.splice(update.position, 1);
2795
- for (let index = update.position; index < previousInstances.length; index += 1) {
2796
- previousInstances[index].index = index;
2797
- }
2798
- return new Map(previousInstances.map((instance) => [instance.key, instance]));
2799
- }
2800
- let item;
2801
- let key;
3988
+ const survivorRange = update.structuralSurvivorRange;
3989
+ const survivorIndices = update.structuralSurvivors;
3990
+ const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
3991
+ if (!survivorRange && !survivorIndices) return void 0;
3992
+ const changed = [];
3993
+ const appendedKeys = /* @__PURE__ */ new Set();
3994
+ const appended = [];
2802
3995
  try {
2803
- item = finalValue[update.position];
2804
- key = keyedRowIdentity(props.rowKey(item, update.position));
2805
- } catch {
2806
- return void 0;
2807
- }
2808
- if (update.kind === "insert") {
2809
- if (instances.has(key)) return void 0;
2810
- let inserted;
2811
- try {
2812
- const descriptor = props.create(item, update.position);
2813
- inserted = {
3996
+ if (mappedStructuralSources) {
3997
+ for (let index = 0; index < survivorCount; index += 1) {
3998
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
3999
+ const instance = previousInstances[sourceIndex];
4000
+ const item = finalValue[index];
4001
+ const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
4002
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, sourceItem)) {
4003
+ return void 0;
4004
+ }
4005
+ }
4006
+ for (let index = 0; index < survivorCount; index += 1) {
4007
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
4008
+ const instance = previousInstances[sourceIndex];
4009
+ const item = finalValue[index];
4010
+ const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
4011
+ if (Object.is(item, sourceItem)) continue;
4012
+ if (keyedRowIdentity(props.rowKey(item, index)) !== instance.key) return void 0;
4013
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
4014
+ if (!bindingUpdates) return void 0;
4015
+ changed.push({ bindingUpdates, instance, item });
4016
+ }
4017
+ } else if (survivorIndices) {
4018
+ for (let index = 0; index < survivorCount; index += 1) {
4019
+ const sourceIndex = survivorIndices[index];
4020
+ const instance = previousInstances[sourceIndex];
4021
+ const item = finalValue[index];
4022
+ const expectedItem = mappedItemSources.has(index) ? mappedItemSources.get(index) : item;
4023
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, expectedItem)) {
4024
+ return void 0;
4025
+ }
4026
+ }
4027
+ }
4028
+ for (const [index, sourceItem] of mappedItemSources || []) {
4029
+ if (!Number.isSafeInteger(index) || index < 0 || index >= survivorCount) {
4030
+ return void 0;
4031
+ }
4032
+ const instance = previousInstances[survivorRange ? survivorRange.start + index : survivorIndices[index]];
4033
+ const item = finalValue[index];
4034
+ if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
4035
+ return void 0;
4036
+ }
4037
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
4038
+ if (!bindingUpdates) return void 0;
4039
+ changed.push({ bindingUpdates, instance, item });
4040
+ }
4041
+ for (let index = update.startIndex; index < finalValue.length; index += 1) {
4042
+ const item = finalValue[index];
4043
+ const key = keyedRowIdentity(props.rowKey(item, index));
4044
+ if (instances.has(key) || appendedKeys.has(key)) return void 0;
4045
+ appendedKeys.add(key);
4046
+ const descriptor = props.create(item, index);
4047
+ appended.push({
2814
4048
  key,
2815
4049
  element: createCompilerHostElement(root.ownerDocument, descriptor),
2816
- values: readKeyedRowBindingValues(props, item, update.position),
4050
+ values: readKeyedRowBindingValues(props, item, index),
2817
4051
  item,
2818
- index: update.position,
4052
+ index,
2819
4053
  conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2820
- };
2821
- } catch {
2822
- return void 0;
4054
+ });
2823
4055
  }
2824
- root.insertBefore(inserted.element, previous?.element || null);
2825
- previousInstances.splice(update.position, 0, inserted);
2826
- for (let index = update.position + 1; index < previousInstances.length; index += 1) {
2827
- previousInstances[index].index = index;
4056
+ } catch {
4057
+ return void 0;
4058
+ }
4059
+ const mutableInstances = instances;
4060
+ if (survivorRange) {
4061
+ for (let index = 0; index < survivorRange.start; index += 1) {
4062
+ const instance = previousInstances[index];
4063
+ instance.scope?.cleanup();
4064
+ instance.element.remove();
4065
+ mutableInstances.delete(instance.key);
4066
+ }
4067
+ for (let index = survivorRange.end; index < previousInstances.length; index += 1) {
4068
+ const instance = previousInstances[index];
4069
+ instance.scope?.cleanup();
4070
+ instance.element.remove();
4071
+ mutableInstances.delete(instance.key);
4072
+ }
4073
+ for (let index = survivorRange.start; index < survivorRange.end; index += 1) {
4074
+ previousInstances[index].index = index - survivorRange.start;
4075
+ }
4076
+ } else {
4077
+ const survivorSet = new Set(survivorIndices);
4078
+ for (let index = 0; index < previousInstances.length; index += 1) {
4079
+ if (survivorSet.has(index)) continue;
4080
+ const instance = previousInstances[index];
4081
+ instance.scope?.cleanup();
4082
+ instance.element.remove();
4083
+ mutableInstances.delete(instance.key);
4084
+ }
4085
+ for (let index = 0; index < survivorIndices.length; index += 1) {
4086
+ previousInstances[survivorIndices[index]].index = index;
2828
4087
  }
2829
- return new Map(previousInstances.map((instance) => [instance.key, instance]));
2830
4088
  }
2831
- if (!previous || previous.index !== update.position) return void 0;
2832
- if (key === previous.key) {
2833
- try {
2834
- applyKeyedRowBindings(props, previous, item, update.position);
2835
- } catch {
2836
- return void 0;
4089
+ if (appended.length > 0) {
4090
+ const fragment = root.ownerDocument.createDocumentFragment();
4091
+ for (const instance of appended) {
4092
+ fragment.append(instance.element);
4093
+ mutableInstances.set(instance.key, instance);
2837
4094
  }
2838
- previous.item = item;
2839
- return instances;
4095
+ root.append(fragment);
2840
4096
  }
2841
- if (instances.has(key)) return void 0;
2842
- let replacement;
2843
- try {
2844
- const descriptor = props.create(item, update.position);
2845
- replacement = {
2846
- key,
2847
- element: createCompilerHostElement(root.ownerDocument, descriptor),
2848
- values: readKeyedRowBindingValues(props, item, update.position),
2849
- item,
4097
+ for (const { bindingUpdates, instance, item } of changed) {
4098
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
4099
+ instance.item = item;
4100
+ }
4101
+ return mutableInstances;
4102
+ }
4103
+ function reconcileCompilerKeyedArrayAppendWithStructural(...args) {
4104
+ return reconcileCompilerKeyedArrayStructuralAppend(...args) || reconcileCompilerKeyedArrayAppend(...args);
4105
+ }
4106
+ function reconcileCompilerKeyedArrayAppendMapWithStructural(...args) {
4107
+ return reconcileCompilerKeyedArrayStructuralAppendMap(...args) || reconcileCompilerKeyedArrayStructuralAppend(...args) || reconcileCompilerKeyedArrayAppend(...args);
4108
+ }
4109
+ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4110
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
4111
+ return void 0;
4112
+ }
4113
+ const collectionDependency = props.collectionDependency;
4114
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4115
+ return void 0;
4116
+ }
4117
+ const dependencies = props.dependencies || props.structureDependencies;
4118
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4119
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4120
+ return void 0;
4121
+ }
4122
+ const finalValue = props.items();
4123
+ const updates = compilerKeyedArrayRollingWindows(finalValue, collectionToken, instances.size);
4124
+ if (!updates || !Array.isArray(finalValue)) return void 0;
4125
+ const previousInstances = [...instances.values()];
4126
+ let retainedStart = 0;
4127
+ for (const update of updates) {
4128
+ retainedStart += Math.min(update.retainedStart, previousInstances.length - retainedStart);
4129
+ }
4130
+ const retainedLength = previousInstances.length - retainedStart;
4131
+ const survivors = [];
4132
+ try {
4133
+ for (let index = 0; index < retainedLength; index += 1) {
4134
+ const sourceIndex = retainedStart + index;
4135
+ const instance = previousInstances[sourceIndex];
4136
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
4137
+ return void 0;
4138
+ }
4139
+ survivors.push(instance);
4140
+ }
4141
+ } catch {
4142
+ return void 0;
4143
+ }
4144
+ const knownKeys = new Set(instances.keys());
4145
+ const incoming = [];
4146
+ try {
4147
+ for (let index = retainedLength; index < finalValue.length; index += 1) {
4148
+ const item = finalValue[index];
4149
+ const key = keyedRowIdentity(props.rowKey(item, index));
4150
+ if (knownKeys.has(key)) return void 0;
4151
+ knownKeys.add(key);
4152
+ const descriptor = props.create(item, index);
4153
+ incoming.push({
4154
+ key,
4155
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4156
+ values: readKeyedRowBindingValues(props, item, index),
4157
+ item,
4158
+ index,
4159
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4160
+ });
4161
+ }
4162
+ } catch {
4163
+ return void 0;
4164
+ }
4165
+ for (let index = 0; index < retainedStart; index += 1) {
4166
+ previousInstances[index].scope?.cleanup();
4167
+ previousInstances[index].element.remove();
4168
+ }
4169
+ for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
4170
+ if (incoming.length > 0) {
4171
+ const fragment = root.ownerDocument.createDocumentFragment();
4172
+ for (const instance of incoming) fragment.append(instance.element);
4173
+ root.append(fragment);
4174
+ }
4175
+ const nextInstances = new Map(
4176
+ [...survivors, ...incoming].map((instance) => [instance.key, instance])
4177
+ );
4178
+ return nextInstances;
4179
+ }
4180
+ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4181
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
4182
+ return void 0;
4183
+ }
4184
+ const collectionDependency = props.collectionDependency;
4185
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4186
+ return void 0;
4187
+ }
4188
+ const dependencies = props.dependencies || props.structureDependencies;
4189
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4190
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4191
+ return void 0;
4192
+ }
4193
+ const finalValue = props.items();
4194
+ const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
4195
+ if (!update || !Array.isArray(finalValue)) return void 0;
4196
+ const previousInstances = [...instances.values()];
4197
+ const previous = previousInstances[update.position];
4198
+ if (update.kind === "remove") {
4199
+ const count = update.sourceLength - update.resultLength;
4200
+ const removed = previousInstances.slice(update.position, update.position + count);
4201
+ if (removed.some((instance, index) => instance.index !== update.position + index)) {
4202
+ return void 0;
4203
+ }
4204
+ for (const instance of removed) {
4205
+ instance.scope?.cleanup();
4206
+ instance.element.remove();
4207
+ }
4208
+ previousInstances.splice(update.position, count);
4209
+ for (let index = update.position; index < previousInstances.length; index += 1) {
4210
+ previousInstances[index].index = index;
4211
+ }
4212
+ return keyedRowInstancesByKey(previousInstances);
4213
+ }
4214
+ let item;
4215
+ let key;
4216
+ try {
4217
+ item = finalValue[update.position];
4218
+ key = keyedRowIdentity(props.rowKey(item, update.position));
4219
+ } catch {
4220
+ return void 0;
4221
+ }
4222
+ if (update.kind === "insert") {
4223
+ if (instances.has(key)) return void 0;
4224
+ let inserted;
4225
+ try {
4226
+ const descriptor = props.create(item, update.position);
4227
+ inserted = {
4228
+ key,
4229
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4230
+ values: readKeyedRowBindingValues(props, item, update.position),
4231
+ item,
4232
+ index: update.position,
4233
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4234
+ };
4235
+ } catch {
4236
+ return void 0;
4237
+ }
4238
+ root.insertBefore(inserted.element, previous?.element || null);
4239
+ previousInstances.splice(update.position, 0, inserted);
4240
+ for (let index = update.position + 1; index < previousInstances.length; index += 1) {
4241
+ previousInstances[index].index = index;
4242
+ }
4243
+ return keyedRowInstancesByKey(previousInstances);
4244
+ }
4245
+ if (!previous || previous.index !== update.position) return void 0;
4246
+ if (key === previous.key) {
4247
+ try {
4248
+ applyKeyedRowBindings(props, previous, item, update.position);
4249
+ } catch {
4250
+ return void 0;
4251
+ }
4252
+ previous.item = item;
4253
+ return instances;
4254
+ }
4255
+ if (instances.has(key)) return void 0;
4256
+ let replacement;
4257
+ try {
4258
+ const descriptor = props.create(item, update.position);
4259
+ replacement = {
4260
+ key,
4261
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4262
+ values: readKeyedRowBindingValues(props, item, update.position),
4263
+ item,
2850
4264
  index: update.position,
2851
4265
  conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2852
4266
  };
@@ -2856,10 +4270,10 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
2856
4270
  previous.scope?.cleanup();
2857
4271
  previous.element.replaceWith(replacement.element);
2858
4272
  previousInstances[update.position] = replacement;
2859
- return new Map(previousInstances.map((instance) => [instance.key, instance]));
4273
+ return keyedRowInstancesByKey(previousInstances);
2860
4274
  }
2861
- function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2862
- if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
4275
+ function reconcileCompilerKeyedArrayBatchInsert(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4276
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
2863
4277
  return void 0;
2864
4278
  }
2865
4279
  const collectionDependency = props.collectionDependency;
@@ -2872,10 +4286,502 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
2872
4286
  return void 0;
2873
4287
  }
2874
4288
  const finalValue = props.items();
2875
- const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
4289
+ const update = compilerKeyedArrayBatchInsert(finalValue, collectionToken, instances.size);
2876
4290
  if (!update || !Array.isArray(finalValue)) return void 0;
2877
4291
  const previousInstances = [...instances.values()];
2878
- if (update.kind === "sort") {
4292
+ const insertCount = update.resultLength - update.sourceLength;
4293
+ for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
4294
+ const instance = previousInstances[sourceIndex];
4295
+ const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex + insertCount;
4296
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[resultIndex])) {
4297
+ return void 0;
4298
+ }
4299
+ }
4300
+ const knownKeys = new Set(instances.keys());
4301
+ const incoming = [];
4302
+ try {
4303
+ for (let offset = 0; offset < insertCount; offset += 1) {
4304
+ const index = update.position + offset;
4305
+ const item = finalValue[index];
4306
+ const key = keyedRowIdentity(props.rowKey(item, index));
4307
+ if (knownKeys.has(key)) return void 0;
4308
+ knownKeys.add(key);
4309
+ const descriptor = props.create(item, index);
4310
+ incoming.push({
4311
+ key,
4312
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4313
+ values: readKeyedRowBindingValues(props, item, index),
4314
+ item,
4315
+ index,
4316
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4317
+ });
4318
+ }
4319
+ } catch {
4320
+ return void 0;
4321
+ }
4322
+ const fragment = root.ownerDocument.createDocumentFragment();
4323
+ for (const instance of incoming) fragment.append(instance.element);
4324
+ root.insertBefore(fragment, previousInstances[update.position]?.element || null);
4325
+ previousInstances.splice(update.position, 0, ...incoming);
4326
+ for (let index = update.position + insertCount; index < previousInstances.length; index += 1) {
4327
+ previousInstances[index].index = index;
4328
+ }
4329
+ return keyedRowInstancesByKey(previousInstances);
4330
+ }
4331
+ function normalizeCompilerKeyedArrayDisjointWindows(updates) {
4332
+ const windows = [];
4333
+ for (const update of updates) {
4334
+ const updateEnd = update.position + update.removedCount;
4335
+ let sourcePosition = update.position;
4336
+ for (const window of windows) {
4337
+ const windowStart = window[1];
4338
+ const windowEnd = windowStart + window[3];
4339
+ const before = updateEnd <= windowStart;
4340
+ const after = window[3] === 0 ? update.position >= windowStart : update.position >= windowEnd;
4341
+ if (!before && !after) return void 0;
4342
+ if (after) sourcePosition -= window[3] - window[2];
4343
+ }
4344
+ const delta = update.insertedCount - update.removedCount;
4345
+ for (const window of windows) {
4346
+ if (updateEnd <= window[1]) window[1] += delta;
4347
+ }
4348
+ windows.push([sourcePosition, update.position, update.removedCount, update.insertedCount]);
4349
+ }
4350
+ windows.sort((left, right) => left[0] - right[0]);
4351
+ return windows;
4352
+ }
4353
+ function readCompilerKeyedArrayWindowItems(props, finalValue, resultPosition, insertedCount) {
4354
+ const items = [];
4355
+ const keys = [];
4356
+ try {
4357
+ for (let offset = 0; offset < insertedCount; offset += 1) {
4358
+ const index = resultPosition + offset;
4359
+ const item = finalValue[index];
4360
+ items.push(item);
4361
+ keys.push(keyedRowIdentity(props.rowKey(item, index)));
4362
+ }
4363
+ } catch {
4364
+ return void 0;
4365
+ }
4366
+ return [items, keys];
4367
+ }
4368
+ function prepareCompilerKeyedArrayWindow(props, instances, previousInstances, root, window, incoming, preparedIncomingKeys) {
4369
+ const removedEnd = window[0] + window[2];
4370
+ const removed = previousInstances.slice(window[0], removedEnd);
4371
+ const anchor = previousInstances[removedEnd]?.element || null;
4372
+ if (removed.length !== window[2] || removed.some(
4373
+ (instance, offset) => instance.index !== window[0] + offset || instance.element.parentNode !== root
4374
+ ) || anchor && anchor.parentNode !== root) {
4375
+ return void 0;
4376
+ }
4377
+ const incomingKeySet = new Set(incoming[1]);
4378
+ if (incomingKeySet.size !== incoming[1].length) return void 0;
4379
+ for (const key of incomingKeySet) {
4380
+ if (preparedIncomingKeys.has(key)) return void 0;
4381
+ preparedIncomingKeys.add(key);
4382
+ }
4383
+ const hasLocalReuse = removed.some((instance) => incomingKeySet.has(instance.key));
4384
+ const removedByKey = hasLocalReuse ? new Map(removed.map((instance, offset) => [instance.key, { instance, offset }])) : void 0;
4385
+ const nextWindow = [];
4386
+ const sequence = [];
4387
+ const preparedBindings = [];
4388
+ try {
4389
+ for (let offset = 0; offset < window[3]; offset += 1) {
4390
+ const index = window[1] + offset;
4391
+ const item = incoming[0][offset];
4392
+ const key = incoming[1][offset];
4393
+ const retained = removedByKey?.get(key);
4394
+ if (retained) {
4395
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, retained.instance, item, index);
4396
+ if (!bindingUpdates) return void 0;
4397
+ nextWindow.push(retained.instance);
4398
+ sequence.push(retained.offset);
4399
+ preparedBindings.push(bindingUpdates);
4400
+ continue;
4401
+ }
4402
+ if (instances.has(key)) return void 0;
4403
+ const descriptor = props.create(item, index);
4404
+ nextWindow.push({
4405
+ key,
4406
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4407
+ values: readKeyedRowBindingValues(props, item, index),
4408
+ item,
4409
+ index,
4410
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4411
+ });
4412
+ sequence.push(-1);
4413
+ preparedBindings.push(void 0);
4414
+ }
4415
+ } catch {
4416
+ return void 0;
4417
+ }
4418
+ return [removed, anchor, incoming[0], incomingKeySet, nextWindow, sequence, preparedBindings];
4419
+ }
4420
+ function commitCompilerKeyedArrayWindow(props, root, prepared) {
4421
+ for (const instance of prepared[0]) {
4422
+ if (prepared[3].has(instance.key)) continue;
4423
+ instance.scope?.cleanup();
4424
+ instance.element.remove();
4425
+ }
4426
+ for (let offset = 0; offset < prepared[4].length; offset += 1) {
4427
+ const bindingUpdates = prepared[6][offset];
4428
+ if (!bindingUpdates) continue;
4429
+ const instance = prepared[4][offset];
4430
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
4431
+ instance.item = prepared[2][offset];
4432
+ }
4433
+ reorderCompilerKeyedRows(root, prepared[4], prepared[5], prepared[1]);
4434
+ }
4435
+ function reconcileCompilerKeyedArrayWindowReplace(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4436
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
4437
+ return void 0;
4438
+ }
4439
+ const collectionDependency = props.collectionDependency;
4440
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4441
+ return void 0;
4442
+ }
4443
+ const dependencies = props.dependencies || props.structureDependencies;
4444
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4445
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4446
+ return void 0;
4447
+ }
4448
+ const finalValue = props.items();
4449
+ const updates = compilerKeyedArrayWindowReplacements(finalValue, collectionToken, instances.size);
4450
+ if (!updates || !Array.isArray(finalValue)) return void 0;
4451
+ const previousInstances = [...instances.values()];
4452
+ if (updates.length > 1) {
4453
+ if (updates.some((update2) => update2.insertedCount !== update2.removedCount)) {
4454
+ const windows = normalizeCompilerKeyedArrayDisjointWindows(updates);
4455
+ if (!windows) return void 0;
4456
+ let sourceCursor = 0;
4457
+ let resultCursor = 0;
4458
+ const preparedIncomingKeys = /* @__PURE__ */ new Set();
4459
+ const preparedWindows = [];
4460
+ const nextInstances = [];
4461
+ for (const window of windows) {
4462
+ if (window[0] < sourceCursor) return void 0;
4463
+ while (sourceCursor < window[0]) {
4464
+ const instance = previousInstances[sourceCursor];
4465
+ if (!instance || instance.index !== sourceCursor || !Object.is(instance.item, finalValue[resultCursor])) {
4466
+ return void 0;
4467
+ }
4468
+ nextInstances.push(instance);
4469
+ sourceCursor += 1;
4470
+ resultCursor += 1;
4471
+ }
4472
+ const incoming2 = readCompilerKeyedArrayWindowItems(
4473
+ props,
4474
+ finalValue,
4475
+ resultCursor,
4476
+ window[3]
4477
+ );
4478
+ if (!incoming2) return void 0;
4479
+ window[1] = resultCursor;
4480
+ const prepared3 = prepareCompilerKeyedArrayWindow(
4481
+ props,
4482
+ instances,
4483
+ previousInstances,
4484
+ root,
4485
+ window,
4486
+ incoming2,
4487
+ preparedIncomingKeys
4488
+ );
4489
+ if (!prepared3) return void 0;
4490
+ preparedWindows.push(prepared3);
4491
+ nextInstances.push(...prepared3[4]);
4492
+ sourceCursor += window[2];
4493
+ resultCursor += window[3];
4494
+ }
4495
+ while (sourceCursor < previousInstances.length) {
4496
+ const instance = previousInstances[sourceCursor];
4497
+ if (!instance || instance.index !== sourceCursor || !Object.is(instance.item, finalValue[resultCursor])) {
4498
+ return void 0;
4499
+ }
4500
+ nextInstances.push(instance);
4501
+ sourceCursor += 1;
4502
+ resultCursor += 1;
4503
+ }
4504
+ if (resultCursor !== finalValue.length) return void 0;
4505
+ for (const prepared3 of preparedWindows) {
4506
+ commitCompilerKeyedArrayWindow(props, root, prepared3);
4507
+ }
4508
+ for (let index = 0; index < nextInstances.length; index += 1) {
4509
+ nextInstances[index].index = index;
4510
+ }
4511
+ return keyedRowInstancesByKey(nextInstances);
4512
+ }
4513
+ const touchedIndices = /* @__PURE__ */ new Set();
4514
+ for (const update2 of updates) {
4515
+ for (let index = update2.position; index < update2.position + update2.removedCount; index += 1) {
4516
+ touchedIndices.add(index);
4517
+ }
4518
+ }
4519
+ for (let index = 0; index < previousInstances.length; index += 1) {
4520
+ const instance = previousInstances[index];
4521
+ const touched = touchedIndices.has(index);
4522
+ if (!instance || instance.index !== index || (touched ? instance.element.parentNode !== root : !Object.is(instance.item, finalValue[index]))) {
4523
+ return void 0;
4524
+ }
4525
+ }
4526
+ const knownKeys = new Set(instances.keys());
4527
+ const incomingKeys2 = /* @__PURE__ */ new Set();
4528
+ let replacesRows = false;
4529
+ const prepared2 = [];
4530
+ try {
4531
+ for (const index of [...touchedIndices].sort((left, right) => left - right)) {
4532
+ const instance = previousInstances[index];
4533
+ const item = finalValue[index];
4534
+ const key = keyedRowIdentity(props.rowKey(item, index));
4535
+ if (key !== instance.key) {
4536
+ if (knownKeys.has(key) || incomingKeys2.has(key)) return void 0;
4537
+ incomingKeys2.add(key);
4538
+ replacesRows = true;
4539
+ const descriptor = props.create(item, index);
4540
+ prepared2.push([
4541
+ index,
4542
+ instance,
4543
+ item,
4544
+ void 0,
4545
+ {
4546
+ key,
4547
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4548
+ values: readKeyedRowBindingValues(props, item, index),
4549
+ item,
4550
+ index,
4551
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4552
+ }
4553
+ ]);
4554
+ continue;
4555
+ }
4556
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
4557
+ if (!bindingUpdates) return void 0;
4558
+ prepared2.push([index, instance, item, bindingUpdates, void 0]);
4559
+ }
4560
+ } catch {
4561
+ return void 0;
4562
+ }
4563
+ for (const [index, instance, item, bindingUpdates, replacement] of prepared2) {
4564
+ if (replacement) {
4565
+ instance.scope?.cleanup();
4566
+ instance.element.replaceWith(replacement.element);
4567
+ previousInstances[index] = replacement;
4568
+ } else {
4569
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
4570
+ instance.item = item;
4571
+ }
4572
+ }
4573
+ return replacesRows ? keyedRowInstancesByKey(previousInstances) : instances;
4574
+ }
4575
+ const update = updates[0];
4576
+ const removedEnd = update.position + update.removedCount;
4577
+ for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
4578
+ const instance = previousInstances[sourceIndex];
4579
+ if (!instance || instance.index !== sourceIndex) return void 0;
4580
+ if (sourceIndex >= update.position && sourceIndex < removedEnd) continue;
4581
+ const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex - update.removedCount + update.insertedCount;
4582
+ if (!Object.is(instance.item, finalValue[resultIndex])) return void 0;
4583
+ }
4584
+ const removed = previousInstances.slice(update.position, removedEnd);
4585
+ const anchor = previousInstances[removedEnd]?.element;
4586
+ if (removed.length !== update.removedCount || removed.some((instance) => instance.element.parentNode !== root) || anchor && anchor.parentNode !== root) {
4587
+ return void 0;
4588
+ }
4589
+ const incoming = readCompilerKeyedArrayWindowItems(
4590
+ props,
4591
+ finalValue,
4592
+ update.position,
4593
+ update.insertedCount
4594
+ );
4595
+ if (!incoming) return void 0;
4596
+ const incomingItems = incoming[0];
4597
+ const incomingKeys = incoming[1];
4598
+ if (update.insertedCount === update.removedCount && incomingKeys.every((key, offset) => key === removed[offset].key)) {
4599
+ const prepared2 = [];
4600
+ try {
4601
+ for (let offset = 0; offset < update.insertedCount; offset += 1) {
4602
+ const updates2 = prepareKeyedRowBindingUpdates(
4603
+ props,
4604
+ removed[offset],
4605
+ incomingItems[offset],
4606
+ update.position + offset
4607
+ );
4608
+ if (!updates2) return void 0;
4609
+ prepared2.push(updates2);
4610
+ }
4611
+ } catch {
4612
+ return void 0;
4613
+ }
4614
+ for (let offset = 0; offset < update.insertedCount; offset += 1) {
4615
+ applyPreparedKeyedRowBindingUpdates(props, removed[offset], prepared2[offset]);
4616
+ removed[offset].item = incomingItems[offset];
4617
+ }
4618
+ return instances;
4619
+ }
4620
+ const prepared = prepareCompilerKeyedArrayWindow(
4621
+ props,
4622
+ instances,
4623
+ previousInstances,
4624
+ root,
4625
+ [update.position, update.position, update.removedCount, update.insertedCount],
4626
+ incoming,
4627
+ /* @__PURE__ */ new Set()
4628
+ );
4629
+ if (!prepared) return void 0;
4630
+ commitCompilerKeyedArrayWindow(props, root, prepared);
4631
+ previousInstances.splice(update.position, update.removedCount, ...prepared[4]);
4632
+ for (let index = update.position; index < previousInstances.length; index += 1) {
4633
+ previousInstances[index].index = index;
4634
+ }
4635
+ return keyedRowInstancesByKey(previousInstances);
4636
+ }
4637
+ function reconcileCompilerKeyedArrayPositionWithBatch(...args) {
4638
+ return reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
4639
+ }
4640
+ function reconcileCompilerKeyedArrayPositionWithWindow(...args) {
4641
+ return reconcileCompilerKeyedArrayWindowReplace(...args) || reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
4642
+ }
4643
+ function reconcileCompilerKeyedArrayStructuralReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
4644
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
4645
+ return void 0;
4646
+ }
4647
+ const collectionDependency = props.collectionDependency;
4648
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4649
+ return void 0;
4650
+ }
4651
+ const dependencies = props.dependencies || props.structureDependencies;
4652
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4653
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4654
+ return void 0;
4655
+ }
4656
+ const finalValue = preparedReorder?.value ?? props.items();
4657
+ const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
4658
+ if (!update?.structuralUpdate || !Array.isArray(finalValue)) return void 0;
4659
+ const survivorResult = compilerKeyedArrayFilterSurvivorsFromUpdate(
4660
+ update.structuralUpdate,
4661
+ collectionToken,
4662
+ instances.size,
4663
+ finalValue.length
4664
+ );
4665
+ if (!survivorResult) return void 0;
4666
+ const previousInstances = [...instances.values()];
4667
+ const mappedItemSources = update.mappedItemSources;
4668
+ const prepared = (() => {
4669
+ try {
4670
+ const survivors = [];
4671
+ let previousSourceIndex = -1;
4672
+ for (const sourceIndex of survivorResult.indices) {
4673
+ const instance = previousInstances[sourceIndex];
4674
+ if (sourceIndex <= previousSourceIndex || !instance || instance.index !== sourceIndex) {
4675
+ return void 0;
4676
+ }
4677
+ previousSourceIndex = sourceIndex;
4678
+ survivors.push(instance);
4679
+ }
4680
+ const prepareChangedInstance = (instance, item, targetIndex) => {
4681
+ if (Object.is(instance.item, item)) return void 0;
4682
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, targetIndex);
4683
+ if (!bindingUpdates) throw new TypeError();
4684
+ return { bindingUpdates, instance, item };
4685
+ };
4686
+ let preservesSurvivorOrder = true;
4687
+ const directChanges = [];
4688
+ if (update.kind !== 1 /* Permutation */) {
4689
+ const positionalInstances = update.kind === 0 /* Reverse */ ? [...survivors].reverse() : survivors;
4690
+ const sequence2 = update.kind === 0 /* Reverse */ ? positionalInstances.map((instance) => instance.index) : void 0;
4691
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
4692
+ const item = finalValue[targetIndex];
4693
+ const instance = positionalInstances[targetIndex];
4694
+ if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
4695
+ const changed2 = prepareChangedInstance(instance, item, targetIndex);
4696
+ if (changed2) directChanges.push(changed2);
4697
+ }
4698
+ return { changed: directChanges, nextInstances: positionalInstances, sequence: sequence2 };
4699
+ }
4700
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
4701
+ const item = finalValue[targetIndex];
4702
+ const instance = survivors[targetIndex];
4703
+ const sourceItem = mappedItemSources?.has(item) ? mappedItemSources.get(item) : item;
4704
+ if (!Object.is(instance.item, sourceItem)) {
4705
+ preservesSurvivorOrder = false;
4706
+ break;
4707
+ }
4708
+ if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
4709
+ const changed2 = prepareChangedInstance(instance, item, targetIndex);
4710
+ if (changed2) directChanges.push(changed2);
4711
+ }
4712
+ if (preservesSurvivorOrder) {
4713
+ return { changed: directChanges, nextInstances: survivors, sequence: void 0 };
4714
+ }
4715
+ const survivorInstances = /* @__PURE__ */ new Map();
4716
+ for (const instance of survivors) {
4717
+ if (survivorInstances.has(instance.item)) return void 0;
4718
+ survivorInstances.set(instance.item, instance);
4719
+ }
4720
+ const nextInstances = [];
4721
+ const sequence = [];
4722
+ const changed = [];
4723
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
4724
+ const item = finalValue[targetIndex];
4725
+ const sourceItem = mappedItemSources?.has(item) ? mappedItemSources.get(item) : item;
4726
+ const instance = survivorInstances.get(sourceItem);
4727
+ if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) {
4728
+ return void 0;
4729
+ }
4730
+ survivorInstances.delete(sourceItem);
4731
+ nextInstances.push(instance);
4732
+ sequence.push(instance.index);
4733
+ const changedInstance = prepareChangedInstance(instance, item, targetIndex);
4734
+ if (changedInstance) changed.push(changedInstance);
4735
+ }
4736
+ if (survivorInstances.size > 0) return void 0;
4737
+ return { changed, nextInstances, sequence };
4738
+ } catch {
4739
+ return void 0;
4740
+ }
4741
+ })();
4742
+ if (!prepared) return void 0;
4743
+ let survivorCursor = 0;
4744
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
4745
+ if (survivorResult.indices[survivorCursor] === sourceIndex) {
4746
+ survivorCursor += 1;
4747
+ continue;
4748
+ }
4749
+ const instance = previousInstances[sourceIndex];
4750
+ instance.scope?.cleanup();
4751
+ instance.element.remove();
4752
+ }
4753
+ if (prepared.sequence) {
4754
+ reorderCompilerKeyedRows(root, prepared.nextInstances, prepared.sequence, null);
4755
+ }
4756
+ for (const { bindingUpdates, instance, item } of prepared.changed) {
4757
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
4758
+ instance.item = item;
4759
+ }
4760
+ for (let index = 0; index < prepared.nextInstances.length; index += 1) {
4761
+ prepared.nextInstances[index].index = index;
4762
+ }
4763
+ return keyedRowInstancesByKey(prepared.nextInstances);
4764
+ }
4765
+ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
4766
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
4767
+ return void 0;
4768
+ }
4769
+ const collectionDependency = props.collectionDependency;
4770
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4771
+ return void 0;
4772
+ }
4773
+ const dependencies = props.dependencies || props.structureDependencies;
4774
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4775
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4776
+ return void 0;
4777
+ }
4778
+ const finalValue = preparedReorder?.value ?? props.items();
4779
+ const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
4780
+ if (!update || update.mapped || update.structuralUpdate || !Array.isArray(finalValue)) {
4781
+ return void 0;
4782
+ }
4783
+ const previousInstances = [...instances.values()];
4784
+ if (update.kind === 1 /* Permutation */) {
2879
4785
  const instancesByItem = /* @__PURE__ */ new Map();
2880
4786
  try {
2881
4787
  for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
@@ -2894,30 +4800,19 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
2894
4800
  sequence.push(instance.index);
2895
4801
  }
2896
4802
  if (instancesByItem.size > 0) return void 0;
2897
- const activeElement2 = root.ownerDocument.activeElement;
2898
- const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
2899
- const stablePositions = longestIncreasingSubsequencePositions(sequence);
2900
- let anchor2 = null;
2901
- for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
2902
- const instance = nextInstances[index];
2903
- if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
2904
- root.insertBefore(instance.element, anchor2);
2905
- }
2906
- anchor2 = instance.element;
2907
- instance.index = index;
4803
+ reorderCompilerKeyedRows(root, nextInstances, sequence, null);
4804
+ for (let index = 0; index < nextInstances.length; index += 1) {
4805
+ nextInstances[index].index = index;
2908
4806
  }
2909
- if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
2910
- activeElement2.focus({ preventScroll: true });
2911
- }
2912
- return new Map(nextInstances.map((instance) => [instance.key, instance]));
4807
+ return keyedRowInstancesByKey(nextInstances);
2913
4808
  } catch {
2914
4809
  return void 0;
2915
4810
  }
2916
4811
  }
2917
4812
  try {
2918
- for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
4813
+ for (let targetIndex = 0; targetIndex < previousInstances.length; targetIndex += 1) {
4814
+ const sourceIndex = update.kind === 0 /* Reverse */ ? previousInstances.length - targetIndex - 1 : targetIndex;
2919
4815
  const instance = previousInstances[sourceIndex];
2920
- const targetIndex = previousInstances.length - sourceIndex - 1;
2921
4816
  if (instance.index !== sourceIndex || !Object.is(instance.item, finalValue[targetIndex])) {
2922
4817
  return void 0;
2923
4818
  }
@@ -2925,22 +4820,41 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
2925
4820
  } catch {
2926
4821
  return void 0;
2927
4822
  }
2928
- const activeElement = root.ownerDocument.activeElement;
2929
- const restoreFocus = Boolean(activeElement && root.contains(activeElement));
2930
- let anchor = previousInstances[0]?.element || null;
2931
- for (let sourceIndex = 1; sourceIndex < previousInstances.length; sourceIndex += 1) {
2932
- const element = previousInstances[sourceIndex].element;
2933
- root.insertBefore(element, anchor);
2934
- anchor = element;
4823
+ if (update.kind === void 0) return instances;
4824
+ reverseCompilerKeyedRows(root, previousInstances);
4825
+ return keyedRowInstancesByKey(previousInstances);
4826
+ }
4827
+ function prepareCompilerKeyedArrayReorder(args) {
4828
+ const [props, dirtyState, collectionToken, instances, , reactOwnedRows] = args;
4829
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
4830
+ return void 0;
2935
4831
  }
2936
- previousInstances.reverse();
2937
- for (let index = 0; index < previousInstances.length; index += 1) {
2938
- previousInstances[index].index = index;
4832
+ const collectionDependency = props.collectionDependency;
4833
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4834
+ return void 0;
2939
4835
  }
2940
- if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
2941
- activeElement.focus({ preventScroll: true });
4836
+ const dependencies = props.dependencies || props.structureDependencies;
4837
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4838
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4839
+ return void 0;
2942
4840
  }
2943
- return new Map(previousInstances.map((instance) => [instance.key, instance]));
4841
+ const value = props.items();
4842
+ return {
4843
+ update: compilerKeyedArrayReorder(value, collectionToken, instances.size),
4844
+ value
4845
+ };
4846
+ }
4847
+ function reconcileCompilerKeyedArrayReorderWithMap(...args) {
4848
+ const prepared = prepareCompilerKeyedArrayReorder(args);
4849
+ if (!prepared) return void 0;
4850
+ const reconcile = prepared.update?.mapped ? reconcileCompilerKeyedArrayMapReorder : reconcileCompilerKeyedArrayReorder;
4851
+ return reconcile(args[0], args[1], args[2], args[3], args[4], args[5], prepared);
4852
+ }
4853
+ function reconcileCompilerKeyedArrayReorderWithMapAndStructural(...args) {
4854
+ const prepared = prepareCompilerKeyedArrayReorder(args);
4855
+ if (!prepared) return void 0;
4856
+ const reconcile = prepared.update?.structuralUpdate ? reconcileCompilerKeyedArrayStructuralReorder : prepared.update?.mapped ? reconcileCompilerKeyedArrayMapReorder : reconcileCompilerKeyedArrayReorder;
4857
+ return reconcile(args[0], args[1], args[2], args[3], args[4], args[5], prepared);
2944
4858
  }
2945
4859
  function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2946
4860
  if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.prependIndexIndependent || props.collectionDependency === void 0) {
@@ -2968,7 +4882,192 @@ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken,
2968
4882
  const knownKeys = new Set(instances.keys());
2969
4883
  const prepended = [];
2970
4884
  try {
2971
- for (let index = 0; index < prefixLength; index += 1) {
4885
+ for (let index = 0; index < prefixLength; index += 1) {
4886
+ const item = finalValue[index];
4887
+ const key = keyedRowIdentity(props.rowKey(item, index));
4888
+ if (knownKeys.has(key)) return void 0;
4889
+ knownKeys.add(key);
4890
+ const descriptor = props.create(item, index);
4891
+ prepended.push({
4892
+ key,
4893
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4894
+ values: readKeyedRowBindingValues(props, item, index),
4895
+ item,
4896
+ index,
4897
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4898
+ });
4899
+ }
4900
+ } catch {
4901
+ return void 0;
4902
+ }
4903
+ if (prepended.length > 0) {
4904
+ const fragment = root.ownerDocument.createDocumentFragment();
4905
+ for (const instance of prepended) fragment.append(instance.element);
4906
+ root.insertBefore(fragment, root.firstChild);
4907
+ }
4908
+ for (let index = 0; index < previousInstances.length; index += 1) {
4909
+ previousInstances[index].index = prefixLength + index;
4910
+ }
4911
+ return keyedRowInstancesByKey([...prepended, ...previousInstances]);
4912
+ }
4913
+ function reconcileCompilerKeyedArrayStructuralPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4914
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.prependIndexIndependent || props.collectionDependency === void 0) {
4915
+ return void 0;
4916
+ }
4917
+ const collectionDependency = props.collectionDependency;
4918
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4919
+ return void 0;
4920
+ }
4921
+ const dependencies = props.dependencies || props.structureDependencies;
4922
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4923
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4924
+ return void 0;
4925
+ }
4926
+ const finalValue = props.items();
4927
+ const update = compilerKeyedArrayStructuralPrependUpdate(
4928
+ finalValue,
4929
+ collectionToken,
4930
+ instances.size
4931
+ );
4932
+ const structuralUpdate = update?.structuralUpdate;
4933
+ const survivorResult = update?.structuralSurvivors;
4934
+ if (!update || !structuralUpdate || !survivorResult || structuralUpdate.mappedItemSources || !Array.isArray(finalValue)) {
4935
+ return void 0;
4936
+ }
4937
+ const previousInstances = [...instances.values()];
4938
+ const survivors = [];
4939
+ const knownKeys = new Set(instances.keys());
4940
+ const prepended = [];
4941
+ try {
4942
+ for (let index = 0; index < survivorResult.indices.length; index += 1) {
4943
+ const sourceIndex = survivorResult.indices[index];
4944
+ const instance = previousInstances[sourceIndex];
4945
+ const item = finalValue[update.prefixLength + index];
4946
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !survivorResult.keysStable && keyedRowIdentity(props.rowKey(item, update.prefixLength + index)) !== instance.key) {
4947
+ return void 0;
4948
+ }
4949
+ survivors.push(instance);
4950
+ }
4951
+ for (let index = 0; index < update.prefixLength; index += 1) {
4952
+ const item = finalValue[index];
4953
+ const key = keyedRowIdentity(props.rowKey(item, index));
4954
+ if (knownKeys.has(key)) return void 0;
4955
+ knownKeys.add(key);
4956
+ const descriptor = props.create(item, index);
4957
+ prepended.push({
4958
+ key,
4959
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
4960
+ values: readKeyedRowBindingValues(props, item, index),
4961
+ item,
4962
+ index,
4963
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
4964
+ });
4965
+ }
4966
+ } catch {
4967
+ return void 0;
4968
+ }
4969
+ const survivorSet = new Set(survivorResult.indices);
4970
+ for (let index = 0; index < previousInstances.length; index += 1) {
4971
+ if (survivorSet.has(index)) continue;
4972
+ previousInstances[index].scope?.cleanup();
4973
+ previousInstances[index].element.remove();
4974
+ }
4975
+ if (prepended.length > 0) {
4976
+ const fragment = root.ownerDocument.createDocumentFragment();
4977
+ for (const instance of prepended) fragment.append(instance.element);
4978
+ root.insertBefore(fragment, survivors[0]?.element || root.firstChild);
4979
+ }
4980
+ for (let index = 0; index < survivors.length; index += 1) {
4981
+ survivors[index].index = update.prefixLength + index;
4982
+ }
4983
+ return keyedRowInstancesByKey([...prepended, ...survivors]);
4984
+ }
4985
+ function reconcileCompilerKeyedArrayStructuralPrependMap(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
4986
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.prependIndexIndependent || props.collectionDependency === void 0) {
4987
+ return void 0;
4988
+ }
4989
+ const collectionDependency = props.collectionDependency;
4990
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
4991
+ return void 0;
4992
+ }
4993
+ const dependencies = props.dependencies || props.structureDependencies;
4994
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
4995
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
4996
+ return void 0;
4997
+ }
4998
+ const finalValue = props.items();
4999
+ const update = compilerKeyedArrayStructuralPrependMapUpdate(
5000
+ finalValue,
5001
+ collectionToken,
5002
+ instances.size,
5003
+ true
5004
+ );
5005
+ if (!update || !update.mappedItemSources || !Array.isArray(finalValue)) return void 0;
5006
+ const mappedItemSources = update.mappedSurvivorsValidated ? update.mappedItemSources : void 0;
5007
+ const mappedStructuralSources = update.mappedSurvivorsValidated ? void 0 : update.mappedItemSources;
5008
+ const previousInstances = [...instances.values()];
5009
+ const survivorRange = update.structuralSurvivorRange;
5010
+ const survivorIndices = update.structuralSurvivors;
5011
+ const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
5012
+ if (!survivorRange && !survivorIndices) return void 0;
5013
+ const changed = [];
5014
+ const knownKeys = new Set(instances.keys());
5015
+ const prepended = [];
5016
+ try {
5017
+ if (mappedStructuralSources) {
5018
+ for (let index = 0; index < survivorCount; index += 1) {
5019
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
5020
+ const instance = previousInstances[sourceIndex];
5021
+ const item = finalValue[update.prefixLength + index];
5022
+ const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
5023
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, sourceItem)) {
5024
+ return void 0;
5025
+ }
5026
+ }
5027
+ for (let index = 0; index < survivorCount; index += 1) {
5028
+ const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
5029
+ const instance = previousInstances[sourceIndex];
5030
+ const item = finalValue[update.prefixLength + index];
5031
+ const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
5032
+ if (Object.is(item, sourceItem)) continue;
5033
+ if (keyedRowIdentity(props.rowKey(item, update.prefixLength + index)) !== instance.key) {
5034
+ return void 0;
5035
+ }
5036
+ const bindingUpdates = prepareKeyedRowBindingUpdates(
5037
+ props,
5038
+ instance,
5039
+ item,
5040
+ update.prefixLength + index
5041
+ );
5042
+ if (!bindingUpdates) return void 0;
5043
+ changed.push({ bindingUpdates, instance, item });
5044
+ }
5045
+ } else if (survivorIndices) {
5046
+ for (let index = 0; index < survivorCount; index += 1) {
5047
+ const sourceIndex = survivorIndices[index];
5048
+ const instance = previousInstances[sourceIndex];
5049
+ const item = finalValue[update.prefixLength + index];
5050
+ const expectedItem = mappedItemSources.has(index) ? mappedItemSources.get(index) : item;
5051
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, expectedItem)) {
5052
+ return void 0;
5053
+ }
5054
+ }
5055
+ }
5056
+ for (const [index, sourceItem] of mappedItemSources || []) {
5057
+ if (!Number.isSafeInteger(index) || index < 0 || index >= survivorCount) {
5058
+ return void 0;
5059
+ }
5060
+ const instance = previousInstances[survivorRange ? survivorRange.start + index : survivorIndices[index]];
5061
+ const finalIndex = update.prefixLength + index;
5062
+ const item = finalValue[finalIndex];
5063
+ if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, finalIndex)) !== instance.key) {
5064
+ return void 0;
5065
+ }
5066
+ const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, finalIndex);
5067
+ if (!bindingUpdates) return void 0;
5068
+ changed.push({ bindingUpdates, instance, item });
5069
+ }
5070
+ for (let index = 0; index < update.prefixLength; index += 1) {
2972
5071
  const item = finalValue[index];
2973
5072
  const key = keyedRowIdentity(props.rowKey(item, index));
2974
5073
  if (knownKeys.has(key)) return void 0;
@@ -2986,15 +5085,43 @@ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken,
2986
5085
  } catch {
2987
5086
  return void 0;
2988
5087
  }
5088
+ if (survivorRange) {
5089
+ for (let index = 0; index < survivorRange.start; index += 1) {
5090
+ previousInstances[index].scope?.cleanup();
5091
+ previousInstances[index].element.remove();
5092
+ }
5093
+ for (let index = survivorRange.end; index < previousInstances.length; index += 1) {
5094
+ previousInstances[index].scope?.cleanup();
5095
+ previousInstances[index].element.remove();
5096
+ }
5097
+ } else {
5098
+ const survivorSet = new Set(survivorIndices);
5099
+ for (let index = 0; index < previousInstances.length; index += 1) {
5100
+ if (survivorSet.has(index)) continue;
5101
+ previousInstances[index].scope?.cleanup();
5102
+ previousInstances[index].element.remove();
5103
+ }
5104
+ }
5105
+ const survivors = survivorRange ? previousInstances.slice(survivorRange.start, survivorRange.end) : survivorIndices.map((index) => previousInstances[index]);
2989
5106
  if (prepended.length > 0) {
2990
5107
  const fragment = root.ownerDocument.createDocumentFragment();
2991
5108
  for (const instance of prepended) fragment.append(instance.element);
2992
- root.insertBefore(fragment, root.firstChild);
5109
+ root.insertBefore(fragment, survivors[0]?.element || root.firstChild);
2993
5110
  }
2994
- for (let index = 0; index < previousInstances.length; index += 1) {
2995
- previousInstances[index].index = prefixLength + index;
5111
+ for (let index = 0; index < survivors.length; index += 1) {
5112
+ survivors[index].index = update.prefixLength + index;
5113
+ }
5114
+ for (const { bindingUpdates, instance, item } of changed) {
5115
+ applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
5116
+ instance.item = item;
2996
5117
  }
2997
- return new Map([...prepended, ...previousInstances].map((instance) => [instance.key, instance]));
5118
+ return keyedRowInstancesByKey([...prepended, ...survivors]);
5119
+ }
5120
+ function reconcileCompilerKeyedArrayPrependWithStructural(...args) {
5121
+ return reconcileCompilerKeyedArrayStructuralPrepend(...args) || reconcileCompilerKeyedArrayPrepend(...args);
5122
+ }
5123
+ function reconcileCompilerKeyedArrayPrependMapWithStructural(...args) {
5124
+ return reconcileCompilerKeyedArrayStructuralPrependMap(...args) || reconcileCompilerKeyedArrayStructuralPrepend(...args) || reconcileCompilerKeyedArrayPrepend(...args);
2998
5125
  }
2999
5126
  function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, instances, reactOwnedRows) {
3000
5127
  if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
@@ -3041,7 +5168,7 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
3041
5168
  for (let index = 0; index < survivors.length; index += 1) {
3042
5169
  survivors[index].index = index;
3043
5170
  }
3044
- return new Map(survivors.map((instance) => [instance.key, instance]));
5171
+ return keyedRowInstancesByKey(survivors);
3045
5172
  }
3046
5173
  function createKeyedRowConditionalRuntime() {
3047
5174
  class FarmKeyedRowConditional extends React__default.default.Component {
@@ -3215,7 +5342,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3215
5342
  this.hasReactOwnedRows()
3216
5343
  );
3217
5344
  if (appendedInstances) {
3218
- this.instances = new Map(appendedInstances);
5345
+ this.instances = appendedInstances instanceof Map ? appendedInstances : new Map(appendedInstances);
3219
5346
  this.rebuildElementIndex(this.instances);
3220
5347
  this.commitCurrentCollection(dirtyState);
3221
5348
  afterCommit?.();
@@ -3248,8 +5375,14 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3248
5375
  this.hasReactOwnedRows()
3249
5376
  );
3250
5377
  if (reorderedInstances) {
5378
+ const removedRows = reorderedInstances.size < this.instances.size;
3251
5379
  this.instances = new Map(reorderedInstances);
3252
5380
  this.rebuildElementIndex(this.instances);
5381
+ if (removedRows) {
5382
+ const keys = [...this.instances.keys()];
5383
+ this.pruneEventHandlers(keys);
5384
+ this.pruneConditionalListeners(keys);
5385
+ }
3253
5386
  this.commitCurrentCollection(dirtyState);
3254
5387
  afterCommit?.();
3255
5388
  return;
@@ -3405,7 +5538,10 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3405
5538
  }
3406
5539
  }
3407
5540
  commitCurrentCollection(dirtyState) {
3408
- this.collectionToken = options.keyedUpdates?.commit(this.currentProps.items());
5541
+ this.collectionToken = options.keyedUpdates?.commit(
5542
+ this.currentProps.items(),
5543
+ this.instances
5544
+ );
3409
5545
  this.commitKeyedTargets(dirtyState);
3410
5546
  }
3411
5547
  hasSafeMembershipTargets(dirtyState) {
@@ -3837,8 +5973,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3837
5973
  }
3838
5974
  if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
3839
5975
  if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
3840
- const activeElement = this.root.ownerDocument.activeElement;
3841
- const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
3842
5976
  const nextKeys = new Set(rows.keys);
3843
5977
  const hasSurvivingRows = rows.keys.some((key) => this.instances.has(key));
3844
5978
  const oldIndices = /* @__PURE__ */ new Map();
@@ -3852,7 +5986,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3852
5986
  }
3853
5987
  }
3854
5988
  const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : rows.keys.map(() => -1);
3855
- const stablePositions = hasSurvivingRows ? longestIncreasingSubsequencePositions(sequence) : /* @__PURE__ */ new Set();
3856
5989
  const nextInstances = [];
3857
5990
  const conditionalChanges = [];
3858
5991
  for (let index = 0; index < rows.items.length; index += 1) {
@@ -3917,34 +6050,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
3917
6050
  for (const instance of nextInstances) fragment.append(instance.element);
3918
6051
  this.root.replaceChildren(fragment);
3919
6052
  } else {
3920
- let anchor = null;
3921
- for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
3922
- const instance = nextInstances[index];
3923
- if (sequence[index] < 0) {
3924
- let start = index;
3925
- while (start > 0 && sequence[start - 1] < 0) start -= 1;
3926
- const fragment = this.root.ownerDocument.createDocumentFragment();
3927
- for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
3928
- fragment.append(nextInstances[itemIndex].element);
3929
- }
3930
- this.root.insertBefore(fragment, anchor);
3931
- anchor = nextInstances[start].element;
3932
- index = start;
3933
- } else {
3934
- if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
3935
- this.root.insertBefore(instance.element, anchor);
3936
- }
3937
- anchor = instance.element;
3938
- }
3939
- }
6053
+ reorderCompilerKeyedRows(this.root, nextInstances, sequence, null);
3940
6054
  }
3941
- this.instances = new Map(nextInstances.map((instance) => [instance.key, instance]));
6055
+ this.instances = keyedRowInstancesByKey(nextInstances);
3942
6056
  this.rebuildElementIndex(this.instances);
3943
6057
  this.pruneEventHandlers(rows.keys);
3944
6058
  this.pruneConditionalListeners(rows.keys);
3945
- if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
3946
- activeElement.focus({ preventScroll: true });
3947
- }
3948
6059
  this.commitCurrentCollection(dirtyState);
3949
6060
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
3950
6061
  }
@@ -4434,6 +6545,22 @@ var keyedRowsPositionHintedRuntimeFeature = {
4434
6545
  })
4435
6546
  })
4436
6547
  };
6548
+ var keyedRowsBatchPositionHintedRuntimeFeature = {
6549
+ name: "keyed-rows:batch-position-hinted",
6550
+ create: (owner) => ({
6551
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6552
+ keyedUpdates: keyedBatchPositionUpdateRuntime
6553
+ })
6554
+ })
6555
+ };
6556
+ var keyedRowsWindowPositionHintedRuntimeFeature = {
6557
+ name: "keyed-rows:window-position-hinted",
6558
+ create: (owner) => ({
6559
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6560
+ keyedUpdates: keyedWindowPositionUpdateRuntime
6561
+ })
6562
+ })
6563
+ };
4437
6564
  var keyedRowsReorderHintedRuntimeFeature = {
4438
6565
  name: "keyed-rows:reorder-hinted",
4439
6566
  create: (owner) => ({
@@ -4442,6 +6569,14 @@ var keyedRowsReorderHintedRuntimeFeature = {
4442
6569
  })
4443
6570
  })
4444
6571
  };
6572
+ var keyedRowsMapReorderHintedRuntimeFeature = {
6573
+ name: "keyed-rows:map-reorder-hinted",
6574
+ create: (owner) => ({
6575
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6576
+ keyedUpdates: keyedMapReorderUpdateRuntime
6577
+ })
6578
+ })
6579
+ };
4445
6580
  var keyedRowsAllHintedRuntimeFeature = {
4446
6581
  name: "keyed-rows:all-hinted",
4447
6582
  create: (owner) => ({
@@ -4458,6 +6593,22 @@ var keyedRowsEveryHintedRuntimeFeature = {
4458
6593
  })
4459
6594
  })
4460
6595
  };
6596
+ var keyedRowsBatchEveryHintedRuntimeFeature = {
6597
+ name: "keyed-rows:batch-every-hinted",
6598
+ create: (owner) => ({
6599
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6600
+ keyedUpdates: keyedBatchEveryUpdateRuntime
6601
+ })
6602
+ })
6603
+ };
6604
+ var keyedRowsWindowEveryHintedRuntimeFeature = {
6605
+ name: "keyed-rows:window-every-hinted",
6606
+ create: (owner) => ({
6607
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6608
+ keyedUpdates: keyedWindowEveryUpdateRuntime
6609
+ })
6610
+ })
6611
+ };
4461
6612
  var keyedRowsFilterHintedRuntimeFeature = {
4462
6613
  name: "keyed-rows:filter-hinted",
4463
6614
  create: (owner) => ({
@@ -4466,6 +6617,38 @@ var keyedRowsFilterHintedRuntimeFeature = {
4466
6617
  })
4467
6618
  })
4468
6619
  };
6620
+ var keyedRowsStructuralAppendHintedRuntimeFeature = {
6621
+ name: "keyed-rows:structural-append-hinted",
6622
+ create: (owner) => ({
6623
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6624
+ keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
6625
+ })
6626
+ })
6627
+ };
6628
+ var keyedRowsStructuralAppendMapHintedRuntimeFeature = {
6629
+ name: "keyed-rows:structural-append-map-hinted",
6630
+ create: (owner) => ({
6631
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6632
+ keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
6633
+ })
6634
+ })
6635
+ };
6636
+ var keyedRowsStructuralPrependHintedRuntimeFeature = {
6637
+ name: "keyed-rows:structural-prepend-hinted",
6638
+ create: (owner) => ({
6639
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6640
+ keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
6641
+ })
6642
+ })
6643
+ };
6644
+ var keyedRowsStructuralPrependMapHintedRuntimeFeature = {
6645
+ name: "keyed-rows:structural-prepend-map-hinted",
6646
+ create: (owner) => ({
6647
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6648
+ keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
6649
+ })
6650
+ })
6651
+ };
4469
6652
  var keyedRowsPrependHintedRuntimeFeature = {
4470
6653
  name: "keyed-rows:prepend-hinted",
4471
6654
  create: (owner) => ({
@@ -4478,7 +6661,7 @@ var keyedRowsFilterPrependHintedRuntimeFeature = {
4478
6661
  name: "keyed-rows:filter-prepend-hinted",
4479
6662
  create: (owner) => ({
4480
6663
  KeyedRows: createKeyedRowsBlockComponent(owner, {
4481
- keyedUpdates: keyedFilterPrependUpdateRuntime
6664
+ keyedUpdates: keyedStructuralPrependUpdateRuntime
4482
6665
  })
4483
6666
  })
4484
6667
  };
@@ -4508,6 +6691,24 @@ var keyedRowsConditionalPositionHintedRuntimeFeature = {
4508
6691
  })
4509
6692
  })
4510
6693
  };
6694
+ var keyedRowsConditionalBatchPositionHintedRuntimeFeature = {
6695
+ name: "keyed-rows:conditional:batch-position-hinted",
6696
+ create: (owner) => ({
6697
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6698
+ conditionals: createKeyedRowConditionalRuntime(),
6699
+ keyedUpdates: keyedBatchPositionUpdateRuntime
6700
+ })
6701
+ })
6702
+ };
6703
+ var keyedRowsConditionalWindowPositionHintedRuntimeFeature = {
6704
+ name: "keyed-rows:conditional:window-position-hinted",
6705
+ create: (owner) => ({
6706
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6707
+ conditionals: createKeyedRowConditionalRuntime(),
6708
+ keyedUpdates: keyedWindowPositionUpdateRuntime
6709
+ })
6710
+ })
6711
+ };
4511
6712
  var keyedRowsConditionalReorderHintedRuntimeFeature = {
4512
6713
  name: "keyed-rows:conditional:reorder-hinted",
4513
6714
  create: (owner) => ({
@@ -4535,6 +6736,24 @@ var keyedRowsConditionalEveryHintedRuntimeFeature = {
4535
6736
  })
4536
6737
  })
4537
6738
  };
6739
+ var keyedRowsConditionalBatchEveryHintedRuntimeFeature = {
6740
+ name: "keyed-rows:conditional:batch-every-hinted",
6741
+ create: (owner) => ({
6742
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6743
+ conditionals: createKeyedRowConditionalRuntime(),
6744
+ keyedUpdates: keyedBatchEveryUpdateRuntime
6745
+ })
6746
+ })
6747
+ };
6748
+ var keyedRowsConditionalWindowEveryHintedRuntimeFeature = {
6749
+ name: "keyed-rows:conditional:window-every-hinted",
6750
+ create: (owner) => ({
6751
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6752
+ conditionals: createKeyedRowConditionalRuntime(),
6753
+ keyedUpdates: keyedWindowEveryUpdateRuntime
6754
+ })
6755
+ })
6756
+ };
4538
6757
  var keyedRowsConditionalFilterHintedRuntimeFeature = {
4539
6758
  name: "keyed-rows:conditional:filter-hinted",
4540
6759
  create: (owner) => ({
@@ -4544,6 +6763,42 @@ var keyedRowsConditionalFilterHintedRuntimeFeature = {
4544
6763
  })
4545
6764
  })
4546
6765
  };
6766
+ var keyedRowsConditionalStructuralAppendHintedRuntimeFeature = {
6767
+ name: "keyed-rows:conditional:structural-append-hinted",
6768
+ create: (owner) => ({
6769
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6770
+ conditionals: createKeyedRowConditionalRuntime(),
6771
+ keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
6772
+ })
6773
+ })
6774
+ };
6775
+ var keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature = {
6776
+ name: "keyed-rows:conditional:structural-append-map-hinted",
6777
+ create: (owner) => ({
6778
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6779
+ conditionals: createKeyedRowConditionalRuntime(),
6780
+ keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
6781
+ })
6782
+ })
6783
+ };
6784
+ var keyedRowsConditionalStructuralPrependHintedRuntimeFeature = {
6785
+ name: "keyed-rows:conditional:structural-prepend-hinted",
6786
+ create: (owner) => ({
6787
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6788
+ conditionals: createKeyedRowConditionalRuntime(),
6789
+ keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
6790
+ })
6791
+ })
6792
+ };
6793
+ var keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature = {
6794
+ name: "keyed-rows:conditional:structural-prepend-map-hinted",
6795
+ create: (owner) => ({
6796
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6797
+ conditionals: createKeyedRowConditionalRuntime(),
6798
+ keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
6799
+ })
6800
+ })
6801
+ };
4547
6802
  var keyedRowsConditionalPrependHintedRuntimeFeature = {
4548
6803
  name: "keyed-rows:conditional:prepend-hinted",
4549
6804
  create: (owner) => ({
@@ -4588,6 +6843,24 @@ var keyedRowsHostPositionHintedRuntimeFeature = {
4588
6843
  })
4589
6844
  })
4590
6845
  };
6846
+ var keyedRowsHostBatchPositionHintedRuntimeFeature = {
6847
+ name: "keyed-rows:host:batch-position-hinted",
6848
+ create: (owner) => ({
6849
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6850
+ hostBlocks: createKeyedRowHostRuntime(),
6851
+ keyedUpdates: keyedBatchPositionUpdateRuntime
6852
+ })
6853
+ })
6854
+ };
6855
+ var keyedRowsHostWindowPositionHintedRuntimeFeature = {
6856
+ name: "keyed-rows:host:window-position-hinted",
6857
+ create: (owner) => ({
6858
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6859
+ hostBlocks: createKeyedRowHostRuntime(),
6860
+ keyedUpdates: keyedWindowPositionUpdateRuntime
6861
+ })
6862
+ })
6863
+ };
4591
6864
  var keyedRowsHostReorderHintedRuntimeFeature = {
4592
6865
  name: "keyed-rows:host:reorder-hinted",
4593
6866
  create: (owner) => ({
@@ -4615,6 +6888,24 @@ var keyedRowsHostEveryHintedRuntimeFeature = {
4615
6888
  })
4616
6889
  })
4617
6890
  };
6891
+ var keyedRowsHostBatchEveryHintedRuntimeFeature = {
6892
+ name: "keyed-rows:host:batch-every-hinted",
6893
+ create: (owner) => ({
6894
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6895
+ hostBlocks: createKeyedRowHostRuntime(),
6896
+ keyedUpdates: keyedBatchEveryUpdateRuntime
6897
+ })
6898
+ })
6899
+ };
6900
+ var keyedRowsHostWindowEveryHintedRuntimeFeature = {
6901
+ name: "keyed-rows:host:window-every-hinted",
6902
+ create: (owner) => ({
6903
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6904
+ hostBlocks: createKeyedRowHostRuntime(),
6905
+ keyedUpdates: keyedWindowEveryUpdateRuntime
6906
+ })
6907
+ })
6908
+ };
4618
6909
  var keyedRowsHostFilterHintedRuntimeFeature = {
4619
6910
  name: "keyed-rows:host:filter-hinted",
4620
6911
  create: (owner) => ({
@@ -4624,6 +6915,42 @@ var keyedRowsHostFilterHintedRuntimeFeature = {
4624
6915
  })
4625
6916
  })
4626
6917
  };
6918
+ var keyedRowsHostStructuralAppendHintedRuntimeFeature = {
6919
+ name: "keyed-rows:host:structural-append-hinted",
6920
+ create: (owner) => ({
6921
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6922
+ hostBlocks: createKeyedRowHostRuntime(),
6923
+ keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
6924
+ })
6925
+ })
6926
+ };
6927
+ var keyedRowsHostStructuralAppendMapHintedRuntimeFeature = {
6928
+ name: "keyed-rows:host:structural-append-map-hinted",
6929
+ create: (owner) => ({
6930
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6931
+ hostBlocks: createKeyedRowHostRuntime(),
6932
+ keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
6933
+ })
6934
+ })
6935
+ };
6936
+ var keyedRowsHostStructuralPrependHintedRuntimeFeature = {
6937
+ name: "keyed-rows:host:structural-prepend-hinted",
6938
+ create: (owner) => ({
6939
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6940
+ hostBlocks: createKeyedRowHostRuntime(),
6941
+ keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
6942
+ })
6943
+ })
6944
+ };
6945
+ var keyedRowsHostStructuralPrependMapHintedRuntimeFeature = {
6946
+ name: "keyed-rows:host:structural-prepend-map-hinted",
6947
+ create: (owner) => ({
6948
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
6949
+ hostBlocks: createKeyedRowHostRuntime(),
6950
+ keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
6951
+ })
6952
+ })
6953
+ };
4627
6954
  var keyedRowsHostPrependHintedRuntimeFeature = {
4628
6955
  name: "keyed-rows:host:prepend-hinted",
4629
6956
  create: (owner) => ({
@@ -4671,6 +6998,26 @@ var keyedRowsCompletePositionHintedRuntimeFeature = {
4671
6998
  })
4672
6999
  })
4673
7000
  };
7001
+ var keyedRowsCompleteBatchPositionHintedRuntimeFeature = {
7002
+ name: "keyed-rows:complete:batch-position-hinted",
7003
+ create: (owner) => ({
7004
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7005
+ conditionals: createKeyedRowConditionalRuntime(),
7006
+ hostBlocks: createKeyedRowHostRuntime(),
7007
+ keyedUpdates: keyedBatchPositionUpdateRuntime
7008
+ })
7009
+ })
7010
+ };
7011
+ var keyedRowsCompleteWindowPositionHintedRuntimeFeature = {
7012
+ name: "keyed-rows:complete:window-position-hinted",
7013
+ create: (owner) => ({
7014
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7015
+ conditionals: createKeyedRowConditionalRuntime(),
7016
+ hostBlocks: createKeyedRowHostRuntime(),
7017
+ keyedUpdates: keyedWindowPositionUpdateRuntime
7018
+ })
7019
+ })
7020
+ };
4674
7021
  var keyedRowsCompleteReorderHintedRuntimeFeature = {
4675
7022
  name: "keyed-rows:complete:reorder-hinted",
4676
7023
  create: (owner) => ({
@@ -4701,6 +7048,26 @@ var keyedRowsCompleteEveryHintedRuntimeFeature = {
4701
7048
  })
4702
7049
  })
4703
7050
  };
7051
+ var keyedRowsCompleteBatchEveryHintedRuntimeFeature = {
7052
+ name: "keyed-rows:complete:batch-every-hinted",
7053
+ create: (owner) => ({
7054
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7055
+ conditionals: createKeyedRowConditionalRuntime(),
7056
+ hostBlocks: createKeyedRowHostRuntime(),
7057
+ keyedUpdates: keyedBatchEveryUpdateRuntime
7058
+ })
7059
+ })
7060
+ };
7061
+ var keyedRowsCompleteWindowEveryHintedRuntimeFeature = {
7062
+ name: "keyed-rows:complete:window-every-hinted",
7063
+ create: (owner) => ({
7064
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7065
+ conditionals: createKeyedRowConditionalRuntime(),
7066
+ hostBlocks: createKeyedRowHostRuntime(),
7067
+ keyedUpdates: keyedWindowEveryUpdateRuntime
7068
+ })
7069
+ })
7070
+ };
4704
7071
  var keyedRowsCompleteFilterHintedRuntimeFeature = {
4705
7072
  name: "keyed-rows:complete:filter-hinted",
4706
7073
  create: (owner) => ({
@@ -4711,6 +7078,46 @@ var keyedRowsCompleteFilterHintedRuntimeFeature = {
4711
7078
  })
4712
7079
  })
4713
7080
  };
7081
+ var keyedRowsCompleteStructuralAppendHintedRuntimeFeature = {
7082
+ name: "keyed-rows:complete:structural-append-hinted",
7083
+ create: (owner) => ({
7084
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7085
+ conditionals: createKeyedRowConditionalRuntime(),
7086
+ hostBlocks: createKeyedRowHostRuntime(),
7087
+ keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
7088
+ })
7089
+ })
7090
+ };
7091
+ var keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature = {
7092
+ name: "keyed-rows:complete:structural-append-map-hinted",
7093
+ create: (owner) => ({
7094
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7095
+ conditionals: createKeyedRowConditionalRuntime(),
7096
+ hostBlocks: createKeyedRowHostRuntime(),
7097
+ keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
7098
+ })
7099
+ })
7100
+ };
7101
+ var keyedRowsCompleteStructuralPrependHintedRuntimeFeature = {
7102
+ name: "keyed-rows:complete:structural-prepend-hinted",
7103
+ create: (owner) => ({
7104
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7105
+ conditionals: createKeyedRowConditionalRuntime(),
7106
+ hostBlocks: createKeyedRowHostRuntime(),
7107
+ keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
7108
+ })
7109
+ })
7110
+ };
7111
+ var keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature = {
7112
+ name: "keyed-rows:complete:structural-prepend-map-hinted",
7113
+ create: (owner) => ({
7114
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7115
+ conditionals: createKeyedRowConditionalRuntime(),
7116
+ hostBlocks: createKeyedRowHostRuntime(),
7117
+ keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
7118
+ })
7119
+ })
7120
+ };
4714
7121
  var keyedRowsCompletePrependHintedRuntimeFeature = {
4715
7122
  name: "keyed-rows:complete:prepend-hinted",
4716
7123
  create: (owner) => ({
@@ -4731,6 +7138,16 @@ var keyedRowsCompleteFilterPrependHintedRuntimeFeature = {
4731
7138
  })
4732
7139
  })
4733
7140
  };
7141
+ var keyedRowsCompleteCompatibilityRuntimeFeature = {
7142
+ name: "keyed-rows:complete:compatibility",
7143
+ create: (owner) => ({
7144
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
7145
+ conditionals: createKeyedRowConditionalRuntime(),
7146
+ hostBlocks: createKeyedRowHostRuntime(),
7147
+ keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
7148
+ })
7149
+ })
7150
+ };
4734
7151
  var keyedRangesRuntimeFeature = {
4735
7152
  name: "keyed-ranges",
4736
7153
  create: (owner) => ({
@@ -5203,7 +7620,7 @@ var COMPLETE_RUNTIME_FEATURES = [
5203
7620
  hostConditionalRuntimeFeature,
5204
7621
  conditionalRangesRuntimeFeature,
5205
7622
  keyedListRuntimeFeature,
5206
- keyedRowsCompleteEveryHintedRuntimeFeature,
7623
+ keyedRowsCompleteCompatibilityRuntimeFeature,
5207
7624
  keyedRangesRuntimeFeature,
5208
7625
  mixedRangesRuntimeFeature,
5209
7626
  componentRuntimeFeature
@@ -5219,20 +7636,38 @@ exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
5219
7636
  exports.createCompiledComponent = createCompiledComponent;
5220
7637
  exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
5221
7638
  exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
7639
+ exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
5222
7640
  exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
7641
+ exports.createCompilerKeyedArrayMapPipeline = createCompilerKeyedArrayMapPipeline;
7642
+ exports.createCompilerKeyedArrayMapReorder = createCompilerKeyedArrayMapReorder;
7643
+ exports.createCompilerKeyedArrayMappedStructuralAppend = createCompilerKeyedArrayMappedStructuralAppend;
7644
+ exports.createCompilerKeyedArrayMappedStructuralPrepend = createCompilerKeyedArrayMappedStructuralPrepend;
5223
7645
  exports.createCompilerKeyedArrayPositionUpdate = createCompilerKeyedArrayPositionUpdate;
5224
7646
  exports.createCompilerKeyedArrayPrepend = createCompilerKeyedArrayPrepend;
7647
+ exports.createCompilerKeyedArrayQueuedMapPipeline = createCompilerKeyedArrayQueuedMapPipeline;
5225
7648
  exports.createCompilerKeyedArrayReorder = createCompilerKeyedArrayReorder;
5226
7649
  exports.createCompilerKeyedArrayRollingWindow = createCompilerKeyedArrayRollingWindow;
5227
7650
  exports.createCompilerKeyedArraySlice = createCompilerKeyedArraySlice;
5228
7651
  exports.createCompilerKeyedArraySort = createCompilerKeyedArraySort;
7652
+ exports.createCompilerKeyedArrayStructuralAppend = createCompilerKeyedArrayStructuralAppend;
7653
+ exports.createCompilerKeyedArrayStructuralAppendMapPipeline = createCompilerKeyedArrayStructuralAppendMapPipeline;
7654
+ exports.createCompilerKeyedArrayStructuralPrepend = createCompilerKeyedArrayStructuralPrepend;
7655
+ exports.createCompilerKeyedArrayStructuralPrependMapPipeline = createCompilerKeyedArrayStructuralPrependMapPipeline;
7656
+ exports.createCompilerKeyedArrayStructuralReorder = createCompilerKeyedArrayStructuralReorder;
7657
+ exports.createCompilerKeyedArrayStructuralSort = createCompilerKeyedArrayStructuralSort;
7658
+ exports.createCompilerKeyedArrayWindowReplace = createCompilerKeyedArrayWindowReplace;
5229
7659
  exports.createCompilerKeyedCollectionUpdate = createCompilerKeyedCollectionUpdate;
5230
7660
  exports.createCompilerKeyedMapUpdate = createCompilerKeyedMapUpdate;
7661
+ exports.finalizeCompilerKeyedArrayMappedStructuralUpdate = finalizeCompilerKeyedArrayMappedStructuralUpdate;
5231
7662
  exports.hostConditionalRuntimeFeature = hostConditionalRuntimeFeature;
5232
7663
  exports.keyedListRuntimeFeature = keyedListRuntimeFeature;
5233
7664
  exports.keyedRangesRuntimeFeature = keyedRangesRuntimeFeature;
5234
7665
  exports.keyedRowsAllHintedRuntimeFeature = keyedRowsAllHintedRuntimeFeature;
7666
+ exports.keyedRowsBatchEveryHintedRuntimeFeature = keyedRowsBatchEveryHintedRuntimeFeature;
7667
+ exports.keyedRowsBatchPositionHintedRuntimeFeature = keyedRowsBatchPositionHintedRuntimeFeature;
5235
7668
  exports.keyedRowsCompleteAllHintedRuntimeFeature = keyedRowsCompleteAllHintedRuntimeFeature;
7669
+ exports.keyedRowsCompleteBatchEveryHintedRuntimeFeature = keyedRowsCompleteBatchEveryHintedRuntimeFeature;
7670
+ exports.keyedRowsCompleteBatchPositionHintedRuntimeFeature = keyedRowsCompleteBatchPositionHintedRuntimeFeature;
5236
7671
  exports.keyedRowsCompleteEveryHintedRuntimeFeature = keyedRowsCompleteEveryHintedRuntimeFeature;
5237
7672
  exports.keyedRowsCompleteFilterHintedRuntimeFeature = keyedRowsCompleteFilterHintedRuntimeFeature;
5238
7673
  exports.keyedRowsCompleteFilterPrependHintedRuntimeFeature = keyedRowsCompleteFilterPrependHintedRuntimeFeature;
@@ -5241,7 +7676,15 @@ exports.keyedRowsCompletePositionHintedRuntimeFeature = keyedRowsCompletePositio
5241
7676
  exports.keyedRowsCompletePrependHintedRuntimeFeature = keyedRowsCompletePrependHintedRuntimeFeature;
5242
7677
  exports.keyedRowsCompleteReorderHintedRuntimeFeature = keyedRowsCompleteReorderHintedRuntimeFeature;
5243
7678
  exports.keyedRowsCompleteRuntimeFeature = keyedRowsCompleteRuntimeFeature;
7679
+ exports.keyedRowsCompleteStructuralAppendHintedRuntimeFeature = keyedRowsCompleteStructuralAppendHintedRuntimeFeature;
7680
+ exports.keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature = keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature;
7681
+ exports.keyedRowsCompleteStructuralPrependHintedRuntimeFeature = keyedRowsCompleteStructuralPrependHintedRuntimeFeature;
7682
+ exports.keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature = keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature;
7683
+ exports.keyedRowsCompleteWindowEveryHintedRuntimeFeature = keyedRowsCompleteWindowEveryHintedRuntimeFeature;
7684
+ exports.keyedRowsCompleteWindowPositionHintedRuntimeFeature = keyedRowsCompleteWindowPositionHintedRuntimeFeature;
5244
7685
  exports.keyedRowsConditionalAllHintedRuntimeFeature = keyedRowsConditionalAllHintedRuntimeFeature;
7686
+ exports.keyedRowsConditionalBatchEveryHintedRuntimeFeature = keyedRowsConditionalBatchEveryHintedRuntimeFeature;
7687
+ exports.keyedRowsConditionalBatchPositionHintedRuntimeFeature = keyedRowsConditionalBatchPositionHintedRuntimeFeature;
5245
7688
  exports.keyedRowsConditionalEveryHintedRuntimeFeature = keyedRowsConditionalEveryHintedRuntimeFeature;
5246
7689
  exports.keyedRowsConditionalFilterHintedRuntimeFeature = keyedRowsConditionalFilterHintedRuntimeFeature;
5247
7690
  exports.keyedRowsConditionalFilterPrependHintedRuntimeFeature = keyedRowsConditionalFilterPrependHintedRuntimeFeature;
@@ -5250,11 +7693,19 @@ exports.keyedRowsConditionalPositionHintedRuntimeFeature = keyedRowsConditionalP
5250
7693
  exports.keyedRowsConditionalPrependHintedRuntimeFeature = keyedRowsConditionalPrependHintedRuntimeFeature;
5251
7694
  exports.keyedRowsConditionalReorderHintedRuntimeFeature = keyedRowsConditionalReorderHintedRuntimeFeature;
5252
7695
  exports.keyedRowsConditionalRuntimeFeature = keyedRowsConditionalRuntimeFeature;
7696
+ exports.keyedRowsConditionalStructuralAppendHintedRuntimeFeature = keyedRowsConditionalStructuralAppendHintedRuntimeFeature;
7697
+ exports.keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature = keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature;
7698
+ exports.keyedRowsConditionalStructuralPrependHintedRuntimeFeature = keyedRowsConditionalStructuralPrependHintedRuntimeFeature;
7699
+ exports.keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature = keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature;
7700
+ exports.keyedRowsConditionalWindowEveryHintedRuntimeFeature = keyedRowsConditionalWindowEveryHintedRuntimeFeature;
7701
+ exports.keyedRowsConditionalWindowPositionHintedRuntimeFeature = keyedRowsConditionalWindowPositionHintedRuntimeFeature;
5253
7702
  exports.keyedRowsEveryHintedRuntimeFeature = keyedRowsEveryHintedRuntimeFeature;
5254
7703
  exports.keyedRowsFilterHintedRuntimeFeature = keyedRowsFilterHintedRuntimeFeature;
5255
7704
  exports.keyedRowsFilterPrependHintedRuntimeFeature = keyedRowsFilterPrependHintedRuntimeFeature;
5256
7705
  exports.keyedRowsHintedRuntimeFeature = keyedRowsHintedRuntimeFeature;
5257
7706
  exports.keyedRowsHostAllHintedRuntimeFeature = keyedRowsHostAllHintedRuntimeFeature;
7707
+ exports.keyedRowsHostBatchEveryHintedRuntimeFeature = keyedRowsHostBatchEveryHintedRuntimeFeature;
7708
+ exports.keyedRowsHostBatchPositionHintedRuntimeFeature = keyedRowsHostBatchPositionHintedRuntimeFeature;
5258
7709
  exports.keyedRowsHostEveryHintedRuntimeFeature = keyedRowsHostEveryHintedRuntimeFeature;
5259
7710
  exports.keyedRowsHostFilterHintedRuntimeFeature = keyedRowsHostFilterHintedRuntimeFeature;
5260
7711
  exports.keyedRowsHostFilterPrependHintedRuntimeFeature = keyedRowsHostFilterPrependHintedRuntimeFeature;
@@ -5263,10 +7714,23 @@ exports.keyedRowsHostPositionHintedRuntimeFeature = keyedRowsHostPositionHintedR
5263
7714
  exports.keyedRowsHostPrependHintedRuntimeFeature = keyedRowsHostPrependHintedRuntimeFeature;
5264
7715
  exports.keyedRowsHostReorderHintedRuntimeFeature = keyedRowsHostReorderHintedRuntimeFeature;
5265
7716
  exports.keyedRowsHostRuntimeFeature = keyedRowsHostRuntimeFeature;
7717
+ exports.keyedRowsHostStructuralAppendHintedRuntimeFeature = keyedRowsHostStructuralAppendHintedRuntimeFeature;
7718
+ exports.keyedRowsHostStructuralAppendMapHintedRuntimeFeature = keyedRowsHostStructuralAppendMapHintedRuntimeFeature;
7719
+ exports.keyedRowsHostStructuralPrependHintedRuntimeFeature = keyedRowsHostStructuralPrependHintedRuntimeFeature;
7720
+ exports.keyedRowsHostStructuralPrependMapHintedRuntimeFeature = keyedRowsHostStructuralPrependMapHintedRuntimeFeature;
7721
+ exports.keyedRowsHostWindowEveryHintedRuntimeFeature = keyedRowsHostWindowEveryHintedRuntimeFeature;
7722
+ exports.keyedRowsHostWindowPositionHintedRuntimeFeature = keyedRowsHostWindowPositionHintedRuntimeFeature;
7723
+ exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
5266
7724
  exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
5267
7725
  exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;
5268
7726
  exports.keyedRowsReorderHintedRuntimeFeature = keyedRowsReorderHintedRuntimeFeature;
5269
7727
  exports.keyedRowsRuntimeFeature = keyedRowsRuntimeFeature;
7728
+ exports.keyedRowsStructuralAppendHintedRuntimeFeature = keyedRowsStructuralAppendHintedRuntimeFeature;
7729
+ exports.keyedRowsStructuralAppendMapHintedRuntimeFeature = keyedRowsStructuralAppendMapHintedRuntimeFeature;
7730
+ exports.keyedRowsStructuralPrependHintedRuntimeFeature = keyedRowsStructuralPrependHintedRuntimeFeature;
7731
+ exports.keyedRowsStructuralPrependMapHintedRuntimeFeature = keyedRowsStructuralPrependMapHintedRuntimeFeature;
7732
+ exports.keyedRowsWindowEveryHintedRuntimeFeature = keyedRowsWindowEveryHintedRuntimeFeature;
7733
+ exports.keyedRowsWindowPositionHintedRuntimeFeature = keyedRowsWindowPositionHintedRuntimeFeature;
5270
7734
  exports.mixedRangesRuntimeFeature = mixedRangesRuntimeFeature;
5271
7735
  //# sourceMappingURL=compiler-runtime.cjs.map
5272
7736
  //# sourceMappingURL=compiler-runtime.cjs.map