@cap.core/ql 1.3.0 → 1.4.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/cql/parser.min.js +1 -1
- package/lib/index.js +2 -0
- package/lib/ql/call-action.js +6 -0
- package/lib/ql/update.js +1 -1
- package/package.json +2 -2
package/cql/parser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as fluent from"../lib/xl/fluent.js";import{SELECT}from"../lib/ql/select.js";import{INSERT}from"../lib/ql/insert.js";import{UPSERT}from"../lib/ql/insert.js";import{UPDATE}from"../lib/ql/update.js";import{DELETE}from"../lib/ql/delete.js";class peg$SyntaxError extends SyntaxError{constructor(t,e,r,n){super(t),this.expected=e,this.found=r,this.location=n,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let r=null;const n=t.find(t=>t.source===this.location.source);n&&(r=n.text.split(/\r\n|\n|\r/g));const o=this.location.start,s=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,u=this.location.source+":"+s.line+":"+s.column;if(r){const t=this.location.end,n="".padEnd(s.line.toString().length," "),l=r[o.line-1],i=(o.line===t.line?t.column:l.length+1)-o.column||1;e+="\n --\x3e "+u+"\n"+n+" |\n"+s.line+" | "+l+"\n"+n+" | "+"".padEnd(o.column-1," ")+"".padEnd(i,"^")}else e+="\n at "+u}return e}static buildMessage(t,e){function r(t){return t.codePointAt(0).toString(16).toUpperCase()}const n=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function o(t){return n?t.replace(n,t=>"\\u{"+r(t)+"}"):t}function s(t){return o(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+r(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+r(t)))}function u(t){return o(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+r(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+r(t)))}const l={literal:t=>'"'+s(t.text)+'"',class(t){const e=t.parts.map(t=>Array.isArray(t)?u(t[0])+"-"+u(t[1]):u(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function i(t){return l[t.type](t)}return"Expected "+function(t){const e=t.map(i);if(e.sort(),e.length>0){let t=1;for(let r=1;r<e.length;r++)e[r-1]!==e[r]&&(e[t]=e[r],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+function(t){return t?'"'+s(t)+'"':"end of input"}(e)+" found."}}function peg$parse(t,e){const r={},n=(e=void 0!==e?e:{}).grammarSource,o={CQL:mr,subject:Pr,columns:vr,values:qr,ref:Dr,val:Ur,expr:Or,with:Rr,set:Fr,where:Sr,groupBy:_r,orderBy:$r};let s=mr;const u="select",l="localized",i="distinct",c="one",a="from",f="where",h="group by",p="having",d="order by",g="limit",b="offset",C="as",w="*",A="[",m="]",E="asc",x="desc",L="insert",v="upsert",y="into",S="entries",_="columns",$="rows",T="values",R="{",F=":",j="}",I="update",P="entity",O="with",N="set",D="=",U="delete",z="#",B="?",M="and",Z="or",q="in",H="between",W="like",Y="exists",k="contains",G="case",Q="when",V="then",J="else",K="end",X="is",tt="not",et="null",rt="empty",nt="-",ot=".",st="e",ut="'",lt="''",it="true",ct="false",at="(",ft=")",ht=",",pt=/^[A-Za-z_$]/,dt=/^[A-Za-z0-9_$]/,gt=/^[!=><+\-*\/%&|\^~]/,bt=/^[0-9]/,Ct=/^[^']/,wt=/^[A-Za-z_$0-9]/,At=/^[ \t\n\r]/,mt=pr("SELECT",!0),Et=pr("LOCALIZED",!0),xt=pr("DISTINCT",!0),Lt=pr("ONE",!0),vt=pr("FROM",!0),yt={type:"any"},St=pr("WHERE",!0),_t=pr("GROUP BY",!0),$t=pr("HAVING",!0),Tt=pr("ORDER BY",!0),Rt=pr("LIMIT",!0),Ft=pr("OFFSET",!0),jt=pr("as",!0),It=pr("*",!1),Pt=pr("[",!1),Ot=pr("]",!1),Nt=pr("asc",!0),Dt=pr("desc",!0),Ut=pr("INSERT",!0),zt=pr("UPSERT",!0),Bt=pr("INTO",!0),Mt=pr("ENTRIES",!0),Zt=pr("COLUMNS",!0),qt=pr("ROWS",!0),Ht=pr("VALUES",!0),Wt=pr("{",!1),Yt=pr(":",!1),kt=pr("}",!1),Gt=pr("UPDATE",!0),Qt=pr("ENTITY",!0),Vt=pr("WITH",!0),Jt=pr("SET",!0),Kt=pr("=",!1),Xt=pr("DELETE",!0),te=gr("a name"),ee=pr("AS",!0),re=pr("from",!0),ne=dr([["A","Z"],["a","z"],"_","$"],!1,!1,!1),oe=dr([["A","Z"],["a","z"],["0","9"],"_","$"],!1,!1,!1),se=gr("an element ref"),ue=gr("an entity ref"),le=gr("a reference"),ie=gr("a value"),ce=gr("a list"),ae=gr("a function"),fe=gr("a symbol"),he=pr("#",!1),pe=gr("a parameter"),de=pr("?",!1),ge=gr("an operator"),be=dr(["!","=",">","<","+","-","*","/","%","&","|","^","~"],!1,!1,!1),Ce=pr("and",!1),we=pr("or",!1),Ae=pr("in",!1),me=pr("between",!1),Ee=pr("like",!1),xe=pr("exists",!1),Le=pr("contains",!1),ve=pr("case",!1),ye=pr("when",!1),Se=pr("then",!1),_e=pr("else",!1),$e=pr("end",!1),Te=pr("is",!1),Re=pr("not",!1),Fe=pr("null",!1),je=pr("empty",!1),Ie=gr("a literal"),Pe=pr("-",!1),Oe=dr([["0","9"]],!1,!1,!1),Ne=pr(".",!1),De=pr("e",!1),Ue=pr("'",!1),ze=dr(["'"],!0,!1,!1),Be=pr("''",!1),Me=pr("true",!1),Ze=pr("false",!1),qe=pr("(",!1),He=pr(")",!1),We=dr([["A","Z"],["a","z"],"_","$",["0","9"]],!1,!1,!1),Ye=gr("a comma"),ke=pr(",",!1),Ge=gr(""),Qe=dr([" ","\t","\n","\r"],!1,!1,!1);function Ve(e){return nn?.length&&(e.params=nn),on?.length&&(e.args=on),e.source=t.substring(lr,ur),e}function Je(t,e){t.as=e}function Ke(t,e,r){e?t.inline=r:t.expand=r}function Xe(t,e){t.as=e}function tr(t,e){t.sort=e.toLowerCase()}function er(t){for(let e in t)"val"in t[e]&&(t[e]=t[e].val);return t}function rr(t,e,r){t[e]=r}function nr(t,e,r){t[e]=r}function or(t,e){return e?{id:t,...e}:t}function sr(){return"'"}let ur=0|e.peg$currPos,lr=ur;const ir=[{line:1,column:1}];let cr,ar=ur,fr=e.peg$maxFailExpected||[],hr=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');s=o[e.startRule]}function pr(t,e){return{type:"literal",text:t,ignoreCase:e}}function dr(t,e,r,n){return{type:"class",parts:t,inverted:e,ignoreCase:r,unicode:n}}function gr(t){return{type:"other",description:t}}function br(e){let r,n=ir[e];if(n)return n;if(e>=ir.length)r=ir.length-1;else for(r=e;!ir[--r];);for(n=ir[r],n={line:n.line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return ir[e]=n,n}function Cr(t,e,r){const o=br(t),s=br(e),u={source:n,start:{offset:t,line:o.line,column:o.column},end:{offset:e,line:s.line,column:s.column}};return r&&n&&"function"==typeof n.offset&&(u.start=n.offset(u.start),u.end=n.offset(u.end)),u}function wr(t){ur<ar||(ur>ar&&(ar=ur,fr=[]),fr.push(t))}function Ar(t,e,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(t,e),t,e,r)}function mr(){let e,n;return e=ur,n=Er(),n===r&&(n=function(){let e,n,o,s,u,l,i,c,f,h,p,d,g,b;e=ur,n=ur,o=t.substr(ur,6),o.toLowerCase()===L?ur+=6:(o=r,0===hr&&wr(Ut));o!==r?(s=rn(),s!==r?(lr=n,n=new INSERT):(ur=n,n=r)):(ur=n,n=r);n===r&&(n=ur,o=t.substr(ur,6),o.toLowerCase()===v?ur+=6:(o=r,0===hr&&wr(zt)),o!==r?(s=rn(),s!==r?(lr=n,n=new UPSERT):(ur=n,n=r)):(ur=n,n=r));if(n!==r)if(o=ur,s=kr(),s!==r&&(lr=o,C=s,s=void(n._.entries=Array.isArray(C)?C:[C])),o=s,o===r&&(o=null),s=ur,u=ur,l=t.substr(ur,4),l.toLowerCase()===y?ur+=4:(l=r,0===hr&&wr(Bt)),l!==r?(i=rn(),i!==r?(l=[l,i],u=l):(ur=u,u=r)):(ur=u,u=r),u!==r?(l=Pr(),l!==r?(lr=s,s=function(t,e){t._.into=e}(n,l)):(ur=s,s=r)):(ur=s,s=r),s!==r){if(u=ur,l=t.substr(ur,4),l.toLowerCase()===a?ur+=4:(l=r,0===hr&&wr(vt)),l!==r?(i=rn(),i!==r?(c=kr(),c!==r?(lr=u,u=function(t,e){t._.from=e}(n,c)):(ur=u,u=r)):(ur=u,u=r)):(ur=u,u=r),u===r&&(u=ur,l=Er(),l!==r&&(lr=u,l=function(t,e){t._.from=e}(n,l)),u=l),u===r){if(u=ur,l=ur,i=ur,c=t.substr(ur,7),c.toLowerCase()===S?ur+=7:(c=r,0===hr&&wr(Mt)),c!==r?(f=rn(),f!==r?(c=[c,f],i=c):(ur=i,i=r)):(ur=i,i=r),i===r&&(i=null),c=ur,f=kr(),f===r&&(f=function(){let t,e,n,o,s;t=ur,e=[],n=ur,o=Tr(),o!==r&&(lr=n,o=er(o));n=o;for(;n!==r;)e.push(n),n=ur,o=Xr(),o!==r?(o=ur,s=Tr(),s!==r&&(lr=o,s=er(s)),o=s,o===r?(ur=n,n=r):n=o):n=o;e.length<1?(ur=t,t=r):t=e;return t}()),f!==r&&(lr=c,f=function(t,e){t._tail(e)}(n,f)),c=f,c!==r?(i=[i,c],l=i):(ur=l,l=r),l===r&&(l=null),i=ur,c=ur,f=t.substr(ur,7),f.toLowerCase()===_?ur+=7:(f=r,0===hr&&wr(Zt)),f!==r?(h=rn(),h!==r?(f=[f,h],c=f):(ur=c,c=r)):(ur=c,c=r),c===r&&(c=null),f=kr(),f===r)if(f=ur,h=Vr(),h!==r){for(p=ur,d=[],g=Ir();g!==r;)d.push(g),g=ur,b=Xr(),b!==r?(b=Ir(),b===r?(ur=g,g=r):g=b):g=b;d.length<1?(ur=p,p=r):p=d,p!==r?(d=Jr(),d!==r?f=p:(ur=f,f=r)):(ur=f,f=r)}else ur=f,f=r;f!==r?(lr=i,i=function(t,e){t._.columns=e}(n,f)):(ur=i,i=r),i===r&&(i=null),c=ur,f=ur,h=t.substr(ur,4),h.toLowerCase()===$?ur+=4:(h=r,0===hr&&wr(qt)),h!==r?(p=rn(),p!==r?(h=[h,p],f=h):(ur=f,f=r)):(ur=f,f=r),f===r&&(f=null),h=kr(),h!==r?(lr=c,c=function(t,e){t._.rows=e}(n,h)):(ur=c,c=r),c===r&&(c=null),f=ur,h=ur,p=t.substr(ur,6),p.toLowerCase()===T?ur+=6:(p=r,0===hr&&wr(Ht)),p!==r?(d=rn(),d!==r?(p=[p,d],h=p):(ur=h,h=r)):(ur=h,h=r),h!==r?(p=zr(),p!==r?(lr=f,f=function(t,e){t._.values=e.list}(n,p)):(ur=f,f=r)):(ur=f,f=r),f===r&&(f=null),l=[l,i,c,f],u=l}u!==r?e=n:(ur=e,e=r)}else ur=e,e=r;else ur=e,e=r;var C;return e}(),n===r&&(n=function(){let e,n,o,s,u,l,i,c;e=ur,n=ur,o=t.substr(ur,6),o.toLowerCase()===I?ur+=6:(o=r,0===hr&&wr(Gt));o!==r?(s=rn(),s!==r?(lr=n,n=new UPDATE):(ur=n,n=r)):(ur=n,n=r);n!==r?(o=ur,s=ur,u=t.substr(ur,6),u.toLowerCase()===P?ur+=6:(u=r,0===hr&&wr(Qt)),u!==r?(l=rn(),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r),s===r&&(s=null),u=Pr(),u!==r?(lr=o,a=u,o=void(n._.entity=a)):(ur=o,o=r),o!==r?(s=ur,u=t.substr(ur,4),u.toLowerCase()===O?ur+=4:(u=r,0===hr&&wr(Vt)),u===r&&(u=t.substr(ur,3),u.toLowerCase()===N?ur+=3:(u=r,0===hr&&wr(Jt))),u!==r?(l=rn(),l!==r?(i=Rr(),i!==r?(c=en(),lr=s,s=function(t,e){Object.assign(t._,e)}(n,i)):(ur=s,s=r)):(ur=s,s=r)):(ur=s,s=r),s===r&&(s=null),u=ur,l=ur,i=t.substr(ur,5),i.toLowerCase()===f?ur+=5:(i=r,0===hr&&wr(St)),i!==r?(c=rn(),c!==r?(i=[i,c],l=i):(ur=l,l=r)):(ur=l,l=r),l!==r?(i=Sr(),i!==r?(c=en(),lr=u,u=function(t,e){t._.where=e}(n,i)):(ur=u,u=r)):(ur=u,u=r),u===r&&(u=null),e=n):(ur=e,e=r)):(ur=e,e=r);var a;return e}(),n===r&&(n=function(){let e,n,o,s,u,l,i;e=ur,n=ur,o=t.substr(ur,6),o.toLowerCase()===U?ur+=6:(o=r,0===hr&&wr(Xt));o!==r?(s=rn(),s!==r?(lr=n,n=new DELETE):(ur=n,n=r)):(ur=n,n=r);n!==r?(o=ur,s=ur,u=t.substr(ur,4),u.toLowerCase()===a?ur+=4:(u=r,0===hr&&wr(vt)),u!==r?(l=rn(),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r),s===r&&(s=null),u=Pr(),u!==r?(l=en(),lr=o,c=u,o=void(n._.from=c)):(ur=o,o=r),o!==r?(s=ur,u=ur,l=t.substr(ur,5),l.toLowerCase()===f?ur+=5:(l=r,0===hr&&wr(St)),l!==r?(i=rn(),i!==r?(l=[l,i],u=l):(ur=u,u=r)):(ur=u,u=r),u!==r?(l=Sr(),l!==r?(i=en(),lr=s,s=function(t,e){t._.where=e}(n,l)):(ur=s,s=r)):(ur=s,s=r),s===r&&(s=null),e=n):(ur=e,e=r)):(ur=e,e=r);var c;return e}()))),n!==r&&(lr=e,n=Ve(n)),e=n,e}function Er(){let e,n,o,s,f,h,p,d,g,b,C;return e=ur,n=ur,o=t.substr(ur,6),o.toLowerCase()===u?ur+=6:(o=r,0===hr&&wr(mt)),o!==r?(s=rn(),s!==r?(lr=n,n=new SELECT):(ur=n,n=r)):(ur=n,n=r),n!==r?(o=ur,s=t.substr(ur,9),s.toLowerCase()===l?ur+=9:(s=r,0===hr&&wr(Et)),s!==r?(f=rn(),f!==r?(lr=o,o=void(n._.localized=!0)):(ur=o,o=r)):(ur=o,o=r),o===r&&(o=null),s=ur,f=t.substr(ur,8),f.toLowerCase()===i?ur+=8:(f=r,0===hr&&wr(xt)),f!==r?(h=rn(),h!==r?(lr=s,s=function(t){t._.distinct=!0}(n)):(ur=s,s=r)):(ur=s,s=r),s===r&&(s=null),f=ur,h=t.substr(ur,3),h.toLowerCase()===c?ur+=3:(h=r,0===hr&&wr(Lt)),h!==r?(p=rn(),p!==r?(lr=f,f=function(t){t._.one=!0}(n)):(ur=f,f=r)):(ur=f,f=r),f===r&&(f=null),h=ur,p=vr(),p!==r?(d=en(),lr=h,h=function(t,e){t._.columns=e}(n,p)):(ur=h,h=r),h===r&&(h=null),p=ur,d=ur,g=t.substr(ur,4),g.toLowerCase()===a?ur+=4:(g=r,0===hr&&wr(vt)),g!==r?(b=rn(),b!==r?(g=[g,b],d=g):(ur=d,d=r)):(ur=d,d=r),d!==r?(g=Pr(),g===r&&(g=Yr()),g!==r?(lr=p,p=function(t,e){t._.from=e}(n,g)):(ur=p,p=r)):(ur=p,p=r),p===r&&(p=null),d=ur,g=Gr(),g!==r?(b=vr(),b!==r?(C=Qr(),C!==r?(lr=d,d=function(t,e){t._.columns=e}(n,b)):(ur=d,d=r)):(ur=d,d=r)):(ur=d,d=r),d===r&&(d=null),g=ur,b=xr(),b!==r&&(lr=g,b=function(t,e){Object.assign(t._,e)}(n,b)),g=b,g===r&&(g=null),e=n):(ur=e,e=r),e}function xr(){let e,n,o,s,u,l,i,c,a,C,w,A;var m;return e=ur,n=ur,o=ur,hr++,t.length>ur?(s=t.charAt(ur),ur++):(s=r,0===hr&&wr(yt)),hr--,s!==r?(ur=o,o=void 0):o=r,o!==r&&(lr=n,o={}),n=o,n!==r?(o=ur,s=ur,u=t.substr(ur,5),u.toLowerCase()===f?ur+=5:(u=r,0===hr&&wr(St)),u!==r?(l=rn(),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r),s!==r?(u=Sr(),u!==r?(l=en(),lr=o,m=u,o=void(n.where=m)):(ur=o,o=r)):(ur=o,o=r),o===r&&(o=null),s=ur,u=ur,l=t.substr(ur,8),l.toLowerCase()===h?ur+=8:(l=r,0===hr&&wr(_t)),l!==r?(i=rn(),i!==r?(c=_r(),c!==r?(a=en(),lr=u,u=function(t,e){t.groupBy=e}(n,c)):(ur=u,u=r)):(ur=u,u=r)):(ur=u,u=r),u!==r?(l=ur,i=t.substr(ur,6),i.toLowerCase()===p?ur+=6:(i=r,0===hr&&wr($t)),i!==r?(c=rn(),c!==r?(a=Sr(),a!==r?(C=en(),lr=l,l=function(t,e){t.having=e}(n,a)):(ur=l,l=r)):(ur=l,l=r)):(ur=l,l=r),l===r&&(l=null),u=[u,l],s=u):(ur=s,s=r),s===r&&(s=null),u=ur,l=ur,i=t.substr(ur,8),i.toLowerCase()===d?ur+=8:(i=r,0===hr&&wr(Tt)),i!==r?(c=rn(),c!==r?(i=[i,c],l=i):(ur=l,l=r)):(ur=l,l=r),l!==r?(i=$r(),i!==r?(c=en(),lr=u,u=function(t,e){t.orderBy=e}(n,i)):(ur=u,u=r)):(ur=u,u=r),u===r&&(u=null),l=ur,i=ur,c=t.substr(ur,5),c.toLowerCase()===g?ur+=5:(c=r,0===hr&&wr(Rt)),c!==r?(a=rn(),a!==r?(C=Dr(),C===r&&(C=Ur()),C!==r?(w=en(),lr=i,i=function(t,e){t.limit={rows:e}}(n,C)):(ur=i,i=r)):(ur=i,i=r)):(ur=i,i=r),i!==r?(c=ur,a=t.substr(ur,6),a.toLowerCase()===b?ur+=6:(a=r,0===hr&&wr(Ft)),a!==r?(C=rn(),C!==r?(w=Dr(),w===r&&(w=Ur()),w!==r?(A=en(),lr=c,c=function(t,e){t.limit.offset=e}(n,w)):(ur=c,c=r)):(ur=c,c=r)):(ur=c,c=r),c===r&&(c=null),i=[i,c],l=i):(ur=l,l=r),l===r&&(l=null),e=n):(ur=e,e=r),e}function Lr(){let e,n,o,s,u;return e=ur,n=ur,o=en(),n=t.substring(n,ur),o=t.substr(ur,2),o.toLowerCase()===C?ur+=2:(o=r,0===hr&&wr(jt)),o!==r?(s=rn(),s!==r?(u=jr(),u!==r?e=u:(ur=e,e=r)):(ur=e,e=r)):(ur=e,e=r),e}function vr(){let e,n,o,s,u,l,i,c,a,f,h;for(e=ur,n=[],42===t.charCodeAt(ur)?(o=w,ur++):(o=r,0===hr&&wr(It)),o===r&&(o=ur,s=Dr(),s!==r?(u=ur,l=Lr(),l!==r&&(lr=u,l=Je(s,l)),u=l,u===r&&(u=null),l=tn(),l===r&&(l=null),i=ur,c=Gr(),c!==r?(a=vr(),a!==r?(f=Qr(),f!==r?(lr=i,i=Ke(s,l,a)):(ur=i,i=r)):(ur=i,i=r)):(ur=i,i=r),i!==r?o=s:(ur=o,o=r)):(ur=o,o=r),o===r&&(o=ur,s=Or(),s!==r?(u=ur,l=Lr(),l!==r&&(lr=u,l=Xe(s,l)),u=l,u===r&&(u=null),o=s):(ur=o,o=r)));o!==r;)n.push(o),o=ur,s=Xr(),s!==r?(42===t.charCodeAt(ur)?(s=w,ur++):(s=r,0===hr&&wr(It)),s===r&&(s=ur,u=Dr(),u!==r?(l=ur,i=Lr(),i!==r&&(lr=l,i=Je(u,i)),l=i,l===r&&(l=null),i=tn(),i===r&&(i=null),c=ur,a=Gr(),a!==r?(f=vr(),f!==r?(h=Qr(),h!==r?(lr=c,c=Ke(u,i,f)):(ur=c,c=r)):(ur=c,c=r)):(ur=c,c=r),c!==r?s=u:(ur=s,s=r)):(ur=s,s=r),s===r&&(s=ur,u=Or(),u!==r?(l=ur,i=Lr(),i!==r&&(lr=l,i=Xe(u,i)),l=i,l===r&&(l=null),s=u):(ur=s,s=r))),s===r?(ur=o,o=r):o=s):o=s;return n.length<1?(ur=e,e=r):e=n,e}function yr(){let e,n,o,s,u,l,i,c;return e=ur,n=en(),91===t.charCodeAt(ur)?(o=A,ur++):(o=r,0===hr&&wr(Pt)),o!==r?(s=en(),u=function(){let e,n,o,s,u;e=ur,n=kr(),n!==r&&(lr=e,l=n,n={where:fluent.where(l)});var l;if(e=n,e===r){for(e=ur,n=ur,o=[],s=Ur();s!==r;)o.push(s),s=ur,u=Xr(),u!==r?(u=Ur(),u===r?(ur=s,s=r):s=u):s=u;o.length<1?(ur=n,n=r):n=o,n!==r&&(lr=e,n={where:n}),e=n,e===r&&(e=ur,n=ur,hr++,o=ur,s=t.substr(ur,5),s.toLowerCase()===f?ur+=5:(s=r,0===hr&&wr(St)),s!==r?(u=rn(),u!==r?(s=[s,u],o=s):(ur=o,o=r)):(ur=o,o=r),hr--,o===r?n=void 0:(ur=n,n=r),n!==r?(o=Nr(),o!==r?(lr=e,e={where:o.xpr}):(ur=e,e=r)):(ur=e,e=r),e===r&&(e=xr()))}return e}(),u!==r?(l=en(),93===t.charCodeAt(ur)?(i=m,ur++):(i=r,0===hr&&wr(Ot)),i!==r?(c=en(),e=u):(ur=e,e=r)):(ur=e,e=r)):(ur=e,e=r),e}function Sr(){let t,e;var n;return t=ur,e=kr(),e!==r&&(lr=t,n=e,e=fluent.where(n)),t=e,t===r&&(t=ur,e=Nr(),e!==r&&(lr=t,e=e.xpr),t=e),t}function _r(){let t,e,n,o,s;for(t=ur,e=ur,n=[],o=Dr();o!==r;)n.push(o),o=ur,s=Xr(),s!==r?(s=Dr(),s===r?(ur=o,o=r):o=s):o=s;return n.length<1?(ur=e,e=r):e=n,e!==r?t=e:(ur=t,t=r),t}function $r(){let e,n,o,s,u,l,i,c,a;for(e=ur,n=ur,o=[],s=ur,u=Dr(),u!==r?(l=ur,i=rn(),i!==r?(c=t.substr(ur,3),c.toLowerCase()===E?ur+=3:(c=r,0===hr&&wr(Nt)),c===r&&(c=t.substr(ur,4),c.toLowerCase()===x?ur+=4:(c=r,0===hr&&wr(Dt))),c!==r?(lr=l,l=tr(u,c)):(ur=l,l=r)):(ur=l,l=r),l===r&&(l=null),s=u):(ur=s,s=r);s!==r;)o.push(s),s=ur,u=Xr(),u!==r?(u=ur,l=Dr(),l!==r?(i=ur,c=rn(),c!==r?(a=t.substr(ur,3),a.toLowerCase()===E?ur+=3:(a=r,0===hr&&wr(Nt)),a===r&&(a=t.substr(ur,4),a.toLowerCase()===x?ur+=4:(a=r,0===hr&&wr(Dt))),a!==r?(lr=i,i=tr(l,a)):(ur=i,i=r)):(ur=i,i=r),i===r&&(i=null),u=l):(ur=u,u=r),u===r?(ur=s,s=r):s=u):s=u;return o.length<1?(ur=n,n=r):n=o,n!==r?e=n:(ur=e,e=r),e}function Tr(){let e,n,o,s,u,l,i,c,a,f,h;if(e=ur,n=ur,o=en(),123===t.charCodeAt(ur)?(s=R,ur++):(s=r,0===hr&&wr(Wt)),s!==r?(u=en(),lr=n,n={}):(ur=n,n=r),n!==r){for(o=ur,s=[],u=ur,l=Ir(),l!==r?(i=en(),58===t.charCodeAt(ur)?(c=F,ur++):(c=r,0===hr&&wr(Yt)),c!==r?(a=en(),f=Zr(),f===r&&(f=Or()),f!==r?(lr=u,u=rr(n,l,f)):(ur=u,u=r)):(ur=u,u=r)):(ur=u,u=r);u!==r;)s.push(u),u=ur,l=Xr(),l!==r?(l=ur,i=Ir(),i!==r?(c=en(),58===t.charCodeAt(ur)?(a=F,ur++):(a=r,0===hr&&wr(Yt)),a!==r?(f=en(),h=Zr(),h===r&&(h=Or()),h!==r?(lr=l,l=rr(n,i,h)):(ur=l,l=r)):(ur=l,l=r)):(ur=l,l=r),l===r?(ur=u,u=r):u=l):u=l;s.length<1?(ur=o,o=r):o=s,o!==r?(s=en(),125===t.charCodeAt(ur)?(u=j,ur++):(u=r,0===hr&&wr(kt)),u!==r?(l=en(),e=n):(ur=e,e=r)):(ur=e,e=r)}else ur=e,e=r;return e}function Rr(){let t,e;return t=ur,e=kr(),e!==r&&(lr=t,e={data:e}),t=e,t===r&&(t=ur,e=Tr(),e!==r&&(lr=t,e={with:e}),t=e,t===r&&(t=ur,e=Fr(),e!==r&&(lr=t,e={with:e}),t=e)),t}function Fr(){let e,n,o,s,u,l,i,c,a,f,h;for(e=ur,n=ur,o="",lr=n,o={},n=o,o=ur,s=[],u=ur,l=Ir(),l!==r?(i=en(),61===t.charCodeAt(ur)?(c=D,ur++):(c=r,0===hr&&wr(Kt)),c!==r?(a=en(),f=Zr(),f===r&&(f=Or()),f!==r?(lr=u,u=nr(n,l,f)):(ur=u,u=r)):(ur=u,u=r)):(ur=u,u=r);u!==r;)s.push(u),u=ur,l=Xr(),l!==r?(l=ur,i=Ir(),i!==r?(c=en(),61===t.charCodeAt(ur)?(a=D,ur++):(a=r,0===hr&&wr(Kt)),a!==r?(f=en(),h=Zr(),h===r&&(h=Or()),h!==r?(lr=l,l=nr(n,i,h)):(ur=l,l=r)):(ur=l,l=r)):(ur=l,l=r),l===r?(ur=u,u=r):u=l):u=l;return s.length<1?(ur=o,o=r):o=s,o!==r?e=n:(ur=e,e=r),e}function jr(){let e,n,o,s,u,l,i,c,f;if(hr++,e=ur,n=ur,hr++,o=t.substr(ur,2),o.toLowerCase()===C?ur+=2:(o=r,0===hr&&wr(ee)),hr--,o===r?n=void 0:(ur=n,n=r),n!==r)if(o=ur,hr++,s=t.substr(ur,4),s.toLowerCase()===a?ur+=4:(s=r,0===hr&&wr(re)),hr--,s===r?o=void 0:(ur=o,o=r),o!==r)if(s=ur,hr++,u=Wr(),hr--,u===r?s=void 0:(ur=s,s=r),s!==r){if(u=ur,l=ur,i=t.charAt(ur),pt.test(i)?ur++:(i=r,0===hr&&wr(ne)),i!==r){for(c=[],f=t.charAt(ur),dt.test(f)?ur++:(f=r,0===hr&&wr(oe));f!==r;)c.push(f),f=t.charAt(ur),dt.test(f)?ur++:(f=r,0===hr&&wr(oe));i=[i,c],l=i}else ur=l,l=r;u=l!==r?t.substring(u,ur):l,u!==r?e=u:(ur=e,e=r)}else ur=e,e=r;else ur=e,e=r;else ur=e,e=r;return hr--,e===r&&(n=r,0===hr&&wr(te)),e}function Ir(){let e,n,o,s,u,l;for(hr++,e=ur,n=ur,o=ur,s=[],u=jr();u!==r;)s.push(u),u=ur,l=tn(),l!==r?(l=jr(),l===r?(ur=u,u=r):u=l):u=l;return s.length<1?(ur=o,o=r):o=s,n=o!==r?t.substring(n,ur):o,n!==r?e=n:(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(se)),e}function Pr(){let e,n,o,s,u,l,i;var c;if(hr++,e=ur,n=kr(),n!==r&&(lr=e,c=n,n=fluent.subject(c)),e=n,e===r){for(e=ur,n=ur,o=[],s=ur,u=jr(),u!==r?(l=tn(),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r);s!==r;)o.push(s),s=ur,u=jr(),u!==r?(l=tn(),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r);n=t.substring(n,ur),o=ur,s=jr(),s!==r?(u=en(),58===t.charCodeAt(ur)?(l=F,ur++):(l=r,0===hr&&wr(Yt)),l!==r?(i=en(),o=s):(ur=o,o=r)):(ur=o,o=r),o===r&&(o=null),s=Dr(),s!==r?(u=en(),lr=e,e=function(t,e,r){if(e)return{ref:[t+e,...r.ref]};if(t){let[e]=r.ref;e.id?e.id=t+e.id:r.ref[0]=t+e}return r}(n,o,s)):(ur=e,e=r)}return hr--,e===r&&(n=r,0===hr&&wr(ue)),e}function Or(){let t,e;var n;return t=ur,e=Nr(),e!==r&&(lr=t,e=(n=e).xpr.length>1?n:n.xpr[0]),t=e,t}function Nr(){let t,e,n,o,s,u;if(t=ur,e=[],n=Yr(),n===r&&(n=zr(),n===r&&(n=Mr(),n===r&&(n=Ur(),n===r&&(n=Hr(),n===r&&(n=Br(),n===r&&(n=Dr(),n===r&&(n=ur,o=Vr(),o!==r?(s=Or(),s!==r?(u=Jr(),u!==r?n=s:(ur=n,n=r)):(ur=n,n=r)):(ur=n,n=r)))))))),n!==r)for(;n!==r;)e.push(n),n=Yr(),n===r&&(n=zr(),n===r&&(n=Mr(),n===r&&(n=Ur(),n===r&&(n=Hr(),n===r&&(n=Br(),n===r&&(n=Dr(),n===r&&(n=ur,o=Vr(),o!==r?(s=Or(),s!==r?(u=Jr(),u!==r?n=s:(ur=n,n=r)):(ur=n,n=r)):(ur=n,n=r))))))));else e=r;return e!==r&&(lr=t,e={xpr:e}),t=e,t}function Dr(){let t,e,n,o,s,u,l;for(hr++,t=ur,e=ur,n=[],o=ur,s=jr(),s!==r?(u=yr(),u===r&&(u=null),lr=o,o=or(s,u)):(ur=o,o=r);o!==r;)n.push(o),o=ur,s=tn(),s!==r?(s=ur,u=jr(),u!==r?(l=yr(),l===r&&(l=null),lr=s,s=or(u,l)):(ur=s,s=r),s===r?(ur=o,o=r):o=s):o=s;return n.length<1?(ur=e,e=r):e=n,e!==r&&(lr=t,e={ref:e}),t=e,hr--,t===r&&(e=r,0===hr&&wr(le)),t}function Ur(){let e,n;return hr++,e=Zr(),e===r&&(e=ur,n=function(){let e,n;hr++,e=function(){let e,n,o,s,u,l;e=ur,39===t.charCodeAt(ur)?(n=ut,ur++):(n=r,0===hr&&wr(Ue));if(n!==r){for(o=ur,s=[],u=t.charAt(ur),Ct.test(u)?ur++:(u=r,0===hr&&wr(ze)),u===r&&(u=ur,t.substr(ur,2)===lt?(l=lt,ur+=2):(l=r,0===hr&&wr(Be)),l!==r&&(lr=u,l="'"),u=l);u!==r;)s.push(u),u=t.charAt(ur),Ct.test(u)?ur++:(u=r,0===hr&&wr(ze)),u===r&&(u=ur,t.substr(ur,2)===lt?(l=lt,ur+=2):(l=r,0===hr&&wr(Be)),l!==r&&(lr=u,l=sr()),u=l);o=t.substring(o,ur),39===t.charCodeAt(ur)?(s=ut,ur++):(s=r,0===hr&&wr(Ue)),s!==r?e=o:(ur=e,e=r)}else ur=e,e=r;return e}(),e===r&&(e=function(){let e,n,o,s,u,l,i,c,a,f;e=ur,n=ur,o=ur,45===t.charCodeAt(ur)?(s=nt,ur++):(s=r,0===hr&&wr(Pe));s===r&&(s=null);u=[],l=t.charAt(ur),bt.test(l)?ur++:(l=r,0===hr&&wr(Oe));if(l!==r)for(;l!==r;)u.push(l),l=t.charAt(ur),bt.test(l)?ur++:(l=r,0===hr&&wr(Oe));else u=r;if(u!==r){if(l=ur,46===t.charCodeAt(ur)?(i=ot,ur++):(i=r,0===hr&&wr(Ne)),i!==r){if(c=[],a=t.charAt(ur),bt.test(a)?ur++:(a=r,0===hr&&wr(Oe)),a!==r)for(;a!==r;)c.push(a),a=t.charAt(ur),bt.test(a)?ur++:(a=r,0===hr&&wr(Oe));else c=r;c!==r?(i=[i,c],l=i):(ur=l,l=r)}else ur=l,l=r;if(l===r&&(l=null),i=ur,101===t.charCodeAt(ur)?(c=st,ur++):(c=r,0===hr&&wr(De)),c!==r){if(a=[],f=t.charAt(ur),bt.test(f)?ur++:(f=r,0===hr&&wr(Oe)),f!==r)for(;f!==r;)a.push(f),f=t.charAt(ur),bt.test(f)?ur++:(f=r,0===hr&&wr(Oe));else a=r;a!==r?(c=[c,a],i=c):(ur=i,i=r)}else ur=i,i=r;i===r&&(i=null),s=[s,u,l,i],o=s}else ur=o,o=r;n=o!==r?t.substring(n,ur):o;n!==r&&(lr=e,n=Number(n));return e=n,e}(),e===r&&(e=function(){let e,n,o,s;e=ur,t.substr(ur,4)===it?(n=it,ur+=4):(n=r,0===hr&&wr(Me));n!==r?(o=ur,hr++,s=Kr(),hr--,s===r?o=void 0:(ur=o,o=r),o!==r?(lr=e,e=!0):(ur=e,e=r)):(ur=e,e=r);return e}(),e===r&&(e=function(){let e,n,o,s;e=ur,t.substr(ur,5)===ct?(n=ct,ur+=5):(n=r,0===hr&&wr(Ze));n!==r?(o=ur,hr++,s=Kr(),hr--,s===r?o=void 0:(ur=o,o=r),o!==r?(lr=e,e=!1):(ur=e,e=r)):(ur=e,e=r);return e}(),e===r&&(e=function(){let e,n,o,s;e=ur,t.substr(ur,4)===et?(n=et,ur+=4):(n=r,0===hr&&wr(Fe));n!==r?(o=ur,hr++,s=Kr(),hr--,s===r?o=void 0:(ur=o,o=r),o!==r?(lr=e,e=null):(ur=e,e=r)):(ur=e,e=r);return e}()))));hr--,e===r&&(n=r,0===hr&&wr(Ie));return e}(),n!==r&&(lr=e,n={val:n}),e=n),hr--,e===r&&(n=r,0===hr&&wr(ie)),e}function zr(){let t,e,n,o;return hr++,t=Zr(),t===r&&(t=ur,e=Vr(),e!==r?(n=ur,o=qr(),o!==r&&(lr=n,o={list:o}),n=o,n!==r?(o=Jr(),o!==r?t=n:(ur=t,t=r)):(ur=t,t=r)):(ur=t,t=r)),hr--,t===r&&(e=r,0===hr&&wr(ce)),t}function Br(){let e,n,o,s,u,l,i;if(hr++,e=ur,n=jr(),n!==r)if(o=Vr(),o!==r){for(s=ur,u=[],42===t.charCodeAt(ur)?(l=w,ur++):(l=r,0===hr&&wr(It)),l===r&&(l=Or());l!==r;)u.push(l),l=ur,i=Xr(),i!==r?(42===t.charCodeAt(ur)?(i=w,ur++):(i=r,0===hr&&wr(It)),i===r&&(i=Or()),i===r?(ur=l,l=r):l=i):l=i;u.length<1?(ur=s,s=r):s=u,s!==r?(u=Jr(),u!==r?(lr=e,e={func:n,args:s}):(ur=e,e=r)):(ur=e,e=r)}else ur=e,e=r;else ur=e,e=r;return hr--,e===r&&(n=r,0===hr&&wr(ae)),e}function Mr(){let e,n,o;return hr++,e=ur,35===t.charCodeAt(ur)?(n=z,ur++):(n=r,0===hr&&wr(he)),n!==r?(o=jr(),o!==r?(lr=e,e={"#":o}):(ur=e,e=r)):(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(fe)),e}function Zr(){let e,n,o,s;return hr++,e=ur,n=en(),63===t.charCodeAt(ur)?(o=B,ur++):(o=r,0===hr&&wr(de)),o!==r?(s=en(),lr=e,e=un()):(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(pe)),e}function qr(){let t,e,n,o;for(hr++,t=ur,e=[],n=Mr(),n===r&&(n=Ur(),n===r&&(n=Dr(),n===r&&(n=Br())));n!==r;)e.push(n),n=ur,o=Xr(),o!==r?(o=Mr(),o===r&&(o=Ur(),o===r&&(o=Dr(),o===r&&(o=Br()))),o===r?(ur=n,n=r):n=o):n=o;return e.length<2?(ur=t,t=r):t=e,hr--,t===r&&(e=r,0===hr&&wr(ie)),t}function Hr(){let e,n,o,s,u;if(hr++,e=ur,n=en(),o=Wr(),o===r){if(o=ur,s=[],u=t.charAt(ur),gt.test(u)?ur++:(u=r,0===hr&&wr(be)),u!==r)for(;u!==r;)s.push(u),u=t.charAt(ur),gt.test(u)?ur++:(u=r,0===hr&&wr(be));else s=r;o=s!==r?t.substring(o,ur):s}return o!==r?(s=en(),e=o):(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(ge)),e}function Wr(){let e,n,o,s,u,l,i,c;if(e=ur,t.substr(ur,3)===M?(n=M,ur+=3):(n=r,0===hr&&wr(Ce)),n===r&&(t.substr(ur,2)===Z?(n=Z,ur+=2):(n=r,0===hr&&wr(we)),n===r&&(t.substr(ur,2)===q?(n=q,ur+=2):(n=r,0===hr&&wr(Ae)),n===r&&(t.substr(ur,7)===H?(n=H,ur+=7):(n=r,0===hr&&wr(me)),n===r&&(t.substr(ur,4)===W?(n=W,ur+=4):(n=r,0===hr&&wr(Ee)),n===r&&(t.substr(ur,6)===Y?(n=Y,ur+=6):(n=r,0===hr&&wr(xe)),n===r&&(t.substr(ur,8)===k?(n=k,ur+=8):(n=r,0===hr&&wr(Le)))))))),n!==r?(o=ur,hr++,s=Kr(),hr--,s===r?o=void 0:(ur=o,o=r),o!==r?e=n:(ur=e,e=r)):(ur=e,e=r),e===r&&(e=ur,t.substr(ur,4)===G?(n=G,ur+=4):(n=r,0===hr&&wr(ve)),n===r&&(t.substr(ur,4)===Q?(n=Q,ur+=4):(n=r,0===hr&&wr(ye)),n===r&&(t.substr(ur,4)===V?(n=V,ur+=4):(n=r,0===hr&&wr(Se)),n===r&&(t.substr(ur,4)===J?(n=J,ur+=4):(n=r,0===hr&&wr(_e)),n===r&&(t.substr(ur,3)===K?(n=K,ur+=3):(n=r,0===hr&&wr($e)))))),n!==r?(o=ur,hr++,s=Kr(),hr--,s===r?o=void 0:(ur=o,o=r),o!==r?e=n:(ur=e,e=r)):(ur=e,e=r),e===r)){for(e=ur,n=ur,o=[],s=ur,t.substr(ur,2)===X?(u=X,ur+=2):(u=r,0===hr&&wr(Te)),u===r&&(t.substr(ur,3)===tt?(u=tt,ur+=3):(u=r,0===hr&&wr(Re)),u===r&&(t.substr(ur,4)===et?(u=et,ur+=4):(u=r,0===hr&&wr(Fe)),u===r&&(t.substr(ur,5)===rt?(u=rt,ur+=5):(u=r,0===hr&&wr(je))))),u!==r?(l=ur,hr++,i=Kr(),hr--,i===r?l=void 0:(ur=l,l=r),l!==r?(u=[u,l],s=u):(ur=s,s=r)):(ur=s,s=r);s!==r;)o.push(s),s=ur,u=en(),u=ur,t.substr(ur,2)===X?(l=X,ur+=2):(l=r,0===hr&&wr(Te)),l===r&&(t.substr(ur,3)===tt?(l=tt,ur+=3):(l=r,0===hr&&wr(Re)),l===r&&(t.substr(ur,4)===et?(l=et,ur+=4):(l=r,0===hr&&wr(Fe)),l===r&&(t.substr(ur,5)===rt?(l=rt,ur+=5):(l=r,0===hr&&wr(je))))),l!==r?(i=ur,hr++,c=Kr(),hr--,c===r?i=void 0:(ur=i,i=r),i!==r?(l=[l,i],u=l):(ur=u,u=r)):(ur=u,u=r),u===r?(ur=s,s=r):s=u;o.length<1?(ur=n,n=r):n=o,e=n!==r?t.substring(e,ur):n}return e}function Yr(){let t,e,n,o;return t=ur,e=Vr(),e!==r?(n=Er(),n!==r?(o=Jr(),o!==r?t=n:(ur=t,t=r)):(ur=t,t=r)):(ur=t,t=r),t}function kr(){let e,n,o,s;return e=ur,n=en(),63===t.charCodeAt(ur)?(o=B,ur++):(o=r,0===hr&&wr(de)),o!==r?(s=en(),lr=e,e=on.shift()):(ur=e,e=r),e}function Gr(){let e,n,o,s;return e=ur,n=en(),123===t.charCodeAt(ur)?(o=R,ur++):(o=r,0===hr&&wr(Wt)),o!==r?(s=en(),n=[n,o,s],e=n):(ur=e,e=r),e}function Qr(){let e,n,o,s;return e=ur,n=en(),125===t.charCodeAt(ur)?(o=j,ur++):(o=r,0===hr&&wr(kt)),o!==r?(s=en(),n=[n,o,s],e=n):(ur=e,e=r),e}function Vr(){let e,n,o,s;return e=ur,n=en(),40===t.charCodeAt(ur)?(o=at,ur++):(o=r,0===hr&&wr(qe)),o!==r?(s=en(),n=[n,o,s],e=n):(ur=e,e=r),e}function Jr(){let e,n,o,s;return e=ur,n=en(),41===t.charCodeAt(ur)?(o=ft,ur++):(o=r,0===hr&&wr(He)),o!==r?(s=en(),n=[n,o,s],e=n):(ur=e,e=r),e}function Kr(){let e;return e=t.charAt(ur),wt.test(e)?ur++:(e=r,0===hr&&wr(We)),e}function Xr(){let e,n,o,s;return hr++,e=ur,n=en(),44===t.charCodeAt(ur)?(o=ht,ur++):(o=r,0===hr&&wr(ke)),o!==r?(s=en(),e=o):(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(Ye)),e}function tn(){let e,n,o,s;return hr++,e=ur,n=en(),46===t.charCodeAt(ur)?(o=ot,ur++):(o=r,0===hr&&wr(Ne)),o!==r?(s=en(),lr=e,e="."):(ur=e,e=r),hr--,e===r&&(n=r,0===hr&&wr(Ge)),e}function en(){let e,n,o;for(hr++,e=ur,n=[],o=t.charAt(ur),At.test(o)?ur++:(o=r,0===hr&&wr(Qe));o!==r;)n.push(o),o=t.charAt(ur),At.test(o)?ur++:(o=r,0===hr&&wr(Qe));return e=t.substring(e,ur),hr--,e}function rn(){let e,n,o;if(hr++,e=ur,n=[],o=t.charAt(ur),At.test(o)?ur++:(o=r,0===hr&&wr(Qe)),o!==r)for(;o!==r;)n.push(o),o=t.charAt(ur),At.test(o)?ur++:(o=r,0===hr&&wr(Qe));else n=r;return e=n!==r?t.substring(e,ur):n,hr--,e===r&&(n=r,0===hr&&wr(Ge)),e}const nn=[],on=e.args;let sn=0;const un=!on?.length||!e.startRule&&peg$parse.late_binding?()=>nn[sn++]=ln:()=>nn[sn]=fluent.expr(on[sn++]),ln={ref:["?"],param:!0};cr=s();const cn=cr!==r&&ur===t.length;function an(){throw cr!==r&&ur<t.length&&wr({type:"end"}),Ar(fr,ar<t.length?function(e=ur){const r=t.codePointAt(e);return void 0===r?"":String.fromCodePoint(r)}(ar):null,ar<t.length?Cr(ar,ar+1):Cr(ar,ar))}return e.peg$library?{peg$result:cr,peg$currPos:ur,peg$FAILED:r,peg$maxFailExpected:fr,peg$maxFailPos:ar,peg$success:cn,peg$throw:cn?void 0:an}:cn?cr:void an()}const peg$allowedStartRules=["CQL","subject","columns","values","ref","val","expr","with","set","where","groupBy","orderBy"];export{peg$allowedStartRules as StartRules,peg$SyntaxError as SyntaxError,peg$parse as parse};
|
|
1
|
+
import*as fluent from"../lib/xl/fluent.js";import{SELECT}from"../lib/ql/select.js";import{INSERT}from"../lib/ql/insert.js";import{UPSERT}from"../lib/ql/insert.js";import{UPDATE}from"../lib/ql/update.js";import{DELETE}from"../lib/ql/delete.js";import{CALL}from"../lib/ql/call-action.js";class peg$SyntaxError extends SyntaxError{constructor(t,e,r,n){super(t),this.expected=e,this.found=r,this.location=n,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let r=null;const n=t.find(t=>t.source===this.location.source);n&&(r=n.text.split(/\r\n|\n|\r/g));const o=this.location.start,s=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,u=this.location.source+":"+s.line+":"+s.column;if(r){const t=this.location.end,n="".padEnd(s.line.toString().length," "),l=r[o.line-1],i=(o.line===t.line?t.column:l.length+1)-o.column||1;e+="\n --\x3e "+u+"\n"+n+" |\n"+s.line+" | "+l+"\n"+n+" | "+"".padEnd(o.column-1," ")+"".padEnd(i,"^")}else e+="\n at "+u}return e}static buildMessage(t,e){function r(t){return t.codePointAt(0).toString(16).toUpperCase()}const n=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function o(t){return n?t.replace(n,t=>"\\u{"+r(t)+"}"):t}function s(t){return o(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+r(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+r(t)))}function u(t){return o(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+r(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+r(t)))}const l={literal:t=>'"'+s(t.text)+'"',class(t){const e=t.parts.map(t=>Array.isArray(t)?u(t[0])+"-"+u(t[1]):u(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function i(t){return l[t.type](t)}return"Expected "+function(t){const e=t.map(i);if(e.sort(),e.length>0){let t=1;for(let r=1;r<e.length;r++)e[r-1]!==e[r]&&(e[t]=e[r],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+function(t){return t?'"'+s(t)+'"':"end of input"}(e)+" found."}}function peg$parse(t,e){const r={},n=(e=void 0!==e?e:{}).grammarSource,o={CQL:_r,subject:Mr,columns:Fr,values:Vr,ref:Hr,val:Wr,expr:Zr,changes:Pr,where:jr,groupBy:Or,orderBy:Nr};let s=_r;const u="select",l="stream",i="localized",c="distinct",a="one",f="from",h="where",p="group by",d="having",g="order by",b="limit",C="offset",w="as",A="*",m="[",L="]",E="asc",x="desc",v="insert",y="upsert",S="into",_="entries",T="columns",$="rows",R="values",F="update",I="entity",j="with",O="set",N="=",P="{",U=":",D="}",z="delete",B="call",M="action",Z="function",q="#",H="?",W="and",Y="or",k="in",G="between",Q="like",V="exists",J="contains",K="case",X="when",tt="then",et="else",rt="end",nt="is",ot="not",st="null",ut="empty",lt="-",it=".",ct="e",at="'",ft="''",ht="true",pt="false",dt="(",gt=")",bt=",",Ct=/^[A-Za-z_$]/,wt=/^[A-Za-z0-9_$]/,At=/^[!=><+\-*\/%&|\^~]/,mt=/^[0-9]/,Lt=/^[^']/,Et=/^[A-Za-z_$0-9]/,xt=/^[ \t\n\r]/,vt=mr("SELECT",!0),yt=mr("STREAM",!0),St=mr("LOCALIZED",!0),_t=mr("DISTINCT",!0),Tt=mr("ONE",!0),$t=mr("FROM",!0),Rt={type:"any"},Ft=mr("WHERE",!0),It=mr("GROUP BY",!0),jt=mr("HAVING",!0),Ot=mr("ORDER BY",!0),Nt=mr("LIMIT",!0),Pt=mr("OFFSET",!0),Ut=mr("as",!0),Dt=mr("*",!1),zt=mr("[",!1),Bt=mr("]",!1),Mt=mr("asc",!0),Zt=mr("desc",!0),qt=mr("INSERT",!0),Ht=mr("UPSERT",!0),Wt=mr("INTO",!0),Yt=mr("ENTRIES",!0),kt=mr("COLUMNS",!0),Gt=mr("ROWS",!0),Qt=mr("VALUES",!0),Vt=mr("UPDATE",!0),Jt=mr("ENTITY",!0),Kt=mr("WITH",!0),Xt=mr("SET",!0),te=mr("=",!1),ee=mr("{",!1),re=mr(":",!1),ne=mr("}",!1),oe=mr("DELETE",!0),se=mr("CALL",!0),ue=mr("ACTION",!0),le=mr("FUNCTION",!0),ie=Er("a name"),ce=mr("AS",!0),ae=mr("from",!0),fe=Lr([["A","Z"],["a","z"],"_","$"],!1,!1,!1),he=Lr([["A","Z"],["a","z"],["0","9"],"_","$"],!1,!1,!1),pe=Er("an element ref"),de=Er("an entity ref"),ge=Er("a reference"),be=Er("a value"),Ce=Er("a list"),we=Er("a function"),Ae=Er("a symbol"),me=mr("#",!1),Le=Er("a parameter"),Ee=mr("?",!1),xe=Er("an operator"),ve=Lr(["!","=",">","<","+","-","*","/","%","&","|","^","~"],!1,!1,!1),ye=mr("and",!1),Se=mr("or",!1),_e=mr("in",!1),Te=mr("between",!1),$e=mr("like",!1),Re=mr("exists",!1),Fe=mr("contains",!1),Ie=mr("case",!1),je=mr("when",!1),Oe=mr("then",!1),Ne=mr("else",!1),Pe=mr("end",!1),Ue=mr("is",!1),De=mr("not",!1),ze=mr("null",!1),Be=mr("empty",!1),Me=Er("a literal"),Ze=mr("-",!1),qe=Lr([["0","9"]],!1,!1,!1),He=mr(".",!1),We=mr("e",!1),Ye=mr("'",!1),ke=Lr(["'"],!0,!1,!1),Ge=mr("''",!1),Qe=mr("true",!1),Ve=mr("false",!1),Je=mr("(",!1),Ke=mr(")",!1),Xe=Lr([["A","Z"],["a","z"],"_","$",["0","9"]],!1,!1,!1),tr=Er("a comma"),er=mr(",",!1),rr=Er(""),nr=Lr([" ","\t","\n","\r"],!1,!1,!1);function or(e){return fn?.length&&(e.params=fn),hn?.length&&(e.args=hn),e.source=t.substring(dr,pr),e}function sr(t,e){t.as=e}function ur(t,e,r){e?t.inline=r:t.expand=r}function lr(t,e){t.as=e}function ir(t,e){t.sort=e.toLowerCase()}function cr(t,e,r){t[e]=r}function ar(t,e,r){t[e]=r.val||r}function fr(t,e){return e?{id:t,...e}:t}function hr(){return"'"}let pr=0|e.peg$currPos,dr=pr;const gr=[{line:1,column:1}];let br,Cr=pr,wr=e.peg$maxFailExpected||[],Ar=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');s=o[e.startRule]}function mr(t,e){return{type:"literal",text:t,ignoreCase:e}}function Lr(t,e,r,n){return{type:"class",parts:t,inverted:e,ignoreCase:r,unicode:n}}function Er(t){return{type:"other",description:t}}function xr(e){let r,n=gr[e];if(n)return n;if(e>=gr.length)r=gr.length-1;else for(r=e;!gr[--r];);for(n=gr[r],n={line:n.line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return gr[e]=n,n}function vr(t,e,r){const o=xr(t),s=xr(e),u={source:n,start:{offset:t,line:o.line,column:o.column},end:{offset:e,line:s.line,column:s.column}};return r&&n&&"function"==typeof n.offset&&(u.start=n.offset(u.start),u.end=n.offset(u.end)),u}function yr(t){pr<Cr||(pr>Cr&&(Cr=pr,wr=[]),wr.push(t))}function Sr(t,e,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(t,e),t,e,r)}function _r(){let e,n;return e=pr,n=Tr(),n===r&&(n=function(){let e,n,o,s,u,l,i,c,a,h,p,d,g,b;e=pr,n=pr,o=t.substr(pr,6),o.toLowerCase()===v?pr+=6:(o=r,0===Ar&&yr(qt));o!==r?(s=an(),s!==r?(dr=n,n=new INSERT):(pr=n,n=r)):(pr=n,n=r);n===r&&(n=pr,o=t.substr(pr,6),o.toLowerCase()===y?pr+=6:(o=r,0===Ar&&yr(Ht)),o!==r?(s=an(),s!==r?(dr=n,n=new UPSERT):(pr=n,n=r)):(pr=n,n=r));if(n!==r)if(o=pr,s=tn(),s!==r&&(dr=o,C=s,s=void(n._.entries=Array.isArray(C)?C:[C])),o=s,o===r&&(o=null),s=pr,u=pr,l=t.substr(pr,4),l.toLowerCase()===S?pr+=4:(l=r,0===Ar&&yr(Wt)),l!==r?(i=an(),i!==r?(l=[l,i],u=l):(pr=u,u=r)):(pr=u,u=r),u!==r?(l=Mr(),l!==r?(dr=s,s=function(t,e){t._.into=e}(n,l)):(pr=s,s=r)):(pr=s,s=r),s!==r){if(u=pr,l=t.substr(pr,4),l.toLowerCase()===f?pr+=4:(l=r,0===Ar&&yr($t)),l!==r?(i=an(),i!==r?(c=tn(),c!==r?(dr=u,u=function(t,e){t._.from=e}(n,c)):(pr=u,u=r)):(pr=u,u=r)):(pr=u,u=r),u===r&&(u=pr,l=Tr(),l!==r&&(dr=u,l=function(t,e){t._.from=e}(n,l)),u=l),u===r){if(u=pr,l=pr,i=pr,c=t.substr(pr,7),c.toLowerCase()===_?pr+=7:(c=r,0===Ar&&yr(Yt)),c!==r?(a=an(),a!==r?(c=[c,a],i=c):(pr=i,i=r)):(pr=i,i=r),i===r&&(i=null),c=pr,a=tn(),a===r){for(a=pr,h=[],p=Ur();p!==r;)h.push(p),p=pr,d=un(),d!==r?(d=Ur(),d===r?(pr=p,p=r):p=d):p=d;h.length<1?(pr=a,a=r):a=h}if(a!==r&&(dr=c,a=function(t,e){t._tail(e)}(n,a)),c=a,c!==r?(i=[i,c],l=i):(pr=l,l=r),l===r&&(l=null),i=pr,c=pr,a=t.substr(pr,7),a.toLowerCase()===T?pr+=7:(a=r,0===Ar&&yr(kt)),a!==r?(h=an(),h!==r?(a=[a,h],c=a):(pr=c,c=r)):(pr=c,c=r),c===r&&(c=null),a=tn(),a===r)if(a=pr,h=nn(),h!==r){for(p=pr,d=[],g=Br();g!==r;)d.push(g),g=pr,b=un(),b!==r?(b=Br(),b===r?(pr=g,g=r):g=b):g=b;d.length<1?(pr=p,p=r):p=d,p!==r?(d=on(),d!==r?a=p:(pr=a,a=r)):(pr=a,a=r)}else pr=a,a=r;a!==r?(dr=i,i=function(t,e){t._.columns=e}(n,a)):(pr=i,i=r),i===r&&(i=null),c=pr,a=pr,h=t.substr(pr,4),h.toLowerCase()===$?pr+=4:(h=r,0===Ar&&yr(Gt)),h!==r?(p=an(),p!==r?(h=[h,p],a=h):(pr=a,a=r)):(pr=a,a=r),a===r&&(a=null),h=tn(),h!==r?(dr=c,c=function(t,e){t._.rows=e}(n,h)):(pr=c,c=r),c===r&&(c=null),a=pr,h=pr,p=t.substr(pr,6),p.toLowerCase()===R?pr+=6:(p=r,0===Ar&&yr(Qt)),p!==r?(d=an(),d!==r?(p=[p,d],h=p):(pr=h,h=r)):(pr=h,h=r),h!==r?(p=Yr(),p!==r?(dr=a,a=function(t,e){t._.values=e.list}(n,p)):(pr=a,a=r)):(pr=a,a=r),a===r&&(a=null),l=[l,i,c,a],u=l}u!==r?e=n:(pr=e,e=r)}else pr=e,e=r;else pr=e,e=r;var C;return e}(),n===r&&(n=function(){let e,n,o,s,u,l,i,c,a;e=pr,n=pr,o=t.substr(pr,6),o.toLowerCase()===F?pr+=6:(o=r,0===Ar&&yr(Vt));o!==r?(s=an(),s!==r?(dr=n,n=new UPDATE):(pr=n,n=r)):(pr=n,n=r);n!==r?(o=pr,s=pr,u=t.substr(pr,6),u.toLowerCase()===I?pr+=6:(u=r,0===Ar&&yr(Jt)),u!==r?(l=an(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),u=Mr(),u!==r?(dr=o,f=u,o=void(n._.entity=f)):(pr=o,o=r),o!==r?(s=pr,u=pr,l=t.substr(pr,4),l.toLowerCase()===j?pr+=4:(l=r,0===Ar&&yr(Kt)),l!==r?(i=an(),i!==r?(l=[l,i],u=l):(pr=u,u=r)):(pr=u,u=r),u!==r?(l=tn(),l===r&&(l=Ur()),l!==r?(dr=s,s=function(t,e){t._.data=e}(n,l)):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),u=pr,l=pr,i=t.substr(pr,3),i.toLowerCase()===O?pr+=3:(i=r,0===Ar&&yr(Xt)),i!==r?(c=an(),c!==r?(i=[i,c],l=i):(pr=l,l=r)):(pr=l,l=r),l!==r?(i=Pr(),i!==r?(dr=u,u=function(t,e){t._.with=e}(n,i)):(pr=u,u=r)):(pr=u,u=r),u===r&&(u=null),l=pr,i=pr,c=t.substr(pr,5),c.toLowerCase()===h?pr+=5:(c=r,0===Ar&&yr(Ft)),c!==r?(a=an(),a!==r?(c=[c,a],i=c):(pr=i,i=r)):(pr=i,i=r),i!==r?(c=jr(),c!==r?(a=cn(),dr=l,l=function(t,e){t._.where=e}(n,c)):(pr=l,l=r)):(pr=l,l=r),l===r&&(l=null),e=n):(pr=e,e=r)):(pr=e,e=r);var f;return e}(),n===r&&(n=function(){let e,n,o,s,u,l,i;e=pr,n=pr,o=t.substr(pr,6),o.toLowerCase()===z?pr+=6:(o=r,0===Ar&&yr(oe));o!==r?(s=an(),s!==r?(dr=n,n=new DELETE):(pr=n,n=r)):(pr=n,n=r);n!==r?(o=pr,s=pr,u=t.substr(pr,4),u.toLowerCase()===f?pr+=4:(u=r,0===Ar&&yr($t)),u!==r?(l=an(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),u=Mr(),u!==r?(l=cn(),dr=o,c=u,o=void(n._.from=c)):(pr=o,o=r),o!==r?(s=pr,u=pr,l=t.substr(pr,5),l.toLowerCase()===h?pr+=5:(l=r,0===Ar&&yr(Ft)),l!==r?(i=an(),i!==r?(l=[l,i],u=l):(pr=u,u=r)):(pr=u,u=r),u!==r?(l=jr(),l!==r?(i=cn(),dr=s,s=function(t,e){t._.where=e}(n,l)):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),e=n):(pr=e,e=r)):(pr=e,e=r);var c;return e}(),n===r&&(n=function(){let e,n,o,s,u,l,i;e=pr,n=pr,o=t.substr(pr,4),o.toLowerCase()===B?pr+=4:(o=r,0===Ar&&yr(se));o!==r?(s=an(),s!==r?(dr=n,n=new CALL):(pr=n,n=r)):(pr=n,n=r);n!==r?(o=pr,s=pr,u=t.substr(pr,6),u.toLowerCase()===M?pr+=6:(u=r,0===Ar&&yr(ue)),u===r&&(u=t.substr(pr,8),u.toLowerCase()===Z?pr+=8:(u=r,0===Ar&&yr(le))),u!==r?(l=an(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),u=zr(),u!==r?(l=cn(),dr=o,c=u,o=void(n._.action=c)):(pr=o,o=r),o!==r?(s=pr,u=pr,l=t.substr(pr,4),l.toLowerCase()===j?pr+=4:(l=r,0===Ar&&yr(Kt)),l!==r?(i=an(),i!==r?(l=[l,i],u=l):(pr=u,u=r)):(pr=u,u=r),u===r&&(u=null),l=Ur(),l!==r?(i=cn(),dr=s,s=function(t,e){Object.assign(t._,{with:e})}(n,l)):(pr=s,s=r),s!==r?e=n:(pr=e,e=r)):(pr=e,e=r)):(pr=e,e=r);var c;return e}())))),n!==r&&(dr=e,n=or(n)),e=n,e}function Tr(){let e,n,o,s,h,p,d,g,b,C,w,A;return e=pr,n=pr,o=t.substr(pr,6),o.toLowerCase()===u?pr+=6:(o=r,0===Ar&&yr(vt)),o!==r?(s=an(),s!==r?(dr=n,n=new SELECT):(pr=n,n=r)):(pr=n,n=r),n===r&&(n=pr,o=t.substr(pr,6),o.toLowerCase()===l?pr+=6:(o=r,0===Ar&&yr(yt)),o!==r?(s=an(),s!==r?(dr=n,n=function(){let t=new SELECT;return t._.stream=!0,t}()):(pr=n,n=r)):(pr=n,n=r)),n!==r?(o=pr,s=t.substr(pr,9),s.toLowerCase()===i?pr+=9:(s=r,0===Ar&&yr(St)),s!==r?(h=an(),h!==r?(dr=o,o=void(n._.localized=!0)):(pr=o,o=r)):(pr=o,o=r),o===r&&(o=null),s=pr,h=t.substr(pr,8),h.toLowerCase()===c?pr+=8:(h=r,0===Ar&&yr(_t)),h!==r?(p=an(),p!==r?(dr=s,s=function(t){t._.distinct=!0}(n)):(pr=s,s=r)):(pr=s,s=r),s===r&&(s=null),h=pr,p=t.substr(pr,6),p.toLowerCase()===l?pr+=6:(p=r,0===Ar&&yr(yt)),p!==r?(d=an(),d!==r?(dr=h,h=function(t){t._.stream=!0}(n)):(pr=h,h=r)):(pr=h,h=r),h===r&&(h=null),p=pr,d=t.substr(pr,3),d.toLowerCase()===a?pr+=3:(d=r,0===Ar&&yr(Tt)),d!==r?(g=an(),g!==r?(dr=p,p=function(t){t._.one=!0}(n)):(pr=p,p=r)):(pr=p,p=r),p===r&&(p=null),d=pr,g=Fr(),g!==r?(b=cn(),dr=d,d=function(t,e){t._.columns=e}(n,g)):(pr=d,d=r),d===r&&(d=null),g=pr,b=pr,C=t.substr(pr,4),C.toLowerCase()===f?pr+=4:(C=r,0===Ar&&yr($t)),C!==r?(w=an(),w!==r?(C=[C,w],b=C):(pr=b,b=r)):(pr=b,b=r),b!==r?(C=Mr(),C===r&&(C=Xr()),C!==r?(dr=g,g=function(t,e){t._.from=e}(n,C)):(pr=g,g=r)):(pr=g,g=r),g===r&&(g=null),b=pr,C=en(),C!==r?(w=Fr(),w!==r?(A=rn(),A!==r?(dr=b,b=function(t,e){t._.columns=e}(n,w)):(pr=b,b=r)):(pr=b,b=r)):(pr=b,b=r),b===r&&(b=null),C=pr,w=$r(),w!==r&&(dr=C,w=function(t,e){Object.assign(t._,e)}(n,w)),C=w,C===r&&(C=null),e=n):(pr=e,e=r),e}function $r(){let e,n,o,s,u,l,i,c,a,f,w,A;var m;return e=pr,n=pr,o=pr,Ar++,t.length>pr?(s=t.charAt(pr),pr++):(s=r,0===Ar&&yr(Rt)),Ar--,s!==r?(pr=o,o=void 0):o=r,o!==r&&(dr=n,o={}),n=o,n!==r?(o=pr,s=pr,u=t.substr(pr,5),u.toLowerCase()===h?pr+=5:(u=r,0===Ar&&yr(Ft)),u!==r?(l=an(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r),s!==r?(u=jr(),u!==r?(l=cn(),dr=o,m=u,o=void(n.where=m)):(pr=o,o=r)):(pr=o,o=r),o===r&&(o=null),s=pr,u=pr,l=t.substr(pr,8),l.toLowerCase()===p?pr+=8:(l=r,0===Ar&&yr(It)),l!==r?(i=an(),i!==r?(c=Or(),c!==r?(a=cn(),dr=u,u=function(t,e){t.groupBy=e}(n,c)):(pr=u,u=r)):(pr=u,u=r)):(pr=u,u=r),u!==r?(l=pr,i=t.substr(pr,6),i.toLowerCase()===d?pr+=6:(i=r,0===Ar&&yr(jt)),i!==r?(c=an(),c!==r?(a=jr(),a!==r?(f=cn(),dr=l,l=function(t,e){t.having=e}(n,a)):(pr=l,l=r)):(pr=l,l=r)):(pr=l,l=r),l===r&&(l=null),u=[u,l],s=u):(pr=s,s=r),s===r&&(s=null),u=pr,l=pr,i=t.substr(pr,8),i.toLowerCase()===g?pr+=8:(i=r,0===Ar&&yr(Ot)),i!==r?(c=an(),c!==r?(i=[i,c],l=i):(pr=l,l=r)):(pr=l,l=r),l!==r?(i=Nr(),i!==r?(c=cn(),dr=u,u=function(t,e){t.orderBy=e}(n,i)):(pr=u,u=r)):(pr=u,u=r),u===r&&(u=null),l=pr,i=pr,c=t.substr(pr,5),c.toLowerCase()===b?pr+=5:(c=r,0===Ar&&yr(Nt)),c!==r?(a=an(),a!==r?(f=Hr(),f===r&&(f=Wr()),f!==r?(w=cn(),dr=i,i=function(t,e){t.limit={rows:e}}(n,f)):(pr=i,i=r)):(pr=i,i=r)):(pr=i,i=r),i!==r?(c=pr,a=t.substr(pr,6),a.toLowerCase()===C?pr+=6:(a=r,0===Ar&&yr(Pt)),a!==r?(f=an(),f!==r?(w=Hr(),w===r&&(w=Wr()),w!==r?(A=cn(),dr=c,c=function(t,e){t.limit.offset=e}(n,w)):(pr=c,c=r)):(pr=c,c=r)):(pr=c,c=r),c===r&&(c=null),i=[i,c],l=i):(pr=l,l=r),l===r&&(l=null),e=n):(pr=e,e=r),e}function Rr(){let e,n,o,s,u;return e=pr,n=pr,o=cn(),n=t.substring(n,pr),o=t.substr(pr,2),o.toLowerCase()===w?pr+=2:(o=r,0===Ar&&yr(Ut)),o!==r?(s=an(),s!==r?(u=zr(),u!==r?e=u:(pr=e,e=r)):(pr=e,e=r)):(pr=e,e=r),e}function Fr(){let e,n,o,s,u,l,i,c,a,f,h;for(e=pr,n=[],42===t.charCodeAt(pr)?(o=A,pr++):(o=r,0===Ar&&yr(Dt)),o===r&&(o=pr,s=Hr(),s!==r?(u=pr,l=Rr(),l!==r&&(dr=u,l=sr(s,l)),u=l,u===r&&(u=null),l=ln(),l===r&&(l=null),i=pr,c=en(),c!==r?(a=Fr(),a!==r?(f=rn(),f!==r?(dr=i,i=ur(s,l,a)):(pr=i,i=r)):(pr=i,i=r)):(pr=i,i=r),i!==r?o=s:(pr=o,o=r)):(pr=o,o=r),o===r&&(o=pr,s=Zr(),s!==r?(u=pr,l=Rr(),l!==r&&(dr=u,l=lr(s,l)),u=l,u===r&&(u=null),o=s):(pr=o,o=r)));o!==r;)n.push(o),o=pr,s=un(),s!==r?(42===t.charCodeAt(pr)?(s=A,pr++):(s=r,0===Ar&&yr(Dt)),s===r&&(s=pr,u=Hr(),u!==r?(l=pr,i=Rr(),i!==r&&(dr=l,i=sr(u,i)),l=i,l===r&&(l=null),i=ln(),i===r&&(i=null),c=pr,a=en(),a!==r?(f=Fr(),f!==r?(h=rn(),h!==r?(dr=c,c=ur(u,i,f)):(pr=c,c=r)):(pr=c,c=r)):(pr=c,c=r),c!==r?s=u:(pr=s,s=r)):(pr=s,s=r),s===r&&(s=pr,u=Zr(),u!==r?(l=pr,i=Rr(),i!==r&&(dr=l,i=lr(u,i)),l=i,l===r&&(l=null),s=u):(pr=s,s=r))),s===r?(pr=o,o=r):o=s):o=s;return n.length<1?(pr=e,e=r):e=n,e}function Ir(){let e,n,o,s,u,l,i,c;return e=pr,n=cn(),91===t.charCodeAt(pr)?(o=m,pr++):(o=r,0===Ar&&yr(zt)),o!==r?(s=cn(),u=function(){let e,n,o,s,u;e=pr,n=tn(),n!==r&&(dr=e,l=n,n={where:fluent.where(l)});var l;if(e=n,e===r){for(e=pr,n=pr,o=[],s=Wr();s!==r;)o.push(s),s=pr,u=un(),u!==r?(u=Wr(),u===r?(pr=s,s=r):s=u):s=u;o.length<1?(pr=n,n=r):n=o,n!==r&&(dr=e,n={where:n}),e=n,e===r&&(e=pr,n=pr,Ar++,o=pr,s=t.substr(pr,5),s.toLowerCase()===h?pr+=5:(s=r,0===Ar&&yr(Ft)),s!==r?(u=an(),u!==r?(s=[s,u],o=s):(pr=o,o=r)):(pr=o,o=r),Ar--,o===r?n=void 0:(pr=n,n=r),n!==r?(o=qr(),o!==r?(dr=e,e={where:o.xpr}):(pr=e,e=r)):(pr=e,e=r),e===r&&(e=$r()))}return e}(),u!==r?(l=cn(),93===t.charCodeAt(pr)?(i=L,pr++):(i=r,0===Ar&&yr(Bt)),i!==r?(c=cn(),e=u):(pr=e,e=r)):(pr=e,e=r)):(pr=e,e=r),e}function jr(){let t,e;var n;return t=pr,e=tn(),e!==r&&(dr=t,n=e,e=fluent.where(n)),t=e,t===r&&(t=pr,e=qr(),e!==r&&(dr=t,e=e.xpr),t=e),t}function Or(){let t,e,n,o,s;for(t=pr,e=pr,n=[],o=Hr();o!==r;)n.push(o),o=pr,s=un(),s!==r?(s=Hr(),s===r?(pr=o,o=r):o=s):o=s;return n.length<1?(pr=e,e=r):e=n,e!==r?t=e:(pr=t,t=r),t}function Nr(){let e,n,o,s,u,l,i,c,a;for(e=pr,n=pr,o=[],s=pr,u=Hr(),u!==r?(l=pr,i=an(),i!==r?(c=t.substr(pr,3),c.toLowerCase()===E?pr+=3:(c=r,0===Ar&&yr(Mt)),c===r&&(c=t.substr(pr,4),c.toLowerCase()===x?pr+=4:(c=r,0===Ar&&yr(Zt))),c!==r?(dr=l,l=ir(u,c)):(pr=l,l=r)):(pr=l,l=r),l===r&&(l=null),s=u):(pr=s,s=r);s!==r;)o.push(s),s=pr,u=un(),u!==r?(u=pr,l=Hr(),l!==r?(i=pr,c=an(),c!==r?(a=t.substr(pr,3),a.toLowerCase()===E?pr+=3:(a=r,0===Ar&&yr(Mt)),a===r&&(a=t.substr(pr,4),a.toLowerCase()===x?pr+=4:(a=r,0===Ar&&yr(Zt))),a!==r?(dr=i,i=ir(l,a)):(pr=i,i=r)):(pr=i,i=r),i===r&&(i=null),u=l):(pr=u,u=r),u===r?(pr=s,s=r):s=u):s=u;return o.length<1?(pr=n,n=r):n=o,n!==r?e=n:(pr=e,e=r),e}function Pr(){let e,n,o,s,u,l,i,c,a,f,h;for(e=pr,n=pr,o="",dr=n,o={},n=o,o=pr,s=[],u=pr,l=Br(),l!==r?(i=cn(),61===t.charCodeAt(pr)?(c=N,pr++):(c=r,0===Ar&&yr(te)),c!==r?(a=cn(),f=Qr(),f===r&&(f=Zr()),f!==r?(dr=u,u=cr(n,l,f)):(pr=u,u=r)):(pr=u,u=r)):(pr=u,u=r);u!==r;)s.push(u),u=pr,l=un(),l!==r?(l=pr,i=Br(),i!==r?(c=cn(),61===t.charCodeAt(pr)?(a=N,pr++):(a=r,0===Ar&&yr(te)),a!==r?(f=cn(),h=Qr(),h===r&&(h=Zr()),h!==r?(dr=l,l=cr(n,i,h)):(pr=l,l=r)):(pr=l,l=r)):(pr=l,l=r),l===r?(pr=u,u=r):u=l):u=l;return s.length<1?(pr=o,o=r):o=s,o!==r?(s=cn(),e=n):(pr=e,e=r),e}function Ur(){let e,n,o,s,u,l,i,c,a,f,h;if(e=pr,n=pr,o=cn(),123===t.charCodeAt(pr)?(s=P,pr++):(s=r,0===Ar&&yr(ee)),s!==r?(u=cn(),dr=n,n={}):(pr=n,n=r),n!==r){for(o=pr,s=[],u=pr,l=Br(),l!==r?(i=cn(),58===t.charCodeAt(pr)?(c=U,pr++):(c=r,0===Ar&&yr(re)),c!==r?(a=cn(),f=Wr(),f===r&&(f=Ur(),f===r&&(f=Dr())),f!==r?(dr=u,u=ar(n,l,f)):(pr=u,u=r)):(pr=u,u=r)):(pr=u,u=r);u!==r;)s.push(u),u=pr,l=un(),l!==r?(l=pr,i=Br(),i!==r?(c=cn(),58===t.charCodeAt(pr)?(a=U,pr++):(a=r,0===Ar&&yr(re)),a!==r?(f=cn(),h=Wr(),h===r&&(h=Ur(),h===r&&(h=Dr())),h!==r?(dr=l,l=ar(n,i,h)):(pr=l,l=r)):(pr=l,l=r)):(pr=l,l=r),l===r?(pr=u,u=r):u=l):u=l;s.length<1?(pr=o,o=r):o=s,o!==r?(s=cn(),125===t.charCodeAt(pr)?(u=D,pr++):(u=r,0===Ar&&yr(ne)),u!==r?(l=cn(),e=n):(pr=e,e=r)):(pr=e,e=r)}else pr=e,e=r;return e}function Dr(){let e,n,o,s,u,l,i,c;if(e=pr,n=cn(),91===t.charCodeAt(pr)?(o=m,pr++):(o=r,0===Ar&&yr(zt)),o!==r){for(s=cn(),u=pr,l=[],i=Ur();i!==r;)l.push(i),i=pr,c=un(),c!==r?(c=Ur(),c===r?(pr=i,i=r):i=c):i=c;l.length<1?(pr=u,u=r):u=l,u!==r?(l=cn(),93===t.charCodeAt(pr)?(i=L,pr++):(i=r,0===Ar&&yr(Bt)),i!==r?(c=cn(),e=u):(pr=e,e=r)):(pr=e,e=r)}else pr=e,e=r;return e}function zr(){let e,n,o,s,u,l,i,c,a;if(Ar++,e=pr,n=pr,Ar++,o=t.substr(pr,2),o.toLowerCase()===w?pr+=2:(o=r,0===Ar&&yr(ce)),Ar--,o===r?n=void 0:(pr=n,n=r),n!==r)if(o=pr,Ar++,s=t.substr(pr,4),s.toLowerCase()===f?pr+=4:(s=r,0===Ar&&yr(ae)),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r)if(s=pr,Ar++,u=Kr(),Ar--,u===r?s=void 0:(pr=s,s=r),s!==r){if(u=pr,l=pr,i=t.charAt(pr),Ct.test(i)?pr++:(i=r,0===Ar&&yr(fe)),i!==r){for(c=[],a=t.charAt(pr),wt.test(a)?pr++:(a=r,0===Ar&&yr(he));a!==r;)c.push(a),a=t.charAt(pr),wt.test(a)?pr++:(a=r,0===Ar&&yr(he));i=[i,c],l=i}else pr=l,l=r;u=l!==r?t.substring(u,pr):l,u!==r?e=u:(pr=e,e=r)}else pr=e,e=r;else pr=e,e=r;else pr=e,e=r;return Ar--,e===r&&(n=r,0===Ar&&yr(ie)),e}function Br(){let e,n,o,s,u,l;for(Ar++,e=pr,n=pr,o=pr,s=[],u=zr();u!==r;)s.push(u),u=pr,l=ln(),l!==r?(l=zr(),l===r?(pr=u,u=r):u=l):u=l;return s.length<1?(pr=o,o=r):o=s,n=o!==r?t.substring(n,pr):o,n!==r?e=n:(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(pe)),e}function Mr(){let e,n,o,s,u,l,i;var c;if(Ar++,e=pr,n=tn(),n!==r&&(dr=e,c=n,n=fluent.subject(c)),e=n,e===r){for(e=pr,n=pr,o=[],s=pr,u=zr(),u!==r?(l=ln(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r);s!==r;)o.push(s),s=pr,u=zr(),u!==r?(l=ln(),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r);n=t.substring(n,pr),o=pr,s=zr(),s!==r?(u=cn(),58===t.charCodeAt(pr)?(l=U,pr++):(l=r,0===Ar&&yr(re)),l!==r?(i=cn(),o=s):(pr=o,o=r)):(pr=o,o=r),o===r&&(o=null),s=Hr(),s!==r?(u=cn(),dr=e,e=function(t,e,r){if(e)return{ref:[t+e,...r.ref]};if(t){let[e]=r.ref;e.id?e.id=t+e.id:r.ref[0]=t+e}return r}(n,o,s)):(pr=e,e=r)}return Ar--,e===r&&(n=r,0===Ar&&yr(de)),e}function Zr(){let t,e;var n;return t=pr,e=qr(),e!==r&&(dr=t,e=(n=e).xpr.length>1?n:n.xpr[0]),t=e,t}function qr(){let t,e,n,o,s,u;if(t=pr,e=[],n=Xr(),n===r&&(n=Yr(),n===r&&(n=Gr(),n===r&&(n=Wr(),n===r&&(n=Jr(),n===r&&(n=kr(),n===r&&(n=Hr(),n===r&&(n=pr,o=nn(),o!==r?(s=Zr(),s!==r?(u=on(),u!==r?n=s:(pr=n,n=r)):(pr=n,n=r)):(pr=n,n=r)))))))),n!==r)for(;n!==r;)e.push(n),n=Xr(),n===r&&(n=Yr(),n===r&&(n=Gr(),n===r&&(n=Wr(),n===r&&(n=Jr(),n===r&&(n=kr(),n===r&&(n=Hr(),n===r&&(n=pr,o=nn(),o!==r?(s=Zr(),s!==r?(u=on(),u!==r?n=s:(pr=n,n=r)):(pr=n,n=r)):(pr=n,n=r))))))));else e=r;return e!==r&&(dr=t,e={xpr:e}),t=e,t}function Hr(){let t,e,n,o,s,u,l;for(Ar++,t=pr,e=pr,n=[],o=pr,s=zr(),s!==r?(u=Ir(),u===r&&(u=null),dr=o,o=fr(s,u)):(pr=o,o=r);o!==r;)n.push(o),o=pr,s=ln(),s!==r?(s=pr,u=zr(),u!==r?(l=Ir(),l===r&&(l=null),dr=s,s=fr(u,l)):(pr=s,s=r),s===r?(pr=o,o=r):o=s):o=s;return n.length<1?(pr=e,e=r):e=n,e!==r&&(dr=t,e={ref:e}),t=e,Ar--,t===r&&(e=r,0===Ar&&yr(ge)),t}function Wr(){let e,n;return Ar++,e=Qr(),e===r&&(e=pr,n=function(){let e,n;Ar++,e=function(){let e,n,o,s,u,l;e=pr,39===t.charCodeAt(pr)?(n=at,pr++):(n=r,0===Ar&&yr(Ye));if(n!==r){for(o=pr,s=[],u=t.charAt(pr),Lt.test(u)?pr++:(u=r,0===Ar&&yr(ke)),u===r&&(u=pr,t.substr(pr,2)===ft?(l=ft,pr+=2):(l=r,0===Ar&&yr(Ge)),l!==r&&(dr=u,l="'"),u=l);u!==r;)s.push(u),u=t.charAt(pr),Lt.test(u)?pr++:(u=r,0===Ar&&yr(ke)),u===r&&(u=pr,t.substr(pr,2)===ft?(l=ft,pr+=2):(l=r,0===Ar&&yr(Ge)),l!==r&&(dr=u,l=hr()),u=l);o=t.substring(o,pr),39===t.charCodeAt(pr)?(s=at,pr++):(s=r,0===Ar&&yr(Ye)),s!==r?e=o:(pr=e,e=r)}else pr=e,e=r;return e}(),e===r&&(e=function(){let e,n,o,s,u,l,i,c,a,f;e=pr,n=pr,o=pr,45===t.charCodeAt(pr)?(s=lt,pr++):(s=r,0===Ar&&yr(Ze));s===r&&(s=null);u=[],l=t.charAt(pr),mt.test(l)?pr++:(l=r,0===Ar&&yr(qe));if(l!==r)for(;l!==r;)u.push(l),l=t.charAt(pr),mt.test(l)?pr++:(l=r,0===Ar&&yr(qe));else u=r;if(u!==r){if(l=pr,46===t.charCodeAt(pr)?(i=it,pr++):(i=r,0===Ar&&yr(He)),i!==r){if(c=[],a=t.charAt(pr),mt.test(a)?pr++:(a=r,0===Ar&&yr(qe)),a!==r)for(;a!==r;)c.push(a),a=t.charAt(pr),mt.test(a)?pr++:(a=r,0===Ar&&yr(qe));else c=r;c!==r?(i=[i,c],l=i):(pr=l,l=r)}else pr=l,l=r;if(l===r&&(l=null),i=pr,101===t.charCodeAt(pr)?(c=ct,pr++):(c=r,0===Ar&&yr(We)),c!==r){if(a=[],f=t.charAt(pr),mt.test(f)?pr++:(f=r,0===Ar&&yr(qe)),f!==r)for(;f!==r;)a.push(f),f=t.charAt(pr),mt.test(f)?pr++:(f=r,0===Ar&&yr(qe));else a=r;a!==r?(c=[c,a],i=c):(pr=i,i=r)}else pr=i,i=r;i===r&&(i=null),s=[s,u,l,i],o=s}else pr=o,o=r;n=o!==r?t.substring(n,pr):o;n!==r&&(dr=e,n=Number(n));return e=n,e}(),e===r&&(e=function(){let e,n,o,s;e=pr,t.substr(pr,4)===ht?(n=ht,pr+=4):(n=r,0===Ar&&yr(Qe));n!==r?(o=pr,Ar++,s=sn(),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r?(dr=e,e=!0):(pr=e,e=r)):(pr=e,e=r);return e}(),e===r&&(e=function(){let e,n,o,s;e=pr,t.substr(pr,5)===pt?(n=pt,pr+=5):(n=r,0===Ar&&yr(Ve));n!==r?(o=pr,Ar++,s=sn(),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r?(dr=e,e=!1):(pr=e,e=r)):(pr=e,e=r);return e}(),e===r&&(e=function(){let e,n,o,s;e=pr,t.substr(pr,4)===st?(n=st,pr+=4):(n=r,0===Ar&&yr(ze));n!==r?(o=pr,Ar++,s=sn(),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r?(dr=e,e=null):(pr=e,e=r)):(pr=e,e=r);return e}()))));Ar--,e===r&&(n=r,0===Ar&&yr(Me));return e}(),n!==r&&(dr=e,n={val:n}),e=n),Ar--,e===r&&(n=r,0===Ar&&yr(be)),e}function Yr(){let t,e,n,o;return Ar++,t=Qr(),t===r&&(t=pr,e=nn(),e!==r?(n=pr,o=Vr(),o!==r&&(dr=n,o={list:o}),n=o,n!==r?(o=on(),o!==r?t=n:(pr=t,t=r)):(pr=t,t=r)):(pr=t,t=r)),Ar--,t===r&&(e=r,0===Ar&&yr(Ce)),t}function kr(){let e,n,o,s,u,l,i;if(Ar++,e=pr,n=zr(),n!==r)if(o=nn(),o!==r){for(s=pr,u=[],42===t.charCodeAt(pr)?(l=A,pr++):(l=r,0===Ar&&yr(Dt)),l===r&&(l=Zr());l!==r;)u.push(l),l=pr,i=un(),i!==r?(42===t.charCodeAt(pr)?(i=A,pr++):(i=r,0===Ar&&yr(Dt)),i===r&&(i=Zr()),i===r?(pr=l,l=r):l=i):l=i;u.length<1?(pr=s,s=r):s=u,s!==r?(u=on(),u!==r?(dr=e,e={func:n,args:s}):(pr=e,e=r)):(pr=e,e=r)}else pr=e,e=r;else pr=e,e=r;return Ar--,e===r&&(n=r,0===Ar&&yr(we)),e}function Gr(){let e,n,o;return Ar++,e=pr,35===t.charCodeAt(pr)?(n=q,pr++):(n=r,0===Ar&&yr(me)),n!==r?(o=zr(),o!==r?(dr=e,e={"#":o}):(pr=e,e=r)):(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(Ae)),e}function Qr(){let e,n,o,s;return Ar++,e=pr,n=cn(),63===t.charCodeAt(pr)?(o=H,pr++):(o=r,0===Ar&&yr(Ee)),o!==r?(s=cn(),dr=e,e=dn()):(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(Le)),e}function Vr(){let t,e,n,o;for(Ar++,t=pr,e=[],n=Gr(),n===r&&(n=Wr(),n===r&&(n=Hr(),n===r&&(n=kr())));n!==r;)e.push(n),n=pr,o=un(),o!==r?(o=Gr(),o===r&&(o=Wr(),o===r&&(o=Hr(),o===r&&(o=kr()))),o===r?(pr=n,n=r):n=o):n=o;return e.length<2?(pr=t,t=r):t=e,Ar--,t===r&&(e=r,0===Ar&&yr(be)),t}function Jr(){let e,n,o,s,u;if(Ar++,e=pr,n=cn(),o=Kr(),o===r){if(o=pr,s=[],u=t.charAt(pr),At.test(u)?pr++:(u=r,0===Ar&&yr(ve)),u!==r)for(;u!==r;)s.push(u),u=t.charAt(pr),At.test(u)?pr++:(u=r,0===Ar&&yr(ve));else s=r;o=s!==r?t.substring(o,pr):s}return o!==r?(s=cn(),e=o):(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(xe)),e}function Kr(){let e,n,o,s,u,l,i,c;if(e=pr,t.substr(pr,3)===W?(n=W,pr+=3):(n=r,0===Ar&&yr(ye)),n===r&&(t.substr(pr,2)===Y?(n=Y,pr+=2):(n=r,0===Ar&&yr(Se)),n===r&&(t.substr(pr,2)===k?(n=k,pr+=2):(n=r,0===Ar&&yr(_e)),n===r&&(t.substr(pr,7)===G?(n=G,pr+=7):(n=r,0===Ar&&yr(Te)),n===r&&(t.substr(pr,4)===Q?(n=Q,pr+=4):(n=r,0===Ar&&yr($e)),n===r&&(t.substr(pr,6)===V?(n=V,pr+=6):(n=r,0===Ar&&yr(Re)),n===r&&(t.substr(pr,8)===J?(n=J,pr+=8):(n=r,0===Ar&&yr(Fe)))))))),n!==r?(o=pr,Ar++,s=sn(),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r?e=n:(pr=e,e=r)):(pr=e,e=r),e===r&&(e=pr,t.substr(pr,4)===K?(n=K,pr+=4):(n=r,0===Ar&&yr(Ie)),n===r&&(t.substr(pr,4)===X?(n=X,pr+=4):(n=r,0===Ar&&yr(je)),n===r&&(t.substr(pr,4)===tt?(n=tt,pr+=4):(n=r,0===Ar&&yr(Oe)),n===r&&(t.substr(pr,4)===et?(n=et,pr+=4):(n=r,0===Ar&&yr(Ne)),n===r&&(t.substr(pr,3)===rt?(n=rt,pr+=3):(n=r,0===Ar&&yr(Pe)))))),n!==r?(o=pr,Ar++,s=sn(),Ar--,s===r?o=void 0:(pr=o,o=r),o!==r?e=n:(pr=e,e=r)):(pr=e,e=r),e===r)){for(e=pr,n=pr,o=[],s=pr,t.substr(pr,2)===nt?(u=nt,pr+=2):(u=r,0===Ar&&yr(Ue)),u===r&&(t.substr(pr,3)===ot?(u=ot,pr+=3):(u=r,0===Ar&&yr(De)),u===r&&(t.substr(pr,4)===st?(u=st,pr+=4):(u=r,0===Ar&&yr(ze)),u===r&&(t.substr(pr,5)===ut?(u=ut,pr+=5):(u=r,0===Ar&&yr(Be))))),u!==r?(l=pr,Ar++,i=sn(),Ar--,i===r?l=void 0:(pr=l,l=r),l!==r?(u=[u,l],s=u):(pr=s,s=r)):(pr=s,s=r);s!==r;)o.push(s),s=pr,u=cn(),u=pr,t.substr(pr,2)===nt?(l=nt,pr+=2):(l=r,0===Ar&&yr(Ue)),l===r&&(t.substr(pr,3)===ot?(l=ot,pr+=3):(l=r,0===Ar&&yr(De)),l===r&&(t.substr(pr,4)===st?(l=st,pr+=4):(l=r,0===Ar&&yr(ze)),l===r&&(t.substr(pr,5)===ut?(l=ut,pr+=5):(l=r,0===Ar&&yr(Be))))),l!==r?(i=pr,Ar++,c=sn(),Ar--,c===r?i=void 0:(pr=i,i=r),i!==r?(l=[l,i],u=l):(pr=u,u=r)):(pr=u,u=r),u===r?(pr=s,s=r):s=u;o.length<1?(pr=n,n=r):n=o,e=n!==r?t.substring(e,pr):n}return e}function Xr(){let t,e,n,o;return t=pr,e=nn(),e!==r?(n=Tr(),n!==r?(o=on(),o!==r?t=n:(pr=t,t=r)):(pr=t,t=r)):(pr=t,t=r),t}function tn(){let e,n,o,s;return e=pr,n=cn(),63===t.charCodeAt(pr)?(o=H,pr++):(o=r,0===Ar&&yr(Ee)),o!==r?(s=cn(),dr=e,e=hn.shift()):(pr=e,e=r),e}function en(){let e,n,o,s;return e=pr,n=cn(),123===t.charCodeAt(pr)?(o=P,pr++):(o=r,0===Ar&&yr(ee)),o!==r?(s=cn(),n=[n,o,s],e=n):(pr=e,e=r),e}function rn(){let e,n,o,s;return e=pr,n=cn(),125===t.charCodeAt(pr)?(o=D,pr++):(o=r,0===Ar&&yr(ne)),o!==r?(s=cn(),n=[n,o,s],e=n):(pr=e,e=r),e}function nn(){let e,n,o,s;return e=pr,n=cn(),40===t.charCodeAt(pr)?(o=dt,pr++):(o=r,0===Ar&&yr(Je)),o!==r?(s=cn(),n=[n,o,s],e=n):(pr=e,e=r),e}function on(){let e,n,o,s;return e=pr,n=cn(),41===t.charCodeAt(pr)?(o=gt,pr++):(o=r,0===Ar&&yr(Ke)),o!==r?(s=cn(),n=[n,o,s],e=n):(pr=e,e=r),e}function sn(){let e;return e=t.charAt(pr),Et.test(e)?pr++:(e=r,0===Ar&&yr(Xe)),e}function un(){let e,n,o,s;return Ar++,e=pr,n=cn(),44===t.charCodeAt(pr)?(o=bt,pr++):(o=r,0===Ar&&yr(er)),o!==r?(s=cn(),e=o):(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(tr)),e}function ln(){let e,n,o,s;return Ar++,e=pr,n=cn(),46===t.charCodeAt(pr)?(o=it,pr++):(o=r,0===Ar&&yr(He)),o!==r?(s=cn(),dr=e,e="."):(pr=e,e=r),Ar--,e===r&&(n=r,0===Ar&&yr(rr)),e}function cn(){let e,n,o;for(Ar++,e=pr,n=[],o=t.charAt(pr),xt.test(o)?pr++:(o=r,0===Ar&&yr(nr));o!==r;)n.push(o),o=t.charAt(pr),xt.test(o)?pr++:(o=r,0===Ar&&yr(nr));return e=t.substring(e,pr),Ar--,e}function an(){let e,n,o;if(Ar++,e=pr,n=[],o=t.charAt(pr),xt.test(o)?pr++:(o=r,0===Ar&&yr(nr)),o!==r)for(;o!==r;)n.push(o),o=t.charAt(pr),xt.test(o)?pr++:(o=r,0===Ar&&yr(nr));else n=r;return e=n!==r?t.substring(e,pr):n,Ar--,e===r&&(n=r,0===Ar&&yr(rr)),e}const fn=[],hn=e.args;let pn=0;const dn=!hn?.length||!e.startRule&&peg$parse.late_binding?()=>fn[pn++]=gn:()=>fn[pn]=fluent.expr(hn[pn++]),gn={ref:["?"],param:!0};br=s();const bn=br!==r&&pr===t.length;function Cn(){throw br!==r&&pr<t.length&&yr({type:"end"}),Sr(wr,Cr<t.length?function(e=pr){const r=t.codePointAt(e);return void 0===r?"":String.fromCodePoint(r)}(Cr):null,Cr<t.length?vr(Cr,Cr+1):vr(Cr,Cr))}return e.peg$library?{peg$result:br,peg$currPos:pr,peg$FAILED:r,peg$maxFailExpected:wr,peg$maxFailPos:Cr,peg$success:bn,peg$throw:bn?void 0:Cn}:bn?br:void Cn()}const peg$allowedStartRules=["CQL","subject","columns","values","ref","val","expr","changes","where","groupBy","orderBy"];export{peg$allowedStartRules as StartRules,peg$SyntaxError as SyntaxError,peg$parse as parse};
|
package/lib/index.js
CHANGED
|
@@ -32,12 +32,14 @@ import { INSERT as INSERT_ } from './ql/insert.js'
|
|
|
32
32
|
import { UPSERT as UPSERT_ } from './ql/insert.js'
|
|
33
33
|
import { UPDATE as UPDATE_ } from './ql/update.js'
|
|
34
34
|
import { DELETE as DELETE_ } from './ql/delete.js'
|
|
35
|
+
import { CALL as CALL_ } from './ql/call-action.js'
|
|
35
36
|
|
|
36
37
|
export const SELECT = chimera (SELECT_, SELECT_.columns)
|
|
37
38
|
export const INSERT = chimera (INSERT_, INSERT_.entries)
|
|
38
39
|
export const UPSERT = chimera (UPSERT_, UPSERT_.entries)
|
|
39
40
|
export const UPDATE = chimera (UPDATE_, UPDATE_.entity)
|
|
40
41
|
export const DELETE = chimera (DELETE_, DELETE_.from)
|
|
42
|
+
export const CALL = chimera (CALL_, CALL_.action)
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Turns subclasses of Query into fluent APIs that allow constructing instances with `new`
|
package/lib/ql/update.js
CHANGED
|
@@ -5,7 +5,7 @@ export class UPDATE extends Query { UPDATE = {}
|
|
|
5
5
|
static entity (...args) { return (new this)._set('entity', subject (...args)) }
|
|
6
6
|
where (...args) { return this._add ('where', where (...args)) }
|
|
7
7
|
with (...args) {
|
|
8
|
-
if (args[0]?.raw) Object.assign (this._, ttl('
|
|
8
|
+
if (args[0]?.raw) Object.assign (this._, ttl('changes',...args))
|
|
9
9
|
else this._set('data', args[0])
|
|
10
10
|
return this
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap.core/ql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Minimalistic implementation of cds.ql, carved out from CAP.",
|
|
5
5
|
"repository": "https://github.com/cap-js/ql.git",
|
|
6
6
|
"author": "daniel.hutzel@sap.com",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@types/cap.core__ql": "file:./@types"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"peggy": "npx peggy cql/grammar.pegjs -o cql/parser.js --format es --allowed-start-rules CQL,subject,columns,values,ref,val,expr,
|
|
18
|
+
"peggy": "npx peggy cql/grammar.pegjs -o cql/parser.js --format es --allowed-start-rules CQL,subject,columns,values,ref,val,expr,changes,where,groupBy,orderBy",
|
|
19
19
|
"terser": "npx terser cql/parser.js -o cql/parser.min.js --compress --mangle --ecma 2022 --source-map",
|
|
20
20
|
"build": "npm run peggy && npm run terser",
|
|
21
21
|
"test": "npx vitest run"
|