@sheetxl/scripting 0.4.13 → 0.4.14

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,10 +1,10 @@
1
1
  "use strict";/**
2
- * @license @sheetxl/scripting - Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild. - v0.4.13
2
+ * @license @sheetxl/scripting - Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild. - v0.4.14
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
6
  */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let c=class{constructor(e){this._worker=null,this._nextId=1,this._pendingRequests=new Map,this._workerFactory=e}start(){if(typeof Worker>"u")throw new Error("Web Workers are not supported in this environment.");return this._worker||(this._worker=this._workerFactory(),this._worker.onmessage=e=>{const{id:n,result:t,error:r}=e.data,o=this._pendingRequests.get(n);if(o)if(this._pendingRequests.delete(n),r){const i=new Error(r.message);i.stack=r.stack,r.cause&&(i.cause=r.cause),o.reject(i)}else o.resolve(t)},this._worker.onerror=e=>{console.error("Worker error:",e),this._pendingRequests.forEach(n=>{n.reject(new Error(`Worker failed: ${e.message}`))}),this._pendingRequests.clear(),this._worker=null}),Promise.resolve()}execute(e){if(!this._worker)throw new Error("Worker is not initialized. Call start() first.");const n=this._nextId++;return new Promise((t,r)=>{this._pendingRequests.set(n,{resolve:t,reject:r}),this._worker.postMessage({id:n,params:e})})}terminate(){this._worker&&(this._worker.terminate(),this._worker=null)}};class u{constructor(n){this._onExecute=n}execute(n){return this._onExecute(n)}start(){return Promise.resolve()}terminate(){}}const s=`/**
7
- * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.4.13
7
+ * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.4.14
8
8
  *
9
9
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
10
10
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -40,7 +40,7 @@ var Re, ae, d;
40
40
  }
41
41
  }
42
42
  e.Known = t;
43
- class n extends t {
43
+ class r extends t {
44
44
  constructor(c, m) {
45
45
  super(e.Code.Parse, e.Label.Parse, c, m);
46
46
  }
@@ -52,8 +52,8 @@ var Re, ae, d;
52
52
  return { line: c?.line ?? 1, column: c?.column ?? 1, offset: c?.offset ?? 0, length: c?.length ?? 0 };
53
53
  }
54
54
  }
55
- e.Parse = n;
56
- class r extends t {
55
+ e.Parse = r;
56
+ class n extends t {
57
57
  constructor(c, m) {
58
58
  super(e.Code.Null, e.Label.Null, c, m);
59
59
  }
@@ -61,7 +61,7 @@ var Re, ae, d;
61
61
  this.code = e.Code.Null;
62
62
  }
63
63
  }
64
- e.Null = r;
64
+ e.Null = n;
65
65
  class o extends t {
66
66
  constructor(c, m) {
67
67
  super(e.Code.Div0, e.Label.Div0, c, m);
@@ -209,54 +209,54 @@ var Re, ae, d;
209
209
  })(d || (d = {}));
210
210
  const _ = {};
211
211
  _[d.Code.Parse] = d.Parse, _[d.Code.Null] = d.Null, _[d.Code.Div0] = d.Div0, _[d.Code.Value] = d.Value, _[d.Code.Ref] = d.Ref, _[d.Code.Name] = d.Name, _[d.Code.Num] = d.Num, _[d.Code.NA] = d.NA, _[d.Code.GettingData] = d.GettingData, _[d.Code.Spill] = d.Spill, _[d.Code.Connect] = d.Connect, _[d.Code.Blocked] = d.Blocked, _[d.Code.Unknown] = d.Unknown, _[d.Code.Field] = d.Field, _[d.Code.Calc] = d.Calc, _[d.Code.Busy] = d.Busy, _[d.Code.Python] = d.Python, _[d.Code.Timeout] = d.Timeout;
212
- const et = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map(), ke = Object.keys(_);
212
+ const et = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map(), ke = Object.keys(_);
213
213
  for (let e = 0; e < ke.length; e++) {
214
- const t = ke[e], n = _[t];
215
- tt.set(d.Label[t], n), nt.set(d.Code[t], n);
216
- const r = new n();
217
- et.set(r.getLabel(), r), Te.set(r.getCode(), r);
214
+ const t = ke[e], r = _[t];
215
+ tt.set(d.Label[t], r), rt.set(d.Code[t], r);
216
+ const n = new r();
217
+ et.set(n.getLabel(), n), Te.set(n.getCode(), n);
218
218
  }
219
219
  const Et = Te.get(d.Code.Unknown);
220
220
  var v;
221
- (v = d || (d = {})).BuiltIn = { Parse: new v.Parse(), Null: new v.Null(), Div0: new v.Div0(), Value: new v.Value(), Ref: new v.Ref(), Name: new v.Name(), Num: new v.Num(), NA: new v.NA(), GettingData: new v.GettingData(), Spill: new v.Spill(), Connect: new v.Connect(), Blocked: new v.Blocked(), Unknown: new v.Unknown(), Field: new v.Field(), Calc: new v.Calc(), Busy: new v.Busy(), Python: new v.Python(), Timeout: new v.Timeout() }, v.getBuiltInByLabel = (e) => et.get(e), v.newTypedError = (e, t, n) => {
222
- let r;
223
- return r = typeof e == "string" ? tt.get(e) : nt.get(e), r || (r = v.Unknown), new r(t, n);
221
+ (v = d || (d = {})).BuiltIn = { Parse: new v.Parse(), Null: new v.Null(), Div0: new v.Div0(), Value: new v.Value(), Ref: new v.Ref(), Name: new v.Name(), Num: new v.Num(), NA: new v.NA(), GettingData: new v.GettingData(), Spill: new v.Spill(), Connect: new v.Connect(), Blocked: new v.Blocked(), Unknown: new v.Unknown(), Field: new v.Field(), Calc: new v.Calc(), Busy: new v.Busy(), Python: new v.Python(), Timeout: new v.Timeout() }, v.getBuiltInByLabel = (e) => et.get(e), v.newTypedError = (e, t, r) => {
222
+ let n;
223
+ return n = typeof e == "string" ? tt.get(e) : rt.get(e), n || (n = v.Unknown), new n(t, r);
224
224
  }, v.getBuiltInById = (e) => Te.get(e) || Et;
225
225
  /**
226
- * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.4.13
226
+ * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.4.14
227
227
  *
228
228
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
229
229
  * License: The license can be found at https://www.sheetxl.com/license.
230
230
  */
231
231
  const S = { html: "text/html", plain: "text/plain", png: "image/png" }, St = Object.freeze({ left: 0, top: 0 }), xt = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ct = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
232
232
  Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Ct, EmptyRect: xt, EmptyTopLeft: St }, Symbol.toStringTag, { value: "Module" }));
233
- const j = { Column: "column", Row: "row" }, vt = Object.freeze({ colIndex: 0, rowIndex: 0 }), Tt = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), rt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, ot = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, _t = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Ot = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, Le = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, Ae = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, it = (e = j.Row, t = !1) => t ? e !== j.Column ? _t : Ot : e !== j.Column ? ot : rt, Me = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, Se = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, xe = (e, t) => !(!e || !t) && !(e.colStart > t.colEnd || t.colStart > e.colEnd) && !(e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), je = (e, t) => {
233
+ const j = { Column: "column", Row: "row" }, vt = Object.freeze({ colIndex: 0, rowIndex: 0 }), Tt = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), nt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, ot = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, _t = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Ot = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, Le = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, Ae = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, it = (e = j.Row, t = !1) => t ? e !== j.Column ? _t : Ot : e !== j.Column ? ot : nt, Me = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, Se = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, xe = (e, t) => !(!e || !t) && !(e.colStart > t.colEnd || t.colStart > e.colEnd) && !(e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), je = (e, t) => {
234
234
  if (e === t) return !0;
235
235
  if (!e || !t || e.length !== t.length) return !1;
236
- for (let n = 0; n < e.length; n++) if (!Se(e[n], t[n])) return !1;
236
+ for (let r = 0; r < e.length; r++) if (!Se(e[r], t[r])) return !1;
237
237
  return !0;
238
- }, he = (e, t, n) => {
238
+ }, he = (e, t, r) => {
239
239
  if (!e && !t) return null;
240
- if (!e) return n ? t : { ...t };
241
- if (!t) return n ? e : { ...e };
242
- const r = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), i = Math.max(e.colEnd, t.colEnd), a = Math.max(e.rowEnd, t.rowEnd);
243
- let l = n;
244
- return l ? (l.colStart = r, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: r, rowStart: o, colEnd: i, rowEnd: a }, l;
240
+ if (!e) return r ? t : { ...t };
241
+ if (!t) return r ? e : { ...e };
242
+ const n = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), i = Math.max(e.colEnd, t.colEnd), a = Math.max(e.rowEnd, t.rowEnd);
243
+ let l = r;
244
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: n, rowStart: o, colEnd: i, rowEnd: a }, l;
245
245
  }, Pe = (e, t) => {
246
246
  if (!t || t.length === 0) return e;
247
- const n = { ...e };
248
- for (let r = 0; r < t.length; r++) {
249
- const o = t[r];
250
- xe(n, o) && (n.rowStart = Math.min(n.rowStart, o.rowStart), n.colStart = Math.min(n.colStart, o.colStart), n.rowEnd = Math.max(n.rowEnd, o.rowEnd), n.colEnd = Math.max(n.colEnd, o.colEnd));
247
+ const r = { ...e };
248
+ for (let n = 0; n < t.length; n++) {
249
+ const o = t[n];
250
+ xe(r, o) && (r.rowStart = Math.min(r.rowStart, o.rowStart), r.colStart = Math.min(r.colStart, o.colStart), r.rowEnd = Math.max(r.rowEnd, o.rowEnd), r.colEnd = Math.max(r.colEnd, o.colEnd));
251
251
  }
252
- return n;
253
- }, It = [null, null], Nt = (e, t, n) => {
252
+ return r;
253
+ }, It = [null, null], Nt = (e, t, r) => {
254
254
  if (e[0].value === e[1].value) return t;
255
255
  };
256
- function Fe(e, t = 2, n, r = j.Row, o) {
256
+ function Fe(e, t = 2, r, n = j.Row, o) {
257
257
  let i = [...e];
258
258
  if (t <= 0 || e.length <= 1) return i;
259
- let a = r === j.Column, l = 0, u = !1;
259
+ let a = n === j.Column, l = 0, u = !1;
260
260
  do {
261
261
  const f = i.sort(it(a ? j.Row : j.Column));
262
262
  i = [], i.push(f[0]);
@@ -267,9 +267,9 @@ function Fe(e, t = 2, n, r = j.Row, o) {
267
267
  let J = !1;
268
268
  if (J = a ? p && T === I.rowStart && D === I.rowEnd && A + 1 === I.colStart : p && y === I.colStart && A === I.colEnd && D + 1 === I.rowStart, J) {
269
269
  let E = { colStart: y, rowStart: T, colEnd: a ? I.colEnd : A, rowEnd: a ? D : I.rowEnd };
270
- if (p.value !== void 0 && (E.value = p.value), n) {
270
+ if (p.value !== void 0 && (E.value = p.value), r) {
271
271
  const c = o ?? [null, null];
272
- c[0] = p, c[1] = I, E = n(c, E, r);
272
+ c[0] = p, c[1] = I, E = r(c, E, n);
273
273
  }
274
274
  if (E) {
275
275
  i[g] = E, u = !0, p = E, y = p.colStart, T = p.rowStart, A = p.colEnd, D = p.rowEnd;
@@ -284,11 +284,11 @@ function Fe(e, t = 2, n, r = j.Row, o) {
284
284
  }
285
285
  Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: vt, EmptyRange: Tt, cellToRange: (e, t) => {
286
286
  if (!e) return null;
287
- let n = t;
288
- return n || (n = { ...e }, delete n.colIndex, delete n.rowIndex), n.colStart = e.colIndex ?? 0, n.rowStart = e.rowIndex ?? 0, n.colEnd = e.colIndex ?? 0, n.rowEnd = e.rowIndex ?? 0, n;
289
- }, columnFirstCellComparator: Le, columnFirstRangeComparator: rt, createCellComparator: (e = j.Row, t = !1) => t ? e !== j.Column ? (n, r) => n.rowIndex === r.rowIndex ? r.colIndex - n.colIndex : r.rowIndex - n.rowIndex : (n, r) => n.colIndex === r.colIndex ? r.rowIndex - n.rowIndex : r.colIndex - n.colIndex : e !== j.Column ? Ae : Le, createConflatingRanges: (e, t = !1) => {
290
- const n = [];
291
- let r, o, i = Number.MIN_SAFE_INTEGER, a = Number.MIN_SAFE_INTEGER;
287
+ let r = t;
288
+ return r || (r = { ...e }, delete r.colIndex, delete r.rowIndex), r.colStart = e.colIndex ?? 0, r.rowStart = e.rowIndex ?? 0, r.colEnd = e.colIndex ?? 0, r.rowEnd = e.rowIndex ?? 0, r;
289
+ }, columnFirstCellComparator: Le, columnFirstRangeComparator: nt, createCellComparator: (e = j.Row, t = !1) => t ? e !== j.Column ? (r, n) => r.rowIndex === n.rowIndex ? n.colIndex - r.colIndex : n.rowIndex - r.rowIndex : (r, n) => r.colIndex === n.colIndex ? n.rowIndex - r.rowIndex : n.colIndex - r.colIndex : e !== j.Column ? Ae : Le, createConflatingRanges: (e, t = !1) => {
290
+ const r = [];
291
+ let n, o, i = Number.MIN_SAFE_INTEGER, a = Number.MIN_SAFE_INTEGER;
292
292
  return { append: (l, u, f) => {
293
293
  let h = !0;
294
294
  const g = f !== void 0;
@@ -296,38 +296,38 @@ Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: vt, EmptyRange
296
296
  const T = e ? e(o, f, t) : o === f ? f : void 0;
297
297
  T === void 0 ? h = !1 : f = T;
298
298
  }
299
- if (h && u === a + 1 && l === i) return t ? r.rowEnd = u : r.colEnd = u, a = u, void (o = f);
300
- r && n.push(r);
299
+ if (h && u === a + 1 && l === i) return t ? n.rowEnd = u : n.colEnd = u, a = u, void (o = f);
300
+ n && r.push(n);
301
301
  const p = t ? l : u, y = t ? u : l;
302
- r = { colStart: p, rowStart: y, colEnd: p, rowEnd: y }, g && (r.value = f), i = l, a = u, o = f;
303
- }, done: (l) => (r && (n.push(r), r = null), l ? Fe(n, 3, l === !0 ? Nt : l, t ? j.Column : j.Row, It) : n) };
304
- }, createRangeComparator: it, defaultRange: (e, t, n) => e ? n ? (n.colStart = e.colStart ?? t.colStart, n.rowStart = e.rowStart ?? t.rowStart, n.colEnd = e.colEnd ?? t.colEnd, n.rowEnd = e.rowEnd ?? t.rowEnd, n) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Pe, extendRangeToUnionRanges: (e, t) => {
302
+ n = { colStart: p, rowStart: y, colEnd: p, rowEnd: y }, g && (n.value = f), i = l, a = u, o = f;
303
+ }, done: (l) => (n && (r.push(n), n = null), l ? Fe(r, 3, l === !0 ? Nt : l, t ? j.Column : j.Row, It) : r) };
304
+ }, createRangeComparator: it, defaultRange: (e, t, r) => e ? r ? (r.colStart = e.colStart ?? t.colStart, r.rowStart = e.rowStart ?? t.rowStart, r.colEnd = e.colEnd ?? t.colEnd, r.rowEnd = e.rowEnd ?? t.rowEnd, r) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Pe, extendRangeToUnionRanges: (e, t) => {
305
305
  if (!t || t.length === 0) return e;
306
- let n = e, r = null;
307
- for (; !Se(n, r); ) r = n, n = Pe(r, t);
308
- return n;
306
+ let r = e, n = null;
307
+ for (; !Se(r, n); ) n = r, r = Pe(n, t);
308
+ return r;
309
309
  }, indexOfCoords: (e, t) => {
310
- const n = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
311
- for (let r = t.length - 1; r >= 0; r--) if (xe(n, t[r])) return r;
310
+ const r = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
311
+ for (let n = t.length - 1; n >= 0; n--) if (xe(r, t[n])) return n;
312
312
  return -1;
313
- }, intersectRanges: (e, t, n) => {
314
- if (!e) return n ? t : { ...t };
315
- if (!t) return n ? e : { ...e };
313
+ }, intersectRanges: (e, t, r) => {
314
+ if (!e) return r ? t : { ...t };
315
+ if (!t) return r ? e : { ...e };
316
316
  if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
317
- const r = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), i = Math.min(e.colEnd, t.colEnd), a = Math.min(e.rowEnd, t.rowEnd);
318
- let l = n;
319
- return l ? (l.colStart = r, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: r, rowStart: o, colEnd: i, rowEnd: a }, l;
320
- }, isCellWithinRange: (e, t) => !(!e || !t) && !(e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd) && !(e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Me, isEqualRanges: Se, isEqualRangesArrays: je, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Me(e.cell, t.cell) && je(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd) && !(e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: xe, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !!e && !(typeof e.colStart != "number" || e.colStart < 0) && !(typeof e.colEnd != "number" || e.colEnd < e.colStart) && !(typeof e.rowStart != "number" || e.rowStart < 0) && !(typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: Fe, rowFirstCellComparator: Ae, rowFirstRangeComparator: ot, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, n = -e.colStart, r) => r ? (r.colStart = e.colStart + n, r.rowStart = e.rowStart + t, r.colEnd = e.colEnd + n, r.rowEnd = e.rowEnd + t, r) : { colStart: e.colStart + n, rowStart: e.rowStart + t, colEnd: e.colEnd + n, rowEnd: e.rowEnd + t }, unionRanges: he, unionRangesArrays: (e, t, n) => {
317
+ const n = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), i = Math.min(e.colEnd, t.colEnd), a = Math.min(e.rowEnd, t.rowEnd);
318
+ let l = r;
319
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: n, rowStart: o, colEnd: i, rowEnd: a }, l;
320
+ }, isCellWithinRange: (e, t) => !(!e || !t) && !(e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd) && !(e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Me, isEqualRanges: Se, isEqualRangesArrays: je, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Me(e.cell, t.cell) && je(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd) && !(e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: xe, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !!e && !(typeof e.colStart != "number" || e.colStart < 0) && !(typeof e.colEnd != "number" || e.colEnd < e.colStart) && !(typeof e.rowStart != "number" || e.rowStart < 0) && !(typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: Fe, rowFirstCellComparator: Ae, rowFirstRangeComparator: ot, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, r = -e.colStart, n) => n ? (n.colStart = e.colStart + r, n.rowStart = e.rowStart + t, n.colEnd = e.colEnd + r, n.rowEnd = e.rowEnd + t, n) : { colStart: e.colStart + r, rowStart: e.rowStart + t, colEnd: e.colEnd + r, rowEnd: e.rowEnd + t }, unionRanges: he, unionRangesArrays: (e, t, r) => {
321
321
  if (!e || e.length === 0) return null;
322
322
  if (e.length === 1 && !t) return e[0];
323
- let r = e[0];
324
- for (let o = 1; o < e.length; o++) r = he(r, e[o], n);
325
- return t && (r = he(r, t, n)), r;
323
+ let n = e[0];
324
+ for (let o = 1; o < e.length; o++) n = he(n, e[o], r);
325
+ return t && (n = he(n, t, r)), n;
326
326
  } }, Symbol.toStringTag, { value: "Module" }));
327
327
  function Rt(e) {
328
328
  const t = Object.prototype.toString.call(e);
329
- return t === "[object RegExp]" || t === "[object Date]" || function(n) {
330
- return n.$$typeof === kt;
329
+ return t === "[object RegExp]" || t === "[object Date]" || function(r) {
330
+ return r.$$typeof === kt;
331
331
  }(e);
332
332
  }
333
333
  const kt = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
@@ -336,19 +336,19 @@ function Lt(e) {
336
336
  return !!t && typeof t == "object";
337
337
  }(e) && !Rt(e);
338
338
  }
339
- function re(e, t) {
340
- return t.clone !== !1 && t.isMergeableObject(e) ? Y((n = e, Array.isArray(n) ? [] : {}), e, t) : e;
341
- var n;
339
+ function ne(e, t) {
340
+ return t.clone !== !1 && t.isMergeableObject(e) ? Y((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
341
+ var r;
342
342
  }
343
- function At(e, t, n) {
344
- return e.concat(t).map(function(r) {
345
- return re(r, n);
343
+ function At(e, t, r) {
344
+ return e.concat(t).map(function(n) {
345
+ return ne(n, r);
346
346
  });
347
347
  }
348
348
  function De(e) {
349
349
  return Object.keys(e).concat(function(t) {
350
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(n) {
351
- return Object.propertyIsEnumerable.call(t, n);
350
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(r) {
351
+ return Object.propertyIsEnumerable.call(t, r);
352
352
  }) : [];
353
353
  }(e));
354
354
  }
@@ -359,45 +359,45 @@ function Ue(e, t) {
359
359
  return !1;
360
360
  }
361
361
  }
362
- function Mt(e, t, n) {
363
- const r = {};
364
- return n.isMergeableObject(e) && De(e).forEach(function(o) {
365
- r[o] = re(e[o], n);
362
+ function Mt(e, t, r) {
363
+ const n = {};
364
+ return r.isMergeableObject(e) && De(e).forEach(function(o) {
365
+ n[o] = ne(e[o], r);
366
366
  }), De(t).forEach(function(o) {
367
367
  (function(i, a) {
368
368
  return Ue(i, a) && !(Object.hasOwnProperty.call(i, a) && Object.propertyIsEnumerable.call(i, a));
369
- })(e, o) || (Ue(e, o) && n.isMergeableObject(t[o]) ? r[o] = function(i, a) {
369
+ })(e, o) || (Ue(e, o) && r.isMergeableObject(t[o]) ? n[o] = function(i, a) {
370
370
  if (!a.customMerge) return Y;
371
371
  const l = a.customMerge(i);
372
372
  return typeof l == "function" ? l : Y;
373
- }(o, n)(e[o], t[o], n) : r[o] = re(t[o], n));
374
- }), r;
373
+ }(o, r)(e[o], t[o], r) : n[o] = ne(t[o], r));
374
+ }), n;
375
375
  }
376
- function Y(e, t, n) {
377
- (n = n || {}).arrayMerge = n.arrayMerge || At, n.isMergeableObject = n.isMergeableObject || Lt, n.cloneUnlessOtherwiseSpecified = re;
378
- const r = Array.isArray(t);
379
- return r === Array.isArray(e) ? r ? n.arrayMerge(e, t, n) : Mt(e, t, n) : re(t, n);
376
+ function Y(e, t, r) {
377
+ (r = r || {}).arrayMerge = r.arrayMerge || At, r.isMergeableObject = r.isMergeableObject || Lt, r.cloneUnlessOtherwiseSpecified = ne;
378
+ const n = Array.isArray(t);
379
+ return n === Array.isArray(e) ? n ? r.arrayMerge(e, t, r) : Mt(e, t, r) : ne(t, r);
380
380
  }
381
381
  Y.all = function(e, t) {
382
382
  if (!Array.isArray(e)) throw new Error("first argument should be an array");
383
- return e.reduce(function(n, r) {
384
- return Y(n, r, t);
383
+ return e.reduce(function(r, n) {
384
+ return Y(r, n, t);
385
385
  }, {});
386
386
  };
387
387
  const jt = Object.freeze([]), Pt = Object.freeze({}), Be = (e) => e, de = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
388
388
  let t = 16 * Math.random() | 0;
389
389
  return (e === "x" ? t : 3 & t | 8).toString(16);
390
- }), Ft = (e) => 1 * e, at = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((n, r) => n === t[r]), ne = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, lt = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
390
+ }), Ft = (e) => 1 * e, at = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((r, n) => r === t[n]), re = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, lt = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
391
391
  e[t] && typeof e[t] == "object" ? lt(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
392
- }), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !at(e, t)) || !!e.isEqual?.(t), st = (e, t, n = Dt) => {
392
+ }), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !at(e, t)) || !!e.isEqual?.(t), st = (e, t, r = Dt) => {
393
393
  if (e == null || e === t) return null;
394
- if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return n(e, t) ? null : e;
395
- const r = Object.keys(e);
396
- if (r.length === 0) return null;
394
+ if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return r(e, t) ? null : e;
395
+ const n = Object.keys(e);
396
+ if (n.length === 0) return null;
397
397
  let o = !1;
398
- for (let i = 0; i < r.length; i++) {
399
- const a = r[i];
400
- st(e[a], t?.[a], n) === null && (o = !0, delete e[a]);
398
+ for (let i = 0; i < n.length; i++) {
399
+ const a = n[i];
400
+ st(e[a], t?.[a], r) === null && (o = !0, delete e[a]);
401
401
  }
402
402
  return o && Object.keys(e).length === 0 ? null : void 0;
403
403
  }, $e = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), ze = (e) => e == null, Ke = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), Ve = !(typeof window > "u" || !window.document || !window.document.createElement), k = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, oe = () => {
@@ -408,9 +408,9 @@ const jt = Object.freeze([]), Pt = Object.freeze({}), Be = (e) => e, de = () =>
408
408
  function ct() {
409
409
  return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
410
410
  }
411
- const qe = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: jt, EmptyObject: Pt, OSType: k, arrayMove: function(e, t, n) {
412
- const r = e.slice();
413
- return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
411
+ const qe = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: jt, EmptyObject: Pt, OSType: k, arrayMove: function(e, t, r) {
412
+ const n = e.slice();
413
+ return n.splice(r < 0 ? n.length + r : r, 0, n.splice(t, 1)[0]), n;
414
414
  }, asNumber: (e) => {
415
415
  const t = Ft(e);
416
416
  return Number.isFinite(t) ? t : 0;
@@ -422,267 +422,267 @@ const qe = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeEl
422
422
  setTimeout(() => {
423
423
  Function("console.log.apply(console, arguments)").apply(null, e), t();
424
424
  });
425
- }), debounce: function(e, t = 300, n = !1) {
426
- let r, o, i, a, l = 0;
425
+ }), debounce: function(e, t = 300, r = !1) {
426
+ let n, o, i, a, l = 0;
427
427
  function u() {
428
428
  let h = Date.now() - l;
429
- h < t && h >= 0 ? r = setTimeout(u, t - h) : (r = null, n || (a = e.apply(i, o), i = o = null));
429
+ h < t && h >= 0 ? n = setTimeout(u, t - h) : (n = null, r || (a = e.apply(i, o), i = o = null));
430
430
  }
431
431
  t == null && (t = 100);
432
432
  const f = function() {
433
433
  i = globalThis, o = arguments, l = Date.now();
434
- var h = n && !r;
435
- return r || (r = setTimeout(u, t)), h && (a = e.apply(i, o), i = o = null), a;
434
+ var h = r && !n;
435
+ return n || (n = setTimeout(u, t)), h && (a = e.apply(i, o), i = o = null), a;
436
436
  };
437
437
  return f.clear = function() {
438
- r && (clearTimeout(r), r = null);
438
+ n && (clearTimeout(n), n = null);
439
439
  }, f.flush = function() {
440
- r && (a = e.apply(i, o), i = o = null, clearTimeout(r), r = null);
440
+ n && (a = e.apply(i, o), i = o = null, clearTimeout(n), n = null);
441
441
  }, f;
442
- }, deepEqual: function e(t, n) {
443
- if (t === n) return !0;
444
- if (t && n && typeof t == "object" && typeof n == "object") {
445
- if (t.constructor !== n.constructor) return !1;
446
- let r, o, i;
442
+ }, deepEqual: function e(t, r) {
443
+ if (t === r) return !0;
444
+ if (t && r && typeof t == "object" && typeof r == "object") {
445
+ if (t.constructor !== r.constructor) return !1;
446
+ let n, o, i;
447
447
  if (Array.isArray(t)) {
448
- if (r = t.length, r != n.length) return !1;
449
- for (o = r; o-- !== 0; ) if (!e(t[o], n[o])) return !1;
448
+ if (n = t.length, n != r.length) return !1;
449
+ for (o = n; o-- !== 0; ) if (!e(t[o], r[o])) return !1;
450
450
  return !0;
451
451
  }
452
- if (t instanceof Map && n instanceof Map) {
453
- if (t.size !== n.size) return !1;
454
- for (o of t.entries()) if (!n.has(o[0])) return !1;
455
- for (o of t.entries()) if (!e(o[1], n.get(o[0]))) return !1;
452
+ if (t instanceof Map && r instanceof Map) {
453
+ if (t.size !== r.size) return !1;
454
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
455
+ for (o of t.entries()) if (!e(o[1], r.get(o[0]))) return !1;
456
456
  return !0;
457
457
  }
458
- if (t instanceof Set && n instanceof Set) {
459
- if (t.size !== n.size) return !1;
460
- for (o of t.entries()) if (!n.has(o[0])) return !1;
458
+ if (t instanceof Set && r instanceof Set) {
459
+ if (t.size !== r.size) return !1;
460
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
461
461
  return !0;
462
462
  }
463
- if (ArrayBuffer.isView(t) && ArrayBuffer.isView(n)) {
464
- if (r = t.length, r != n.length) return !1;
465
- for (o = r; o-- !== 0; ) if (t[o] !== n[o]) return !1;
463
+ if (ArrayBuffer.isView(t) && ArrayBuffer.isView(r)) {
464
+ if (n = t.length, n != r.length) return !1;
465
+ for (o = n; o-- !== 0; ) if (t[o] !== r[o]) return !1;
466
466
  return !0;
467
467
  }
468
- if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
469
- if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
470
- if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
471
- if (i = Object.keys(t), r = i.length, r !== Object.keys(n).length) return !1;
472
- for (o = r; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(n, i[o])) return !1;
473
- for (o = r; o-- !== 0; ) {
468
+ if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
469
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
470
+ if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
471
+ if (i = Object.keys(t), n = i.length, n !== Object.keys(r).length) return !1;
472
+ for (o = n; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, i[o])) return !1;
473
+ for (o = n; o-- !== 0; ) {
474
474
  let a = i[o];
475
- if ((a !== "_owner" || !t.$$typeof) && !e(t[a], n[a])) return !1;
475
+ if ((a !== "_owner" || !t.$$typeof) && !e(t[a], r[a])) return !1;
476
476
  }
477
477
  return !0;
478
478
  }
479
- return t != t && n != n;
479
+ return t != t && r != r;
480
480
  }, deepFreeze: function e(t) {
481
- return Object.freeze(t), Object.keys(t).forEach((n) => {
482
- typeof t[n] != "object" || t[n] === null || Object.isFrozen(t[n]) || e(t[n]);
481
+ return Object.freeze(t), Object.keys(t).forEach((r) => {
482
+ typeof t[r] != "object" || t[r] === null || Object.isFrozen(t[r]) || e(t[r]);
483
483
  }), t;
484
484
  }, deepMerge: Y, diffValues: (e, t) => {
485
- const n = {}, r = Object.keys(t), o = r.length;
485
+ const r = {}, n = Object.keys(t), o = n.length;
486
486
  for (let i = 0; i < o; i++) {
487
- const a = r[i];
488
- e[a] !== t[a] && (e[a] === void 0 ? n[a] = t[a] : n[a] = e[a]);
489
- }
490
- return Object.keys(n).length === 0 ? null : n;
491
- }, findEqualOrGreater: function(e, t, n = Be) {
492
- let r = 0, o = e.length - 1;
493
- for (; r <= o; ) {
494
- let i = Math.floor((r + o) / 2), a = n(e[i]);
487
+ const a = n[i];
488
+ e[a] !== t[a] && (e[a] === void 0 ? r[a] = t[a] : r[a] = e[a]);
489
+ }
490
+ return Object.keys(r).length === 0 ? null : r;
491
+ }, findEqualOrGreater: function(e, t, r = Be) {
492
+ let n = 0, o = e.length - 1;
493
+ for (; n <= o; ) {
494
+ let i = Math.floor((n + o) / 2), a = r(e[i]);
495
495
  if (a === t) return i;
496
- a < t ? r = i + 1 : o = i - 1;
496
+ a < t ? n = i + 1 : o = i - 1;
497
497
  }
498
- return r;
499
- }, findEqualOrLesser: function(e, t, n = Be) {
500
- let r = e.length - 1, o = 0;
501
- for (; r >= o; ) {
502
- let i = Math.floor((r + o) / 2), a = n(e[i]);
498
+ return n;
499
+ }, findEqualOrLesser: function(e, t, r = Be) {
500
+ let n = e.length - 1, o = 0;
501
+ for (; n >= o; ) {
502
+ let i = Math.floor((n + o) / 2), a = r(e[i]);
503
503
  if (a === t) return i;
504
- a > t ? r = i - 1 : o = i + 1;
504
+ a > t ? n = i - 1 : o = i + 1;
505
505
  }
506
- return r;
507
- }, findNextStep: (e, t = !0, n = 15, r = 10, o = 400) => {
508
- const i = Math.max(e - r, 0) + (t ? 1 : -1);
509
- return Math.min(o, Math[t ? "ceil" : "floor"](i / n) * n + r);
506
+ return n;
507
+ }, findNextStep: (e, t = !0, r = 15, n = 10, o = 400) => {
508
+ const i = Math.max(e - n, 0) + (t ? 1 : -1);
509
+ return Math.min(o, Math[t ? "ceil" : "floor"](i / r) * r + n);
510
510
  }, getDPI: () => {
511
511
  let e = 1;
512
512
  return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
513
513
  }, getFromPath: (e, t) => {
514
- const n = t.split(".");
515
- let r = e;
516
- for (let o = 0; o < n.length; o++) {
517
- const i = n[o];
518
- if (!r) return null;
519
- let a = r[i];
520
- if (typeof a == "function" && (a = a.bind(r)()), !a || !ne(a)) return a;
521
- r = a;
522
- }
523
- return r ?? null;
514
+ const r = t.split(".");
515
+ let n = e;
516
+ for (let o = 0; o < r.length; o++) {
517
+ const i = r[o];
518
+ if (!n) return null;
519
+ let a = n[i];
520
+ if (typeof a == "function" && (a = a.bind(n)()), !a || !re(a)) return a;
521
+ n = a;
522
+ }
523
+ return n ?? null;
524
524
  }, getOS: oe, hasFocus: qe, isDefined: (e) => e != null, isEmpty: (e) => e == null || e === "", isEqualArrays: at, isEqualBounds: (e, t) => e === t || !(e && !t || t && !e) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEqualObjectKeys: (e, t) => {
525
525
  if (e === t) return !0;
526
526
  if (e && !t || t && !e) return !1;
527
- const n = Object.keys(e);
528
- if (n.length !== Object.keys(t).length) return !1;
529
- for (let r = 0; r < n.length; r++) if (e[n[r]] !== t[n[r]]) return !1;
527
+ const r = Object.keys(e);
528
+ if (r.length !== Object.keys(t).length) return !1;
529
+ for (let n = 0; n < r.length; n++) if (e[r[n]] !== t[r[n]]) return !1;
530
530
  return !0;
531
531
  }, isNode: ct, isNullOrUndefined: ze, isNumeric: (e) => {
532
532
  const t = 1 * e;
533
533
  return Number.isFinite(t) && typeof t == "number";
534
- }, isObject: ne, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: Ke, mergeContentful: (...e) => {
534
+ }, isObject: re, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: Ke, mergeContentful: (...e) => {
535
535
  const t = e.length;
536
- if (t > 0 && e[t - 1] !== void 0 && !ne(e[t - 1])) return e[t - 1];
537
- let n = e[0] || {};
538
- for (let r = 1; r < t; r++) n = Y(n, e[r] || {}, { arrayMerge: (o, i) => [...i] });
539
- return n;
536
+ if (t > 0 && e[t - 1] !== void 0 && !re(e[t - 1])) return e[t - 1];
537
+ let r = e[0] || {};
538
+ for (let n = 1; n < t; n++) r = Y(r, e[n] || {}, { arrayMerge: (o, i) => [...i] });
539
+ return r;
540
540
  }, nextTick: (e) => {
541
541
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
542
542
  e();
543
543
  }) : (typeof setImmediate == "function" ? setImmediate : setTimeout)(() => {
544
544
  e();
545
545
  });
546
- }, openFileDialog: (e = "*.*") => new Promise((t, n) => {
547
- if (!Ve) return void n("Unable to open dialog with no dom.");
548
- const r = document.createElement("input");
549
- r.type = "file", r.accept = e;
546
+ }, openFileDialog: (e = "*.*") => new Promise((t, r) => {
547
+ if (!Ve) return void r("Unable to open dialog with no dom.");
548
+ const n = document.createElement("input");
549
+ n.type = "file", n.accept = e;
550
550
  let o = null, i = !1;
551
551
  globalThis.addEventListener?.("focus", () => {
552
552
  setTimeout(() => {
553
553
  o || i || (i = !0, t(null));
554
554
  }, 1e3);
555
- }, { once: !0, passive: !0 }), r.onchange = () => {
556
- if (o = r.files[0], o) {
555
+ }, { once: !0, passive: !0 }), n.onchange = () => {
556
+ if (o = n.files[0], o) {
557
557
  if (i) return void console.warn("File open detected after faux cancel.", o);
558
558
  t(o);
559
559
  }
560
- }, r.autofocus = !0, r.click();
560
+ }, n.autofocus = !0, n.click();
561
561
  }), rafThrottle: (e) => {
562
- let t, n = !1, r = function() {
563
- n = !1, e(t);
562
+ let t, r = !1, n = function() {
563
+ r = !1, e(t);
564
564
  };
565
565
  return function(o) {
566
- t = o, t && t.persist && t.persist(), n || (n = !0, requestAnimationFrame(r));
566
+ t = o, t && t.persist && t.persist(), r || (r = !0, requestAnimationFrame(n));
567
567
  };
568
568
  }, removeEmptyProperties: lt, removeEqualValues: st, removeListenerAll: (e) => {
569
569
  if (!e) return [];
570
570
  for (let t = 0; t < e.length; t++) e[t] && e[t]();
571
571
  return [];
572
572
  }, requestTimeout: (e, t) => {
573
- const n = $e(), r = { id: requestAnimationFrame(function o() {
574
- $e() - n >= t ? e.call(null) : r.id = requestAnimationFrame(o);
573
+ const r = $e(), n = { id: requestAnimationFrame(function o() {
574
+ $e() - r >= t ? e.call(null) : n.id = requestAnimationFrame(o);
575
575
  }) };
576
- return r;
576
+ return n;
577
577
  }, roundAccurately: (e, t = 0) => {
578
578
  if (e == null || !isFinite(e)) return null;
579
- const n = 10 ** t;
580
- return Number(Math.round(e * n) / n);
581
- }, setToPath: (e, t, n) => {
582
- const r = t.split(".");
579
+ const r = 10 ** t;
580
+ return Number(Math.round(e * r) / r);
581
+ }, setToPath: (e, t, r) => {
582
+ const n = t.split(".");
583
583
  let o = e;
584
584
  if (!o) throw new Error("Can not set path to a null path.");
585
- for (let i = 0; o && i < r.length - 1; i++) {
586
- const a = r[i];
585
+ for (let i = 0; o && i < n.length - 1; i++) {
586
+ const a = n[i];
587
587
  let l = o[a];
588
- if (l == null && (l = {}, o[a] = l), !ne(l)) throw new Error("Can not set path to a non object path.");
588
+ if (l == null && (l = {}, o[a] = l), !re(l)) throw new Error("Can not set path to a non object path.");
589
589
  o = l;
590
590
  }
591
- if (typeof n != "number" && typeof n != "boolean" && typeof n != "string" && !ne(n)) throw new Error(\`Can not set path to \${n} that is not a a supported primitive.\`);
592
- return o[r[r.length - 1]] = n, e;
591
+ if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !re(r)) throw new Error(\`Can not set path to \${r} that is not a a supported primitive.\`);
592
+ return o[n[n.length - 1]] = r, e;
593
593
  }, splitNumber: (e) => {
594
594
  let t = Math.abs(e);
595
595
  if (isNaN(t) || !isFinite(e)) return null;
596
- let n = 0 | t, r = t - n, o = 0, i = 0, a = 1;
597
- if (r > 5e-8) for (; i < 8 && Math.abs(o / a - r) > 5e-8; ) i++, a *= 10, o = Math.round(r * a);
598
- return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(n + 1)), fpLength: i };
599
- }, subtractRect: (e, t, n = !1) => {
596
+ let r = 0 | t, n = t - r, o = 0, i = 0, a = 1;
597
+ if (n > 5e-8) for (; i < 8 && Math.abs(o / a - n) > 5e-8; ) i++, a *= 10, o = Math.round(n * a);
598
+ return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(r + 1)), fpLength: i };
599
+ }, subtractRect: (e, t, r = !1) => {
600
600
  if (!t) return [e];
601
601
  if (!Ke(e, t)) return [];
602
- const r = [];
602
+ const n = [];
603
603
  let o = e;
604
604
  const i = () => {
605
- t.top > o.top && t.top < o.bottom && (r.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
605
+ t.top > o.top && t.top < o.bottom && (n.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
606
606
  }, a = () => {
607
- t.bottom > o.top && t.bottom < o.bottom && (r.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
607
+ t.bottom > o.top && t.bottom < o.bottom && (n.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
608
608
  }, l = () => {
609
- t.right > o.left && t.right < o.right && (r.push({ ...o, left: t.right }), o = { ...o, right: t.right });
609
+ t.right > o.left && t.right < o.right && (n.push({ ...o, left: t.right }), o = { ...o, right: t.right });
610
610
  }, u = () => {
611
- t.left > o.left && t.left < o.right && (r.push({ ...o, right: t.left }), o = { ...o, left: t.left });
611
+ t.left > o.left && t.left < o.right && (n.push({ ...o, right: t.left }), o = { ...o, left: t.left });
612
612
  };
613
- return n ? (u(), l(), i(), a()) : (i(), a(), l(), u()), r;
613
+ return r ? (u(), l(), i(), a()) : (i(), a(), l(), u()), n;
614
614
  }, textToKey: (e) => e.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(), throttle: function(e, t) {
615
- let n = null;
616
- return (...r) => {
615
+ let r = null;
616
+ return (...n) => {
617
617
  const o = Date.now();
618
- (!n || o - n >= t) && (n = o, e(...r));
618
+ (!r || o - r >= t) && (r = o, e(...n));
619
619
  };
620
620
  }, toSafeJSON: function e(t) {
621
621
  if (t === null || typeof t != "object") return t;
622
622
  if (typeof t.toJSON == "function") return t.toJSON();
623
- if (Array.isArray(t)) return t.map((r) => e(r));
623
+ if (Array.isArray(t)) return t.map((n) => e(n));
624
624
  if (typeof t.toString == "function" && t.toString !== Object.prototype.toString) return t.toString();
625
- const n = {};
626
- for (const r in t) t.hasOwnProperty(r) && (n[r] = e(t[r]));
627
- return n;
625
+ const r = {};
626
+ for (const n in t) t.hasOwnProperty(n) && (r[n] = e(t[n]));
627
+ return r;
628
628
  }, transpose: (e) => {
629
629
  if (!e) return e;
630
- const t = e.length, n = e[0].length, r = [];
631
- for (let o = 0; o < n; o++) r[o] = Array(t);
632
- for (let o = 0; o < t; o++) for (let i = 0; i < n; i++) r[i][o] = e[o][i];
633
- return r;
630
+ const t = e.length, r = e[0].length, n = [];
631
+ for (let o = 0; o < r; o++) n[o] = Array(t);
632
+ for (let o = 0; o < t; o++) for (let i = 0; i < r; i++) n[i][o] = e[o][i];
633
+ return n;
634
634
  }, uuidV4: de, validEnumValue: (e, t) => {
635
635
  if (!Object.values(e).includes(t)) throw new Error(\`Invalid type: \${t ?? "null"}. Must be one of: \${Object.values(t).join(", ")}.\`);
636
- }, whenFocus: async (e, t = !1) => new Promise((n) => {
637
- qe(e, t) ? n(!0) : e.addEventListener("focusin", () => {
638
- n(!0);
636
+ }, whenFocus: async (e, t = !1) => new Promise((r) => {
637
+ qe(e, t) ? r(!0) : e.addEventListener("focusin", () => {
638
+ r(!0);
639
639
  }, { once: !0 }), e.focus();
640
640
  }) }, Symbol.toStringTag, { value: "Module" }));
641
641
  Object.freeze(Object.defineProperty({ __proto__: null, MESSAGE_ERROR_INVALID_ARG: (e) => \`Invalid argument: '\${e}'.\` }, Symbol.toStringTag, { value: "Module" }));
642
642
  const ut = (e) => {
643
- const t = new Uint8Array(e), n = t.byteLength;
644
- let r = "";
645
- for (let o = 0; o < n; o++) r += String.fromCharCode(t[o]);
646
- if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(r);
647
- if (typeof Buffer < "u") return Buffer.from(r, "binary").toString("base64");
643
+ const t = new Uint8Array(e), r = t.byteLength;
644
+ let n = "";
645
+ for (let o = 0; o < r; o++) n += String.fromCharCode(t[o]);
646
+ if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(n);
647
+ if (typeof Buffer < "u") return Buffer.from(n, "binary").toString("base64");
648
648
  throw new Error("Unsupported environment");
649
- }, Ce = (e) => new Promise((t, n) => {
649
+ }, Ce = (e) => new Promise((t, r) => {
650
650
  if (e) if (typeof FileReader < "u") {
651
- const r = new FileReader();
652
- r.onload = () => {
653
- t(r.result);
654
- }, r.onerror = () => {
655
- n(r.error);
656
- }, r.readAsText(e);
651
+ const n = new FileReader();
652
+ n.onload = () => {
653
+ t(n.result);
654
+ }, n.onerror = () => {
655
+ r(n.error);
656
+ }, n.readAsText(e);
657
657
  } else if (typeof Buffer < "u") {
658
- const r = (o) => Buffer.from(o).toString("utf-8");
658
+ const n = (o) => Buffer.from(o).toString("utf-8");
659
659
  e.arrayBuffer().then((o) => {
660
- t(r(o));
660
+ t(n(o));
661
661
  }).catch((o) => {
662
- n(o);
662
+ r(o);
663
663
  });
664
- } else n(new Error("Unsupported environment"));
664
+ } else r(new Error("Unsupported environment"));
665
665
  else t("");
666
666
  });
667
667
  Object.freeze(Object.defineProperty({ __proto__: null, DEFAULT_MIME_TYPE: "*/*", arrayBufferToBase64: ut, base64ToArrayBuffer: (e) => {
668
- const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), n = t.length, r = new Uint8Array(n);
669
- for (let o = 0; o < n; o++) r[o] = t.charCodeAt(o);
670
- return r.buffer;
668
+ const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), r = t.length, n = new Uint8Array(r);
669
+ for (let o = 0; o < r; o++) n[o] = t.charCodeAt(o);
670
+ return n.buffer;
671
671
  }, blobToString: Ce }, Symbol.toStringTag, { value: "Module" }));
672
- const dt = "data:image/png;base64,", ft = "Unable to resolve image.", Ge = (e) => new Promise(async (t, n) => {
673
- let r = null;
672
+ const dt = "data:image/png;base64,", ft = "Unable to resolve image.", Ge = (e) => new Promise(async (t, r) => {
673
+ let n = null;
674
674
  try {
675
- r = new Image(), r.src = e, r.addEventListener("load", function() {
676
- t({ width: r.naturalWidth, height: r.naturalHeight });
677
- }, { once: !0 }), r.addEventListener("error", function() {
678
- URL.revokeObjectURL(e), n("Invalid Image");
679
- }, { once: !0 }), await r.decode("sync");
675
+ n = new Image(), n.src = e, n.addEventListener("load", function() {
676
+ t({ width: n.naturalWidth, height: n.naturalHeight });
677
+ }, { once: !0 }), n.addEventListener("error", function() {
678
+ URL.revokeObjectURL(e), r("Invalid Image");
679
+ }, { once: !0 }), await n.decode("sync");
680
680
  } catch {
681
- r?.src && URL.revokeObjectURL(r.src);
681
+ n?.src && URL.revokeObjectURL(n.src);
682
682
  }
683
- r || n(ft);
683
+ n || r(ft);
684
684
  }), we = "image/svg+xml";
685
- Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: dt, getImageDataUrl: (e, t = 1) => new Promise(async (n, r) => {
685
+ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: dt, getImageDataUrl: (e, t = 1) => new Promise(async (r, n) => {
686
686
  let o = null;
687
687
  try {
688
688
  o = new Image(), o.src = e, o.addEventListener("load", function() {
@@ -690,42 +690,42 @@ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: dt,
690
690
  const i = document.createElement("canvas");
691
691
  i.width = o.naturalWidth, i.height = o.naturalHeight, i.getContext("2d").drawImage(o, 0, 0);
692
692
  const a = i.toDataURL("image/png", t);
693
- n({ elemImg: o, dataUrl: a });
693
+ r({ elemImg: o, dataUrl: a });
694
694
  } catch (i) {
695
- URL.revokeObjectURL(e), r(i);
695
+ URL.revokeObjectURL(e), n(i);
696
696
  }
697
697
  }, { once: !0 }), o.addEventListener("error", function() {
698
- URL.revokeObjectURL(e), r("Invalid Image");
698
+ URL.revokeObjectURL(e), n("Invalid Image");
699
699
  }, { once: !0 }), await o.decode("sync");
700
700
  } catch {
701
701
  o?.src && URL.revokeObjectURL(o.src);
702
702
  }
703
- o || r(ft);
703
+ o || n(ft);
704
704
  }), loadImageDetails: async (e, t = null) => {
705
- let n = null;
706
- const r = async () => {
705
+ let r = null;
706
+ const n = async () => {
707
707
  try {
708
708
  const i = t ?? "image/*", a = URL.createObjectURL(new Blob([e], { type: i })), l = await Ge(a);
709
- n = { mimeType: i, naturalDimensions: l, asUrl: a };
709
+ r = { mimeType: i, naturalDimensions: l, asUrl: a };
710
710
  } catch {
711
711
  }
712
712
  }, o = async () => {
713
713
  try {
714
714
  const i = new TextDecoder().decode(e), a = URL.createObjectURL(new Blob([i], { type: we })), l = await Ge(a);
715
- n = { mimeType: t ?? we, naturalDimensions: l, asUrl: a, asSVGText: i };
715
+ r = { mimeType: t ?? we, naturalDimensions: l, asUrl: a, asSVGText: i };
716
716
  } catch {
717
717
  }
718
718
  };
719
- if (t === we ? await o() : t.startsWith("image/") ? await r() : (await r(), n || await o()), !n) throw new Error("Failed to load image");
720
- return n;
719
+ if (t === we ? await o() : t.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw new Error("Failed to load image");
720
+ return r;
721
721
  } }, Symbol.toStringTag, { value: "Module" }));
722
722
  var We, Ye;
723
- (Ye = We || (We = {})).resolveTypedUpdates = (e, t, n, r) => {
723
+ (Ye = We || (We = {})).resolveTypedUpdates = (e, t, r, n) => {
724
724
  if (e === null) return e;
725
- if (e === void 0) return r;
725
+ if (e === void 0) return n;
726
726
  let o = e;
727
727
  if (t?.shorthand) {
728
- const u = t?.shorthand(e, n);
728
+ const u = t?.shorthand(e, r);
729
729
  u !== void 0 && (o = u);
730
730
  }
731
731
  if (o !== null && t?.getSubType) {
@@ -734,20 +734,18 @@ var We, Ye;
734
734
  }
735
735
  const i = t?.properties, a = t?.arrayType ?? !1;
736
736
  let l = o;
737
- if (t && t.merge && l && r) l = t.merge(l, r, n);
738
- else if (!a) {
739
- if (i) {
740
- const u = Object.keys({ ...o, ...r });
741
- l = null;
742
- for (let f = 0; f < u.length; f++) {
743
- const h = u[f];
744
- let g, p = o[h];
745
- if (p !== void 0) {
746
- const y = i[h];
747
- g = y ? (0, Ye.resolveTypedUpdates)(p, y, n, r?.[h]) : p;
748
- } else g = r?.[h];
749
- g != null && (l = l ?? {}, l[h] = g);
750
- }
737
+ if (t && t.merge && l && n) l = t.merge(l, n, r);
738
+ else if (!a && i) {
739
+ const u = Object.keys({ ...o, ...n });
740
+ l = null;
741
+ for (let f = 0; f < u.length; f++) {
742
+ const h = u[f];
743
+ let g, p = o[h];
744
+ if (p !== void 0) {
745
+ const y = i[h];
746
+ g = y ? (0, Ye.resolveTypedUpdates)(p, y, r, n?.[h]) : p;
747
+ } else g = n?.[h];
748
+ g != null && (l = l ?? {}, l[h] = g);
751
749
  }
752
750
  }
753
751
  return l;
@@ -763,10 +761,10 @@ Please use Chrome or Edge if external copy and paste is required.\`, Perms: ye,
763
761
  document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
764
762
  e();
765
763
  }, { once: !0 }), document.activeElement.focus?.();
766
- }), be = async (e, t, n) => {
767
- if (oe() === k.Safari) return await n(new Error(pt.Safari));
764
+ }), be = async (e, t, r) => {
765
+ if (oe() === k.Safari) return await r(new Error(pt.Safari));
768
766
  try {
769
- const r = async (a) => {
767
+ const n = async (a) => {
770
768
  try {
771
769
  return await a();
772
770
  } catch (l) {
@@ -775,9 +773,9 @@ Please use Chrome or Edge if external copy and paste is required.\`, Perms: ye,
775
773
  }
776
774
  }, o = await globalThis?.navigator?.permissions?.query({ name: e, allowWithoutGesture: !0, allowWithoutSanitization: !0 });
777
775
  let i = !1;
778
- if (o.state === "prompt" && (i = await r(t)), i || o.state !== "granted" || (i = await t()), !i) return await n(new Error(o.state));
779
- } catch (r) {
780
- return r.message === "No valid data on clipboard" || r.name === "DataError" ? void 0 : await n(r);
776
+ if (o.state === "prompt" && (i = await n(t)), i || o.state !== "granted" || (i = await t()), !i) return await r(new Error(o.state));
777
+ } catch (n) {
778
+ return n.message === "No valid data on clipboard" || n.name === "DataError" ? void 0 : await r(n);
781
779
  }
782
780
  }, mt = async (e) => {
783
781
  try {
@@ -787,21 +785,21 @@ Please use Chrome or Edge if external copy and paste is required.\`, Perms: ye,
787
785
  return await e.read();
788
786
  }, Bt = async (e, t) => {
789
787
  if (!e) return null;
790
- const n = await mt(e);
791
- let r = !1;
792
- for (let o = 0; !r && n && o < n.length; o++) if (r = n[o].types.includes(t), r)
793
- return await n[o].getType(t);
794
- return r ? void 0 : null;
788
+ const r = await mt(e);
789
+ let n = !1;
790
+ for (let o = 0; !n && r && o < r.length; o++) if (n = r[o].types.includes(t), n)
791
+ return await r[o].getType(t);
792
+ return n ? void 0 : null;
795
793
  };
796
794
  if (!globalThis.ClipboardItem) {
797
- const e = (n, r) => new Blob([r], { type: n });
795
+ const e = (r, n) => new Blob([n], { type: r });
798
796
  class t {
799
- constructor(r, o) {
800
- this._items = {}, this._types = Object.keys(r);
801
- const i = {}, a = Object.keys(r);
797
+ constructor(n, o) {
798
+ this._items = {}, this._types = Object.keys(n);
799
+ const i = {}, a = Object.keys(n);
802
800
  for (let l = 0; l < a.length; l++) {
803
801
  const u = a[l];
804
- let f = r[u];
802
+ let f = n[u];
805
803
  i[u] = typeof f == "string" ? e(u, f) : f;
806
804
  }
807
805
  this._items = i, this._presentationStyle = o?.presentationStyle ?? "unspecified";
@@ -809,55 +807,55 @@ if (!globalThis.ClipboardItem) {
809
807
  get types() {
810
808
  return this._types;
811
809
  }
812
- getType(r) {
813
- return Promise.resolve(this._items[r]);
810
+ getType(n) {
811
+ return Promise.resolve(this._items[n]);
814
812
  }
815
- supports(r) {
813
+ supports(n) {
816
814
  return !0;
817
815
  }
818
816
  }
819
817
  globalThis.ClipboardItem = t;
820
818
  }
821
- const ve = async (e, t = S.html) => new Promise(async (n, r) => {
819
+ const ve = async (e, t = S.html) => new Promise(async (r, n) => {
822
820
  try {
823
821
  const o = await Bt(e, t);
824
822
  if (o) {
825
823
  const i = new FileReader();
826
824
  i.onload = () => {
827
- n(i.result);
825
+ r(i.result);
828
826
  }, i.onerror = () => {
829
- n("");
827
+ r("");
830
828
  }, i.readAsText(o);
831
- } else n("");
829
+ } else r("");
832
830
  } catch (o) {
833
- r(o);
831
+ n(o);
834
832
  }
835
833
  }), He = async (e, t = S.html) => {
836
- const n = await ve(e, t);
837
- if (!n) return null;
838
- let r = null;
834
+ const r = await ve(e, t);
835
+ if (!r) return null;
836
+ let n = null;
839
837
  try {
840
- r = new DOMParser().parseFromString(n, S.html);
838
+ n = new DOMParser().parseFromString(r, S.html);
841
839
  } catch {
842
840
  console.warn("Can't parse html from clipboard.");
843
841
  }
844
- return r;
842
+ return n;
845
843
  }, $t = async (e) => {
846
844
  e && await e.writeText("");
847
845
  }, ie = "clipboard-uuid", Q = "web text/uuid", Xe = (e) => \`<div style="display:none" \${ie}="\${e}"/>\`, zt = (e, t) => {
848
- let n = null;
846
+ let r = null;
849
847
  try {
850
- const r = new DOMParser().parseFromString(t, S.html);
851
- r.body.firstElementChild.setAttribute(ie, e), n = r.getElementsByTagName("body")[0].innerHTML;
852
- } catch (r) {
853
- console.warn("Can't embed uuid.", r);
848
+ const n = new DOMParser().parseFromString(t, S.html);
849
+ n.body.firstElementChild.setAttribute(ie, e), r = n.getElementsByTagName("body")[0].innerHTML;
850
+ } catch (n) {
851
+ console.warn("Can't embed uuid.", n);
854
852
  }
855
- return n;
853
+ return r;
856
854
  }, Ze = (e, t) => {
857
855
  if (!t || !e) return !1;
858
856
  try {
859
- const n = t.querySelectorAll(\`[\${ie}="\${e}"]\`);
860
- if (n && n.length === 1) return !0;
857
+ const r = t.querySelectorAll(\`[\${ie}="\${e}"]\`);
858
+ if (r && r.length === 1) return !0;
861
859
  if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
862
860
  return !1;
863
861
  } catch {
@@ -879,8 +877,8 @@ class Qe {
879
877
  await ge();
880
878
  const t = await ve(this._nativeClipboard, Q);
881
879
  if (!this._state || t && t === this._state.uuid) return !0;
882
- const n = await He(this._nativeClipboard, S.html);
883
- return !this._state || (Ze(this._state.uuid, n) || this.clear(), !0);
880
+ const r = await He(this._nativeClipboard, S.html);
881
+ return !this._state || (Ze(this._state.uuid, r) || this.clear(), !0);
884
882
  }, async (t) => {
885
883
  t?.message === "denied" || t.message?.includes("Document is not focused") || oe() === k.Safari || console.warn("Unable to detect clipboard changes: ", t);
886
884
  });
@@ -891,7 +889,7 @@ class Qe {
891
889
  t._checkForChanges();
892
890
  }, this._onBlur = () => {
893
891
  globalThis.addEventListener?.("focus", t._onFocus, { once: !0 });
894
- }, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (n) => {
892
+ }, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (r) => {
895
893
  t._checkForChanges();
896
894
  }));
897
895
  }
@@ -900,13 +898,13 @@ class Qe {
900
898
  const t = this;
901
899
  return await be("clipboard-read", async () => {
902
900
  if (await ge(), this._state?.uuid) {
903
- const n = await ve(this._nativeClipboard, Q);
904
- if (n && n === t._state.uuid) return !0;
905
- const r = await He(this._nativeClipboard, S.html);
906
- if (Ze(t._state?.uuid, r)) return !0;
901
+ const r = await ve(this._nativeClipboard, Q);
902
+ if (r && r === t._state.uuid) return !0;
903
+ const n = await He(this._nativeClipboard, S.html);
904
+ if (Ze(t._state?.uuid, n)) return !0;
907
905
  }
908
906
  return t._state = { items: await mt(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
909
- }, async (n) => {
907
+ }, async (r) => {
910
908
  this.dispatchEvent(new Event("clipboarderrorread"));
911
909
  }), this._state?.items ?? [];
912
910
  }
@@ -915,10 +913,10 @@ class Qe {
915
913
  }
916
914
  async _write(t) {
917
915
  if (!this._nativeClipboard) return this._state = t, this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")), null;
918
- const n = this, r = [], o = t.uuid;
916
+ const r = this, n = [], o = t.uuid;
919
917
  let i = t.items ?? [];
920
918
  const a = () => {
921
- n._state = { uuid: o, ref: t.ref, items: r }, n.dispatchEvent(new Event("clipboardwrite")), n.dispatchEvent(new Event("clipboardchange"));
919
+ r._state = { uuid: o, ref: t.ref, items: n }, r.dispatchEvent(new Event("clipboardwrite")), r.dispatchEvent(new Event("clipboardchange"));
922
920
  };
923
921
  await be("clipboard-write", async () => {
924
922
  await ge(), o && i.length === 0 && (i.push(new ClipboardItem({ [Q]: new Blob([o], { type: Q }) })), i.push(new ClipboardItem({ [S.html]: new Blob([Xe(o)], { type: S.html }) })));
@@ -946,10 +944,10 @@ class Qe {
946
944
  const T = u.types[y];
947
945
  p[T] = y === f ? g : u.getType(T);
948
946
  }
949
- h && f === -1 && (p[S.html] = g), o && (p[Q] = new Blob([o], { type: Q })), r.push(new ClipboardItem(p));
947
+ h && f === -1 && (p[S.html] = g), o && (p[Q] = new Blob([o], { type: Q })), n.push(new ClipboardItem(p));
950
948
  }
951
949
  try {
952
- r && r.length !== 0 ? await this._nativeClipboard.write(r) : await $t(this._nativeClipboard);
950
+ n && n.length !== 0 ? await this._nativeClipboard.write(n) : await $t(this._nativeClipboard);
953
951
  } catch (l) {
954
952
  l.message?.includes("Document is not focused") || console.warn("Unable to write to native clipboard: ", l);
955
953
  }
@@ -960,28 +958,28 @@ class Qe {
960
958
  }
961
959
  async writeReference(t) {
962
960
  if (!t) return void this.clear();
963
- let n = null;
964
- const r = {};
961
+ let r = null;
962
+ const n = {};
965
963
  try {
966
964
  const i = await t.toText?.() ?? null;
967
- i && (r[S.plain] = new Blob([i ?? ""], { type: S.plain }));
965
+ i && (n[S.plain] = new Blob([i ?? ""], { type: S.plain }));
968
966
  } catch (i) {
969
- n = i;
967
+ r = i;
970
968
  }
971
969
  try {
972
970
  const i = await t.toHtml?.() ?? null;
973
- i && (r[S.html] = new Blob([i], { type: S.html }));
971
+ i && (n[S.html] = new Blob([i], { type: S.html }));
974
972
  } catch (i) {
975
- n = i, console.warn("export to html", i);
973
+ r = i, console.warn("export to html", i);
976
974
  }
977
975
  try {
978
976
  const i = await t.toImage?.() ?? null;
979
- i && (r[S.png] = i);
977
+ i && (n[S.png] = i);
980
978
  } catch (i) {
981
- n = i, console.warn("export to png", i);
979
+ r = i, console.warn("export to png", i);
982
980
  }
983
- const o = this._write({ uuid: de(), ref: t, items: Object.keys(r).length > 0 ? [new ClipboardItem(r)] : null });
984
- if (n) throw n;
981
+ const o = this._write({ uuid: de(), ref: t, items: Object.keys(n).length > 0 ? [new ClipboardItem(n)] : null });
982
+ if (r) throw r;
985
983
  return o;
986
984
  }
987
985
  clear(t = !1) {
@@ -991,32 +989,32 @@ class Qe {
991
989
  return await this.read(), this._state?.ref ?? null;
992
990
  }
993
991
  readText() {
994
- return new Promise(async (t, n) => {
995
- const r = await this.read();
992
+ return new Promise(async (t, r) => {
993
+ const n = await this.read();
996
994
  let o = null;
997
- for (let a = 0; !o && r && a < r.length; a++) r[a].types.includes(S.plain) && (o = await r[a].getType(S.plain));
995
+ for (let a = 0; !o && n && a < n.length; a++) n[a].types.includes(S.plain) && (o = await n[a].getType(S.plain));
998
996
  if (!o) return void t("");
999
997
  const i = new FileReader();
1000
998
  i.onload = () => {
1001
999
  t(i.result);
1002
1000
  }, i.readAsText(o), i.onerror = (a) => {
1003
- n(a);
1001
+ r(a);
1004
1002
  };
1005
1003
  });
1006
1004
  }
1007
1005
  async writeText(t) {
1008
- const n = [new ClipboardItem({ [S.plain]: new Blob([t], { type: S.plain }) })];
1009
- return this._write({ uuid: de(), items: n, ref: null });
1006
+ const r = [new ClipboardItem({ [S.plain]: new Blob([t], { type: S.plain }) })];
1007
+ return this._write({ uuid: de(), items: r, ref: null });
1010
1008
  }
1011
- addEventListener(t, n, r = {}) {
1012
- const o = r?.capture ? this._listenersCapture : this._listeners;
1009
+ addEventListener(t, r, n = {}) {
1010
+ const o = n?.capture ? this._listenersCapture : this._listeners;
1013
1011
  let i = o.get(t);
1014
- i || (i = /* @__PURE__ */ new Map(), o.set(t, i)), i.set(n, typeof r == "boolean" ? {} : r);
1012
+ i || (i = /* @__PURE__ */ new Map(), o.set(t, i)), i.set(r, typeof n == "boolean" ? {} : n);
1015
1013
  }
1016
1014
  dispatchEvent(t) {
1017
1015
  if (!t) return;
1018
- const n = (r) => {
1019
- const o = r.get(t.type);
1016
+ const r = (n) => {
1017
+ const o = n.get(t.type);
1020
1018
  o && o.forEach((i, a) => {
1021
1019
  try {
1022
1020
  typeof a == "function" ? a(t) : a.handleEvent && a.handleEvent(t), i.once && o.delete(a);
@@ -1025,11 +1023,11 @@ class Qe {
1025
1023
  }
1026
1024
  });
1027
1025
  };
1028
- return n(this._listenersCapture), n(this._listeners), !0;
1026
+ return r(this._listenersCapture), r(this._listeners), !0;
1029
1027
  }
1030
- removeEventListener(t, n, r) {
1031
- const o = r?.capture ? this._listenersCapture : this._listeners, i = o.get(t);
1032
- i && (i.delete(n), i.size === 0 && o.delete(t));
1028
+ removeEventListener(t, r, n) {
1029
+ const o = n?.capture ? this._listenersCapture : this._listeners, i = o.get(t);
1030
+ i && (i.delete(r), i.size === 0 && o.delete(t));
1033
1031
  }
1034
1032
  close() {
1035
1033
  globalThis.removeEventListener?.("focus", this._onFocus), globalThis.removeEventListener?.("blur", this._onBlur);
@@ -1048,16 +1046,16 @@ async function Vt() {
1048
1046
  return ee;
1049
1047
  }
1050
1048
  let e, t;
1051
- le = new Promise((n, r) => {
1052
- e = n, t = r;
1049
+ le = new Promise((r, n) => {
1050
+ e = r, t = n;
1053
1051
  });
1054
1052
  try {
1055
- const { initialize: n } = await Promise.resolve().then(function() {
1056
- return nn;
1053
+ const { initialize: r } = await Promise.resolve().then(function() {
1054
+ return rr;
1057
1055
  });
1058
- return ee = await n(), e(), ee;
1059
- } catch (n) {
1060
- throw console.error("Failed to import or initialize esbuild:", n), le = null, t(n), n;
1056
+ return ee = await r(), e(), ee;
1057
+ } catch (r) {
1058
+ throw console.error("Failed to import or initialize esbuild:", r), le = null, t(r), r;
1061
1059
  }
1062
1060
  }
1063
1061
  const qt = {
@@ -1066,21 +1064,21 @@ const qt = {
1066
1064
  target: "esnext"
1067
1065
  }
1068
1066
  };
1069
- async function Gt(e, t, n = "/script.js", r = Kt) {
1067
+ async function Gt(e, t, r = "/script.js", n = Kt) {
1070
1068
  try {
1071
1069
  const o = await Vt(), i = "@sheetxl/primitives", a = \`
1072
- export const FormulaContext = globalThis.\${r}?.FormulaContext;
1073
- export const ScalarType = globalThis.\${r}?.ScalarType;
1074
- export const Observable = globalThis.\${r}?.Observable;
1075
- export const IRange = globalThis.\${r}?.IRange;
1076
- export const FormulaError = globalThis.\${r}?.FormulaError;
1070
+ export const FormulaContext = globalThis.\${n}?.FormulaContext;
1071
+ export const ScalarType = globalThis.\${n}?.ScalarType;
1072
+ export const Observable = globalThis.\${n}?.Observable;
1073
+ export const IRange = globalThis.\${n}?.IRange;
1074
+ export const FormulaError = globalThis.\${n}?.FormulaError;
1077
1075
  // Add more exports as needed
1078
1076
  \`, l = {
1079
1077
  // ESBuild.Plugin = {
1080
1078
  name: "sheetxl-esbuild-in-memory",
1081
1079
  setup(f) {
1082
1080
  const h = "sheetxl-" + (/* @__PURE__ */ new Date()).getTime();
1083
- f.onResolve({ filter: new RegExp(\`^(\${n.replace("/", "\\\\/")}|\${i})$\`) }, (g) => ({
1081
+ f.onResolve({ filter: new RegExp(\`^(\${r.replace("/", "\\\\/")}|\${i})$\`) }, (g) => ({
1084
1082
  path: g.path,
1085
1083
  namespace: h
1086
1084
  })), f.onResolve({ filter: /.*/ }, (g) => {
@@ -1088,7 +1086,7 @@ async function Gt(e, t, n = "/script.js", r = Kt) {
1088
1086
  return console.warn(\`esbuild: Treating import "\${g.path}" as external.\`), { path: g.path, external: !0 };
1089
1087
  }), f.onLoad({ filter: /.*/, namespace: h }, (g) => {
1090
1088
  let p;
1091
- if (g.path === n)
1089
+ if (g.path === r)
1092
1090
  p = t;
1093
1091
  else if (g.path === i)
1094
1092
  p = a;
@@ -1104,7 +1102,7 @@ async function Gt(e, t, n = "/script.js", r = Kt) {
1104
1102
  });
1105
1103
  }
1106
1104
  }, u = await o.build({
1107
- entryPoints: [n],
1105
+ entryPoints: [r],
1108
1106
  // Use the virtual entry point
1109
1107
  bundle: !0,
1110
1108
  // IMPORTANT: Enable bundling
@@ -1161,9 +1159,9 @@ interface Promise<T> {
1161
1159
  ["ICellRange", "range"],
1162
1160
  ["IFormulaContext", "context"]
1163
1161
  ]), _e = (e, t) => {
1164
- Array.from(t.keys()).forEach((r) => {
1165
- const o = t.get(r);
1166
- t.set(\`\${e}.\${r}\`, o);
1162
+ Array.from(t.keys()).forEach((n) => {
1163
+ const o = t.get(n);
1164
+ t.set(\`\${e}.\${n}\`, o);
1167
1165
  });
1168
1166
  }, Ht = /* @__PURE__ */ new Map([
1169
1167
  ["Scalar", "*"],
@@ -1189,7 +1187,7 @@ async function Qt() {
1189
1187
  return se;
1190
1188
  try {
1191
1189
  return await (await Promise.resolve().then(function() {
1192
- return on;
1190
+ return or;
1193
1191
  })).initialize();
1194
1192
  } catch (e) {
1195
1193
  throw se = null, e;
@@ -1197,14 +1195,14 @@ async function Qt() {
1197
1195
  se = null;
1198
1196
  }
1199
1197
  }
1200
- async function en(e) {
1198
+ async function er(e) {
1201
1199
  const t = e?.source ?? null;
1202
1200
  if (!t) return null;
1203
- const n = (e.disableBundle || e.declarationsOnly) ?? !1, r = [
1201
+ const r = (e.disableBundle || e.declarationsOnly) ?? !1, n = [
1204
1202
  Jt(),
1205
1203
  //import('typescript'), // when bundled, but node check causes issues. We could bundle replace isNode but felt hacky
1206
1204
  Qt()
1207
- ], o = await Promise.all(r), i = o[0], a = o[1];
1205
+ ], o = await Promise.all(n), i = o[0], a = o[1];
1208
1206
  let l = "", u = null;
1209
1207
  const f = [], h = {
1210
1208
  allowJs: !0,
@@ -1428,7 +1426,7 @@ async function en(e) {
1428
1426
  throw new Error("No exported functions.");
1429
1427
  const yt = \`\${Ut.uuidV4()}-script\`;
1430
1428
  try {
1431
- !n && B.length === 0 && (l = await Gt(a, l, g));
1429
+ !r && B.length === 0 && (l = await Gt(a, l, g));
1432
1430
  } catch {
1433
1431
  console.warn("Error bundling script");
1434
1432
  }
@@ -1444,30 +1442,30 @@ async function en(e) {
1444
1442
  return u && (Ie.autoRun = u), Ie;
1445
1443
  }
1446
1444
  self.addEventListener("message", async (e) => {
1447
- const { id: t, params: n } = e.data;
1445
+ const { id: t, params: r } = e.data;
1448
1446
  try {
1449
- const r = await en(n);
1450
- self.postMessage({ id: t, result: r, error: null });
1451
- } catch (r) {
1447
+ const n = await er(r);
1448
+ self.postMessage({ id: t, result: n, error: null });
1449
+ } catch (n) {
1452
1450
  self.postMessage({
1453
1451
  id: t,
1454
1452
  result: null,
1455
1453
  error: {
1456
- message: r.message,
1457
- stack: r.stack,
1458
- cause: r.cause
1454
+ message: n.message,
1455
+ stack: n.stack,
1456
+ cause: n.cause
1459
1457
  }
1460
1458
  });
1461
1459
  }
1462
1460
  });
1463
1461
  let ce = null;
1464
- async function tn() {
1462
+ async function tr() {
1465
1463
  return ce || (ce = new Promise(async (e, t) => {
1466
1464
  try {
1467
- const n = "0.20.2", r = \`https://esm.sh/esbuild-wasm@\${n}\`, o = \`https://esm.sh/esbuild-wasm@\${n}/esbuild.wasm\`, a = (await import(
1465
+ const r = "0.20.2", n = \`https://esm.sh/esbuild-wasm@\${r}\`, o = \`https://esm.sh/esbuild-wasm@\${r}/esbuild.wasm\`, a = (await import(
1468
1466
  /* webpackIgnore: true */
1469
1467
  /* @vite-ignore */
1470
- r
1468
+ n
1471
1469
  )).default;
1472
1470
  await a.initialize({
1473
1471
  wasmURL: o,
@@ -1475,29 +1473,29 @@ async function tn() {
1475
1473
  worker: !1
1476
1474
  // Keep processing on the current thread
1477
1475
  }), e(a);
1478
- } catch (n) {
1479
- console.error("Error initializing esbuild:", n), t(n);
1476
+ } catch (r) {
1477
+ console.error("Error initializing esbuild:", r), t(r);
1480
1478
  }
1481
1479
  }), ce);
1482
1480
  }
1483
- var nn = /* @__PURE__ */ Object.freeze({
1481
+ var rr = /* @__PURE__ */ Object.freeze({
1484
1482
  __proto__: null,
1485
- initialize: tn
1483
+ initialize: tr
1486
1484
  });
1487
1485
  let ue = null;
1488
- async function rn() {
1486
+ async function nr() {
1489
1487
  return ue || (ue = new Promise(async (e, t) => {
1490
- let n = null;
1488
+ let r = null;
1491
1489
  try {
1492
- n = await import("https://esm.sh/typescript@5.7.2");
1493
- } catch (r) {
1494
- console.error("Error initializing Browser TypeScript module:", r);
1490
+ r = await import("https://esm.sh/typescript@5.7.2");
1491
+ } catch (n) {
1492
+ console.error("Error initializing Browser TypeScript module:", n);
1495
1493
  }
1496
- n || console.log("use script fallback"), e(n);
1494
+ r || console.log("use script fallback"), e(r);
1497
1495
  }), ue);
1498
1496
  }
1499
- var on = /* @__PURE__ */ Object.freeze({
1497
+ var or = /* @__PURE__ */ Object.freeze({
1500
1498
  __proto__: null,
1501
- initialize: rn
1499
+ initialize: nr
1502
1500
  });
1503
- `,a=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",s],{type:"text/javascript;charset=utf-8"});function d(e){let n;try{if(n=a&&(self.URL||self.webkitURL).createObjectURL(a),!n)throw"";const t=new Worker(n,{type:"module",name:e?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(s),{type:"module",name:e?.name})}}const l=async()=>{const{compileModule:e}=await Promise.resolve().then(()=>require("./D7p1GlEsqnlwvB3K.cjs")),n=new u(t=>e(t));return await n.start(),n};exports.createCompilerWorker=async function(){if(typeof process<"u"&&process.versions?.node&&typeof Worker>"u")return await l();if(typeof Worker<"u"){const e=new c(()=>new d);try{return await e.start(),e}catch(n){console.error("Failed to start TypescriptCompiler worker reverting to fallback:",n)}}return await l()};
1501
+ `,a=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",s],{type:"text/javascript;charset=utf-8"});function d(e){let n;try{if(n=a&&(self.URL||self.webkitURL).createObjectURL(a),!n)throw"";const t=new Worker(n,{type:"module",name:e?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(s),{type:"module",name:e?.name})}}const l=async()=>{const{compileModule:e}=await Promise.resolve().then(()=>require("./CNn5zoW93aWa8oj_.cjs")),n=new u(t=>e(t));return await n.start(),n};exports.createCompilerWorker=async function(){if(typeof process<"u"&&process.versions?.node&&typeof Worker>"u")return await l();if(typeof Worker<"u"){const e=new c(()=>new d);try{return await e.start(),e}catch(n){console.error("Failed to start TypescriptCompiler worker reverting to fallback:",n)}}return await l()};