solve-engine 2.7.0 → 2.8.0
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.
- package/dist/{chunk-HF4H7LYA.js → chunk-2V44X7GH.js} +3 -3
- package/dist/{chunk-HF4H7LYA.js.map → chunk-2V44X7GH.js.map} +1 -1
- package/dist/{chunk-5FO4PDIG.js → chunk-3GAWAMT4.js} +2 -2
- package/dist/{chunk-5FO4PDIG.js.map → chunk-3GAWAMT4.js.map} +1 -1
- package/dist/{chunk-32GC2FHC.cjs → chunk-3HYO3QYW.cjs} +2 -2
- package/dist/{chunk-32GC2FHC.cjs.map → chunk-3HYO3QYW.cjs.map} +1 -1
- package/dist/{chunk-2JMFUQZH.js → chunk-44EOEWGP.js} +2 -2
- package/dist/chunk-44EOEWGP.js.map +1 -0
- package/dist/{chunk-CIQOK7Q4.cjs → chunk-6QRHN3I6.cjs} +2 -2
- package/dist/chunk-6QRHN3I6.cjs.map +1 -0
- package/dist/{chunk-IHZBKT7L.cjs → chunk-6TPXH6Y5.cjs} +3 -3
- package/dist/chunk-6TPXH6Y5.cjs.map +1 -0
- package/dist/chunk-BKSKZA4W.cjs +2 -0
- package/dist/chunk-BKSKZA4W.cjs.map +1 -0
- package/dist/{chunk-VAGS5JS7.cjs → chunk-C65UDMWH.cjs} +2 -2
- package/dist/{chunk-VAGS5JS7.cjs.map → chunk-C65UDMWH.cjs.map} +1 -1
- package/dist/{chunk-B7J24Q5T.cjs → chunk-CIENDLKV.cjs} +2 -2
- package/dist/{chunk-B7J24Q5T.cjs.map → chunk-CIENDLKV.cjs.map} +1 -1
- package/dist/chunk-DLAKPF5T.js +2 -0
- package/dist/chunk-DLAKPF5T.js.map +1 -0
- package/dist/chunk-EOMHELRL.js +2 -0
- package/dist/chunk-EOMHELRL.js.map +1 -0
- package/dist/{chunk-AQWNEO7M.cjs → chunk-EURCQMZK.cjs} +2 -2
- package/dist/{chunk-AQWNEO7M.cjs.map → chunk-EURCQMZK.cjs.map} +1 -1
- package/dist/{chunk-KXM7EY27.js → chunk-GAAXTO4K.js} +3 -3
- package/dist/{chunk-KXM7EY27.js.map → chunk-GAAXTO4K.js.map} +1 -1
- package/dist/{chunk-G7TBEQRQ.js → chunk-GMSBBLUQ.js} +2 -2
- package/dist/{chunk-G7TBEQRQ.js.map → chunk-GMSBBLUQ.js.map} +1 -1
- package/dist/chunk-HDVZZ7JN.js +3 -0
- package/dist/chunk-HDVZZ7JN.js.map +1 -0
- package/dist/{chunk-5AMJNF7J.js → chunk-LH7URJZT.js} +3 -3
- package/dist/chunk-LH7URJZT.js.map +1 -0
- package/dist/{chunk-ZRFUD2LX.cjs → chunk-OZ6SKIPD.cjs} +4 -4
- package/dist/{chunk-ZRFUD2LX.cjs.map → chunk-OZ6SKIPD.cjs.map} +1 -1
- package/dist/{chunk-YAHGSBMC.js → chunk-QYO7IEPR.js} +2 -2
- package/dist/{chunk-YAHGSBMC.js.map → chunk-QYO7IEPR.js.map} +1 -1
- package/dist/{chunk-2LFLR3VZ.cjs → chunk-SNVPM27Q.cjs} +2 -2
- package/dist/{chunk-2LFLR3VZ.cjs.map → chunk-SNVPM27Q.cjs.map} +1 -1
- package/dist/{chunk-AR7L5OJ2.js → chunk-T3FBAFRR.js} +2 -2
- package/dist/{chunk-AR7L5OJ2.js.map → chunk-T3FBAFRR.js.map} +1 -1
- package/dist/chunk-TUBLMUTZ.cjs +2 -0
- package/dist/chunk-TUBLMUTZ.cjs.map +1 -0
- package/dist/{chunk-GYX6S6OS.cjs → chunk-U47GA63S.cjs} +3 -3
- package/dist/chunk-U47GA63S.cjs.map +1 -0
- package/dist/{chunk-CVY2A3TP.js → chunk-UKDUFMT5.js} +2 -2
- package/dist/{chunk-CVY2A3TP.js.map → chunk-UKDUFMT5.js.map} +1 -1
- package/dist/chunk-UWAXJX5G.js +2 -0
- package/dist/chunk-UWAXJX5G.js.map +1 -0
- package/dist/chunk-WEAKI5V5.cjs +2 -0
- package/dist/chunk-WEAKI5V5.cjs.map +1 -0
- package/dist/{chunk-NXIMGB4S.cjs → chunk-WYIOXAFW.cjs} +2 -2
- package/dist/{chunk-NXIMGB4S.cjs.map → chunk-WYIOXAFW.cjs.map} +1 -1
- package/dist/{chunk-W7VOTR2J.cjs → chunk-YORX7723.cjs} +3 -3
- package/dist/{chunk-W7VOTR2J.cjs.map → chunk-YORX7723.cjs.map} +1 -1
- package/dist/{chunk-HTJPV42D.js → chunk-YTCTUBR2.js} +2 -2
- package/dist/{chunk-HTJPV42D.js.map → chunk-YTCTUBR2.js.map} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.js +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/language.cjs +1 -1
- package/dist/language.js +1 -1
- package/dist/lexer.cjs +1 -1
- package/dist/lexer.js +1 -1
- package/dist/normalizer.cjs +1 -1
- package/dist/normalizer.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +1 -1
- package/dist/packages.d.ts +1 -1
- package/dist/packages.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2JMFUQZH.js.map +0 -1
- package/dist/chunk-5AMJNF7J.js.map +0 -1
- package/dist/chunk-CIQOK7Q4.cjs.map +0 -1
- package/dist/chunk-FWW3M36J.cjs +0 -2
- package/dist/chunk-FWW3M36J.cjs.map +0 -1
- package/dist/chunk-GYX6S6OS.cjs.map +0 -1
- package/dist/chunk-HAEOMJE3.cjs +0 -2
- package/dist/chunk-HAEOMJE3.cjs.map +0 -1
- package/dist/chunk-IANAMBJQ.cjs +0 -2
- package/dist/chunk-IANAMBJQ.cjs.map +0 -1
- package/dist/chunk-IHZBKT7L.cjs.map +0 -1
- package/dist/chunk-N4HJTHZR.js +0 -2
- package/dist/chunk-N4HJTHZR.js.map +0 -1
- package/dist/chunk-P5EMTVMJ.js +0 -3
- package/dist/chunk-P5EMTVMJ.js.map +0 -1
- package/dist/chunk-TRBXW6HW.js +0 -2
- package/dist/chunk-TRBXW6HW.js.map +0 -1
- package/dist/chunk-WGZ3FNHI.js +0 -2
- package/dist/chunk-WGZ3FNHI.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {e,c}from'./chunk-IJMNVBIS.js';import {a as a$1}from'./chunk-62LMTO4F.js';import {a as a$2}from'./chunk-TRBXW6HW.js';import {c as c$1}from'./chunk-MPB7KUN5.js';e();function g(){let c=new Uint8Array(128);for(let r=48;r<=57;r++)c[r]=2;for(let r=65;r<=90;r++)c[r]=3;for(let r=97;r<=122;r++)c[r]=3;return c[95]=3,c[46]=4,c[32]=1,c[9]=1,c[10]=1,c[13]=1,c[33]=5,c[37]=5,c[38]=5,c[40]=5,c[41]=5,c[42]=5,c[43]=5,c[44]=5,c[45]=5,c[47]=5,c[58]=5,c[59]=5,c[60]=5,c[61]=5,c[62]=5,c[63]=5,c[91]=5,c[93]=5,c[94]=5,c[123]=5,c[124]=5,c[125]=5,c[126]=5,c[64]=5,c[34]=6,c[35]=7,c[36]=8,c[96]=11,c}function w(c){return c===133||c===160||c===5760||c>=8192&&c<=8202||c===8203||c===8232||c===8233||c===8239||c===8287||c===12288||c===65279}var a=class{constructor(r,t,e,s,o,i,l,n,p){this.type=r;this.typeId=t;this.value=e;this.text=s;this.offset=o;this.lineBreaks=i;this.line=l;this.col=n;this.sourceEnd=p;}},y={61:{61:"EQUALITY",62:"THEREFORE"},33:{61:"NEQ"},62:{61:"GTE"},60:{61:"LTE"},38:{38:"LOGICAL_AND"},124:{124:"LOGICAL_OR"},43:{61:"PLUS_EQUALS"},45:{61:"MINUS_EQUALS"}},L={43:"PLUS",45:"MINUS",42:"STAR",47:"SLASH",94:"CARET",37:"PERCENT",40:"LPAREN",41:"RPAREN",91:"LBRACKET",93:"RBRACKET",123:"LBRACE",125:"RBRACE",44:"COMMA",58:"COLON",59:"SEMICOLON",61:"EQUALS",63:"QUESTION",33:"BANG",38:"BIT_AND",124:"BIT_OR",60:"LT",62:"GT",126:"BIT_NOT",64:"AT"},b=(()=>{let c=new Set;for(let t=48;t<=57;t++)c.add(t);let r=[43,45,42,47,94,37,40,41,91,93,123,125,61,60,62,33,38,124,126,59,63];for(let t of r)c.add(t);return c.add(36),c.add(163),c.add(8364),c.add(165),c.add(8381),c.add(8361),c.add(96),c.add(46),c.add(35),c})(),S=class S{constructor(r="en",t){this.configuredLookup=null;this.input="";this.pos=0;this.len=0;this.line=1;this.lineStartPos=0;this.groupingStack=[];this.pluginKeywordMap=new Map;this.pluginOperators=new Map;this.pluginUnits=new Set;this.hasPluginOps=false;this._inlineSolveSpans=[];this.pluginRawLinePatterns=[];this.pendingRawLineToken=null;this.localeCode=r,this.locale=a$1(r),this.configuredLookup=t??null,this.keywordMap=new Map;for(let[e,s]of Object.entries(this.locale.keywordMap))this.keywordMap.set(e.toLowerCase(),s);this.mergedKeywords=new Map(this.keywordMap),this.mergedUnits=new Set(a$2);}matchRawLine(r){for(let t of this.pluginRawLinePatterns){let e=t.pattern.exec(r);if(e&&typeof e[1]=="string"){let s=e[1].trim();if(s.length>0)return new a(t.tokenType,c(t.tokenType),s,s,0,0,this.line,1)}}return null}rebuildMergedCollections(){this.mergedKeywords=new Map([...this.keywordMap,...this.pluginKeywordMap]),this.mergedUnits=new Set([...a$2,...this.pluginUnits]);}registerVocabulary(r){if(r.keywords){for(let[t,e]of Object.entries(r.keywords)){let s=t.toLowerCase();if(this.keywordMap.has(s))throw c$1.config("PLUGIN_KEYWORD_COLLISION",`Plugin keyword "${t}" conflicts with built-in keyword (type: ${this.keywordMap.get(s)}). Built-in keywords cannot be overridden.`,{keyword:t,builtinType:this.keywordMap.get(s)});this.pluginKeywordMap.set(s,e);}this.rebuildMergedCollections();}if(r.operators){this.hasPluginOps=true;for(let[t,e]of Object.entries(r.operators))if(t.length===2){let s=t.charCodeAt(0),o=t.charCodeAt(1),i=y[s];if(i&&i[o]!==void 0)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: ${i[o]}). Built-in operators cannot be overridden.`,{operator:t,builtinType:i[o]});if(s===60&&o===60)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: LSHIFT). Built-in operators cannot be overridden.`,{operator:t,builtinType:"LSHIFT"});if(s===62&&o===62)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: RSHIFT). Built-in operators cannot be overridden.`,{operator:t,builtinType:"RSHIFT"});if(s===47&&o===47)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in comment sequence. Comment sequences cannot be overridden.`,{operator:t,builtinType:"COMMENT"});let l=this.pluginOperators.get(s);l||(l=new Map,this.pluginOperators.set(s,l)),l.set(o,e);}}if(r.units){for(let t of r.units){if(a$2.has(t))throw c$1.config("PLUGIN_UNIT_COLLISION",`Plugin unit "${t}" conflicts with a built-in unit. Built-in units cannot be overridden.`,{unit:t});this.pluginUnits.add(t);}this.rebuildMergedCollections();}r.rawLinePatterns&&this.pluginRawLinePatterns.push(...r.rawLinePatterns);}unregisterVocabulary(r){if(r.keywords){for(let t of Object.keys(r.keywords))this.pluginKeywordMap.delete(t.toLowerCase());this.rebuildMergedCollections();}if(r.operators){for(let t of Object.keys(r.operators))if(t.length===2){let e=t.charCodeAt(0),s=t.charCodeAt(1),o=this.pluginOperators.get(e);o&&(o.delete(s),o.size===0&&this.pluginOperators.delete(e));}this.hasPluginOps=this.pluginOperators.size>0;}if(r.units){for(let t of r.units)this.pluginUnits.delete(t);this.rebuildMergedCollections();}if(r.rawLinePatterns){let t=new Set(r.rawLinePatterns);this.pluginRawLinePatterns=this.pluginRawLinePatterns.filter(e=>!t.has(e));}}reset(r){this.input=r,this.pos=0,this.len=r.length,this.line=1,this.lineStartPos=0,this.pendingRawLineToken=this.pluginRawLinePatterns.length>0?this.matchRawLine(r):null;}scanDocument(r){this.input=r,this.pos=0,this.len=r.length,this.line=1,this.lineStartPos=0;let t=[],e=this.input,s=this.len;for(;this.pos<s;){let o=this.pos,i=this.pos;for(;i<s;){let d=e.charCodeAt(i);if(d===10||d===13)break;i++;}let l=this.line,n=this.classifyFromPositions(o,i),p=e.slice(o,i),u=[];if(!n.skip){let d=this.pluginRawLinePatterns.length>0?this.matchRawLine(p):null;if(d)u=[d];else {let A=this.len;this.len=i,n.contentOffset!==void 0&&(this.pos=n.contentOffset),u=Array.from(this),this.len=A;}}let f=[];if(n.hasInlineSolve)if(!n.skip&&u.length>0){let d=this.findInlineSolves(p);f=this._inlineSolveSpans.map((A,C)=>({start:d[C]?.start??0,end:d[C]?.end??0,expression:d[C]?.expression??"",columnNumber:d[C]?.columnNumber??A.columnNumber,startTokenIndex:A.startTokenIndex,endTokenIndex:A.endTokenIndex}));}else f=this.findInlineSolves(p);if(t.push({text:p,lineNumber:l,startOffset:o,endOffset:i,classification:n,tokens:u,inlineSolves:f}),this.pos=i,this.pos<s){let d=e.charCodeAt(this.pos);d===13?(this.pos++,this.pos<s&&e.charCodeAt(this.pos)===10&&this.pos++):d===10&&this.pos++;}this.line++,this.lineStartPos=this.pos;}return t}tokenizeAll(){return this.pendingRawLineToken?(this._inlineSolveSpans=[],[this.pendingRawLineToken]):Array.from(this)}*[Symbol.iterator](){let r=this.len;if(r===0){this._inlineSolveSpans=[];return}let t=0,e=null,s=[];if(r===1){let i=this.input.charCodeAt(0);switch(S.CHAR_CLASS[i]??0){case 2:case 4:yield new a("NUMBER",c("NUMBER"),this.input,this.input,0,0,1,1),t++;break;case 3:{let n=this.input,p=n.toLowerCase();if(this.mergedUnits.has(n))yield new a("UNIT",c("UNIT"),n,n,0,0,1,1);else {let u=this.mergedKeywords.get(p);u?yield new a(u,c(u),n,n,0,0,1,1):yield new a("IDENT",c("IDENT"),n,n,0,0,1,1);}t++;break}case 5:{let n=L[i];n&&(yield new a(n,c(n),this.input,this.input,0,0,1,1),t++);break}case 6:this.pos=0,yield this.tokenizeString(),t++;break;case 7:this.pos=0,yield this.tokenizeComment(),t++;break;case 8:yield new a("DOLLAR",c("DOLLAR"),"$","$",0,0,1,1),t++;break;case 11:yield new a("BACKTICK_OPEN",c("BACKTICK_OPEN"),"`","`",0,0,1,1),t++;break;default:{w(i)||(i===215?(yield new a("STAR",c("STAR"),"\xD7","\xD7",0,0,1,1),t++):i===247?(yield new a("SLASH",c("SLASH"),"\xF7","\xF7",0,0,1,1),t++):i===177?(yield new a("PLUS_MINUS",c("PLUS_MINUS"),"\xB1","\xB1",0,0,1,1),t++):i===8800?(yield new a("NEQ",c("NEQ"),"\u2260","\u2260",0,0,1,1),t++):i===163?(yield new a("POUND",c("POUND"),"\xA3","\xA3",0,0,1,1),t++):i===8364?(yield new a("EURO",c("EURO"),"\u20AC","\u20AC",0,0,1,1),t++):i===165?(yield new a("YEN",c("YEN"),"\xA5","\xA5",0,0,1,1),t++):i===8381?(yield new a("RUBLE",c("RUBLE"),"\u20BD","\u20BD",0,0,1,1),t++):i===8361?(yield new a("WON",c("WON"),"\u20A9","\u20A9",0,0,1,1),t++):i===8377?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B9","\u20B9",0,0,1,1),t++):i===8378?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20BA","\u20BA",0,0,1,1),t++):i===8372?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B4","\u20B4",0,0,1,1),t++):i===8362?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AA","\u20AA",0,0,1,1),t++):i===8363?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AB","\u20AB",0,0,1,1),t++):i===8358?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20A6","\u20A6",0,0,1,1),t++):i===8369?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B1","\u20B1",0,0,1,1),t++):i>=128&&(yield new a("IDENT",c("IDENT"),this.input,this.input,0,0,1,1),t++));break}}this._inlineSolveSpans=s;return}let o=this.input;for(this.groupingStack.length=0;this.pos<r;){let i=o.charCodeAt(this.pos),l=S.CHAR_CLASS[i]??0;if(e&&i===92&&this.pos+1<r&&o.charCodeAt(this.pos+1)===96){this.pos+=2;continue}switch(l){case 1:this.pos++,i===10?(this.line++,this.lineStartPos=this.pos,this.groupingStack.length=0):i===13&&(this.line++,this.pos<r&&o.charCodeAt(this.pos)===10&&this.pos++,this.lineStartPos=this.pos,this.groupingStack.length=0);break;case 2:yield this.tokenizeNumber(),t++;break;case 3:{let n=this.tokenizeIdentifier();n.type==="INLINE_SOLVE_START"&&(e={startTokenIndex:t,startColumn:n.col}),yield n,t++;break}case 4:if(this.pos+1<r)if((S.CHAR_CLASS[o.charCodeAt(this.pos+1)]??0)===2)yield this.tokenizeNumber();else {let p=this.pos-this.lineStartPos+1;yield new a("DOT",c("DOT"),".",".",this.pos,0,this.line,p),this.pos++;}else {let n=this.pos-this.lineStartPos+1;yield new a("DOT",c("DOT"),".",".",this.pos,0,this.line,n),this.pos++;}t++;break;case 5:yield this.tokenizeOperator(),t++;break;case 6:yield this.tokenizeString(),t++;break;case 7:yield this.tokenizeComment(),t++;break;case 8:{let n=this.pos-this.lineStartPos+1;yield new a("DOLLAR",c("DOLLAR"),"$","$",this.pos,0,this.line,n),this.pos++,t++;break}case 11:{let n=this.pos-this.lineStartPos+1;if(yield new a("BACKTICK_OPEN",c("BACKTICK_OPEN"),"`","`",this.pos,0,this.line,n),this.pos++,e){let p=e;s.push({start:0,end:0,expression:"",columnNumber:p.startColumn,startTokenIndex:p.startTokenIndex,endTokenIndex:t}),e=null;}t++;break}default:{let n=this.pos-this.lineStartPos+1;w(i)?(this.pos++,(i===8232||i===8233||i===133)&&(this.line++,this.lineStartPos=this.pos)):i===215?(yield new a("STAR",c("STAR"),"\xD7","\xD7",this.pos,0,this.line,n),this.pos++,t++):i===247?(yield new a("SLASH",c("SLASH"),"\xF7","\xF7",this.pos,0,this.line,n),this.pos++,t++):i===177?(yield new a("PLUS_MINUS",c("PLUS_MINUS"),"\xB1","\xB1",this.pos,0,this.line,n),this.pos++,t++):i===8800?(yield new a("NEQ",c("NEQ"),"\u2260","\u2260",this.pos,0,this.line,n),this.pos++,t++):i===163?(yield new a("POUND",c("POUND"),"\xA3","\xA3",this.pos,0,this.line,n),this.pos++,t++):i===8364?(yield new a("EURO",c("EURO"),"\u20AC","\u20AC",this.pos,0,this.line,n),this.pos++,t++):i===165?(yield new a("YEN",c("YEN"),"\xA5","\xA5",this.pos,0,this.line,n),this.pos++,t++):i===8381?(yield new a("RUBLE",c("RUBLE"),"\u20BD","\u20BD",this.pos,0,this.line,n),this.pos++,t++):i===8361?(yield new a("WON",c("WON"),"\u20A9","\u20A9",this.pos,0,this.line,n),this.pos++,t++):i===8377?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B9","\u20B9",this.pos,0,this.line,n),this.pos++,t++):i===8378?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20BA","\u20BA",this.pos,0,this.line,n),this.pos++,t++):i===8372?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B4","\u20B4",this.pos,0,this.line,n),this.pos++,t++):i===8362?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AA","\u20AA",this.pos,0,this.line,n),this.pos++,t++):i===8363?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AB","\u20AB",this.pos,0,this.line,n),this.pos++,t++):i===8358?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20A6","\u20A6",this.pos,0,this.line,n),this.pos++,t++):i===8369?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B1","\u20B1",this.pos,0,this.line,n),this.pos++,t++):i>=128?(yield this.tokenizeIdentifier(),t++):this.pos++;break}}}this._inlineSolveSpans=s;}tokenizeNumber(){let r=this.input,t=this.len,e=this.pos,s=e,o=e-this.lineStartPos+1,i;if(r.charCodeAt(e)===48&&e+1<t){let f=r.charCodeAt(e+1);if(f===120||f===88){for(e+=2;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}if(f===98||f===66){for(e+=2;e<t&&(i=r.charCodeAt(e),i===48||i===49);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}if(f===111||f===79){for(e+=2;e<t&&(i=r.charCodeAt(e),i>=48&&i<=55);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}}let l=false;for(;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)l=true,e++;for(;l&&e<t&&(r.charCodeAt(e)===44||r.charCodeAt(e)===46)&&!(r.charCodeAt(e)===44&&this.groupingStack.length>0&&this.groupingStack[this.groupingStack.length-1]);){if(e+4<=t){let f=r.charCodeAt(e+1),d=r.charCodeAt(e+2),A=r.charCodeAt(e+3),C=e+4<t?r.charCodeAt(e+4):-1,T=!(C>=48&&C<=57);if(f>=48&&f<=57&&d>=48&&d<=57&&A>=48&&A<=57&&T){e+=4,l=true;continue}}break}let n=false;if(e<t&&r.charCodeAt(e)===46&&e+1<t){let f=r.charCodeAt(e+1);if(f>=48&&f<=57)for(n=true,e++;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)e++;}let p=false;if(e<t){let f=r.charCodeAt(e);if((f===101||f===69)&&e+1<t){let d=r.charCodeAt(e+1);if(d>=48&&d<=57||d===43||d===45)for(p=true,e++,(d===43||d===45)&&e++;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)e++;}}if(e<t&&r.charCodeAt(e)===110&&l&&!n&&!p){e++;let f=r.slice(s,e);return this.pos=e,new a("BIGINT",c("BIGINT"),f,f,s,0,this.line,o)}let u=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),u,u,s,0,this.line,o)}tokenizeIdentifier(){let r=this.input,t=this.len,e=this.pos,s=e,o=e-this.lineStartPos+1,i;for(;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95||i>=128&&!w(i));)e++;let l=r.slice(s,e),n=l.toLowerCase();if(n==="s"&&e<t&&r.charCodeAt(e)===96){e++,this.pos=e;let f=r.slice(s,e);return new a("INLINE_SOLVE_START",c("INLINE_SOLVE_START"),f,f,s,0,this.line,o)}if(this.mergedUnits.has(l)&&!this.isFollowedByLParen(e))return this.pos=e,new a("UNIT",c("UNIT"),l,l,s,0,this.line,o);let u=this.mergedKeywords.get(n);return u?(this.pos=e,new a(u,c(u),l,l,s,0,this.line,o)):(this.pos=e,new a("IDENT",c("IDENT"),l,l,s,0,this.line,o))}isFollowedByLParen(r){let t=this.len,e=r;for(;e<t;){let s=this.input.charCodeAt(e);if(s===40)return true;if(s!==32&&s!==9)break;e++;}return false}precededByCallTarget(r){let t=this.input,e=this.lineStartPos,s=r-1;for(;s>=e&&(t.charCodeAt(s)===32||t.charCodeAt(s)===9);)s--;if(s<e)return false;let o=t.charCodeAt(s),i=d=>d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||d===95,l=d=>d>=65&&d<=90||d>=97&&d<=122||d===95;if(!i(o))return false;let n=s+1,p=false;for(;s>=e;){let d=t.charCodeAt(s);if(!i(d))break;l(d)&&(p=true),s--;}if(!p)return false;let u=t.slice(s+1,n).toLowerCase(),f=this.mergedKeywords.get(u);return f===void 0||f==="FUNC"}tokenizeOperator(){let r=this.input,t=this.pos,e=t-this.lineStartPos+1,s=r.charCodeAt(t),o=this.len;if(t+1<o){let n=r.charCodeAt(t+1),p=y[s];if(p){let u=p[n];if(u){let f=r.slice(t,t+2);return this.pos=t+2,new a(u,c(u),f,f,t,0,this.line,e)}}if(s===47&&n===47){let u=t+2;for(;u<o;){let d=r.charCodeAt(u);if(d===10||d===13)break;u++;}let f=r.slice(t,u);return this.pos=u,new a("COMMENT",c("COMMENT"),f,f,t,0,this.line,e)}if(s===60&&n===60)return this.pos=t+2,new a("LSHIFT",c("LSHIFT"),"<<","<<",t,0,this.line,e);if(s===62&&n===62)return r.charCodeAt(t+2)===62?(this.pos=t+3,new a("URSHIFT",c("URSHIFT"),">>>",">>>",t,0,this.line,e)):(this.pos=t+2,new a("RSHIFT",c("RSHIFT"),">>",">>",t,0,this.line,e));if(this.hasPluginOps){let u=this.pluginOperators.get(s);if(u){let f=u.get(n);if(f){let d=r.slice(t,t+2);return this.pos=t+2,new a(f,c(f),d,d,t,0,this.line,e)}}}}this.pos=t+1,s===91?this.groupingStack.push(true):s===40?this.groupingStack.push(this.precededByCallTarget(t)):(s===41||s===93)&&this.groupingStack.length>0&&this.groupingStack.pop();let i=L[s],l=r.charAt(t);return new a(i||"ERROR",c(i||"ERROR"),l,l,t,0,this.line,e)}tokenizeString(){let r=this.input,t=this.len,e=this.pos,s=e-this.lineStartPos+1,o=e+1,i=0;for(;o<t;){let l=r.charCodeAt(o);if(l===34){o++;let n=r.slice(e,o),p=r.slice(e+1,o-1);return this.pos=o,new a("STRING",c("STRING"),p,n,e,i,this.line,s)}if(l===92&&o+1<t){o+=2;continue}l===10&&(this.line++,this.lineStartPos=o+1,i++),o++;}throw this.pos=o,c$1.parsing("UNTERMINATED_STRING",`Unterminated string literal: ${r.slice(e,o)}`,{literal:r.slice(e,o),offset:e})}static hasExpressionIndicators(r,t,e){let s=b;for(let o=t;o<e;o++){let i=r.charCodeAt(o);if(s.has(i)||i>=128&&(i===215||i===247||i===8800||i===163||i===8364||i===165||i===8381||i===8361))return true}return false}skipMarkerGap(r,t){let e=this.input,s=r;for(;s<t&&(e.charCodeAt(s)===32||e.charCodeAt(s)===9);)s++;if(s+2<t&&e.charCodeAt(s)===91&&e.charCodeAt(s+2)===93){let o=s+3;for(;o<t&&(e.charCodeAt(o)===32||e.charCodeAt(o)===9);)o++;if(o>s+3)return o}return s}matchHexColourEnd(r,t){let e=this.input,s=r+1,o=0;for(;s<t;){let i=e.charCodeAt(s);if(!(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102))break;o++,s++;}if(o!==3&&o!==4&&o!==6&&o!==8)return -1;if(s<t){let i=e.charCodeAt(s);if(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95)return -1}return s}classifyFromPositions(r,t){let e=t;if(r>=e)return {type:"empty",skip:true,hasInlineSolve:false};let s=this.input,o=r;for(;o<e;){let n=s.charCodeAt(o);if(n!==32&&n!==9)break;o++;}if(o>=e)return {type:"empty",skip:true,hasInlineSolve:false};let i=s.charCodeAt(o),l;if(i===35){if(this.matchHexColourEnd(o,e)!==-1){if(l===void 0){let p=s.indexOf("s`",o);l=p!==-1&&p<e;}return {type:"expression",skip:false,hasInlineSolve:l}}let n=1;for(;o+n<e&&s.charCodeAt(o+n)===35;)n++;return n<=6&&o+n<e&&s.charCodeAt(o+n)===32?{type:"heading",skip:true,hasInlineSolve:false}:{type:"heading",skip:true,hasInlineSolve:false}}if(i===62&&o+1<e&&s.charCodeAt(o+1)===32)return {type:"blockquote",skip:true,hasInlineSolve:false};if(i===96&&o+2<e&&s.charCodeAt(o+1)===96&&s.charCodeAt(o+2)===96)return {type:"code_fence",skip:true,hasInlineSolve:false};if(i===126&&o+2<e&&s.charCodeAt(o+1)===126&&s.charCodeAt(o+2)===126)return {type:"code_fence",skip:true,hasInlineSolve:false};if(i===36&&o+1<e&&s.charCodeAt(o+1)===36)return {type:"math_fence",skip:true,hasInlineSolve:false};if(i===45||i===42||i===95){let n=1;for(;o+n<e&&s.charCodeAt(o+n)===i;)n++;if(n>=3){let p=o+n;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"hr",skip:true,hasInlineSolve:false}}}if((i===45||i===42||i===43)&&o+1<e&&s.charCodeAt(o+1)===32){if(l===void 0){let n=s.indexOf("s`",o);l=n!==-1&&n<e;}return {type:"list",skip:false,hasInlineSolve:l,contentOffset:this.skipMarkerGap(o+1,e)}}if(i>=48&&i<=57){let n=o;for(;n<e&&s.charCodeAt(n)>=48&&s.charCodeAt(n)<=57;)n++;if(n<e&&s.charCodeAt(n)===46&&n+1<e&&s.charCodeAt(n+1)===32){if(l===void 0){let p=s.indexOf("s`",o);l=p!==-1&&p<e;}return {type:"list",skip:false,hasInlineSolve:l,contentOffset:this.skipMarkerGap(n+1,e)}}}if(i===124){let n=o+1;for(;n<e;){let p=s.charCodeAt(n);if(p!==45&&p!==58&&p!==124&&p!==32&&p!==9&&p!==13)break;n++;}if(n>=e)return {type:"table_separator",skip:true,hasInlineSolve:false}}if(i===91&&o+1<e&&s.charCodeAt(o+1)===91){let n=s.indexOf("]]",o+2);if(n!==-1&&n<e){let p=n+2;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(i===33&&o+2<e&&s.charCodeAt(o+1)===91&&s.charCodeAt(o+2)===91){let n=s.indexOf("]]",o+3);if(n!==-1&&n<e){let p=n+2;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(i===47&&o+1<e&&s.charCodeAt(o+1)===47)return {type:"comment",skip:true,hasInlineSolve:false};if(i===62){let n=o+1;for(;n<e&&(s.charCodeAt(n)===32||s.charCodeAt(n)===9);)n++;if(n>=e)return {type:"blockquote",skip:true,hasInlineSolve:false}}if(i===45||i===42||i===43){let n=o+1;for(;n<e&&(s.charCodeAt(n)===32||s.charCodeAt(n)===9);)n++;if(n>=e)return {type:"list",skip:false,hasInlineSolve:false}}if(l===void 0){let n=s.indexOf("s`",o);l=n!==-1&&n<e;}if(!l){let n=true;for(let p=o;p<e;p++){let u=s.charCodeAt(p);if(u>=128||S.CHAR_CLASS[u]>1){n=false;break}}if(n)return {type:"empty",skip:true,hasInlineSolve:false}}return {type:"expression",skip:false,hasInlineSolve:l}}classifyLine(r){let t=this.input,e=this.len,s=this.pos;this.input=r,this.len=r.length,this.pos=0;let o=this.classifyFromPositions(0,r.length);return this.input=t,this.len=e,this.pos=s,o}getKeywords(){return Object.fromEntries(this.mergedKeywords)}findInlineSolves(r){let t=[],e=r.length,s=0;for(;s<e;){let o=r.indexOf("s`",s);if(o===-1)break;let i=o+2,l=i;for(;l<e;){let u=r.charCodeAt(l);if(u===92&&l+1<e){l+=2;continue}if(u===96)break;l++;}l>=e&&(l=e);let n=r.slice(i,l),p=l<e?l+1:l;t.push({start:o,end:p,expression:n,columnNumber:o+1}),s=p;}return t}tokenizeComment(){let r=this.input,t=this.len,e=this.pos,s=e-this.lineStartPos+1;if(r.charCodeAt(e)===35){let l=this.matchHexColourEnd(e,t);if(l!==-1){let d=r.slice(e,l);return this.pos=l,new a("HEX_COLOUR",c("HEX_COLOUR"),d,d,e,0,this.line,s)}let n=r.charCodeAt(e+1),p=n>=65&&n<=90||n>=97&&n<=122,u=e>this.lineStartPos?r.charCodeAt(e-1):-1,f=u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95;if(p&&!f){let d=e+2;for(;d<t;){let C=r.charCodeAt(d);if(!(C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||C===95||C===45))break;d++;}let A=r.slice(e+1,d);return this.pos=d,new a("TAG",c("TAG"),A,A,e,0,this.line,s)}}let o=this.pos;for(o+1<t&&r.charCodeAt(o+1)===47?o+=2:o++;o<t;){let l=r.charCodeAt(o);if(l===10||l===13)break;o++;}let i=r.slice(e,o);return this.pos=o,new a("COMMENT",c("COMMENT"),i,i,e,0,this.line,s)}};S.CHAR_CLASS=g();var I=S;export{a,I as b};//# sourceMappingURL=chunk-G7TBEQRQ.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {e,c}from'./chunk-IJMNVBIS.js';import {a as a$1}from'./chunk-62LMTO4F.js';import {a as a$2}from'./chunk-UWAXJX5G.js';import {c as c$1}from'./chunk-MPB7KUN5.js';e();function g(){let c=new Uint8Array(128);for(let r=48;r<=57;r++)c[r]=2;for(let r=65;r<=90;r++)c[r]=3;for(let r=97;r<=122;r++)c[r]=3;return c[95]=3,c[46]=4,c[32]=1,c[9]=1,c[10]=1,c[13]=1,c[33]=5,c[37]=5,c[38]=5,c[40]=5,c[41]=5,c[42]=5,c[43]=5,c[44]=5,c[45]=5,c[47]=5,c[58]=5,c[59]=5,c[60]=5,c[61]=5,c[62]=5,c[63]=5,c[91]=5,c[93]=5,c[94]=5,c[123]=5,c[124]=5,c[125]=5,c[126]=5,c[64]=5,c[34]=6,c[35]=7,c[36]=8,c[96]=11,c}function w(c){return c===133||c===160||c===5760||c>=8192&&c<=8202||c===8203||c===8232||c===8233||c===8239||c===8287||c===12288||c===65279}var a=class{constructor(r,t,e,s,o,i,l,n,p){this.type=r;this.typeId=t;this.value=e;this.text=s;this.offset=o;this.lineBreaks=i;this.line=l;this.col=n;this.sourceEnd=p;}},y={61:{61:"EQUALITY",62:"THEREFORE"},33:{61:"NEQ"},62:{61:"GTE"},60:{61:"LTE"},38:{38:"LOGICAL_AND"},124:{124:"LOGICAL_OR"},43:{61:"PLUS_EQUALS"},45:{61:"MINUS_EQUALS"}},L={43:"PLUS",45:"MINUS",42:"STAR",47:"SLASH",94:"CARET",37:"PERCENT",40:"LPAREN",41:"RPAREN",91:"LBRACKET",93:"RBRACKET",123:"LBRACE",125:"RBRACE",44:"COMMA",58:"COLON",59:"SEMICOLON",61:"EQUALS",63:"QUESTION",33:"BANG",38:"BIT_AND",124:"BIT_OR",60:"LT",62:"GT",126:"BIT_NOT",64:"AT"},b=(()=>{let c=new Set;for(let t=48;t<=57;t++)c.add(t);let r=[43,45,42,47,94,37,40,41,91,93,123,125,61,60,62,33,38,124,126,59,63];for(let t of r)c.add(t);return c.add(36),c.add(163),c.add(8364),c.add(165),c.add(8381),c.add(8361),c.add(96),c.add(46),c.add(35),c})(),S=class S{constructor(r="en",t){this.configuredLookup=null;this.input="";this.pos=0;this.len=0;this.line=1;this.lineStartPos=0;this.groupingStack=[];this.pluginKeywordMap=new Map;this.pluginOperators=new Map;this.pluginUnits=new Set;this.hasPluginOps=false;this._inlineSolveSpans=[];this.pluginRawLinePatterns=[];this.pendingRawLineToken=null;this.localeCode=r,this.locale=a$1(r),this.configuredLookup=t??null,this.keywordMap=new Map;for(let[e,s]of Object.entries(this.locale.keywordMap))this.keywordMap.set(e.toLowerCase(),s);this.mergedKeywords=new Map(this.keywordMap),this.mergedUnits=new Set(a$2);}matchRawLine(r){for(let t of this.pluginRawLinePatterns){let e=t.pattern.exec(r);if(e&&typeof e[1]=="string"){let s=e[1].trim();if(s.length>0)return new a(t.tokenType,c(t.tokenType),s,s,0,0,this.line,1)}}return null}rebuildMergedCollections(){this.mergedKeywords=new Map([...this.keywordMap,...this.pluginKeywordMap]),this.mergedUnits=new Set([...a$2,...this.pluginUnits]);}registerVocabulary(r){if(r.keywords){for(let[t,e]of Object.entries(r.keywords)){let s=t.toLowerCase();if(this.keywordMap.has(s))throw c$1.config("PLUGIN_KEYWORD_COLLISION",`Plugin keyword "${t}" conflicts with built-in keyword (type: ${this.keywordMap.get(s)}). Built-in keywords cannot be overridden.`,{keyword:t,builtinType:this.keywordMap.get(s)});this.pluginKeywordMap.set(s,e);}this.rebuildMergedCollections();}if(r.operators){this.hasPluginOps=true;for(let[t,e]of Object.entries(r.operators))if(t.length===2){let s=t.charCodeAt(0),o=t.charCodeAt(1),i=y[s];if(i&&i[o]!==void 0)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: ${i[o]}). Built-in operators cannot be overridden.`,{operator:t,builtinType:i[o]});if(s===60&&o===60)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: LSHIFT). Built-in operators cannot be overridden.`,{operator:t,builtinType:"LSHIFT"});if(s===62&&o===62)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in operator (type: RSHIFT). Built-in operators cannot be overridden.`,{operator:t,builtinType:"RSHIFT"});if(s===47&&o===47)throw c$1.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${t}" conflicts with built-in comment sequence. Comment sequences cannot be overridden.`,{operator:t,builtinType:"COMMENT"});let l=this.pluginOperators.get(s);l||(l=new Map,this.pluginOperators.set(s,l)),l.set(o,e);}}if(r.units){for(let t of r.units){if(a$2.has(t))throw c$1.config("PLUGIN_UNIT_COLLISION",`Plugin unit "${t}" conflicts with a built-in unit. Built-in units cannot be overridden.`,{unit:t});this.pluginUnits.add(t);}this.rebuildMergedCollections();}r.rawLinePatterns&&this.pluginRawLinePatterns.push(...r.rawLinePatterns);}unregisterVocabulary(r){if(r.keywords){for(let t of Object.keys(r.keywords))this.pluginKeywordMap.delete(t.toLowerCase());this.rebuildMergedCollections();}if(r.operators){for(let t of Object.keys(r.operators))if(t.length===2){let e=t.charCodeAt(0),s=t.charCodeAt(1),o=this.pluginOperators.get(e);o&&(o.delete(s),o.size===0&&this.pluginOperators.delete(e));}this.hasPluginOps=this.pluginOperators.size>0;}if(r.units){for(let t of r.units)this.pluginUnits.delete(t);this.rebuildMergedCollections();}if(r.rawLinePatterns){let t=new Set(r.rawLinePatterns);this.pluginRawLinePatterns=this.pluginRawLinePatterns.filter(e=>!t.has(e));}}reset(r){this.input=r,this.pos=0,this.len=r.length,this.line=1,this.lineStartPos=0,this.pendingRawLineToken=this.pluginRawLinePatterns.length>0?this.matchRawLine(r):null;}scanDocument(r){this.input=r,this.pos=0,this.len=r.length,this.line=1,this.lineStartPos=0;let t=[],e=this.input,s=this.len;for(;this.pos<s;){let o=this.pos,i=this.pos;for(;i<s;){let d=e.charCodeAt(i);if(d===10||d===13)break;i++;}let l=this.line,n=this.classifyFromPositions(o,i),p=e.slice(o,i),u=[];if(!n.skip){let d=this.pluginRawLinePatterns.length>0?this.matchRawLine(p):null;if(d)u=[d];else {let A=this.len;this.len=i,n.contentOffset!==void 0&&(this.pos=n.contentOffset),u=Array.from(this),this.len=A;}}let f=[];if(n.hasInlineSolve)if(!n.skip&&u.length>0){let d=this.findInlineSolves(p);f=this._inlineSolveSpans.map((A,C)=>({start:d[C]?.start??0,end:d[C]?.end??0,expression:d[C]?.expression??"",columnNumber:d[C]?.columnNumber??A.columnNumber,startTokenIndex:A.startTokenIndex,endTokenIndex:A.endTokenIndex}));}else f=this.findInlineSolves(p);if(t.push({text:p,lineNumber:l,startOffset:o,endOffset:i,classification:n,tokens:u,inlineSolves:f}),this.pos=i,this.pos<s){let d=e.charCodeAt(this.pos);d===13?(this.pos++,this.pos<s&&e.charCodeAt(this.pos)===10&&this.pos++):d===10&&this.pos++;}this.line++,this.lineStartPos=this.pos;}return t}tokenizeAll(){return this.pendingRawLineToken?(this._inlineSolveSpans=[],[this.pendingRawLineToken]):Array.from(this)}*[Symbol.iterator](){let r=this.len;if(r===0){this._inlineSolveSpans=[];return}let t=0,e=null,s=[];if(r===1){let i=this.input.charCodeAt(0);switch(S.CHAR_CLASS[i]??0){case 2:case 4:yield new a("NUMBER",c("NUMBER"),this.input,this.input,0,0,1,1),t++;break;case 3:{let n=this.input,p=n.toLowerCase();if(this.mergedUnits.has(n))yield new a("UNIT",c("UNIT"),n,n,0,0,1,1);else {let u=this.mergedKeywords.get(p);u?yield new a(u,c(u),n,n,0,0,1,1):yield new a("IDENT",c("IDENT"),n,n,0,0,1,1);}t++;break}case 5:{let n=L[i];n&&(yield new a(n,c(n),this.input,this.input,0,0,1,1),t++);break}case 6:this.pos=0,yield this.tokenizeString(),t++;break;case 7:this.pos=0,yield this.tokenizeComment(),t++;break;case 8:yield new a("DOLLAR",c("DOLLAR"),"$","$",0,0,1,1),t++;break;case 11:yield new a("BACKTICK_OPEN",c("BACKTICK_OPEN"),"`","`",0,0,1,1),t++;break;default:{w(i)||(i===215?(yield new a("STAR",c("STAR"),"\xD7","\xD7",0,0,1,1),t++):i===247?(yield new a("SLASH",c("SLASH"),"\xF7","\xF7",0,0,1,1),t++):i===177?(yield new a("PLUS_MINUS",c("PLUS_MINUS"),"\xB1","\xB1",0,0,1,1),t++):i===8800?(yield new a("NEQ",c("NEQ"),"\u2260","\u2260",0,0,1,1),t++):i===163?(yield new a("POUND",c("POUND"),"\xA3","\xA3",0,0,1,1),t++):i===8364?(yield new a("EURO",c("EURO"),"\u20AC","\u20AC",0,0,1,1),t++):i===165?(yield new a("YEN",c("YEN"),"\xA5","\xA5",0,0,1,1),t++):i===8381?(yield new a("RUBLE",c("RUBLE"),"\u20BD","\u20BD",0,0,1,1),t++):i===8361?(yield new a("WON",c("WON"),"\u20A9","\u20A9",0,0,1,1),t++):i===8377?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B9","\u20B9",0,0,1,1),t++):i===8378?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20BA","\u20BA",0,0,1,1),t++):i===8372?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B4","\u20B4",0,0,1,1),t++):i===8362?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AA","\u20AA",0,0,1,1),t++):i===8363?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AB","\u20AB",0,0,1,1),t++):i===8358?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20A6","\u20A6",0,0,1,1),t++):i===8369?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B1","\u20B1",0,0,1,1),t++):i>=128&&(yield new a("IDENT",c("IDENT"),this.input,this.input,0,0,1,1),t++));break}}this._inlineSolveSpans=s;return}let o=this.input;for(this.groupingStack.length=0;this.pos<r;){let i=o.charCodeAt(this.pos),l=S.CHAR_CLASS[i]??0;if(e&&i===92&&this.pos+1<r&&o.charCodeAt(this.pos+1)===96){this.pos+=2;continue}switch(l){case 1:this.pos++,i===10?(this.line++,this.lineStartPos=this.pos,this.groupingStack.length=0):i===13&&(this.line++,this.pos<r&&o.charCodeAt(this.pos)===10&&this.pos++,this.lineStartPos=this.pos,this.groupingStack.length=0);break;case 2:yield this.tokenizeNumber(),t++;break;case 3:{let n=this.tokenizeIdentifier();n.type==="INLINE_SOLVE_START"&&(e={startTokenIndex:t,startColumn:n.col}),yield n,t++;break}case 4:if(this.pos+1<r)if((S.CHAR_CLASS[o.charCodeAt(this.pos+1)]??0)===2)yield this.tokenizeNumber();else {let p=this.pos-this.lineStartPos+1;yield new a("DOT",c("DOT"),".",".",this.pos,0,this.line,p),this.pos++;}else {let n=this.pos-this.lineStartPos+1;yield new a("DOT",c("DOT"),".",".",this.pos,0,this.line,n),this.pos++;}t++;break;case 5:yield this.tokenizeOperator(),t++;break;case 6:yield this.tokenizeString(),t++;break;case 7:yield this.tokenizeComment(),t++;break;case 8:{let n=this.pos-this.lineStartPos+1;yield new a("DOLLAR",c("DOLLAR"),"$","$",this.pos,0,this.line,n),this.pos++,t++;break}case 11:{let n=this.pos-this.lineStartPos+1;if(yield new a("BACKTICK_OPEN",c("BACKTICK_OPEN"),"`","`",this.pos,0,this.line,n),this.pos++,e){let p=e;s.push({start:0,end:0,expression:"",columnNumber:p.startColumn,startTokenIndex:p.startTokenIndex,endTokenIndex:t}),e=null;}t++;break}default:{let n=this.pos-this.lineStartPos+1;w(i)?(this.pos++,(i===8232||i===8233||i===133)&&(this.line++,this.lineStartPos=this.pos)):i===215?(yield new a("STAR",c("STAR"),"\xD7","\xD7",this.pos,0,this.line,n),this.pos++,t++):i===247?(yield new a("SLASH",c("SLASH"),"\xF7","\xF7",this.pos,0,this.line,n),this.pos++,t++):i===177?(yield new a("PLUS_MINUS",c("PLUS_MINUS"),"\xB1","\xB1",this.pos,0,this.line,n),this.pos++,t++):i===8800?(yield new a("NEQ",c("NEQ"),"\u2260","\u2260",this.pos,0,this.line,n),this.pos++,t++):i===163?(yield new a("POUND",c("POUND"),"\xA3","\xA3",this.pos,0,this.line,n),this.pos++,t++):i===8364?(yield new a("EURO",c("EURO"),"\u20AC","\u20AC",this.pos,0,this.line,n),this.pos++,t++):i===165?(yield new a("YEN",c("YEN"),"\xA5","\xA5",this.pos,0,this.line,n),this.pos++,t++):i===8381?(yield new a("RUBLE",c("RUBLE"),"\u20BD","\u20BD",this.pos,0,this.line,n),this.pos++,t++):i===8361?(yield new a("WON",c("WON"),"\u20A9","\u20A9",this.pos,0,this.line,n),this.pos++,t++):i===8377?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B9","\u20B9",this.pos,0,this.line,n),this.pos++,t++):i===8378?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20BA","\u20BA",this.pos,0,this.line,n),this.pos++,t++):i===8372?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B4","\u20B4",this.pos,0,this.line,n),this.pos++,t++):i===8362?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AA","\u20AA",this.pos,0,this.line,n),this.pos++,t++):i===8363?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20AB","\u20AB",this.pos,0,this.line,n),this.pos++,t++):i===8358?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20A6","\u20A6",this.pos,0,this.line,n),this.pos++,t++):i===8369?(yield new a("CURRENCY_SYMBOL",c("CURRENCY_SYMBOL"),"\u20B1","\u20B1",this.pos,0,this.line,n),this.pos++,t++):i>=128?(yield this.tokenizeIdentifier(),t++):this.pos++;break}}}this._inlineSolveSpans=s;}tokenizeNumber(){let r=this.input,t=this.len,e=this.pos,s=e,o=e-this.lineStartPos+1,i;if(r.charCodeAt(e)===48&&e+1<t){let f=r.charCodeAt(e+1);if(f===120||f===88){for(e+=2;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}if(f===98||f===66){for(e+=2;e<t&&(i=r.charCodeAt(e),i===48||i===49);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}if(f===111||f===79){for(e+=2;e<t&&(i=r.charCodeAt(e),i>=48&&i<=55);)e++;let d=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),d,d,s,0,this.line,o)}}let l=false;for(;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)l=true,e++;for(;l&&e<t&&(r.charCodeAt(e)===44||r.charCodeAt(e)===46)&&!(r.charCodeAt(e)===44&&this.groupingStack.length>0&&this.groupingStack[this.groupingStack.length-1]);){if(e+4<=t){let f=r.charCodeAt(e+1),d=r.charCodeAt(e+2),A=r.charCodeAt(e+3),C=e+4<t?r.charCodeAt(e+4):-1,T=!(C>=48&&C<=57);if(f>=48&&f<=57&&d>=48&&d<=57&&A>=48&&A<=57&&T){e+=4,l=true;continue}}break}let n=false;if(e<t&&r.charCodeAt(e)===46&&e+1<t){let f=r.charCodeAt(e+1);if(f>=48&&f<=57)for(n=true,e++;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)e++;}let p=false;if(e<t){let f=r.charCodeAt(e);if((f===101||f===69)&&e+1<t){let d=r.charCodeAt(e+1);if(d>=48&&d<=57||d===43||d===45)for(p=true,e++,(d===43||d===45)&&e++;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57);)e++;}}if(e<t&&r.charCodeAt(e)===110&&l&&!n&&!p){e++;let f=r.slice(s,e);return this.pos=e,new a("BIGINT",c("BIGINT"),f,f,s,0,this.line,o)}let u=r.slice(s,e);return this.pos=e,new a("NUMBER",c("NUMBER"),u,u,s,0,this.line,o)}tokenizeIdentifier(){let r=this.input,t=this.len,e=this.pos,s=e,o=e-this.lineStartPos+1,i;for(;e<t&&(i=r.charCodeAt(e),i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95||i>=128&&!w(i));)e++;let l=r.slice(s,e),n=l.toLowerCase();if(n==="s"&&e<t&&r.charCodeAt(e)===96){e++,this.pos=e;let f=r.slice(s,e);return new a("INLINE_SOLVE_START",c("INLINE_SOLVE_START"),f,f,s,0,this.line,o)}if(this.mergedUnits.has(l)&&!this.isFollowedByLParen(e))return this.pos=e,new a("UNIT",c("UNIT"),l,l,s,0,this.line,o);let u=this.mergedKeywords.get(n);return u?(this.pos=e,new a(u,c(u),l,l,s,0,this.line,o)):(this.pos=e,new a("IDENT",c("IDENT"),l,l,s,0,this.line,o))}isFollowedByLParen(r){let t=this.len,e=r;for(;e<t;){let s=this.input.charCodeAt(e);if(s===40)return true;if(s!==32&&s!==9)break;e++;}return false}precededByCallTarget(r){let t=this.input,e=this.lineStartPos,s=r-1;for(;s>=e&&(t.charCodeAt(s)===32||t.charCodeAt(s)===9);)s--;if(s<e)return false;let o=t.charCodeAt(s),i=d=>d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||d===95,l=d=>d>=65&&d<=90||d>=97&&d<=122||d===95;if(!i(o))return false;let n=s+1,p=false;for(;s>=e;){let d=t.charCodeAt(s);if(!i(d))break;l(d)&&(p=true),s--;}if(!p)return false;let u=t.slice(s+1,n).toLowerCase(),f=this.mergedKeywords.get(u);return f===void 0||f==="FUNC"}tokenizeOperator(){let r=this.input,t=this.pos,e=t-this.lineStartPos+1,s=r.charCodeAt(t),o=this.len;if(t+1<o){let n=r.charCodeAt(t+1),p=y[s];if(p){let u=p[n];if(u){let f=r.slice(t,t+2);return this.pos=t+2,new a(u,c(u),f,f,t,0,this.line,e)}}if(s===47&&n===47){let u=t+2;for(;u<o;){let d=r.charCodeAt(u);if(d===10||d===13)break;u++;}let f=r.slice(t,u);return this.pos=u,new a("COMMENT",c("COMMENT"),f,f,t,0,this.line,e)}if(s===60&&n===60)return this.pos=t+2,new a("LSHIFT",c("LSHIFT"),"<<","<<",t,0,this.line,e);if(s===62&&n===62)return r.charCodeAt(t+2)===62?(this.pos=t+3,new a("URSHIFT",c("URSHIFT"),">>>",">>>",t,0,this.line,e)):(this.pos=t+2,new a("RSHIFT",c("RSHIFT"),">>",">>",t,0,this.line,e));if(this.hasPluginOps){let u=this.pluginOperators.get(s);if(u){let f=u.get(n);if(f){let d=r.slice(t,t+2);return this.pos=t+2,new a(f,c(f),d,d,t,0,this.line,e)}}}}this.pos=t+1,s===91?this.groupingStack.push(true):s===40?this.groupingStack.push(this.precededByCallTarget(t)):(s===41||s===93)&&this.groupingStack.length>0&&this.groupingStack.pop();let i=L[s],l=r.charAt(t);return new a(i||"ERROR",c(i||"ERROR"),l,l,t,0,this.line,e)}tokenizeString(){let r=this.input,t=this.len,e=this.pos,s=e-this.lineStartPos+1,o=e+1,i=0;for(;o<t;){let l=r.charCodeAt(o);if(l===34){o++;let n=r.slice(e,o),p=r.slice(e+1,o-1);return this.pos=o,new a("STRING",c("STRING"),p,n,e,i,this.line,s)}if(l===92&&o+1<t){o+=2;continue}l===10&&(this.line++,this.lineStartPos=o+1,i++),o++;}throw this.pos=o,c$1.parsing("UNTERMINATED_STRING",`Unterminated string literal: ${r.slice(e,o)}`,{literal:r.slice(e,o),offset:e})}static hasExpressionIndicators(r,t,e){let s=b;for(let o=t;o<e;o++){let i=r.charCodeAt(o);if(s.has(i)||i>=128&&(i===215||i===247||i===8800||i===163||i===8364||i===165||i===8381||i===8361))return true}return false}skipMarkerGap(r,t){let e=this.input,s=r;for(;s<t&&(e.charCodeAt(s)===32||e.charCodeAt(s)===9);)s++;if(s+2<t&&e.charCodeAt(s)===91&&e.charCodeAt(s+2)===93){let o=s+3;for(;o<t&&(e.charCodeAt(o)===32||e.charCodeAt(o)===9);)o++;if(o>s+3)return o}return s}matchHexColourEnd(r,t){let e=this.input,s=r+1,o=0;for(;s<t;){let i=e.charCodeAt(s);if(!(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102))break;o++,s++;}if(o!==3&&o!==4&&o!==6&&o!==8)return -1;if(s<t){let i=e.charCodeAt(s);if(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95)return -1}return s}classifyFromPositions(r,t){let e=t;if(r>=e)return {type:"empty",skip:true,hasInlineSolve:false};let s=this.input,o=r;for(;o<e;){let n=s.charCodeAt(o);if(n!==32&&n!==9)break;o++;}if(o>=e)return {type:"empty",skip:true,hasInlineSolve:false};let i=s.charCodeAt(o),l;if(i===35){if(this.matchHexColourEnd(o,e)!==-1){if(l===void 0){let p=s.indexOf("s`",o);l=p!==-1&&p<e;}return {type:"expression",skip:false,hasInlineSolve:l}}let n=1;for(;o+n<e&&s.charCodeAt(o+n)===35;)n++;return n<=6&&o+n<e&&s.charCodeAt(o+n)===32?{type:"heading",skip:true,hasInlineSolve:false}:{type:"heading",skip:true,hasInlineSolve:false}}if(i===62&&o+1<e&&s.charCodeAt(o+1)===32)return {type:"blockquote",skip:true,hasInlineSolve:false};if(i===96&&o+2<e&&s.charCodeAt(o+1)===96&&s.charCodeAt(o+2)===96)return {type:"code_fence",skip:true,hasInlineSolve:false};if(i===126&&o+2<e&&s.charCodeAt(o+1)===126&&s.charCodeAt(o+2)===126)return {type:"code_fence",skip:true,hasInlineSolve:false};if(i===36&&o+1<e&&s.charCodeAt(o+1)===36)return {type:"math_fence",skip:true,hasInlineSolve:false};if(i===45||i===42||i===95){let n=1;for(;o+n<e&&s.charCodeAt(o+n)===i;)n++;if(n>=3){let p=o+n;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"hr",skip:true,hasInlineSolve:false}}}if((i===45||i===42||i===43)&&o+1<e&&s.charCodeAt(o+1)===32){if(l===void 0){let n=s.indexOf("s`",o);l=n!==-1&&n<e;}return {type:"list",skip:false,hasInlineSolve:l,contentOffset:this.skipMarkerGap(o+1,e)}}if(i>=48&&i<=57){let n=o;for(;n<e&&s.charCodeAt(n)>=48&&s.charCodeAt(n)<=57;)n++;if(n<e&&s.charCodeAt(n)===46&&n+1<e&&s.charCodeAt(n+1)===32){if(l===void 0){let p=s.indexOf("s`",o);l=p!==-1&&p<e;}return {type:"list",skip:false,hasInlineSolve:l,contentOffset:this.skipMarkerGap(n+1,e)}}}if(i===124){let n=o+1;for(;n<e;){let p=s.charCodeAt(n);if(p!==45&&p!==58&&p!==124&&p!==32&&p!==9&&p!==13)break;n++;}if(n>=e)return {type:"table_separator",skip:true,hasInlineSolve:false}}if(i===91&&o+1<e&&s.charCodeAt(o+1)===91){let n=s.indexOf("]]",o+2);if(n!==-1&&n<e){let p=n+2;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(i===33&&o+2<e&&s.charCodeAt(o+1)===91&&s.charCodeAt(o+2)===91){let n=s.indexOf("]]",o+3);if(n!==-1&&n<e){let p=n+2;for(;p<e&&(s.charCodeAt(p)===32||s.charCodeAt(p)===9);)p++;if(p>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(i===47&&o+1<e&&s.charCodeAt(o+1)===47)return {type:"comment",skip:true,hasInlineSolve:false};if(i===62){let n=o+1;for(;n<e&&(s.charCodeAt(n)===32||s.charCodeAt(n)===9);)n++;if(n>=e)return {type:"blockquote",skip:true,hasInlineSolve:false}}if(i===45||i===42||i===43){let n=o+1;for(;n<e&&(s.charCodeAt(n)===32||s.charCodeAt(n)===9);)n++;if(n>=e)return {type:"list",skip:false,hasInlineSolve:false}}if(l===void 0){let n=s.indexOf("s`",o);l=n!==-1&&n<e;}if(!l){let n=true;for(let p=o;p<e;p++){let u=s.charCodeAt(p);if(u>=128||S.CHAR_CLASS[u]>1){n=false;break}}if(n)return {type:"empty",skip:true,hasInlineSolve:false}}return {type:"expression",skip:false,hasInlineSolve:l}}classifyLine(r){let t=this.input,e=this.len,s=this.pos;this.input=r,this.len=r.length,this.pos=0;let o=this.classifyFromPositions(0,r.length);return this.input=t,this.len=e,this.pos=s,o}getKeywords(){return Object.fromEntries(this.mergedKeywords)}findInlineSolves(r){let t=[],e=r.length,s=0;for(;s<e;){let o=r.indexOf("s`",s);if(o===-1)break;let i=o+2,l=i;for(;l<e;){let u=r.charCodeAt(l);if(u===92&&l+1<e){l+=2;continue}if(u===96)break;l++;}l>=e&&(l=e);let n=r.slice(i,l),p=l<e?l+1:l;t.push({start:o,end:p,expression:n,columnNumber:o+1}),s=p;}return t}tokenizeComment(){let r=this.input,t=this.len,e=this.pos,s=e-this.lineStartPos+1;if(r.charCodeAt(e)===35){let l=this.matchHexColourEnd(e,t);if(l!==-1){let d=r.slice(e,l);return this.pos=l,new a("HEX_COLOUR",c("HEX_COLOUR"),d,d,e,0,this.line,s)}let n=r.charCodeAt(e+1),p=n>=65&&n<=90||n>=97&&n<=122,u=e>this.lineStartPos?r.charCodeAt(e-1):-1,f=u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95;if(p&&!f){let d=e+2;for(;d<t;){let C=r.charCodeAt(d);if(!(C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||C===95||C===45))break;d++;}let A=r.slice(e+1,d);return this.pos=d,new a("TAG",c("TAG"),A,A,e,0,this.line,s)}}let o=this.pos;for(o+1<t&&r.charCodeAt(o+1)===47?o+=2:o++;o<t;){let l=r.charCodeAt(o);if(l===10||l===13)break;o++;}let i=r.slice(e,o);return this.pos=o,new a("COMMENT",c("COMMENT"),i,i,e,0,this.line,s)}};S.CHAR_CLASS=g();var I=S;export{a,I as b};//# sourceMappingURL=chunk-GMSBBLUQ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-GMSBBLUQ.js.map
|