@sheetxl/primitives 0.7.28-beta.4 → 0.8.0-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 +1 @@
1
- var e;Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),function(e){e.MAX_TEXT_LENGTH=32767;let t=e.MAX_SIGNIFICANT_DIGITS=15;e.truncateNumberText=function(e){let n=e.length;if(n<=t)return e;let r=0,i=null;for(let a=0;a<n;a++){let n=e.charCodeAt(a);if(n>=48&&n<=57){if(r===0&&n===48)continue;r++,r>t&&((i??=e.split(``))[a]=`0`)}else if((n===69||n===101)&&r>0)break}return i===null?e:i.join(``)}}(e||={});var t,n,r,i,a={Number:`number`,String:`string`,Boolean:`boolean`,Error:`error`,RichData:`richData`,Null:`null`},o={...a,Date:`date`},s=/[.*+?^${}()|[\]\\]/,c=e=>s.test(e)?`\\`+e:e,l={isWildCard:e=>typeof e==`string`&&/[*?]/.test(e),toRegex:(e,t,n=!1)=>{let r=``,i=e.length;for(let t=0;t<i;t++){let n=e[t];if(n===`~`){let n=e[t+1];n===`*`||n===`?`||n===`~`?(r+=c(n),t++):r+=`~`;continue}n===`*`?r+=`.*`:r+=n===`?`?`.`:c(n)}return RegExp(n?`^${r}$`:r,t)}};(n=t||={}).Axis={Column:`column`,Row:`row`},n.AxisSelection={...t.Axis,Both:`both`},n.Direction={Up:`up`,Down:`down`,Left:`left`,Right:`right`},(r||={}).Aggregate={Count:`count`,NumericalCount:`numericalCount`,Sum:`sum`,Average:`average`,StdDev:`stdDev`,PopulationStdDev:`stdDevP`,Variance:`var`,PopulationVariance:`varP`,Min:`min`,Max:`max`},function(e){let t=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},n=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!`};class r extends Error{constructor(e,t,n,r){super(n,r),this._label=t,this._code=e,this.details=r}static{this.code=i.Code.Unknown}get isFormulaError(){return!0}getLabel(){return this._label}getCode(){return this._code}equals(e){return!!e&&(this._code===e._code||this._code===e.code)}get[Symbol.toStringTag](){return`[FormulaError]`}toString(){return this._label}}e.Known=r;class a extends r{constructor(e,r){super(t.Parse,n.Parse,e,r)}static{this.code=i.Code.Parse}getDetails(){let e=this.details;return{line:e?.line??1,column:e?.column??1,offset:e?.offset??0,length:e?.length??0}}}e.Parse=a;class o extends r{constructor(e,r){super(t.Null,n.Null,e,r)}static{this.code=i.Code.Null}}e.Null=o;class s extends r{constructor(e,r){super(t.Div0,n.Div0,e,r)}static{this.code=i.Code.Div0}}e.Div0=s;class c extends r{constructor(e,r){super(t.Value,n.Value,e,r)}static{this.code=i.Code.Value}}e.Value=c;class l extends r{constructor(e,r){super(t.Ref,n.Ref,e,r)}static{this.code=i.Code.Ref}}e.Ref=l;class u extends r{constructor(e,r){super(t.Name,n.Name,e,r)}static{this.code=i.Code.Name}}e.Name=u;class d extends r{constructor(e,r){super(t.Num,n.Num,e,r)}static{this.code=i.Code.Num}}e.Num=d;class f extends r{constructor(e,r){super(t.NA,n.NA,e,r)}static{this.code=i.Code.NA}}e.NA=f;class p extends r{constructor(e,r){super(t.GettingData,n.GettingData,e,r)}static{this.code=i.Code.GettingData}}e.GettingData=p;class m extends r{constructor(e,r){super(t.Spill,n.Spill,e,r)}static{this.code=i.Code.Spill}}e.Spill=m;class h extends r{constructor(e,r){super(t.Connect,n.Connect,e,r)}static{this.code=i.Code.Connect}}e.Connect=h;class g extends r{constructor(e,r){super(t.Blocked,n.Blocked,e,r)}static{this.code=i.Code.Blocked}}e.Blocked=g;class _ extends r{constructor(e,r){super(t.Unknown,n.Unknown,e,r)}static{this.code=i.Code.Unknown}}e.Unknown=_;class v extends r{constructor(e,r){super(t.Field,n.Field,e,r)}static{this.code=i.Code.Field}}e.Field=v;class y extends r{constructor(e,r){super(t.Calc,n.Calc,e,r)}static{this.code=i.Code.Calc}}e.Calc=y;class b extends r{constructor(e,r){super(t.Busy,n.Busy,e,r)}static{this.code=i.Code.Busy}}e.Busy=b;class x extends r{constructor(e,r){super(t.Python,n.Python,e,r)}static{this.code=i.Code.Python}}e.Python=x;class S extends r{constructor(e,r){super(t.Timeout,n.Timeout,e,r)}static{this.code=i.Code.Timeout}}e.Timeout=S}(i||={});var u={};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;var d=new Map,f=new Map,p=new Map,m=new Map,h=Object.keys(u);for(let e=0;e<h.length;e++){let t=u[h[e]],n=new t;p.set(n.getLabel(),t),m.set(n.getCode(),t),d.set(n.getLabel(),n),f.set(n.getCode(),n)}(function(e){let t=e.getBuiltInByCode=e=>f.get(e);e.BuiltIn={Parse:t(i.Code.Parse),Null:t(i.Code.Null),Div0:t(i.Code.Div0),Value:t(i.Code.Value),Ref:t(i.Code.Ref),Name:t(i.Code.Name),Num:t(i.Code.Num),NA:t(i.Code.NA),GettingData:t(i.Code.GettingData),Spill:t(i.Code.Spill),Connect:t(i.Code.Connect),Blocked:t(i.Code.Blocked),Unknown:t(i.Code.Unknown),Field:t(i.Code.Field),Calc:t(i.Code.Calc),Busy:t(i.Code.Busy),Python:t(i.Code.Python),Timeout:t(i.Code.Timeout)},e.newTypedError=(e,t,n)=>{let r;return r=typeof e==`string`?p.get(e):m.get(e),r||=i.Unknown,new r(t,n)},e.getBuiltInByLabel=e=>d.get(e),e.isError=function(e,t){return!!e&&!0===e.isFormulaError&&(t===void 0||e.getCode()===t)}})(i||={});var g=class{createRange(e,t,n){throw new v}getReference(e,t){throw new v}getResizedReference(e,t,n){throw new v}getNumberFormat(e,t){throw new v}fromSerialDate(e,t){throw new v}toSerialDate(e,t){throw new v}getDateParts(e,t){throw new v}getSerialDate(e,t,n,r,i,a,o){throw new v}getNow(){throw new v}getValueAt(e,t,n,r){return null}getEntireCoords(){return y}isValidDate(e,t){return e instanceof Date||Object.prototype.toString.call(e)===`[object Date]`?!isNaN(e.getTime()):!t&&typeof e==`number`&&!(e<0||e>x)}getRow(){return 0}getColumn(){return 0}getFormulaAt(e,t,n){return null}getSpillAt(e,t,n){return null}getSheetIndex(e){return-1}getSheetCount(){return 1}markVolatile(){}formatResults(e){}filterHidden(e,t){return e}filterTotals(e){return e}getFunction(e){return null}getAddress(e,t){throw new v}parseAsSerialDate(e,t){throw new v}parseAsDate(e,t){throw new v}parseAsNumber(e,t){throw new v}createCriteria(e){throw new v}parseAsLiteral(e){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&i.getBuiltInByLabel(t)}toText(e){return typeof e==`string`?e:e==null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e?.isFormulaError?e.getLabel():String(e)}compare(e,t,n){if(e===t)return 0;let r=_(e),i=_(t);return r===i?e<t?-1:+(e>t):r<i?-1:1}getRuntime(){return b}},_=e=>{if(e==null)return 0;switch(typeof e){case`number`:return 1;case`string`:return 2;case`boolean`:return 3;default:return 4}},v=class extends Error{constructor(e=`Not implemented in StubbedFormulaContext`){super(e),this.name=`NotImplementedError`}},y=Object.freeze({colStart:0,rowStart:0,colEnd:2**14-1,rowEnd:2**20-1}),b={isDate1904:()=>!1,getLocale:()=>w.tag,getLocaleProfile:()=>w,isR1C1:()=>!1,getNow:()=>0,getLocation:()=>`unknown`,getVersion:()=>`1.0.0`,getOS:()=>`unknown`,getUser:()=>`unidentified`,getDescription:()=>`Stubbed Formula Context`},x=2958465,S=new g,C=class{constructor(){this._scope=S}_setScope(e){this._scope=e??S}_getScope(){return this._scope}getNumberFormat(e,t){return this._getScope().getNumberFormat(e,t)}getEntireCoords(){return this._getScope().getEntireCoords()??y}parseAsSerialDate(e,t){return this._getScope().parseAsSerialDate(e,t)}parseAsDate(e,t){return this._getScope().parseAsDate(e,t)}parseAsNumber(e,t){return this._getScope().parseAsNumber(e,t)}createCriteria(e){return this._getScope().createCriteria(e)}parseAsLiteral(e){let t=this._getScope();return t.parseAsLiteral?t.parseAsLiteral(e):S.parseAsLiteral(e)}toText(e){return this._getScope().toText(e)}isValidDate(e,t=!1){return this._getScope().isValidDate(e,t)}fromSerialDate(e,t=!1){return this._getScope().fromSerialDate(e,t)}toSerialDate(e,t=!1){return this._getScope().toSerialDate(e,t)}getDateParts(e,t){return this._getScope().getDateParts(e,t)}getSerialDate(e,t,n,r=0,i=0,a=0,o=0){return this._getScope().getSerialDate(e,t,n,r,i,a,o)}getNow(){return this._getScope().getNow()}createRange(e,t,n){return this._getScope().createRange(e,t,n)}getRow(){return this._getScope().getRow?.()??0}getColumn(){return this._getScope().getColumn?.()??0}getReference(e,t){return this._getScope().getReference(e,t)}getResizedReference(e,t,n){return this._getScope().getResizedReference(e,t,n)}getValueAt(e,t,n){return this._getScope().getValueAt(e,t,n)}getFormulaAt(e,t,n){return this._getScope().getFormulaAt?.(e,t,n)??null}getSpillAt(e,t,n){return this._getScope().getSpillAt?.(e,t,n)??null}getSheetIndex(e){return this._getScope().getSheetIndex?.(e)??-1}getSheetCount(){return this._getScope().getSheetCount?.()??1}markVolatile(){this._getScope().markVolatile?.()}formatResults(e){this._getScope().formatResults?.(e)}filterHidden(e,t){return this._getScope().filterHidden?.(e,t)??e}filterTotals(e){return this._getScope().filterTotals?.(e)??e}getFunction(e){return this._getScope().getFunction?.(e)??null}getAddress(e,t){return this._getScope().getAddress(e,t)}compare(e,t,n){return this._getScope().compare?.(e,t,n)??S.compare(e,t,n)}getRuntime(){return this._getScope().getRuntime()}get[Symbol.toStringTag](){return`[FormulaContext]`}toString(){return this._getScope()?.toString?.()??`{STUB SCOPE}`}},w=Object.freeze({tag:`en-US`,numberingSystem:`latn`,decimal:`.`,group:`,`,grouping:[3],minusSign:`-`,percentSign:`%`,permilleSign:`‰`,currencyCode:`USD`,currencySymbol:`$`,currencyDisplay:`symbol`,currencyPosition:`before`,currencySpacing:`tight`,date:Object.freeze({calendar:`gregory`,short:`M/d/yy`,medium:`MMM d, y`,long:`MMMM d, y`,timeShort:`h:mm a`,timeLong:`h:mm:ss a`,am:`AM`,pm:`PM`,firstDay:0,weekend:[6,0],monthsWide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthsAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],weekdaysWide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],weekdaysAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],hour12:!0}),listSeparator:`,`,csvDelimiter:`,`,rtl:!1,collator:Object.freeze({sensitivity:`base`,numeric:!0})}),T=new C;exports.DEFAULT_LOCALE_PROFILE=w,exports.FormulaContext=T,Object.defineProperty(exports,"FormulaError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"IRange",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"IRangeStats",{enumerable:!0,get:function(){return r}}),exports.InteropScalarType=o,exports.Observable=class{constructor(e){this._subscribeFn=e}subscribe(e,t,n){let r=typeof e==`object`?{next:e.next||(()=>{}),error:e.error||(()=>{}),complete:e.complete||(()=>{}),unsubscribe:()=>{}}:{next:e||(()=>{}),error:t||(()=>{}),complete:n||(()=>{}),unsubscribe:()=>{}},i=this._subscribeFn(r);return r.unsubscribe=()=>{typeof i==`function`&&i()},r}},Object.defineProperty(exports,"Scalar",{enumerable:!0,get:function(){return e}}),exports.ScalarType=a,exports.ScopedFormulaContext=C,exports.StubbedFormulaContext=g,exports.WildCard=l;
1
+ var e;Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),function(e){e.MAX_TEXT_LENGTH=32767;let t=e.MAX_SIGNIFICANT_DIGITS=15;e.truncateNumberText=function(e){let n=e.length;if(n<=t)return e;let r=0,i=null;for(let a=0;a<n;a++){let n=e.charCodeAt(a);if(n>=48&&n<=57){if(r===0&&n===48)continue;r++,r>t&&((i??=e.split(``))[a]=`0`)}else if((n===69||n===101)&&r>0)break}return i===null?e:i.join(``)}}(e||={});var t,n,r,i,a={Number:`number`,String:`string`,Boolean:`boolean`,Error:`error`,RichData:`richData`,Null:`null`},o={...a,Date:`date`},s={...a,Reference:`reference`,Array:`array`,Lambda:`lambda`,Omitted:`omitted`},c=/[.*+?^${}()|[\]\\]/,l=e=>c.test(e)?`\\`+e:e,u={isWildCard:e=>typeof e==`string`&&/[*?]/.test(e),toRegex:(e,t,n=!1)=>{let r=``,i=e.length;for(let t=0;t<i;t++){let n=e[t];if(n===`~`){let n=e[t+1];n!==`*`&&n!==`?`&&n!==`~`||(r+=l(n),t++);continue}n===`*`?r+=`[\\s\\S]*`:r+=n===`?`?`[\\s\\S]`:l(n)}return RegExp(n===`start`?`^${r}`:n?`^${r}$`:r,t)}};(n=t||={}).Axis={Column:`column`,Row:`row`},n.AxisSelection={...t.Axis,Both:`both`},n.Direction={Up:`up`,Down:`down`,Left:`left`,Right:`right`},(r||={}).Aggregate={Count:`count`,NumericalCount:`numericalCount`,Sum:`sum`,Average:`average`,StdDev:`stdDev`,PopulationStdDev:`stdDevP`,Variance:`var`,PopulationVariance:`varP`,Min:`min`,Max:`max`},function(e){let t=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},n=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!`};class r extends Error{constructor(e,t,n,r){super(n,r),this._label=t,this._code=e,this.details=r}static{this.code=i.Code.Unknown}get isFormulaError(){return!0}getLabel(){return this._label}getCode(){return this._code}equals(e){return!!e&&(this._code===e._code||this._code===e.code)}get[Symbol.toStringTag](){return`[FormulaError]`}toString(){return this._label}}e.Known=r;class a extends r{constructor(e,r){super(t.Parse,n.Parse,e,r)}static{this.code=i.Code.Parse}getDetails(){let e=this.details;return{line:e?.line??1,column:e?.column??1,offset:e?.offset??0,length:e?.length??0}}}e.Parse=a;class o extends r{constructor(e,r){super(t.Null,n.Null,e,r)}static{this.code=i.Code.Null}}e.Null=o;class s extends r{constructor(e,r){super(t.Div0,n.Div0,e,r)}static{this.code=i.Code.Div0}}e.Div0=s;class c extends r{constructor(e,r){super(t.Value,n.Value,e,r)}static{this.code=i.Code.Value}}e.Value=c;class l extends r{constructor(e,r){super(t.Ref,n.Ref,e,r)}static{this.code=i.Code.Ref}}e.Ref=l;class u extends r{constructor(e,r){super(t.Name,n.Name,e,r)}static{this.code=i.Code.Name}}e.Name=u;class d extends r{constructor(e,r){super(t.Num,n.Num,e,r)}static{this.code=i.Code.Num}}e.Num=d;class f extends r{constructor(e,r){super(t.NA,n.NA,e,r)}static{this.code=i.Code.NA}}e.NA=f;class p extends r{constructor(e,r){super(t.GettingData,n.GettingData,e,r)}static{this.code=i.Code.GettingData}}e.GettingData=p;class m extends r{constructor(e,r){super(t.Spill,n.Spill,e,r)}static{this.code=i.Code.Spill}}e.Spill=m;class h extends r{constructor(e,r){super(t.Connect,n.Connect,e,r)}static{this.code=i.Code.Connect}}e.Connect=h;class g extends r{constructor(e,r){super(t.Blocked,n.Blocked,e,r)}static{this.code=i.Code.Blocked}}e.Blocked=g;class _ extends r{constructor(e,r){super(t.Unknown,n.Unknown,e,r)}static{this.code=i.Code.Unknown}}e.Unknown=_;class v extends r{constructor(e,r){super(t.Field,n.Field,e,r)}static{this.code=i.Code.Field}}e.Field=v;class y extends r{constructor(e,r){super(t.Calc,n.Calc,e,r)}static{this.code=i.Code.Calc}}e.Calc=y;class b extends r{constructor(e,r){super(t.Busy,n.Busy,e,r)}static{this.code=i.Code.Busy}}e.Busy=b;class x extends r{constructor(e,r){super(t.Python,n.Python,e,r)}static{this.code=i.Code.Python}}e.Python=x;class S extends r{constructor(e,r){super(t.Timeout,n.Timeout,e,r)}static{this.code=i.Code.Timeout}}e.Timeout=S}(i||={});var d={};d[i.Code.Parse]=i.Parse,d[i.Code.Null]=i.Null,d[i.Code.Div0]=i.Div0,d[i.Code.Value]=i.Value,d[i.Code.Ref]=i.Ref,d[i.Code.Name]=i.Name,d[i.Code.Num]=i.Num,d[i.Code.NA]=i.NA,d[i.Code.GettingData]=i.GettingData,d[i.Code.Spill]=i.Spill,d[i.Code.Connect]=i.Connect,d[i.Code.Blocked]=i.Blocked,d[i.Code.Unknown]=i.Unknown,d[i.Code.Field]=i.Field,d[i.Code.Calc]=i.Calc,d[i.Code.Busy]=i.Busy,d[i.Code.Python]=i.Python,d[i.Code.Timeout]=i.Timeout;var f=new Map,p=new Map,m=new Map,h=new Map,g=Object.keys(d);for(let e=0;e<g.length;e++){let t=d[g[e]],n=new t;m.set(n.getLabel(),t),h.set(n.getCode(),t),f.set(n.getLabel(),n),p.set(n.getCode(),n)}(function(e){let t=e.getBuiltInByCode=e=>p.get(e);e.BuiltIn={Parse:t(i.Code.Parse),Null:t(i.Code.Null),Div0:t(i.Code.Div0),Value:t(i.Code.Value),Ref:t(i.Code.Ref),Name:t(i.Code.Name),Num:t(i.Code.Num),NA:t(i.Code.NA),GettingData:t(i.Code.GettingData),Spill:t(i.Code.Spill),Connect:t(i.Code.Connect),Blocked:t(i.Code.Blocked),Unknown:t(i.Code.Unknown),Field:t(i.Code.Field),Calc:t(i.Code.Calc),Busy:t(i.Code.Busy),Python:t(i.Code.Python),Timeout:t(i.Code.Timeout)},e.newTypedError=(e,t,n)=>{let r;return r=typeof e==`string`?m.get(e):h.get(e),r||=i.Unknown,new r(t,n)},e.getBuiltInByLabel=e=>f.get(e),e.isError=function(e,t){return!!e&&!0===e.isFormulaError&&(t===void 0||e.getCode()===t)}})(i||={});var _=class{createRange(e,t,n){throw new b}flattenAreas(e){throw new b}getReference(e,t){throw new b}getResizedReference(e,t,n){throw new b}getNumberFormat(e,t){throw new b}fromSerialDate(e,t){throw new b}toSerialDate(e,t){throw new b}getDateParts(e,t){throw new b}getSerialDate(e,t,n,r,i,a,o){throw new b}getNow(){throw new b}getRandom(){return Math.random()}getValueAt(e,t,n,r){return null}getEntireCoords(){return x}isValidDate(e,t){return e instanceof Date||Object.prototype.toString.call(e)===`[object Date]`?!isNaN(e.getTime()):!t&&typeof e==`number`&&!(e<0||e>C)}getRow(){return 0}getColumn(){return 0}isImplicitIntersect(){return!1}getFormulaAt(e,t,n){return null}getSpillAt(e,t,n){return null}getSheetIndex(e){return-1}getSheetCount(){return 1}markVolatile(){}formatResults(e){}filterHidden(e,t){return e}filterTotals(e){return e}getFunction(e){return null}getAddress(e,t){throw new b}parseAsSerialDate(e,t){throw new b}parseAsDate(e,t){throw new b}parseAsNumber(e,t){throw new b}createCriteria(e,t){throw new b}parseAsLiteral(e){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&i.getBuiltInByLabel(t)}toText(e){return typeof e==`string`?e:e==null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e?.isFormulaError?e.getLabel():String(e)}compare(e,t,n){if(e===t)return 0;let r=v(e),i=v(t);return r===i?e<t?-1:+(e>t):r<i?-1:1}getRuntime(){return S}getArgs(){throw new b(y)}},v=e=>{if(e==null)return 0;switch(typeof e){case`number`:return 1;case`string`:return 2;case`boolean`:return 3;default:return 4}},y=`FormulaContext.getArgs() is only valid while a function body is running`,b=class extends Error{constructor(e=`Not implemented in StubbedFormulaContext`){super(e),this.name=`NotImplementedError`}},x=Object.freeze({colStart:0,rowStart:0,colEnd:2**14-1,rowEnd:2**20-1}),S={isDate1904:()=>!1,getLocale:()=>E.tag,getLocaleProfile:()=>E,isR1C1:()=>!1,getNow:()=>0,getRandom:()=>Math.random(),getLocation:()=>`unknown`,getVersion:()=>`1.0.0`,getOS:()=>`unknown`,getUser:()=>`unidentified`,getDescription:()=>`Stubbed Formula Context`},C=2958465,w=new _,T=class{constructor(){this._scope=w,this._argsFn=null}_setScope(e){this._scope=e??w}_getScope(){return this._scope}_setArgsProvider(e){this._argsFn=e}getNumberFormat(e,t){return this._getScope().getNumberFormat(e,t)}getEntireCoords(){return this._getScope().getEntireCoords()??x}parseAsSerialDate(e,t){return this._getScope().parseAsSerialDate(e,t)}parseAsDate(e,t){return this._getScope().parseAsDate(e,t)}parseAsNumber(e,t){return this._getScope().parseAsNumber(e,t)}createCriteria(e,t){return this._getScope().createCriteria(e,t)}parseAsLiteral(e){let t=this._getScope();return t.parseAsLiteral?t.parseAsLiteral(e):w.parseAsLiteral(e)}toText(e){return this._getScope().toText(e)}isValidDate(e,t=!1){return this._getScope().isValidDate(e,t)}fromSerialDate(e,t=!1){return this._getScope().fromSerialDate(e,t)}toSerialDate(e,t=!1){return this._getScope().toSerialDate(e,t)}getDateParts(e,t){return this._getScope().getDateParts(e,t)}getSerialDate(e,t,n,r=0,i=0,a=0,o=0){return this._getScope().getSerialDate(e,t,n,r,i,a,o)}getNow(){return this._getScope().getNow()}getRandom(){return this._getScope().getRandom?.()??Math.random()}createRange(e,t,n){return this._getScope().createRange(e,t,n)}flattenAreas(e){if(!Array.isArray(e))return e;let t=[];for(let n=0;n<e.length;n++){let r=e[n],{rows:i,columns:a}=r.getShape();for(let e=0;e<i;e++)for(let n=0;n<a;n++)t.push(r.getValueAt(e,n))}return this.createRange(t.length,1,(e,n)=>t[n.rowIndex])}getRow(){return this._getScope().getRow?.()??0}getColumn(){return this._getScope().getColumn?.()??0}isImplicitIntersect(){return this._getScope().isImplicitIntersect?.()??!1}getReference(e,t){return this._getScope().getReference(e,t)}getResizedReference(e,t,n){return this._getScope().getResizedReference(e,t,n)}getValueAt(e,t,n){return this._getScope().getValueAt(e,t,n)}getFormulaAt(e,t,n){return this._getScope().getFormulaAt?.(e,t,n)??null}getSpillAt(e,t,n){return this._getScope().getSpillAt?.(e,t,n)??null}getSheetIndex(e){return this._getScope().getSheetIndex?.(e)??-1}getSheetCount(){return this._getScope().getSheetCount?.()??1}markVolatile(){this._getScope().markVolatile?.()}formatResults(e){this._getScope().formatResults?.(e)}filterHidden(e,t){return this._getScope().filterHidden?.(e,t)??e}filterTotals(e){return this._getScope().filterTotals?.(e)??e}getFunction(e){return this._getScope().getFunction?.(e)??null}getAddress(e,t){return this._getScope().getAddress(e,t)}compare(e,t,n){return this._getScope().compare?.(e,t,n)??w.compare(e,t,n)}getRuntime(){return this._getScope().getRuntime()}getArgs(){let e=this._argsFn,t=e?e():null;if(!t)throw new b(y);return t}get[Symbol.toStringTag](){return`[FormulaContext]`}toString(){return this._getScope()?.toString?.()??`{STUB SCOPE}`}},E=Object.freeze({tag:`en-US`,numberingSystem:`latn`,decimal:`.`,group:`,`,grouping:[3],minusSign:`-`,percentSign:`%`,permilleSign:`‰`,currencyCode:`USD`,currencySymbol:`$`,currencyDisplay:`symbol`,currencyPosition:`before`,currencySpacing:`tight`,date:Object.freeze({calendar:`gregory`,short:`M/d/yy`,medium:`MMM d, y`,long:`MMMM d, y`,timeShort:`h:mm a`,timeLong:`h:mm:ss a`,am:`AM`,pm:`PM`,firstDay:0,weekend:[6,0],monthsWide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthsAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],weekdaysWide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],weekdaysAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],hour12:!0}),listSeparator:`,`,csvDelimiter:`,`,rtl:!1,collator:Object.freeze({sensitivity:`base`,numeric:!0})}),D=new T;exports.DEFAULT_LOCALE_PROFILE=E,exports.FormulaContext=D,Object.defineProperty(exports,"FormulaError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"IRange",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"IRangeStats",{enumerable:!0,get:function(){return r}}),exports.InteropScalarType=o,exports.Observable=class{constructor(e){this._subscribeFn=e}subscribe(e,t,n){let r=typeof e==`object`?{next:e.next||(()=>{}),error:e.error||(()=>{}),complete:e.complete||(()=>{}),unsubscribe:()=>{}}:{next:e||(()=>{}),error:t||(()=>{}),complete:n||(()=>{}),unsubscribe:()=>{}},i=this._subscribeFn(r);return r.unsubscribe=()=>{typeof i==`function`&&i()},r}},Object.defineProperty(exports,"Scalar",{enumerable:!0,get:function(){return e}}),exports.ScalarType=a,exports.ScopedFormulaContext=T,exports.StubbedFormulaContext=_,exports.ValueKind=s,exports.WildCard=u,exports.isLazyValue=e=>typeof e==`object`&&!!e&&!0===e.isLazy;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.7.28-beta.4
2
+ * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.2
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -32,7 +32,13 @@ var t, n, r, i, a = {
32
32
  }, o = {
33
33
  ...a,
34
34
  Date: "date"
35
- }, s = /[.*+?^${}()|[\]\\]/, c = (e) => s.test(e) ? "\\" + e : e, l = {
35
+ }, s = {
36
+ ...a,
37
+ Reference: "reference",
38
+ Array: "array",
39
+ Lambda: "lambda",
40
+ Omitted: "omitted"
41
+ }, c = /[.*+?^${}()|[\]\\]/, l = (e) => c.test(e) ? "\\" + e : e, u = {
36
42
  isWildCard: (e) => typeof e == "string" && /[*?]/.test(e),
37
43
  toRegex: (e, t, n = !1) => {
38
44
  let r = "", i = e.length;
@@ -40,14 +46,14 @@ var t, n, r, i, a = {
40
46
  let n = e[t];
41
47
  if (n === "~") {
42
48
  let n = e[t + 1];
43
- n === "*" || n === "?" || n === "~" ? (r += c(n), t++) : r += "~";
49
+ n !== "*" && n !== "?" && n !== "~" || (r += l(n), t++);
44
50
  continue;
45
51
  }
46
- n === "*" ? r += ".*" : r += n === "?" ? "." : c(n);
52
+ n === "*" ? r += "[\\s\\S]*" : r += n === "?" ? "[\\s\\S]" : l(n);
47
53
  }
48
- return RegExp(n ? `^${r}$` : r, t);
54
+ return RegExp(n === "start" ? `^${r}` : n ? `^${r}$` : r, t);
49
55
  }
50
- };
56
+ }, d = (e) => typeof e == "object" && !!e && !0 === e.isLazy;
51
57
  (n = t ||= {}).Axis = {
52
58
  Column: "column",
53
59
  Row: "row"
@@ -309,15 +315,15 @@ var t, n, r, i, a = {
309
315
  }
310
316
  e.Timeout = S;
311
317
  }(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
+ var f = {};
319
+ f[i.Code.Parse] = i.Parse, f[i.Code.Null] = i.Null, f[i.Code.Div0] = i.Div0, f[i.Code.Value] = i.Value, f[i.Code.Ref] = i.Ref, f[i.Code.Name] = i.Name, f[i.Code.Num] = i.Num, f[i.Code.NA] = i.NA, f[i.Code.GettingData] = i.GettingData, f[i.Code.Spill] = i.Spill, f[i.Code.Connect] = i.Connect, f[i.Code.Blocked] = i.Blocked, f[i.Code.Unknown] = i.Unknown, f[i.Code.Field] = i.Field, f[i.Code.Calc] = i.Calc, f[i.Code.Busy] = i.Busy, f[i.Code.Python] = i.Python, f[i.Code.Timeout] = i.Timeout;
320
+ var p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = Object.keys(f);
321
+ for (let e = 0; e < _.length; e++) {
322
+ let t = f[_[e]], n = new t();
323
+ h.set(n.getLabel(), t), g.set(n.getCode(), t), p.set(n.getLabel(), n), m.set(n.getCode(), n);
318
324
  }
319
325
  (function(e) {
320
- let t = e.getBuiltInByCode = (e) => f.get(e);
326
+ let t = e.getBuiltInByCode = (e) => m.get(e);
321
327
  e.BuiltIn = {
322
328
  Parse: t(i.Code.Parse),
323
329
  Null: t(i.Code.Null),
@@ -339,12 +345,12 @@ for (let e = 0; e < h.length; e++) {
339
345
  Timeout: t(i.Code.Timeout)
340
346
  }, e.newTypedError = (e, t, n) => {
341
347
  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) {
348
+ return r = typeof e == "string" ? h.get(e) : g.get(e), r ||= i.Unknown, new r(t, n);
349
+ }, e.getBuiltInByLabel = (e) => p.get(e), e.isError = function(e, t) {
344
350
  return !!e && !0 === e.isFormulaError && (t === void 0 || e.getCode() === t);
345
351
  };
346
352
  })(i ||= {});
347
- var g = class {
353
+ var v = class {
348
354
  constructor(e) {
349
355
  this._subscribeFn = e;
350
356
  }
@@ -364,42 +370,48 @@ var g = class {
364
370
  typeof i == "function" && i();
365
371
  }, r;
366
372
  }
367
- }, _ = class {
373
+ }, y = class {
368
374
  createRange(e, t, n) {
369
- throw new y();
375
+ throw new S();
376
+ }
377
+ flattenAreas(e) {
378
+ throw new S();
370
379
  }
371
380
  getReference(e, t) {
372
- throw new y();
381
+ throw new S();
373
382
  }
374
383
  getResizedReference(e, t, n) {
375
- throw new y();
384
+ throw new S();
376
385
  }
377
386
  getNumberFormat(e, t) {
378
- throw new y();
387
+ throw new S();
379
388
  }
380
389
  fromSerialDate(e, t) {
381
- throw new y();
390
+ throw new S();
382
391
  }
383
392
  toSerialDate(e, t) {
384
- throw new y();
393
+ throw new S();
385
394
  }
386
395
  getDateParts(e, t) {
387
- throw new y();
396
+ throw new S();
388
397
  }
389
398
  getSerialDate(e, t, n, r, i, a, o) {
390
- throw new y();
399
+ throw new S();
391
400
  }
392
401
  getNow() {
393
- throw new y();
402
+ throw new S();
403
+ }
404
+ getRandom() {
405
+ return Math.random();
394
406
  }
395
407
  getValueAt(e, t, n, r) {
396
408
  return null;
397
409
  }
398
410
  getEntireCoords() {
399
- return b;
411
+ return C;
400
412
  }
401
413
  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);
414
+ return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]" ? !isNaN(e.getTime()) : !t && typeof e == "number" && !(e < 0 || e > T);
403
415
  }
404
416
  getRow() {
405
417
  return 0;
@@ -407,6 +419,9 @@ var g = class {
407
419
  getColumn() {
408
420
  return 0;
409
421
  }
422
+ isImplicitIntersect() {
423
+ return !1;
424
+ }
410
425
  getFormulaAt(e, t, n) {
411
426
  return null;
412
427
  }
@@ -431,19 +446,19 @@ var g = class {
431
446
  return null;
432
447
  }
433
448
  getAddress(e, t) {
434
- throw new y();
449
+ throw new S();
435
450
  }
436
451
  parseAsSerialDate(e, t) {
437
- throw new y();
452
+ throw new S();
438
453
  }
439
454
  parseAsDate(e, t) {
440
- throw new y();
455
+ throw new S();
441
456
  }
442
457
  parseAsNumber(e, t) {
443
- throw new y();
458
+ throw new S();
444
459
  }
445
- createCriteria(e) {
446
- throw new y();
460
+ createCriteria(e, t) {
461
+ throw new S();
447
462
  }
448
463
  parseAsLiteral(e) {
449
464
  let t = e.toUpperCase();
@@ -454,13 +469,16 @@ var g = class {
454
469
  }
455
470
  compare(e, t, n) {
456
471
  if (e === t) return 0;
457
- let r = v(e), i = v(t);
472
+ let r = b(e), i = b(t);
458
473
  return r === i ? e < t ? -1 : +(e > t) : r < i ? -1 : 1;
459
474
  }
460
475
  getRuntime() {
461
- return x;
476
+ return w;
477
+ }
478
+ getArgs() {
479
+ throw new S(x);
462
480
  }
463
- }, v = (e) => {
481
+ }, b = (e) => {
464
482
  if (e == null) return 0;
465
483
  switch (typeof e) {
466
484
  case "number": return 1;
@@ -468,41 +486,45 @@ var g = class {
468
486
  case "boolean": return 3;
469
487
  default: return 4;
470
488
  }
471
- }, y = class extends Error {
489
+ }, x = "FormulaContext.getArgs() is only valid while a function body is running", S = class extends Error {
472
490
  constructor(e = "Not implemented in StubbedFormulaContext") {
473
491
  super(e), this.name = "NotImplementedError";
474
492
  }
475
- }, b = Object.freeze({
493
+ }, C = Object.freeze({
476
494
  colStart: 0,
477
495
  rowStart: 0,
478
496
  colEnd: 2 ** 14 - 1,
479
497
  rowEnd: 2 ** 20 - 1
480
- }), x = {
498
+ }), w = {
481
499
  isDate1904: () => !1,
482
- getLocale: () => T.tag,
483
- getLocaleProfile: () => T,
500
+ getLocale: () => O.tag,
501
+ getLocaleProfile: () => O,
484
502
  isR1C1: () => !1,
485
503
  getNow: () => 0,
504
+ getRandom: () => Math.random(),
486
505
  getLocation: () => "unknown",
487
506
  getVersion: () => "1.0.0",
488
507
  getOS: () => "unknown",
489
508
  getUser: () => "unidentified",
490
509
  getDescription: () => "Stubbed Formula Context"
491
- }, S = 2958465, C = new _(), w = class {
510
+ }, T = 2958465, E = new y(), D = class {
492
511
  constructor() {
493
- this._scope = C;
512
+ this._scope = E, this._argsFn = null;
494
513
  }
495
514
  _setScope(e) {
496
- this._scope = e ?? C;
515
+ this._scope = e ?? E;
497
516
  }
498
517
  _getScope() {
499
518
  return this._scope;
500
519
  }
520
+ _setArgsProvider(e) {
521
+ this._argsFn = e;
522
+ }
501
523
  getNumberFormat(e, t) {
502
524
  return this._getScope().getNumberFormat(e, t);
503
525
  }
504
526
  getEntireCoords() {
505
- return this._getScope().getEntireCoords() ?? b;
527
+ return this._getScope().getEntireCoords() ?? C;
506
528
  }
507
529
  parseAsSerialDate(e, t) {
508
530
  return this._getScope().parseAsSerialDate(e, t);
@@ -513,12 +535,12 @@ var g = class {
513
535
  parseAsNumber(e, t) {
514
536
  return this._getScope().parseAsNumber(e, t);
515
537
  }
516
- createCriteria(e) {
517
- return this._getScope().createCriteria(e);
538
+ createCriteria(e, t) {
539
+ return this._getScope().createCriteria(e, t);
518
540
  }
519
541
  parseAsLiteral(e) {
520
542
  let t = this._getScope();
521
- return t.parseAsLiteral ? t.parseAsLiteral(e) : C.parseAsLiteral(e);
543
+ return t.parseAsLiteral ? t.parseAsLiteral(e) : E.parseAsLiteral(e);
522
544
  }
523
545
  toText(e) {
524
546
  return this._getScope().toText(e);
@@ -541,15 +563,30 @@ var g = class {
541
563
  getNow() {
542
564
  return this._getScope().getNow();
543
565
  }
566
+ getRandom() {
567
+ return this._getScope().getRandom?.() ?? Math.random();
568
+ }
544
569
  createRange(e, t, n) {
545
570
  return this._getScope().createRange(e, t, n);
546
571
  }
572
+ flattenAreas(e) {
573
+ if (!Array.isArray(e)) return e;
574
+ let t = [];
575
+ for (let n = 0; n < e.length; n++) {
576
+ let r = e[n], { rows: i, columns: a } = r.getShape();
577
+ for (let e = 0; e < i; e++) for (let n = 0; n < a; n++) t.push(r.getValueAt(e, n));
578
+ }
579
+ return this.createRange(t.length, 1, (e, n) => t[n.rowIndex]);
580
+ }
547
581
  getRow() {
548
582
  return this._getScope().getRow?.() ?? 0;
549
583
  }
550
584
  getColumn() {
551
585
  return this._getScope().getColumn?.() ?? 0;
552
586
  }
587
+ isImplicitIntersect() {
588
+ return this._getScope().isImplicitIntersect?.() ?? !1;
589
+ }
553
590
  getReference(e, t) {
554
591
  return this._getScope().getReference(e, t);
555
592
  }
@@ -590,18 +627,23 @@ var g = class {
590
627
  return this._getScope().getAddress(e, t);
591
628
  }
592
629
  compare(e, t, n) {
593
- return this._getScope().compare?.(e, t, n) ?? C.compare(e, t, n);
630
+ return this._getScope().compare?.(e, t, n) ?? E.compare(e, t, n);
594
631
  }
595
632
  getRuntime() {
596
633
  return this._getScope().getRuntime();
597
634
  }
635
+ getArgs() {
636
+ let e = this._argsFn, t = e ? e() : null;
637
+ if (!t) throw new S(x);
638
+ return t;
639
+ }
598
640
  get [Symbol.toStringTag]() {
599
641
  return "[FormulaContext]";
600
642
  }
601
643
  toString() {
602
644
  return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
603
645
  }
604
- }, T = Object.freeze({
646
+ }, O = Object.freeze({
605
647
  tag: "en-US",
606
648
  numberingSystem: "latn",
607
649
  decimal: ".",
@@ -681,5 +723,5 @@ var g = class {
681
723
  sensitivity: "base",
682
724
  numeric: !0
683
725
  })
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 };
726
+ }), k = new D();
727
+ export { O as DEFAULT_LOCALE_PROFILE, k as FormulaContext, i as FormulaError, t as IRange, r as IRangeStats, o as InteropScalarType, v as Observable, e as Scalar, a as ScalarType, D as ScopedFormulaContext, y as StubbedFormulaContext, s as ValueKind, u as WildCard, d as isLazyValue };