@sheetxl/primitives 0.7.27 → 0.7.28-beta.2

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,309 +1,686 @@
1
1
  /**
2
- * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.7.27
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- const e = { Number: "n", String: "s", Boolean: "b", Error: "e", RichData: "r", Null: "z" };
8
- var t, o, n;
9
- (o = t || (t = {})).Orientation = { Column: "column", Row: "row" }, o.Orientations = { ...o.Orientation, Both: "both" }, o.Direction = { Up: "up", Down: "down", Left: "left", Right: "right" }, ((e2) => {
10
- e2.Code = { Parse: 0, Null: 1, Div0: 2, Value: 3, Ref: 4, Name: 5, Num: 6, NA: 7, GettingData: 8, Spill: 9, Connect: 10, Blocked: 11, Unknown: 12, Field: 13, Calc: 14, Busy: 16, Python: 19, Timeout: 20 }, e2.Label = { Parse: "#PARSE!", Null: "#NULL!", Div0: "#DIV/0!", Value: "#VALUE!", Ref: "#REF!", Name: "#NAME?", Num: "#NUM!", NA: "#N/A", GettingData: "#GETTING_DATA", Spill: "#SPILL!", Connect: "#CONNECT!", Blocked: "#BLOCKED!", Unknown: "#UNKNOWN!", Field: "#FIELD!", Calc: "#CALC!", Busy: "#BUSY!", Python: "#PYTHON!", Timeout: "#TIMEOUT!" };
11
- class t2 extends Error {
12
- constructor(e3, t3, o3, n3) {
13
- super(o3, n3), this._label = t3, this._code = e3, this.details = n3;
14
- }
15
- static {
16
- this.code = e2.Code.Unknown;
17
- }
18
- get isFormulaError() {
19
- return true;
20
- }
21
- getLabel() {
22
- return this._label;
23
- }
24
- getCode() {
25
- return this._code;
26
- }
27
- equals(e3) {
28
- return !!e3 && (this._code === e3._code || this._code === e3.code);
29
- }
30
- get [Symbol.toStringTag]() {
31
- return "[FormulaError]";
32
- }
33
- toString() {
34
- return this.message || this._label;
35
- }
36
- }
37
- e2.Known = t2;
38
- class o2 extends t2 {
39
- constructor(t3, o3) {
40
- super(e2.Code.Parse, e2.Label.Parse, t3, o3);
41
- }
42
- static {
43
- this.code = e2.Code.Parse;
44
- }
45
- getDetails() {
46
- const e3 = this.details;
47
- return { line: e3?.line ?? 1, column: e3?.column ?? 1, offset: e3?.offset ?? 0, length: e3?.length ?? 0 };
48
- }
49
- }
50
- e2.Parse = o2;
51
- class n2 extends t2 {
52
- constructor(t3, o3) {
53
- super(e2.Code.Null, e2.Label.Null, t3, o3);
54
- }
55
- static {
56
- this.code = e2.Code.Null;
57
- }
58
- }
59
- e2.Null = n2;
60
- class s2 extends t2 {
61
- constructor(t3, o3) {
62
- super(e2.Code.Div0, e2.Label.Div0, t3, o3);
63
- }
64
- static {
65
- this.code = e2.Code.Div0;
66
- }
67
- }
68
- e2.Div0 = s2;
69
- class r2 extends t2 {
70
- constructor(t3, o3) {
71
- super(e2.Code.Value, e2.Label.Value, t3, o3);
72
- }
73
- static {
74
- this.code = e2.Code.Value;
75
- }
76
- }
77
- e2.Value = r2;
78
- class l2 extends t2 {
79
- constructor(t3, o3) {
80
- super(e2.Code.Ref, e2.Label.Ref, t3, o3);
81
- }
82
- static {
83
- this.code = e2.Code.Ref;
84
- }
85
- }
86
- e2.Ref = l2;
87
- class a2 extends t2 {
88
- constructor(t3, o3) {
89
- super(e2.Code.Name, e2.Label.Name, t3, o3);
90
- }
91
- static {
92
- this.code = e2.Code.Name;
93
- }
94
- }
95
- e2.Name = a2;
96
- class c2 extends t2 {
97
- constructor(t3, o3) {
98
- super(e2.Code.Num, e2.Label.Num, t3, o3);
99
- }
100
- static {
101
- this.code = e2.Code.Num;
102
- }
103
- }
104
- e2.Num = c2;
105
- class i2 extends t2 {
106
- constructor(t3, o3) {
107
- super(e2.Code.NA, e2.Label.NA, t3, o3);
108
- }
109
- static {
110
- this.code = e2.Code.NA;
111
- }
112
- }
113
- e2.NA = i2;
114
- class u2 extends t2 {
115
- constructor(t3, o3) {
116
- super(e2.Code.GettingData, e2.Label.GettingData, t3, o3);
117
- }
118
- static {
119
- this.code = e2.Code.GettingData;
120
- }
121
- }
122
- e2.GettingData = u2;
123
- class d2 extends t2 {
124
- constructor(t3, o3) {
125
- super(e2.Code.Spill, e2.Label.Spill, t3, o3);
126
- }
127
- static {
128
- this.code = e2.Code.Spill;
129
- }
130
- }
131
- e2.Spill = d2;
132
- class C2 extends t2 {
133
- constructor(t3, o3) {
134
- super(e2.Code.Connect, e2.Label.Connect, t3, o3);
135
- }
136
- static {
137
- this.code = e2.Code.Connect;
138
- }
139
- }
140
- e2.Connect = C2;
141
- class m2 extends t2 {
142
- constructor(t3, o3) {
143
- super(e2.Code.Blocked, e2.Label.Blocked, t3, o3);
144
- }
145
- static {
146
- this.code = e2.Code.Blocked;
147
- }
148
- }
149
- e2.Blocked = m2;
150
- class g2 extends t2 {
151
- constructor(t3, o3) {
152
- super(e2.Code.Unknown, e2.Label.Unknown, t3, o3);
153
- }
154
- static {
155
- this.code = e2.Code.Unknown;
156
- }
157
- }
158
- e2.Unknown = g2;
159
- class w2 extends t2 {
160
- constructor(t3, o3) {
161
- super(e2.Code.Field, e2.Label.Field, t3, o3);
162
- }
163
- static {
164
- this.code = e2.Code.Field;
165
- }
166
- }
167
- e2.Field = w2;
168
- class N2 extends t2 {
169
- constructor(t3, o3) {
170
- super(e2.Code.Calc, e2.Label.Calc, t3, o3);
171
- }
172
- static {
173
- this.code = e2.Code.Calc;
174
- }
175
- }
176
- e2.Calc = N2;
177
- class h2 extends t2 {
178
- constructor(t3, o3) {
179
- super(e2.Code.Busy, e2.Label.Busy, t3, o3);
180
- }
181
- static {
182
- this.code = e2.Code.Busy;
183
- }
184
- }
185
- e2.Busy = h2;
186
- class b2 extends t2 {
187
- constructor(t3, o3) {
188
- super(e2.Code.Python, e2.Label.Python, t3, o3);
189
- }
190
- static {
191
- this.code = e2.Code.Python;
192
- }
193
- }
194
- e2.Python = b2;
195
- class p extends t2 {
196
- constructor(t3, o3) {
197
- super(e2.Code.Timeout, e2.Label.Timeout, t3, o3);
198
- }
199
- static {
200
- this.code = e2.Code.Timeout;
201
- }
202
- }
203
- e2.Timeout = p;
204
- })(n || (n = {}));
205
- const s = {};
206
- s[n.Code.Parse] = n.Parse, s[n.Code.Null] = n.Null, s[n.Code.Div0] = n.Div0, s[n.Code.Value] = n.Value, s[n.Code.Ref] = n.Ref, s[n.Code.Name] = n.Name, s[n.Code.Num] = n.Num, s[n.Code.NA] = n.NA, s[n.Code.GettingData] = n.GettingData, s[n.Code.Spill] = n.Spill, s[n.Code.Connect] = n.Connect, s[n.Code.Blocked] = n.Blocked, s[n.Code.Unknown] = n.Unknown, s[n.Code.Field] = n.Field, s[n.Code.Calc] = n.Calc, s[n.Code.Busy] = n.Busy, s[n.Code.Python] = n.Python, s[n.Code.Timeout] = n.Timeout;
207
- const r = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), i = Object.keys(s);
208
- for (let e2 = 0; e2 < i.length; e2++) {
209
- const t2 = i[e2], o2 = s[t2];
210
- a.set(n.Label[t2], o2), c.set(n.Code[t2], o2);
211
- const u2 = new o2();
212
- r.set(u2.getLabel(), u2), l.set(u2.getCode(), u2);
213
- }
214
- const u = l.get(n.Code.Unknown);
215
- var d;
216
- (d = n || (n = {})).BuiltIn = { Parse: new d.Parse(), Null: new d.Null(), Div0: new d.Div0(), Value: new d.Value(), Ref: new d.Ref(), Name: new d.Name(), Num: new d.Num(), NA: new d.NA(), GettingData: new d.GettingData(), Spill: new d.Spill(), Connect: new d.Connect(), Blocked: new d.Blocked(), Unknown: new d.Unknown(), Field: new d.Field(), Calc: new d.Calc(), Busy: new d.Busy(), Python: new d.Python(), Timeout: new d.Timeout() }, d.getBuiltInByLabel = (e2) => r.get(e2), d.newTypedError = (e2, t2, o2) => {
217
- let n2;
218
- return n2 = "string" == typeof e2 ? a.get(e2) : c.get(e2), n2 || (n2 = d.Unknown), new n2(t2, o2);
219
- }, d.getBuiltInById = (e2) => l.get(e2) || u;
220
- class C {
221
- constructor(e2) {
222
- this._subscribeFn = e2;
223
- }
224
- subscribe(e2, t2, o2) {
225
- const n2 = "object" == typeof e2 ? { next: e2.next || (() => {
226
- }), error: e2.error || (() => {
227
- }), complete: e2.complete || (() => {
228
- }), unsubscribe: () => {
229
- } } : { next: e2 || (() => {
230
- }), error: t2 || (() => {
231
- }), complete: o2 || (() => {
232
- }), unsubscribe: () => {
233
- } }, s2 = this._subscribeFn(n2);
234
- return n2.unsubscribe = () => {
235
- "function" == typeof s2 && s2();
236
- }, n2;
237
- }
238
- }
239
- class m {
240
- getRange(e2) {
241
- throw new g();
242
- }
243
- getReference(e2, t2) {
244
- throw new g();
245
- }
246
- getNumberFormat(e2, t2) {
247
- return t2?.toString() ?? "";
248
- }
249
- fromOADate(e2) {
250
- return new Date(e2);
251
- }
252
- toOADate(e2) {
253
- return e2.getTime();
254
- }
255
- getValueAt(e2, t2) {
256
- return null;
257
- }
258
- getEntireCoords() {
259
- return N;
260
- }
261
- isValidDate(e2) {
262
- return (e2 instanceof Date || "[object Date]" === Object.prototype.toString.call(e2)) && !isNaN(e2.getTime());
263
- }
264
- getPosition() {
265
- return w;
266
- }
267
- getFormulaAt(e2, t2) {
268
- return null;
269
- }
270
- getSpillAt(e2, t2) {
271
- return null;
272
- }
273
- getSheetIndex(e2) {
274
- return -1;
275
- }
276
- getSheetCount() {
277
- return 1;
278
- }
279
- markVolatile() {
280
- }
281
- formatResults(e2) {
282
- }
283
- getFunction(e2) {
284
- return null;
285
- }
286
- getAddress(e2, t2) {
287
- throw new g();
288
- }
289
- parseAsDateTime(e2, t2) {
290
- throw new g();
291
- }
292
- getRuntime() {
293
- return h;
294
- }
295
- }
296
- class g extends Error {
297
- constructor(e2 = "Not implemented in StubbedFormulaContext") {
298
- super(e2), this.name = "NotImplementedError";
299
- }
300
- }
301
- const w = Object.freeze({ colIndex: 0, rowIndex: 0 }), N = Object.freeze({ colStart: 0, rowStart: 0, colEnd: Math.pow(2, 14) - 1, rowEnd: Math.pow(2, 20) - 1 }), h = { getCurrencySymbol: () => "$", getNumberDecimalSeparator: () => ".", getNumberGroupSeparator: () => ",", isDate1904: () => false, getLocation: () => "unknown", getVersion: () => "1.0.0", getOS: () => "unknown", getUser: () => "unidentified", getDescription: () => "Stubbed Formula Context" }, b = new m();
302
- export {
303
- b as FormulaContext,
304
- n as FormulaError,
305
- t as IRange,
306
- C as Observable,
307
- e as ScalarType,
308
- m as StubbedFormulaContext
2
+ * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.7.28-beta.2
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ var e;
8
+ (function(e) {
9
+ e.MAX_TEXT_LENGTH = 32767;
10
+ const t = e.MAX_SIGNIFICANT_DIGITS = 15;
11
+ e.truncateNumberText = function(e) {
12
+ const r = e.length;
13
+ if (r <= t) return e;
14
+ let o = 0, n = null;
15
+ for (let s = 0; s < r; s++) {
16
+ const r = e.charCodeAt(s);
17
+ if (r >= 48 && r <= 57) {
18
+ if (0 === o && 48 === r) continue;
19
+ o++, o > t && ((n ??= e.split(""))[s] = "0");
20
+ } else if ((69 === r || 101 === r) && o > 0) break;
21
+ }
22
+ return null === n ? e : n.join("");
23
+ };
24
+ })(e || (e = {}));
25
+ var t, r, o, n, s = {
26
+ Number: "number",
27
+ String: "string",
28
+ Boolean: "boolean",
29
+ Error: "error",
30
+ RichData: "richData",
31
+ Null: "null"
32
+ }, a = {
33
+ ...s,
34
+ Date: "date"
35
+ }, i = /[.*+?^${}()|[\]\\]/, c = (e) => i.test(e) ? "\\" + e : e, u = {
36
+ isWildCard: (e) => "string" == typeof e && /[*?]/.test(e),
37
+ toRegex: (e, t, r = !1) => {
38
+ let o = "";
39
+ const n = e.length;
40
+ for (let t = 0; t < n; t++) {
41
+ const r = e[t];
42
+ if ("~" === r) {
43
+ const r = e[t + 1];
44
+ "*" === r || "?" === r || "~" === r ? (o += c(r), t++) : o += "~";
45
+ continue;
46
+ }
47
+ "*" !== r ? o += "?" !== r ? c(r) : "." : o += ".*";
48
+ }
49
+ return RegExp(r ? `^${o}$` : o, t);
50
+ }
309
51
  };
52
+ (r = t || (t = {})).Axis = {
53
+ Column: "column",
54
+ Row: "row"
55
+ }, r.AxisSelection = {
56
+ ...t.Axis,
57
+ Both: "both"
58
+ }, r.Direction = {
59
+ Up: "up",
60
+ Down: "down",
61
+ Left: "left",
62
+ Right: "right"
63
+ }, (o || (o = {})).Aggregate = {
64
+ Count: "count",
65
+ NumericalCount: "numericalCount",
66
+ Sum: "sum",
67
+ Average: "average",
68
+ StdDev: "stdDev",
69
+ PopulationStdDev: "stdDevP",
70
+ Variance: "var",
71
+ PopulationVariance: "varP",
72
+ Min: "min",
73
+ Max: "max"
74
+ }, function(e) {
75
+ const t = e.Code = {
76
+ Parse: 0,
77
+ Null: 1,
78
+ Div0: 2,
79
+ Value: 3,
80
+ Ref: 4,
81
+ Name: 5,
82
+ Num: 6,
83
+ NA: 7,
84
+ GettingData: 8,
85
+ Spill: 9,
86
+ Connect: 10,
87
+ Blocked: 11,
88
+ Unknown: 12,
89
+ Field: 13,
90
+ Calc: 14,
91
+ Busy: 16,
92
+ Python: 19,
93
+ Timeout: 20
94
+ }, r = e.Label = {
95
+ Parse: "#PARSE!",
96
+ Null: "#NULL!",
97
+ Div0: "#DIV/0!",
98
+ Value: "#VALUE!",
99
+ Ref: "#REF!",
100
+ Name: "#NAME?",
101
+ Num: "#NUM!",
102
+ NA: "#N/A",
103
+ GettingData: "#GETTING_DATA",
104
+ Spill: "#SPILL!",
105
+ Connect: "#CONNECT!",
106
+ Blocked: "#BLOCKED!",
107
+ Unknown: "#UNKNOWN!",
108
+ Field: "#FIELD!",
109
+ Calc: "#CALC!",
110
+ Busy: "#BUSY!",
111
+ Python: "#PYTHON!",
112
+ Timeout: "#TIMEOUT!"
113
+ };
114
+ class o extends Error {
115
+ constructor(e, t, r, o) {
116
+ super(r, o), this._label = t, this._code = e, this.details = o;
117
+ }
118
+ static {
119
+ this.code = n.Code.Unknown;
120
+ }
121
+ get isFormulaError() {
122
+ return !0;
123
+ }
124
+ getLabel() {
125
+ return this._label;
126
+ }
127
+ getCode() {
128
+ return this._code;
129
+ }
130
+ equals(e) {
131
+ return !!e && (this._code === e._code || this._code === e.code);
132
+ }
133
+ get [Symbol.toStringTag]() {
134
+ return "[FormulaError]";
135
+ }
136
+ toString() {
137
+ return this._label;
138
+ }
139
+ }
140
+ e.Known = o;
141
+ class s extends o {
142
+ constructor(e, o) {
143
+ super(t.Parse, r.Parse, e, o);
144
+ }
145
+ static {
146
+ this.code = n.Code.Parse;
147
+ }
148
+ getDetails() {
149
+ const e = this.details;
150
+ return {
151
+ line: e?.line ?? 1,
152
+ column: e?.column ?? 1,
153
+ offset: e?.offset ?? 0,
154
+ length: e?.length ?? 0
155
+ };
156
+ }
157
+ }
158
+ e.Parse = s;
159
+ class a extends o {
160
+ constructor(e, o) {
161
+ super(t.Null, r.Null, e, o);
162
+ }
163
+ static {
164
+ this.code = n.Code.Null;
165
+ }
166
+ }
167
+ e.Null = a;
168
+ class i extends o {
169
+ constructor(e, o) {
170
+ super(t.Div0, r.Div0, e, o);
171
+ }
172
+ static {
173
+ this.code = n.Code.Div0;
174
+ }
175
+ }
176
+ e.Div0 = i;
177
+ class c extends o {
178
+ constructor(e, o) {
179
+ super(t.Value, r.Value, e, o);
180
+ }
181
+ static {
182
+ this.code = n.Code.Value;
183
+ }
184
+ }
185
+ e.Value = c;
186
+ class u extends o {
187
+ constructor(e, o) {
188
+ super(t.Ref, r.Ref, e, o);
189
+ }
190
+ static {
191
+ this.code = n.Code.Ref;
192
+ }
193
+ }
194
+ e.Ref = u;
195
+ class l extends o {
196
+ constructor(e, o) {
197
+ super(t.Name, r.Name, e, o);
198
+ }
199
+ static {
200
+ this.code = n.Code.Name;
201
+ }
202
+ }
203
+ e.Name = l;
204
+ class d extends o {
205
+ constructor(e, o) {
206
+ super(t.Num, r.Num, e, o);
207
+ }
208
+ static {
209
+ this.code = n.Code.Num;
210
+ }
211
+ }
212
+ e.Num = d;
213
+ class g extends o {
214
+ constructor(e, o) {
215
+ super(t.NA, r.NA, e, o);
216
+ }
217
+ static {
218
+ this.code = n.Code.NA;
219
+ }
220
+ }
221
+ e.NA = g;
222
+ class p extends o {
223
+ constructor(e, o) {
224
+ super(t.GettingData, r.GettingData, e, o);
225
+ }
226
+ static {
227
+ this.code = n.Code.GettingData;
228
+ }
229
+ }
230
+ e.GettingData = p;
231
+ class h extends o {
232
+ constructor(e, o) {
233
+ super(t.Spill, r.Spill, e, o);
234
+ }
235
+ static {
236
+ this.code = n.Code.Spill;
237
+ }
238
+ }
239
+ e.Spill = h;
240
+ class m extends o {
241
+ constructor(e, o) {
242
+ super(t.Connect, r.Connect, e, o);
243
+ }
244
+ static {
245
+ this.code = n.Code.Connect;
246
+ }
247
+ }
248
+ e.Connect = m;
249
+ class C extends o {
250
+ constructor(e, o) {
251
+ super(t.Blocked, r.Blocked, e, o);
252
+ }
253
+ static {
254
+ this.code = n.Code.Blocked;
255
+ }
256
+ }
257
+ e.Blocked = C;
258
+ class S extends o {
259
+ constructor(e, o) {
260
+ super(t.Unknown, r.Unknown, e, o);
261
+ }
262
+ static {
263
+ this.code = n.Code.Unknown;
264
+ }
265
+ }
266
+ e.Unknown = S;
267
+ class N extends o {
268
+ constructor(e, o) {
269
+ super(t.Field, r.Field, e, o);
270
+ }
271
+ static {
272
+ this.code = n.Code.Field;
273
+ }
274
+ }
275
+ e.Field = N;
276
+ class w extends o {
277
+ constructor(e, o) {
278
+ super(t.Calc, r.Calc, e, o);
279
+ }
280
+ static {
281
+ this.code = n.Code.Calc;
282
+ }
283
+ }
284
+ e.Calc = w;
285
+ class f extends o {
286
+ constructor(e, o) {
287
+ super(t.Busy, r.Busy, e, o);
288
+ }
289
+ static {
290
+ this.code = n.Code.Busy;
291
+ }
292
+ }
293
+ e.Busy = f;
294
+ class b extends o {
295
+ constructor(e, o) {
296
+ super(t.Python, r.Python, e, o);
297
+ }
298
+ static {
299
+ this.code = n.Code.Python;
300
+ }
301
+ }
302
+ e.Python = b;
303
+ class y extends o {
304
+ constructor(e, o) {
305
+ super(t.Timeout, r.Timeout, e, o);
306
+ }
307
+ static {
308
+ this.code = n.Code.Timeout;
309
+ }
310
+ }
311
+ e.Timeout = y;
312
+ }(n || (n = {}));
313
+ var l = {};
314
+ l[n.Code.Parse] = n.Parse, l[n.Code.Null] = n.Null, l[n.Code.Div0] = n.Div0, l[n.Code.Value] = n.Value, l[n.Code.Ref] = n.Ref, l[n.Code.Name] = n.Name, l[n.Code.Num] = n.Num, l[n.Code.NA] = n.NA, l[n.Code.GettingData] = n.GettingData, l[n.Code.Spill] = n.Spill, l[n.Code.Connect] = n.Connect, l[n.Code.Blocked] = n.Blocked, l[n.Code.Unknown] = n.Unknown, l[n.Code.Field] = n.Field, l[n.Code.Calc] = n.Calc, l[n.Code.Busy] = n.Busy, l[n.Code.Python] = n.Python, l[n.Code.Timeout] = n.Timeout;
315
+ var d = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), m = Object.keys(l);
316
+ for (let e = 0; e < m.length; e++) {
317
+ const t = l[m[e]], r = new t();
318
+ p.set(r.getLabel(), t), h.set(r.getCode(), t), d.set(r.getLabel(), r), g.set(r.getCode(), r);
319
+ }
320
+ (function(e) {
321
+ const t = e.getBuiltInByCode = (e) => g.get(e);
322
+ e.BuiltIn = {
323
+ Parse: t(n.Code.Parse),
324
+ Null: t(n.Code.Null),
325
+ Div0: t(n.Code.Div0),
326
+ Value: t(n.Code.Value),
327
+ Ref: t(n.Code.Ref),
328
+ Name: t(n.Code.Name),
329
+ Num: t(n.Code.Num),
330
+ NA: t(n.Code.NA),
331
+ GettingData: t(n.Code.GettingData),
332
+ Spill: t(n.Code.Spill),
333
+ Connect: t(n.Code.Connect),
334
+ Blocked: t(n.Code.Blocked),
335
+ Unknown: t(n.Code.Unknown),
336
+ Field: t(n.Code.Field),
337
+ Calc: t(n.Code.Calc),
338
+ Busy: t(n.Code.Busy),
339
+ Python: t(n.Code.Python),
340
+ Timeout: t(n.Code.Timeout)
341
+ }, e.newTypedError = (e, t, r) => {
342
+ let o;
343
+ return o = "string" == typeof e ? p.get(e) : h.get(e), o || (o = n.Unknown), new o(t, r);
344
+ }, e.getBuiltInByLabel = (e) => d.get(e), e.isError = function(e, t) {
345
+ return !!e && !0 === e.isFormulaError && (void 0 === t || e.getCode() === t);
346
+ };
347
+ })(n || (n = {}));
348
+ var C = class {
349
+ constructor(e) {
350
+ this._subscribeFn = e;
351
+ }
352
+ subscribe(e, t, r) {
353
+ const o = "object" == typeof e ? {
354
+ next: e.next || (() => {}),
355
+ error: e.error || (() => {}),
356
+ complete: e.complete || (() => {}),
357
+ unsubscribe: () => {}
358
+ } : {
359
+ next: e || (() => {}),
360
+ error: t || (() => {}),
361
+ complete: r || (() => {}),
362
+ unsubscribe: () => {}
363
+ }, n = this._subscribeFn(o);
364
+ return o.unsubscribe = () => {
365
+ "function" == typeof n && n();
366
+ }, o;
367
+ }
368
+ }, S = class {
369
+ createRange(e, t, r) {
370
+ throw new w();
371
+ }
372
+ getReference(e, t) {
373
+ throw new w();
374
+ }
375
+ getResizedReference(e, t, r) {
376
+ throw new w();
377
+ }
378
+ getNumberFormat(e, t) {
379
+ throw new w();
380
+ }
381
+ fromSerialDate(e, t) {
382
+ throw new w();
383
+ }
384
+ toSerialDate(e, t) {
385
+ throw new w();
386
+ }
387
+ getDateParts(e, t) {
388
+ throw new w();
389
+ }
390
+ getSerialDate(e, t, r, o, n, s, a) {
391
+ throw new w();
392
+ }
393
+ getNow() {
394
+ throw new w();
395
+ }
396
+ getValueAt(e, t, r, o) {
397
+ return null;
398
+ }
399
+ getEntireCoords() {
400
+ return f;
401
+ }
402
+ isValidDate(e, t) {
403
+ return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e) ? !isNaN(e.getTime()) : !t && "number" == typeof e && !(e < 0 || e > y);
404
+ }
405
+ getRow() {
406
+ return 0;
407
+ }
408
+ getColumn() {
409
+ return 0;
410
+ }
411
+ getFormulaAt(e, t, r) {
412
+ return null;
413
+ }
414
+ getSpillAt(e, t, r) {
415
+ return null;
416
+ }
417
+ getSheetIndex(e) {
418
+ return -1;
419
+ }
420
+ getSheetCount() {
421
+ return 1;
422
+ }
423
+ markVolatile() {}
424
+ formatResults(e) {}
425
+ filterHidden(e, t) {
426
+ return e;
427
+ }
428
+ filterTotals(e) {
429
+ return e;
430
+ }
431
+ getFunction(e) {
432
+ return null;
433
+ }
434
+ getAddress(e, t) {
435
+ throw new w();
436
+ }
437
+ parseAsSerialDate(e, t) {
438
+ throw new w();
439
+ }
440
+ parseAsDate(e, t) {
441
+ throw new w();
442
+ }
443
+ parseAsNumber(e, t) {
444
+ throw new w();
445
+ }
446
+ createCriteria(e) {
447
+ throw new w();
448
+ }
449
+ parseAsLiteral(e) {
450
+ const t = e.toUpperCase();
451
+ return "TRUE" === t || "FALSE" !== t && n.getBuiltInByLabel(t);
452
+ }
453
+ toText(e) {
454
+ return "string" == typeof e ? e : null == e ? "" : "boolean" == typeof e ? e ? "TRUE" : "FALSE" : e?.isFormulaError ? e.getLabel() : String(e);
455
+ }
456
+ compare(e, t, r) {
457
+ if (e === t) return 0;
458
+ const o = N(e), n = N(t);
459
+ return o !== n ? o < n ? -1 : 1 : e < t ? -1 : e > t ? 1 : 0;
460
+ }
461
+ getRuntime() {
462
+ return b;
463
+ }
464
+ }, N = (e) => {
465
+ if (null == e) return 0;
466
+ switch (typeof e) {
467
+ case "number": return 1;
468
+ case "string": return 2;
469
+ case "boolean": return 3;
470
+ default: return 4;
471
+ }
472
+ }, w = class extends Error {
473
+ constructor(e = "Not implemented in StubbedFormulaContext") {
474
+ super(e), this.name = "NotImplementedError";
475
+ }
476
+ }, f = Object.freeze({
477
+ colStart: 0,
478
+ rowStart: 0,
479
+ colEnd: Math.pow(2, 14) - 1,
480
+ rowEnd: Math.pow(2, 20) - 1
481
+ }), b = {
482
+ isDate1904: () => !1,
483
+ getLocale: () => _.tag,
484
+ getLocaleProfile: () => _,
485
+ isR1C1: () => !1,
486
+ getNow: () => 0,
487
+ getLocation: () => "unknown",
488
+ getVersion: () => "1.0.0",
489
+ getOS: () => "unknown",
490
+ getUser: () => "unidentified",
491
+ getDescription: () => "Stubbed Formula Context"
492
+ }, y = 2958465, D = new S(), A = class {
493
+ constructor() {
494
+ this._scope = D;
495
+ }
496
+ _setScope(e) {
497
+ this._scope = e ?? D;
498
+ }
499
+ _getScope() {
500
+ return this._scope;
501
+ }
502
+ getNumberFormat(e, t) {
503
+ return this._getScope().getNumberFormat(e, t);
504
+ }
505
+ getEntireCoords() {
506
+ return this._getScope().getEntireCoords() ?? f;
507
+ }
508
+ parseAsSerialDate(e, t) {
509
+ return this._getScope().parseAsSerialDate(e, t);
510
+ }
511
+ parseAsDate(e, t) {
512
+ return this._getScope().parseAsDate(e, t);
513
+ }
514
+ parseAsNumber(e, t) {
515
+ return this._getScope().parseAsNumber(e, t);
516
+ }
517
+ createCriteria(e) {
518
+ return this._getScope().createCriteria(e);
519
+ }
520
+ parseAsLiteral(e) {
521
+ const t = this._getScope();
522
+ return t.parseAsLiteral ? t.parseAsLiteral(e) : D.parseAsLiteral(e);
523
+ }
524
+ toText(e) {
525
+ return this._getScope().toText(e);
526
+ }
527
+ isValidDate(e, t = !1) {
528
+ return this._getScope().isValidDate(e, t);
529
+ }
530
+ fromSerialDate(e, t = !1) {
531
+ return this._getScope().fromSerialDate(e, t);
532
+ }
533
+ toSerialDate(e, t = !1) {
534
+ return this._getScope().toSerialDate(e, t);
535
+ }
536
+ getDateParts(e, t) {
537
+ return this._getScope().getDateParts(e, t);
538
+ }
539
+ getSerialDate(e, t, r, o = 0, n = 0, s = 0, a = 0) {
540
+ return this._getScope().getSerialDate(e, t, r, o, n, s, a);
541
+ }
542
+ getNow() {
543
+ return this._getScope().getNow();
544
+ }
545
+ createRange(e, t, r) {
546
+ return this._getScope().createRange(e, t, r);
547
+ }
548
+ getRow() {
549
+ return this._getScope().getRow?.() ?? 0;
550
+ }
551
+ getColumn() {
552
+ return this._getScope().getColumn?.() ?? 0;
553
+ }
554
+ getReference(e, t) {
555
+ return this._getScope().getReference(e, t);
556
+ }
557
+ getResizedReference(e, t, r) {
558
+ return this._getScope().getResizedReference(e, t, r);
559
+ }
560
+ getValueAt(e, t, r) {
561
+ return this._getScope().getValueAt(e, t, r);
562
+ }
563
+ getFormulaAt(e, t, r) {
564
+ return this._getScope().getFormulaAt?.(e, t, r) ?? null;
565
+ }
566
+ getSpillAt(e, t, r) {
567
+ return this._getScope().getSpillAt?.(e, t, r) ?? null;
568
+ }
569
+ getSheetIndex(e) {
570
+ return this._getScope().getSheetIndex?.(e) ?? -1;
571
+ }
572
+ getSheetCount() {
573
+ return this._getScope().getSheetCount?.() ?? 1;
574
+ }
575
+ markVolatile() {
576
+ this._getScope().markVolatile?.();
577
+ }
578
+ formatResults(e) {
579
+ this._getScope().formatResults?.(e);
580
+ }
581
+ filterHidden(e, t) {
582
+ return this._getScope().filterHidden?.(e, t) ?? e;
583
+ }
584
+ filterTotals(e) {
585
+ return this._getScope().filterTotals?.(e) ?? e;
586
+ }
587
+ getFunction(e) {
588
+ return this._getScope().getFunction?.(e) ?? null;
589
+ }
590
+ getAddress(e, t) {
591
+ return this._getScope().getAddress(e, t);
592
+ }
593
+ compare(e, t, r) {
594
+ return this._getScope().compare?.(e, t, r) ?? D.compare(e, t, r);
595
+ }
596
+ getRuntime() {
597
+ return this._getScope().getRuntime();
598
+ }
599
+ get [Symbol.toStringTag]() {
600
+ return "[FormulaContext]";
601
+ }
602
+ toString() {
603
+ return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
604
+ }
605
+ }, _ = Object.freeze({
606
+ tag: "en-US",
607
+ numberingSystem: "latn",
608
+ decimal: ".",
609
+ group: ",",
610
+ grouping: [3],
611
+ minusSign: "-",
612
+ percentSign: "%",
613
+ permilleSign: "‰",
614
+ currencyCode: "USD",
615
+ currencySymbol: "$",
616
+ currencyDisplay: "symbol",
617
+ currencyPosition: "before",
618
+ currencySpacing: "tight",
619
+ date: Object.freeze({
620
+ calendar: "gregory",
621
+ short: "M/d/yy",
622
+ medium: "MMM d, y",
623
+ long: "MMMM d, y",
624
+ timeShort: "h:mm a",
625
+ timeLong: "h:mm:ss a",
626
+ am: "AM",
627
+ pm: "PM",
628
+ firstDay: 0,
629
+ weekend: [6, 0],
630
+ monthsWide: [
631
+ "January",
632
+ "February",
633
+ "March",
634
+ "April",
635
+ "May",
636
+ "June",
637
+ "July",
638
+ "August",
639
+ "September",
640
+ "October",
641
+ "November",
642
+ "December"
643
+ ],
644
+ monthsAbbr: [
645
+ "Jan",
646
+ "Feb",
647
+ "Mar",
648
+ "Apr",
649
+ "May",
650
+ "Jun",
651
+ "Jul",
652
+ "Aug",
653
+ "Sep",
654
+ "Oct",
655
+ "Nov",
656
+ "Dec"
657
+ ],
658
+ weekdaysWide: [
659
+ "Sunday",
660
+ "Monday",
661
+ "Tuesday",
662
+ "Wednesday",
663
+ "Thursday",
664
+ "Friday",
665
+ "Saturday"
666
+ ],
667
+ weekdaysAbbr: [
668
+ "Sun",
669
+ "Mon",
670
+ "Tue",
671
+ "Wed",
672
+ "Thu",
673
+ "Fri",
674
+ "Sat"
675
+ ],
676
+ hour12: !0
677
+ }),
678
+ listSeparator: ",",
679
+ csvDelimiter: ",",
680
+ rtl: !1,
681
+ collator: Object.freeze({
682
+ sensitivity: "base",
683
+ numeric: !0
684
+ })
685
+ }), x = new A();
686
+ export { _ as DEFAULT_LOCALE_PROFILE, x as FormulaContext, n as FormulaError, t as IRange, o as IRangeStats, a as InteropScalarType, C as Observable, e as Scalar, s as ScalarType, A as ScopedFormulaContext, S as StubbedFormulaContext, u as WildCard };