UNPKG

@openobserve/node-sql-parser

Version:
1 lines 181 kB
!function(r,t){for(var e in t)r[e]=t[e]}(exports,function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=1)}([function(r,t,e){"use strict";var n=e(2);function o(r,t,e,n){this.message=r,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,o)}!function(r,t){function e(){this.constructor=r}e.prototype=t.prototype,r.prototype=new e}(o,Error),o.buildMessage=function(r,t){var e={literal:function(r){return'"'+o(r.text)+'"'},class:function(r){var t,e="";for(t=0;t<r.parts.length;t++)e+=r.parts[t]instanceof Array?u(r.parts[t][0])+"-"+u(r.parts[t][1]):u(r.parts[t]);return"["+(r.inverted?"^":"")+e+"]"},any:function(r){return"any character"},end:function(r){return"end of input"},other:function(r){return r.description}};function n(r){return r.charCodeAt(0).toString(16).toUpperCase()}function o(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(r){return"\\x0"+n(r)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(r){return"\\x"+n(r)}))}function u(r){return r.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,(function(r){return"\\x0"+n(r)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(r){return"\\x"+n(r)}))}return"Expected "+function(r){var t,n,o,u=new Array(r.length);for(t=0;t<r.length;t++)u[t]=(o=r[t],e[o.type](o));if(u.sort(),u.length>0){for(t=1,n=1;t<u.length;t++)u[t-1]!==u[t]&&(u[n]=u[t],n++);u.length=n}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}(r)+" but "+function(r){return r?'"'+o(r)+'"':"end of input"}(t)+" found."},r.exports={SyntaxError:o,parse:function(r,t){t=void 0!==t?t:{};var e,u={},a={start:Zo},s=Zo,i=function(r,t){return Ji(r,t,1)},c=Yo("IF",!0),l=function(r,t){return Ji(r,t)},f=Yo("AUTO_INCREMENT",!0),p=Yo("UNIQUE",!0),v=Yo("KEY",!0),b=Yo("PRIMARY",!0),d=Yo("COLUMN_FORMAT",!0),y=Yo("FIXED",!0),h=Yo("DYNAMIC",!0),m=Yo("DEFAULT",!0),w=Yo("STORAGE",!0),L=Yo("DISK",!0),C=Yo("MEMORY",!0),E=Yo("ALGORITHM",!0),A=Yo("INSTANT",!0),g=Yo("INPLACE",!0),j=Yo("COPY",!0),S=Yo("LOCK",!0),T=Yo("NONE",!0),_=Yo("SHARED",!0),x=Yo("EXCLUSIVE",!0),I=Yo("PRIMARY KEY",!0),k=Yo("FOREIGN KEY",!0),N=Yo("MATCH FULL",!0),R=Yo("MATCH PARTIAL",!0),O=Yo("MATCH SIMPLE",!0),U=Yo("RESTRICT",!0),M=Yo("CASCADE",!0),D=Yo("SET NULL",!0),P=Yo("NO ACTION",!0),F=Yo("SET DEFAULT",!0),H=Yo("CHARACTER",!0),$=Yo("SET",!0),W=Yo("CHARSET",!0),q=Yo("COLLATE",!0),B=Yo("AVG_ROW_LENGTH",!0),G=Yo("KEY_BLOCK_SIZE",!0),Y=Yo("MAX_ROWS",!0),V=Yo("MIN_ROWS",!0),Q=Yo("STATS_SAMPLE_PAGES",!0),X=Yo("CONNECTION",!0),K=Yo("COMPRESSION",!0),z=Yo("'",!1),Z=Yo("ZLIB",!0),J=Yo("LZ4",!0),rr=Yo("ENGINE",!0),tr=Yo("READ",!0),er=Yo("LOCAL",!0),nr=Yo("LOW_PRIORITY",!0),or=Yo("WRITE",!0),ur=function(r,t){return Ji(r,t)},ar=Yo("(",!1),sr=Yo(")",!1),ir=Yo(".",!1),cr=Yo("UNNEST",!0),lr=Yo("BTREE",!0),fr=Yo("HASH",!0),pr=Yo("WITH",!0),vr=Yo("PARSER",!0),br=Yo("VISIBLE",!0),dr=Yo("INVISIBLE",!0),yr=function(r,t){return t.unshift(r),t.forEach(r=>{const{table:t,as:e}=r;ac[t]=t,e&&(ac[e]=t),function(r){const t=ec(r);r.clear(),t.forEach(t=>r.add(t))}(uc)}),t},hr=Yo("FOLLOWING",!0),mr=Yo("PRECEDING",!0),wr=Yo("CURRENT",!0),Lr=Yo("ROW",!0),Cr=Yo("UNBOUNDED",!0),Er=Yo("=",!1),Ar=function(r,t){return rc(r,t)},gr=Yo("!",!1),jr=function(r){return r[0]+" "+r[2]},Sr=Yo(">=",!1),Tr=Yo(">",!1),_r=Yo("<=",!1),xr=Yo("<>",!1),Ir=Yo("<",!1),kr=Yo("==",!1),Nr=Yo("!=",!1),Rr=function(r,t){return{op:r,right:t}},Or=Yo("+",!1),Ur=Yo("-",!1),Mr=Yo("*",!1),Dr=Yo("/",!1),Pr=Yo("%",!1),Fr=Yo("~",!1),Hr=function(r){return!0===Qi[r.toUpperCase()]},$r=Yo('"',!1),Wr=/^[^"]/,qr=Vo(['"'],!0,!1),Br=/^[^']/,Gr=Vo(["'"],!0,!1),Yr=Yo("`",!1),Vr=/^[^`]/,Qr=Vo(["`"],!0,!1),Xr=function(r,t){return r+t.join("")},Kr=/^[A-Za-z_]/,zr=Vo([["A","Z"],["a","z"],"_"],!1,!1),Zr=/^[A-Za-z0-9_]/,Jr=Vo([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),rt=/^[A-Za-z0-9_:]/,tt=Vo([["A","Z"],["a","z"],["0","9"],"_",":"],!1,!1),et=Yo(":",!1),nt=Yo("OVER",!0),ot=Yo("AT TIME ZONE",!0),ut=Yo("CENTURY",!0),at=Yo("DAY",!0),st=Yo("DATE",!0),it=Yo("DECADE",!0),ct=Yo("DOW",!0),lt=Yo("DOY",!0),ft=Yo("EPOCH",!0),pt=Yo("HOUR",!0),vt=Yo("ISODOW",!0),bt=Yo("ISOYEAR",!0),dt=Yo("MICROSECONDS",!0),yt=Yo("MILLENNIUM",!0),ht=Yo("MILLISECONDS",!0),mt=Yo("MINUTE",!0),wt=Yo("MONTH",!0),Lt=Yo("QUARTER",!0),Ct=Yo("SECOND",!0),Et=Yo("TIMEZONE",!0),At=Yo("TIMEZONE_HOUR",!0),gt=Yo("TIMEZONE_MINUTE",!0),jt=Yo("WEEK",!0),St=Yo("YEAR",!0),Tt=function(r,t){return{type:r.toLowerCase(),value:t[1].join("")}},_t=/^[^"\\\0-\x1F\x7F]/,xt=Vo(['"',"\\",["\0",""],""],!0,!1),It=/^[^'\\]/,kt=Vo(["'","\\"],!0,!1),Nt=Yo("\\'",!1),Rt=Yo('\\"',!1),Ot=Yo("\\\\",!1),Ut=Yo("\\/",!1),Mt=Yo("\\b",!1),Dt=Yo("\\f",!1),Pt=Yo("\\n",!1),Ft=Yo("\\r",!1),Ht=Yo("\\t",!1),$t=Yo("\\u",!1),Wt=Yo("\\",!1),qt=Yo("''",!1),Bt=Yo('""',!1),Gt=Yo("``",!1),Yt=/^[\n\r]/,Vt=Vo(["\n","\r"],!1,!1),Qt=/^[0-9]/,Xt=Vo([["0","9"]],!1,!1),Kt=/^[0-9a-fA-F]/,zt=Vo([["0","9"],["a","f"],["A","F"]],!1,!1),Zt=/^[eE]/,Jt=Vo(["e","E"],!1,!1),re=/^[+\-]/,te=Vo(["+","-"],!1,!1),ee=Yo("NULL",!0),ne=Yo("NOT NULL",!0),oe=Yo("TRUE",!0),ue=Yo("TO",!0),ae=Yo("FALSE",!0),se=(Yo("SHOW",!0),Yo("DROP",!0)),ie=Yo("USE",!0),ce=Yo("ALTER",!0),le=Yo("SELECT",!0),fe=Yo("UPDATE",!0),pe=Yo("CREATE",!0),ve=Yo("TEMPORARY",!0),be=Yo("DELETE",!0),de=Yo("INSERT",!0),ye=Yo("RECURSIVE",!1),he=Yo("REPLACE",!0),me=Yo("RENAME",!0),we=Yo("IGNORE",!0),Le=(Yo("EXPLAIN",!0),Yo("PARTITION",!0)),Ce=Yo("INTO",!0),Ee=Yo("OVERWRITE",!0),Ae=Yo("FROM",!0),ge=Yo("UNLOCK",!0),je=Yo("AS",!0),Se=Yo("TABLE",!0),Te=Yo("TABLES",!0),_e=Yo("DATABASE",!0),xe=Yo("SCHEMA",!0),Ie=Yo("ON",!0),ke=Yo("LEFT",!0),Ne=Yo("RIGHT",!0),Re=Yo("FULL",!0),Oe=Yo("CROSS",!0),Ue=Yo("INNER",!0),Me=Yo("JOIN",!0),De=Yo("OUTER",!0),Pe=Yo("UNION",!0),Fe=Yo("VALUES",!0),He=Yo("USING",!0),$e=Yo("WHERE",!0),We=Yo("GROUP",!0),qe=Yo("BY",!0),Be=Yo("ORDER",!0),Ge=Yo("HAVING",!0),Ye=Yo("LIMIT",!0),Ve=Yo("OFFSET",!0),Qe=Yo("ASC",!0),Xe=Yo("DESC",!0),Ke=Yo("ALL",!0),ze=Yo("DISTINCT",!0),Ze=Yo("BETWEEN",!0),Je=Yo("IN",!0),rn=Yo("IS",!0),tn=Yo("LIKE",!0),en=Yo("RLIKE",!0),nn=Yo("EXISTS",!0),on=Yo("NOT",!0),un=Yo("AND",!0),an=Yo("OR",!0),sn=Yo("COUNT",!0),cn=Yo("MAX",!0),ln=Yo("MIN",!0),fn=Yo("SUM",!0),pn=Yo("AVG",!0),vn=Yo("EXTRACT",!0),bn=Yo("CALL",!0),dn=Yo("CASE",!0),yn=Yo("WHEN",!0),hn=Yo("THEN",!0),mn=Yo("ELSE",!0),wn=Yo("END",!0),Ln=Yo("CAST",!0),Cn=Yo("ARRAY",!0),En=Yo("CHAR",!0),An=Yo("VARCHAR",!0),gn=Yo("NUMERIC",!0),jn=Yo("DECIMAL",!0),Sn=Yo("SIGNED",!0),Tn=Yo("STRING",!0),_n=Yo("UNSIGNED",!0),xn=Yo("INT",!0),In=Yo("ZEROFILL",!0),kn=Yo("INTEGER",!0),Nn=Yo("JSON",!0),Rn=Yo("SMALLINT",!0),On=Yo("TINYINT",!0),Un=Yo("TINYTEXT",!0),Mn=Yo("TEXT",!0),Dn=Yo("MEDIUMTEXT",!0),Pn=Yo("LONGTEXT",!0),Fn=Yo("BIGINT",!0),Hn=Yo("FLOAT",!0),$n=Yo("DOUBLE",!0),Wn=Yo("DATETIME",!0),qn=Yo("ROWS",!0),Bn=Yo("TIME",!0),Gn=Yo("TIMESTAMP",!0),Yn=Yo("TRUNCATE",!0),Vn=Yo("USER",!0),Qn=Yo("CURRENT_DATE",!0),Xn=(Yo("ADDDATE",!0),Yo("INTERVAL",!0)),Kn=Yo("CURRENT_TIME",!0),zn=Yo("CURRENT_TIMESTAMP",!0),Zn=Yo("CURRENT_USER",!0),Jn=Yo("SESSION_USER",!0),ro=Yo("SYSTEM_USER",!0),to=Yo("GLOBAL",!0),eo=Yo("SESSION",!0),no=Yo("PERSIST",!0),oo=Yo("PERSIST_ONLY",!0),uo=Yo("@",!1),ao=Yo("@@",!1),so=Yo("$",!1),io=Yo("return",!0),co=Yo(":=",!1),lo=Yo("DUAL",!0),fo=Yo("ADD",!0),po=Yo("COLUMN",!0),vo=Yo("INDEX",!0),bo=Yo("FULLTEXT",!0),yo=Yo("SPATIAL",!0),ho=Yo("COMMENT",!0),mo=Yo("CONSTRAINT",!0),wo=Yo("REFERENCES",!0),Lo=Yo("SQL_CALC_FOUND_ROWS",!0),Co=Yo("SQL_CACHE",!0),Eo=Yo("SQL_NO_CACHE",!0),Ao=Yo("SQL_SMALL_RESULT",!0),go=Yo("SQL_BIG_RESULT",!0),jo=Yo("SQL_BUFFER_RESULT",!0),So=Yo(",",!1),To=Yo("[",!1),_o=Yo("]",!1),xo=Yo(";",!1),Io=Yo("||",!1),ko=Yo("&&",!1),No=Yo("/*",!1),Ro=Yo("*/",!1),Oo=Yo("--",!1),Uo=Yo("#",!1),Mo={type:"any"},Do=/^[ \t\n\r]/,Po=Vo([" ","\t","\n","\r"],!1,!1),Fo=function(r){return{dataType:r}},Ho=0,$o=0,Wo=[{line:1,column:1}],qo=0,Bo=[],Go=0;if("startRule"in t){if(!(t.startRule in a))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=a[t.startRule]}function Yo(r,t){return{type:"literal",text:r,ignoreCase:t}}function Vo(r,t,e){return{type:"class",parts:r,inverted:t,ignoreCase:e}}function Qo(t){var e,n=Wo[t];if(n)return n;for(e=t-1;!Wo[e];)e--;for(n={line:(n=Wo[e]).line,column:n.column};e<t;)10===r.charCodeAt(e)?(n.line++,n.column=1):n.column++,e++;return Wo[t]=n,n}function Xo(r,t){var e=Qo(r),n=Qo(t);return{start:{offset:r,line:e.line,column:e.column},end:{offset:t,line:n.line,column:n.column}}}function Ko(r){Ho<qo||(Ho>qo&&(qo=Ho,Bo=[]),Bo.push(r))}function zo(r,t,e){return new o(o.buildMessage(r,t),r,t,e)}function Zo(){var r,t;return r=Ho,Si()!==u&&(t=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=ru())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=gi())!==u&&(s=Si())!==u&&(i=ru())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=gi())!==u&&(s=Si())!==u&&(i=ru())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=function(r,t){const e=r&&r.ast||r,n=t&&t.length&&t[0].length>=4?[e]:e;for(let r=0;r<t.length;r++)t[r][3]&&0!==t[r][3].length&&n.push(t[r][3]&&t[r][3].ast||t[r][3]);return{tableList:Array.from(oc),columnList:ec(uc),ast:n}}(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u?($o=r,r=t):(Ho=r,r=u),r}function Jo(){var t;return(t=function(){var r,t,e,n,o,a;r=Ho,(t=as())!==u&&Si()!==u&&(e=ms())!==u&&Si()!==u&&(n=Mu())!==u?($o=r,s=t,c=e,(l=n)&&l.forEach(r=>oc.add(`${s}::${r.db}::${r.table}`)),t={tableList:Array.from(oc),columnList:ec(uc),ast:{type:s.toLowerCase(),keyword:c.toLowerCase(),name:l}},r=t):(Ho=r,r=u);var s,c,l;r===u&&(r=Ho,(t=as())!==u&&Si()!==u&&(e=bi())!==u&&Si()!==u&&(n=ga())!==u&&Si()!==u&&Cs()!==u&&Si()!==u&&(o=Hu())!==u&&Si()!==u?((a=function(){var r,t,e,n,o,a;r=Ho,(t=iu())===u&&(t=cu());if(t!==u){for(e=[],n=Ho,(o=Si())!==u?((a=iu())===u&&(a=cu()),a!==u?n=o=[o,a]:(Ho=n,n=u)):(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u?((a=iu())===u&&(a=cu()),a!==u?n=o=[o,a]:(Ho=n,n=u)):(Ho=n,n=u);e!==u?($o=r,t=i(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())===u&&(a=null),a!==u&&Si()!==u?($o=r,t=function(r,t,e,n,o){return{tableList:Array.from(oc),columnList:ec(uc),ast:{type:r.toLowerCase(),keyword:t.toLowerCase(),name:e,table:n,options:o}}}(t,e,n,o,a),r=t):(Ho=r,r=u)):(Ho=r,r=u));return r}())===u&&(t=function(){var t;(t=function(){var t,e,n,o,a,s,i,c,f,p;t=Ho,(e=is())!==u&&Si()!==u?((n=cs())===u&&(n=null),n!==u&&Si()!==u&&ms()!==u&&Si()!==u?((o=nu())===u&&(o=null),o!==u&&Si()!==u&&(a=Mu())!==u&&Si()!==u&&(s=function(){var r,t,e,n,o,a,s,i,c;if(r=Ho,(t=Li())!==u)if(Si()!==u)if((e=ou())!==u){for(n=[],o=Ho,(a=Si())!==u&&(s=mi())!==u&&(i=Si())!==u&&(c=ou())!==u?o=a=[a,s,i,c]:(Ho=o,o=u);o!==u;)n.push(o),o=Ho,(a=Si())!==u&&(s=mi())!==u&&(i=Si())!==u&&(c=ou())!==u?o=a=[a,s,i,c]:(Ho=o,o=u);n!==u&&(o=Si())!==u&&(a=Ci())!==u?($o=r,t=l(e,n),r=t):(Ho=r,r=u)}else Ho=r,r=u;else Ho=r,r=u;else Ho=r,r=u;return r}())!==u&&Si()!==u?((i=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=yu())!==u){for(e=[],n=Ho,(o=Si())!==u?((a=mi())===u&&(a=null),a!==u&&(s=Si())!==u&&(i=yu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u)):(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u?((a=mi())===u&&(a=null),a!==u&&(s=Si())!==u&&(i=yu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u)):(Ho=n,n=u);e!==u?($o=r,t=Ji(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())===u&&(i=null),i!==u&&Si()!==u?((c=function(){var t,e,n,o;t=Ho,"ignore"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(we));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(c=fs()),c===u&&(c=null),c!==u&&Si()!==u?((f=hs())===u&&(f=null),f!==u&&Si()!==u?((p=eu())===u&&(p=null),p!==u?($o=t,v=e,b=n,d=o,h=s,m=i,w=c,L=f,C=p,(y=a)&&y.forEach(r=>oc.add(`create::${r.db}::${r.table}`)),e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:v[0].toLowerCase(),keyword:"table",temporary:b&&b[0].toLowerCase(),if_not_exists:d,table:y,ignore_replace:w&&w[0].toLowerCase(),as:L&&L[0].toLowerCase(),query_expr:C&&C.ast,create_definitions:h,table_options:m}},t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);var v,b,d,y,h,m,w,L,C;t===u&&(t=Ho,(e=is())!==u&&Si()!==u?((n=cs())===u&&(n=null),n!==u&&Si()!==u&&ms()!==u&&Si()!==u?((o=nu())===u&&(o=null),o!==u&&Si()!==u&&(a=Mu())!==u&&Si()!==u&&(s=function r(){var t,e;(t=function(){var r,t;r=Ho,Os()!==u&&Si()!==u&&(t=Mu())!==u?($o=r,r={type:"like",table:t}):(Ho=r,r=u);return r}())===u&&(t=Ho,Li()!==u&&Si()!==u&&(e=r())!==u&&Si()!==u&&Ci()!==u?($o=t,(n=e).parentheses=!0,t=n):(Ho=t,t=u));var n;return t}())!==u?($o=t,e=function(r,t,e,n,o){return n&&n.forEach(r=>oc.add(`create::${r.db}::${r.table}`)),{tableList:Array.from(oc),columnList:ec(uc),ast:{type:r[0].toLowerCase(),keyword:"table",temporary:t&&t[0].toLowerCase(),if_not_exists:e,table:n,like:o}}}(e,n,o,a,s),t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u));return t}())===u&&(t=function(){var t,e,n,o,a,s;t=Ho,(e=is())!==u&&Si()!==u?((n=function(){var t,e,n,o;t=Ho,"database"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(_e));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="DATABASE"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(n=function(){var t,e,n,o;t=Ho,"schema"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(xe));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="SCHEMA"):(Ho=t,t=u)):(Ho=t,t=u);return t}()),n!==u&&Si()!==u?((o=nu())===u&&(o=null),o!==u&&Si()!==u&&(a=Fi())!==u&&Si()!==u?((s=function(){var r,t,e,n,o,a;if(r=Ho,(t=du())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=du())!==u?n=o=[o,a]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=du())!==u?n=o=[o,a]:(Ho=n,n=u);e!==u?($o=r,t=i(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())===u&&(s=null),s!==u?($o=t,e=function(r,t,e,n,o){const u=t.toLowerCase();return{tableList:Array.from(oc),columnList:ec(uc),ast:{type:r[0].toLowerCase(),keyword:u,if_not_exists:e,[u]:{db:n.schema,schema:n.name},create_definitions:o}}}(e,n,o,a,s),t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);return t}());return t}())===u&&(t=function(){var t,e,n,o;t=Ho,(e=function(){var t,e,n,o;t=Ho,"truncate"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(Yn));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="TRUNCATE"):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u?((n=ms())===u&&(n=null),n!==u&&Si()!==u&&(o=Mu())!==u?($o=t,a=e,s=n,(i=o)&&i.forEach(r=>oc.add(`${a}::${r.db}::${r.table}`)),e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:a.toLowerCase(),keyword:s&&s.toLowerCase()||"table",name:i}},t=e):(Ho=t,t=u)):(Ho=t,t=u);var a,s,i;return t}())===u&&(t=function(){var r,t,e;r=Ho,(t=ps())!==u&&Si()!==u&&ms()!==u&&Si()!==u&&(e=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=Nu())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Nu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Nu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=l(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u?($o=r,(n=e).forEach(r=>r.forEach(r=>r.table&&oc.add(`rename::${r.db}::${r.table}`))),t={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"rename",table:n}},r=t):(Ho=r,r=u);var n;return r}())===u&&(t=function(){var t,e,n;t=Ho,(e=function(){var t,e,n,o;t=Ho,"call"===r.substr(Ho,4).toLowerCase()?(e=r.substr(Ho,4),Ho+=4):(e=u,0===Go&&Ko(bn));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="CALL"):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&(n=Hi())!==u?($o=t,o=n,e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"call",expr:o},...Xi()},t=e):(Ho=t,t=u);var o;return t}())===u&&(t=function(){var t,e,n;t=Ho,(e=function(){var t,e,n,o;t=Ho,"use"===r.substr(Ho,3).toLowerCase()?(e=r.substr(Ho,3),Ho+=3):(e=u,0===Go&&Ko(ie));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&(n=Sa())!==u?($o=t,o=n,oc.add(`use::${o}::null`),e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"use",db:o}},t=e):(Ho=t,t=u);var o;return t}())===u&&(t=function(){var t,e,n,o;t=Ho,(e=function(){var t,e,n,o;t=Ho,"alter"===r.substr(Ho,5).toLowerCase()?(e=r.substr(Ho,5),Ho+=5):(e=u,0===Go&&Ko(ce));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&ms()!==u&&Si()!==u&&(n=Mu())!==u&&Si()!==u&&(o=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=su())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=su())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=su())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=l(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u?($o=t,s=o,(a=n)&&a.length>0&&a.forEach(r=>oc.add(`alter::${r.db}::${r.table}`)),e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"alter",table:a,expr:s}},t=e):(Ho=t,t=u);var a,s;return t}())===u&&(t=function(){var t,e,n,o;t=Ho,(e=ys())!==u&&Si()!==u?((n=function(){var t,e,n,o;t=Ho,"global"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(to));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="GLOBAL"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(n=function(){var t,e,n,o;t=Ho,"session"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(eo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="SESSION"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(n=function(){var t,e,n,o;t=Ho,"local"===r.substr(Ho,5).toLowerCase()?(e=r.substr(Ho,5),Ho+=5):(e=u,0===Go&&Ko(er));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="LOCAL"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(n=function(){var t,e,n,o;t=Ho,"persist"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(no));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="PERSIST"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(n=function(){var t,e,n,o;t=Ho,"persist_only"===r.substr(Ho,12).toLowerCase()?(e=r.substr(Ho,12),Ho+=12):(e=u,0===Go&&Ko(oo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="PERSIST_ONLY"):(Ho=t,t=u)):(Ho=t,t=u);return t}()),n===u&&(n=null),n!==u&&Si()!==u&&(o=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=Oi())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Oi())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Oi())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=ur(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u?($o=t,a=n,(s=o).keyword=a,e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"set",keyword:a,expr:s}},t=e):(Ho=t,t=u)):(Ho=t,t=u);var a,s;return t}())===u&&(t=function(){var t,e,n;t=Ho,(e=function(){var t,e,n,o;t=Ho,"lock"===r.substr(Ho,4).toLowerCase()?(e=r.substr(Ho,4),Ho+=4):(e=u,0===Go&&Ko(S));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&ws()!==u&&Si()!==u&&(n=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=hu())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=hu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=hu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=ur(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u?($o=t,o=n,e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"lock",keyword:"tables",tables:o}},t=e):(Ho=t,t=u);var o;return t}())===u&&(t=function(){var t,e;t=Ho,(e=function(){var t,e,n,o;t=Ho,"unlock"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(ge));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&ws()!==u?($o=t,e={tableList:Array.from(oc),columnList:ec(uc),ast:{type:"unlock",keyword:"tables"}},t=e):(Ho=t,t=u);return t}()),t}function ru(){var t;return(t=eu())===u&&(t=function(){var r,t,e,n,o;r=Ho,(t=ss())!==u&&Si()!==u&&(e=Mu())!==u&&Si()!==u&&ys()!==u&&Si()!==u&&(n=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=ra())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=ra())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=ra())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=l(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u&&Si()!==u?((o=qu())===u&&(o=null),o!==u?($o=r,t=function(r,t,e){const n={};return r&&r.forEach(r=>{const{db:t,as:e,table:o,join:u}=r,a=u?"select":"update";t&&(n[o]=t),o&&oc.add(`${a}::${t}::${o}`)}),t&&t.forEach(r=>{if(r.table){const t=tc(r.table);oc.add(`update::${n[t]||null}::${t}`)}uc.add(`update::${r.table}::${r.column}`)}),{tableList:Array.from(oc),columnList:ec(uc),ast:{type:"update",table:r,set:t,where:e}}}(e,n,o),r=t):(Ho=r,r=u)):(Ho=r,r=u);return r}())===u&&(t=function(){var r,t,e,n,o,a,s,i;r=Ho,(t=na())!==u&&Si()!==u&&(e=bs())!==u&&Si()!==u?((n=ms())===u&&(n=null),n!==u&&Si()!==u&&(o=Hu())!==u?((a=ea())===u&&(a=null),a!==u&&Si()!==u&&Li()!==u&&Si()!==u&&(s=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=Ra())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Ra())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=Ra())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=l(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u&&Si()!==u&&Ci()!==u&&Si()!==u&&(i=ta())!==u?($o=r,t=function(r,t,e,n,o,u,a){if(n&&(oc.add(`insert::${n.db}::${n.table}`),n.as=null),u){let r=n&&n.table||null;Array.isArray(a)&&a.forEach((r,t)=>{if(r.value.length!=u.length)throw new Error("Error: column count doesn't match value count at row "+(t+1))}),u.forEach(t=>uc.add(`insert::${r}::${t}`))}const s=e?" "+e.toLowerCase():"";return{tableList:Array.from(oc),columnList:ec(uc),ast:{type:r,prefix:`${t.toLowerCase()}${s}`,table:[n],columns:u,values:a,partition:o}}}(t,e,n,o,a,s,i),r=t):(Ho=r,r=u)):(Ho=r,r=u)):(Ho=r,r=u);return r}())===u&&(t=function(){var t,e,n,o,a,s,i;t=Ho,(e=na())!==u&&Si()!==u?((n=bs())===u&&(n=function(){var t,e,n,o;t=Ho,"overwrite"===r.substr(Ho,9).toLowerCase()?(e=r.substr(Ho,9),Ho+=9):(e=u,0===Go&&Ko(Ee));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="OVERWRITE"):(Ho=t,t=u)):(Ho=t,t=u);return t}()),n!==u&&Si()!==u?((o=ms())===u&&(o=null),o!==u&&Si()!==u&&(a=Hu())!==u&&Si()!==u?((s=ea())===u&&(s=null),s!==u&&Si()!==u&&(i=ta())!==u?($o=t,e=function(r,t,e,n,o,u){n&&(oc.add(`insert::${n.db}::${n.table}`),uc.add(`insert::${n.table}::(.*)`),n.as=null);const a=e?" "+e.toLowerCase():"";return{tableList:Array.from(oc),columnList:ec(uc),ast:{type:r,prefix:`${t.toLowerCase()}${a}`,table:[n],columns:null,values:u,partition:o}}}(e,n,o,a,s,i),t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(t=function(){var r,t,e,n,o;r=Ho,(t=ls())!==u&&Si()!==u?((e=Mu())===u&&(e=null),e!==u&&Si()!==u&&(n=ku())!==u&&Si()!==u?((o=qu())===u&&(o=null),o!==u?($o=r,t=function(r,t,e){if(t&&t.forEach(r=>{const{db:t,as:e,table:n,join:o}=r,u=o?"select":"delete";n&&oc.add(`${u}::${t}::${n}`),o||uc.add(`delete::${n}::(.*)`)}),null===r&&1===t.length){const e=t[0];r=[{db:e.db,table:e.table,as:e.as,addition:!0}]}return{tableList:Array.from(oc),columnList:ec(uc),ast:{type:"delete",table:r,from:t,where:e}}}(e,n,o),r=t):(Ho=r,r=u)):(Ho=r,r=u)):(Ho=r,r=u);return r}())===u&&(t=Jo())===u&&(t=function(){var r,t;r=[],t=Ri();for(;t!==u;)r.push(t),t=Ri();return r}()),t}function tu(){var t,e,n;return t=Ho,function(){var t,e,n,o;t=Ho,"union"===r.substr(Ho,5).toLowerCase()?(e=r.substr(Ho,5),Ho+=5):(e=u,0===Go&&Ko(Pe));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}()!==u&&Si()!==u?((e=xs())===u&&(e=Is()),e===u&&(e=null),e!==u?($o=t,t=(n=e)?"union "+n.toLowerCase():"union"):(Ho=t,t=u)):(Ho=t,t=u),t}function eu(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=mu())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=tu())!==u&&(s=Si())!==u&&(i=mu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=tu())!==u&&(s=Si())!==u&&(i=mu())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u&&(n=Si())!==u?((o=Xu())===u&&(o=null),o!==u&&(a=Si())!==u?((s=Ju())===u&&(s=null),s!==u?($o=r,r=t=function(r,t,e,n){t.forEach(r=>r.slice(1,1));let o=r;for(let r=0;r<t.length;r++)o._next=t[r][3],o.set_op=t[r][1],o=o._next;return e&&(r._orderby=e),n&&(r._limit=n),{tableList:Array.from(oc),columnList:ec(uc),ast:r}}(t,e,o,s)):(Ho=r,r=u)):(Ho=r,r=u)):(Ho=r,r=u)}else Ho=r,r=u;return r}function nu(){var t,e;return t=Ho,"if"===r.substr(Ho,2).toLowerCase()?(e=r.substr(Ho,2),Ho+=2):(e=u,0===Go&&Ko(c)),e!==u&&Si()!==u&&Ds()!==u&&Si()!==u&&Ms()!==u?($o=t,t=e="IF NOT EXISTS"):(Ho=t,t=u),t}function ou(){var t;return(t=au())===u&&(t=lu())===u&&(t=fu())===u&&(t=function(){var t;(t=function(){var t,e,n,o,a,s;t=Ho,(e=pu())===u&&(e=null);e!==u&&Si()!==u?("primary key"===r.substr(Ho,11).toLowerCase()?(n=r.substr(Ho,11),Ho+=11):(n=u,0===Go&&Ko(I)),n!==u&&Si()!==u?((o=Ru())===u&&(o=null),o!==u&&Si()!==u&&(a=Cu())!==u&&Si()!==u?((s=Ou())===u&&(s=null),s!==u?($o=t,c=n,l=o,f=a,p=s,e={constraint:(i=e)&&i.constraint,definition:f,constraint_type:c.toLowerCase(),keyword:i&&i.keyword,index_type:l,resource:"constraint",index_options:p},t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);var i,c,l,f,p;return t}())===u&&(t=function(){var t,e,n,o,a,s,i,c;t=Ho,(e=pu())===u&&(e=null);e!==u&&Si()!==u&&(n=function(){var t,e,n,o;t=Ho,"unique"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(p));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="UNIQUE"):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u?((o=bi())===u&&(o=di()),o===u&&(o=null),o!==u&&Si()!==u?((a=Ra())===u&&(a=null),a!==u&&Si()!==u?((s=Ru())===u&&(s=null),s!==u&&Si()!==u&&(i=Cu())!==u&&Si()!==u?((c=Ou())===u&&(c=null),c!==u?($o=t,f=n,v=o,b=a,d=s,y=i,h=c,e={constraint:(l=e)&&l.constraint,definition:y,constraint_type:v&&`${f.toLowerCase()} ${v.toLowerCase()}`||f.toLowerCase(),keyword:l&&l.keyword,index_type:d,index:b,resource:"constraint",index_options:h},t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);var l,f,v,b,d,y,h;return t}())===u&&(t=function(){var t,e,n,o,a,s;t=Ho,(e=pu())===u&&(e=null);e!==u&&Si()!==u?("foreign key"===r.substr(Ho,11).toLowerCase()?(n=r.substr(Ho,11),Ho+=11):(n=u,0===Go&&Ko(k)),n!==u&&Si()!==u?((o=Ra())===u&&(o=null),o!==u&&Si()!==u&&(a=Cu())!==u&&Si()!==u?((s=vu())===u&&(s=null),s!==u?($o=t,c=n,l=o,f=a,p=s,e={constraint:(i=e)&&i.constraint,definition:f,constraint_type:c,keyword:i&&i.keyword,index:l,resource:"constraint",reference_definition:p},t=e):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u);var i,c,l,f,p;return t}());return t}()),t}function uu(){var t,e,n,o;return t=Ho,(e=function(){var t,e;t=Ho,(e=function(){var t,e,n,o;t=Ho,"not null"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(ne));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&($o=t,e={type:"not null",value:"not null"});return t=e}())===u&&(e=Ya()),e!==u&&($o=t,(o=e)&&!o.value&&(o.value="null"),e={nullable:o}),(t=e)===u&&(t=Ho,(e=function(){var r,t;r=Ho,os()!==u&&Si()!==u&&(t=fa())!==u?($o=r,r={type:"default",value:t}):(Ho=r,r=u);return r}())!==u&&($o=t,e={default_val:e}),(t=e)===u&&(t=Ho,"auto_increment"===r.substr(Ho,14).toLowerCase()?(e=r.substr(Ho,14),Ho+=14):(e=u,0===Go&&Ko(f)),e!==u&&($o=t,e={auto_increment:e.toLowerCase()}),(t=e)===u&&(t=Ho,"unique"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(p)),e!==u&&Si()!==u?("key"===r.substr(Ho,3).toLowerCase()?(n=r.substr(Ho,3),Ho+=3):(n=u,0===Go&&Ko(v)),n===u&&(n=null),n!==u?($o=t,t=e=function(r){const t=["unique"];return r&&t.push(r),{unique:t.join(" ").toLowerCase("")}}(n)):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,"primary"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(b)),e===u&&(e=null),e!==u&&Si()!==u?("key"===r.substr(Ho,3).toLowerCase()?(n=r.substr(Ho,3),Ho+=3):(n=u,0===Go&&Ko(v)),n!==u?($o=t,t=e=function(r){const t=[];return r&&t.push("primary"),t.push("key"),{primary_key:t.join(" ").toLowerCase("")}}(e)):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,(e=xi())!==u&&($o=t,e={comment:e}),(t=e)===u&&(t=Ho,(e=function(){var r,t,e,n,o;r=Ho,(t=Ls())!==u&&Si()!==u&&(e=Ua())!==u&&Si()!==u&&(n=fi())!==u&&Si()!==u&&(o=Sa())!==u?($o=r,r=t={type:"collate",keyword:"collate",collate:{name:e,symbol:n,value:o}}):(Ho=r,r=u);r===u&&(r=Ho,(t=Ls())!==u&&Si()!==u?((e=fi())===u&&(e=null),e!==u&&Si()!==u&&(n=Sa())!==u?($o=r,t=function(r,t){return{type:"collate",keyword:"collate",collate:{name:t,symbol:r}}}(e,n),r=t):(Ho=r,r=u)):(Ho=r,r=u));return r}())!==u&&($o=t,e={collate:e}),(t=e)===u&&(t=Ho,(e=function(){var t,e,n;t=Ho,"column_format"===r.substr(Ho,13).toLowerCase()?(e=r.substr(Ho,13),Ho+=13):(e=u,0===Go&&Ko(d));e!==u&&Si()!==u?("fixed"===r.substr(Ho,5).toLowerCase()?(n=r.substr(Ho,5),Ho+=5):(n=u,0===Go&&Ko(y)),n===u&&("dynamic"===r.substr(Ho,7).toLowerCase()?(n=r.substr(Ho,7),Ho+=7):(n=u,0===Go&&Ko(h)),n===u&&("default"===r.substr(Ho,7).toLowerCase()?(n=r.substr(Ho,7),Ho+=7):(n=u,0===Go&&Ko(m)))),n!==u?($o=t,e={type:"column_format",value:n.toLowerCase()},t=e):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&($o=t,e={column_format:e}),(t=e)===u&&(t=Ho,(e=function(){var t,e,n;t=Ho,"storage"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(w));e!==u&&Si()!==u?("disk"===r.substr(Ho,4).toLowerCase()?(n=r.substr(Ho,4),Ho+=4):(n=u,0===Go&&Ko(L)),n===u&&("memory"===r.substr(Ho,6).toLowerCase()?(n=r.substr(Ho,6),Ho+=6):(n=u,0===Go&&Ko(C))),n!==u?($o=t,e={type:"storage",value:n.toLowerCase()},t=e):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&($o=t,e={storage:e}),(t=e)===u&&(t=Ho,(e=vu())!==u&&($o=t,e={reference_definition:e}),t=e))))))))),t}function au(){var r,t,e,n,o,a,s;return r=Ho,(t=ga())!==u&&Si()!==u&&(e=Bi())!==u&&Si()!==u?((n=function(){var r,t,e,n,o,a;if(r=Ho,(t=uu())!==u)if(Si()!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=uu())!==u?n=o=[o,a]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=uu())!==u?n=o=[o,a]:(Ho=n,n=u);e!==u?($o=r,r=t=function(r,t){let e=r;for(let r=0;r<t.length;r++)e={...e,...t[r][1]};return e}(t,e)):(Ho=r,r=u)}else Ho=r,r=u;else Ho=r,r=u;return r}())===u&&(n=null),n!==u?($o=r,o=t,a=e,s=n,uc.add(`create::${o.table}::${o.column}`),r=t={column:o,definition:a,resource:"column",...s||{}}):(Ho=r,r=u)):(Ho=r,r=u),r}function su(){var r;return(r=function(){var r,t,e,n;r=Ho,(t=pi())!==u&&Si()!==u?((e=vi())===u&&(e=null),e!==u&&Si()!==u&&(n=au())!==u?($o=r,o=e,a=n,t={action:"add",...a,keyword:o,resource:"column",type:"alter"},r=t):(Ho=r,r=u)):(Ho=r,r=u);var o,a;return r}())===u&&(r=function(){var r,t,e;r=Ho,as()!==u&&Si()!==u?((t=vi())===u&&(t=null),t!==u&&Si()!==u&&(e=ga())!==u?($o=r,r={action:"drop",column:e,keyword:t,resource:"column",type:"alter"}):(Ho=r,r=u)):(Ho=r,r=u);return r}())===u&&(r=function(){var r,t,e;r=Ho,(t=pi())!==u&&Si()!==u&&(e=lu())!==u?($o=r,n=e,t={action:"add",type:"alter",...n},r=t):(Ho=r,r=u);var n;return r}())===u&&(r=function(){var r,t,e;r=Ho,(t=pi())!==u&&Si()!==u&&(e=fu())!==u?($o=r,n=e,t={action:"add",type:"alter",...n},r=t):(Ho=r,r=u);var n;return r}())===u&&(r=function(){var r,t,e,n;r=Ho,(t=ps())!==u&&Si()!==u?((e=us())===u&&(e=hs()),e===u&&(e=null),e!==u&&Si()!==u&&(n=Sa())!==u?($o=r,a=n,t={action:"rename",type:"alter",resource:"table",keyword:(o=e)&&o[0].toLowerCase(),table:a},r=t):(Ho=r,r=u)):(Ho=r,r=u);var o,a;return r}())===u&&(r=iu())===u&&(r=cu()),r}function iu(){var t,e,n,o;return t=Ho,"algorithm"===r.substr(Ho,9).toLowerCase()?(e=r.substr(Ho,9),Ho+=9):(e=u,0===Go&&Ko(E)),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u?("default"===r.substr(Ho,7).toLowerCase()?(o=r.substr(Ho,7),Ho+=7):(o=u,0===Go&&Ko(m)),o===u&&("instant"===r.substr(Ho,7).toLowerCase()?(o=r.substr(Ho,7),Ho+=7):(o=u,0===Go&&Ko(A)),o===u&&("inplace"===r.substr(Ho,7).toLowerCase()?(o=r.substr(Ho,7),Ho+=7):(o=u,0===Go&&Ko(g)),o===u&&("copy"===r.substr(Ho,4).toLowerCase()?(o=r.substr(Ho,4),Ho+=4):(o=u,0===Go&&Ko(j))))),o!==u?($o=t,t=e={type:"alter",keyword:"algorithm",resource:"algorithm",symbol:n,algorithm:o}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function cu(){var t,e,n,o;return t=Ho,"lock"===r.substr(Ho,4).toLowerCase()?(e=r.substr(Ho,4),Ho+=4):(e=u,0===Go&&Ko(S)),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u?("default"===r.substr(Ho,7).toLowerCase()?(o=r.substr(Ho,7),Ho+=7):(o=u,0===Go&&Ko(m)),o===u&&("none"===r.substr(Ho,4).toLowerCase()?(o=r.substr(Ho,4),Ho+=4):(o=u,0===Go&&Ko(T)),o===u&&("shared"===r.substr(Ho,6).toLowerCase()?(o=r.substr(Ho,6),Ho+=6):(o=u,0===Go&&Ko(_)),o===u&&("exclusive"===r.substr(Ho,9).toLowerCase()?(o=r.substr(Ho,9),Ho+=9):(o=u,0===Go&&Ko(x))))),o!==u?($o=t,t=e={type:"alter",keyword:"lock",resource:"lock",symbol:n,lock:o}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function lu(){var r,t,e,n,o,a,s,i;return r=Ho,(t=bi())===u&&(t=di()),t!==u&&Si()!==u?((e=Ra())===u&&(e=null),e!==u&&Si()!==u?((n=Ru())===u&&(n=null),n!==u&&Si()!==u&&(o=Cu())!==u&&Si()!==u?((a=Ou())===u&&(a=null),a!==u&&Si()!==u?($o=r,s=n,i=a,r=t={index:e,definition:o,keyword:t.toLowerCase(),index_type:s,resource:"index",index_options:i}):(Ho=r,r=u)):(Ho=r,r=u)):(Ho=r,r=u)):(Ho=r,r=u),r}function fu(){var t,e,n,o,a,s,i,c,l;return t=Ho,(e=function(){var t,e,n,o;t=Ho,"fulltext"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(bo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="FULLTEXT"):(Ho=t,t=u)):(Ho=t,t=u);return t}())===u&&(e=function(){var t,e,n,o;t=Ho,"spatial"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(yo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="SPATIAL"):(Ho=t,t=u)):(Ho=t,t=u);return t}()),e!==u&&Si()!==u?((n=bi())===u&&(n=di()),n===u&&(n=null),n!==u&&Si()!==u?((o=Ra())===u&&(o=null),o!==u&&Si()!==u&&(a=Cu())!==u&&Si()!==u?((s=Ou())===u&&(s=null),s!==u&&Si()!==u?($o=t,i=e,l=s,t=e={index:o,definition:a,keyword:(c=n)&&`${i.toLowerCase()} ${c.toLowerCase()}`||i.toLowerCase(),index_options:l,resource:"index"}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function pu(){var t,e,n,o;return t=Ho,(e=function(){var t,e,n,o;t=Ho,"constraint"===r.substr(Ho,10).toLowerCase()?(e=r.substr(Ho,10),Ho+=10):(e=u,0===Go&&Ko(mo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="CONSTRAINT"):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u?((n=Sa())===u&&(n=null),n!==u?($o=t,o=n,t=e={keyword:e.toLowerCase(),constraint:o}):(Ho=t,t=u)):(Ho=t,t=u),t}function vu(){var t,e,n,o,a,s,i,c,l,f;return t=Ho,(e=function(){var t,e,n,o;t=Ho,"references"===r.substr(Ho,10).toLowerCase()?(e=r.substr(Ho,10),Ho+=10):(e=u,0===Go&&Ko(wo));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?($o=t,t=e="REFERENCES"):(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&(n=Mu())!==u&&Si()!==u&&(o=Cu())!==u&&Si()!==u?("match full"===r.substr(Ho,10).toLowerCase()?(a=r.substr(Ho,10),Ho+=10):(a=u,0===Go&&Ko(N)),a===u&&("match partial"===r.substr(Ho,13).toLowerCase()?(a=r.substr(Ho,13),Ho+=13):(a=u,0===Go&&Ko(R)),a===u&&("match simple"===r.substr(Ho,12).toLowerCase()?(a=r.substr(Ho,12),Ho+=12):(a=u,0===Go&&Ko(O)))),a===u&&(a=null),a!==u&&Si()!==u?((s=bu())===u&&(s=null),s!==u&&Si()!==u?((i=bu())===u&&(i=null),i!==u?($o=t,c=a,l=s,f=i,t=e={definition:o,table:n,keyword:e.toLowerCase(),match:c&&c.toLowerCase(),on_action:[l,f].filter(r=>r)}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,(e=bu())!==u&&($o=t,e={on_action:[e]}),t=e),t}function bu(){var t,e,n,o;return t=Ho,Cs()!==u&&Si()!==u?((e=ls())===u&&(e=ss()),e!==u&&Si()!==u&&(n=function(){var t,e,n;t=Ho,(e=ci())!==u&&Si()!==u&&Li()!==u&&Si()!==u?((n=ua())===u&&(n=null),n!==u&&Si()!==u&&Ci()!==u?($o=t,t=e={type:"function",name:{name:[{type:"origin",value:e}]},args:n}):(Ho=t,t=u)):(Ho=t,t=u);t===u&&(t=Ho,"restrict"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(U)),e===u&&("cascade"===r.substr(Ho,7).toLowerCase()?(e=r.substr(Ho,7),Ho+=7):(e=u,0===Go&&Ko(M)),e===u&&("set null"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(D)),e===u&&("no action"===r.substr(Ho,9).toLowerCase()?(e=r.substr(Ho,9),Ho+=9):(e=u,0===Go&&Ko(P)),e===u&&("set default"===r.substr(Ho,11).toLowerCase()?(e=r.substr(Ho,11),Ho+=11):(e=u,0===Go&&Ko(F)),e===u&&(e=ci()))))),e!==u&&($o=t,e={type:"origin",value:e.toLowerCase()}),t=e);return t}())!==u?($o=t,o=n,t={type:"on "+e[0].toLowerCase(),value:o}):(Ho=t,t=u)):(Ho=t,t=u),t}function du(){var t,e,n,o,a,s,i,c,l;return t=Ho,(e=os())===u&&(e=null),e!==u&&Si()!==u?((n=function(){var t,e,n;return t=Ho,"character"===r.substr(Ho,9).toLowerCase()?(e=r.substr(Ho,9),Ho+=9):(e=u,0===Go&&Ko(H)),e!==u&&Si()!==u?("set"===r.substr(Ho,3).toLowerCase()?(n=r.substr(Ho,3),Ho+=3):(n=u,0===Go&&Ko($)),n!==u?($o=t,t=e="CHARACTER SET"):(Ho=t,t=u)):(Ho=t,t=u),t}())===u&&("charset"===r.substr(Ho,7).toLowerCase()?(n=r.substr(Ho,7),Ho+=7):(n=u,0===Go&&Ko(W)),n===u&&("collate"===r.substr(Ho,7).toLowerCase()?(n=r.substr(Ho,7),Ho+=7):(n=u,0===Go&&Ko(q)))),n!==u&&Si()!==u?((o=fi())===u&&(o=null),o!==u&&Si()!==u&&(a=ja())!==u?($o=t,i=n,c=o,l=a,t=e={keyword:(s=e)&&`${s[0].toLowerCase()} ${i.toLowerCase()}`||i.toLowerCase(),symbol:c,value:l}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function yu(){var t,e,n,o,a,s,i,c,l;return t=Ho,"auto_increment"===r.substr(Ho,14).toLowerCase()?(e=r.substr(Ho,14),Ho+=14):(e=u,0===Go&&Ko(f)),e===u&&("avg_row_length"===r.substr(Ho,14).toLowerCase()?(e=r.substr(Ho,14),Ho+=14):(e=u,0===Go&&Ko(B)),e===u&&("key_block_size"===r.substr(Ho,14).toLowerCase()?(e=r.substr(Ho,14),Ho+=14):(e=u,0===Go&&Ko(G)),e===u&&("max_rows"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(Y)),e===u&&("min_rows"===r.substr(Ho,8).toLowerCase()?(e=r.substr(Ho,8),Ho+=8):(e=u,0===Go&&Ko(V)),e===u&&("stats_sample_pages"===r.substr(Ho,18).toLowerCase()?(e=r.substr(Ho,18),Ho+=18):(e=u,0===Go&&Ko(Q))))))),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u&&(o=za())!==u?($o=t,c=n,l=o,t=e={keyword:e.toLowerCase(),symbol:c,value:l.value}):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=du())===u&&(t=Ho,(e=yi())===u&&("connection"===r.substr(Ho,10).toLowerCase()?(e=r.substr(Ho,10),Ho+=10):(e=u,0===Go&&Ko(X))),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u&&(o=Va())!==u?($o=t,t=e=function(r,t,e){return{keyword:r.toLowerCase(),symbol:t,value:`'${e.value}'`}}(e,n,o)):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,"compression"===r.substr(Ho,11).toLowerCase()?(e=r.substr(Ho,11),Ho+=11):(e=u,0===Go&&Ko(K)),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u?(o=Ho,39===r.charCodeAt(Ho)?(a="'",Ho++):(a=u,0===Go&&Ko(z)),a!==u?("zlib"===r.substr(Ho,4).toLowerCase()?(s=r.substr(Ho,4),Ho+=4):(s=u,0===Go&&Ko(Z)),s===u&&("lz4"===r.substr(Ho,3).toLowerCase()?(s=r.substr(Ho,3),Ho+=3):(s=u,0===Go&&Ko(J)),s===u&&("none"===r.substr(Ho,4).toLowerCase()?(s=r.substr(Ho,4),Ho+=4):(s=u,0===Go&&Ko(T)))),s!==u?(39===r.charCodeAt(Ho)?(i="'",Ho++):(i=u,0===Go&&Ko(z)),i!==u?o=a=[a,s,i]:(Ho=o,o=u)):(Ho=o,o=u)):(Ho=o,o=u),o!==u?($o=t,t=e=function(r,t,e){return{keyword:r.toLowerCase(),symbol:t,value:e.join("").toUpperCase()}}(e,n,o)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,"engine"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(rr)),e!==u&&Si()!==u?((n=fi())===u&&(n=null),n!==u&&Si()!==u&&(o=Ua())!==u?($o=t,t=e=function(r,t,e){return{keyword:r.toLowerCase(),symbol:t,value:e.toUpperCase()}}(e,n,o)):(Ho=t,t=u)):(Ho=t,t=u)))),t}function hu(){var t,e,n,o,a;return t=Ho,(e=Pu())!==u&&Si()!==u&&(n=function(){var t,e,n;return t=Ho,"read"===r.substr(Ho,4).toLowerCase()?(e=r.substr(Ho,4),Ho+=4):(e=u,0===Go&&Ko(tr)),e!==u&&Si()!==u?("local"===r.substr(Ho,5).toLowerCase()?(n=r.substr(Ho,5),Ho+=5):(n=u,0===Go&&Ko(er)),n===u&&(n=null),n!==u?($o=t,t=e={type:"read",suffix:n&&"local"}):(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=Ho,"low_priority"===r.substr(Ho,12).toLowerCase()?(e=r.substr(Ho,12),Ho+=12):(e=u,0===Go&&Ko(nr)),e===u&&(e=null),e!==u&&Si()!==u?("write"===r.substr(Ho,5).toLowerCase()?(n=r.substr(Ho,5),Ho+=5):(n=u,0===Go&&Ko(or)),n!==u?($o=t,t=e={type:"write",prefix:e&&"low_priority"}):(Ho=t,t=u)):(Ho=t,t=u)),t}())!==u?($o=t,o=e,a=n,oc.add(`lock::${o.db}::${o.table}`),t=e={table:o,lock_type:a}):(Ho=t,t=u),t}function mu(){var t,e,n,o,a,s,i;return(t=Eu())===u&&(t=Ho,e=Ho,40===r.charCodeAt(Ho)?(n="(",Ho++):(n=u,0===Go&&Ko(ar)),n!==u&&(o=Si())!==u&&(a=mu())!==u&&(s=Si())!==u?(41===r.charCodeAt(Ho)?(i=")",Ho++):(i=u,0===Go&&Ko(sr)),i!==u?e=n=[n,o,a,s,i]:(Ho=e,e=u)):(Ho=e,e=u),e!==u&&($o=t,e={...e[2],parentheses_symbol:!0}),t=e),t}function wu(){var t,e,n,o,a,s,i,c,f;if(t=Ho,Ss()!==u)if(Si()!==u)if((e=Lu())!==u){for(n=[],o=Ho,(a=Si())!==u&&(s=mi())!==u&&(i=Si())!==u&&(c=Lu())!==u?o=a=[a,s,i,c]:(Ho=o,o=u);o!==u;)n.push(o),o=Ho,(a=Si())!==u&&(s=mi())!==u&&(i=Si())!==u&&(c=Lu())!==u?o=a=[a,s,i,c]:(Ho=o,o=u);n!==u?($o=t,t=l(e,n)):(Ho=t,t=u)}else Ho=t,t=u;else Ho=t,t=u;else Ho=t,t=u;return t===u&&(t=Ho,Si()!==u&&Ss()!==u&&(e=Si())!==u&&(n=function(){var t,e,n,o;t=Ho,"RECURSIVE"===r.substr(Ho,9)?(e="RECURSIVE",Ho+=9):(e=u,0===Go&&Ko(ye));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&(o=Si())!==u&&(a=Lu())!==u?($o=t,(f=a).recursive=!0,t=[f]):(Ho=t,t=u)),t}function Lu(){var r,t,e,n,o;return r=Ho,(t=Va())===u&&(t=Ua()),t!==u&&Si()!==u?((e=Cu())===u&&(e=null),e!==u&&Si()!==u&&hs()!==u&&Si()!==u&&Li()!==u&&Si()!==u&&(n=eu())!==u&&Si()!==u&&Ci()!==u?($o=r,"string"==typeof(o=t)&&(o={type:"default",value:o}),r=t={name:o,stmt:n,columns:e}):(Ho=r,r=u)):(Ho=r,r=u),r}function Cu(){var r,t;return r=Ho,Li()!==u&&Si()!==u&&(t=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=ga())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=ga())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=ga())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,t=l(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u&&Si()!==u&&Ci()!==u?($o=r,r=t):(Ho=r,r=u),r}function Eu(){var t,e,n,o,a,s,i,c,l,f,p,v,b,d,y,h,m,w,L,C,E;return t=Ho,Si()!==u?((e=wu())===u&&(e=null),e!==u&&Si()!==u&&function(){var t,e,n,o;t=Ho,"select"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(le));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}()!==u&&Ti()!==u?((n=function(){var r,t,e,n,o,a;if(r=Ho,(t=Au())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=Au())!==u?n=o=[o,a]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=Au())!==u?n=o=[o,a]:(Ho=n,n=u);e!==u?($o=r,t=function(r,t){const e=[r];for(let r=0,n=t.length;r<n;++r)e.push(t[r][1]);return e}(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())===u&&(n=null),n!==u&&Si()!==u?((o=Is())===u&&(o=null),o!==u&&Si()!==u&&(a=gu())!==u&&Si()!==u?((s=ku())===u&&(s=null),s!==u&&Si()!==u?((i=qu())===u&&(i=null),i!==u&&Si()!==u?((c=function(){var t,e,n;t=Ho,(e=function(){var t,e,n,o;t=Ho,"group"===r.substr(Ho,5).toLowerCase()?(e=r.substr(Ho,5),Ho+=5):(e=u,0===Go&&Ko(We));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}())!==u&&Si()!==u&&Ts()!==u&&Si()!==u&&(n=ua())!==u?($o=t,e={columns:n.value},t=e):(Ho=t,t=u);return t}())===u&&(c=null),c!==u&&Si()!==u?((l=function(){var t,e;t=Ho,function(){var t,e,n,o;t=Ho,"having"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(Ge));e!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u);return t}()!==u&&Si()!==u&&(e=pa())!==u?($o=t,t=e):(Ho=t,t=u);return t}())===u&&(l=null),l!==u&&Si()!==u?((f=Xu())===u&&(f=null),f!==u&&Si()!==u?((p=Ju())===u&&(p=null),p!==u?($o=t,v=e,b=n,d=o,y=a,m=i,w=c,L=l,C=f,E=p,(h=s)&&h.forEach(r=>r.table&&oc.add(`select::${r.db}::${r.table}`)),t={with:v,type:"select",options:b,distinct:d,columns:y,from:h,where:m,groupby:w,having:L,orderby:C,limit:E}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function Au(){var t,e;return t=Ho,(e=function(){var t;"sql_calc_found_rows"===r.substr(Ho,19).toLowerCase()?(t=r.substr(Ho,19),Ho+=19):(t=u,0===Go&&Ko(Lo));return t}())===u&&((e=function(){var t;"sql_cache"===r.substr(Ho,9).toLowerCase()?(t=r.substr(Ho,9),Ho+=9):(t=u,0===Go&&Ko(Co));return t}())===u&&(e=function(){var t;"sql_no_cache"===r.substr(Ho,12).toLowerCase()?(t=r.substr(Ho,12),Ho+=12):(t=u,0===Go&&Ko(Eo));return t}()),e===u&&(e=function(){var t;"sql_big_result"===r.substr(Ho,14).toLowerCase()?(t=r.substr(Ho,14),Ho+=14):(t=u,0===Go&&Ko(go));return t}())===u&&(e=function(){var t;"sql_small_result"===r.substr(Ho,16).toLowerCase()?(t=r.substr(Ho,16),Ho+=16):(t=u,0===Go&&Ko(Ao));return t}())===u&&(e=function(){var t;"sql_buffer_result"===r.substr(Ho,17).toLowerCase()?(t=r.substr(Ho,17),Ho+=17):(t=u,0===Go&&Ko(jo));return t}())),e!==u&&($o=t,e=e),t=e}function gu(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=xs())===u&&(t=Ho,(e=wi())!==u?(n=Ho,Go++,o=Ma(),Go--,o===u?n=void 0:(Ho=n,n=u),n!==u?t=e=[e,n]:(Ho=t,t=u)):(Ho=t,t=u),t===u&&(t=wi())),t!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=_u())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=_u())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,r=t=function(r,t){uc.add("select::null::(.*)");const e={expr:{type:"column_ref",table:null,column:"*"},as:null};return t&&t.length>0?Ji(e,t):[e]}(0,e)):(Ho=r,r=u)}else Ho=r,r=u;if(r===u)if(r=Ho,(t=_u())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=_u())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=mi())!==u&&(s=Si())!==u&&(i=_u())!==u?n=o=[o,a,s,i]:(Ho=n,n=u);e!==u?($o=r,r=t=l(t,e)):(Ho=r,r=u)}else Ho=r,r=u;return r}function ju(){var t,e,n,o,a,s,i;return t=Ho,Ei()!==u&&Si()!==u?((e=za())===u&&(e=Va()),e!==u&&Si()!==u&&Ai()!==u?(n=Ho,(o=Si())!==u?(46===r.charCodeAt(Ho)?(a=".",Ho++):(a=u,0===Go&&Ko(ir)),a!==u&&(s=Si())!==u&&(i=Sa())!==u?n=o=[o,a,s,i]:(Ho=n,n=u)):(Ho=n,n=u),n===u&&(n=null),n!==u?($o=t,t=function(r,t){let e;return t&&(e={type:"default",value:t[3]}),{brackets:!0,index:r,property:e}}(e,n)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function Su(){var r,t,e,n,o,a;if(r=Ho,(t=ju())!==u){for(e=[],n=Ho,(o=Si())!==u&&(a=ju())!==u?n=o=[o,a]:(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u&&(a=ju())!==u?n=o=[o,a]:(Ho=n,n=u);e!==u?($o=r,r=t=i(t,e)):(Ho=r,r=u)}else Ho=r,r=u;return r}function Tu(){var r,t,e,n,o;return r=Ho,(t=function(){var r,t,e,n,o,a,s,i;if(r=Ho,(t=fa())!==u){for(e=[],n=Ho,(o=Si())!==u?((a=Ps())===u&&(a=Fs())===u&&(a=ji()),a!==u&&(s=Si())!==u&&(i=fa())!==u?n=o=[o,a,s,i]:(Ho=n,n=u)):(Ho=n,n=u);n!==u;)e.push(n),n=Ho,(o=Si())!==u?((a=Ps())===u&&(a=Fs())===u&&(a=ji()),a!==u&&(s=Si())!==u&&(i=fa())!==u?n=o=[o,a,s,i]:(Ho=n,n=u)):(Ho=n,n=u);e!==u?($o=r,t=function(r,t){const e=r.ast;if(e&&"select"===e.type&&(!(r.parentheses_symbol||r.parentheses||r.ast.parentheses||r.ast.parentheses_symbol)||1!==e.columns.length||"*"===e.columns[0].expr.column))throw new Error("invalid column clause with select statement");if(!t||0===t.length)return r;const n=t.length;let o=t[n-1][3];for(let e=n-1;e>=0;e--){const n=0===e?r:t[e-1][3];o=zi(t[e][1],n,o)}return o}(t,e),r=t):(Ho=r,r=u)}else Ho=r,r=u;return r}())!==u&&Si()!==u?((e=Su())===u&&(e=null),e!==u?($o=r,n=t,(o=e)&&(n.array_index=o),r=t=n):(Ho=r,r=u)):(Ho=r,r=u),r}function _u(){var r,t,e,n,o;return r=Ho,t=Ho,(e=Sa())!==u&&(n=Si())!==u&&(o=hi())!==u?t=e=[e,n,o]:(Ho=t,t=u),t===u&&(t=null),t!==u&&(e=Si())!==u&&(n=wi())!==u?($o=r,r=t=function(r){const t=r&&r[0]||null;return uc.add(`select::${t}::(.*)`),{expr:{type:"column_ref",table:t,column:"*"},as:null}}(t)):(Ho=r,r=u),r===u&&(r=Ho,(t=Tu())!==u&&(e=Si())!==u?((n=xu())===u&&(n=null),n!==u?($o=r,r=t={type:"expr",expr:t,as:n}):(Ho=r,r=u)):(Ho=r,r=u)),r}function xu(){var r,t,e;return r=Ho,(t=hs())!==u&&Si()!==u?((e=Wa())===u&&(e=function(){var r,t;r=Ho,(t=Ua())!==u?($o=Ho,(function(r){if(!0===Qi[r.toUpperCase()])throw new Error("Error: "+JSON.stringify(r)+" is a reserved word, can not as alias clause");return!1}(t)?u:void 0)!==u?($o=r,r=t=t):(Ho=r,r=u)):(Ho=r,r=u);r===u&&(r=Ho,(t=_a())!==u&&($o=r,t=t),r=t);return r}()),e!==u?($o=r,r=t=e):(Ho=r,r=u)):(Ho=r,r=u),r===u&&(r=Ho,(t=hs())===u&&(t=null),t!==u&&Si()!==u&&(e=Sa())!==u?($o=r,r=t=e):(Ho=r,r=u)),r}function Iu(){var t,e,n,o,a;return t=Ho,"unnest"===r.substr(Ho,6).toLowerCase()?(e=r.substr(Ho,6),Ho+=6):(e=u,0===Go&&Ko(cr)),e!==u&&Si()!==u&&Li()!==u&&Si()!==u?((n=fa())===u&&(n=null),n!==u&&Si()!==u&&Ci()!==u&&Si()!==u?((o=xu())===u&&(o=null),o!==u&&Si()!==u?((a=function(){var r,t;return r=Ho,Ss()!==u&&Si()!==u&&_s()!==u&&Si()!==u?((t=xu())===u&&(t=null),t!==u?($o=r,r={keyword:"with offset as",as:t}):(Ho=r,r=u)):(Ho=r,r=u),r}())===u&&(a=null),a!==u?($o=t,t=e={type:"unnest",expr:n,parentheses:!0,as:o,with_offset:a}):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u)):(Ho=t,t=u),t}function ku(){var r,t;return r=Ho,ds()!==u&&Si()!==u&&(t=Mu())!==u?($o=r,r=t):(Ho=r,r=u),r}function Nu(){var r,t,e;return r=Ho,(t=Hu())!==u&&Si()!==u&&us()!==u&&Si()!==u&&(e=Hu())!==u?($o=r,r=t=[t,e]):(Ho=r,r=u),r}function Ru(){var t,e;return t=Ho,js