@gridsheet/react-core 3.0.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
- import { useRef as j, useEffect as O, useState as N } from "react";
2
- import { x2c as ne, y2r as se, a2p as $, Autofill as ie, areaToZone as L, zoneToArea as z, areaDiff as G, restrictZone as U, matrixShape as oe, superposeArea as re, p2a as ce, operations as K, DEFAULT_HEIGHT as F, DEFAULT_WIDTH as k, smartScroll as J, createBook as ue } from "@gridsheet/core";
3
- const y = (o) => {
1
+ import { useRef as V, useEffect as O, useState as N } from "react";
2
+ import { x2c as ne, y2r as se, a2p as $, Autofill as ie, areaToZone as L, zoneToArea as z, areaDiff as G, restrictZone as U, matrixShape as oe, superposeArea as re, p2a as ce, operations as K, DEFAULT_HEIGHT as F, DEFAULT_WIDTH as k, smartScroll as J, createBook as ae } from "@gridsheet/core";
3
+ const p = (o) => {
4
4
  const e = { ...o };
5
5
  return e.selectingZone != null && e.selectingZone.endY === -1 && e.selectingZone.endX === -1 && delete e.selectingZone, e;
6
6
  }, W = (o, e) => {
7
7
  const { choosing: s, selectingZone: t } = o;
8
- let { y: n, x: i } = s, { startY: r, startX: u, endY: c, endX: l } = t;
9
- const [d, a] = [e.numRows, e.numCols];
10
- return n > d && (n = d), i > a && (i = a), r > d && (r = d), c > d && (c = d), u > a && (u = a), l > a && (l = a), {
8
+ let { y: n, x: i } = s, { startY: r, startX: a, endY: c, endX: d } = t;
9
+ const [l, u] = [e.numRows, e.numCols];
10
+ return n > l && (n = l), i > u && (i = u), r > l && (r = l), c > l && (c = l), a > u && (a = u), d > u && (d = u), {
11
11
  choosing: { y: n, x: i },
12
- selectingZone: { startY: r, startX: u, endY: c, endX: l }
12
+ selectingZone: { startY: r, startX: a, endY: c, endX: d }
13
13
  };
14
- }, _ = "gs-flash-overlay--active", de = 600, D = (o) => {
15
- o && (o.classList.remove(_), o.offsetWidth, o.classList.add(_), setTimeout(() => o.classList.remove(_), de));
14
+ }, _ = "gs-flash-overlay--active", le = 600, D = (o) => {
15
+ o && (o.classList.remove(_), o.offsetWidth, o.classList.add(_), setTimeout(() => o.classList.remove(_), le));
16
16
  }, ee = (o, e, s) => ({
17
17
  ...o,
18
18
  sheetReactive: { current: e },
@@ -24,52 +24,52 @@ const y = (o) => {
24
24
  let { choosing: r } = e;
25
25
  if (!s)
26
26
  return { matchingCells: [] };
27
- const u = [];
27
+ const a = [];
28
28
  let c;
29
29
  if (n)
30
30
  try {
31
- const x = t ? "" : "i", w = new RegExp(s, x);
32
- c = (f) => w.test(f);
31
+ const R = t ? "" : "i", h = new RegExp(s, R);
32
+ c = (w) => h.test(w);
33
33
  } catch {
34
- const w = t ? s : s.toLowerCase();
35
- c = (f) => (t ? f : f.toLowerCase()).indexOf(w) !== -1;
34
+ const h = t ? s : s.toLowerCase();
35
+ c = (w) => (t ? w : w.toLowerCase()).indexOf(h) !== -1;
36
36
  }
37
37
  else {
38
- const x = t ? s : s.toLowerCase();
39
- c = (w) => (t ? w : w.toLowerCase()).indexOf(x) !== -1;
40
- }
41
- let l = 1, d = o.bottom, a = 1, g = o.right;
42
- i && (l = i.startY, d = i.endY, a = i.startX, g = i.endX);
43
- for (let x = l; x <= d; x++)
44
- for (let w = a; w <= g; w++) {
45
- const f = o.getSerializedValue({ point: { y: x, x: w } });
46
- c(f) && u.push(`${ne(w)}${se(x)}`);
38
+ const R = t ? s : s.toLowerCase();
39
+ c = (h) => (t ? h : h.toLowerCase()).indexOf(R) !== -1;
40
+ }
41
+ let d = 1, l = o.bottom, u = 1, g = o.right;
42
+ i && (d = i.startY, l = i.endY, u = i.startX, g = i.endX);
43
+ for (let R = d; R <= l; R++)
44
+ for (let h = u; h <= g; h++) {
45
+ const w = o.getSerializedValue({ point: { y: R, x: h } });
46
+ c(w) && a.push(`${ne(h)}${se(R)}`);
47
47
  }
48
- const p = u.length === e.matchingCells.length ? e.matchingCellIndex : 0;
49
- if (u.length > 0) {
50
- const x = u[p];
51
- r = $(x);
48
+ const S = a.length === e.matchingCells.length ? e.matchingCellIndex : 0;
49
+ if (a.length > 0) {
50
+ const R = a[S];
51
+ r = $(R);
52
52
  }
53
- return { matchingCells: u, searchQuery: s, matchingCellIndex: p, choosing: r };
53
+ return { matchingCells: a, searchQuery: s, matchingCellIndex: S, choosing: r };
54
54
  }, Zt = (o) => {
55
55
  const { sheetId: e, sheetReactive: s } = o, t = s.current;
56
56
  return !t || e === t.registry.editingSheetId ? !1 : !!t.registry.editingAddress;
57
- }, E = { startY: -1, startX: -1, endY: -1, endX: -1 }, q = {}, Xt = (o, e) => {
58
- var u, c;
59
- const s = q[e.type];
57
+ }, E = { startY: -1, startX: -1, endY: -1, endX: -1 }, j = {}, Xt = (o, e) => {
58
+ var a, c;
59
+ const s = j[e.type];
60
60
  if (s == null)
61
61
  return o;
62
- const t = (u = o.sheetReactive.current) == null ? void 0 : u.registry;
62
+ const t = (a = o.sheetReactive.current) == null ? void 0 : a.registry;
63
63
  if ((c = t == null ? void 0 : t._strictModeCache) != null && c.has(e)) {
64
- const l = t._strictModeCache.get(e);
65
- return t._strictModeCache.delete(e), l;
64
+ const d = t._strictModeCache.get(e);
65
+ return t._strictModeCache.delete(e), d;
66
66
  }
67
67
  const { callback: n, ...i } = s.reduce(o, e.value);
68
68
  n == null || n(i);
69
69
  const r = { ...o, ...i };
70
70
  return t && (t._strictModeCache || (t._strictModeCache = /* @__PURE__ */ new Map()), t._strictModeCache.set(e, r), queueMicrotask(() => {
71
- var l;
72
- (l = t._strictModeCache) == null || l.delete(e);
71
+ var d;
72
+ (d = t._strictModeCache) == null || d.delete(e);
73
73
  })), r;
74
74
  }, B = class B {
75
75
  constructor() {
@@ -85,16 +85,16 @@ const y = (o) => {
85
85
  };
86
86
  }
87
87
  bind() {
88
- return this.actionId = B.head++, q[this.actionId] = this, this.call.bind(this);
88
+ return this.actionId = B.head++, j[this.actionId] = this, this.call.bind(this);
89
89
  }
90
90
  };
91
91
  B.head = 1;
92
- let h = B;
92
+ let f = B;
93
93
  const Mt = (o) => {
94
94
  var e;
95
- return ((e = q[o]) == null ? void 0 : e.mutation) === !0;
95
+ return ((e = j[o]) == null ? void 0 : e.mutation) === !0;
96
96
  };
97
- class ae extends h {
97
+ class ue extends f {
98
98
  reduce(e, s) {
99
99
  const t = s, { sheetReactive: n } = e;
100
100
  return n.current == null ? e : {
@@ -104,8 +104,8 @@ class ae extends h {
104
104
  };
105
105
  }
106
106
  }
107
- const Et = new ae().bind();
108
- class le extends h {
107
+ const Et = new ue().bind();
108
+ class de extends f {
109
109
  reduce(e, s) {
110
110
  const t = s, { sheetReactive: n } = e;
111
111
  return n.current == null ? e : {
@@ -115,8 +115,8 @@ class le extends h {
115
115
  };
116
116
  }
117
117
  }
118
- const Tt = new le().bind();
119
- class he extends h {
118
+ const Ht = new de().bind();
119
+ class he extends f {
120
120
  reduce(e, s) {
121
121
  const t = s, { sheetReactive: n } = e;
122
122
  return n.current == null ? e : {
@@ -126,8 +126,8 @@ class he extends h {
126
126
  };
127
127
  }
128
128
  }
129
- const Ht = new he().bind();
130
- class ge extends h {
129
+ const Tt = new he().bind();
130
+ class fe extends f {
131
131
  reduce(e, s) {
132
132
  const t = s, { sheetReactive: n } = e;
133
133
  return n.current == null ? e : {
@@ -137,8 +137,8 @@ class ge extends h {
137
137
  };
138
138
  }
139
139
  }
140
- const Ft = new ge().bind();
141
- class fe extends h {
140
+ const Ft = new fe().bind();
141
+ class ge extends f {
142
142
  reduce(e, s) {
143
143
  return {
144
144
  ...e,
@@ -146,8 +146,8 @@ class fe extends h {
146
146
  };
147
147
  }
148
148
  }
149
- const kt = new fe().bind();
150
- class Re extends h {
149
+ const kt = new ge().bind();
150
+ class Re extends f {
151
151
  reduce(e, s) {
152
152
  return {
153
153
  ...e,
@@ -156,7 +156,7 @@ class Re extends h {
156
156
  }
157
157
  }
158
158
  const Lt = new Re().bind();
159
- class we extends h {
159
+ class we extends f {
160
160
  reduce(e, s) {
161
161
  const t = new ie(e, s), n = t.applied, i = L(t.wholeArea);
162
162
  return {
@@ -172,7 +172,7 @@ class we extends h {
172
172
  }
173
173
  }
174
174
  const Dt = new we().bind();
175
- class Se extends h {
175
+ class Se extends f {
176
176
  reduce(e, s) {
177
177
  return {
178
178
  ...e,
@@ -181,7 +181,7 @@ class Se extends h {
181
181
  }
182
182
  }
183
183
  const Pt = new Se().bind();
184
- class xe extends h {
184
+ class xe extends f {
185
185
  reduce(e, s) {
186
186
  return {
187
187
  ...e,
@@ -190,7 +190,7 @@ class xe extends h {
190
190
  }
191
191
  }
192
192
  const zt = new xe().bind();
193
- class me extends h {
193
+ class me extends f {
194
194
  reduce(e, s) {
195
195
  return {
196
196
  ...e,
@@ -199,7 +199,7 @@ class me extends h {
199
199
  }
200
200
  }
201
201
  const Bt = new me().bind();
202
- class ye extends h {
202
+ class ye extends f {
203
203
  reduce(e, s) {
204
204
  return {
205
205
  ...e,
@@ -208,7 +208,7 @@ class ye extends h {
208
208
  }
209
209
  }
210
210
  const Wt = new ye().bind();
211
- class pe extends h {
211
+ class pe extends f {
212
212
  reduce(e, s) {
213
213
  return {
214
214
  ...e,
@@ -219,7 +219,7 @@ class pe extends h {
219
219
  }
220
220
  }
221
221
  const ve = new pe().bind();
222
- class be extends h {
222
+ class be extends f {
223
223
  reduce(e, s) {
224
224
  return {
225
225
  ...e,
@@ -228,7 +228,7 @@ class be extends h {
228
228
  }
229
229
  }
230
230
  const Ut = new be().bind();
231
- class Ae extends h {
231
+ class Ae extends f {
232
232
  reduce(e, s) {
233
233
  return {
234
234
  ...e,
@@ -237,7 +237,7 @@ class Ae extends h {
237
237
  }
238
238
  }
239
239
  const _t = new Ae().bind();
240
- class Ce extends h {
240
+ class Ce extends f {
241
241
  reduce(e, s) {
242
242
  return {
243
243
  ...e,
@@ -245,8 +245,8 @@ class Ce extends h {
245
245
  };
246
246
  }
247
247
  }
248
- const Ie = new Ce().bind();
249
- class Ye extends h {
248
+ const Ye = new Ce().bind();
249
+ class Ie extends f {
250
250
  reduce(e, s) {
251
251
  const { sheetReactive: t } = e, n = t.current;
252
252
  return n ? {
@@ -261,8 +261,8 @@ class Ye extends h {
261
261
  } : e;
262
262
  }
263
263
  }
264
- const Ze = new Ye().bind();
265
- class Xe extends h {
264
+ const Ze = new Ie().bind();
265
+ class Xe extends f {
266
266
  constructor() {
267
267
  super(...arguments), this.mutation = !0;
268
268
  }
@@ -281,7 +281,7 @@ class Xe extends h {
281
281
  }
282
282
  }
283
283
  const Me = new Xe().bind();
284
- class Ee extends h {
284
+ class Ee extends f {
285
285
  constructor() {
286
286
  super(...arguments), this.mutation = !0;
287
287
  }
@@ -289,13 +289,13 @@ class Ee extends h {
289
289
  const { choosing: t, selectingZone: n, sheetReactive: i } = e, r = i.current;
290
290
  if (!r)
291
291
  return e;
292
- const { registry: u } = r, { copyingSheetId: c, copyingZone: l, cutting: d } = u, a = r.getSheetBySheetId(c);
292
+ const { registry: a } = r, { copyingSheetId: c, copyingZone: d, cutting: l } = a, u = r.getSheetBySheetId(c);
293
293
  let g = z(n);
294
- const p = z(l), { matrix: x, onlyValue: w } = s;
295
- if (d) {
296
- if (!a)
294
+ const S = z(d), { matrix: R, onlyValue: h } = s;
295
+ if (l) {
296
+ if (!u)
297
297
  return e;
298
- const Y = p, { rows: C, cols: v } = G(p), R = g.top !== -1 ? {
298
+ const I = S, { rows: C, cols: v } = G(S), x = g.top !== -1 ? {
299
299
  top: g.top,
300
300
  left: g.left,
301
301
  bottom: g.top + C,
@@ -305,108 +305,108 @@ class Ee extends h {
305
305
  left: t.x,
306
306
  bottom: t.y + C,
307
307
  right: t.x + v
308
- }, m = U(L(R)), X = r.move({
309
- srcSheet: a,
310
- src: Y,
311
- dst: R,
308
+ }, y = U(L(x)), X = r.move({
309
+ srcSheet: u,
310
+ src: I,
311
+ dst: x,
312
312
  operator: "USER",
313
- undoReflection: y({
314
- sheetId: a.id,
315
- selectingZone: m,
313
+ undoReflection: p({
314
+ sheetId: u.id,
315
+ selectingZone: y,
316
316
  choosing: t,
317
- transmit: { copyingSheetId: a.id, copyingZone: l, cutting: !0 }
317
+ transmit: { copyingSheetId: u.id, copyingZone: d, cutting: !0 }
318
318
  }),
319
- redoReflection: y({
320
- sheetId: a.id,
319
+ redoReflection: p({
320
+ sheetId: u.id,
321
321
  choosing: t,
322
- transmit: { copyingSheetId: a.id, copyingZone: E }
322
+ transmit: { copyingSheetId: u.id, copyingZone: E }
323
323
  })
324
324
  });
325
325
  return {
326
326
  ...e,
327
327
  ...M(X, e),
328
328
  sheetReactive: { current: X },
329
- selectingZone: m,
329
+ selectingZone: y,
330
330
  inputting: X.getSerializedValue({ point: t, resolution: "RAW" }),
331
- callback: ({ sheetReactive: H }) => {
332
- u.transmit({
331
+ callback: ({ sheetReactive: T }) => {
332
+ a.transmit({
333
333
  cutting: !1,
334
334
  copyingZone: E
335
335
  });
336
336
  }
337
337
  };
338
338
  }
339
- let f, { y: S, x: Z } = t;
340
- if (p.top === -1) {
341
- const { rows: Y, cols: C } = oe({ matrix: x, base: -1 });
339
+ let w, { y: m, x: Z } = t;
340
+ if (S.top === -1) {
341
+ const { rows: I, cols: C } = oe({ matrix: R, base: -1 });
342
342
  g = {
343
- top: S,
343
+ top: m,
344
344
  left: Z,
345
- bottom: S + Y,
345
+ bottom: m + I,
346
346
  right: Z + C
347
347
  };
348
348
  const v = U(L(g));
349
- f = r.writeRawCellMatrix({
350
- point: { y: S, x: Z },
351
- matrix: x,
352
- onlyValue: w,
353
- undoReflection: y({
349
+ w = r.writeRawCellMatrix({
350
+ point: { y: m, x: Z },
351
+ matrix: R,
352
+ onlyValue: h,
353
+ undoReflection: p({
354
354
  sheetId: r.id,
355
355
  selectingZone: v,
356
356
  choosing: t
357
357
  }),
358
- redoReflection: y({
358
+ redoReflection: p({
359
359
  sheetId: r.id,
360
360
  selectingZone: v,
361
361
  choosing: t
362
362
  })
363
363
  });
364
364
  } else {
365
- if (a == null)
365
+ if (u == null)
366
366
  return e;
367
- let { rows: Y, cols: C } = G(p);
367
+ let { rows: I, cols: C } = G(S);
368
368
  if (g.top !== -1) {
369
- S = g.top, Z = g.left;
370
- const v = re(g, p);
371
- Y = v.rows, C = v.cols;
369
+ m = g.top, Z = g.left;
370
+ const v = re(g, S);
371
+ I = v.rows, C = v.cols;
372
372
  }
373
- g = { top: S, left: Z, bottom: S + Y, right: Z + C }, f = r.copy({
374
- srcSheet: a,
375
- src: p,
373
+ g = { top: m, left: Z, bottom: m + I, right: Z + C }, w = r.copy({
374
+ srcSheet: u,
375
+ src: S,
376
376
  dst: g,
377
- onlyValue: w,
377
+ onlyValue: h,
378
378
  operator: "USER",
379
- undoReflection: y({
380
- sheetId: a.id,
381
- transmit: { copyingZone: l },
379
+ undoReflection: p({
380
+ sheetId: u.id,
381
+ transmit: { copyingZone: d },
382
382
  choosing: t,
383
383
  selectingZone: n
384
384
  }),
385
- redoReflection: y({
386
- sheetId: a.id,
387
- transmit: { copyingSheetId: a.id, copyingZone: E },
385
+ redoReflection: p({
386
+ sheetId: u.id,
387
+ transmit: { copyingSheetId: u.id, copyingZone: E },
388
388
  choosing: t,
389
389
  selectingZone: L(g)
390
390
  })
391
391
  });
392
392
  }
393
- const I = U(L(g));
394
- return I.endX = Math.min(I.endX, f.numCols), I.endY = Math.min(I.endY, f.numRows), {
393
+ const Y = U(L(g));
394
+ return Y.endX = Math.min(Y.endX, w.numCols), Y.endY = Math.min(Y.endY, w.numRows), {
395
395
  ...e,
396
- sheetReactive: { current: f },
397
- selectingZone: I,
398
- inputting: f.getSerializedValue({ point: t, resolution: "RAW" }),
399
- ...M(f, e),
400
- callback: ({ sheetReactive: Y }) => {
401
- u.transmit({
396
+ sheetReactive: { current: w },
397
+ selectingZone: Y,
398
+ inputting: w.getSerializedValue({ point: t, resolution: "RAW" }),
399
+ ...M(w, e),
400
+ callback: ({ sheetReactive: I }) => {
401
+ a.transmit({
402
402
  copyingZone: E
403
403
  });
404
404
  }
405
405
  };
406
406
  }
407
407
  }
408
- const Te = new Ee().bind();
409
- class He extends h {
408
+ const He = new Ee().bind();
409
+ class Te extends f {
410
410
  reduce(e, s) {
411
411
  const { sheetReactive: t } = e;
412
412
  return {
@@ -423,8 +423,8 @@ class He extends h {
423
423
  };
424
424
  }
425
425
  }
426
- const Fe = new He().bind();
427
- class ke extends h {
426
+ const Fe = new Te().bind();
427
+ class ke extends f {
428
428
  reduce(e, s) {
429
429
  return {
430
430
  ...e,
@@ -434,7 +434,7 @@ class ke extends h {
434
434
  }
435
435
  }
436
436
  const Le = new ke().bind();
437
- class De extends h {
437
+ class De extends f {
438
438
  reduce(e, s) {
439
439
  return {
440
440
  ...e,
@@ -445,59 +445,59 @@ class De extends h {
445
445
  }
446
446
  }
447
447
  const Pe = new De().bind();
448
- class ze extends h {
448
+ class ze extends f {
449
449
  reduce(e, s) {
450
- const { range: t, numCols: n } = s, { start: i, end: r } = t, u = e.sheetReactive.current, c = {
450
+ const { range: t, numCols: n } = s, { start: i, end: r } = t, a = e.sheetReactive.current, c = {
451
451
  startY: i,
452
452
  startX: 1,
453
453
  endY: r,
454
454
  endX: n
455
455
  };
456
- let l = i;
457
- if (u) {
458
- for (let d = i; d <= r; d++)
459
- if (!u.isRowFiltered(d)) {
460
- l = d;
456
+ let d = i;
457
+ if (a) {
458
+ for (let l = i; l <= r; l++)
459
+ if (!a.isRowFiltered(l)) {
460
+ d = l;
461
461
  break;
462
462
  }
463
463
  }
464
464
  return {
465
465
  ...e,
466
466
  selectingZone: c,
467
- choosing: { y: l, x: 1 },
467
+ choosing: { y: d, x: 1 },
468
468
  leftHeaderSelecting: !0,
469
469
  topHeaderSelecting: !1
470
470
  };
471
471
  }
472
472
  }
473
473
  const Be = new ze().bind();
474
- class We extends h {
474
+ class We extends f {
475
475
  reduce(e, s) {
476
- const { range: t, numRows: n } = s, { start: i, end: r } = t, u = e.sheetReactive.current, c = {
476
+ const { range: t, numRows: n } = s, { start: i, end: r } = t, a = e.sheetReactive.current, c = {
477
477
  startY: 1,
478
478
  startX: i,
479
479
  endY: n,
480
480
  endX: r
481
481
  };
482
- let l = 1;
483
- if (u) {
484
- for (let d = 1; d <= n; d++)
485
- if (!u.isRowFiltered(d)) {
486
- l = d;
482
+ let d = 1;
483
+ if (a) {
484
+ for (let l = 1; l <= n; l++)
485
+ if (!a.isRowFiltered(l)) {
486
+ d = l;
487
487
  break;
488
488
  }
489
489
  }
490
490
  return {
491
491
  ...e,
492
492
  selectingZone: c,
493
- choosing: { y: l, x: i },
493
+ choosing: { y: d, x: i },
494
494
  leftHeaderSelecting: !1,
495
495
  topHeaderSelecting: !0
496
496
  };
497
497
  }
498
498
  }
499
499
  const Ue = new We().bind();
500
- class _e extends h {
500
+ class _e extends f {
501
501
  reduce(e, s) {
502
502
  const { startY: t, startX: n } = e.selectingZone, i = {
503
503
  startY: t,
@@ -509,7 +509,7 @@ class _e extends h {
509
509
  }
510
510
  }
511
511
  const Oe = new _e().bind();
512
- class qe extends h {
512
+ class je extends f {
513
513
  reduce(e, s) {
514
514
  const { matchingCells: t } = e;
515
515
  let { matchingCellIndex: n, choosing: i } = e;
@@ -520,25 +520,25 @@ class qe extends h {
520
520
  return { ...e, matchingCells: t, matchingCellIndex: n, choosing: i };
521
521
  }
522
522
  }
523
- const Qe = new qe().bind();
524
- class Ve extends h {
523
+ const qe = new je().bind();
524
+ class Qe extends f {
525
525
  reduce(e, s) {
526
526
  let { value: t, point: n } = s;
527
- const { choosing: i, selectingZone: r, sheetReactive: u } = e;
527
+ const { choosing: i, selectingZone: r, sheetReactive: a } = e;
528
528
  n == null && (n = i);
529
- const c = u.current;
529
+ const c = a.current;
530
530
  if (!c)
531
531
  return e;
532
- const l = c.write({
532
+ const d = c.write({
533
533
  point: n,
534
534
  value: t,
535
535
  operator: "USER",
536
- undoReflection: y({
536
+ undoReflection: p({
537
537
  sheetId: c.id,
538
538
  selectingZone: r,
539
539
  choosing: n
540
540
  }),
541
- redoReflection: y({
541
+ redoReflection: p({
542
542
  sheetId: c.id,
543
543
  selectingZone: r,
544
544
  choosing: n
@@ -546,9 +546,9 @@ class Ve extends h {
546
546
  });
547
547
  return {
548
548
  ...e,
549
- ...M(l, e),
550
- sheetReactive: { current: l },
551
- callback: ({ sheetReactive: d }) => {
549
+ ...M(d, e),
550
+ sheetReactive: { current: d },
551
+ callback: ({ sheetReactive: l }) => {
552
552
  c.registry.transmit({
553
553
  copyingZone: E
554
554
  });
@@ -556,39 +556,39 @@ class Ve extends h {
556
556
  };
557
557
  }
558
558
  }
559
- const je = new Ve().bind();
560
- class Ge extends h {
559
+ const Ve = new Qe().bind();
560
+ class Ge extends f {
561
561
  constructor() {
562
562
  super(...arguments), this.mutation = !0;
563
563
  }
564
564
  reduce(e, s) {
565
- var x;
565
+ var R;
566
566
  const { choosing: t, selectingZone: n, sheetReactive: i } = e, r = i.current;
567
567
  if (!r)
568
568
  return e;
569
- let u = z(n);
570
- if (u.top === -1) {
571
- const { y: w, x: f } = t;
572
- u = { top: w, left: f, bottom: w, right: f };
569
+ let a = z(n);
570
+ if (a.top === -1) {
571
+ const { y: h, x: w } = t;
572
+ a = { top: h, left: w, bottom: h, right: w };
573
573
  }
574
- const { top: c, left: l, bottom: d, right: a } = u, g = {};
575
- let p = 0;
576
- for (let w = c; w <= d; w++)
577
- if (!r.isRowFiltered(w))
578
- for (let f = l; f <= a; f++) {
579
- const S = r.getCell({ y: w, x: f }, { resolution: "SYSTEM" }), Z = ce({ y: w, x: f });
580
- K.hasOperation(S == null ? void 0 : S.prevention, K.Write) || ((x = r.getSystem({ y: w, x: f })) == null ? void 0 : x.spilledFrom) == null && (S == null ? void 0 : S.value) != null && (g[Z] = { value: void 0 }, p++);
574
+ const { top: c, left: d, bottom: l, right: u } = a, g = {};
575
+ let S = 0;
576
+ for (let h = c; h <= l; h++)
577
+ if (!r.isRowFiltered(h))
578
+ for (let w = d; w <= u; w++) {
579
+ const m = r.getCell({ y: h, x: w }, { resolution: "SYSTEM" }), Z = ce({ y: h, x: w });
580
+ K.hasOperation(m == null ? void 0 : m.prevention, K.Write) || ((R = r.getSystem({ y: h, x: w })) == null ? void 0 : R.spilledFrom) == null && (m == null ? void 0 : m.value) != null && (g[Z] = { value: void 0 }, S++);
581
581
  }
582
- return p === 0 ? e : (r.update({
582
+ return S === 0 ? e : (r.update({
583
583
  diff: g,
584
584
  partial: !0,
585
585
  operator: "USER",
586
- undoReflection: y({
586
+ undoReflection: p({
587
587
  sheetId: r.id,
588
588
  selectingZone: n,
589
589
  choosing: t
590
590
  }),
591
- redoReflection: y({
591
+ redoReflection: p({
592
592
  sheetId: r.id,
593
593
  selectingZone: n,
594
594
  choosing: t
@@ -601,7 +601,7 @@ class Ge extends h {
601
601
  }
602
602
  }
603
603
  const Ke = new Ge().bind();
604
- class Ne extends h {
604
+ class Ne extends f {
605
605
  constructor() {
606
606
  super(...arguments), this.mutation = !0;
607
607
  }
@@ -613,8 +613,8 @@ class Ne extends h {
613
613
  if (i == null)
614
614
  return e;
615
615
  if (i.dstSheetId !== n.id) {
616
- const { dispatch: u, store: c } = n.registry.contextsBySheetId[i.dstSheetId];
617
- return u(
616
+ const { dispatch: a, store: c } = n.registry.contextsBySheetId[i.dstSheetId];
617
+ return a(
618
618
  te({
619
619
  ...c,
620
620
  ...i.undoReflection,
@@ -628,14 +628,14 @@ class Ne extends h {
628
628
  ...i.undoReflection,
629
629
  ...M(n, e),
630
630
  sheetReactive: { current: n },
631
- callback: (u) => {
632
- r == null || r(u), D(e.flashRef.current);
631
+ callback: (a) => {
632
+ r == null || r(a), D(e.flashRef.current);
633
633
  }
634
634
  };
635
635
  }
636
636
  }
637
637
  const $e = new Ne().bind();
638
- class Je extends h {
638
+ class Je extends f {
639
639
  constructor() {
640
640
  super(...arguments), this.mutation = !0;
641
641
  }
@@ -643,18 +643,18 @@ class Je extends h {
643
643
  const { sheetReactive: t } = e, n = t.current;
644
644
  if (n == null)
645
645
  return e;
646
- const { history: i, newSheet: r, callback: u } = n.redo();
646
+ const { history: i, newSheet: r, callback: a } = n.redo();
647
647
  if (i == null)
648
648
  return e;
649
649
  if (i.dstSheetId !== n.id) {
650
- const { dispatch: c, store: l } = n.registry.contextsBySheetId[i.dstSheetId];
650
+ const { dispatch: c, store: d } = n.registry.contextsBySheetId[i.dstSheetId];
651
651
  return c(
652
652
  te({
653
- ...l,
653
+ ...d,
654
654
  ...i.redoReflection,
655
- sheetReactive: { current: l.sheetReactive.current }
655
+ sheetReactive: { current: d.sheetReactive.current }
656
656
  })
657
- ), D(l.flashRef.current), i.srcSheetId === n.id ? ee(e, n, u) : e;
657
+ ), D(d.flashRef.current), i.srcSheetId === n.id ? ee(e, n, a) : e;
658
658
  }
659
659
  return {
660
660
  ...e,
@@ -663,106 +663,106 @@ class Je extends h {
663
663
  ...M(n, e),
664
664
  sheetReactive: { current: n },
665
665
  callback: (c) => {
666
- u == null || u(c), D(e.flashRef.current);
666
+ a == null || a(c), D(e.flashRef.current);
667
667
  }
668
668
  };
669
669
  }
670
670
  }
671
671
  const et = new Je().bind();
672
- class tt extends h {
672
+ class tt extends f {
673
673
  reduce(e, s) {
674
- var R, m, X, H;
675
- const { shiftKey: t, deltaY: n, deltaX: i, numRows: r, numCols: u } = s, { choosing: c, sheetReactive: l, tabularRef: d } = e, a = l.current;
676
- if (a == null)
674
+ var x, y, X, T;
675
+ const { shiftKey: t, deltaY: n, deltaX: i, numRows: r, numCols: a } = s, { choosing: c, sheetReactive: d, tabularRef: l } = e, u = d.current;
676
+ if (u == null)
677
677
  return e;
678
678
  let { selectingZone: g } = e;
679
- const { y: p, x } = c;
679
+ const { y: S, x: R } = c;
680
680
  if (t) {
681
681
  const [b, P] = [
682
- g.endY === -1 ? p : g.endY,
683
- g.endX === -1 ? x : g.endX
684
- ], [T, A] = [b + n, P + i];
685
- return T < 1 || r < T || A < 1 || u < A ? e : (g = p === T && x === A ? { startY: -1, startX: -1, endY: -1, endX: -1 } : { startY: p, startX: x, endY: T, endX: A }, {
682
+ g.endY === -1 ? S : g.endY,
683
+ g.endX === -1 ? R : g.endX
684
+ ], [H, A] = [b + n, P + i];
685
+ return H < 1 || r < H || A < 1 || a < A ? e : (g = S === H && R === A ? { startY: -1, startX: -1, endY: -1, endX: -1 } : { startY: S, startX: R, endY: H, endX: A }, {
686
686
  ...e,
687
687
  selectingZone: g
688
688
  });
689
689
  }
690
- const [w, f] = [p + n, x + i];
691
- if (w < 1 || r < w || f < 1 || u < f)
690
+ const [h, w] = [S + n, R + i];
691
+ if (h < 1 || r < h || w < 1 || a < w)
692
692
  return e;
693
- let S = w;
694
- if (a.isRowFiltered(S)) {
693
+ let m = h;
694
+ if (u.isRowFiltered(m)) {
695
695
  const b = n >= 0 ? 1 : -1;
696
- for (; S >= 1 && S <= r && a.isRowFiltered(S); )
697
- S += b;
698
- if (S < 1 || S > r)
696
+ for (; m >= 1 && m <= r && u.isRowFiltered(m); )
697
+ m += b;
698
+ if (m < 1 || m > r)
699
699
  return e;
700
700
  }
701
- let { y: Z, x: I, height: Y, width: C } = e.editorRect;
701
+ let { y: Z, x: Y, height: I, width: C } = e.editorRect;
702
702
  if (n > 0)
703
- for (let b = p; b < S; b++)
704
- Z += ((R = a.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : R.height) || F;
703
+ for (let b = S; b < m; b++)
704
+ Z += ((x = u.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : x.height) || F;
705
705
  else if (n < 0)
706
- for (let b = p - 1; b >= S; b--)
707
- Z -= ((m = a.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : m.height) || F;
706
+ for (let b = S - 1; b >= m; b--)
707
+ Z -= ((y = u.getCell({ y: b, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : y.height) || F;
708
708
  if (i > 0)
709
- for (let b = x; b < f; b++)
710
- I += ((X = a.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : X.width) || k;
709
+ for (let b = R; b < w; b++)
710
+ Y += ((X = u.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : X.width) || k;
711
711
  else if (i < 0)
712
- for (let b = x - 1; b >= f; b--)
713
- I -= ((H = a.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : H.width) || k;
714
- const v = a.getCell({ y: S, x: f }, { resolution: "SYSTEM" });
715
- return Y = (v == null ? void 0 : v.height) || F, C = (v == null ? void 0 : v.width) || k, J(a, d.current, { y: S, x: f }), {
712
+ for (let b = R - 1; b >= w; b--)
713
+ Y -= ((T = u.getCell({ y: 0, x: b }, { resolution: "SYSTEM" })) == null ? void 0 : T.width) || k;
714
+ const v = u.getCell({ y: m, x: w }, { resolution: "SYSTEM" });
715
+ return I = (v == null ? void 0 : v.height) || F, C = (v == null ? void 0 : v.width) || k, J(u, l.current, { y: m, x: w }), {
716
716
  ...e,
717
717
  selectingZone: { startY: -1, startX: -1, endY: -1, endX: -1 },
718
- choosing: { y: S, x: f },
719
- editorRect: { y: Z, x: I, height: Y, width: C }
718
+ choosing: { y: m, x: w },
719
+ editorRect: { y: Z, x: Y, height: I, width: C }
720
720
  };
721
721
  }
722
722
  }
723
723
  const nt = new tt().bind();
724
- class st extends h {
724
+ class st extends f {
725
725
  reduce(e, s) {
726
- var H, b, P, T;
726
+ var T, b, P, H;
727
727
  const { numRows: t, numCols: n } = s;
728
728
  let { deltaY: i, deltaX: r } = s;
729
- const { choosing: u, selectingZone: c, sheetReactive: l, tabularRef: d } = e, a = l.current;
730
- if (a == null)
729
+ const { choosing: a, selectingZone: c, sheetReactive: d, tabularRef: l } = e, u = d.current;
730
+ if (u == null)
731
731
  return e;
732
- let { y: g, x: p, height: x, width: w } = e.editorRect;
733
- const { y: f, x: S } = u, Z = z(c), { top: I, left: Y, bottom: C, right: v } = Z;
734
- let [R, m] = [f + i, S + r];
735
- if (R < I && I !== -1 && (i = C - R, R = C, m > Y ? (m--, r--) : (r = v - m, m = v)), R > C && C !== -1 && (i = I - R, R = I, m < v ? (m++, r++) : (r = Y - m, m = Y)), m < Y && Y !== -1 && (r = v - m, m = v, R > I ? (R--, i--) : (i = C - R, R = C)), m > v && v !== -1 && (r = Y - m, m = Y, R < C ? (R++, i++) : (i = I - R, R = I)), R < 1 || t < R || m < 1 || n < m)
732
+ let { y: g, x: S, height: R, width: h } = e.editorRect;
733
+ const { y: w, x: m } = a, Z = z(c), { top: Y, left: I, bottom: C, right: v } = Z;
734
+ let [x, y] = [w + i, m + r];
735
+ if (x < Y && Y !== -1 && (i = C - x, x = C, y > I ? (y--, r--) : (r = v - y, y = v)), x > C && C !== -1 && (i = Y - x, x = Y, y < v ? (y++, r++) : (r = I - y, y = I)), y < I && I !== -1 && (r = v - y, y = v, x > Y ? (x--, i--) : (i = C - x, x = C)), y > v && v !== -1 && (r = I - y, y = I, x < C ? (x++, i++) : (i = Y - x, x = Y)), x < 1 || t < x || y < 1 || n < y)
736
736
  return e;
737
- if (a.isRowFiltered(R)) {
738
- const A = i >= 0 ? 1 : -1, Q = I !== -1 ? I : 1, V = C !== -1 ? C : t;
739
- for (; R >= Q && R <= V && a.isRowFiltered(R); )
740
- R += A;
741
- if (R < Q || R > V || a.isRowFiltered(R))
737
+ if (u.isRowFiltered(x)) {
738
+ const A = i >= 0 ? 1 : -1, q = Y !== -1 ? Y : 1, Q = C !== -1 ? C : t;
739
+ for (; x >= q && x <= Q && u.isRowFiltered(x); )
740
+ x += A;
741
+ if (x < q || x > Q || u.isRowFiltered(x))
742
742
  return e;
743
743
  }
744
744
  if (i > 0)
745
- for (let A = f; A < R; A++)
746
- g += ((H = a.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : H.height) || F;
745
+ for (let A = w; A < x; A++)
746
+ g += ((T = u.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : T.height) || F;
747
747
  else if (i < 0)
748
- for (let A = f - 1; A >= R; A--)
749
- g -= ((b = a.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : b.height) || F;
748
+ for (let A = w - 1; A >= x; A--)
749
+ g -= ((b = u.getCell({ y: A, x: 0 }, { resolution: "SYSTEM" })) == null ? void 0 : b.height) || F;
750
750
  if (r > 0)
751
- for (let A = S; A < m; A++)
752
- p += ((P = a.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : P.width) || k;
751
+ for (let A = m; A < y; A++)
752
+ S += ((P = u.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : P.width) || k;
753
753
  else if (r < 0)
754
- for (let A = S - 1; A >= m; A--)
755
- p -= ((T = a.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : T.width) || k;
756
- const X = a.getCell({ y: R, x: m }, { resolution: "SYSTEM" });
757
- return x = (X == null ? void 0 : X.height) || F, w = (X == null ? void 0 : X.width) || k, J(a, d.current, { y: R, x: m }), {
754
+ for (let A = m - 1; A >= y; A--)
755
+ S -= ((H = u.getCell({ y: 0, x: A }, { resolution: "SYSTEM" })) == null ? void 0 : H.width) || k;
756
+ const X = u.getCell({ y: x, x: y }, { resolution: "SYSTEM" });
757
+ return R = (X == null ? void 0 : X.height) || F, h = (X == null ? void 0 : X.width) || k, J(u, l.current, { y: x, x: y }), {
758
758
  ...e,
759
- choosing: { y: R, x: m },
760
- editorRect: { y: g, x: p, height: x, width: w }
759
+ choosing: { y: x, x: y },
760
+ editorRect: { y: g, x: S, height: R, width: h }
761
761
  };
762
762
  }
763
763
  }
764
764
  const it = new st().bind();
765
- class ot extends h {
765
+ class ot extends f {
766
766
  reduce(e, s) {
767
767
  return {
768
768
  ...e,
@@ -771,235 +771,274 @@ class ot extends h {
771
771
  }
772
772
  }
773
773
  const Ot = new ot().bind();
774
- class rt extends h {
774
+ class rt extends f {
775
775
  constructor() {
776
776
  super(...arguments), this.mutation = !0;
777
777
  }
778
778
  reduce(e, s) {
779
- const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c } = e, l = r.current;
780
- return l == null ? e : (l.insertRows({
779
+ const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c } = e, d = r.current;
780
+ return d == null ? e : (d.insertRows({
781
781
  y: n,
782
782
  numRows: t,
783
783
  baseY: n,
784
784
  operator: i,
785
- undoReflection: y({
786
- sheetId: l.id,
787
- selectingZone: u,
785
+ undoReflection: p({
786
+ sheetId: d.id,
787
+ selectingZone: a,
788
788
  choosing: c
789
789
  }),
790
- redoReflection: y({
791
- sheetId: l.id,
792
- selectingZone: u,
790
+ redoReflection: p({
791
+ sheetId: d.id,
792
+ selectingZone: a,
793
793
  choosing: c
794
794
  })
795
795
  }), {
796
796
  ...e,
797
- sheetReactive: { current: l }
797
+ sheetReactive: { current: d }
798
798
  });
799
799
  }
800
800
  }
801
801
  const ct = new rt().bind();
802
- class ut extends h {
802
+ class at extends f {
803
803
  constructor() {
804
804
  super(...arguments), this.mutation = !0;
805
805
  }
806
806
  reduce(e, s) {
807
- const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
808
- if (d == null)
807
+ const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c, editorRef: d } = e, l = r.current;
808
+ if (l == null)
809
809
  return e;
810
- const a = {
811
- ...u,
812
- startY: u.startY + t,
813
- endY: u.endY + t
810
+ const u = {
811
+ ...a,
812
+ startY: a.startY + t,
813
+ endY: a.endY + t
814
814
  }, g = { ...c, y: c.y + t };
815
- return d.insertRows({
815
+ return l.insertRows({
816
816
  y: n + 1,
817
817
  numRows: t,
818
818
  baseY: n,
819
819
  operator: i,
820
- undoReflection: y({
821
- sheetId: d.id,
822
- selectingZone: u,
820
+ undoReflection: p({
821
+ sheetId: l.id,
822
+ selectingZone: a,
823
823
  choosing: c
824
824
  }),
825
- redoReflection: y({
826
- sheetId: d.id,
827
- selectingZone: a,
825
+ redoReflection: p({
826
+ sheetId: l.id,
827
+ selectingZone: u,
828
828
  choosing: g
829
829
  })
830
830
  }), {
831
831
  ...e,
832
- selectingZone: a,
832
+ selectingZone: u,
833
833
  choosing: g,
834
- sheetReactive: { current: d }
834
+ sheetReactive: { current: l }
835
835
  };
836
836
  }
837
837
  }
838
- const dt = new ut().bind();
839
- class at extends h {
838
+ const lt = new at().bind();
839
+ class ut extends f {
840
840
  constructor() {
841
841
  super(...arguments), this.mutation = !0;
842
842
  }
843
843
  reduce(e, s) {
844
- const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
845
- return d == null ? e : (d.insertCols({
844
+ const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c, editorRef: d } = e, l = r.current;
845
+ return l == null ? e : (l.insertCols({
846
846
  x: n,
847
847
  numCols: t,
848
848
  baseX: n,
849
849
  operator: i,
850
- undoReflection: y({
851
- sheetId: d.id,
852
- selectingZone: u,
850
+ undoReflection: p({
851
+ sheetId: l.id,
852
+ selectingZone: a,
853
853
  choosing: c
854
854
  }),
855
- redoReflection: y({
856
- sheetId: d.id,
857
- selectingZone: u,
855
+ redoReflection: p({
856
+ sheetId: l.id,
857
+ selectingZone: a,
858
858
  choosing: c
859
859
  })
860
860
  }), {
861
861
  ...e,
862
- sheetReactive: { current: d }
862
+ sheetReactive: { current: l }
863
863
  });
864
864
  }
865
865
  }
866
- const lt = new at().bind();
867
- class ht extends h {
866
+ const dt = new ut().bind();
867
+ class ht extends f {
868
868
  constructor() {
869
869
  super(...arguments), this.mutation = !0;
870
870
  }
871
871
  reduce(e, s) {
872
- const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c } = e, l = r.current;
873
- if (l == null)
872
+ const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c } = e, d = r.current;
873
+ if (d == null)
874
874
  return e;
875
- const d = {
876
- ...u,
877
- startX: u.startX + t,
878
- endX: u.endX + t
879
- }, a = { ...c, x: c.x + t };
880
- return u.startX += t, u.endX += t, l.insertCols({
875
+ const l = {
876
+ ...a,
877
+ startX: a.startX + t,
878
+ endX: a.endX + t
879
+ }, u = { ...c, x: c.x + t };
880
+ return a.startX += t, a.endX += t, d.insertCols({
881
881
  x: n + 1,
882
882
  numCols: t,
883
883
  baseX: n,
884
884
  operator: i,
885
- undoReflection: y({
886
- sheetId: l.id,
887
- selectingZone: u,
885
+ undoReflection: p({
886
+ sheetId: d.id,
887
+ selectingZone: a,
888
888
  choosing: c
889
889
  }),
890
- redoReflection: y({
891
- sheetId: l.id,
892
- selectingZone: d,
893
- choosing: a
890
+ redoReflection: p({
891
+ sheetId: d.id,
892
+ selectingZone: l,
893
+ choosing: u
894
894
  })
895
895
  }), {
896
896
  ...e,
897
- selectingZone: d,
898
- choosing: a,
899
- sheetReactive: { current: l }
897
+ selectingZone: l,
898
+ choosing: u,
899
+ sheetReactive: { current: d }
900
900
  };
901
901
  }
902
902
  }
903
- const gt = new ht().bind();
904
- class ft extends h {
903
+ const ft = new ht().bind();
904
+ class gt extends f {
905
905
  constructor() {
906
906
  super(...arguments), this.mutation = !0;
907
907
  }
908
908
  reduce(e, s) {
909
- const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
910
- return d == null ? e : (d.removeRows({
909
+ const { numRows: t, y: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c, editorRef: d } = e, l = r.current;
910
+ if (l == null)
911
+ return e;
912
+ l.removeRows({
911
913
  y: n,
912
914
  numRows: t,
913
915
  operator: i,
914
- undoReflection: y({
915
- sheetId: d.id,
916
- selectingZone: u,
916
+ undoReflection: p({
917
+ sheetId: l.id,
918
+ selectingZone: a,
917
919
  choosing: c,
918
920
  sheetHeight: e.sheetHeight
919
921
  }),
920
- redoReflection: y({
921
- sheetId: d.id,
922
- selectingZone: u,
922
+ redoReflection: p({
923
+ sheetId: l.id,
924
+ selectingZone: a,
923
925
  choosing: c
924
926
  })
925
- }), {
926
- ...e,
927
- sheetReactive: { current: d }
928
927
  });
928
+ const u = l.numRows, g = l.numCols;
929
+ let S = Math.max(1, Math.min(n, u));
930
+ if (l.isRowFiltered(S)) {
931
+ let R = -1;
932
+ for (let h = S; h <= u; h++)
933
+ if (!l.isRowFiltered(h)) {
934
+ R = h;
935
+ break;
936
+ }
937
+ if (R === -1) {
938
+ for (let h = S; h >= 1; h--)
939
+ if (!l.isRowFiltered(h)) {
940
+ R = h;
941
+ break;
942
+ }
943
+ }
944
+ R !== -1 && (S = R);
945
+ }
946
+ return {
947
+ ...e,
948
+ sheetReactive: { current: l },
949
+ selectingZone: { startY: S, startX: 1, endY: S, endX: g },
950
+ choosing: { y: S, x: 1 },
951
+ leftHeaderSelecting: !0,
952
+ topHeaderSelecting: !1
953
+ };
929
954
  }
930
955
  }
931
- const Rt = new ft().bind();
932
- class wt extends h {
956
+ const Rt = new gt().bind();
957
+ class wt extends f {
933
958
  constructor() {
934
959
  super(...arguments), this.mutation = !0;
935
960
  }
936
961
  reduce(e, s) {
937
- const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: u, choosing: c, editorRef: l } = e, d = r.current;
938
- return d == null ? e : (d.removeCols({
962
+ const { numCols: t, x: n, operator: i } = s, { sheetReactive: r, selectingZone: a, choosing: c, editorRef: d } = e, l = r.current;
963
+ if (l == null)
964
+ return e;
965
+ l.removeCols({
939
966
  x: n,
940
967
  numCols: t,
941
968
  operator: i,
942
- undoReflection: y({
943
- sheetId: d.id,
944
- selectingZone: u,
969
+ undoReflection: p({
970
+ sheetId: l.id,
971
+ selectingZone: a,
945
972
  choosing: c,
946
973
  sheetWidth: e.sheetWidth
947
974
  }),
948
- redoReflection: y({
949
- sheetId: d.id,
950
- selectingZone: u,
975
+ redoReflection: p({
976
+ sheetId: l.id,
977
+ selectingZone: a,
951
978
  choosing: c
952
979
  })
953
- }), {
954
- ...e,
955
- sheetReactive: { current: d }
956
980
  });
981
+ const u = l.numCols, g = l.numRows, S = Math.max(1, Math.min(n, u));
982
+ let R = 1;
983
+ for (let h = 1; h <= g; h++)
984
+ if (!l.isRowFiltered(h)) {
985
+ R = h;
986
+ break;
987
+ }
988
+ return {
989
+ ...e,
990
+ sheetReactive: { current: l },
991
+ selectingZone: { startY: 1, startX: S, endY: g, endX: S },
992
+ choosing: { y: R, x: S },
993
+ leftHeaderSelecting: !1,
994
+ topHeaderSelecting: !0
995
+ };
957
996
  }
958
997
  }
959
998
  const St = new wt().bind();
960
- class xt extends h {
999
+ class xt extends f {
961
1000
  constructor() {
962
1001
  super(...arguments), this.mutation = !0;
963
1002
  }
964
1003
  reduce(e, s) {
965
- const { x: t, direction: n } = s, { sheetReactive: i, selectingZone: r, choosing: u } = e, c = i.current;
1004
+ const { x: t, direction: n } = s, { sheetReactive: i, selectingZone: r, choosing: a } = e, c = i.current;
966
1005
  if (c == null)
967
1006
  return e;
968
1007
  c.sortRows({ x: t, direction: n });
969
- const l = y({ sheetId: c.id, selectingZone: r, choosing: u });
970
- return c.registry.lastHistory && (c.registry.lastHistory.undoReflection = l, c.registry.lastHistory.redoReflection = l), {
1008
+ const d = p({ sheetId: c.id, selectingZone: r, choosing: a });
1009
+ return c.registry.lastHistory && (c.registry.lastHistory.undoReflection = d, c.registry.lastHistory.redoReflection = d), {
971
1010
  ...e,
972
1011
  sheetReactive: { current: c }
973
1012
  };
974
1013
  }
975
1014
  }
976
1015
  const mt = new xt().bind();
977
- class yt extends h {
1016
+ class yt extends f {
978
1017
  constructor() {
979
1018
  super(...arguments), this.mutation = !0;
980
1019
  }
981
1020
  reduce(e, s) {
982
- const { x: t, filter: n } = s, { sheetReactive: i, selectingZone: r, choosing: u } = e, c = i.current;
1021
+ const { x: t, filter: n } = s, { sheetReactive: i, selectingZone: r, choosing: a } = e, c = i.current;
983
1022
  if (c == null)
984
1023
  return e;
985
1024
  c.filterRows({ x: t, filter: n });
986
- const l = y({ sheetId: c.id, selectingZone: r, choosing: u });
987
- c.registry.lastHistory && (c.registry.lastHistory.undoReflection = l, c.registry.lastHistory.redoReflection = l);
988
- let d = u;
989
- if (c.isRowFiltered(u.y)) {
990
- for (let a = 1; a <= c.numRows; a++)
991
- if (!c.isRowFiltered(a)) {
992
- d = { y: a, x: u.x };
1025
+ const d = p({ sheetId: c.id, selectingZone: r, choosing: a });
1026
+ c.registry.lastHistory && (c.registry.lastHistory.undoReflection = d, c.registry.lastHistory.redoReflection = d);
1027
+ let l = a;
1028
+ if (c.isRowFiltered(a.y)) {
1029
+ for (let u = 1; u <= c.numRows; u++)
1030
+ if (!c.isRowFiltered(u)) {
1031
+ l = { y: u, x: a.x };
993
1032
  break;
994
1033
  }
995
1034
  }
996
1035
  return {
997
1036
  ...e,
998
- choosing: d,
999
- selectingZone: d !== u ? E : r,
1037
+ choosing: l,
1038
+ selectingZone: l !== a ? E : r,
1000
1039
  sheetReactive: { current: c },
1001
- callback: ({ sheetReactive: a }) => {
1002
- const g = a.current;
1040
+ callback: ({ sheetReactive: u }) => {
1041
+ const g = u.current;
1003
1042
  g && g.registry.transmit({
1004
1043
  cutting: !1,
1005
1044
  copyingZone: E
@@ -1009,7 +1048,7 @@ class yt extends h {
1009
1048
  }
1010
1049
  }
1011
1050
  const pt = new yt().bind();
1012
- class vt extends h {
1051
+ class vt extends f {
1013
1052
  reduce(e, s) {
1014
1053
  return {
1015
1054
  ...e,
@@ -1017,8 +1056,8 @@ class vt extends h {
1017
1056
  };
1018
1057
  }
1019
1058
  }
1020
- const qt = new vt().bind();
1021
- class bt extends h {
1059
+ const jt = new vt().bind();
1060
+ class bt extends f {
1022
1061
  reduce(e, s) {
1023
1062
  return {
1024
1063
  ...e,
@@ -1026,8 +1065,8 @@ class bt extends h {
1026
1065
  };
1027
1066
  }
1028
1067
  }
1029
- const Qt = new bt().bind();
1030
- class At extends h {
1068
+ const qt = new bt().bind();
1069
+ class At extends f {
1031
1070
  reduce(e, s) {
1032
1071
  return {
1033
1072
  ...e,
@@ -1035,8 +1074,8 @@ class At extends h {
1035
1074
  };
1036
1075
  }
1037
1076
  }
1038
- const Vt = new At().bind();
1039
- class Ct extends h {
1077
+ const Qt = new At().bind();
1078
+ class Ct extends f {
1040
1079
  reduce(e, s) {
1041
1080
  return {
1042
1081
  ...e,
@@ -1044,28 +1083,28 @@ class Ct extends h {
1044
1083
  };
1045
1084
  }
1046
1085
  }
1047
- const te = new Ct().bind(), jt = {
1048
- blur: Ie,
1086
+ const te = new Ct().bind(), Vt = {
1087
+ blur: Ye,
1049
1088
  copy: Ze,
1050
1089
  cut: Me,
1051
- paste: Te,
1090
+ paste: He,
1052
1091
  escape: Fe,
1053
1092
  choose: Le,
1054
1093
  select: Pe,
1055
1094
  selectRows: Be,
1056
1095
  selectCols: Ue,
1057
1096
  drag: Oe,
1058
- search: Qe,
1059
- write: je,
1097
+ search: qe,
1098
+ write: Ve,
1060
1099
  clear: Ke,
1061
1100
  undo: $e,
1062
1101
  redo: et,
1063
1102
  arrow: nt,
1064
1103
  walk: it,
1065
1104
  insertRowsAbove: ct,
1066
- insertRowsBelow: dt,
1067
- insertColsLeft: lt,
1068
- insertColsRight: gt,
1105
+ insertRowsBelow: lt,
1106
+ insertColsLeft: dt,
1107
+ insertColsRight: ft,
1069
1108
  removeRows: Rt,
1070
1109
  removeCols: St,
1071
1110
  sortRows: mt,
@@ -1076,7 +1115,7 @@ const te = new Ct().bind(), jt = {
1076
1115
  e(!0);
1077
1116
  }, []), o && typeof window < "u" ? { window, document } : { window: null, document: null };
1078
1117
  }, Kt = (o, e = 100) => {
1079
- const s = j(o), t = j();
1118
+ const s = V(o), t = V();
1080
1119
  return O(() => {
1081
1120
  s.current = o;
1082
1121
  }, [o]), (...n) => {
@@ -1085,7 +1124,7 @@ const te = new Ct().bind(), jt = {
1085
1124
  }, e);
1086
1125
  };
1087
1126
  }, Nt = (o = {}) => {
1088
- const [e, s] = N(() => ue(o)), { registry: t } = e;
1127
+ const [e, s] = N(() => ae(o)), { registry: t } = e;
1089
1128
  return t.updateSheet = ve, t.transmit = (n) => {
1090
1129
  Object.assign(t, n), t.ready && requestAnimationFrame(() => s({ registry: t }));
1091
1130
  }, O(() => {
@@ -1093,12 +1132,12 @@ const te = new Ct().bind(), jt = {
1093
1132
  }, [o]), e;
1094
1133
  };
1095
1134
  export {
1096
- lt as A,
1097
- dt as B,
1135
+ dt as A,
1136
+ lt as B,
1098
1137
  ct as C,
1099
1138
  Pt as D,
1100
- qt as E,
1101
- Qt as F,
1139
+ jt as E,
1140
+ qt as F,
1102
1141
  Zt as G,
1103
1142
  Ut as H,
1104
1143
  Le as I,
@@ -1109,14 +1148,14 @@ export {
1109
1148
  Ue as N,
1110
1149
  Kt as O,
1111
1150
  Be as P,
1112
- Qe as Q,
1113
- Tt as R,
1114
- Ht as S,
1151
+ qe as Q,
1152
+ Ht as R,
1153
+ Tt as S,
1115
1154
  Ft as T,
1116
1155
  Nt as U,
1117
1156
  Xt as V,
1118
1157
  Mt as W,
1119
- jt as X,
1158
+ Vt as X,
1120
1159
  Ot as a,
1121
1160
  ve as b,
1122
1161
  $e as c,
@@ -1129,19 +1168,19 @@ export {
1129
1168
  Fe as j,
1130
1169
  Ke as k,
1131
1170
  it as l,
1132
- Vt as m,
1171
+ Qt as m,
1133
1172
  te as n,
1134
1173
  zt as o,
1135
- Te as p,
1174
+ He as p,
1136
1175
  Bt as q,
1137
1176
  et as r,
1138
1177
  kt as s,
1139
1178
  pt as t,
1140
1179
  Gt as u,
1141
1180
  mt as v,
1142
- je as w,
1181
+ Ve as w,
1143
1182
  St as x,
1144
1183
  Rt as y,
1145
- gt as z
1184
+ ft as z
1146
1185
  };
1147
- //# sourceMappingURL=hooks-CcD8I6FA.mjs.map
1186
+ //# sourceMappingURL=hooks-CvkA2lFB.mjs.map