jora
Version:
JavaScript object query engine
14 lines • 76.7 kB
JavaScript
var jora=(()=>{var ye=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Qt=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)ye(t,r,{get:e[r],enumerable:!0})},Zt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kt(e))!Qt.call(t,o)&&o!==r&&ye(t,o,{get:()=>e[o],enumerable:!(i=Jt(e,o))||i.enumerable});return t};var Xt=t=>Zt(ye({},"__esModule",{value:!0}),t);var Ms={};w(Ms,{default:()=>ws});var yt="1.0.0-beta.15";var S=Object.hasOwn||((t,e)=>Object.hasOwnProperty.call(t,e)),$t=Object.prototype.toString;function U(t,e){return e!==void 0&&(D(e)?e.forEach(r=>t.add(r)):t.add(e)),t}function ie(t,e,r){t.has(e)?t.get(e).add(r):t.set(e,new Set([r]))}function mt(t,e){return t&&S(t,e)?t[e]:void 0}function I(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function j(t){return $t.call(t)==="[object RegExp]"}function P(t){return t&&(D(t)||S(t,"length")&&isFinite(t.length))}function D(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function G(t,e=0){let r=parseInt(t,10);return isNaN(r)?e:r}function v(t){if(D(t))return t.length>0;if(I(t)){for(let e in t)if(S(t,e))return!0;return!1}return!!t}var er=function(){return{yy:{},options:{ranges:!0},rules:[/^(?:\/\/.*?(?:\n|\r\n?|\u2028|\u2029|$)|\/\*(?:.|\s)*?(?:\*\/|$))/,/^\s+/,/^\//,/^<(?!=)/,/^/,/^(?:(?:[a-zA-Z_]|\\u[0-9a-fA-F]{4})(?:[a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})*\(?)/,/^/,(e,r)=>{if(e[0]!==(r==="template"?"}":"`"))return null;for(let i=1;i<e.length;i++){if(e[i]==="`")return i+1;if(e[i]==="$"&&e[i+1]==="{")return i+2;e[i]==="\\"&&i++}return null},(e,r)=>{if(e[0]!==(r==="template"?"}":"`"))return null;for(let i=1;i<e.length;i++){if(e[i]==="`")return i+1;if(e[i]==="$"&&e[i+1]==="{")return i+2;e[i]==="\\"&&i++}return null},/^/,/^\(/,/^\)/,/^\[/,/^\]/,/^\{/,/^\}/,/^(?:(true|false|null|undefined|Infinity|NaN)\b)/,/^and\b/,/^or\b/,/^is\b/,/^has\s+no\b/,/^has\b/,/^in\b/,/^not\s+in\b/,/^not\b/,/^no\b/,/^(?:(asc|desc)(NA?|AN?)?\b)/,/^(?:(?:[a-zA-Z_]|\\u[0-9a-fA-F]{4})(?:[a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})*\()/,/^(?:\$(?:[a-zA-Z_]|\\u[0-9a-fA-F]{4})(?:[a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})*\()/,/^(?:(?:[a-zA-Z_]|\\u[0-9a-fA-F]{4})(?:[a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})*)/,/^(?:\$(?:[a-zA-Z_]|\\u[0-9a-fA-F]{4})(?:[a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})*)/,/^(?:[_\d]*\.)?[_\d]+(?:[eE][-+]?[_\d]+)?\b/,/^(?:\d*\.)?\d+(?:[eE][-+]?\d+)?\b/,/^0[xX][_0-9a-fA-F]+/,/^0[xX][0-9a-fA-F]+/,/^(?:"(?:\\[\\"]|[^"])*")/,/^(?:'(?:\\[\\']|[^'])*')/,/^(?:\/(?:\\.|[^/])+\/[gimsu]*)/,/^@/,/^#/,/^\$\$/,/^\$/,/^=>/,/^=/,/^!=/,/^~=/,/^>=/,/^<=/,/^</,/^>/,/^\.\.\(/,/^\.\(/,/^\.\[/,/^\.\.\./,/^\.\./,/^\./,/^\?\?/,/^\?/,/^,/,/^:/,/^;/,/^\-/,/^\+/,/^\*/,/^\//,/^\%/,/^(?:\|)/,/^./,/^$/],conditions:{preventPrimitive:{rules:[0,1,2,3,4,7,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],inclusive:!0},preventKeyword:{rules:[5,6],inclusive:!1},template:{rules:[8,9],inclusive:!1},INITIAL:{rules:[0,1,7,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],inclusive:!0}},performAction(e,r,i,o){let n=o;switch(i){case 0:{e.commentRanges.push(r.yylloc.range);break}case 1:break;case 2:{return this.popState(),40;break}case 3:{return this.popState(),44;break}case 4:{this.done=!1,this.popState();break}case 5:{if(this.popState(),r.yytext.endsWith("(")){this.unput(r.yytext);return}return e.pps(),14;break}case 6:{this.done=!1,this.popState();break}case 7:{let a=r.yytext.endsWith("`")?"TEMPLATE":"TPL_START";return r.yytext=this.toStringLiteral(r.yytext,!0,1+ +(a!=="TEMPLATE")),a==="TEMPLATE"&&e.pps(),a;break}case 8:{let a=r.yytext.endsWith("`")?"TPL_END":"TPL_CONTINUE";return r.yytext=this.toStringLiteral(r.yytext,!0,1+ +(a!=="TPL_END")),this.popState(),a==="TPL_END"&&e.pps(),a;break}case 9:{this.parseError("Unexpected end of input");break}case 10:return 21;case 11:{return e.pps(),22;break}case 12:return 61;case 13:{return e.pps(),63;break}case 14:return 84;case 15:{if(this.bracketStack[this.bracketStack.length-1]!=="TPL_END")return e.pps(),85;this.unput("}"),this.begin("template");break}case 16:{return r.yytext=this.toLiteral(r.yytext),57;break}case 17:return 36;case 18:return 37;case 19:return 30;case 20:return 35;case 21:return 33;case 22:return 32;case 23:return 34;case 24:return 25;case 25:return 26;case 26:return 95;case 27:{return r.yytext=r.yytext.slice(0,-1),70;break}case 28:{return r.yytext=r.yytext.slice(1,-1),72;break}case 29:{return e.pps(),14;break}case 30:{return e.pps(),r.yytext=r.yytext.slice(1),15;break}case 31:{return e.pps(),r.yytext=this.toNumberLiteral(r.yytext,!0),55;break}case 32:{return e.pps(),r.yytext=this.toNumberLiteral(r.yytext),55;break}case 33:{return e.pps(),r.yytext=this.toNumberLiteral(r.yytext,!0,!0),55;break}case 34:{return e.pps(),r.yytext=this.toNumberLiteral(r.yytext,!1,!0),55;break}case 35:{return e.pps(),r.yytext=this.toStringLiteral(r.yytext),54;break}case 36:{return e.pps(),r.yytext=this.toStringLiteral(r.yytext),54;break}case 37:{return e.pps(),r.yytext=this.toRegExp(r.yytext),56;break}case 38:{return e.pps(),51;break}case 39:{return e.pps(),52;break}case 40:{return e.pps(),53;break}case 41:{return e.pps(),9;break}case 42:return 20;case 43:return 42;case 44:return 43;case 45:return 48;case 46:return 47;case 47:return 45;case 48:return 44;case 49:return 46;case 50:return 69;case 51:return 66;case 52:return 67;case 53:return 89;case 54:{return e.pps(),e.pks(),68;break}case 55:{return e.pps(),e.pks(),65;break}case 56:return 38;case 57:return 17;case 58:return 73;case 59:return 11;case 60:return 10;case 61:return 27;case 62:return 28;case 63:return 39;case 64:return 40;case 65:return 41;case 66:return 29;case 67:{this.parseError(`Bad input on line ${r.yylloc.first_line} column ${r.yylloc.first_column}
`+this.showPosition(),{text:r.yytext,token:"BAD_TOKEN"});break}case 68:return 5}},setInput(e,r){return this.yy=r||this.yy||{},this._input=e,this._more=!1,this._backtrack=!1,this.done=!1,this.currentCondition="INITIAL",this.conditionStack=["INITIAL"],this.offset=0,this.yytext=this.match="",this.yyleng=0,this.yylineno=0,this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.yylloc.range=[0,0],this},parseError(e,r){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,r)},input(){let e=this._input[this.offset],r=/\n|\r\n?|\u2028|\u2029/g.test(e);return this.offset++,this.yyleng++,this.yytext=this.match=this.yytext+e,r?(this.yylineno++,this.yylloc.last_line++,this.yylloc.last_column=0):this.yylloc.last_column++,this.yylloc.range[1]++,e},lineColumnForOffset(e=this.offset,r=this._input,i=1,o=0){let n=/\n|\r\n?|\u2028|\u2029/g,a=i,s=o,m=0,h;for(;(h=n.exec(r))!==null;)if(h.index<e)a++,s=0,m=h.index+h[0].length;else{s+=e-m,m=-1;break}return m!==-1&&(s+=e-m),{line:a,column:s}},setMatch(e,r){let i=this._input.slice(e,r),o=e!==this.offset?this.lineColumnForOffset(e):{line:this.yylloc.last_line,column:this.yylloc.last_column},n=e!==r?this.lineColumnForOffset(r-e,i,o.line,o.column):o;this.yytext=this.match=i,this.yyleng=r-e,this.offset=r,this.yylineno=n.line-1,this.yylloc={first_line:o.line,first_column:o.column,last_line:n.line,last_column:n.column},this.yylloc.range=[e,r]},less(e){let r=this.offset-this.match.length;this.setMatch(r,r+e)},unput(e){let r=this.match.length-e.length;if(!this.match.startsWith(e,r))throw new Error("Lexer#unput() should receive a part of matched text only");this.less(r)},more(){this._more=!0},reject(){throw new Error("reject() is allowed only when options.backtrack_lexer = true")},showPosition(e=this.offset-this.match.length){let r=this._input,i=Math.max(e-20,0),o=Math.min(e+20,r.length),n=(i===0?"":"...")+r.slice(i,e).replace(/\n|\r\n?|\u2028|\u2029/g,"\\n"),a=r.slice(e,o).replace(/\n|\r\n?|\u2028|\u2029/g,"\\n")+(o===r.length?"":"...");return n+a+`
${"-".repeat(n.length)}^`},test_match(e,r){let i;this._more=!1,this._backtrack=!1,this.setMatch(this.offset,this.offset+e[0].length),this.matches=e;let o=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]);return!o&&this._backtrack?(Object.assign(this,i),!1):(this.eof()||(this.done=!1),typeof o=="number"&&this.yy.parser?this.yy.parser.terminals_[o]:o||!1)},eof(){return this.offset===this._input.length},next(){if(this.done)return 1;this.eof()&&(this.done=!0),this._more||(this.yytext="",this.match="");let e,r;for(let i of this.conditions[this.currentCondition].rules){let o=this.rules[i],n=this._input.slice(this.offset),a;if(typeof o=="function"){let s=o(n,this.currentCondition);switch(typeof s){case"string":a=[s];break;case"number":a=[n.slice(0,s)];break;default:a=s}}else a=n.match(o);if(a&&(!e||a[0].length>e[0].length)){e=a,r=i;break}}if(e)return this.test_match(e,r);if(this.eof())return 1;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex(){let e;for(;!e;)e=this.next();return e},begin(e){this.currentCondition=e,this.conditionStack.push(e)},pushState(e){this.begin(e)},popState(){return this.conditionStack.pop(),this.currentCondition=this.conditionStack.length?this.conditionStack[this.conditionStack.length-1]:"INITIAL"},topState(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:"INITIAL"},stateStackSize(){return this.conditionStack.length}}}();function me(){this.yy={}}me.prototype={Parser:me,lexer:er,symbols_:{error:2,root:3,block:4,EOF:5,definitions:6,e:7,def:8,$:9,";":10,":":11,$ident:12,ident:13,IDENT:14,$IDENT:15,condConsequent:16,"?":17,condAlternate:18,query:19,"=>":20,"(":21,")":22,functionArgs:23,compareFunction:24,NOT:25,NO:26,"-":27,"+":28,"|":29,IS:30,assertion:31,IN:32,HAS:33,NOTIN:34,HASNO:35,AND:36,OR:37,"??":38,"*":39,"/":40,"%":41,"=":42,"!=":43,"<":44,"<=":45,">":46,">=":47,"~=":48,queryRoot:49,relativePath:50,"@":51,"#":52,$$:53,STRING:54,NUMBER:55,REGEXP:56,LITERAL:57,template:58,object:59,array:60,"[":61,sliceNotation:62,"]":63,"method()":64,".":65,".(":66,".[":67,"..":68,"..(":69,"METHOD(":70,arguments:71,"$METHOD(":72,",":73,functionArg:74,templateString:75,templateStart:76,templateTail:77,templateEnd:78,templateContinue:79,TEMPLATE:80,TPL_START:81,TPL_CONTINUE:82,TPL_END:83,"{":84,"}":85,objectEntries:86,objectEntry:87,objectEntryKeyLiteral:88,"...":89,arrayElements:90,arrayElement:91,assertionTerm:92,assertionList:93,compareExpr:94,ORDER:95,sliceNotationComponent:96,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",9:"$",10:";",11:":",14:"IDENT",15:"$IDENT",17:"?",20:"=>",21:"(",22:")",25:"NOT",26:"NO",27:"-",28:"+",29:"|",30:"IS",32:"IN",33:"HAS",34:"NOTIN",35:"HASNO",36:"AND",37:"OR",38:"??",39:"*",40:"/",41:"%",42:"=",43:"!=",44:"<",45:"<=",46:">",47:">=",48:"~=",51:"@",52:"#",53:"$$",54:"STRING",55:"NUMBER",56:"REGEXP",57:"LITERAL",61:"[",63:"]",65:".",66:".(",67:".[",68:"..",69:"..(",70:"METHOD(",72:"$METHOD(",73:",",80:"TEMPLATE",81:"TPL_START",82:"TPL_CONTINUE",83:"TPL_END",84:"{",85:"}",89:"...",95:"ORDER"},productions_:[0,[3,2],[4,2],[4,1],[4,1],[4,0],[6,1],[6,2],[8,2],[8,4],[8,2],[8,4],[13,1],[12,1],[16,2],[16,1],[18,2],[18,1],[18,0],[7,1],[7,2],[7,3],[7,4],[7,5],[7,1],[7,2],[7,2],[7,2],[7,2],[7,3],[7,4],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[19,1],[19,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,3],[49,2],[49,2],[49,1],[49,1],[49,3],[49,4],[49,2],[49,2],[49,3],[49,3],[49,2],[49,2],[49,3],[49,2],[49,3],[50,3],[50,4],[50,4],[50,3],[50,3],[50,4],[50,4],[50,3],[50,3],[50,4],[64,2],[64,3],[64,2],[64,3],[71,1],[71,3],[74,1],[23,1],[23,3],[58,1],[58,2],[77,1],[77,2],[77,2],[77,3],[75,1],[76,1],[79,1],[78,1],[59,2],[59,3],[59,4],[59,3],[59,4],[59,5],[86,1],[86,3],[88,1],[88,1],[88,1],[87,1],[87,1],[87,1],[87,1],[87,1],[87,3],[87,3],[87,3],[87,2],[87,2],[87,2],[87,5],[87,1],[87,2],[90,1],[90,3],[91,1],[91,1],[91,2],[60,2],[60,3],[60,4],[31,1],[31,2],[31,3],[31,4],[92,1],[92,1],[92,1],[92,1],[93,1],[93,3],[93,3],[24,1],[24,3],[94,2],[62,1],[62,2],[62,2],[62,3],[96,1],[96,2]],table:function(e){function r(d){let y=d.match(/[\x20-\x2f]/g),b=y?Math.max(...y.map(C=>C.charCodeAt()-32)):-1;for(let C=b;C>=0;C--){let k=(32+C).toString(16),u;d=d.replace(new RegExp("\\[\\x"+k+"(.+?)\\]"),(l,A)=>u=A).replace(new RegExp("\\x"+k,"g"),u)}return d=d.replace(/<([^>]+?)>/g,(C,k)=>{let u=n[k[0]],l=1;return u>>5===1&&(u=u&31|n[k[1]]<<5,l=2),k.slice(l).repeat(u)}),d}function i(d){let y=[];for(let b=0;b<d.length;b++){let C=n[d[b]];if(C&32){let k=n[d[++b]];y.push(C&31|k<<5)}else y.push(C)}return y}let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~|=".split("").reduce((d,y,b)=>(d[y]=b,d),Object.create(null)),[a,s,...m]=e.split("=").map(r),h=s.split(";").map(d=>{let y=[];for(let b=0;b<d.length;b++)for(let C=0,k=n[d[b]];C<3;C++)y.push(k>>C*2&3);return y}),B=m.map(i),E=i(a).map(d=>{let y=h[d],b=Object.create(null);for(let C=0;C<y.length;C++){let k=y[C];if(k!==0){let u=B[k-1].shift();b[C]=k===1?u:[k-1,u]}}return b});for(let d=0;d<B[3].length;d+=2)E[B[3][d]][B[3][d+1]]=[3];return E}(`ABCDEFGHIJKHHHHLL<NM>NOPMMQRSQRTMUVWXYYMZaEFTO<TH>PMbQRSQRcMMHdefgBhBiBHj[ BjBkBk]BFHFHlBMmBnBoBpBqBrBMMsBtBMMMMXMWMMuB[!lBMMuB]vBgBMMwBUMZMxByBzB0B1B2B3B4BH5<DB6>BvBXe7BXevBgBM<E8B>9B~ <DB|>BgCgC<Eh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BgChCiCjCkClCmCnCoCpC>|B~B3B4B5B6B9BgChCiCjCkClCmCnCoCpC|B~B3B4B5B6B7B9BgChCiCjCkClCmCnCoCpC|B~B3B4B5B6BgChCiCjCkClCmCnCoCp<CCgChCi><CC|B~BgChCiClCmCnCo><FC|B~BgChCi>ClCmCnCoCrD-qHrCrHsHtHuH-rCzC#BwHyHsBzH|B~B/rC-rC0H-rC1H-rCzC%2H*rBsDrD<C-rC>yDxD1DwDvD0D7H8H9H<C.2B3B4B5B6B7B8B9BgChCiCjCkClCmCnCoCpC>zC$mElErBhItB1DyEzE0EwEuBvB|HxEkIjI<CzC#B-rC>-rCzC#B-oIrCsCtCuCvCwCxC!zC#B.2B3B4B5B6B7B8B9BgChCiCjCkClCmCnCoCpC-rCzC#B-rCrI8H9H<CyDxD1DwDvD0D>zCuI#BhItB1DyEzE0EwEuBvBvIxE1H<D-rC>wI<C-rC><CzC#B><C-rC>=FDDDEEE<jBG><gBT><mBN><lBY><kB4B><kB6B><mB0B><mB1B><mB7E><mB2B><mB3B><mB5B><mB7B><mB8B><mB9B><mB~B><mB|B><mBgC><mBhC><lBS><mBlC><mBmC>FFF<mBlD><cP><5BM><mBrD><gBsD>BCCC<jBH><lBS><mB9E>FFF<PU><mB4B><mB6B>jDjDNNNiD<bN>iDN<WZ><Wa><jBb><jBc><jBI><jBK><mBtE>~EqEqEoEoEiFiFrErE<mBjC><mBwE><mB0E><mB1E><mB2E><mB3E><5BN><mBkC><cR><mBpC><mBqC><mBtC><mBuC><RwC><mBmD><mBnD><mBuD><gBtD><mBvD>1D1[ D6D6D7D7D]8D8D9D9D~D~DmEmE<D3D><D4D><D5D><RO><5B8C>gDgD<5B~C><Rd><mBf><agB><ahB><aiB><ajB><VkB><UlB><WmB><jBnB><jBoB><mBpB><mBqB><mBrB><dsB><dtB><hBuB><hBvB><hBwB><hBxB><dyB><mBzB><mByC><mB1C><mB2C><mB5C><mB6C><PV><mBnC><mB8E><mBiC><mBuE>|EgFjFjFsEsE<mBxE><D4E><RQ><mBrC><mBsC><mBvC><RxC><mBoD><mBpD><mBwD><mByD>iEiEjEjEkEkEnEnE<5B9C><5B|C><Re><mBzC><mB0C><mB3C><mB4C><mB7C><PW>kDkDiDiD<mBoC><jBJ><jBL><mBvE>pEpEqEqEhF<mByE><mBqD><mBxD>2D2 <mBzD>hEhE|D|DgEgEhDhD<PX><mBzE><D5E><D6E><mB0D>hEhElElE=BB`),defaultActions:{50:[2,1],201:[2,159],249:[2,161]},performAction(t,e,r,i,o,n,a){let s=n.length-1;switch(o){case 1:return i.buildResult(n[s-1]);case 2:this.$={type:"Block",definitions:n[s-1],body:n[s],range:this._$.range};break;case 3:this.$={type:"Block",definitions:n[s],body:{type:"Placeholder",range:[a[s].range[1],a[s].range[1]]},range:this._$.range};break;case 4:this.$={type:"Block",definitions:[],body:n[s],range:this._$.range};break;case 5:this.$={type:"Block",definitions:[],body:{type:"Placeholder",range:[a[s].range[1],a[s].range[1]]},range:this._$.range};break;case 6:case 96:case 99:case 101:case 117:case 136:case 152:case 155:this.$=[n[s]];break;case 7:n[s-1].push(n[s]);break;case 8:this.$={type:"Definition",declarator:{type:"Declarator",name:null,range:a[s-1].range},value:null,range:this._$.range};break;case 9:this.$={type:"Definition",declarator:{type:"Declarator",name:null,range:a[s-3].range},value:n[s-1],range:this._$.range};break;case 10:this.$={type:"Definition",declarator:{type:"Declarator",name:n[s-1].name,range:a[s-1].range},value:null,range:this._$.range};break;case 11:this.$={type:"Definition",declarator:{type:"Declarator",name:n[s-3].name,range:a[s-3].range},value:n[s-1],range:this._$.range};break;case 12:case 13:case 98:case 148:case 149:this.$={type:"Identifier",name:n[s],range:this._$.range};break;case 14:case 16:case 163:this.$=n[s];break;case 15:case 17:this.$={type:"Placeholder",range:[a[s].range[1],a[s].range[1]]};break;case 18:case 162:this.$=null;break;case 19:case 52:case 53:case 64:case 65:case 138:break;case 20:case 22:this.$={type:"Function",arguments:[],body:n[s],range:this._$.range};break;case 21:this.$={type:"Function",arguments:[{type:"Identifier",name:n[s-2],range:a[s-2].range}],body:n[s],range:this._$.range};break;case 23:this.$={type:"Function",arguments:n[s-3],body:n[s],range:this._$.range};break;case 24:this.$={type:"CompareFunction",compares:n[s],range:this._$.range};break;case 25:case 26:case 27:case 28:case 67:this.$={type:"Prefix",operator:n[s-1],argument:n[s],range:this._$.range};break;case 29:this.$={type:"Pipeline",left:n[s-2],right:n[s],range:this._$.range};break;case 30:this.$={type:"Pipeline",left:n[s-3],right:{type:"Block",definitions:n[s-1],body:n[s]},range:this._$.range};break;case 31:this.$={type:"Postfix",operator:n[s],argument:n[s-2],range:this._$.range};break;case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:this.$={type:"Binary",operator:n[s-1],left:n[s-2],right:n[s],range:this._$.range};break;case 51:this.$={type:"Conditional",test:n[s-2],consequent:n[s-1],alternate:n[s],range:this._$.range};break;case 54:this.$={type:"Data",range:this._$.range};break;case 55:this.$={type:"Context",range:this._$.range};break;case 56:this.$={type:"Current",range:this._$.range};break;case 57:this.$={type:"Arg1",range:this._$.range};break;case 58:this.$={type:"Reference",name:n[s],range:this._$.range};break;case 59:case 60:case 61:case 62:case 107:case 108:case 109:case 110:case 119:case 120:case 121:this.$={type:"Literal",value:n[s],range:this._$.range};break;case 63:this.$={type:"Template",values:n[s],range:this._$.range};break;case 66:this.$={type:"SliceNotation",value:null,arguments:n[s-1],range:this._$.range};break;case 68:this.$={type:"Conditional",test:null,consequent:n[s-1],alternate:n[s],range:this._$.range};break;case 69:case 73:this.$={type:"GetProperty",value:null,property:n[s],range:this._$.range};break;case 70:case 74:this.$={type:"MethodCall",value:null,method:n[s],range:this._$.range};break;case 71:this.$={type:"Parentheses",body:n[s-1],range:this._$.range};break;case 72:this.$={type:"Parentheses",body:{type:"Block",definitions:n[s-2],body:n[s-1]},range:this._$.range};break;case 75:this.$={type:"Map",value:null,query:n[s-1],range:this._$.range};break;case 76:this.$={type:"Filter",value:null,query:n[s-1],range:this._$.range};break;case 77:this.$={type:"MapRecursive",value:null,query:{type:"GetProperty",value:null,property:n[s]},range:this._$.range};break;case 78:this.$={type:"MapRecursive",value:null,query:{type:"MethodCall",value:null,method:n[s]},range:this._$.range};break;case 79:this.$={type:"MapRecursive",value:null,query:n[s-1],range:this._$.range};break;case 80:this.$={type:"Pipeline",left:null,right:n[s],range:this._$.range};break;case 81:this.$={type:"Pipeline",left:null,right:{type:"Block",definitions:n[s-1],body:n[s]},range:this._$.range};break;case 82:this.$={type:"Pick",value:n[s-2],getter:null,range:this._$.range};break;case 83:this.$={type:"Pick",value:n[s-3],getter:n[s-1],range:this._$.range};break;case 84:this.$={type:"SliceNotation",value:n[s-3],arguments:n[s-1],range:this._$.range};break;case 85:this.$={type:"GetProperty",value:n[s-2],property:n[s],range:this._$.range};break;case 86:this.$={type:"MethodCall",value:n[s-2],method:n[s],range:this._$.range};break;case 87:this.$={type:"Map",value:n[s-3],query:n[s-1],range:this._$.range};break;case 88:this.$={type:"Filter",value:n[s-3],query:n[s-1],range:this._$.range};break;case 89:this.$={type:"MapRecursive",value:n[s-2],query:{type:"GetProperty",value:null,property:n[s]},range:this._$.range};break;case 90:this.$={type:"MapRecursive",value:n[s-2],query:{type:"MethodCall",value:null,method:n[s]},range:this._$.range};break;case 91:this.$={type:"MapRecursive",value:n[s-3],query:n[s-1],range:this._$.range};break;case 92:this.$={type:"Method",reference:{type:"Identifier",name:n[s-1],range:[a[s-1].range[0],a[s-1].range[1]-1]},arguments:[],range:this._$.range},this._mn=n[s-1];break;case 93:this.$={type:"Method",reference:{type:"Identifier",name:n[s-2],range:[a[s-2].range[0],a[s-2].range[1]-1]},arguments:n[s-1],range:this._$.range},this._mn=n[s-2];break;case 94:this.$={type:"Method",reference:{type:"Reference",name:{type:"Identifier",name:n[s-1],range:[a[s-1].range[0],a[s-1].range[1]-1]},range:[a[s-1].range[0],a[s-1].range[1]-1]},arguments:[],range:this._$.range},this._mn=n[s-1];break;case 95:this.$={type:"Method",reference:{type:"Reference",name:{type:"Identifier",name:n[s-2],range:[a[s-2].range[0],a[s-2].range[1]-1]},range:[a[s-2].range[0],a[s-2].range[1]-1]},arguments:n[s-1],range:this._$.range},this._mn=n[s-2];break;case 97:case 100:case 118:case 137:case 156:n[s-2].push(n[s]);break;case 102:this.$=[n[s-1],...n[s]];break;case 103:case 158:this.$=[null,n[s]];break;case 104:case 160:this.$=[n[s-1],n[s]];break;case 105:this.$=[null,n[s-1],...n[s]];break;case 106:this.$=[n[s-2],n[s-1],...n[s]];break;case 111:case 114:this.$={type:"Object",properties:[],range:this._$.range};break;case 112:this.$={type:"Object",properties:n[s-1],range:this._$.range};break;case 113:this.$={type:"Object",properties:n[s-2],range:this._$.range};break;case 115:this.$={type:"Block",definitions:n[s-2],body:{type:"Object",properties:n[s-1]},range:this._$.range};break;case 116:this.$={type:"Block",definitions:n[s-3],body:{type:"Object",properties:n[s-2]},range:this._$.range};break;case 122:this.$={type:"ObjectEntry",key:{type:"Current"},value:null,range:this._$.range};break;case 123:this.$={type:"ObjectEntry",key:{type:"Reference",name:n[s]},value:null,range:this._$.range};break;case 124:case 126:this.$={type:"ObjectEntry",key:n[s],value:null,range:this._$.range};break;case 125:this.$={type:"ObjectEntry",key:{type:"Literal",value:this._mn},value:n[s],range:this._$.range};break;case 127:case 128:this.$={type:"ObjectEntry",key:n[s-2],value:n[s],range:this._$.range};break;case 129:this.$={type:"ObjectEntry",key:{type:"Identifier",name:"$"+n[s-2].name,range:a[s-2].range},value:n[s],range:this._$.range};break;case 130:this.$={type:"ObjectEntry",key:n[s-1],value:{type:"Pipeline",left:{type:"Reference",name:n[s-1]},right:n[s]},range:this._$.range};break;case 131:this.$={type:"ObjectEntry",key:n[s-1],value:{type:"Pipeline",left:{type:"GetProperty",value:null,property:n[s-1]},right:n[s]},range:this._$.range};break;case 132:this.$={type:"ObjectEntry",key:{type:"Literal",value:this._mn},value:{type:"Pipeline",left:n[s-1],right:n[s]},range:this._$.range};break;case 133:this.$={type:"ObjectEntry",key:n[s-3],value:n[s],range:this._$.range};break;case 134:this.$={type:"Spread",query:null,array:!1,range:this._$.range};break;case 135:this.$={type:"Spread",query:n[s],array:!1,range:this._$.range};break;case 139:this.$={type:"Spread",query:null,array:!0,range:this._$.range};break;case 140:this.$={type:"Spread",query:n[s],array:!0,range:this._$.range};break;case 141:this.$={type:"Array",elements:[],range:this._$.range};break;case 142:this.$={type:"Array",elements:n[s-1],range:this._$.range};break;case 143:this.$={type:"Array",elements:n[s-2],range:this._$.range};break;case 144:this.$={type:"Assertion",negation:!1,assertion:n[s],range:this._$.range};break;case 145:this.$={type:"Assertion",negation:!0,assertion:n[s],range:this._$.range};break;case 146:this.$={type:"Assertion",negation:!1,assertion:n[s-1],range:this._$.range};break;case 147:this.$={type:"Assertion",negation:!0,assertion:n[s-1],range:this._$.range};break;case 150:this.$={type:"Method",reference:{type:"Reference",name:n[s]},arguments:[],range:this._$.range};break;case 151:this.$={type:"Identifier",name:String(n[s]),range:this._$.range};break;case 153:case 154:n[s-2].push(n[s-1],n[s]);break;case 157:this.$={type:"Compare",query:n[s-1],order:n[s],range:this._$.range};break;case 159:this.$=[null,n[s-1],n[s]];break;case 161:this.$=[n[s-2],n[s-1],n[s]];break}},trace(...t){this.DEBUG&&Jison.print(...t)},parseError(t,e){if(e.recoverable)this.trace(t);else{let r=new Error(t);throw r.hash=e,r}},parse(t,...e){let s=M=>{C.length-=2*M,k.length-=M,u.length-=M},m=()=>{let M=h.lex()||1;return typeof M!="number"&&(M=this.symbols_[M]||M),M},h=Object.create(this.lexer),B=h.options&&h.options.ranges,E={...this.yy,parser:this,lexer:h};h.setInput(t,E),typeof E.parseError=="function"&&(this.parseError=E.parseError),typeof h.yylloc>"u"&&(h.yylloc={});let d=this.table,y={},b=h.yylloc,C=[0],k=[null],u=[b],l=[],A="",p=0,f=0,c=0,g,O;for(;;){let M=C[C.length-1],N;if(this.defaultActions[M]?N=this.defaultActions[M]:((g===null||typeof g>"u")&&(g=m()),N=d[M]&&d[M][g]),!N||!N[0]){let ne=function(q){let H=C.length-1,gt=0;for(;;){if("2"in d[q])return gt;if(q===0||H<2)return!1;H-=2,q=C[H],++gt}},L,R="";if(!c){let q=[];for(let H in d[M])H in this.terminals_&&H>2&&q.push("'"+this.terminals_[H]+"'");R=h.showPosition?"Parse error on line "+(p+1)+`:
`+h.showPosition()+`
Expecting `+q.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(p+1)+": Unexpected "+(g===1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(R,{text:h.match,token:this.terminals_[g]||g,line:h.yylineno,loc:b,expected:q})}if(c===3){if(g===1||O===1)throw new Error(R||"Parsing halted while starting to recover from another error.");f=h.yyleng,A=h.yytext,p=h.yylineno,b=h.yylloc,g=m()}if(L===!1)throw new Error(R||"Parsing halted. No suitable error recovery rule available.");s(L),O=g==2?null:g,g=2,M=C[C.length-1],N=d[M]&&d[M][2],c=3}if(Array.isArray(N[0])&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+g);switch(N[0]){case 1:C.push(g),k.push(h.yytext),u.push(h.yylloc),C.push(N[1]),g=null,O?(g=O,O=null):(f=h.yyleng,A=h.yytext,p=h.yylineno,b=h.yylloc,c>0&&c--);break;case 2:{let L=this.productions_[N[1]][1],R=u[u.length-(L||1)],ne=u[u.length-1];y.$=k[k.length-L],y._$={first_line:R.first_line,last_line:ne.last_line,first_column:R.first_column,last_column:ne.last_column},B&&(y._$.range=[R.range[0],ne.range[1]]);let q=this.performAction.call(y,A,f,p,E,N[1],k,u,...e);if(typeof q<"u")return q;L&&s(L),C.push(this.productions_[N[1]][0]),k.push(y.$),u.push(y._$),C.push(d[C[C.length-2]][C[C.length-1]]);break}case 3:return!0}}}};var tr=function(e){function r(l,A){Object.entries(A).forEach(([p,f])=>l[p]=f(l[p]))}let i=new Map([["EOF",["<end of input>"]],["IDENT",["ident"]],["$IDENT",["$ident"]],["NOT",["'not'"]],["NO",["'no'"]],["IS",["'is'"]],["IN",["'in'"]],["HAS",["'has'"]],["NOTIN",["'not in'"]],["HASNO",["'has no'"]],["AND",["'and'"]],["OR",["'or'"]],["STRING",["string"]],["TPL_START",["template"]],["TEMPLATE",["template"]],["NUMBER",["number"]],["REGEXP",["regexp"]],["LITERAL",["'true'","'false'","'null'","'undefined'","'NaN'","'Infinity'"]],["ORDER",["'asc'","'desc'","'ascN'","'descN'"]],["METHOD(",["'method('"]],["$METHOD(",["'$method('"]]]),o=l=>i.get(l)||`'${l}'`,n=function(l,A={},p){if(A.recoverable)this.trace(l);else{if(Array.isArray(A.inside)){let M=p.lexer.offset-p.lexer.match.length;p.lexer.setMatch(M+A.inside[0],M+A.inside[1])}let f=p.lexer.yylloc,c=[l.split(/\n/)[0],"",p.lexer.showPosition()],g=Array.isArray(A.expected)?[...new Set([].concat(...A.expected.map(M=>o(M.slice(1,-1)))))]:null;g&&c.push("","Expecting "+g.join(", ")+" got "+o(A.token));let O=new SyntaxError(c.join(`
`));throw O.details={rawMessage:l,text:A.text,token:A.token,expected:g,loc:{range:f.range,start:{line:f.first_line,column:f.first_column,offset:f.range[0]},end:{line:f.last_line,column:f.last_column,offset:f.range[1]}}},O}},a=new Set([`
`,"\r","\u2028","\u2029"]),s=new Map([["undefined",void 0],["null",null],["false",!1],["true",!0],["Infinity",1/0],["NaN",NaN]]);Object.assign(e.lexer,{toLiteral:l=>s.get(l),toNumberLiteral(l,A,p=!1){if(A){let f=l.match(p?/(?:^|[^0-9a-fA-F])_|_(?:[^0-9a-fA-F]|$)/:/(?:^|\D)_|_(?:\D|$)/);if(f){let c=f[0],g=f.index+ +(c[1]==="_"),O=c==="__"?"Only one underscore is allowed":"Wrong underscore";this.parseError(O+" as numeric separator",{inside:[g,g+1]})}l=l.replace(/_/g,"")}return p?parseInt(l,16):parseFloat(l)},toStringLiteral(l,A=!1,p=1){let f=l.length-p,c="";for(let g=1;g<f;g++){if(!A&&a.has(l[g])&&this.parseError("Invalid line terminator",{inside:[g,g+1]}),l[g]!=="\\"){c+=l[g];continue}g===f-1&&this.parseError("Invalid backslash",{inside:[g,g+1]});let O=l[++g];switch(O){case"\r":g+=l[g+1]===`
`;break;case`
`:case"\u2028":case"\u2029":break;case"0":c+="\0";break;case"b":c+="\b";break;case"n":c+=`
`;break;case"r":c+="\r";break;case"f":c+="\f";break;case"t":c+=" ";break;case"v":c+="\v";break;case"u":{let[M=""]=l.slice(g+1,g+5).match(/^[0-9a-f]*/i)||[];if(M.length===4){c+=String.fromCharCode(parseInt(M,16)),g+=4;break}this.parseError("Invalid Unicode escape sequence",{inside:[g-1,Math.min(g+1+M.length,f)]});break}case"x":{let[M=""]=l.slice(g+1,g+3).match(/^[0-9a-f]*/i)||[];if(M.length===2){c+=String.fromCharCode(parseInt(M,16)),g+=2;break}this.parseError("Invalid hexadecimal escape sequence",{inside:[g-1,Math.min(g+1+M.length,f)]});break}default:c+=O}}return c},toRegExp(l){let A=l.lastIndexOf("/")+1,p=l.substr(A);return p.split("").forEach((f,c,g)=>{let O=g.indexOf(f,c+1);O!==-1&&this.parseError("Duplicate flag in regexp",{inside:[A+O,A+O+1]})}),new RegExp(l.substr(1,l.lastIndexOf("/")-1),p)}}),r(e.lexer,{setInput:l=>function(A,p){let f=[];return p.commentRanges=f,p.buildResult=c=>({ast:c,commentRanges:f}),p.parseError=function(...c){return n.call(this,...c,p)},p.pks=()=>{this.eof()||this.begin("preventKeyword")},p.pps=()=>{this.eof()||this.begin("preventPrimitive")},this.bracketStack=[],this.prevToken=null,this.prevYylloc={first_line:1,last_line:1,first_column:0,last_column:0,range:[0,0]},l.call(this,A,p)}});let m=new e.Parser;m.lexer={...e.lexer},m.yy={...e.yy};let h=["AND","OR","IN","NOTIN","HAS","HASNO","IS"],B=[...h,"NOT","NO","ORDER"],E=["+","-","*","/","%","|","=","!=","~=",">=","<=","<",">"],d=[null,"?",":",";",",",".","..","(",".(","..(","METHOD(","$METHOD(","[",".[","=>",...E,...h,"NOT","NO"],y=[",","?",":",";","EOF","]",")","}","TPL_CONTINUE","TPL_END",...E,...h,"ORDER"],b=new Map(d.map(l=>[l,new Set(y)]));for(let l of[".(","..(","METHOD(","$METHOD("])b.get(l).delete(")");for(let l of["[",".["])b.get(l).delete("]");r(m.lexer,{lex:l=>function(){let p=this.offset,f=l.call(this);if(b.has(this.prevToken)&&b.get(this.prevToken).has(f)){let c={first_line:this.prevYylloc.last_line,last_line:this.yylloc.first_line,first_column:this.prevYylloc.last_column,last_column:this.yylloc.first_column,range:[this.prevYylloc.range[1],this.yylloc.range[0]]};if(this.unput(this.match),this.pushState("preventPrimitive"),this.done=!1,this.yytext="",this.yylloc=this.prevYylloc=c,p!==this.offset&&B.includes(f))switch(this._input[p]){case" ":case" ":c.last_column--,c.range[1]--;break;case`
`:{let g=this._input.lastIndexOf(`
`,p-1);c.last_line--,c.last_column=g===-1?c.last_column-1:p-g,c.range[1]--;break}}return this.prevToken="IDENT"}if(this.prevYylloc=this.yylloc,B.includes(f))switch(this._input[this.offset]){case" ":case" ":this.prevYylloc={...this.prevYylloc,last_column:this.prevYylloc.last_column+1,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]};break;case`
`:this.prevYylloc={...this.prevYylloc,last_line:this.prevYylloc.last_line+1,last_column:0,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]};break}return this.prevToken=f}});let C=new Map([["(",")"],[".(",")"],["..(",")"],["METHOD(",")"],["$METHOD(",")"],["[","]"],[".[","]"],["{","}"],["TPL_START","TPL_END"]]),k=new Set([")","]","}","TPL_END"]),u=l=>function(){let p=l.call(this);if(k.has(p)){let f=this.bracketStack.pop();f!==p&&this.parseError(`Expected "${f}" got "${p}"`)}return C.has(p)&&this.bracketStack.push(C.get(p)),p};return r(e.lexer,{lex:u}),r(m.lexer,{lex:u}),{parse(l,A){return A?m.parse(l):e.parse(l)},*tokenize(l,A,p){let f=A?m:e,c=Object.create(f.lexer);for(c.setInput(l,{parser:f});!c.done;){let g={type:c.lex(),value:c.match,offset:c.yylloc.range[0]};p&&(g.loc={range:c.yylloc.range,start:{line:c.yylloc.first_line,column:c.yylloc.first_column},end:{line:c.yylloc.last_line,column:c.yylloc.last_column}}),yield g}}}}(new me),se=tr;var Ae={};w(Ae,{compile:()=>rr,stringify:()=>ir,walk:()=>nr});function rr(t,e){let r=e.scope.arg1;e.put(typeof r=="string"?r:"undefined")}function nr(){}function ir(t,e){e.put("$$")}var de={};w(de,{compile:()=>or,stringify:()=>lr,suggest:()=>sr,walk:()=>ar});function sr(t,e){t.elements.length===0&&e.queryRoot(t.range[0]+1,t.range[1]-1)}function or(t,e){e.put("["),e.list(t.elements,","),e.put("]")}function ar(t,e){e.list(t.elements)}function lr(t,e){e.put("["),e.list(t.elements,","),e.put("]")}var Ce={};w(Ce,{compile:()=>pr,stringify:()=>fr,suggest:()=>ur,walk:()=>cr});function ur(t,e){Array.isArray(t.assertion)||(e.range(t.assertion.range,"var"),e.range(t.assertion.range,"assertion"))}function pr(t,e){if(Array.isArray(t.assertion)){e.put(t.negation?"!(":"(");for(let r=0;r<t.assertion.length;r++)if(r%2===0)e.node(t.assertion[r]);else switch(t.assertion[r]){case"and":e.put("&&");break;case"or":e.put("||");break;default:e.error("Bad conjuction operator in assertion",t)}e.put(")")}else switch(t.negation&&e.put("!"),t.assertion.type){case"Identifier":t.assertion.name?(e.put("!!"),e.tolerant&&e.put("(typeof "),e.put("a["),e.node(t.assertion),e.put("]"),e.tolerant&&(e.put('==="function"?a['),e.node(t.assertion),e.put("]")),e.put(".call(mctx,"),e.nodeOrCurrent(),e.put(")"),e.tolerant&&e.put(":false)"),e.usedAssertions.has(t.assertion.name)?e.usedAssertions.get(t.assertion.name).push(t.assertion.range):e.usedAssertions.set(t.assertion.name,t.assertion.range)):e.put("false");break;case"Method":e.put("!!"),e.node(t.assertion);break;default:e.error('Unknown assertion node type "'+t.assertion.type+'"',t.assertion)}}function cr(t,e){if(Array.isArray(t.assertion))for(let r=0;r<t.assertion.length;r++)r%2===0&&e.node(t.assertion[r]);else e.node(t.assertion)}function fr(t,e){if(t.negation&&e.put("not "),Array.isArray(t.assertion)){e.put("(");for(let r=0;r<t.assertion.length;r++)r%2===0?e.node(t.assertion[r]):(e.put(" "),e.put(t.assertion[r]),e.put(" "));e.put(")")}else e.node(t.assertion)}var be={};w(be,{compile:()=>gr,stringify:()=>mr,suggest:()=>hr,walk:()=>yr});var At={in:"in","not in":"notIn",has:"has","has no":"hasNo",and:"and",or:"or","??":"nullish","+":"add","-":"sub","*":"mul","/":"div","%":"mod","=":"eq","!=":"ne","<":"lt","<=":"lte",">":"gt",">=":"gte","~=":"match"};function oe(t,e,r){if(r.type==="Array"){if(r.elements.length===0){t.range([r.range[0]+1,r.range[1]-1],"value-subset",e,!1);return}let i=[];for(let{type:n,range:a,value:s}of r.elements)a&&(n==="Literal"||n==="Identifier")&&i.push(s);let o=i.length?t.literalList(i):!1;for(let{type:n,range:a,value:s}of r.elements)a&&(n==="Literal"||n==="Identifier"||n==="GetProperty"&&s===null)&&t.range(a,"value-subset",e,o)}}function hr(t,e){switch(t.operator){case"in":e.range(t.left.range,"in-value",t.right,null),oe(e,t.left,t.right);break;case"not in":oe(e,t.left,t.right);break;case"has":e.range(t.right.range,"in-value",t.left,null),oe(e,t.right,t.left);break;case"has no":oe(e,t.right,t.left);break;case"=":case"!=":e.range(t.right.range,"value",t.left,null);break}}function gr(t,e){if(!(t.operator in At)){e.error('Unknown operator "'+t.operator+'"',t);return}switch(t.operator){case"and":e.put("!");case"or":{let r=e.allocateVar();e.put(`${e.buildinFn("bool")}(${r}=`),e.node(t.left),e.put(`)?${r}:`),e.createScope(()=>e.node(t.right),i=>(e.put(")"),"("+i+","),e.scope.$ref);break}case"??":{let r=e.allocateVar();e.put(`(${r}=`),e.node(t.left),e.put(`,${r}!==null&&${r}!==undefined)?${r}:`),e.createScope(()=>e.node(t.right),i=>(e.put(")"),"("+i+","),e.scope.$ref);break}case"has no":e.put("!");case"has":e.put(e.buildinFn("in")),e.put("("),e.node(t.right),e.put(","),e.node(t.left),e.put(")");break;default:e.put(e.buildinFn(At[t.operator])),e.put("("),e.node(t.left),e.put(","),e.node(t.right),e.put(")")}}function yr(t,e){e.node(t.left),e.node(t.right)}function mr(t,e){e.node(t.left),/^[a-z]/i.test(t.operator)?(e.put(" "),e.put(t.operator),e.put(" ")):e.put(t.operator),e.node(t.right)}var ke={};w(ke,{compile:()=>dr,stringify:()=>br,suggest:()=>Ar,walk:()=>Cr});function Ar(t,e){t.body===null&&e.queryRoot(t.range[1])}function dr(t,e){t.definitions.length?(e.put("(()=>{"),e.createScope(()=>{for(let{declarator:r}of t.definitions)r.name&&e.scope.awaitInit.add(e.unescapeName("$"+r.name,r));e.list(t.definitions),e.put("return "),e.nodeOrCurrent(t.body)},r=>r+";",e.scope.$ref),e.put("})()")):t.body&&t.body.type==="Object"?(e.put("("),e.nodeOrCurrent(t.body),e.put(")")):e.nodeOrCurrent(t.body)}function Cr(t,e){e.list(t.definitions),e.nodeOrNothing(t.body)}function br(t,e){e.list(t.definitions),e.nodeOrNothing(t.body)}var Be={};w(Be,{compile:()=>kr,stringify:()=>Er,walk:()=>Br});var dt={"":"cmp",N:"cmpNatural",A:"cmpAnalytical",NA:"cmpNaturalAnalytical",AN:"cmpNaturalAnalytical"};function kr(t,e){let r=t.order.startsWith("desc"),i=dt[t.order.slice(r?4:3)]||dt[""];r&&e.put("-"),e.put(e.buildinFn(i)),e.put("((_q=$=>("),e.createScope(()=>e.node(t.query),o=>o+","),e.put("))(_a),_q(_b))")}function Br(t,e){e.node(t.query)}function Er(t,e){e.node(t.query),e.put(" "),e.put(t.order)}var Ee={};w(Ee,{compile:()=>wr,stringify:()=>Dr,walk:()=>Mr});function wr(t,e){e.put("(_a, _b)=>{let _q;return "),e.list(t.compares,"||"),e.put("||0}")}function Mr(t,e){e.list(t.compares)}function Dr(t,e){e.list(t.compares,",")}var we={};w(we,{compile:()=>Or,stringify:()=>Nr,walk:()=>Sr});function Or(t,e){e.put(e.buildinFn("bool")),e.put("("),e.nodeOrCurrent(t.test),e.put(")?"),e.createScope(()=>e.nodeOrCurrent(t.consequent),r=>(e.put(")"),"("+r+","),e.scope.$ref),e.put(":"),e.createScope(()=>{t.alternate?t.alternate.type==="Placeholder"?(e.put("("),e.node(t.alternate),e.put(",undefined)")):e.node(t.alternate):e.put("undefined")},r=>(e.put(")"),"("+r+","),e.scope.$ref)}function Sr(t,e){e.nodeOrNothing(t.test),e.nodeOrNothing(t.consequent),e.nodeOrNothing(t.alternate)}function Nr(t,e){e.nodeOrNothing(t.test),e.put("?"),e.nodeOrNothing(t.consequent),t.alternate&&(e.put(":"),e.node(t.alternate))}var Me={};w(Me,{compile:()=>_r,stringify:()=>Fr,walk:()=>vr});function _r(t,e){e.put("context")}function vr(){}function Fr(t,e){e.put("#")}var De={};w(De,{compile:()=>Tr,stringify:()=>Pr,suggest:()=>Ir,walk:()=>qr});function Ir(t,e){t.range&&e.range(t.range,"var")}function Tr(t,e){e.put(e.scope.$ref)}function qr(){}function Pr(t,e){e.put("$")}var Oe={};w(Oe,{compile:()=>Rr,stringify:()=>xr,walk:()=>jr});function Rr(t,e){e.put("data")}function jr(){}function xr(t,e){e.put("@")}var Se={};w(Se,{compile:()=>zr,stringify:()=>Hr,walk:()=>Lr});function zr(t,e){t.name&&e.putIdent("$"+e.unescapeName(t.name,t),t)}function Lr(){}function Hr(t,e){e.put(t.name?"$"+t.name:"$")}var Ne={};w(Ne,{compile:()=>Ur,stringify:()=>Vr,suggest:()=>Yr,walk:()=>Wr});function Q(t,e){return{type:"GetProperty",value:t,property:e}}function ae(t){return{type:"Identifier",name:t}}var Gr=["$data","$context","$ctx","$array","$idx","$index"];function Yr(t,e){t.value===null&&e.range(t.declarator.range,"path")}function Ur(t,e){let r=t.declarator.name,i=r&&e.unescapeName("$"+r,t);if(i===null){e.node(t.declarator),e.nodeOrCurrent(t.value),e.put(";");return}if(e.scope.own.has(i)){e.error(`Identifier "${i}" has already been declared`,t.declarator);return}if(Gr.includes(i)){e.error(`Identifier "${i}" is reserved for future use`,t.declarator);return}e.put("const "),e.node(t.declarator),e.put("="),e.node(t.value||Q(null,ae(r))),e.put(";"),e.scope.add(i),e.scope.own.add(i),e.scope.awaitInit.delete(i)}function Wr(t,e){e.node(t.declarator),e.nodeOrNothing(t.value)}function Vr(t,e){e.node(t.declarator),t.value!==null&&(e.put(":"),e.node(t.value)),e.put(";")}var _e={};w(_e,{compile:()=>Jr,stringify:()=>Qr,walk:()=>Kr});function Jr(t,e){e.put(e.buildinFn("filter")),e.put("("),e.nodeOrCurrent(t.value),e.put(",$=>"),e.createScope(()=>e.node(t.query),r=>(e.put(")"),"("+r+",")),e.put(")")}function Kr(t,e){e.nodeOrNothing(t.value),e.node(t.query)}function Qr(t,e){e.nodeOrNothing(t.value),e.put(".["),e.node(t.query),e.put("]")}var ve={};w(ve,{compile:()=>Zr,stringify:()=>$r,walk:()=>Xr});function Zr(t,e){let r=t.arguments.map(o=>e.unescapeName("$"+o.name,o)),i=t.arguments.find((o,n)=>n>0&&r.lastIndexOf("$"+o.name,n-1)!==-1);i&&e.error('Duplicate parameter name "$'+i.name+'" is not allowed',i),e.put("function("),e.put(String(r)||"$"),e.put("){return "),e.createScope(()=>{e.scope.arg1=r[1]||"arguments[1]",e.scope.$ref=r[0]||"$";for(let o of r)e.scope.add(o);e.node(t.body)},o=>o+","),e.put("}")}function Xr(t,e){e.node(t.body)}function $r(t,e){e.put("=>"),e.node(t.body)}var Fe={};w(Fe,{compile:()=>tn,stringify:()=>nn,suggest:()=>en,walk:()=>rn});function en(t,e){e.range(t.property.range,"path",t.value||void 0,!t.value),t.value===null&&e.range(t.property.range,"var"),t.range&&t.value===null&&t.property.range[0]!==t.range[0]&&e.queryRoot(t.range[0])}function tn(t,e){e.put(e.buildinFn("map")),e.put("("),e.nodeOrCurrent(t.value),e.put(","),e.node(t.property),e.put(")")}function rn(t,e){e.nodeOrNothing(t.value),e.node(t.property)}function nn(t,e){e.nodeOrNothing(t.value)&&e.put("."),e.node(t.property)}var Ie={};w(Ie,{compile:()=>sn,stringify:()=>an,walk:()=>on});function sn(t,e){e.put(JSON.stringify(e.unescapeName(t.name,t,!1)))}function on(){}function an(t,e){e.put(t.name)}var Te={};w(Te,{compile:()=>ln,stringify:()=>pn,walk:()=>un});function ln(t,e){e.put(typeof t.value=="string"?JSON.stringify(t.value):String(t.value))}function un(){}function pn(t,e){e.put(typeof t.value=="string"?JSON.stringify(t.value):String(t.value))}var qe={};w(qe,{compile:()=>cn,stringify:()=>hn,walk:()=>fn});function cn(t,e){e.put(e.buildinFn("map")),e.put("("),e.nodeOrCurrent(t.value),e.put(",$=>"),e.createScope(()=>e.node(t.query),r=>(e.put(")"),"("+r+",")),e.put(")")}function fn(t,e){e.nodeOrNothing(t.value),e.node(t.query)}function hn(t,e){e.nodeOrNothing(t.value),e.put(".("),e.node(t.query),e.put(")")}var Pe={};w(Pe,{compile:()=>gn,stringify:()=>mn,walk:()=>yn});function gn(t,e){e.put(e.buildinFn("mapRecursive")),e.put("("),e.nodeOrCurrent(t.value),e.put(",$=>"),e.createScope(()=>e.node(t.query),r=>(e.put(")"),"("+r+",")),e.put(")")}function yn(t,e){e.nodeOrNothing(t.value),e.node(t.query)}function mn(t,e){e.nodeOrNothing(t.value),e.put(".."),e.isSimpleGetPropertyQuery(t.query)||e.isSimpleMethodCallQuery(t.query)?e.node(t.query):(e.put("("),e.node(t.query),e.put(")"))}var Re={};w(Re,{compile:()=>dn,stringify:()=>bn,suggest:()=>An,walk:()=>Cn});function An(t,e){t.arguments.length===0&&e.queryRoot(t.range[1]-1)}function dn(t,e,r){let i=t.reference.type==="Identifier";e.tolerant&&e.put("(typeof "),i?(e.usedMethods.has(t.reference.name)?e.usedMethods.get(t.reference.name).push(t.reference.range):e.usedMethods.set(t.reference.name,[t.reference.range]),e.put("m["),e.node(t.reference),e.put("]")):e.node(t.reference),e.tolerant&&(e.put('==="function"?'),i?(e.put("m["),e.node(t.reference),e.put("]")):e.node(t.reference)),e.put(i?".call(mctx,":"("),e.nodeOrCurrent(r),t.arguments.length&&(e.put(","),e.list(t.arguments,",")),e.put(")"),e.tolerant&&e.put(":undefined)")}function Cn(t,e){e.node(t.reference),e.list(t.arguments)}function bn(t,e){e.node(t.reference),e.put("("),e.list(t.arguments,","),e.put(")")}var je={};w(je,{compile:()=>kn,stringify:()=>En,walk:()=>Bn});function kn(t,e){e.node(t.method,t.value)}function Bn(t,e){e.nodeOrNothing(t.value),e.node(t.method)}function En(t,e){e.nodeOrNothing(t.value)&&e.put("."),e.node(t.method)}var xe={};w(xe,{compile:()=>Mn,stringify:()=>On,suggest:()=>wn,walk:()=>Dn});function wn(t,e){t.properties.length===0&&e.queryRoot(t.range[0]+1,t.range[1]-1)}function Mn(t,e){e.put("{"),e.list(t.properties,","),e.put("}")}function Dn(t,e){e.list(t.properties)}function On(t,e){e.put("{"),e.list(t.properties,","),e.put("}")}var ze={};w(ze,{compile:()=>_n,stringify:()=>Fn,suggest:()=>Nn,walk:()=>vn});var Sn=new Set(["Literal","Identifier","Reference","Current"]);function Nn(t,e){if(t.value===null)switch(t.key.type){case"Literal":case"Identifier":e.range(t.range,"path"),e.range(t.range,"var");break;case"Current":case"Reference":e.range(t.range,"var");break}}function _n(t,e){let r=t.value;switch(t.key.type){case"Current":e.put("...null");return;case"Literal":e.node(t.key),r=r||Q(null,ae(String(t.key.value)));break;case"Identifier":e.node(t.key),r=r||Q(null,t.key);break;case"Reference":e.node(t.key.name),r=r||t.key;break;default:e.put("["),e.node(t.key),e.put("]")}e.put(":"),e.node(r)}function vn(t,e){e.node(t.key),e.nodeOrNothing(t.value)}function Fn(t,e){if(Sn.has(t.key.type)){if(e.node(t.key),t.value===null)return}else e.put("["),e.node(t.key),e.put("]");e.put(":"),e.node(t.value)}var Le={};w(Le,{compile:()=>In,stringify:()=>qn,walk:()=>Tn});function In(t,e){e.put("("),e.node(t.body),e.put(")")}function Tn(t,e){e.node(t.body)}function qn(t,e){e.put("("),e.node(t.body),e.put(")")}var He={};w(He,{compile:()=>Rn,stringify:()=>xn,suggest:()=>Pn,walk:()=>jn});function Pn(t,e){if(t.getter===null){let r=t.range[1]-1;e.range([r,r],"key",t.value,!1),e.queryRoot(r)}else(t.getter.type==="GetProperty"||t.getter.type==="Reference"||t.getter.type==="Literal"&&typeof t.getter.value=="string")&&e.range(t.getter.range,"key",t.value,!1)}function Rn(t,e){e.put(e.buildinFn("pick")),e.put("("),e.node(t.value),t.getter&&(e.put(","),e.node(t.getter)),e.put(")")}function jn(t,e){e.node(t.value),t.getter!==null&&e.node(t.getter)}function xn(t,e){e.node(t.value),e.put("["),t.getter!==null&&e.node(t.getter),e.put("]")}var Ge={};w(Ge,{compile:()=>zn,stringify:()=>Hn,walk:()=>Ln});function zn(t,e){e.put("($=>("),e.createScope(()=>e.node(t.right),r=>r+","),e.put("))"),e.put("("),e.nodeOrCurrent(t.left),e.put(")")}function Ln(t,e){e.node(t.left),e.node(t.right)}function Hn(t,e){e.node(t.left),e.put("|"),e.node(t.right)}var Ye={};w(Ye,{compile:()=>Yn,stringify:()=>Wn,suggest:()=>Gn,walk:()=>Un});function Gn(t,e){e.queryRoot(t.range[1])}function Yn(t,e){e.put(e.scope.$ref)}function Un(){}function Wn(){}var Ue={};w(Ue,{compile:()=>Vn,stringify:()=>Kn,walk:()=>Jn});function Vn(t,e){if(t.operator&&t.operator.type){e.put("($=>("),e.createScope(()=>e.node(t.operator),r=>r+","),e.put("))"),e.put("("),e.node(t.argument),e.put(")");return}e.error('Unknown operator "'+t.operator+'"',t)}function Jn(t,e){e.node(t.argument),t.operator&&t.operator.type&&e.node(t.operator)}function Kn(t,e){