@solidjs/signals 0.0.2 → 0.0.3

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.
package/dist/prod.js CHANGED
@@ -46,30 +46,30 @@ var Owner = class {
46
46
  // We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild
47
47
  // However, the children are actually added in reverse creation order
48
48
  // See comment at the top of the file for an example of the _nextSibling traversal
49
- q = null;
50
- l = null;
49
+ r = null;
50
+ m = null;
51
51
  o = null;
52
52
  a = STATE_CLEAN;
53
- g = null;
54
- m = defaultContext;
55
53
  h = null;
54
+ n = defaultContext;
55
+ i = null;
56
56
  e = null;
57
57
  constructor(signal = false) {
58
58
  if (currentOwner && !signal)
59
59
  currentOwner.append(this);
60
60
  }
61
61
  append(child) {
62
- child.q = this;
62
+ child.r = this;
63
63
  child.o = this;
64
- if (this.l)
65
- this.l.o = child;
66
- child.l = this.l;
67
- this.l = child;
68
- if (child.m !== this.m) {
69
- child.m = { ...this.m, ...child.m };
64
+ if (this.m)
65
+ this.m.o = child;
66
+ child.m = this.m;
67
+ this.m = child;
68
+ if (child.n !== this.n) {
69
+ child.n = { ...this.n, ...child.n };
70
70
  }
71
- if (this.h) {
72
- child.h = !child.h ? this.h : [...child.h, ...this.h];
71
+ if (this.i) {
72
+ child.i = !child.i ? this.i : [...child.i, ...this.i];
73
73
  }
74
74
  if (this.e)
75
75
  child.e = this.e;
@@ -77,51 +77,51 @@ var Owner = class {
77
77
  dispose(self = true) {
78
78
  if (this.a === STATE_DISPOSED)
79
79
  return;
80
- let head = self ? this.o || this.q : this, current = this.l, next = null;
81
- while (current && current.q === this) {
80
+ let head = self ? this.o || this.r : this, current = this.m, next = null;
81
+ while (current && current.r === this) {
82
82
  current.dispose(true);
83
- current.w();
84
- next = current.l;
85
- current.l = null;
83
+ current.x();
84
+ next = current.m;
85
+ current.m = null;
86
86
  current = next;
87
87
  }
88
88
  if (self)
89
- this.w();
89
+ this.x();
90
90
  if (current)
91
91
  current.o = !self ? this : this.o;
92
92
  if (head)
93
- head.l = current;
93
+ head.m = current;
94
94
  }
95
- w() {
95
+ x() {
96
96
  if (this.o)
97
- this.o.l = null;
98
- this.q = null;
97
+ this.o.m = null;
98
+ this.r = null;
99
99
  this.o = null;
100
- this.m = defaultContext;
101
- this.h = null;
100
+ this.n = defaultContext;
101
+ this.i = null;
102
102
  this.a = STATE_DISPOSED;
103
103
  this.emptyDisposal();
104
104
  }
105
105
  emptyDisposal() {
106
- if (!this.g)
106
+ if (!this.h)
107
107
  return;
108
- if (Array.isArray(this.g)) {
109
- for (let i = 0; i < this.g.length; i++) {
110
- const callable = this.g[i];
108
+ if (Array.isArray(this.h)) {
109
+ for (let i = 0; i < this.h.length; i++) {
110
+ const callable = this.h[i];
111
111
  callable.call(callable);
112
112
  }
113
113
  } else {
114
- this.g.call(this.g);
114
+ this.h.call(this.h);
115
115
  }
116
- this.g = null;
116
+ this.h = null;
117
117
  }
118
118
  handleError(error) {
119
- if (!this.h)
119
+ if (!this.i)
120
120
  throw error;
121
- let i = 0, len = this.h.length;
121
+ let i = 0, len = this.i.length;
122
122
  for (i = 0; i < len; i++) {
123
123
  try {
124
- this.h[i](error);
124
+ this.i[i](error);
125
125
  break;
126
126
  } catch (e) {
127
127
  error = e;
@@ -138,7 +138,7 @@ function getContext(context, owner = currentOwner) {
138
138
  if (!owner) {
139
139
  throw new NoOwnerError();
140
140
  }
141
- const value = hasContext(context, owner) ? owner.m[context.id] : context.defaultValue;
141
+ const value = hasContext(context, owner) ? owner.n[context.id] : context.defaultValue;
142
142
  if (isUndefined(value)) {
143
143
  throw new ContextNotFoundError();
144
144
  }
@@ -148,24 +148,24 @@ function setContext(context, value, owner = currentOwner) {
148
148
  if (!owner) {
149
149
  throw new NoOwnerError();
150
150
  }
151
- owner.m = {
152
- ...owner.m,
151
+ owner.n = {
152
+ ...owner.n,
153
153
  [context.id]: isUndefined(value) ? context.defaultValue : value
154
154
  };
155
155
  }
156
156
  function hasContext(context, owner = currentOwner) {
157
- return !isUndefined(owner?.m[context.id]);
157
+ return !isUndefined(owner?.n[context.id]);
158
158
  }
159
159
  function onCleanup(disposable) {
160
160
  if (!currentOwner)
161
161
  return;
162
162
  const node = currentOwner;
163
- if (!node.g) {
164
- node.g = disposable;
165
- } else if (Array.isArray(node.g)) {
166
- node.g.push(disposable);
163
+ if (!node.h) {
164
+ node.h = disposable;
165
+ } else if (Array.isArray(node.h)) {
166
+ node.h.push(disposable);
167
167
  } else {
168
- node.g = [node.g, disposable];
168
+ node.h = [node.h, disposable];
169
169
  }
170
170
  }
171
171
 
@@ -204,7 +204,7 @@ var Computation = class extends Owner {
204
204
  E = isEqual;
205
205
  N;
206
206
  /** Whether the computation is an error or has ancestors that are unresolved */
207
- i = 0;
207
+ j = 0;
208
208
  /** Which flags raised by sources are handled, vs. being passed through. */
209
209
  A = DEFAULT_FLAGS;
210
210
  F = null;
@@ -222,11 +222,11 @@ var Computation = class extends Owner {
222
222
  }
223
223
  O() {
224
224
  if (this.D)
225
- this.r();
225
+ this.s();
226
226
  if (!this.b || this.b.length)
227
227
  track(this);
228
- newFlags |= this.i & ~currentMask;
229
- if (this.i & ERROR_BIT) {
228
+ newFlags |= this.j & ~currentMask;
229
+ if (this.j & ERROR_BIT) {
230
230
  throw this.d;
231
231
  } else {
232
232
  return this.d;
@@ -281,13 +281,13 @@ var Computation = class extends Owner {
281
281
  const valueChanged = newValue !== UNCHANGED && (!!(flags & ERROR_BIT) || this.E === false || !this.E(this.d, newValue));
282
282
  if (valueChanged)
283
283
  this.d = newValue;
284
- const changedFlagsMask = this.i ^ flags, changedFlags = changedFlagsMask & flags;
285
- this.i = flags;
284
+ const changedFlagsMask = this.j ^ flags, changedFlags = changedFlagsMask & flags;
285
+ this.j = flags;
286
286
  this.H = clock + 1;
287
287
  if (this.c) {
288
288
  for (let i = 0; i < this.c.length; i++) {
289
289
  if (valueChanged) {
290
- this.c[i].s(STATE_DIRTY);
290
+ this.c[i].t(STATE_DIRTY);
291
291
  } else if (changedFlagsMask) {
292
292
  this.c[i].P(changedFlagsMask, changedFlags);
293
293
  }
@@ -298,13 +298,13 @@ var Computation = class extends Owner {
298
298
  /**
299
299
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
300
300
  */
301
- s(state) {
301
+ t(state) {
302
302
  if (this.a >= state)
303
303
  return;
304
304
  this.a = state;
305
305
  if (this.c) {
306
306
  for (let i = 0; i < this.c.length; i++) {
307
- this.c[i].s(STATE_CHECK);
307
+ this.c[i].t(STATE_CHECK);
308
308
  }
309
309
  }
310
310
  }
@@ -318,17 +318,17 @@ var Computation = class extends Owner {
318
318
  if (this.a >= STATE_DIRTY)
319
319
  return;
320
320
  if (mask & this.A) {
321
- this.s(STATE_DIRTY);
321
+ this.t(STATE_DIRTY);
322
322
  return;
323
323
  }
324
324
  if (this.a >= STATE_CHECK)
325
325
  return;
326
- const prevFlags = this.i & mask;
326
+ const prevFlags = this.j & mask;
327
327
  const deltaFlags = prevFlags ^ newFlags2;
328
328
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
329
- this.s(STATE_CHECK);
329
+ this.t(STATE_CHECK);
330
330
  } else {
331
- this.i ^= deltaFlags;
331
+ this.j ^= deltaFlags;
332
332
  if (this.c) {
333
333
  for (let i = 0; i < this.c.length; i++) {
334
334
  this.c[i].P(mask, newFlags2);
@@ -337,7 +337,7 @@ var Computation = class extends Owner {
337
337
  }
338
338
  }
339
339
  Q(error) {
340
- this.write(error, this.i | ERROR_BIT);
340
+ this.write(error, this.j | ERROR_BIT);
341
341
  }
342
342
  /**
343
343
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -346,7 +346,7 @@ var Computation = class extends Owner {
346
346
  *
347
347
  * This function will ensure that the value and states we read from the computation are up to date
348
348
  */
349
- r() {
349
+ s() {
350
350
  if (this.a === STATE_DISPOSED) {
351
351
  throw new Error("Tried to read a disposed computation");
352
352
  }
@@ -356,8 +356,8 @@ var Computation = class extends Owner {
356
356
  let observerFlags = 0;
357
357
  if (this.a === STATE_CHECK) {
358
358
  for (let i = 0; i < this.b.length; i++) {
359
- this.b[i].r();
360
- observerFlags |= this.b[i].i;
359
+ this.b[i].s();
360
+ observerFlags |= this.b[i].j;
361
361
  if (this.a === STATE_DIRTY) {
362
362
  break;
363
363
  }
@@ -373,23 +373,23 @@ var Computation = class extends Owner {
373
373
  /**
374
374
  * Remove ourselves from the owner graph and the computation graph
375
375
  */
376
- w() {
376
+ x() {
377
377
  if (this.a === STATE_DISPOSED)
378
378
  return;
379
379
  if (this.b)
380
380
  removeSourceObservers(this, 0);
381
- super.w();
381
+ super.x();
382
382
  }
383
383
  };
384
384
  function loadingState(node) {
385
- const prevOwner = setOwner(node.q);
385
+ const prevOwner = setOwner(node.r);
386
386
  const options = void 0;
387
387
  const computation = new Computation(
388
388
  void 0,
389
389
  () => {
390
390
  track(node);
391
- node.r();
392
- return !!(node.i & LOADING_BIT);
391
+ node.s();
392
+ return !!(node.j & LOADING_BIT);
393
393
  },
394
394
  options
395
395
  );
@@ -398,14 +398,14 @@ function loadingState(node) {
398
398
  return computation;
399
399
  }
400
400
  function errorState(node) {
401
- const prevOwner = setOwner(node.q);
401
+ const prevOwner = setOwner(node.r);
402
402
  const options = void 0;
403
403
  const computation = new Computation(
404
404
  void 0,
405
405
  () => {
406
406
  track(node);
407
- node.r();
408
- return !!(node.i & ERROR_BIT);
407
+ node.s();
408
+ return !!(node.j & ERROR_BIT);
409
409
  },
410
410
  options
411
411
  );
@@ -547,27 +547,27 @@ function schedule() {
547
547
  }
548
548
  var Queue = class {
549
549
  I = false;
550
- t = [[], [], []];
551
- y = [];
550
+ u = [[], [], []];
551
+ z = [];
552
552
  enqueue(type, node) {
553
- this.t[0].push(node);
553
+ this.u[0].push(node);
554
554
  if (type)
555
- this.t[type].push(node);
555
+ this.u[type].push(node);
556
556
  schedule();
557
557
  }
558
558
  run(type) {
559
- if (this.t[type].length) {
559
+ if (this.u[type].length) {
560
560
  if (type === EFFECT_PURE) {
561
- runPureQueue(this.t[type]);
562
- this.t[type] = [];
561
+ runPureQueue(this.u[type]);
562
+ this.u[type] = [];
563
563
  } else {
564
- const effects = this.t[type];
565
- this.t[type] = [];
564
+ const effects = this.u[type];
565
+ this.u[type] = [];
566
566
  runEffectQueue(effects);
567
567
  }
568
568
  }
569
- for (let i = 0; i < this.y.length; i++) {
570
- this.y[i].run(type);
569
+ for (let i = 0; i < this.z.length; i++) {
570
+ this.z[i].run(type);
571
571
  }
572
572
  }
573
573
  flush() {
@@ -584,12 +584,12 @@ var Queue = class {
584
584
  }
585
585
  }
586
586
  addChild(child) {
587
- this.y.push(child);
587
+ this.z.push(child);
588
588
  }
589
589
  removeChild(child) {
590
- const index = this.y.indexOf(child);
590
+ const index = this.z.indexOf(child);
591
591
  if (index >= 0)
592
- this.y.splice(index, 1);
592
+ this.z.splice(index, 1);
593
593
  }
594
594
  };
595
595
  var globalQueue = new Queue();
@@ -606,14 +606,14 @@ function createBoundary(fn, queue) {
606
606
  }
607
607
  function runTop(node) {
608
608
  const ancestors = [];
609
- for (let current = node; current !== null; current = current.q) {
609
+ for (let current = node; current !== null; current = current.r) {
610
610
  if (current.a !== STATE_CLEAN) {
611
611
  ancestors.push(current);
612
612
  }
613
613
  }
614
614
  for (let i = ancestors.length - 1; i >= 0; i--) {
615
615
  if (ancestors[i].a !== STATE_DISPOSED)
616
- ancestors[i].r();
616
+ ancestors[i].s();
617
617
  }
618
618
  }
619
619
  function runPureQueue(queue) {
@@ -640,12 +640,12 @@ var Effect = class extends Computation {
640
640
  this.B = initialValue;
641
641
  this.C = options?.render ? EFFECT_RENDER : EFFECT_USER;
642
642
  this.e = getOwner()?.e || globalQueue;
643
- this.r();
643
+ this.s();
644
644
  this.C === EFFECT_USER ? this.e.enqueue(this.C, this) : this.R();
645
645
  }
646
646
  write(value, flags = 0) {
647
- const currentFlags = this.i;
648
- this.i = flags;
647
+ const currentFlags = this.j;
648
+ this.j = flags;
649
649
  if ((flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
650
650
  this.e.T?.(this);
651
651
  }
@@ -655,7 +655,7 @@ var Effect = class extends Computation {
655
655
  this.K = true;
656
656
  return value;
657
657
  }
658
- s(state) {
658
+ t(state) {
659
659
  if (this.a >= state)
660
660
  return;
661
661
  if (this.a === STATE_CLEAN)
@@ -665,10 +665,10 @@ var Effect = class extends Computation {
665
665
  Q(error) {
666
666
  this.handleError(error);
667
667
  }
668
- w() {
668
+ x() {
669
669
  this.J = void 0;
670
670
  this.B = void 0;
671
- super.w();
671
+ super.x();
672
672
  }
673
673
  R() {
674
674
  if (this.K && this.a !== STATE_DISPOSED) {
@@ -683,38 +683,38 @@ var EagerComputation = class extends Computation {
683
683
  constructor(initialValue, compute2, options) {
684
684
  super(initialValue, compute2, options);
685
685
  this.e = getOwner()?.e || globalQueue;
686
- this.r();
686
+ this.s();
687
687
  }
688
- s(state) {
688
+ t(state) {
689
689
  if (this.a >= state)
690
690
  return;
691
691
  if (this.a === STATE_CLEAN)
692
692
  this.e.enqueue(EFFECT_PURE, this);
693
- super.s(state);
693
+ super.t(state);
694
694
  }
695
695
  };
696
696
 
697
697
  // src/core/suspense.ts
698
698
  var SuspenseQueue = class extends Queue {
699
- k = /* @__PURE__ */ new Set();
700
- z = false;
699
+ f = /* @__PURE__ */ new Set();
700
+ p = false;
701
701
  L = new Computation(false, null);
702
702
  run(type) {
703
- if (type && this.z)
703
+ if (type && this.p)
704
704
  return;
705
705
  super.run(type);
706
706
  }
707
707
  T(node) {
708
- if (node.i & LOADING_BIT) {
709
- this.k.add(node);
710
- if (!this.z) {
711
- this.z = true;
708
+ if (node.j & LOADING_BIT) {
709
+ this.f.add(node);
710
+ if (!this.p) {
711
+ this.p = true;
712
712
  queueMicrotask(() => this.L.write(true));
713
713
  }
714
714
  } else {
715
- this.k.delete(node);
716
- if (this.k.size === 0) {
717
- this.z = false;
715
+ this.f.delete(node);
716
+ if (this.f.size === 0) {
717
+ this.p = false;
718
718
  queueMicrotask(() => this.L.write(false));
719
719
  }
720
720
  }
@@ -723,7 +723,7 @@ var SuspenseQueue = class extends Queue {
723
723
  function createSuspense(fn, fallbackFn) {
724
724
  const queue = new SuspenseQueue();
725
725
  const tree = createBoundary(fn, queue);
726
- const equality = new Computation(null, () => queue.L.read() || queue.z);
726
+ const equality = new Computation(null, () => queue.L.read() || queue.p);
727
727
  const comp = new Computation(null, () => equality.read() ? untrack(fallbackFn) : tree);
728
728
  return comp.read.bind(comp);
729
729
  }
@@ -833,7 +833,7 @@ function runWithOwner(owner, run) {
833
833
  }
834
834
  function catchError(fn, handler) {
835
835
  const owner = new Owner();
836
- owner.h = owner.h ? [handler, ...owner.h] : [handler];
836
+ owner.i = owner.i ? [handler, ...owner.i] : [handler];
837
837
  try {
838
838
  compute(owner, fn, null);
839
839
  } catch (error) {
@@ -851,15 +851,22 @@ var STORE_NODE = "n";
851
851
  var STORE_HAS = "h";
852
852
  function wrap(value) {
853
853
  let p = value[$PROXY];
854
- if (!p)
854
+ if (!p) {
855
+ let target;
856
+ if (Array.isArray(value)) {
857
+ target = [];
858
+ target.v = value;
859
+ } else
860
+ target = { v: value };
855
861
  Object.defineProperty(value, $PROXY, {
856
- value: p = new Proxy({ v: value }, proxyTraps),
862
+ value: p = new Proxy(target, proxyTraps),
857
863
  writable: true
858
864
  });
865
+ }
859
866
  return p;
860
867
  }
861
868
  function isWrappable(obj) {
862
- return obj != null && typeof obj === "object";
869
+ return obj != null && typeof obj === "object" && !Object.isFrozen(obj);
863
870
  }
864
871
  function unwrap(item, deep = true, set) {
865
872
  let result, unwrapped, v, prop;
@@ -911,8 +918,10 @@ function getNode(nodes, property, value, equals = isEqual) {
911
918
  });
912
919
  }
913
920
  function proxyDescriptor(target, property) {
921
+ if (property === $PROXY)
922
+ return { value: target[$PROXY], writable: true, configurable: true };
914
923
  const desc = Reflect.getOwnPropertyDescriptor(target[STORE_VALUE], property);
915
- if (!desc || desc.get || !desc.configurable || property === $PROXY)
924
+ if (!desc || desc.get || !desc.configurable)
916
925
  return desc;
917
926
  delete desc.value;
918
927
  delete desc.writable;
@@ -978,7 +987,10 @@ var proxyTraps = {
978
987
  return true;
979
988
  },
980
989
  ownKeys,
981
- getOwnPropertyDescriptor: proxyDescriptor
990
+ getOwnPropertyDescriptor: proxyDescriptor,
991
+ getPrototypeOf(target) {
992
+ return Object.getPrototypeOf(target[STORE_VALUE]);
993
+ }
982
994
  };
983
995
  function setProperty(state, property, value, deleting = false) {
984
996
  const prev = state[property];
@@ -1132,6 +1144,7 @@ function reconcile(value, key) {
1132
1144
  if (keyFn(value) !== keyFn(state))
1133
1145
  throw new Error("Cannot reconcile states with different identity");
1134
1146
  applyState(value, state, keyFn);
1147
+ return state;
1135
1148
  };
1136
1149
  }
1137
1150
 
@@ -1286,120 +1299,120 @@ function omit(props, ...keys) {
1286
1299
  // src/map.ts
1287
1300
  function mapArray(list, map, options) {
1288
1301
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
1289
- return Computation.prototype.read.bind(
1290
- new Computation(
1291
- [],
1292
- updateKeyedMap.bind({
1293
- S: new Owner(),
1294
- u: 0,
1295
- U: list,
1296
- p: [],
1297
- M: map,
1298
- n: [],
1299
- k: [],
1300
- x: keyFn,
1301
- f: keyFn || options?.keyed === false ? [] : void 0,
1302
- j: map.length > 1 ? [] : void 0
1303
- }),
1304
- options
1305
- )
1306
- );
1302
+ return updateKeyedMap.bind({
1303
+ S: new Owner(),
1304
+ w: 0,
1305
+ U: list,
1306
+ q: [],
1307
+ M: map,
1308
+ k: [],
1309
+ f: [],
1310
+ y: keyFn,
1311
+ g: keyFn || options?.keyed === false ? [] : void 0,
1312
+ l: map.length > 1 ? [] : void 0,
1313
+ p: options?.fallback
1314
+ });
1307
1315
  }
1308
1316
  function updateKeyedMap() {
1309
1317
  const newItems = this.U() || [], newLen = newItems.length;
1310
1318
  newItems[$TRACK];
1311
1319
  runWithOwner(this.S, () => {
1312
- let i, j, mapper = this.f ? () => {
1313
- this.f[j] = new Computation(newItems[j], null);
1314
- this.j[j] = new Computation(j, null);
1320
+ let i, j, mapper = this.g ? () => {
1321
+ this.g[j] = new Computation(newItems[j], null);
1322
+ this.l[j] = new Computation(j, null);
1315
1323
  return this.M(
1316
- Computation.prototype.read.bind(this.f[j]),
1317
- Computation.prototype.read.bind(this.j[j])
1324
+ Computation.prototype.read.bind(this.g[j]),
1325
+ Computation.prototype.read.bind(this.l[j])
1318
1326
  );
1319
- } : this.j ? () => {
1327
+ } : this.l ? () => {
1320
1328
  const item = newItems[j];
1321
- this.j[j] = new Computation(j, null);
1322
- return this.M(() => item, Computation.prototype.read.bind(this.j[j]));
1329
+ this.l[j] = new Computation(j, null);
1330
+ return this.M(() => item, Computation.prototype.read.bind(this.l[j]));
1323
1331
  } : () => {
1324
1332
  const item = newItems[j];
1325
1333
  return this.M(() => item);
1326
1334
  };
1327
1335
  if (newLen === 0) {
1328
- if (this.u !== 0) {
1336
+ if (this.w !== 0) {
1329
1337
  this.S.dispose(false);
1338
+ this.f = [];
1339
+ this.q = [];
1330
1340
  this.k = [];
1331
- this.p = [];
1332
- this.n = [];
1333
- this.u = 0;
1334
- this.f && (this.f = []);
1335
- this.j && (this.j = []);
1341
+ this.w = 0;
1342
+ this.g && (this.g = []);
1343
+ this.l && (this.l = []);
1344
+ }
1345
+ if (this.p && !this.k[0]) {
1346
+ this.k[0] = compute(this.f[0] = new Owner(), this.p, null);
1336
1347
  }
1337
- } else if (this.u === 0) {
1338
- this.n = new Array(newLen);
1348
+ } else if (this.w === 0) {
1349
+ if (this.f[0])
1350
+ this.f[0].dispose();
1351
+ this.k = new Array(newLen);
1339
1352
  for (j = 0; j < newLen; j++) {
1340
- this.p[j] = newItems[j];
1341
- this.n[j] = compute(this.k[j] = new Owner(), mapper, null);
1353
+ this.q[j] = newItems[j];
1354
+ this.k[j] = compute(this.f[j] = new Owner(), mapper, null);
1342
1355
  }
1343
- this.u = newLen;
1356
+ this.w = newLen;
1344
1357
  } else {
1345
- let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.f ? new Array(newLen) : void 0, tempIndexes = this.j ? new Array(newLen) : void 0;
1346
- for (start = 0, end = Math.min(this.u, newLen); start < end && (this.p[start] === newItems[start] || this.f && compare(this.x, this.p[start], newItems[start])); start++) {
1347
- if (this.f)
1348
- this.f[start].write(newItems[start]);
1358
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.g ? new Array(newLen) : void 0, tempIndexes = this.l ? new Array(newLen) : void 0;
1359
+ for (start = 0, end = Math.min(this.w, newLen); start < end && (this.q[start] === newItems[start] || this.g && compare(this.y, this.q[start], newItems[start])); start++) {
1360
+ if (this.g)
1361
+ this.g[start].write(newItems[start]);
1349
1362
  }
1350
- for (end = this.u - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.p[end] === newItems[newEnd] || this.f && compare(this.x, this.p[end], newItems[newEnd])); end--, newEnd--) {
1351
- temp[newEnd] = this.n[end];
1352
- tempNodes[newEnd] = this.k[end];
1353
- tempRows && (tempRows[newEnd] = this.f[end]);
1354
- tempIndexes && (tempIndexes[newEnd] = this.j[end]);
1363
+ for (end = this.w - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.q[end] === newItems[newEnd] || this.g && compare(this.y, this.q[end], newItems[newEnd])); end--, newEnd--) {
1364
+ temp[newEnd] = this.k[end];
1365
+ tempNodes[newEnd] = this.f[end];
1366
+ tempRows && (tempRows[newEnd] = this.g[end]);
1367
+ tempIndexes && (tempIndexes[newEnd] = this.l[end]);
1355
1368
  }
1356
1369
  newIndices = /* @__PURE__ */ new Map();
1357
1370
  newIndicesNext = new Array(newEnd + 1);
1358
1371
  for (j = newEnd; j >= start; j--) {
1359
1372
  item = newItems[j];
1360
- key = this.x ? this.x(item) : item;
1373
+ key = this.y ? this.y(item) : item;
1361
1374
  i = newIndices.get(key);
1362
1375
  newIndicesNext[j] = i === void 0 ? -1 : i;
1363
1376
  newIndices.set(key, j);
1364
1377
  }
1365
1378
  for (i = start; i <= end; i++) {
1366
- item = this.p[i];
1367
- key = this.x ? this.x(item) : item;
1379
+ item = this.q[i];
1380
+ key = this.y ? this.y(item) : item;
1368
1381
  j = newIndices.get(key);
1369
1382
  if (j !== void 0 && j !== -1) {
1370
- temp[j] = this.n[i];
1371
- tempNodes[j] = this.k[i];
1372
- tempRows && (tempRows[j] = this.f[i]);
1373
- tempIndexes && (tempIndexes[j] = this.j[i]);
1383
+ temp[j] = this.k[i];
1384
+ tempNodes[j] = this.f[i];
1385
+ tempRows && (tempRows[j] = this.g[i]);
1386
+ tempIndexes && (tempIndexes[j] = this.l[i]);
1374
1387
  j = newIndicesNext[j];
1375
1388
  newIndices.set(key, j);
1376
1389
  } else
1377
- this.k[i].dispose();
1390
+ this.f[i].dispose();
1378
1391
  }
1379
1392
  for (j = start; j < newLen; j++) {
1380
1393
  if (j in temp) {
1381
- this.n[j] = temp[j];
1382
- this.k[j] = tempNodes[j];
1394
+ this.k[j] = temp[j];
1395
+ this.f[j] = tempNodes[j];
1383
1396
  if (tempRows) {
1384
- this.f[j] = tempRows[j];
1385
- this.f[j].write(newItems[j]);
1397
+ this.g[j] = tempRows[j];
1398
+ this.g[j].write(newItems[j]);
1386
1399
  }
1387
1400
  if (tempIndexes) {
1388
- this.j[j] = tempIndexes[j];
1389
- this.j[j].write(j);
1401
+ this.l[j] = tempIndexes[j];
1402
+ this.l[j].write(j);
1390
1403
  }
1391
1404
  } else {
1392
- this.n[j] = compute(this.k[j] = new Owner(), mapper, null);
1405
+ this.k[j] = compute(this.f[j] = new Owner(), mapper, null);
1393
1406
  }
1394
1407
  }
1395
- this.n = this.n.slice(0, this.u = newLen);
1396
- this.p = newItems.slice(0);
1408
+ this.k = this.k.slice(0, this.w = newLen);
1409
+ this.q = newItems.slice(0);
1397
1410
  }
1398
1411
  });
1399
- return this.n;
1412
+ return this.k;
1400
1413
  }
1401
1414
  function compare(key, a, b) {
1402
1415
  return key ? key(a) === key(b) : true;
1403
1416
  }
1404
1417
 
1405
- export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, catchError, createAsync, createBoundary, createContext, createEffect, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, runWithOwner, setContext, untrack, unwrap };
1418
+ export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, runWithOwner, setContext, untrack, unwrap };