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

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.
@@ -19,6 +19,463 @@ function materializeIterable(source) {
19
19
  }
20
20
 
21
21
  // src/compiler-runtime.tsx
22
+ var COMPILER_KEYED_COLLECTION_TOKENS = /* @__PURE__ */ new WeakMap();
23
+ var COMPILER_KEYED_MAP_UPDATES = /* @__PURE__ */ new WeakMap();
24
+ var COMPILER_KEYED_ARRAY_APPENDS = /* @__PURE__ */ new WeakMap();
25
+ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
26
+ var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
27
+ var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
28
+ var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
29
+ var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
30
+ var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
31
+ var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
32
+ var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
33
+ var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
34
+ var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
35
+ var NATIVE_ARRAY_FILTER = Array.prototype.filter;
36
+ var NATIVE_ARRAY_SLICE = Array.prototype.slice;
37
+ var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
38
+ var NATIVE_ARRAY_WITH = Array.prototype.with;
39
+ var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
40
+ var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
41
+ var NATIVE_REFLECT_APPLY = Reflect.apply;
42
+ function compilerObject(value) {
43
+ return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
44
+ }
45
+ function compilerKeyedCollectionToken(value) {
46
+ const target = compilerObject(value);
47
+ if (!target) return void 0;
48
+ let token = COMPILER_KEYED_COLLECTION_TOKENS.get(target);
49
+ if (!token) {
50
+ token = {};
51
+ COMPILER_KEYED_COLLECTION_TOKENS.set(target, token);
52
+ }
53
+ return token;
54
+ }
55
+ function commitCompilerKeyedCollection(value) {
56
+ const target = compilerObject(value);
57
+ if (!target) return void 0;
58
+ COMPILER_KEYED_COMMITTED_COLLECTIONS.add(target);
59
+ return compilerKeyedCollectionToken(target);
60
+ }
61
+ function compilerKeyedMapChangedIndices(value, sourceToken) {
62
+ const target = compilerObject(value);
63
+ if (!target || !sourceToken) return void 0;
64
+ const update = COMPILER_KEYED_MAP_UPDATES.get(target);
65
+ if (!update || update.sourceToken !== sourceToken) return void 0;
66
+ const changedIndices = [];
67
+ for (let current = update; current; current = current.previous) {
68
+ changedIndices.push(...current.changedIndices);
69
+ }
70
+ return changedIndices;
71
+ }
72
+ function compilerKeyedArrayAppendStart(value, sourceToken, expectedStart) {
73
+ const target = compilerObject(value);
74
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
75
+ const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
76
+ if (!update || update.sourceToken !== sourceToken) return void 0;
77
+ const updates = [];
78
+ for (let current = update; current; current = current.previous) {
79
+ if (current.sourceToken !== sourceToken) return void 0;
80
+ updates.push(current);
81
+ }
82
+ let length = expectedStart;
83
+ for (let index = updates.length - 1; index >= 0; index -= 1) {
84
+ const current = updates[index];
85
+ if (current.startIndex !== length || current.resultLength < length) return void 0;
86
+ length = current.resultLength;
87
+ }
88
+ return length === value.length ? expectedStart : void 0;
89
+ }
90
+ function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
91
+ const target = compilerObject(value);
92
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
93
+ const update = COMPILER_KEYED_ARRAY_FILTERS.get(target);
94
+ if (!update || update.sourceToken !== sourceToken) return void 0;
95
+ const updates = [];
96
+ for (let current = update; current; current = current.previous) {
97
+ if (current.sourceToken !== sourceToken) return void 0;
98
+ updates.push(current);
99
+ }
100
+ let survivors = Array.from({ length: expectedLength }, (_, index) => index);
101
+ let keysStable = true;
102
+ for (let updateIndex = updates.length - 1; updateIndex >= 0; updateIndex -= 1) {
103
+ const current = updates[updateIndex];
104
+ if (current.sourceLength !== survivors.length) return void 0;
105
+ if (current.kind === "slice") {
106
+ const start = current.retainedStart;
107
+ const end = current.retainedEnd;
108
+ if (start === void 0 || end === void 0 || !Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end < start || end > current.sourceLength || current.resultLength !== end - start) {
109
+ return void 0;
110
+ }
111
+ survivors = survivors.slice(start, end);
112
+ continue;
113
+ }
114
+ keysStable = false;
115
+ const removed = /* @__PURE__ */ new Set();
116
+ for (const index of current.removedIndices || []) {
117
+ if (!Number.isSafeInteger(index) || index < 0 || index >= current.sourceLength)
118
+ return void 0;
119
+ removed.add(index);
120
+ }
121
+ if (current.resultLength !== current.sourceLength - removed.size) return void 0;
122
+ survivors = survivors.filter((_sourceIndex, index) => !removed.has(index));
123
+ }
124
+ return survivors.length === value.length ? { indices: survivors, keysStable } : void 0;
125
+ }
126
+ function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
127
+ const target = compilerObject(value);
128
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
129
+ const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
130
+ if (!update || update.sourceToken !== sourceToken) return void 0;
131
+ const updates = [];
132
+ for (let current = update; current; current = current.previous) {
133
+ if (current.sourceToken !== sourceToken) return void 0;
134
+ updates.push(current);
135
+ }
136
+ let length = expectedLength;
137
+ let prefixLength = 0;
138
+ for (let index = updates.length - 1; index >= 0; index -= 1) {
139
+ const current = updates[index];
140
+ if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
141
+ return void 0;
142
+ }
143
+ length = current.resultLength;
144
+ prefixLength += current.prefixLength;
145
+ }
146
+ return length === value.length ? prefixLength : void 0;
147
+ }
148
+ function compilerKeyedArrayRollingWindow(value, sourceToken, expectedLength) {
149
+ const target = compilerObject(value);
150
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
151
+ const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
152
+ 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) {
153
+ return void 0;
154
+ }
155
+ return update;
156
+ }
157
+ function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
158
+ const target = compilerObject(value);
159
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
160
+ const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
161
+ 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)) {
162
+ return void 0;
163
+ }
164
+ return update;
165
+ }
166
+ function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
167
+ const target = compilerObject(value);
168
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
169
+ const update = COMPILER_KEYED_ARRAY_REORDERS.get(target);
170
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== expectedLength || update.resultLength !== value.length) {
171
+ return void 0;
172
+ }
173
+ return update;
174
+ }
175
+ function compilerKeyedCollectionChangedKeys(value, sourceToken, kind) {
176
+ const target = compilerObject(value);
177
+ if (!target || !sourceToken) return void 0;
178
+ const update = COMPILER_KEYED_COLLECTION_UPDATES.get(target);
179
+ if (!update || update.kind !== kind || update.sourceToken !== sourceToken) return void 0;
180
+ const changedKeys = [];
181
+ for (let current = update; current; current = current.previous) {
182
+ if (current.kind !== kind || current.sourceToken !== sourceToken) return void 0;
183
+ changedKeys.push(...current.changedKeys);
184
+ }
185
+ return changedKeys;
186
+ }
187
+ function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
188
+ const previousTarget = compilerObject(previous);
189
+ const valueTarget = compilerObject(value);
190
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
191
+ if (valueTarget && sourceToken) {
192
+ const previousUpdate = previousTarget && !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_MAP_UPDATES.get(previousTarget) : void 0;
193
+ COMPILER_KEYED_MAP_UPDATES.set(valueTarget, {
194
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
195
+ changedIndices,
196
+ ...previousUpdate ? { previous: previousUpdate } : {}
197
+ });
198
+ }
199
+ return value;
200
+ }
201
+ function createCompilerKeyedArrayAppend(previous, value) {
202
+ try {
203
+ const previousTarget = compilerObject(previous);
204
+ const valueTarget = compilerObject(value);
205
+ 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) {
206
+ return value;
207
+ }
208
+ const startIndex = previous.length;
209
+ if (value.length < startIndex) return value;
210
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
211
+ if (!sourceToken) return value;
212
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget) : void 0;
213
+ COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
214
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
215
+ startIndex,
216
+ resultLength: value.length,
217
+ ...previousUpdate ? { previous: previousUpdate } : {}
218
+ });
219
+ return value;
220
+ } catch {
221
+ return value;
222
+ }
223
+ }
224
+ function createCompilerKeyedArrayPrepend(previous, value) {
225
+ try {
226
+ const previousTarget = compilerObject(previous);
227
+ const valueTarget = compilerObject(value);
228
+ 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) {
229
+ return value;
230
+ }
231
+ const sourceLength = previous.length;
232
+ const prefixLength = value.length - sourceLength;
233
+ if (prefixLength < 1) return value;
234
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
235
+ if (!sourceToken) return value;
236
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
237
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
238
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
239
+ sourceLength,
240
+ resultLength: value.length,
241
+ prefixLength,
242
+ ...previousUpdate ? { previous: previousUpdate } : {}
243
+ });
244
+ return value;
245
+ } catch {
246
+ return value;
247
+ }
248
+ }
249
+ function createCompilerKeyedArrayFilter(previous, method, predicate) {
250
+ let canHint = false;
251
+ let sourceLength = 0;
252
+ try {
253
+ canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
254
+ if (canHint) sourceLength = previous.length;
255
+ } catch {
256
+ canHint = false;
257
+ }
258
+ if (!canHint) {
259
+ return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
260
+ }
261
+ const removedIndices = [];
262
+ let visited = 0;
263
+ const wrappedPredicate = function(item, index, collection) {
264
+ visited += 1;
265
+ const keep = NATIVE_REFLECT_APPLY(predicate, this, [
266
+ item,
267
+ index,
268
+ collection
269
+ ]);
270
+ if (!keep) removedIndices.push(index);
271
+ return keep;
272
+ };
273
+ const value = NATIVE_REFLECT_APPLY(method, previous, [
274
+ wrappedPredicate
275
+ ]);
276
+ try {
277
+ const previousTarget = compilerObject(previous);
278
+ const valueTarget = compilerObject(value);
279
+ if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
280
+ return value;
281
+ }
282
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
283
+ if (!sourceToken) return value;
284
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
285
+ COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
286
+ kind: "filter",
287
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
288
+ sourceLength,
289
+ resultLength: value.length,
290
+ removedIndices,
291
+ ...previousUpdate ? { previous: previousUpdate } : {}
292
+ });
293
+ } catch {
294
+ }
295
+ return value;
296
+ }
297
+ function createCompilerKeyedArraySlice(previous, method, ...args) {
298
+ const canHint = (() => {
299
+ try {
300
+ return Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_SLICE && args.length > 0 && args.length <= 2 && args.every((value2) => Number.isSafeInteger(value2));
301
+ } catch {
302
+ return false;
303
+ }
304
+ })();
305
+ const value = NATIVE_REFLECT_APPLY(method, previous, args);
306
+ if (!canHint) return value;
307
+ try {
308
+ const previousTarget = compilerObject(previous);
309
+ const valueTarget = compilerObject(value);
310
+ if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
311
+ return value;
312
+ }
313
+ const sourceLength = previous.length;
314
+ const normalize = (relative) => relative < 0 ? Math.max(sourceLength + relative, 0) : Math.min(relative, sourceLength);
315
+ const retainedStart = normalize(args[0]);
316
+ const retainedEnd = args.length === 2 ? normalize(args[1]) : sourceLength;
317
+ const resultLength = Math.max(retainedEnd - retainedStart, 0);
318
+ if (value.length !== resultLength || resultLength >= sourceLength) return value;
319
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
320
+ if (!sourceToken) return value;
321
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
322
+ COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
323
+ kind: "slice",
324
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
325
+ sourceLength,
326
+ resultLength,
327
+ retainedEnd: Math.max(retainedEnd, retainedStart),
328
+ retainedStart,
329
+ ...previousUpdate ? { previous: previousUpdate } : {}
330
+ });
331
+ } catch {
332
+ }
333
+ return value;
334
+ }
335
+ function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
336
+ try {
337
+ const previousTarget = compilerObject(previous);
338
+ const retainedTarget = compilerObject(retained);
339
+ const valueTarget = compilerObject(value);
340
+ 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) {
341
+ return value;
342
+ }
343
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
344
+ const slice = COMPILER_KEYED_ARRAY_FILTERS.get(retainedTarget);
345
+ 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) {
346
+ return value;
347
+ }
348
+ for (let index = 0; index < retained.length; index += 1) {
349
+ if (!Object.is(value[index], retained[index])) return value;
350
+ }
351
+ COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.set(valueTarget, {
352
+ sourceToken,
353
+ sourceLength: previous.length,
354
+ resultLength: value.length,
355
+ retainedEnd: slice.retainedEnd,
356
+ retainedStart: slice.retainedStart
357
+ });
358
+ } catch {
359
+ }
360
+ return value;
361
+ }
362
+ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position, ...args) {
363
+ const callArgs = [position, ...args];
364
+ const value = NATIVE_REFLECT_APPLY(
365
+ method,
366
+ previous,
367
+ callArgs
368
+ );
369
+ try {
370
+ const previousTarget = compilerObject(previous);
371
+ const valueTarget = compilerObject(value);
372
+ 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 || !Number.isSafeInteger(position)) {
373
+ return value;
374
+ }
375
+ const sourceLength = previous.length;
376
+ const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
377
+ const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
378
+ const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Object.is(args[0], 1) && normalizedPosition < sourceLength && value.length === sourceLength - 1;
379
+ const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength && value.length === sourceLength;
380
+ if (!validInsert && !validRemove && !validReplace) return value;
381
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
382
+ if (!sourceToken) return value;
383
+ COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
384
+ kind,
385
+ sourceToken,
386
+ sourceLength,
387
+ resultLength: value.length,
388
+ position: normalizedPosition
389
+ });
390
+ } catch {
391
+ }
392
+ return value;
393
+ }
394
+ function createCompilerKeyedArrayReorder(previous, method) {
395
+ const value = NATIVE_REFLECT_APPLY(
396
+ method,
397
+ previous,
398
+ []
399
+ );
400
+ try {
401
+ const previousTarget = compilerObject(previous);
402
+ const valueTarget = compilerObject(value);
403
+ 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) {
404
+ return value;
405
+ }
406
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
407
+ if (!sourceToken) return value;
408
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
409
+ kind: "reverse",
410
+ sourceToken,
411
+ sourceLength: previous.length,
412
+ resultLength: value.length
413
+ });
414
+ } catch {
415
+ }
416
+ return value;
417
+ }
418
+ function createCompilerKeyedArraySort(previous, method, ...args) {
419
+ const value = NATIVE_REFLECT_APPLY(
420
+ method,
421
+ previous,
422
+ args
423
+ );
424
+ try {
425
+ const previousTarget = compilerObject(previous);
426
+ const valueTarget = compilerObject(value);
427
+ 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) {
428
+ return value;
429
+ }
430
+ for (let index = 0; index < previous.length; index += 1) {
431
+ if (!(index in previous)) return value;
432
+ }
433
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
434
+ if (!sourceToken) return value;
435
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
436
+ kind: "sort",
437
+ sourceToken,
438
+ sourceLength: previous.length,
439
+ resultLength: value.length
440
+ });
441
+ } catch {
442
+ }
443
+ return value;
444
+ }
445
+ function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
446
+ const args = operation === "map-set" ? [key, value] : [key];
447
+ const result = NATIVE_REFLECT_APPLY(method, collection, args);
448
+ const target = compilerObject(collection);
449
+ if (!target) return result;
450
+ const kind = operation.startsWith("set-") ? "set" : "map";
451
+ const nativeMethod = operation === "set-add" ? NATIVE_SET_ADD : operation === "set-delete" ? NATIVE_SET_DELETE : operation === "map-set" ? NATIVE_MAP_SET : NATIVE_MAP_DELETE;
452
+ const nativePrototype = kind === "set" ? NATIVE_SET_PROTOTYPE : NATIVE_MAP_PROTOTYPE;
453
+ if (method !== nativeMethod || Object.getPrototypeOf(collection) !== nativePrototype) {
454
+ return result;
455
+ }
456
+ const existing = COMPILER_KEYED_COLLECTION_DRAFTS.get(target);
457
+ if (existing && existing.kind !== kind) return result;
458
+ if (existing) existing.changedKeys.push(key);
459
+ else COMPILER_KEYED_COLLECTION_DRAFTS.set(target, { kind, changedKeys: [key] });
460
+ return result;
461
+ }
462
+ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
463
+ const previousTarget = compilerObject(previous);
464
+ const valueTarget = compilerObject(value);
465
+ if (!previousTarget || !valueTarget || previousTarget === valueTarget) return value;
466
+ const draft = COMPILER_KEYED_COLLECTION_DRAFTS.get(valueTarget);
467
+ if (!draft || draft.kind !== kind || draft.changedKeys.length === 0) return value;
468
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
469
+ if (!sourceToken) return value;
470
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_COLLECTION_UPDATES.get(previousTarget) : void 0;
471
+ COMPILER_KEYED_COLLECTION_UPDATES.set(valueTarget, {
472
+ kind,
473
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
474
+ changedKeys: [...draft.changedKeys],
475
+ ...previousUpdate ? { previous: previousUpdate } : {}
476
+ });
477
+ return value;
478
+ }
22
479
  var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
23
480
  function getCompilerHmrRegistry() {
24
481
  const globalTarget = globalThis;
@@ -406,6 +863,240 @@ var UNSET_KEYED_ROW_BINDING = /* @__PURE__ */ Symbol("unset interactive keyed-ro
406
863
  function keyedRowIdentity(key) {
407
864
  return String(key);
408
865
  }
866
+ function keyedIdentityTargetSnapshot(value) {
867
+ const kind = typeof value;
868
+ return value === null || value === void 0 || kind === "string" || kind === "number" || kind === "bigint" ? { eligible: true, key: String(value) } : { eligible: false };
869
+ }
870
+ var NATIVE_SET_PROTOTYPE = Set.prototype;
871
+ var NATIVE_SET_ADD = Set.prototype.add;
872
+ var NATIVE_SET_DELETE = Set.prototype.delete;
873
+ var NATIVE_SET_HAS = Set.prototype.has;
874
+ var NATIVE_SET_VALUES = Set.prototype.values;
875
+ var KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH = 64;
876
+ function materializeKeyedMembershipSnapshot(snapshot) {
877
+ if (!snapshot.eligible) return void 0;
878
+ if (snapshot.values) return new Set(snapshot.values);
879
+ if (!snapshot.previous || !snapshot.changes) return void 0;
880
+ const values = materializeKeyedMembershipSnapshot(snapshot.previous);
881
+ if (!values) return void 0;
882
+ for (const [key, present] of snapshot.changes) {
883
+ if (present) NATIVE_SET_ADD.call(values, key);
884
+ else NATIVE_SET_DELETE.call(values, key);
885
+ }
886
+ return values;
887
+ }
888
+ function keyedMembershipSnapshotHas(snapshot, key) {
889
+ for (let current = snapshot; current; current = current.previous) {
890
+ if (!current.eligible) return void 0;
891
+ if (current.changes?.has(key)) return current.changes.get(key);
892
+ if (current.values) return NATIVE_SET_HAS.call(current.values, key);
893
+ }
894
+ return void 0;
895
+ }
896
+ function keyedMembershipDeltaSnapshot(value, previous) {
897
+ if (!previous.eligible || !previous.sourceToken) return void 0;
898
+ const target = compilerObject(value);
899
+ if (!target) return void 0;
900
+ const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "set");
901
+ if (!changedKeys) return void 0;
902
+ if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
903
+ return void 0;
904
+ }
905
+ const changes = /* @__PURE__ */ new Map();
906
+ const targetedKeys = /* @__PURE__ */ new Set();
907
+ try {
908
+ for (const key of changedKeys) {
909
+ if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
910
+ const present = NATIVE_SET_HAS.call(value, key);
911
+ const before = keyedMembershipSnapshotHas(previous, key);
912
+ if (before === void 0) return void 0;
913
+ changes.set(key, present);
914
+ if (before !== present) NATIVE_SET_ADD.call(targetedKeys, String(key));
915
+ }
916
+ } catch {
917
+ return void 0;
918
+ }
919
+ const depth = (previous.depth || 0) + 1;
920
+ if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
921
+ return {
922
+ eligible: true,
923
+ previous,
924
+ changes,
925
+ sourceToken: commitCompilerKeyedCollection(value),
926
+ targetedKeys,
927
+ depth
928
+ };
929
+ }
930
+ function keyedMembershipTargetSnapshot(value, previous) {
931
+ if (previous) {
932
+ const delta = keyedMembershipDeltaSnapshot(value, previous);
933
+ if (delta) return delta;
934
+ }
935
+ if (typeof value !== "object" || value === null) return { eligible: false };
936
+ let iterator;
937
+ try {
938
+ iterator = NATIVE_SET_VALUES.call(value);
939
+ } catch {
940
+ return { eligible: false };
941
+ }
942
+ if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
943
+ return { eligible: false };
944
+ }
945
+ const values = /* @__PURE__ */ new Set();
946
+ try {
947
+ for (const entry of iterator) {
948
+ if (!keyedIdentityTargetSnapshot(entry).eligible) return { eligible: false };
949
+ NATIVE_SET_ADD.call(values, entry);
950
+ }
951
+ } catch {
952
+ return { eligible: false };
953
+ }
954
+ return {
955
+ eligible: true,
956
+ values,
957
+ sourceToken: commitCompilerKeyedCollection(value),
958
+ depth: 0
959
+ };
960
+ }
961
+ function keyedMembershipChangedKeys(previousSnapshot, nextSnapshot) {
962
+ if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
963
+ const previous = materializeKeyedMembershipSnapshot(previousSnapshot);
964
+ const next = materializeKeyedMembershipSnapshot(nextSnapshot);
965
+ const keys = /* @__PURE__ */ new Set();
966
+ if (!previous || !next) return keys;
967
+ for (const value of previous) {
968
+ if (!NATIVE_SET_HAS.call(next, value)) NATIVE_SET_ADD.call(keys, String(value));
969
+ }
970
+ for (const value of next) {
971
+ if (!NATIVE_SET_HAS.call(previous, value)) NATIVE_SET_ADD.call(keys, String(value));
972
+ }
973
+ return keys;
974
+ }
975
+ var NATIVE_MAP_PROTOTYPE = Map.prototype;
976
+ var NATIVE_MAP_GET = Map.prototype.get;
977
+ var NATIVE_MAP_HAS = Map.prototype.has;
978
+ var NATIVE_MAP_SET = Map.prototype.set;
979
+ var NATIVE_MAP_DELETE = Map.prototype.delete;
980
+ var NATIVE_MAP_ENTRIES = Map.prototype.entries;
981
+ function isSafeKeyedMapLookupValue(value) {
982
+ return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean";
983
+ }
984
+ function materializeKeyedMapLookupSnapshot(snapshot) {
985
+ if (!snapshot.eligible) return void 0;
986
+ if (snapshot.values) return new Map(snapshot.values);
987
+ if (!snapshot.previous || !snapshot.changes) return void 0;
988
+ const values = materializeKeyedMapLookupSnapshot(snapshot.previous);
989
+ if (!values) return void 0;
990
+ for (const [key, entry] of snapshot.changes) {
991
+ if (entry.present) NATIVE_MAP_SET.call(values, key, entry.value);
992
+ else NATIVE_MAP_DELETE.call(values, key);
993
+ }
994
+ return values;
995
+ }
996
+ function keyedMapLookupSnapshotValue(snapshot, key) {
997
+ for (let current = snapshot; current; current = current.previous) {
998
+ if (!current.eligible) return void 0;
999
+ const changed = current.changes?.get(key);
1000
+ if (changed) return changed;
1001
+ if (current.values) {
1002
+ const present = NATIVE_MAP_HAS.call(current.values, key);
1003
+ return {
1004
+ present,
1005
+ ...present ? { value: NATIVE_MAP_GET.call(current.values, key) } : {}
1006
+ };
1007
+ }
1008
+ }
1009
+ return void 0;
1010
+ }
1011
+ function keyedMapLookupDeltaSnapshot(value, previous) {
1012
+ if (!previous.eligible || !previous.sourceToken) return void 0;
1013
+ const target = compilerObject(value);
1014
+ if (!target) return void 0;
1015
+ const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "map");
1016
+ if (!changedKeys) return void 0;
1017
+ if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
1018
+ return void 0;
1019
+ }
1020
+ const changes = /* @__PURE__ */ new Map();
1021
+ const targetedKeys = /* @__PURE__ */ new Set();
1022
+ try {
1023
+ for (const key of changedKeys) {
1024
+ if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
1025
+ const present = NATIVE_MAP_HAS.call(value, key);
1026
+ const entry = present ? NATIVE_MAP_GET.call(value, key) : void 0;
1027
+ if (present && !isSafeKeyedMapLookupValue(entry)) return void 0;
1028
+ const before = keyedMapLookupSnapshotValue(previous, key);
1029
+ if (!before) return void 0;
1030
+ changes.set(key, { present, ...present ? { value: entry } : {} });
1031
+ if (before.present !== present || !Object.is(before.value, entry)) {
1032
+ NATIVE_SET_ADD.call(targetedKeys, String(key));
1033
+ }
1034
+ }
1035
+ } catch {
1036
+ return void 0;
1037
+ }
1038
+ const depth = (previous.depth || 0) + 1;
1039
+ if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
1040
+ return {
1041
+ eligible: true,
1042
+ previous,
1043
+ changes,
1044
+ sourceToken: commitCompilerKeyedCollection(value),
1045
+ targetedKeys,
1046
+ depth
1047
+ };
1048
+ }
1049
+ function keyedMapLookupTargetSnapshot(value, previous) {
1050
+ if (previous) {
1051
+ const delta = keyedMapLookupDeltaSnapshot(value, previous);
1052
+ if (delta) return delta;
1053
+ }
1054
+ if (typeof value !== "object" || value === null) return { eligible: false };
1055
+ let iterator;
1056
+ try {
1057
+ iterator = NATIVE_MAP_ENTRIES.call(value);
1058
+ } catch {
1059
+ return { eligible: false };
1060
+ }
1061
+ if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
1062
+ return { eligible: false };
1063
+ }
1064
+ const values = /* @__PURE__ */ new Map();
1065
+ try {
1066
+ for (const [key, entry] of iterator) {
1067
+ if (!keyedIdentityTargetSnapshot(key).eligible || !isSafeKeyedMapLookupValue(entry)) {
1068
+ return { eligible: false };
1069
+ }
1070
+ NATIVE_MAP_SET.call(values, key, entry);
1071
+ }
1072
+ } catch {
1073
+ return { eligible: false };
1074
+ }
1075
+ return {
1076
+ eligible: true,
1077
+ values,
1078
+ sourceToken: commitCompilerKeyedCollection(value),
1079
+ depth: 0
1080
+ };
1081
+ }
1082
+ function keyedMapLookupChangedKeys(previousSnapshot, nextSnapshot) {
1083
+ if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
1084
+ const previous = materializeKeyedMapLookupSnapshot(previousSnapshot);
1085
+ const next = materializeKeyedMapLookupSnapshot(nextSnapshot);
1086
+ const keys = /* @__PURE__ */ new Set();
1087
+ if (!previous || !next) return keys;
1088
+ for (const [key, value] of previous) {
1089
+ if (!Object.is(value, NATIVE_MAP_GET.call(next, key))) {
1090
+ NATIVE_SET_ADD.call(keys, String(key));
1091
+ }
1092
+ }
1093
+ for (const [key, value] of next) {
1094
+ if (!Object.is(value, NATIVE_MAP_GET.call(previous, key))) {
1095
+ NATIVE_SET_ADD.call(keys, String(key));
1096
+ }
1097
+ }
1098
+ return keys;
1099
+ }
409
1100
  function normalizedKeyedRowBindingValue(binding, value) {
410
1101
  return binding.kind === "text" ? renderTextValue(value) : value;
411
1102
  }
@@ -1877,6 +2568,475 @@ function longestIncreasingSubsequencePositions(sequence) {
1877
2568
  }
1878
2569
  return positions;
1879
2570
  }
2571
+ var keyedUpdateRuntime = {
2572
+ append: reconcileCompilerKeyedArrayAppend,
2573
+ commit: commitCompilerKeyedCollection,
2574
+ reconcile: reconcileCompilerKeyedMapUpdate
2575
+ };
2576
+ var keyedFilterUpdateRuntime = {
2577
+ ...keyedUpdateRuntime,
2578
+ filter: reconcileCompilerKeyedArrayFilter
2579
+ };
2580
+ var keyedPrependUpdateRuntime = {
2581
+ ...keyedUpdateRuntime,
2582
+ prepend: reconcileCompilerKeyedArrayPrepend
2583
+ };
2584
+ var keyedFilterPrependUpdateRuntime = {
2585
+ ...keyedFilterUpdateRuntime,
2586
+ prepend: reconcileCompilerKeyedArrayPrepend
2587
+ };
2588
+ var keyedPositionUpdateRuntime = {
2589
+ ...keyedUpdateRuntime,
2590
+ position: reconcileCompilerKeyedArrayPosition
2591
+ };
2592
+ var keyedReorderUpdateRuntime = {
2593
+ ...keyedUpdateRuntime,
2594
+ reorder: reconcileCompilerKeyedArrayReorder
2595
+ };
2596
+ var keyedCompleteUpdateRuntime = {
2597
+ ...keyedFilterPrependUpdateRuntime,
2598
+ rollingWindow: reconcileCompilerKeyedArrayRollingWindow
2599
+ };
2600
+ var keyedEveryUpdateRuntime = {
2601
+ ...keyedCompleteUpdateRuntime,
2602
+ position: reconcileCompilerKeyedArrayPosition,
2603
+ reorder: reconcileCompilerKeyedArrayReorder
2604
+ };
2605
+ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
2606
+ const dependency = props.collectionDependency;
2607
+ if (dependency === void 0) return void 0;
2608
+ const dependencies = props.dependencies || props.structureDependencies || [];
2609
+ const relevantDirty = [...dirtyState].filter((index) => dependencies.includes(index));
2610
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== dependency) return void 0;
2611
+ const finalValue = props.items();
2612
+ const hintedIndices = compilerKeyedMapChangedIndices(finalValue, collectionToken);
2613
+ if (!hintedIndices || !Array.isArray(finalValue) || finalValue.length !== instances.size) {
2614
+ return void 0;
2615
+ }
2616
+ const changedIndices = [...new Set(hintedIndices)].sort((left, right) => left - right);
2617
+ const updates = [];
2618
+ try {
2619
+ for (const index of changedIndices) {
2620
+ if (!Number.isSafeInteger(index) || index < 0 || index >= finalValue.length) return void 0;
2621
+ const item = finalValue[index];
2622
+ const key = keyedRowIdentity(props.rowKey(item, index));
2623
+ const instance = instances.get(key);
2624
+ if (!instance || instance.index !== index) return void 0;
2625
+ updates.push({ key, item, index, instance });
2626
+ }
2627
+ } catch {
2628
+ return void 0;
2629
+ }
2630
+ const conditionalChanges = [];
2631
+ for (const { key, item, index, instance } of updates) {
2632
+ if (props.hostBlocks) {
2633
+ const descriptor = props.create(item, index);
2634
+ if (!instance.scope?.update(descriptor)) {
2635
+ return { collectionToken, conditionalChanges: [], fallback: true };
2636
+ }
2637
+ }
2638
+ applyKeyedRowBindings(props, instance, item, index);
2639
+ const conditionalValues = conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
2640
+ for (const [id, values] of conditionalValues) {
2641
+ if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
2642
+ conditionalChanges.push({ key, id, item, index });
2643
+ }
2644
+ }
2645
+ instance.conditionalValues = conditionalValues;
2646
+ instance.item = item;
2647
+ }
2648
+ return {
2649
+ collectionToken: commitCompilerKeyedCollection(finalValue),
2650
+ conditionalChanges,
2651
+ fallback: false
2652
+ };
2653
+ }
2654
+ function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2655
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || props.collectionDependency === void 0) {
2656
+ return void 0;
2657
+ }
2658
+ const collectionDependency = props.collectionDependency;
2659
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2660
+ return void 0;
2661
+ }
2662
+ const dependencies = props.dependencies || props.structureDependencies;
2663
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2664
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2665
+ return void 0;
2666
+ }
2667
+ const finalValue = props.items();
2668
+ const startIndex = compilerKeyedArrayAppendStart(finalValue, collectionToken, instances.size);
2669
+ if (startIndex === void 0 || !Array.isArray(finalValue)) return void 0;
2670
+ const nextInstances = new Map(instances);
2671
+ const appended = [];
2672
+ try {
2673
+ for (let index = startIndex; index < finalValue.length; index += 1) {
2674
+ const item = finalValue[index];
2675
+ const key = keyedRowIdentity(props.rowKey(item, index));
2676
+ if (nextInstances.has(key)) return void 0;
2677
+ const descriptor = props.create(item, index);
2678
+ const instance = {
2679
+ key,
2680
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2681
+ values: readKeyedRowBindingValues(props, item, index),
2682
+ item,
2683
+ index,
2684
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2685
+ };
2686
+ appended.push(instance);
2687
+ nextInstances.set(key, instance);
2688
+ }
2689
+ } catch {
2690
+ return void 0;
2691
+ }
2692
+ if (appended.length > 0) {
2693
+ const fragment = root.ownerDocument.createDocumentFragment();
2694
+ for (const instance of appended) fragment.append(instance.element);
2695
+ root.append(fragment);
2696
+ }
2697
+ return nextInstances;
2698
+ }
2699
+ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2700
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
2701
+ return void 0;
2702
+ }
2703
+ const collectionDependency = props.collectionDependency;
2704
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2705
+ return void 0;
2706
+ }
2707
+ const dependencies = props.dependencies || props.structureDependencies;
2708
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2709
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2710
+ return void 0;
2711
+ }
2712
+ const finalValue = props.items();
2713
+ const update = compilerKeyedArrayRollingWindow(finalValue, collectionToken, instances.size);
2714
+ if (!update || !Array.isArray(finalValue)) return void 0;
2715
+ const previousInstances = [...instances.values()];
2716
+ const retainedLength = update.retainedEnd - update.retainedStart;
2717
+ const survivors = [];
2718
+ try {
2719
+ for (let index = 0; index < retainedLength; index += 1) {
2720
+ const sourceIndex = update.retainedStart + index;
2721
+ const instance = previousInstances[sourceIndex];
2722
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
2723
+ return void 0;
2724
+ }
2725
+ survivors.push(instance);
2726
+ }
2727
+ } catch {
2728
+ return void 0;
2729
+ }
2730
+ const knownKeys = new Set(instances.keys());
2731
+ const incoming = [];
2732
+ try {
2733
+ for (let index = retainedLength; index < finalValue.length; index += 1) {
2734
+ const item = finalValue[index];
2735
+ const key = keyedRowIdentity(props.rowKey(item, index));
2736
+ if (knownKeys.has(key)) return void 0;
2737
+ knownKeys.add(key);
2738
+ const descriptor = props.create(item, index);
2739
+ incoming.push({
2740
+ key,
2741
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2742
+ values: readKeyedRowBindingValues(props, item, index),
2743
+ item,
2744
+ index,
2745
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2746
+ });
2747
+ }
2748
+ } catch {
2749
+ return void 0;
2750
+ }
2751
+ for (let index = 0; index < update.retainedStart; index += 1) {
2752
+ previousInstances[index].scope?.cleanup();
2753
+ previousInstances[index].element.remove();
2754
+ }
2755
+ for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
2756
+ if (incoming.length > 0) {
2757
+ const fragment = root.ownerDocument.createDocumentFragment();
2758
+ for (const instance of incoming) fragment.append(instance.element);
2759
+ root.append(fragment);
2760
+ }
2761
+ const nextInstances = new Map(
2762
+ [...survivors, ...incoming].map((instance) => [instance.key, instance])
2763
+ );
2764
+ return nextInstances;
2765
+ }
2766
+ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2767
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
2768
+ return void 0;
2769
+ }
2770
+ const collectionDependency = props.collectionDependency;
2771
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2772
+ return void 0;
2773
+ }
2774
+ const dependencies = props.dependencies || props.structureDependencies;
2775
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2776
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2777
+ return void 0;
2778
+ }
2779
+ const finalValue = props.items();
2780
+ const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
2781
+ if (!update || !Array.isArray(finalValue)) return void 0;
2782
+ const previousInstances = [...instances.values()];
2783
+ const previous = previousInstances[update.position];
2784
+ if (update.kind === "remove") {
2785
+ if (!previous || previous.index !== update.position) return void 0;
2786
+ previous.scope?.cleanup();
2787
+ previous.element.remove();
2788
+ previousInstances.splice(update.position, 1);
2789
+ for (let index = update.position; index < previousInstances.length; index += 1) {
2790
+ previousInstances[index].index = index;
2791
+ }
2792
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2793
+ }
2794
+ let item;
2795
+ let key;
2796
+ try {
2797
+ item = finalValue[update.position];
2798
+ key = keyedRowIdentity(props.rowKey(item, update.position));
2799
+ } catch {
2800
+ return void 0;
2801
+ }
2802
+ if (update.kind === "insert") {
2803
+ if (instances.has(key)) return void 0;
2804
+ let inserted;
2805
+ try {
2806
+ const descriptor = props.create(item, update.position);
2807
+ inserted = {
2808
+ key,
2809
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2810
+ values: readKeyedRowBindingValues(props, item, update.position),
2811
+ item,
2812
+ index: update.position,
2813
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2814
+ };
2815
+ } catch {
2816
+ return void 0;
2817
+ }
2818
+ root.insertBefore(inserted.element, previous?.element || null);
2819
+ previousInstances.splice(update.position, 0, inserted);
2820
+ for (let index = update.position + 1; index < previousInstances.length; index += 1) {
2821
+ previousInstances[index].index = index;
2822
+ }
2823
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2824
+ }
2825
+ if (!previous || previous.index !== update.position) return void 0;
2826
+ if (key === previous.key) {
2827
+ try {
2828
+ applyKeyedRowBindings(props, previous, item, update.position);
2829
+ } catch {
2830
+ return void 0;
2831
+ }
2832
+ previous.item = item;
2833
+ return instances;
2834
+ }
2835
+ if (instances.has(key)) return void 0;
2836
+ let replacement;
2837
+ try {
2838
+ const descriptor = props.create(item, update.position);
2839
+ replacement = {
2840
+ key,
2841
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2842
+ values: readKeyedRowBindingValues(props, item, update.position),
2843
+ item,
2844
+ index: update.position,
2845
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2846
+ };
2847
+ } catch {
2848
+ return void 0;
2849
+ }
2850
+ previous.scope?.cleanup();
2851
+ previous.element.replaceWith(replacement.element);
2852
+ previousInstances[update.position] = replacement;
2853
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2854
+ }
2855
+ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2856
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
2857
+ return void 0;
2858
+ }
2859
+ const collectionDependency = props.collectionDependency;
2860
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2861
+ return void 0;
2862
+ }
2863
+ const dependencies = props.dependencies || props.structureDependencies;
2864
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2865
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2866
+ return void 0;
2867
+ }
2868
+ const finalValue = props.items();
2869
+ const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
2870
+ if (!update || !Array.isArray(finalValue)) return void 0;
2871
+ const previousInstances = [...instances.values()];
2872
+ if (update.kind === "sort") {
2873
+ const instancesByItem = /* @__PURE__ */ new Map();
2874
+ try {
2875
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
2876
+ const instance = previousInstances[sourceIndex];
2877
+ if (instance.index !== sourceIndex || instancesByItem.has(instance.item)) return void 0;
2878
+ instancesByItem.set(instance.item, instance);
2879
+ }
2880
+ const nextInstances = [];
2881
+ const sequence = [];
2882
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
2883
+ const item = finalValue[targetIndex];
2884
+ const instance = instancesByItem.get(item);
2885
+ if (!instance || !Object.is(instance.item, item)) return void 0;
2886
+ instancesByItem.delete(item);
2887
+ nextInstances.push(instance);
2888
+ sequence.push(instance.index);
2889
+ }
2890
+ if (instancesByItem.size > 0) return void 0;
2891
+ const activeElement2 = root.ownerDocument.activeElement;
2892
+ const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
2893
+ const stablePositions = longestIncreasingSubsequencePositions(sequence);
2894
+ let anchor2 = null;
2895
+ for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
2896
+ const instance = nextInstances[index];
2897
+ if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
2898
+ root.insertBefore(instance.element, anchor2);
2899
+ }
2900
+ anchor2 = instance.element;
2901
+ instance.index = index;
2902
+ }
2903
+ if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
2904
+ activeElement2.focus({ preventScroll: true });
2905
+ }
2906
+ return new Map(nextInstances.map((instance) => [instance.key, instance]));
2907
+ } catch {
2908
+ return void 0;
2909
+ }
2910
+ }
2911
+ try {
2912
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
2913
+ const instance = previousInstances[sourceIndex];
2914
+ const targetIndex = previousInstances.length - sourceIndex - 1;
2915
+ if (instance.index !== sourceIndex || !Object.is(instance.item, finalValue[targetIndex])) {
2916
+ return void 0;
2917
+ }
2918
+ }
2919
+ } catch {
2920
+ return void 0;
2921
+ }
2922
+ const activeElement = root.ownerDocument.activeElement;
2923
+ const restoreFocus = Boolean(activeElement && root.contains(activeElement));
2924
+ let anchor = previousInstances[0]?.element || null;
2925
+ for (let sourceIndex = 1; sourceIndex < previousInstances.length; sourceIndex += 1) {
2926
+ const element = previousInstances[sourceIndex].element;
2927
+ root.insertBefore(element, anchor);
2928
+ anchor = element;
2929
+ }
2930
+ previousInstances.reverse();
2931
+ for (let index = 0; index < previousInstances.length; index += 1) {
2932
+ previousInstances[index].index = index;
2933
+ }
2934
+ if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
2935
+ activeElement.focus({ preventScroll: true });
2936
+ }
2937
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2938
+ }
2939
+ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2940
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.prependIndexIndependent || props.collectionDependency === void 0) {
2941
+ return void 0;
2942
+ }
2943
+ const collectionDependency = props.collectionDependency;
2944
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2945
+ return void 0;
2946
+ }
2947
+ const dependencies = props.dependencies || props.structureDependencies;
2948
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2949
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2950
+ return void 0;
2951
+ }
2952
+ const finalValue = props.items();
2953
+ const prefixLength = compilerKeyedArrayPrependLength(finalValue, collectionToken, instances.size);
2954
+ if (prefixLength === void 0 || !Array.isArray(finalValue)) return void 0;
2955
+ const previousInstances = [...instances.values()];
2956
+ for (let index = 0; index < previousInstances.length; index += 1) {
2957
+ const instance = previousInstances[index];
2958
+ if (instance.index !== index || !Object.is(instance.item, finalValue[prefixLength + index])) {
2959
+ return void 0;
2960
+ }
2961
+ }
2962
+ const knownKeys = new Set(instances.keys());
2963
+ const prepended = [];
2964
+ try {
2965
+ for (let index = 0; index < prefixLength; index += 1) {
2966
+ const item = finalValue[index];
2967
+ const key = keyedRowIdentity(props.rowKey(item, index));
2968
+ if (knownKeys.has(key)) return void 0;
2969
+ knownKeys.add(key);
2970
+ const descriptor = props.create(item, index);
2971
+ prepended.push({
2972
+ key,
2973
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2974
+ values: readKeyedRowBindingValues(props, item, index),
2975
+ item,
2976
+ index,
2977
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2978
+ });
2979
+ }
2980
+ } catch {
2981
+ return void 0;
2982
+ }
2983
+ if (prepended.length > 0) {
2984
+ const fragment = root.ownerDocument.createDocumentFragment();
2985
+ for (const instance of prepended) fragment.append(instance.element);
2986
+ root.insertBefore(fragment, root.firstChild);
2987
+ }
2988
+ for (let index = 0; index < previousInstances.length; index += 1) {
2989
+ previousInstances[index].index = prefixLength + index;
2990
+ }
2991
+ return new Map([...prepended, ...previousInstances].map((instance) => [instance.key, instance]));
2992
+ }
2993
+ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, instances, reactOwnedRows) {
2994
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
2995
+ return void 0;
2996
+ }
2997
+ const collectionDependency = props.collectionDependency;
2998
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2999
+ return void 0;
3000
+ }
3001
+ const dependencies = props.dependencies || props.structureDependencies;
3002
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
3003
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
3004
+ return void 0;
3005
+ }
3006
+ const finalValue = props.items();
3007
+ const survivorResult = compilerKeyedArrayFilterSurvivors(
3008
+ finalValue,
3009
+ collectionToken,
3010
+ instances.size
3011
+ );
3012
+ if (!survivorResult || !Array.isArray(finalValue)) return void 0;
3013
+ const { indices: survivorIndices, keysStable } = survivorResult;
3014
+ const previousInstances = [...instances.values()];
3015
+ const survivors = [];
3016
+ try {
3017
+ for (let index = 0; index < survivorIndices.length; index += 1) {
3018
+ const sourceIndex = survivorIndices[index];
3019
+ const instance = previousInstances[sourceIndex];
3020
+ const item = finalValue[index];
3021
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !keysStable && keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
3022
+ return void 0;
3023
+ }
3024
+ survivors.push(instance);
3025
+ }
3026
+ } catch {
3027
+ return void 0;
3028
+ }
3029
+ const survivorSet = new Set(survivorIndices);
3030
+ for (let index = 0; index < previousInstances.length; index += 1) {
3031
+ if (survivorSet.has(index)) continue;
3032
+ previousInstances[index].scope?.cleanup();
3033
+ previousInstances[index].element.remove();
3034
+ }
3035
+ for (let index = 0; index < survivors.length; index += 1) {
3036
+ survivors[index].index = index;
3037
+ }
3038
+ return new Map(survivors.map((instance) => [instance.key, instance]));
3039
+ }
1880
3040
  function createKeyedRowConditionalRuntime() {
1881
3041
  class FarmKeyedRowConditional extends React.Component {
1882
3042
  constructor() {
@@ -1947,6 +3107,9 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
1947
3107
  this.propSyncQueued = false;
1948
3108
  this.currentProps = this.props;
1949
3109
  this.instances = /* @__PURE__ */ new Map();
3110
+ this.identityTargets = /* @__PURE__ */ new Map();
3111
+ this.membershipTargets = /* @__PURE__ */ new Map();
3112
+ this.mapLookupTargets = /* @__PURE__ */ new Map();
1950
3113
  this.renderVersion = 0;
1951
3114
  this.eventHandlers = /* @__PURE__ */ new Map();
1952
3115
  this.conditionalListeners = /* @__PURE__ */ new Map();
@@ -2021,8 +3184,123 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2021
3184
  });
2022
3185
  };
2023
3186
  this.refresh = (afterCommit, dirtyState) => {
3187
+ if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
3188
+ const result = options.keyedUpdates.reconcile(
3189
+ this.currentProps,
3190
+ dirtyState,
3191
+ this.collectionToken,
3192
+ this.instances,
3193
+ options.conditionals
3194
+ );
3195
+ if (result) {
3196
+ if (result.fallback) this.activateFallback(afterCommit);
3197
+ else {
3198
+ this.collectionToken = result.collectionToken;
3199
+ this.notifyConditionalChanges(result.conditionalChanges, afterCommit);
3200
+ }
3201
+ return;
3202
+ }
3203
+ const appendedInstances = options.keyedUpdates.append(
3204
+ this.currentProps,
3205
+ dirtyState,
3206
+ this.collectionToken,
3207
+ this.instances,
3208
+ this.root,
3209
+ this.hasReactOwnedRows()
3210
+ );
3211
+ if (appendedInstances) {
3212
+ this.instances = new Map(appendedInstances);
3213
+ this.rebuildElementIndex(this.instances);
3214
+ this.commitCurrentCollection(dirtyState);
3215
+ afterCommit?.();
3216
+ return;
3217
+ }
3218
+ const positionedInstances = options.keyedUpdates.position?.(
3219
+ this.currentProps,
3220
+ dirtyState,
3221
+ this.collectionToken,
3222
+ this.instances,
3223
+ this.root,
3224
+ this.hasReactOwnedRows()
3225
+ );
3226
+ if (positionedInstances) {
3227
+ this.instances = new Map(positionedInstances);
3228
+ this.rebuildElementIndex(this.instances);
3229
+ const keys = [...this.instances.keys()];
3230
+ this.pruneEventHandlers(keys);
3231
+ this.pruneConditionalListeners(keys);
3232
+ this.commitCurrentCollection(dirtyState);
3233
+ afterCommit?.();
3234
+ return;
3235
+ }
3236
+ const reorderedInstances = options.keyedUpdates.reorder?.(
3237
+ this.currentProps,
3238
+ dirtyState,
3239
+ this.collectionToken,
3240
+ this.instances,
3241
+ this.root,
3242
+ this.hasReactOwnedRows()
3243
+ );
3244
+ if (reorderedInstances) {
3245
+ this.instances = new Map(reorderedInstances);
3246
+ this.rebuildElementIndex(this.instances);
3247
+ this.commitCurrentCollection(dirtyState);
3248
+ afterCommit?.();
3249
+ return;
3250
+ }
3251
+ const rollingWindowInstances = options.keyedUpdates.rollingWindow?.(
3252
+ this.currentProps,
3253
+ dirtyState,
3254
+ this.collectionToken,
3255
+ this.instances,
3256
+ this.root,
3257
+ this.hasReactOwnedRows()
3258
+ );
3259
+ if (rollingWindowInstances) {
3260
+ this.instances = new Map(rollingWindowInstances);
3261
+ this.rebuildElementIndex(this.instances);
3262
+ const keys = [...this.instances.keys()];
3263
+ this.pruneEventHandlers(keys);
3264
+ this.pruneConditionalListeners(keys);
3265
+ this.commitCurrentCollection(dirtyState);
3266
+ afterCommit?.();
3267
+ return;
3268
+ }
3269
+ const filteredInstances = options.keyedUpdates.filter?.(
3270
+ this.currentProps,
3271
+ dirtyState,
3272
+ this.collectionToken,
3273
+ this.instances,
3274
+ this.hasReactOwnedRows()
3275
+ );
3276
+ if (filteredInstances) {
3277
+ this.instances = new Map(filteredInstances);
3278
+ this.rebuildElementIndex(this.instances);
3279
+ const keys = [...this.instances.keys()];
3280
+ this.pruneEventHandlers(keys);
3281
+ this.pruneConditionalListeners(keys);
3282
+ this.commitCurrentCollection(dirtyState);
3283
+ afterCommit?.();
3284
+ return;
3285
+ }
3286
+ const prependedInstances = options.keyedUpdates.prepend?.(
3287
+ this.currentProps,
3288
+ dirtyState,
3289
+ this.collectionToken,
3290
+ this.instances,
3291
+ this.root,
3292
+ this.hasReactOwnedRows()
3293
+ );
3294
+ if (prependedInstances) {
3295
+ this.instances = new Map(prependedInstances);
3296
+ this.rebuildElementIndex(this.instances);
3297
+ this.commitCurrentCollection(dirtyState);
3298
+ afterCommit?.();
3299
+ return;
3300
+ }
3301
+ }
2024
3302
  if (dirtyState && this.refreshDirtyBindings(dirtyState, afterCommit)) return;
2025
- this.reconcile(afterCommit);
3303
+ this.reconcile(afterCommit, dirtyState);
2026
3304
  };
2027
3305
  }
2028
3306
  readRows(props) {
@@ -2120,8 +3398,66 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2120
3398
  if (!active.has(key)) this.conditionalListeners.delete(key);
2121
3399
  }
2122
3400
  }
3401
+ commitCurrentCollection(dirtyState) {
3402
+ this.collectionToken = options.keyedUpdates?.commit(this.currentProps.items());
3403
+ this.commitKeyedTargets(dirtyState);
3404
+ }
3405
+ hasSafeMembershipTargets(dirtyState) {
3406
+ for (const binding of this.currentProps.bindings) {
3407
+ const target = binding.membershipTarget;
3408
+ if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
3409
+ if (!keyedMembershipTargetSnapshot(target.read()).eligible) return false;
3410
+ }
3411
+ return true;
3412
+ }
3413
+ hasSafeMapLookupTargets(dirtyState) {
3414
+ for (const binding of this.currentProps.bindings) {
3415
+ const target = binding.mapLookupTarget;
3416
+ if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
3417
+ if (!keyedMapLookupTargetSnapshot(target.read()).eligible) return false;
3418
+ }
3419
+ return true;
3420
+ }
3421
+ commitKeyedTargets(dirtyState) {
3422
+ if (!dirtyState) {
3423
+ this.identityTargets.clear();
3424
+ this.membershipTargets.clear();
3425
+ this.mapLookupTargets.clear();
3426
+ }
3427
+ for (let bindingIndex = 0; bindingIndex < this.currentProps.bindings.length; bindingIndex += 1) {
3428
+ const binding = this.currentProps.bindings[bindingIndex];
3429
+ const identityTarget = binding.identityTarget;
3430
+ if (!identityTarget) {
3431
+ this.identityTargets.delete(bindingIndex);
3432
+ } else if (!dirtyState || dirtyState.has(identityTarget.dependency)) {
3433
+ this.identityTargets.set(
3434
+ bindingIndex,
3435
+ keyedIdentityTargetSnapshot(identityTarget.read())
3436
+ );
3437
+ }
3438
+ const membershipTarget = binding.membershipTarget;
3439
+ if (!membershipTarget) {
3440
+ this.membershipTargets.delete(bindingIndex);
3441
+ } else if (!dirtyState || dirtyState.has(membershipTarget.dependency)) {
3442
+ this.membershipTargets.set(
3443
+ bindingIndex,
3444
+ keyedMembershipTargetSnapshot(membershipTarget.read())
3445
+ );
3446
+ }
3447
+ const mapLookupTarget = binding.mapLookupTarget;
3448
+ if (!mapLookupTarget) {
3449
+ this.mapLookupTargets.delete(bindingIndex);
3450
+ } else if (!dirtyState || dirtyState.has(mapLookupTarget.dependency)) {
3451
+ this.mapLookupTargets.set(
3452
+ bindingIndex,
3453
+ keyedMapLookupTargetSnapshot(mapLookupTarget.read())
3454
+ );
3455
+ }
3456
+ }
3457
+ }
2123
3458
  adopt() {
2124
3459
  if (!this.root) return false;
3460
+ if (!this.hasSafeMembershipTargets() || !this.hasSafeMapLookupTargets()) return false;
2125
3461
  const rows = this.readRows(this.currentProps);
2126
3462
  const elements = [...this.root.children];
2127
3463
  if (!rows || rows.items.length !== elements.length) return false;
@@ -2163,6 +3499,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2163
3499
  this.rebuildElementIndex(instances);
2164
3500
  this.pruneEventHandlers(rows.keys);
2165
3501
  this.pruneConditionalListeners(rows.keys);
3502
+ this.commitCurrentCollection();
2166
3503
  return true;
2167
3504
  }
2168
3505
  hasUnsafeFallbackKeys() {
@@ -2225,21 +3562,132 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2225
3562
  affectedBindingIndices.push(bindingIndex);
2226
3563
  }
2227
3564
  }
2228
- for (const instance of this.instances.values()) {
2229
- for (const bindingIndex of affectedBindingIndices) {
2230
- applyKeyedRowBinding(
2231
- this.currentProps,
2232
- instance,
2233
- instance.item,
2234
- instance.index,
2235
- bindingIndex
3565
+ const nextIdentityTargets = /* @__PURE__ */ new Map();
3566
+ const nextMembershipTargets = /* @__PURE__ */ new Map();
3567
+ const nextMapLookupTargets = /* @__PURE__ */ new Map();
3568
+ for (const bindingIndex of affectedBindingIndices) {
3569
+ const binding = this.currentProps.bindings[bindingIndex];
3570
+ if (binding.identityTarget) {
3571
+ nextIdentityTargets.set(
3572
+ bindingIndex,
3573
+ keyedIdentityTargetSnapshot(binding.identityTarget.read())
3574
+ );
3575
+ }
3576
+ if (binding.membershipTarget) {
3577
+ const snapshot = keyedMembershipTargetSnapshot(
3578
+ binding.membershipTarget.read(),
3579
+ this.membershipTargets.get(bindingIndex)
3580
+ );
3581
+ if (!snapshot.eligible) {
3582
+ this.activateFallback(afterCommit);
3583
+ return true;
3584
+ }
3585
+ nextMembershipTargets.set(bindingIndex, snapshot);
3586
+ }
3587
+ if (binding.mapLookupTarget) {
3588
+ const snapshot = keyedMapLookupTargetSnapshot(
3589
+ binding.mapLookupTarget.read(),
3590
+ this.mapLookupTargets.get(bindingIndex)
2236
3591
  );
3592
+ if (!snapshot.eligible) {
3593
+ this.activateFallback(afterCommit);
3594
+ return true;
3595
+ }
3596
+ nextMapLookupTargets.set(bindingIndex, snapshot);
3597
+ }
3598
+ }
3599
+ for (const bindingIndex of affectedBindingIndices) {
3600
+ const binding = this.currentProps.bindings[bindingIndex];
3601
+ const identityTarget = binding.identityTarget;
3602
+ const previousIdentityTarget = this.identityTargets.get(bindingIndex);
3603
+ const nextIdentityTarget = nextIdentityTargets.get(bindingIndex);
3604
+ const canTargetIdentity = Boolean(
3605
+ identityTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === identityTarget.dependency && dirtyState.has(identityTarget.dependency) && previousIdentityTarget?.eligible && nextIdentityTarget?.eligible
3606
+ );
3607
+ const membershipTarget = binding.membershipTarget;
3608
+ const previousMembershipTarget = this.membershipTargets.get(bindingIndex);
3609
+ const nextMembershipTarget = nextMembershipTargets.get(bindingIndex);
3610
+ const canTargetMembership = Boolean(
3611
+ membershipTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === membershipTarget.dependency && dirtyState.has(membershipTarget.dependency) && previousMembershipTarget?.eligible && nextMembershipTarget?.eligible
3612
+ );
3613
+ const mapLookupTarget = binding.mapLookupTarget;
3614
+ const previousMapLookupTarget = this.mapLookupTargets.get(bindingIndex);
3615
+ const nextMapLookupTarget = nextMapLookupTargets.get(bindingIndex);
3616
+ const canTargetMapLookup = Boolean(
3617
+ mapLookupTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === mapLookupTarget.dependency && dirtyState.has(mapLookupTarget.dependency) && previousMapLookupTarget?.eligible && nextMapLookupTarget?.eligible
3618
+ );
3619
+ if (canTargetMapLookup && previousMapLookupTarget && nextMapLookupTarget) {
3620
+ const keys = keyedMapLookupChangedKeys(previousMapLookupTarget, nextMapLookupTarget);
3621
+ for (const key of keys) {
3622
+ const instance = this.instances.get(key);
3623
+ if (instance) {
3624
+ applyKeyedRowBinding(
3625
+ this.currentProps,
3626
+ instance,
3627
+ instance.item,
3628
+ instance.index,
3629
+ bindingIndex
3630
+ );
3631
+ }
3632
+ }
3633
+ } else if (canTargetMembership && previousMembershipTarget && nextMembershipTarget) {
3634
+ const keys = keyedMembershipChangedKeys(previousMembershipTarget, nextMembershipTarget);
3635
+ for (const key of keys) {
3636
+ const instance = this.instances.get(key);
3637
+ if (instance) {
3638
+ applyKeyedRowBinding(
3639
+ this.currentProps,
3640
+ instance,
3641
+ instance.item,
3642
+ instance.index,
3643
+ bindingIndex
3644
+ );
3645
+ }
3646
+ }
3647
+ } else if (canTargetIdentity && previousIdentityTarget && nextIdentityTarget) {
3648
+ const keys = /* @__PURE__ */ new Set();
3649
+ if (previousIdentityTarget.key !== void 0) keys.add(previousIdentityTarget.key);
3650
+ if (nextIdentityTarget.key !== void 0) keys.add(nextIdentityTarget.key);
3651
+ for (const key of keys) {
3652
+ const instance = this.instances.get(key);
3653
+ if (instance) {
3654
+ applyKeyedRowBinding(
3655
+ this.currentProps,
3656
+ instance,
3657
+ instance.item,
3658
+ instance.index,
3659
+ bindingIndex
3660
+ );
3661
+ }
3662
+ }
3663
+ } else {
3664
+ for (const instance of this.instances.values()) {
3665
+ applyKeyedRowBinding(
3666
+ this.currentProps,
3667
+ instance,
3668
+ instance.item,
3669
+ instance.index,
3670
+ bindingIndex
3671
+ );
3672
+ }
3673
+ }
3674
+ if (nextIdentityTarget) this.identityTargets.set(bindingIndex, nextIdentityTarget);
3675
+ else this.identityTargets.delete(bindingIndex);
3676
+ if (nextMembershipTarget) {
3677
+ this.membershipTargets.set(bindingIndex, nextMembershipTarget);
3678
+ } else {
3679
+ this.membershipTargets.delete(bindingIndex);
3680
+ }
3681
+ if (nextMapLookupTarget) {
3682
+ this.mapLookupTargets.set(bindingIndex, nextMapLookupTarget);
3683
+ } else {
3684
+ this.mapLookupTargets.delete(bindingIndex);
2237
3685
  }
2238
3686
  }
2239
3687
  afterCommit?.();
2240
3688
  return true;
2241
3689
  }
2242
- reconcileStableRows(rows, afterCommit) {
3690
+ reconcileStableRows(rows, afterCommit, dirtyState) {
2243
3691
  if (rows.keys.length !== this.instances.size) return false;
2244
3692
  let index = 0;
2245
3693
  for (const key of this.instances.keys()) {
@@ -2266,17 +3714,23 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2266
3714
  );
2267
3715
  for (const [id, values] of conditionalValues) {
2268
3716
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2269
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3717
+ conditionalChanges.push({
3718
+ key,
3719
+ id,
3720
+ item: rows.items[index],
3721
+ index
3722
+ });
2270
3723
  }
2271
3724
  }
2272
3725
  existing.conditionalValues = conditionalValues;
2273
3726
  existing.item = rows.items[index];
2274
3727
  existing.index = index;
2275
3728
  }
3729
+ this.commitCurrentCollection(dirtyState);
2276
3730
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2277
3731
  return true;
2278
3732
  }
2279
- reconcileSingleRemoval(rows, afterCommit) {
3733
+ reconcileSingleRemoval(rows, afterCommit, dirtyState) {
2280
3734
  if (this.hasReactOwnedRows() || rows.keys.length + 1 !== this.instances.size) return false;
2281
3735
  const previousKeys = [...this.instances.keys()];
2282
3736
  let removedIndex = 0;
@@ -2309,7 +3763,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2309
3763
  );
2310
3764
  for (const [id, values] of conditionalValues) {
2311
3765
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2312
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3766
+ conditionalChanges.push({
3767
+ key,
3768
+ id,
3769
+ item: rows.items[index],
3770
+ index
3771
+ });
2313
3772
  }
2314
3773
  }
2315
3774
  existing.conditionalValues = conditionalValues;
@@ -2321,10 +3780,11 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2321
3780
  this.instances.delete(removedKey);
2322
3781
  this.eventHandlers.delete(removedKey);
2323
3782
  this.conditionalListeners.delete(removedKey);
3783
+ this.commitCurrentCollection(dirtyState);
2324
3784
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2325
3785
  return true;
2326
3786
  }
2327
- reconcile(afterCommit) {
3787
+ reconcile(afterCommit, dirtyState) {
2328
3788
  if (!this.mounted || !this.root) {
2329
3789
  afterCommit?.();
2330
3790
  return;
@@ -2338,6 +3798,14 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2338
3798
  this.forceUpdate(afterCommit);
2339
3799
  return;
2340
3800
  }
3801
+ if (!this.hasSafeMembershipTargets(dirtyState)) {
3802
+ this.activateFallback(afterCommit);
3803
+ return;
3804
+ }
3805
+ if (!this.hasSafeMapLookupTargets(dirtyState)) {
3806
+ this.activateFallback(afterCommit);
3807
+ return;
3808
+ }
2341
3809
  const rows = this.readRows(this.currentProps);
2342
3810
  if (!rows) {
2343
3811
  this.activateFallback(afterCommit);
@@ -2357,11 +3825,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2357
3825
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
2358
3826
  this.eventHandlers.clear();
2359
3827
  this.conditionalListeners.clear();
3828
+ this.commitCurrentCollection(dirtyState);
2360
3829
  afterCommit?.();
2361
3830
  return;
2362
3831
  }
2363
- if (this.reconcileStableRows(rows, afterCommit)) return;
2364
- if (this.reconcileSingleRemoval(rows, afterCommit)) return;
3832
+ if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
3833
+ if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
2365
3834
  const activeElement = this.root.ownerDocument.activeElement;
2366
3835
  const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
2367
3836
  const nextKeys = new Set(rows.keys);
@@ -2399,7 +3868,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2399
3868
  );
2400
3869
  for (const [id, values] of conditionalValues) {
2401
3870
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2402
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3871
+ conditionalChanges.push({
3872
+ key,
3873
+ id,
3874
+ item: rows.items[index],
3875
+ index
3876
+ });
2403
3877
  }
2404
3878
  }
2405
3879
  existing.conditionalValues = conditionalValues;
@@ -2465,6 +3939,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2465
3939
  if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
2466
3940
  activeElement.focus({ preventScroll: true });
2467
3941
  }
3942
+ this.commitCurrentCollection(dirtyState);
2468
3943
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2469
3944
  }
2470
3945
  schedulePropSync() {
@@ -2504,6 +3979,9 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2504
3979
  this.root = null;
2505
3980
  this.cleanupHostScopes();
2506
3981
  this.instances.clear();
3982
+ this.identityTargets.clear();
3983
+ this.membershipTargets.clear();
3984
+ this.mapLookupTargets.clear();
2507
3985
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
2508
3986
  this.eventHandlers.clear();
2509
3987
  this.conditionalListeners.clear();
@@ -2934,6 +4412,70 @@ var keyedRowsRuntimeFeature = {
2934
4412
  KeyedRows: createKeyedRowsBlockComponent(owner)
2935
4413
  })
2936
4414
  };
4415
+ var keyedRowsHintedRuntimeFeature = {
4416
+ name: "keyed-rows:hinted",
4417
+ create: (owner) => ({
4418
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4419
+ keyedUpdates: keyedUpdateRuntime
4420
+ })
4421
+ })
4422
+ };
4423
+ var keyedRowsPositionHintedRuntimeFeature = {
4424
+ name: "keyed-rows:position-hinted",
4425
+ create: (owner) => ({
4426
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4427
+ keyedUpdates: keyedPositionUpdateRuntime
4428
+ })
4429
+ })
4430
+ };
4431
+ var keyedRowsReorderHintedRuntimeFeature = {
4432
+ name: "keyed-rows:reorder-hinted",
4433
+ create: (owner) => ({
4434
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4435
+ keyedUpdates: keyedReorderUpdateRuntime
4436
+ })
4437
+ })
4438
+ };
4439
+ var keyedRowsAllHintedRuntimeFeature = {
4440
+ name: "keyed-rows:all-hinted",
4441
+ create: (owner) => ({
4442
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4443
+ keyedUpdates: keyedCompleteUpdateRuntime
4444
+ })
4445
+ })
4446
+ };
4447
+ var keyedRowsEveryHintedRuntimeFeature = {
4448
+ name: "keyed-rows:every-hinted",
4449
+ create: (owner) => ({
4450
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4451
+ keyedUpdates: keyedEveryUpdateRuntime
4452
+ })
4453
+ })
4454
+ };
4455
+ var keyedRowsFilterHintedRuntimeFeature = {
4456
+ name: "keyed-rows:filter-hinted",
4457
+ create: (owner) => ({
4458
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4459
+ keyedUpdates: keyedFilterUpdateRuntime
4460
+ })
4461
+ })
4462
+ };
4463
+ var keyedRowsPrependHintedRuntimeFeature = {
4464
+ name: "keyed-rows:prepend-hinted",
4465
+ create: (owner) => ({
4466
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4467
+ keyedUpdates: keyedPrependUpdateRuntime
4468
+ })
4469
+ })
4470
+ };
4471
+ var keyedRowsFilterPrependHintedRuntimeFeature = {
4472
+ name: "keyed-rows:filter-prepend-hinted",
4473
+ create: (owner) => ({
4474
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4475
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4476
+ })
4477
+ })
4478
+ };
2937
4479
  var keyedRowsConditionalRuntimeFeature = {
2938
4480
  name: "keyed-rows:conditional",
2939
4481
  create: (owner) => ({
@@ -2942,6 +4484,78 @@ var keyedRowsConditionalRuntimeFeature = {
2942
4484
  })
2943
4485
  })
2944
4486
  };
4487
+ var keyedRowsConditionalHintedRuntimeFeature = {
4488
+ name: "keyed-rows:conditional:hinted",
4489
+ create: (owner) => ({
4490
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4491
+ conditionals: createKeyedRowConditionalRuntime(),
4492
+ keyedUpdates: keyedUpdateRuntime
4493
+ })
4494
+ })
4495
+ };
4496
+ var keyedRowsConditionalPositionHintedRuntimeFeature = {
4497
+ name: "keyed-rows:conditional:position-hinted",
4498
+ create: (owner) => ({
4499
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4500
+ conditionals: createKeyedRowConditionalRuntime(),
4501
+ keyedUpdates: keyedPositionUpdateRuntime
4502
+ })
4503
+ })
4504
+ };
4505
+ var keyedRowsConditionalReorderHintedRuntimeFeature = {
4506
+ name: "keyed-rows:conditional:reorder-hinted",
4507
+ create: (owner) => ({
4508
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4509
+ conditionals: createKeyedRowConditionalRuntime(),
4510
+ keyedUpdates: keyedReorderUpdateRuntime
4511
+ })
4512
+ })
4513
+ };
4514
+ var keyedRowsConditionalAllHintedRuntimeFeature = {
4515
+ name: "keyed-rows:conditional:all-hinted",
4516
+ create: (owner) => ({
4517
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4518
+ conditionals: createKeyedRowConditionalRuntime(),
4519
+ keyedUpdates: keyedCompleteUpdateRuntime
4520
+ })
4521
+ })
4522
+ };
4523
+ var keyedRowsConditionalEveryHintedRuntimeFeature = {
4524
+ name: "keyed-rows:conditional:every-hinted",
4525
+ create: (owner) => ({
4526
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4527
+ conditionals: createKeyedRowConditionalRuntime(),
4528
+ keyedUpdates: keyedEveryUpdateRuntime
4529
+ })
4530
+ })
4531
+ };
4532
+ var keyedRowsConditionalFilterHintedRuntimeFeature = {
4533
+ name: "keyed-rows:conditional:filter-hinted",
4534
+ create: (owner) => ({
4535
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4536
+ conditionals: createKeyedRowConditionalRuntime(),
4537
+ keyedUpdates: keyedFilterUpdateRuntime
4538
+ })
4539
+ })
4540
+ };
4541
+ var keyedRowsConditionalPrependHintedRuntimeFeature = {
4542
+ name: "keyed-rows:conditional:prepend-hinted",
4543
+ create: (owner) => ({
4544
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4545
+ conditionals: createKeyedRowConditionalRuntime(),
4546
+ keyedUpdates: keyedPrependUpdateRuntime
4547
+ })
4548
+ })
4549
+ };
4550
+ var keyedRowsConditionalFilterPrependHintedRuntimeFeature = {
4551
+ name: "keyed-rows:conditional:filter-prepend-hinted",
4552
+ create: (owner) => ({
4553
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4554
+ conditionals: createKeyedRowConditionalRuntime(),
4555
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4556
+ })
4557
+ })
4558
+ };
2945
4559
  var keyedRowsHostRuntimeFeature = {
2946
4560
  name: "keyed-rows:host",
2947
4561
  create: (owner) => ({
@@ -2950,6 +4564,78 @@ var keyedRowsHostRuntimeFeature = {
2950
4564
  })
2951
4565
  })
2952
4566
  };
4567
+ var keyedRowsHostHintedRuntimeFeature = {
4568
+ name: "keyed-rows:host:hinted",
4569
+ create: (owner) => ({
4570
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4571
+ hostBlocks: createKeyedRowHostRuntime(),
4572
+ keyedUpdates: keyedUpdateRuntime
4573
+ })
4574
+ })
4575
+ };
4576
+ var keyedRowsHostPositionHintedRuntimeFeature = {
4577
+ name: "keyed-rows:host:position-hinted",
4578
+ create: (owner) => ({
4579
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4580
+ hostBlocks: createKeyedRowHostRuntime(),
4581
+ keyedUpdates: keyedPositionUpdateRuntime
4582
+ })
4583
+ })
4584
+ };
4585
+ var keyedRowsHostReorderHintedRuntimeFeature = {
4586
+ name: "keyed-rows:host:reorder-hinted",
4587
+ create: (owner) => ({
4588
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4589
+ hostBlocks: createKeyedRowHostRuntime(),
4590
+ keyedUpdates: keyedReorderUpdateRuntime
4591
+ })
4592
+ })
4593
+ };
4594
+ var keyedRowsHostAllHintedRuntimeFeature = {
4595
+ name: "keyed-rows:host:all-hinted",
4596
+ create: (owner) => ({
4597
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4598
+ hostBlocks: createKeyedRowHostRuntime(),
4599
+ keyedUpdates: keyedCompleteUpdateRuntime
4600
+ })
4601
+ })
4602
+ };
4603
+ var keyedRowsHostEveryHintedRuntimeFeature = {
4604
+ name: "keyed-rows:host:every-hinted",
4605
+ create: (owner) => ({
4606
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4607
+ hostBlocks: createKeyedRowHostRuntime(),
4608
+ keyedUpdates: keyedEveryUpdateRuntime
4609
+ })
4610
+ })
4611
+ };
4612
+ var keyedRowsHostFilterHintedRuntimeFeature = {
4613
+ name: "keyed-rows:host:filter-hinted",
4614
+ create: (owner) => ({
4615
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4616
+ hostBlocks: createKeyedRowHostRuntime(),
4617
+ keyedUpdates: keyedFilterUpdateRuntime
4618
+ })
4619
+ })
4620
+ };
4621
+ var keyedRowsHostPrependHintedRuntimeFeature = {
4622
+ name: "keyed-rows:host:prepend-hinted",
4623
+ create: (owner) => ({
4624
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4625
+ hostBlocks: createKeyedRowHostRuntime(),
4626
+ keyedUpdates: keyedPrependUpdateRuntime
4627
+ })
4628
+ })
4629
+ };
4630
+ var keyedRowsHostFilterPrependHintedRuntimeFeature = {
4631
+ name: "keyed-rows:host:filter-prepend-hinted",
4632
+ create: (owner) => ({
4633
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4634
+ hostBlocks: createKeyedRowHostRuntime(),
4635
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4636
+ })
4637
+ })
4638
+ };
2953
4639
  var keyedRowsCompleteRuntimeFeature = {
2954
4640
  name: "keyed-rows:complete",
2955
4641
  create: (owner) => ({
@@ -2959,6 +4645,86 @@ var keyedRowsCompleteRuntimeFeature = {
2959
4645
  })
2960
4646
  })
2961
4647
  };
4648
+ var keyedRowsCompleteHintedRuntimeFeature = {
4649
+ name: "keyed-rows:complete:hinted",
4650
+ create: (owner) => ({
4651
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4652
+ conditionals: createKeyedRowConditionalRuntime(),
4653
+ hostBlocks: createKeyedRowHostRuntime(),
4654
+ keyedUpdates: keyedUpdateRuntime
4655
+ })
4656
+ })
4657
+ };
4658
+ var keyedRowsCompletePositionHintedRuntimeFeature = {
4659
+ name: "keyed-rows:complete:position-hinted",
4660
+ create: (owner) => ({
4661
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4662
+ conditionals: createKeyedRowConditionalRuntime(),
4663
+ hostBlocks: createKeyedRowHostRuntime(),
4664
+ keyedUpdates: keyedPositionUpdateRuntime
4665
+ })
4666
+ })
4667
+ };
4668
+ var keyedRowsCompleteReorderHintedRuntimeFeature = {
4669
+ name: "keyed-rows:complete:reorder-hinted",
4670
+ create: (owner) => ({
4671
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4672
+ conditionals: createKeyedRowConditionalRuntime(),
4673
+ hostBlocks: createKeyedRowHostRuntime(),
4674
+ keyedUpdates: keyedReorderUpdateRuntime
4675
+ })
4676
+ })
4677
+ };
4678
+ var keyedRowsCompleteAllHintedRuntimeFeature = {
4679
+ name: "keyed-rows:complete:all-hinted",
4680
+ create: (owner) => ({
4681
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4682
+ conditionals: createKeyedRowConditionalRuntime(),
4683
+ hostBlocks: createKeyedRowHostRuntime(),
4684
+ keyedUpdates: keyedCompleteUpdateRuntime
4685
+ })
4686
+ })
4687
+ };
4688
+ var keyedRowsCompleteEveryHintedRuntimeFeature = {
4689
+ name: "keyed-rows:complete:every-hinted",
4690
+ create: (owner) => ({
4691
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4692
+ conditionals: createKeyedRowConditionalRuntime(),
4693
+ hostBlocks: createKeyedRowHostRuntime(),
4694
+ keyedUpdates: keyedEveryUpdateRuntime
4695
+ })
4696
+ })
4697
+ };
4698
+ var keyedRowsCompleteFilterHintedRuntimeFeature = {
4699
+ name: "keyed-rows:complete:filter-hinted",
4700
+ create: (owner) => ({
4701
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4702
+ conditionals: createKeyedRowConditionalRuntime(),
4703
+ hostBlocks: createKeyedRowHostRuntime(),
4704
+ keyedUpdates: keyedFilterUpdateRuntime
4705
+ })
4706
+ })
4707
+ };
4708
+ var keyedRowsCompletePrependHintedRuntimeFeature = {
4709
+ name: "keyed-rows:complete:prepend-hinted",
4710
+ create: (owner) => ({
4711
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4712
+ conditionals: createKeyedRowConditionalRuntime(),
4713
+ hostBlocks: createKeyedRowHostRuntime(),
4714
+ keyedUpdates: keyedPrependUpdateRuntime
4715
+ })
4716
+ })
4717
+ };
4718
+ var keyedRowsCompleteFilterPrependHintedRuntimeFeature = {
4719
+ name: "keyed-rows:complete:filter-prepend-hinted",
4720
+ create: (owner) => ({
4721
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4722
+ conditionals: createKeyedRowConditionalRuntime(),
4723
+ hostBlocks: createKeyedRowHostRuntime(),
4724
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4725
+ })
4726
+ })
4727
+ };
2962
4728
  var keyedRangesRuntimeFeature = {
2963
4729
  name: "keyed-ranges",
2964
4730
  create: (owner) => ({
@@ -2990,7 +4756,9 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
2990
4756
  return existing.component;
2991
4757
  }
2992
4758
  }
2993
- const definitionReference = { current: definition };
4759
+ const definitionReference = {
4760
+ current: definition
4761
+ };
2994
4762
  const refreshListeners = /* @__PURE__ */ new Set();
2995
4763
  class FarmCompiledComponent extends React.Component {
2996
4764
  constructor(props) {
@@ -3429,7 +5197,7 @@ var COMPLETE_RUNTIME_FEATURES = [
3429
5197
  hostConditionalRuntimeFeature,
3430
5198
  conditionalRangesRuntimeFeature,
3431
5199
  keyedListRuntimeFeature,
3432
- keyedRowsCompleteRuntimeFeature,
5200
+ keyedRowsCompleteEveryHintedRuntimeFeature,
3433
5201
  keyedRangesRuntimeFeature,
3434
5202
  mixedRangesRuntimeFeature,
3435
5203
  componentRuntimeFeature
@@ -3438,6 +5206,6 @@ function createCompiledComponent(definition) {
3438
5206
  return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
3439
5207
  }
3440
5208
 
3441
- export { componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
5209
+ export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
3442
5210
  //# sourceMappingURL=compiler-runtime.mjs.map
3443
5211
  //# sourceMappingURL=compiler-runtime.mjs.map