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