PageSourceSearch

https://smartguys.ai/_next/static/chunks/2355.2f9e71f7c739fdb9.js

js smartguys.ai collected 2026-10-05 15:07:24 UTC 21,007 bytes, 3 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2355],{13292:(e,t,r)=>{let o=r(99859),{Address:n}=r(82228),{Prefix:i,Postfix:a,Infix:s,Operators:l}=r(95972),u=r(58340),{NotAllInputParsedException:h}=r(60187);class c{constructor(e){this.context=e}columnNameToNumber(e){return n.columnNameToNumber(e)}parseCellAddress(e){let t=e.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);return{ref:{address:t[0],col:this.columnNameToNumber(t[2]),row:+t[4]}}}parseRow(e){if(!Number.isInteger(+e))throw Error("Row number must be integer.");return{ref:{col:void 0,row:+e}}}parseCol(e){return{ref:{col:this.columnNameToNumber(e),row:void 0}}}parseColRange(e,t){return e=this.columnNameToNumber(e),t=this.columnNameToNumber(t),{ref:{from:{col:Math.min(e,t),row:null},to:{col:Math.max(e,t),row:null}}}}parseRowRange(e,t){return{ref:{from:{col:null,row:Math.min(e,t)},to:{col:null,row:Math.max(e,t)}}}}_applyPrefix(e,t,r){return this.isFormulaError(t)?t:i.unaryOp(e,t,r)}async applyPrefixAsync(e,t){let{val:r,isArray:o}=this.extractRefValue(await t);return this._applyPrefix(e,r,o)}applyPrefix(e,t){if(this.context.async)return this.applyPrefixAsync(e,t);{let{val:r,isArray:o}=this.extractRefValue(t);return this._applyPrefix(e,r,o)}}_applyPostfix(e,t,r){return this.isFormulaError(e)?e:a.percentOp(e,r,t)}async applyPostfixAsync(e,t){let{val:r,isArray:o}=this.extractRefValue(await e);return this._applyPostfix(r,o,t)}
1applyPostfix(e,t){if(this.context.async)return this.applyPostfixAsync(e,t);{let{val:r,isArray:o}=this.extractRefValue(e);return this._applyPostfix(r,o,t)}}_applyInfix(e,t,r){let o=e.val,n=e.isArray,i=r.val,a=r.isArray;if(this.isFormulaError(o))return o;if(this.isFormulaError(i))return i;if(l.compareOp.includes(t))return s.compareOp(o,t,i,n,a);if(l.concatOp.includes(t))return s.concatOp(o,t,i,n,a);if(l.mathOp.includes(t))return s.mathOp(o,t,i,n,a);throw Error(`Unrecognized infix: ${t}`)}async applyInfixAsync(e,t,r){let o=this.extractRefValue(await e),n=this.extractRefValue(await r);return this._applyInfix(o,t,n)}applyInfix(e,t,r){if(this.context.async)return this.applyInfixAsync(e,t,r);{let o=this.extractRefValue(e),n=this.extractRefValue(r);return this._applyInfix(o,t,n)}}applyIntersect(e){let t,r,n,i,a,s,l;if(this.isFormulaError(e[0]))return e[0];if(!e[0].ref)throw Error(`Expecting a reference, but got ${e[0]}.`);let u=e.shift().ref;if(a=u.sheet,u.from)t=Math.max(u.from.row,u.to.row),n=Math.min(u.from.row,u.to.row),r=Math.max(u.from.col,u.to.col),i=Math.min(u.from.col,u.to.col);else{if(void 0===u.row||void 0===u.col)throw Error("Cannot intersect the whole row or column.");t=n=u.row,r=i=u.col}return(e.forEach(e=>{if(this.isFormulaError(e))return e;if(!(e=e.ref))throw Error(`Expecting a reference, but got ${e}.`);if(e.from){let s=Math.max(e.from.row,e.to.row),u=Math.min(e.from.row,e.to.row),h=Math.max(e.from.col,e.to.col),c=Math.min(e.from.col,e.to.col);(u>t||s<n||c>r||h<i||a!==e.sheet)&&(l=o.NULL),t=Math.min(t,s),n=Math.max(n,u),r=Math.min(r,h),i=Math.max(i,c)}else{if(void 0===e.row||void 0===e.col)throw Error("Cannot intersect the whole row or column.");(e.row>t||e.row<n||e.col>r||e.col<i||a!==e.sheet)&&(l=o.NULL),t=n=e.row,r=i=e.col}}),l)?l:((s=t===n&&r===i?{ref:{sheet:a,row:t,col:r}}:{ref:{sheet:a,from:{row:n,col:i},to:{row:t,col:r}}}).ref.sheet||delete s.ref.sheet,s)}applyUnion(e){let t=new u;for(let r=0;r<e.length;r++){if(this.isFormulaError(e[r]))return e[r];t.add(this.extractRefValue(e[r]).val,e[r])}return t}applyRange(e){let t,r=-1,o=-1,n=1048577,i=16385;return e.forEach(e=>{if(this.isFormulaError(e))return e;"number"==typeof e&&(e=this.parseRow(e)),void 0===(e=e.ref).row&&(n=1,r=1048576),void 0===e.col&&(i=1,o=16384),e.row>r&&(r=e.row),e.row<n&&(n=e.row),e.col>o&&(o=e.col),e.col<i&&(i=e.col)}),r===n&&o===i?{ref:{row:r,col:o}}:{ref:{from:{row:n,col:i},to:{row:r,col:o}}}}extractRefValue(e){let t=!1;return(Array.isArray(e)&&(t=!0),e.ref)?{val:this.context.retrieveRef(e),isArray:t}:{val:e,isArray:t}}toArray(e){return e}toNumber(e){return Number(e)}toString(e){return e.substring(1,e.length-1).replace(/""/g,'"')}toBoolean(e){return"TRUE"===e}toError(e){return new o(e.toUpperCase())}isFormulaError(e){return e instanceof o}static formatChevrotainError(e,t){let r,n,i="";return e instanceof h?(r=e.token.startLine,n=e.token.startColumn):(r=e.previousToken.startLine,n=e.previousToken.startColumn+1),i+="\n"+t.split("\n")[r-1]+"\n"+Array(n-1).fill(" ").join("")+"^\n"+`Error at position ${r}:${n}
2`+e.message,e.errorLocation={line:r,column:n},o.ERROR(i,e)}}
2e.exports=c},15672:(e,t,r)=>{let o=r(99859),{FormulaHelpers:n,Types:i,Address:a}=r(82228),{Prefix:s,Postfix:l,Infix:u,Operators:h}=r(95972),c=r(58340);class f{constructor(e){this.context=e}columnNameToNumber(e){return a.columnNameToNumber(e)}parseCellAddress(e){let t=e.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);return{ref:{col:this.columnNameToNumber(t[2]),row:+t[4]}}}parseRow(e){if(!Number.isInteger(+e))throw Error("Row number must be integer.");return{ref:{col:void 0,row:+e}}}parseCol(e){return{ref:{col:this.columnNameToNumber(e),row:void 0}}}applyPrefix(e,t){return this.extractRefValue(t),0}applyPostfix(e,t){return this.extractRefValue(e),0}applyInfix(e,t,r){return this.extractRefValue(e),this.extractRefValue(r),0}applyIntersect(e){let t,r,n,i,a,s,l;if(this.isFormulaError(e[0]))return e[0];if(!e[0].ref)throw Error(`Expecting a reference, but got ${e[0]}.`);let u=e.shift().ref;if(a=u.sheet,u.from)t=Math.max(u.from.row,u.to.row),n=Math.min(u.from.row,u.to.row),r=Math.max(u.from.col,u.to.col),i=Math.min(u.from.col,u.to.col);else{if(void 0===u.row||void 0===u.col)throw Error("Cannot intersect the whole row or column.");t=n=u.row,r=i=u.col}return(e.forEach(e=>{if(this.isFormulaError(e))return e;if(!(e=e.ref))throw Error(`Expecting a reference, but got ${e}.`);if(e.from){let s=Math.max(e.from.row,e.to.row),u=Math.min(e.from.row,e.to.row),h=Math.max(e.from.col,e.to.col),c=Math.min(e.from.col,e.to.col);(u>t||s<n||c>r||h<i||a!==e.sheet)&&(l=o.NULL),t=Math.min(t,s),n=Math.max(n,u),r=Math.min(r,h),i=Math.max(i,c)}else{if(void 0===e.row||void 0===e.col)throw Error("Cannot intersect the whole row or column.");(e.row>t||e.row<n||e.col>r||e.col<i||a!==e.sheet)&&(l=o.NULL),t=n=e.row,r=i=e.col}}),l)?l:((s=t===n&&r===i?{ref:{sheet:a,row:t,col:r}}:{ref:{sheet:a,from:{row:n,col:i},to:{row:t,col:r}}}).ref.sheet||delete s.ref.sheet,s)}applyUnion(e){let t=new c;for(let r=0;r<e.length;r++){if(this.isFormulaError(e[r]))return e[r];t.add(this.extractRefValue(e[r]).val,e[r])}return t}applyRange(e){let t,r=-1,o=-1,n=1048577,i=16385;return e.forEach(e=>{if(this.isFormulaError(e))return e;"number"==typeof e&&(e=this.parseRow(e)),void 0===(e=e.ref).row&&(n=1,r=1048576),void 0===e.col&&(i=1,o=16384),e.row>r&&(r=e.row),e.row<n&&(n=e.row),e.col>o&&(o=e.col),e.col<i&&(i=e.col)}),r===n&&o===i?{ref:{row:r,col:o}}:{ref:{from:{row:n,col:i},to:{row:r,col:o}}}}extractRefValue(e){let t=Array.isArray(e);return e.ref?{val:this.context.retrieveRef(e),isArray:t}:{val:e,isArray:t}}toArray(e){return e}toNumber(e){return Number(e)}toString(e){return e.substring(1,e.length-1).replace(/""/g,'"')}toBoolean(e){return"TRUE"===e}toError(e){return new o(e.toUpperCase())}isFormulaError(e){return e instanceof o}}e.exports=f},25600:(e,t,r)=>{let{createToken:o,Lexer:n}=r(60187),i=r(99859),a={},s=o({name:"WhiteSpace",pattern:/\s+/,group:n.SKIPPED}),l=o({name:"String",pattern:/"(""|[^"])*"/}),u=o({name:"SingleQuotedString",pattern:/'(''|[^'])*'/}),h=o({name:"SheetQuoted",pattern:/'((?![\\\/\[\]*?:]).)+?'!/}),c=o({name:"Function",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\(/}),f=o({name:"FormulaErrorT",pattern:/#NULL!|#DIV\/0!|#VALUE!|#NAME\?|#NUM!|#N\/A/}),m=o({name:"RefError",pattern:/#REF!/}),p=o({name:"Name",pattern:/[a-zA-Z_][a-zA-Z0-9_.?]*/}),E=o({name:"Sheet",pattern:/[A-Za-z_.\d\u007F-\uFFFF]+!/}),O=o({name:"Cell",pattern:/[$]?[A-Za-z]{1,3}[$]?[1-9][0-9]*/,longer_alt:p}),N=o({name:"Number",pattern:/[0-9]+[.]?[0-9]*([eE][+\-][0-9]+)?/}),R=o({name:"Boolean",pattern:/TRUE|FALSE/i}),A=o({name:"Column",pattern:/[$]?[A-Za-z]{1,3}/,longer_alt:p}),g=o({name:"At",pattern:/@/}),U=o({name:"Comma",pattern:/,/}),w=o({name:"Colon",pattern:/:/}),C=o({name:"Semicolon",pattern:/;/}),y=o({name:"OpenParen",pattern:/\(/}),L=o({name:"CloseParen",pattern:/\)/}),x=o({name:"OpenSquareParen",pattern:/\[/}),M=o({name:"CloseSquareParen",pattern:/]/});o({name:"exclamationMark",pattern:/!/});let T=o({name:"OpenCurlyParen",pattern:/{/}),d=o({name:"CloseCurlyParen",pattern:/}/}),S=o({name:"QuoteS",pattern:/'/}),b=o({name:"MulOp",pattern:/\*/}),I=o({name:"PlusOp",pattern:/\+/}),v=o({name:"DivOp",pattern:/\//}),F=o({name:"MinOp",pattern:/-/}),P=o({name:"ConcatOp",pattern:/&/}),V=o({name:"ExOp",pattern:/\^/}),B=o({name:"PercentOp",pattern:/%/}),_=o({name:"GtOp",pattern:/>/}),k=o({name:"EqOp",pattern:/=/}),W=o({name:"LtOp",pattern:/</}),j=o({name:"NeqOp",pattern:/<>/}),$=[s,l,h,u,c,f,m,E,O,R,A,p,N,g,U,w,C,y,L,x,M,T,d,S,b,I,v,F,P,V,b,B,j,o({name:"GteOp",pattern:/>=/}),o({name:"LteOp",pattern:/<=/}),_,k,W],D=new n($,{ensureOptimizations:!0});
2$.forEach(e=>{a[e.name]=e}),e.exports={tokenVocabulary:a,lex:function(e){let t=D.tokenize(e);if(t.errors.length>0){let r=t.errors[0],o=r.line,n=r.column,a="\n"+e.split("\n")[o-1]+"\n";throw r.message=(a+=Array(n-1).fill(" ").join("")+"^\n")+`Error at position ${o}:${n}
3`+r.message,r.errorLocation={line:o,column:n},i.ERROR(r.message,r)}return t}}},52355:(e,t,r)=>{let{FormulaParser:o}=r(89789),{DepParser:n}=r(79633);Object.assign(o,{MAX_ROW:1048576,MAX_COLUMN:16384,SSF:r(83088),DepParser:n,FormulaError:r(99859),...r(82228)}),e.exports=o},58340:e=>{class t{constructor(e,t){if(null==e&&null==t)this._data=[],this._refs=[];else{if(e.length!==t.length)throw Error("Collection: data length should match references length.");this._data=e,this._refs=t}}get data(){return this._data}get refs(){return this._refs}get length(){return this._data.length}add(e,t){this._data.push(e),this._refs.push(t)}}e.exports=t},79633:(e,t,r)=>{let o=r(99859),{FormulaHelpers:n}=r(82228),{Parser:i}=r(87481),a=r(25600),s=r(15672),{formatChevrotainError:l}=r(13292);class u{constructor(e){this.data=[],this.utils=new s(this),e=Object.assign({onVariable:()=>null},e),this.utils=new s(this),this.onVariable=e.onVariable,this.functions={},this.parser=new i(this,this.utils)}getCell(e){return null!=e.row&&(null==e.sheet&&(e.sheet=this.position?this.position.sheet:void 0),-1===this.data.findIndex(t=>t.from&&t.from.row<=e.row&&t.to.row>=e.row&&t.from.col<=e.col&&t.to.col>=e.col||t.row===e.row&&t.col===e.col&&t.sheet===e.sheet)&&this.data.push(e)),0}getRange(e){return null!=e.from.row&&(null==e.sheet&&(e.sheet=this.position?this.position.sheet:void 0),-1===this.data.findIndex(t=>t.from&&t.from.row===e.from.row&&t.from.col===e.from.col&&t.to.row===e.to.row&&t.to.col===e.to.col)&&this.data.push(e)),[[0]]}getVariable(e){let t={ref:this.onVariable(e,this.position.sheet)};return null==t.ref?o.NAME:(n.isCellRef(t)?this.getCell(t.ref):this.getRange(t.ref),0)}retrieveRef(e){return n.isRangeRef(e)?this.getRange(e.ref):n.isCellRef(e)?this.getCell(e.ref):e}callFunction(e,t){return t.forEach(e=>{null!=e&&this.retrieveRef(e)}),{value:0,ref:{}}}checkFormulaResult(e){this.retrieveRef(e)}parse(e,t,r=!1){if(0===e.length)throw Error("Input must not be empty.");this.data=[],this.position=t;let n=a.lex(e);this.parser.input=n.tokens;try{let e=this.parser.formulaWithBinaryOp();this.checkFormulaResult(e)}catch(e){if(!r)throw o.ERROR(e.message,e)}if(this.parser.errors.length>0&&!r)throw l(this.parser.errors[0],e);return this.data}}e.exports={DepParser:u}},87481:(e,t,r)=>{let o=r(25600),{EmbeddedActionsParser:n}=r(60187),i=o.tokenVocabulary,{String:a,SheetQuoted:s,ExcelRefFunction:l,ExcelConditionalRefFunction:u,Function:h,FormulaErrorT:c,RefError:f,Cell:m,Sheet:p,Name:E,Number:O,Boolean:N,Column:R,Comma:A,Colon:g,Semicolon:U,OpenParen:w,CloseParen:C,OpenCurlyParen:y,CloseCurlyParen:L,MulOp:x,PlusOp:M,DivOp:T,MinOp:d,ConcatOp:S,ExOp:b,PercentOp:I,NeqOp:v,GteOp:F,LteOp:P,GtOp:V,EqOp:B,LtOp:_}=o.tokenVocabulary;class k extends n{constructor(e,t){super(i,{outputCst:!1,maxLookahead:1,skipValidations:!0}),this.utils=t,this.binaryOperatorsPrecedence=[["^"],["*","/"],["+","-"],["&"],["<",">","=","<>","<=",">="]];let r=this;r.RULE("formulaWithBinaryOp",()=>{let e=[],t=[r.SUBRULE(r.formulaWithPercentOp)];return r.MANY(()=>{e.push(r.OR(r.c1||(r.c1=[{ALT:()=>r.CONSUME(V).image},{ALT:()=>r.CONSUME(B).image},{ALT:()=>r.CONSUME(_).image},{ALT:()=>r.CONSUME(v).image},{ALT:()=>r.CONSUME(F).image},{ALT:()=>r.CONSUME(P).image},{ALT:()=>r.CONSUME(S).image},{ALT:()=>r.CONSUME(M).image},{ALT:()=>r.CONSUME(d).image},{ALT:()=>r.CONSUME(x).image},{ALT:()=>r.CONSUME(T).image},{ALT:()=>r.CONSUME(b).image}]))),t.push(r.SUBRULE2(r.formulaWithPercentOp))}),r.ACTION(()=>{for(let r of this.binaryOperatorsPrecedence)for(let o=0,n=e.length;o<n;o++){let i=e[o];r.includes(i)&&(e.splice(o,1),t.splice(o,2,this.utils.applyInfix(t[o],i,t[o+1])),o--,n--)}}),t[0]}),r.RULE("plusMinusOp",()=>r.OR([{ALT:()=>r.CONSUME(M).image},{ALT:()=>r.CONSUME(d).image}])),r.RULE("formulaWithPercentOp",()=>{let e=r.SUBRULE(r.formulaWithUnaryOp);return r.OPTION(()=>{let t=r.CONSUME(I).image;e=r.ACTION(()=>this.utils.applyPostfix(e,t))}),e}),r.RULE("formulaWithUnaryOp",()=>{let e=[];r.MANY(()=>{let t=r.OR([{ALT:()=>r.CONSUME(M).image},{ALT:()=>r.CONSUME(d).image}]);e.push(t)});let t=r.SUBRULE(r.formulaWithIntersect);return e.length>0?r.ACTION(()=>this.utils.applyPrefix(e,t)):t}),r.RULE("formulaWithIntersect",()=>{let e=r.SUBRULE(r.formulaWithRange),t=[e];return(r.MANY({GATE:()=>{let e=r.LA(0);return r.LA(1).startOffset>e.endOffset+1},DEF:()=>{t.push(r.SUBRULE3(r.formulaWithRange))}}),t.length>1)?r.ACTION(()=>r.ACTION(()=>this.utils.applyIntersect(t))):e}),r.RULE("formulaWithRange",()=>{let e=r.SUBRULE(r.formula),t=[e];return(r.MANY(()=>{r.CONSUME(g),t.push(r.SUBRULE2(r.formula))}),t.length>1)?r.ACTION(()=>r.ACTION(()=>this.utils.applyRange(t))):e}),r.RULE("formula",()=>r.OR9([{ALT:()=>r.SUBRULE(r.referenceWithoutInfix)},{ALT:()=>r.SUBRULE(r.paren)},{ALT:()=>r.SUBRULE(r.constant)},{ALT:()=>r.SUBRULE(r.functionCall)},{ALT:()=>r.SUBRULE(r.constantArray)}])),r.RULE("paren",()=>{let e;r.CONSUME(w);let t=[];return t.push(r.SUBRULE(r.formulaWithBinaryOp)),r.MANY(()=>{r.CONSUME(A),t.push(r.SUBRULE2(r.formulaWithBinaryOp))}),e=t.length>1?r.ACTION(()=>this.utils.applyUnion(t)):t[0],r.CONSUME(C),e}),r.RULE("constantArray",()=>{let e=[[]],t=0;return r.CONSUME(y),e[t].push(r.SUBRULE(r.constantForArray)),r.MANY(()=>{let o=r.OR([{ALT:()=>r.CONSUME(A).image},{ALT:()=>r.CONSUME(U).image}]),n=r.SUBRULE2(r.constantForArray);","===o||(e[++t]=[]),e[t].push(n)}),r.CONSUME(L),r.ACTION(()=>this.utils.toArray(e))}),r.RULE("constantForArray",()=>r.OR([{ALT:()=>{let e=r.OPTION(()=>r.SUBRULE(r.plusMinusOp)),t=r.CONSUME(O).image,o=r.ACTION(()=>this.utils.toNumber(t));return e?r.ACTION(()=>this.utils.applyPrefix([e],o)):o}},{ALT:()=>{let e=r.CONSUME(a).image;return r.ACTION(()=>this.utils.toString(e))}},{ALT:()=>{let e=r.CONSUME(N).image;return r.ACTION(()=>
3this.utils.toBoolean(e))}},{ALT:()=>{let e=r.CONSUME(c).image;return r.ACTION(()=>this.utils.toError(e))}},{ALT:()=>{let e=r.CONSUME(f).image;return r.ACTION(()=>this.utils.toError(e))}}])),r.RULE("constant",()=>r.OR([{ALT:()=>{let e=r.CONSUME(O).image;return r.ACTION(()=>this.utils.toNumber(e))}},{ALT:()=>{let e=r.CONSUME(a).image;return r.ACTION(()=>this.utils.toString(e))}},{ALT:()=>{let e=r.CONSUME(N).image;return r.ACTION(()=>this.utils.toBoolean(e))}},{ALT:()=>{let e=r.CONSUME(c).image;return r.ACTION(()=>this.utils.toError(e))}}])),r.RULE("functionCall",()=>{let t=r.CONSUME(h).image.slice(0,-1),o=r.SUBRULE(r.arguments);return r.CONSUME(C),r.ACTION(()=>e.callFunction(t,o))}),r.RULE("arguments",()=>{r.MANY2(()=>{r.CONSUME2(A)});let e=[];return r.OPTION(()=>{e.push(r.SUBRULE(r.formulaWithBinaryOp)),r.MANY(()=>{r.CONSUME1(A),e.push(null),r.OPTION3(()=>{e.pop(),e.push(r.SUBRULE2(r.formulaWithBinaryOp))})})}),e}),r.RULE("referenceWithoutInfix",()=>r.OR([{ALT:()=>r.SUBRULE(r.referenceItem)},{ALT:()=>{let e=r.SUBRULE(r.prefixName),t=r.SUBRULE2(r.formulaWithRange);return r.ACTION(()=>{if(this.utils.isFormulaError(t))return t;t.ref.sheet=e}),t}}])),r.RULE("referenceItem",()=>r.OR([{ALT:()=>{let e=r.CONSUME(m).image;return r.ACTION(()=>this.utils.parseCellAddress(e))}},{ALT:()=>{let t=r.CONSUME(E).image;return r.ACTION(()=>e.getVariable(t))}},{ALT:()=>{let e=r.CONSUME(R).image;return r.ACTION(()=>this.utils.parseCol(e))}},{ALT:()=>{let e=r.CONSUME(f).image;return r.ACTION(()=>this.utils.toError(e))}}])),r.RULE("prefixName",()=>r.OR([{ALT:()=>r.CONSUME(p).image.slice(0,-1)},{ALT:()=>r.CONSUME(s).image.slice(1,-2).replace(/''/g,"'")}])),this.performSelfAnalysis()}}e.exports={Parser:k}},89789:(e,t,r)=>{let o=r(86866),n=r(13279),i=r(82898),a=r(73588),s=r(6252),l=r(60574),u=r(60525),h=r(9144),c=r(54493),f=r(73353),m=r(99859),{FormulaHelpers:p}=r(82228),{Parser:E,allTokens:O}=r(87481),N=r(25600),R=r(13292);class A{constructor(e,t=!1){this.logs=[],this.isTest=t,this.utils=new R(this),e=Object.assign({functions:{},functionsNeedContext:{},onVariable:()=>null,onCell:()=>0,onRange:()=>[[0]]},e),this.onVariable=e.onVariable,this.functions=Object.assign({},c,h,u,l,s,a,o,n,i,f,e.functions,e.functionsNeedContext),this.onRange=e.onRange,this.onCell=e.onCell,this.funsNullAs0=Object.keys(n).concat(Object.keys(i)).concat(Object.keys(a)).concat(Object.keys(s)).concat(Object.keys(l)).concat(Object.keys(h)).concat(Object.keys(c)),this.funsNeedContextAndNoDataRetrieve=["ROW","ROWS","COLUMN","COLUMNS","SUMIF","INDEX","AVERAGEIF","IF"],this.funsNeedContext=[...Object.keys(e.functionsNeedContext),...this.funsNeedContextAndNoDataRetrieve,"INDEX","OFFSET","INDIRECT","IF","CHOOSE","WEBSERVICE"],this.funsPreserveRef=Object.keys(u),this.parser=new E(this,this.utils)}static get allTokens(){return O}getCell(e){return null==e.sheet&&(e.sheet=this.position?this.position.sheet:void 0),this.onCell(e)}getRange(e){return null==e.sheet&&(e.sheet=this.position?this.position.sheet:void 0),this.onRange(e)}getVariable(e){let t={ref:this.onVariable(e,this.position.sheet,this.position)};return null==t.ref?m.NAME:t}retrieveRef(e){return p.isRangeRef(e)?this.getRange(e.ref):p.isCellRef(e)?this.getCell(e.ref):e}_callFunction(e,t){0===e.indexOf("_xlfn.")&&(e=e.slice(6)),e=e.toUpperCase();let r=this.funsNullAs0.includes(e)?0:"";if(this.funsNeedContextAndNoDataRetrieve.includes(e)||(t=t.map(t=>{if(null===t)return{value:r,isArray:!1,omitted:!0};let o=this.utils.extractRefValue(t);return this.funsPreserveRef.includes(e)?{value:o.val,isArray:o.isArray,ref:t.ref}:{value:o.val,isArray:o.isArray,isRangeRef:!!p.isRangeRef(t),isCellRef:!!p.isCellRef(t)}})),this.functions[e]){let r;try{r=this.funsNeedContextAndNoDataRetrieve.includes(e)||this.funsNeedContext.includes(e)?this.functions[e](this,...t):this.functions[e](...t)}catch(e){if(e instanceof m)return e;throw e}if(void 0===r){if(this.isTest)return this.logs.includes(e)||this.logs.push(e),{value:0,ref:{}};throw m.NOT_IMPLEMENTED(e)}return r}if(this.isTest)return this.logs.includes(e)||this.logs.push(e),{value:0,ref:{}};
3throw m.NOT_IMPLEMENTED(e)}async callFunctionAsync(e,t){let r=[];for(let e of t)r.push(await e);let o=await this._callFunction(e,r);return p.checkFunctionResult(o)}callFunction(e,t){if(this.async)return this.callFunctionAsync(e,t);{let r=this._callFunction(e,t);return p.checkFunctionResult(r)}}supportedFunctions(){let e=[];return Object.keys(this.functions).forEach(t=>{try{let r=this.functions[t](0,0,0,0,0,0,0,0,0,0,0);if(void 0===r)return;e.push(t)}catch(r){r instanceof Error&&e.push(t)}}),e.sort()}checkFormulaResult(e,t=!1){let r=typeof e;if("number"===r){if(isNaN(e))return m.VALUE;if(!isFinite(e))return m.NUM;e+=0}else if("object"===r){if(e instanceof m)return e;if(t){if(e.ref&&(e=this.retrieveRef(e)),"object"==typeof e&&!Array.isArray(e)&&null!=e)return m.VALUE}else if(e.ref&&e.ref.row&&!e.ref.from)e=this.retrieveRef(e);else if(e.ref&&e.ref.from&&e.ref.from.col===e.ref.to.col)e=this.retrieveRef({ref:{row:e.ref.from.row,col:e.ref.from.col}});else{if(!Array.isArray(e))return m.VALUE;e=e[0][0]}}return e}parse(e,t,r=!1){let o;if(0===e.length)throw Error("Input must not be empty.");this.position=t,this.async=!1;let n=N.lex(e);this.parser.input=n.tokens;try{if(o=this.parser.formulaWithBinaryOp(),(o=this.checkFormulaResult(o,r))instanceof m)return o}catch(e){throw m.ERROR(e.message,e)}if(this.parser.errors.length>0){let t=this.parser.errors[0];throw R.formatChevrotainError(t,e)}return o}async parseAsync(e,t,r=!1){let o;if(0===e.length)throw Error("Input must not be empty.");this.position=t,this.async=!0;let n=N.lex(e);this.parser.input=n.tokens;try{if(o=await this.parser.formulaWithBinaryOp(),(o=this.checkFormulaResult(o,r))instanceof m)return o}catch(e){throw m.ERROR(e.message,e)}if(this.parser.errors.length>0){let t=this.parser.errors[0];throw R.formatChevrotainError(t,e)}return o}}e.exports={FormulaParser:A,FormulaHelpers:p}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.