@code-recycle/cli
Version:
高级语法查询替换工具;Advanced syntax query replacement tool
209 lines • 253 kB
JavaScript
exports.id=827,exports.ids=[827],exports.modules={70887:function(e,s){var t,r;void 0===(r='function'==typeof(t=function(){'use strict';var e=Object.prototype.hasOwnProperty,s=Object.prototype.toString,t='boolean'==typeof(new RegExp).sticky;function r(e){
return e&&'[object RegExp]'===s.call(e)}function a(e){return e&&'object'==typeof e&&!r(e)&&!Array.isArray(e)}function n(e){return e.length?'(?:'+e.map((function(e){return'(?:'+e+')'})).join('|')+')':'(?!)'}function o(e){
if('string'==typeof e)return'(?:'+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,'\\$&')+')';if(r(e)){if(e.ignoreCase)throw new Error('RegExp /i flag not allowed');if(e.global)throw new Error('RegExp /g flag is implied')
;if(e.sticky)throw new Error('RegExp /y flag is implied');if(e.multiline)throw new Error('RegExp /m flag is implied');return e.source}throw new Error('Not a pattern: '+e)}function l(e,s){return e.length>s?e:Array(s-e.length+1).join(' ')+e}function p(s,t){
if(a(t)||(t={match:t}),t.include)throw new Error('Matching rules cannot also include states');var n={defaultType:s,lineBreaks:!!t.error||!!t.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1}
;for(var o in t)e.call(t,o)&&(n[o]=t[o]);if('string'==typeof n.type&&s!==n.type)throw new Error('Type transform cannot be a string (type \''+n.type+'\' for token \''+s+'\')');var l=n.match;return n.match=Array.isArray(l)?l:l?[l]:[],
n.match.sort((function(e,s){return r(e)&&r(s)?0:r(s)?-1:r(e)?1:s.length-e.length})),n}function c(e){return Array.isArray(e)?function(e){for(var s=[],t=0;t<e.length;t++){var r=e[t];if(r.include)for(var a=[].concat(r.include),n=0;n<a.length;n++)s.push({
include:a[n]});else{if(!r.type)throw new Error('Rule has no type: '+JSON.stringify(r));s.push(p(r.type,r))}}return s}(e):function(e){for(var s=Object.getOwnPropertyNames(e),t=[],r=0;r<s.length;r++){var n=s[r],o=e[n],l=[].concat(o);if('include'!==n){
var c=[];l.forEach((function(e){a(e)?(c.length&&t.push(p(n,c)),t.push(p(n,e)),c=[]):c.push(e)})),c.length&&t.push(p(n,c))}else for(var m=0;m<l.length;m++)t.push({include:l[m]})}return t}(e)}var m=p('error',{lineBreaks:!0,shouldThrow:!0});function i(e,s){
for(var a=null,l=Object.create(null),p=!0,c=null,i=[],$=[],_=0;_<e.length;_++)e[_].fallback&&(p=!1);for(_=0;_<e.length;_++){var b=e[_];if(b.include)throw new Error('Inheritance is not allowed in stateless lexers');if(b.error||b.fallback){
if(a)throw!b.fallback==!a.fallback?new Error('Multiple '+(b.fallback?'fallback':'error')+' rules not allowed (for token \''+b.defaultType+'\')'):new Error('fallback and error are mutually exclusive (for token \''+b.defaultType+'\')');a=b}
var y=b.match.slice();if(p)for(;y.length&&'string'==typeof y[0]&&1===y[0].length;)l[y.shift().charCodeAt(0)]=b;if(b.pop||b.push||b.next){if(!s)throw new Error('State-switching options are not allowed in stateless lexers (for token \''+b.defaultType+'\')')
;if(b.fallback)throw new Error('State-switching options are not allowed on fallback tokens (for token \''+b.defaultType+'\')')}if(0!==y.length){p=!1,i.push(b);for(var u=0;u<y.length;u++){var x=y[u]
;if(r(x))if(null===c)c=x.unicode;else if(c!==x.unicode&&!1===b.fallback)throw new Error('If one rule is /u then all must be')}var d=n(y.map(o)),w=new RegExp(d);if(w.test(''))throw new Error('RegExp matches empty string: '+w)
;if(new RegExp('|'+d).exec('').length-1>0)throw new Error('RegExp has capture groups: '+w+'\nUse (?: … ) instead');if(!b.lineBreaks&&w.test('\n'))throw new Error('Rule should declare lineBreaks: '+w);$.push('('+d+')')}}
var f=a&&a.fallback,h=t&&!f?'ym':'gm',k=t||f?'':'|';return!0===c&&(h+='u'),{regexp:new RegExp(n($)+k,h),groups:i,fast:l,error:a||m}}function $(e,s,t){var r=e&&(e.push||e.next)
;if(r&&!t[r])throw new Error('Missing state \''+r+'\' (in token \''+e.defaultType+'\' of state \''+s+'\')');if(e&&e.pop&&1!=+e.pop)throw new Error('pop must be 1 (in token \''+e.defaultType+'\' of state \''+s+'\')')}var _=function(e,s){this.startState=s,
this.states=e,this.buffer='',this.stack=[],this.reset()};_.prototype.reset=function(e,s){return this.buffer=e||'',this.index=0,this.line=s?s.line:1,this.col=s?s.col:1,this.queuedToken=s?s.queuedToken:null,this.queuedText=s?s.queuedText:'',
this.queuedThrow=s?s.queuedThrow:null,this.setState(s?s.state:this.startState),this.stack=s&&s.stack?s.stack.slice():[],this},_.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),
queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},_.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var s=this.states[e];this.groups=s.groups,this.error=s.error,this.re=s.regexp,this.fast=s.fast}},
_.prototype.popState=function(){this.setState(this.stack.pop())},_.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var b=t?function(e,s){return e.exec(s)}:function(e,s){var t=e.exec(s);return 0===t[0].length?null:t}
;function y(){return this.value}if(_.prototype._getGroup=function(e){for(var s=this.groups.length,t=0;t<s;t++)if(void 0!==e[t+1])return this.groups[t];throw new Error('Cannot find token type for matched text')},_.prototype.next=function(){var e=this.index
;if(this.queuedGroup){var s=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText='',s}var t=this.buffer;if(e!==t.length){if(o=this.fast[t.charCodeAt(e)])return this._token(o,t.charAt(e),e);var r=this.re
;r.lastIndex=e;var a=b(r,t),n=this.error;if(null==a)return this._token(n,t.slice(e,t.length),e);var o=this._getGroup(a),l=a[0];return n.fallback&&a.index!==e?(this.queuedGroup=o,this.queuedText=l,this._token(n,t.slice(e,a.index),e)):this._token(o,l,e)}},
_.prototype._token=function(e,s,t){var r=0;if(e.lineBreaks){var a=/\n/g,n=1;if('\n'===s)r=1;else for(;a.exec(s);)r++,n=a.lastIndex}var o={type:'function'==typeof e.type&&e.type(s)||e.defaultType,value:'function'==typeof e.value?e.value(s):s,text:s,
toString:y,offset:t,lineBreaks:r,line:this.line,col:this.col},l=s.length;if(this.index+=l,this.line+=r,0!==r?this.col=l-n+1:this.col+=l,e.shouldThrow)throw new Error(this.formatError(o,'invalid syntax'))
;return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),o},'undefined'!=typeof Symbol&&Symbol.iterator){var u=function(e){this.lexer=e};u.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},
u.prototype[Symbol.iterator]=function(){return this},_.prototype[Symbol.iterator]=function(){return new u(this)}}return _.prototype.formatError=function(e,s){if(null==e){var t=this.buffer.slice(this.index);e={text:t,offset:this.index,
lineBreaks:-1===t.indexOf('\n')?0:1,line:this.line,col:this.col}}var r=Math.max(e.line-2,1),a=e.line+2,n=String(a).length,o=function(e,s){for(var t=e.length,r=0;;){var a=e.lastIndexOf('\n',t-1);if(-1===a)break;if(t=a,++r===s)break;if(0===t)break}
var n=r<s?0:t+1;return e.substring(n).split('\n')}(this.buffer,this.line-e.line+2+1).slice(0,5),p=[];p.push(s+' at line '+e.line+' col '+e.col+':'),p.push('');for(var c=0;c<o.length;c++){var m=o[c],i=r+c;p.push(l(String(i),n)+' '+m),
i===e.line&&p.push(l('',n+e.col+1)+'^')}return p.join('\n')},_.prototype.clone=function(){return new _(this.states,this.state)},_.prototype.has=function(e){return!0},{compile:function(e){var s=i(c(e));return new _({start:s},'start')},states:function(e,s){
var t=e.$all?c(e.$all):[];delete e.$all;var r=Object.getOwnPropertyNames(e);s||(s=r[0]);for(var a=Object.create(null),n=0;n<r.length;n++)a[w=r[n]]=c(e[w]).concat(t);for(n=0;n<r.length;n++)for(var o=a[w=r[n]],l=Object.create(null),p=0;p<o.length;p++){
var m=o[p];if(m.include){var b=[p,1];if(m.include!==w&&!l[m.include]){l[m.include]=!0;var y=a[m.include];if(!y)throw new Error('Cannot include nonexistent state \''+m.include+'\' (in state \''+w+'\')');for(var u=0;u<y.length;u++){var x=y[u]
;-1===o.indexOf(x)&&b.push(x)}}o.splice.apply(o,b),p--}}var d=Object.create(null);for(n=0;n<r.length;n++){var w;d[w=r[n]]=i(a[w],!0)}for(n=0;n<r.length;n++){var f=r[n],h=d[f],k=h.groups;for(p=0;p<k.length;p++)$(k[p],f,d)
;var v=Object.getOwnPropertyNames(h.fast);for(p=0;p<v.length;p++)$(h.fast[v[p]],f,d)}return new _(d,s)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){
for(var s='undefined'!=typeof Map,t=s?new Map:Object.create(null),r=Object.getOwnPropertyNames(e),a=0;a<r.length;a++){var n=r[a],o=e[n];(Array.isArray(o)?o:[o]).forEach((function(e){
if('string'!=typeof e)throw new Error('keyword must be string (in keyword \''+n+'\')');s?t.set(e,n):t[e]=n}))}return function(e){return s?t.get(e):t[e]}}}})?t.apply(s,[]):t)||(e.exports=r)},58515:function(e){var s;s=function(){function e(s,t,r){
return this.id=++e.highestId,this.name=s,this.symbols=t,this.postprocess=r,this}function s(e,s,t,r){this.rule=e,this.dot=s,this.reference=t,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}function t(e,s){this.grammar=e,
this.index=s,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(e,s){this.rules=e,this.start=s||this.rules[0].name;var t=this.byName={};this.rules.forEach((function(e){t.hasOwnProperty(e.name)||(t[e.name]=[]),t[e.name].push(e)}))}
function a(){this.reset('')}function n(e,s,n){if(e instanceof r){var o=e;n=s}else o=r.fromCompiled(e,s);for(var l in this.grammar=o,this.options={keepHistory:!1,lexer:o.lexer||new a},n||{})this.options[l]=n[l];this.lexer=this.options.lexer,
this.lexerState=void 0;var p=new t(o,0);this.table=[p],p.wants[o.start]=[],p.predict(o.start),p.process(),this.current=0}function o(e){var s=typeof e;if('string'===s)return e;if('object'===s){if(e.literal)return JSON.stringify(e.literal)
;if(e instanceof RegExp)return e.toString();if(e.type)return'%'+e.type;if(e.test)return'<'+String(e.test)+'>';throw new Error('Unknown symbol type: '+e)}}return e.highestId=0,e.prototype.toString=function(e){
var s=void 0===e?this.symbols.map(o).join(' '):this.symbols.slice(0,e).map(o).join(' ')+' ● '+this.symbols.slice(e).map(o).join(' ');return this.name+' → '+s},s.prototype.toString=function(){
return'{'+this.rule.toString(this.dot)+'}, from: '+(this.reference||0)},s.prototype.nextState=function(e){var t=new s(this.rule,this.dot+1,this.reference,this.wantedBy);return t.left=this,t.right=e,t.isComplete&&(t.data=t.build(),t.right=void 0),t},
s.prototype.build=function(){var e=[],s=this;do{e.push(s.right.data),s=s.left}while(s.left);return e.reverse(),e},s.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,n.fail))},
t.prototype.process=function(e){for(var s=this.states,t=this.wants,r=this.completed,a=0;a<s.length;a++){var o=s[a];if(o.isComplete){if(o.finish(),o.data!==n.fail){for(var l=o.wantedBy,p=l.length;p--;){var c=l[p];this.complete(c,o)}
if(o.reference===this.index){var m=o.rule.name;(this.completed[m]=this.completed[m]||[]).push(o)}}}else{if('string'!=typeof(m=o.rule.symbols[o.dot])){this.scannable.push(o);continue}if(t[m]){if(t[m].push(o),r.hasOwnProperty(m)){var i=r[m]
;for(p=0;p<i.length;p++){var $=i[p];this.complete(o,$)}}}else t[m]=[o],this.predict(m)}}},t.prototype.predict=function(e){for(var t=this.grammar.byName[e]||[],r=0;r<t.length;r++){var a=t[r],n=this.wants[e],o=new s(a,0,this.index,n);this.states.push(o)}},
t.prototype.complete=function(e,s){var t=e.nextState(s);this.states.push(t)},r.fromCompiled=function(s,t){var a=s.Lexer;s.ParserStart&&(t=s.ParserStart,s=s.ParserRules);var n=new r(s=s.map((function(s){return new e(s.name,s.symbols,s.postprocess)})),t)
;return n.lexer=a,n},a.prototype.reset=function(e,s){this.buffer=e,this.index=0,this.line=s?s.line:1,this.lastLineBreak=s?-s.col:0},a.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++]
;return'\n'===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},a.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},a.prototype.formatError=function(e,s){var t=this.buffer;if('string'==typeof t){
var r=t.split('\n').slice(Math.max(0,this.line-5),this.line),a=t.indexOf('\n',this.index);-1===a&&(a=t.length);var n=this.index-this.lastLineBreak,o=String(this.line).length;return s+=' at line '+this.line+' col '+n+':\n\n',(s+=r.map((function(e,s){
return l(this.line-r.length+s+1,o)+' '+e}),this).join('\n'))+'\n'+l('',o+n)+'^\n'}return s+' at index '+(this.index-1);function l(e,s){var t=String(e);return Array(s-t.length+1).join(' ')+t}},n.fail={},n.prototype.feed=function(e){var s,r=this.lexer
;for(r.reset(e,this.lexerState);;){try{if(!(s=r.next()))break}catch(e){var n=new t(this.grammar,this.current+1);throw this.table.push(n),(p=new Error(this.reportLexerError(e))).offset=this.current,p.token=e.token,p}var o=this.table[this.current]
;this.options.keepHistory||delete this.table[this.current-1];var l=this.current+1;n=new t(this.grammar,l),this.table.push(n);for(var p,c=void 0!==s.text?s.text:s.value,m=r.constructor===a?s.value:s,i=o.scannable,$=i.length;$--;){
var _=i[$],b=_.rule.symbols[_.dot];if(b.test?b.test(m):b.type?b.type===s.type:b.literal===c){var y=_.nextState({data:m,token:s,isToken:!0,reference:l-1});n.states.push(y)}}if(n.process(),
0===n.states.length)throw(p=new Error(this.reportError(s))).offset=this.current,p.token=s,p;this.options.keepHistory&&(o.lexerState=r.save()),this.current++}return o&&(this.lexerState=r.save()),this.results=this.finish(),this},
n.prototype.reportLexerError=function(e){var s,t,r=e.token;return r?(s='input '+JSON.stringify(r.text[0])+' (lexer error)',t=this.lexer.formatError(r,'Syntax error')):(s='input (lexer error)',t=e.message),this.reportErrorCommon(t,s)},
n.prototype.reportError=function(e){var s=(e.type?e.type+' token: ':'')+JSON.stringify(void 0!==e.value?e.value:e),t=this.lexer.formatError(e,'Syntax error');return this.reportErrorCommon(t,s)},n.prototype.reportErrorCommon=function(e,s){var t=[]
;t.push(e);var r=this.table.length-2,a=this.table[r],n=a.states.filter((function(e){var s=e.rule.symbols[e.dot];return s&&'string'!=typeof s}))
;return 0===n.length?(t.push('Unexpected '+s+'. I did not expect any more input. Here is the state of my parse table:\n'),this.displayStateStack(a.states,t)):(t.push('Unexpected '+s+'. Instead, I was expecting to see one of the following:\n'),
n.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var s=e[0],r=s.rule.symbols[s.dot],a=this.getSymbolDisplay(r);t.push('A '+a+' based on:'),this.displayStateStack(e,t)}),this)),t.push(''),t.join('\n')},
n.prototype.displayStateStack=function(e,s){for(var t,r=0,a=0;a<e.length;a++){var n=e[a],o=n.rule.toString(n.dot);o===t?r++:(r>0&&s.push(' ^ '+r+' more lines identical to this'),r=0,s.push(' '+o)),t=o}},n.prototype.getSymbolDisplay=function(e){
return function(e){var s=typeof e;if('string'===s)return e;if('object'===s){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return'character matching '+e;if(e.type)return e.type+' token'
;if(e.test)return'token matching '+String(e.test);throw new Error('Unknown symbol type: '+e)}}(e)},n.prototype.buildFirstStateStack=function(e,s){if(-1!==s.indexOf(e))return null;if(0===e.wantedBy.length)return[e]
;var t=e.wantedBy[0],r=[e].concat(s),a=this.buildFirstStateStack(t,r);return null===a?null:[e].concat(a)},n.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},n.prototype.restore=function(e){var s=e.index
;this.current=s,this.table[s]=e,this.table.splice(s+1),this.lexerState=e.lexerState,this.results=this.finish()},n.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error('set option `keepHistory` to enable rewinding')
;this.restore(this.table[e])},n.prototype.finish=function(){var e=[],s=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(t){t.rule.name===s&&t.dot===t.rule.symbols.length&&0===t.reference&&t.data!==n.fail&&e.push(t)})),
e.map((function(e){return e.data}))},{Parser:n,Grammar:r,Rule:e}},e.exports?e.exports=s():this.nearley=s()},56895:(e,s,t)=>{!function(e,s){for(var t in s)e[t]=s[t]}(s,function(e){var s={};function t(r){if(s[r])return s[r].exports;var a=s[r]={i:r,l:!1,
exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=s,t.d=function(e,s,r){t.o(e,s)||Object.defineProperty(e,s,{enumerable:!0,get:r})},t.r=function(e){
'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},t.t=function(e,s){if(1&s&&(e=t(e)),8&s)return e
;if(4&s&&'object'==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,'default',{enumerable:!0,value:e}),2&s&&'string'!=typeof e)for(var a in e)t.d(r,a,function(s){return e[s]}.bind(null,a));return r},
t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,'a',s),s},t.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},t.p='',t(t.s=7)}([function(e,s){e.exports=t(70887)},function(e,s,t){
'use strict';Object.defineProperty(s,'__esModule',{value:!0}),s.unbox=s.doubleQuoted=s.box=s.track=s.tracking=s.trackingComments=s.lexerAny=s.lexer=void 0;const r=t(0),a=t(3),n={};for(const e of a.sqlKeywords)n['kw_'+e.toLowerCase()]=e;var o;s.lexer=(0,
r.compile)({word:{match:/[eE](?!')[A-Za-z0-9_]*|[a-df-zA-DF-Z_][A-Za-z0-9_]*/,type:(e=>{const s=(0,r.keywords)(e);return e=>s(e.toUpperCase())})(n),value:e=>e.toLowerCase()},wordQuoted:{match:/"(?:[^"\*]|"")+"/,type:()=>'quoted_word',
value:e=>e.substring(1,e.length-1)},string:{match:/'(?:[^']|\'\')*'/,value:e=>e.substring(1,e.length-1).replace(/''/g,'\'')},eString:{match:/\b(?:e|E)'(?:[^'\\]|[\r\n\s]|(?:\\\s)|(?:\\\n)|(?:\\.)|(?:\'\'))+'/,
value:e=>e.substring(2,e.length-1).replace(/''/g,'\'').replace(/\\([\s\n])/g,((e,s)=>s)).replace(/\\./g,(e=>JSON.parse('"'+e+'"')))},qparam:{match:/\$\d+/},commentLine:/\-\-.*?$[\s\r\n]*/,commentFullOpen:/\/\*/,commentFullClose:/\*\/[\s\r\n]*/,star:'*',
comma:',',space:{match:/[\s\t\n\v\f\r]+/,lineBreaks:!0},int:/\-?\d+(?![\.\d])/,float:/\-?(?:(?:\d*\.\d+)|(?:\d+\.\d*))/,lparen:'(',rparen:')',lbracket:'[',rbracket:']',semicolon:';',dot:/\.(?!\d)/,op_cast:'::',op_colon:':',op_plus:'+',op_eq:'=',op_neq:{
match:/(?:!=)|(?:\<\>)/,value:()=>'!='},op_membertext:'->>',op_member:'->',op_minus:'-',op_div:/\//,op_not_ilike:/\!~~\*/,op_not_like:/\!~~/,op_ilike:/~~\*/,op_like:/~~/,op_mod:'%',op_exp:'^',op_additive:{match:['||','-','#-','&&']},op_compare:{
match:['>','>=','<','<=','@>','<@','?','?|','?&','#>>','>>','<<','~','~*','!~','!~*','@@']},ops_others:{match:['|','&','^','#']},codeblock:{match:/\$\$(?:.|[\s\t\n\v\f\r])*?\$\$/s,lineBreaks:!0,value:e=>e.substring(2,e.length-2)}}),
s.lexer.next=(o=s.lexer.next,()=>{let e,t=null;for(;e=o.call(s.lexer);){if('commentFullOpen'===e.type){if(null===t){t={nested:0,offset:e.offset,text:e.text};continue}t.nested++}if(null==t){if('space'!==e.type){if('commentLine'!==e.type)break
;null==l||l.push(p(e))}}else if(t.text+=e.text,'commentFullClose'===e.type){if(0===t.nested){null==l||l.push(p(t)),t=null;continue}t.nested--}}if(c&&e){const s=e.offset,t={start:s,end:s+e.text.length};e._location=t}return e}),s.lexerAny=s.lexer;let l=null
;const p=({offset:e,text:s})=>({_location:{start:e,end:e+s.length},comment:s});s.trackingComments=function(e){if(l)throw new Error('WAT ? Recursive comments tracking 🤔🤨 ?');try{l=[];const s=e();return{comments:l,ast:s}}finally{l=null}};let c=!1
;function m(e,s){if(!c||!s||'object'!=typeof s)return s;const t=b(e,!0),r=b(e,!1);if(!t||!r)return s;if(t===r)s._location=t;else{const e={start:t.start,end:r.end};s._location=e}return s}s.tracking=function(e){if(c)return e();try{return c=!0,e()}finally{
c=!1}},s.track=m;const i=Symbol('_literal'),$=Symbol('_doublequoted');function _(e){return Array.isArray(e)&&1===e.length&&(e=_(e[0])),Array.isArray(e)&&!e.length?null:e}function b(e,s){if(!e)return null;if(Array.isArray(e)){const t=s?1:-1
;for(let r=s?0:e.length-1;r>=0&&r<e.length;r+=t){const t=b(e[r],s);if(t)return t}return null}return'object'!=typeof e?null:e._location}s.box=function(e,s,t){return c||t?m(e,{[i]:s,[$]:t}):s},s.doubleQuoted=function(e){const s=_(e)
;if('object'==typeof e&&(null==s?void 0:s[$]))return{doubleQuoted:!0}},s.unbox=function(e){var s;return'object'==typeof e&&null!==(s=null==e?void 0:e[i])&&void 0!==s?s:e}},function(e,s,t){'use strict';Object.defineProperty(s,'__esModule',{value:!0}),
s.AstDefaultMapper=s.arrayNilMap=s.assignChanged=s.astMapper=void 0;const r=t(6);function a(e,s){if(!e)return e;let t=!1;for(const r of Object.keys(s))if(e[r]!==s[r]){t=!0;break}return t?(0,r.trimNullish)({...e,...s},0):e}function n(e,s){
if(!(null==e?void 0:e.length))return e;let t=!1,r=e;for(let a=0;a<e.length;a++){const n=e[a],o=s(n);t||o&&o===n||(t=!0,r=e.slice(0,a)),o&&t&&r.push(o)}return r}function o(e){switch(null==e?void 0:e.type){case'select':case'delete':case'insert':
case'update':case'union':case'union all':case'with':return!0;default:return!1}}s.astMapper=function(e){const s=new l;return s.wrapped=e(s),s},s.assignChanged=a,s.arrayNilMap=n;class l{super(){return new c(this)}statement(e){switch(e.type){
case'alter table':return this.alterTable(e);case'alter index':return this.alterIndex(e);case'commit':case'start transaction':case'rollback':return this.transaction(e);case'create index':return this.createIndex(e);case'create table':
return this.createTable(e);case'truncate table':return this.truncateTable(e);case'delete':return this.delete(e);case'insert':return this.insert(e);case'with':return this.with(e);case'with recursive':return this.withRecursive(e);case'select':
return this.selection(e);case'update':return this.update(e);case'create extension':return this.createExtension(e);case'tablespace':return this.tablespace(e);case'set':return this.setGlobal(e);case'set timezone':return this.setTimezone(e);case'set names':
return this.setNames(e);case'create sequence':return this.createSequence(e);case'alter sequence':return this.alterSequence(e);case'begin':return this.begin(e);case'drop table':case'drop index':case'drop sequence':case'drop type':case'drop trigger':
return this.drop(e);case'create enum':return this.createEnum(e);case'alter enum':return this.alterEnum(e);case'create composite type':return this.createCompositeType(e);case'union':case'union all':return this.union(e);case'show':return this.show(e)
;case'prepare':return this.prepare(e);case'deallocate':return this.deallocate(e);case'create view':return this.createView(e);case'create materialized view':return this.createMaterializedView(e);case'refresh materialized view':
return this.refreshMaterializedView(e);case'create schema':return this.createSchema(e);case'raise':return this.raise(e);case'comment':return this.comment(e);case'do':return this.do(e);case'create function':return this.createFunction(e)
;case'drop function':return this.dropFunction(e);case'values':return this.values(e);default:throw r.NotSupported.never(e)}}comment(e){return e}createView(e){const s=this.select(e.query);if(!s)return null;const t=this.tableRef(e.name);return t?a(e,{
query:s,name:t}):null}createMaterializedView(e){const s=this.select(e.query);if(!s)return null;const t=this.tableRef(e.name);return t?a(e,{query:s,name:t}):null}refreshMaterializedView(e){return e}do(e){return e}createFunction(e){
const s=n(e.arguments,(e=>a(e,{type:this.dataType(e.type)})));let t;if(e.returns)switch(e.returns.kind){case'table':t=a(e.returns,{columns:n(e.returns.columns,(e=>{const s=this.dataType(e.type);return s&&a(e,{type:s})}))});break;case void 0:case null:
case'array':t=this.dataType(e.returns);break;default:throw r.NotSupported.never(e.returns)}return a(e,{returns:t,arguments:s})}dropFunction(e){const s=n(e.arguments,(e=>a(e,{type:this.dataType(e.type)})));return a(e,{arguments:s})}show(e){return e}
createEnum(e){return e}alterEnum(e){return e}createCompositeType(e){const s=n(e.attributes,(e=>a(e,{dataType:this.dataType(e.dataType)})));return a(e,{attributes:s})}drop(e){return e}alterSequence(e){
return'set options'===e.change.type&&e.change.as&&this.dataType(e.change.as),e}begin(e){return e}createSequence(e){return e.options.as&&this.dataType(e.options.as),e}tablespace(e){return e}setGlobal(e){return e}setTimezone(e){return e}setNames(e){return e
}update(e){if(!e)return e;const s=this.tableRef(e.table);if(!s)return null;const t=e.from&&this.from(e.from),r=e.where&&this.expr(e.where),o=n(e.sets,(e=>this.set(e)));return(null==o?void 0:o.length)?a(e,{table:s,where:r,sets:o,from:t,
returning:n(e.returning,(e=>this.selectionColumn(e)))}):null}insert(e){var s,t;const o=this.tableRef(e.into);if(!o)return null;const l=e.insert&&this.select(e.insert);if(!l)return null;const p=n(e.returning,(e=>this.selectionColumn(e)))
;let c=null===(s=e.onConflict)||void 0===s?void 0:s.on;switch(null==c?void 0:c.type){case'on constraint':break;case'on expr':c=a(c,{exprs:n(c.exprs,(e=>this.expr(e)))});break;case null:case void 0:break;default:throw r.NotSupported.never(c)}
let m=null===(t=e.onConflict)||void 0===t?void 0:t.do;if(m&&'do nothing'!==m){const e=n(m.sets,(e=>this.set(e)));(null==e?void 0:e.length)?m.sets!==e&&(m={sets:e}):m='do nothing'}return a(e,{into:o,insert:l,returning:p,onConflict:m?a(e.onConflict,{do:m,
on:c}):e.onConflict})}raise(e){return a(e,{formatExprs:e.formatExprs&&n(e.formatExprs,(e=>this.expr(e))),using:e.using&&n(e.using,(e=>a(e,{value:this.expr(e.value)})))})}delete(e){const s=this.tableRef(e.from);return s?a(e,{
where:e.where&&this.expr(e.where),returning:n(e.returning,(e=>this.selectionColumn(e))),from:s}):null}createSchema(e){return e}createTable(e){const s=n(e.columns,(e=>{switch(e.kind){case'column':return this.createColumn(e);case'like table':
return this.likeTable(e);default:throw r.NotSupported.never(e)}}));return(null==s?void 0:s.length)?a(e,{columns:s}):null}likeTable(e){const s=this.tableRef(e.like);return s?a(e,{like:s}):null}truncateTable(e){return e}constraint(e){switch(e.type){
case'not null':case'null':case'primary key':case'unique':case'add generated':return e;case'default':{const s=this.expr(e.default);return s?a(e,{default:s}):null}case'check':{const s=this.expr(e.expr);return s?a(e,{expr:s}):null}case'reference':{
const s=this.tableRef(e.foreignTable);return s?a(e,{foreignTable:s}):null}default:throw r.NotSupported.never(e)}}set(e){const s=this.expr(e.value);return s?a(e,{value:s}):null}dataType(e){return e}tableRef(e){return e}transaction(e){return e}
createExtension(e){return e}createIndex(e){const s=n(e.expressions,(e=>{const s=this.expr(e.expression);return s===e.expression?e:s?{...e,expression:s}:null}));return(null==s?void 0:s.length)?a(e,{expressions:s}):null}prepare(e){
const s=this.statement(e.statement);return s?a(e,{args:n(e.args,(e=>this.dataType(e))),statement:s}):null}deallocate(e){return e}alterIndex(e){return e}alterTable(e){var s;const t=this.tableRef(e.table);if(!t)return null;let r=[],n=!1
;for(let t=0;t<((null===(s=e.changes)||void 0===s?void 0:s.length)||0);t++){const s=e.changes[t],a=this.tableAlteration(s,e.table);n=n||a!=s,a&&r.push(a)}return r.length?n?a(e,{table:t,changes:r}):e:null}tableAlteration(e,s){switch(e.type){
case'add column':return this.addColumn(e,s);case'add constraint':return this.addConstraint(e,s);case'alter column':return this.alterColumn(e,s);case'rename':return this.renameTable(e,s);case'rename column':return this.renameColumn(e,s)
;case'rename constraint':return this.renameConstraint(e,s);case'drop column':return this.dropColumn(e,s);case'drop constraint':return this.dropConstraint(e,s);case'owner':return this.setTableOwner(e,s);default:throw r.NotSupported.never(e)}}
dropColumn(e,s){return e}dropConstraint(e,s){return e}setTableOwner(e,s){return e}renameConstraint(e,s){return e}renameColumn(e,s){return e}renameTable(e,s){return e}alterColumn(e,s){let t;switch(e.alter.type){case'set default':
t=this.setColumnDefault(e.alter,s,e.column);break;case'set type':t=this.setColumnType(e.alter,s,e.column);break;case'drop default':case'set not null':case'drop not null':t=this.alterColumnSimple(e.alter,s,e.column);break;case'add generated':
t=this.alterColumnAddGenerated(e.alter,s,e.column);break;default:throw r.NotSupported.never(e.alter)}return t?a(e,{alter:t}):null}setColumnType(e,s,t){return a(e,{dataType:this.dataType(e.dataType)})}alterColumnAddGenerated(e,s,t){return e}
alterColumnSimple(e,s,t){return e}setColumnDefault(e,s,t){const r=this.expr(e.default);return r?a(e,{default:r}):null}addConstraint(e,s){return e}addColumn(e,s){const t=this.createColumn(e.column);return t?a(e,{column:t}):null}createColumn(e){var s
;const t=this.dataType(e.dataType);return t?a(e,{dataType:t,constraints:null!==(s=n(e.constraints,(e=>this.constraint(e))))&&void 0!==s?s:void 0}):null}select(e){switch(e.type){case'select':return this.selection(e);case'union':case'union all':
return this.union(e);case'with':return this.with(e);case'values':return this.values(e);case'with recursive':return this.withRecursive(e);default:throw r.NotSupported.never(e)}}selection(e){var s,t
;const r=n(e.from,(e=>this.from(e))),o=n(e.columns,(e=>this.selectionColumn(e))),l=e.where&&this.expr(e.where),p=n(e.groupBy,(e=>this.expr(e))),c=e.having&&this.expr(e.having),m=this.orderBy(e.orderBy),i=a(e.limit,{
limit:this.expr(null===(s=e.limit)||void 0===s?void 0:s.limit),offset:this.expr(null===(t=e.limit)||void 0===t?void 0:t.offset)});return a(e,{from:r,columns:o,where:l,groupBy:p,having:c,orderBy:m,limit:i})}orderBy(e){return n(e,(e=>{
const s=this.expr(e.by);return s?s===e.by?e:{...e,by:s}:null}))}union(e){const s=this.select(e.left),t=this.select(e.right);return s&&t?a(e,{left:s,right:t}):null!=s?s:t}with(e){const s=n(e.bind,(e=>{const s=this.statement(e.statement);return o(s)?a(e,{
statement:s}):null}));if(!s)return null;const t=this.statement(e.in);return o(t)?a(e,{bind:s,in:t}):null}withRecursive(e){const s=this.union(e.bind);if(!s)return null;if('union'!==s.type&&'union all'!==s.type)return null;const t=this.statement(e.in)
;return o(t)?a(e,{bind:s,in:t}):null}from(e){switch(e.type){case'table':return this.fromTable(e);case'statement':return this.fromStatement(e);case'call':return this.fromCall(e);default:throw r.NotSupported.never(e)}}fromCall(e){const s=this.call(e)
;return s&&'call'===s.type?a(e,s):null}fromStatement(e){const s=this.select(e.statement);return s?a(e,{statement:s,join:e.join&&this.join(e.join)}):null}values(e){const s=n(e.values,(e=>n(e,(e=>this.expr(e)))));return(null==s?void 0:s.length)?a(e,{
values:s}):null}join(e){const s=e.on&&this.expr(e.on);return s||e.using?a(e,{on:s}):e}fromTable(e){const s=this.tableRef(e.name);return s?a(e,{name:s,join:e.join&&this.join(e.join)}):null}selectionColumn(e){const s=this.expr(e.expr);return s?a(e,{expr:s
}):null}expr(e){if(!e)return e;switch(e.type){case'binary':return this.binary(e);case'unary':return this.unary(e);case'ref':return this.ref(e);case'string':case'numeric':case'integer':case'boolean':case'constant':case'null':return this.constant(e)
;case'list':case'array':return this.array(e);case'array select':return this.arraySelect(e);case'call':return this.call(e);case'cast':return this.cast(e);case'case':return this.case(e);case'member':return this.member(e);case'arrayIndex':
return this.arrayIndex(e);case'ternary':return this.ternary(e);case'select':case'union':case'union all':case'with':case'with recursive':return this.select(e);case'keyword':return this.valueKeyword(e);case'parameter':return this.parameter(e);case'extract':
return this.extract(e);case'overlay':return this.callOverlay(e);case'substring':return this.callSubstring(e);case'values':return this.values(e);case'default':return this.default(e);default:throw r.NotSupported.never(e)}}arraySelect(e){
const s=this.select(e.select);return s?a(e,{select:s}):null}extract(e){const s=this.expr(e.from);return s?a(e,{from:s}):null}valueKeyword(e){return e}ternary(e){const s=this.expr(e.value),t=this.expr(e.lo),r=this.expr(e.hi);return s&&t&&r?a(e,{value:s,
lo:t,hi:r}):null}parameter(e){return e}arrayIndex(e){const s=this.expr(e.array),t=this.expr(e.index);return s&&t?a(e,{array:s,index:t}):null}member(e){const s=this.expr(e.operand);return s?a(e,{operand:s}):null}case(e){
const s=e.value&&this.expr(e.value),t=n(e.whens,(e=>{const s=this.expr(e.when),t=this.expr(e.value);return s&&t?a(e,{value:t,when:s}):null}));return(null==t?void 0:t.length)?a(e,{value:s,whens:t,else:e.else&&this.expr(e.else)}):null}cast(e){
const s=this.expr(e.operand);return s?a(e,{operand:s}):null}call(e){var s;const t=n(e.args,(e=>this.expr(e)));if(!t)return null;const r=this.orderBy(e.orderBy),o=this.expr(e.filter),l=e.withinGroup?[e.withinGroup]:void 0;return a(e,{args:t,orderBy:r,
filter:o,withinGroup:null===(s=this.orderBy(l))||void 0===s?void 0:s[0]})}callSubstring(e){return a(e,{value:this.expr(e.value),from:this.expr(e.from),for:this.expr(e.for)})}callOverlay(e){return a(e,{value:this.expr(e.value),placing:this.expr(e.placing),
from:this.expr(e.from),for:this.expr(e.for)})}array(e){const s=n(e.expressions,(e=>this.expr(e)));return s?a(e,{expressions:s}):null}constant(e){return e}default(e){return e}ref(e){return e}unary(e){const s=this.expr(e.operand);return s?a(e,{operand:s
}):null}binary(e){const s=this.expr(e.left),t=this.expr(e.right);return s&&t?a(e,{left:s,right:t}):null}}s.AstDefaultMapper=l;const p=l.prototype;for(const e of Object.getOwnPropertyNames(p)){const s=p[e]
;'constructor'!==e&&'super'!==e&&'function'==typeof s&&Object.defineProperty(p,e,{configurable:!1,get:()=>function(...t){var r;if(this.skipNext)return this.skipNext=!1,s.apply(this,t);const a=null===(r=this.wrapped)||void 0===r?void 0:r[e]
;return a?a.apply(this.wrapped,t):s.apply(this,t)}})}class c extends l{constructor(e){super(),this.parent=e}}for(const e of Object.getOwnPropertyNames(p)){const s=p[e]
;'constructor'!==e&&'super'!==e&&'function'==typeof s&&Object.defineProperty(c.prototype,e,{configurable:!1,get:()=>function(...e){return this.parent.skipNext=!0,s.apply(this.parent,e)}})}},function(e,s,t){'use strict'
;Object.defineProperty(s,'__esModule',{value:!0
}),s.sqlKeywords=void 0,s.sqlKeywords=['ALL','ANALYSE','ANALYZE','AND','ANY','ARRAY','AS','ASC','ASYMMETRIC','AUTHORIZATION','BINARY','BOTH','CASE','CAST','CHECK','COLLATE','COLLATION','CONCURRENTLY','CONSTRAINT','CREATE','CROSS','CURRENT_CATALOG','CURRENT_DATE','CURRENT_ROLE','CURRENT_SCHEMA','CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','DEFAULT','DEFERRABLE','DESC','DISTINCT','DO','ELSE','END','EXCEPT','FALSE','FETCH','FOR','FOREIGN','FREEZE','FROM','FULL','GRANT','GROUP','HAVING','ILIKE','IN','INITIALLY','INNER','INTERSECT','INTO','IS','ISNULL','JOIN','LATERAL','LEADING','LEFT','LIKE','LIMIT','LOCALTIME','LOCALTIMESTAMP','NATURAL','NOT','NOTNULL','NULL','OFFSET','ON','ONLY','OR','ORDER','OUTER','OVERLAPS','PLACING','PRIMARY','REFERENCES','RETURNING','RIGHT','SELECT','SESSION_USER','SIMILAR','SOME','SYMMETRIC','TABLE','TABLESAMPLE','THEN','TO','TRAILING','TRUE','UNION','UNIQUE','USER','USING','VARIADIC','VERBOSE','WHEN','WHERE','WINDOW','WITH','PRECISION']
},function(e,s,t){'use strict';Object.defineProperty(s,'__esModule',{value:!0}),s.intervalToString=s.normalizeInterval=s.buildInterval=void 0;const r=[['years',12],['months',30],['days',24],['hours',60],['minutes',60],['seconds',1e3],['milliseconds',0]]
;function*a(e){if('number'==typeof e[1])yield e;else for(const s of e)yield*a(s)}function n(e){var s,t,a,n,o,l,p,c,m;const i={...e};for(let e=0;e<r.length;e++){const[n,o]=r[e],l=null!==(s=i[n])&&void 0!==s?s:0,p=l>=0?Math.floor(l):Math.ceil(l)
;if(!l||p===l)continue;const c=null===(t=r[e+1])||void 0===t?void 0:t[0];c&&(i[c]=(null!==(a=i[c])&&void 0!==a?a:0)+o*(l-p)),i[n]=p}if(i.months||i.years){const e=(null!==(n=i.months)&&void 0!==n?n:0)+12*(null!==(o=i.years)&&void 0!==o?o:0);i.months=e%12,
i.years=(e-i.months)/12}let $=3600*(null!==(l=i.hours)&&void 0!==l?l:0)+60*(null!==(p=i.minutes)&&void 0!==p?p:0)+(null!==(c=i.seconds)&&void 0!==c?c:0)+(null!==(m=i.milliseconds)&&void 0!==m?m:0)/1e3,_=1;$<0&&(_=-1,$=-$),
$>=3600?(i.hours=_*Math.floor($/3600),$-=_*i.hours*3600):delete i.hours,$>=60?(i.minutes=_*Math.floor($/60),$-=_*i.minutes*60):delete i.minutes,$>0?(i.seconds=_*Math.floor($),$-=_*i.seconds):delete i.seconds,
$>0?i.milliseconds=_*Math.round(1e3*$):delete i.milliseconds;for(const[e]of r)i[e]||delete i[e];return i}function o(e){return(e=Math.abs(e))<10?'0'+e:e.toString()}function l(e){return e&&e<0}s.buildInterval=function(e,s){var t;const r={}
;if('invalid'===s)throw new Error(`invalid input syntax for type interval: "${e}"`);for(const[e,n]of a(s))r[e]=(null!==(t=r[e])&&void 0!==t?t:0)+n;return r},s.normalizeInterval=n,s.intervalToString=function(e){var s,t,r;const a=[]
;if((e=n(e)).years&&a.push(1===e.years?'1 year':e.years+' years'),e.months&&a.push(1===e.months?'1 month':e.months+' months'),e.days&&a.push(1===e.days?'1 day':e.days+' days'),e.hours||e.minutes||e.seconds||e.milliseconds){
let n=`${o(null!==(s=e.hours)&&void 0!==s?s:0)}:${o(null!==(t=e.minutes)&&void 0!==t?t:0)}:${o(null!==(r=e.seconds)&&void 0!==r?r:0)}`;e.milliseconds&&(n+=(e.milliseconds/1e3).toString().substr(1)),
(l(e.hours)||l(e.minutes)||l(e.seconds)||l(e.milliseconds))&&(n='-'+n),a.push(n)}return a.join(' ')}},function(e,s,t){'use strict';Object.defineProperty(s,'__esModule',{value:!0}),s.astVisitor=void 0;const r=t(2);class a{super(){return new o(this)}}
const n=r.AstDefaultMapper.prototype;for(const e of Object.getOwnPropertyNames(n)){const s=n[e];'constructor'!==e&&'super'!==e&&'function'==typeof s&&Object.defineProperty(a.prototype,e,{configurable:!1,get:()=>function(...t){const r=this.visitor[e]
;return r?(r.apply(this.visitor,t),t[0]):s.apply(this,t)}})}class o{constructor(e){this.parent=e}}for(const e of Object.getOwnPropertyNames(n)){const s=n[e];'constructor'!==e&&'super'!==e&&'function'==typeof s&&Object.defineProperty(o.prototype,e,{
configurable:!1,get:()=>function(...e){return s.apply(this.parent,e)}})}s.astVisitor=function(e){return(0,r.astMapper)((s=>{const t=new a;return t.mapper=s,t.visitor=e(t),t}))}},function(e,s,t){'use strict';Object.defineProperty(s,'__esModule',{value:!0
}),s.trimNullish=s.NotSupported=void 0;class r extends Error{constructor(e){super('Not supported'+(e?': '+e:''))}static never(e,s){return new r(`${null!=s?s:''} ${JSON.stringify(e)}`)}}s.NotSupported=r,s.trimNullish=function e(s,t=5){if(t<0)return s
;if(s instanceof Array&&s.forEach((s=>e(s,t-1))),'object'!=typeof s||s instanceof Date)return s;if(!s)return s;for(const r of Object.keys(s)){const a=s[r];null==a?delete s[r]:e(a,t-1)}return s}},function(e,s,t){'use strict'
;var r=this&&this.__createBinding||(Object.create?function(e,s,t,r){void 0===r&&(r=t);var a=Object.getOwnPropertyDescriptor(s,t);a&&!('get'in a?!s.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return s[t]}}),
Object.defineProperty(e,r,a)}:function(e,s,t,r){void 0===r&&(r=t),e[r]=s[t]}),a=this&&this.__exportStar||function(e,s){for(var t in e)'default'===t||Object.prototype.hasOwnProperty.call(s,t)||r(s,e,t)};Object.defineProperty(s,'__esModule',{value:!0}),
s.normalizeInterval=s.intervalToString=s.toSql=s.astMapper=s.assignChanged=s.arrayNilMap=s.astVisitor=s.parseWithComments=s.parseIntervalLiteral=s.parseGeometricLiteral=s.parseArrayLiteral=s.parseFirst=s.parse=void 0;var n=t(8)
;Object.defineProperty(s,'parse',{enumerable:!0,get:function(){return n.parse}}),Object.defineProperty(s,'parseFirst',{enumerable:!0,get:function(){return n.parseFirst}}),Object.defineProperty(s,'parseArrayLiteral',{enumerable:!0,get:function(){
return n.parseArrayLiteral}}),Object.defineProperty(s,'parseGeometricLiteral',{enumerable:!0,get:function(){return n.parseGeometricLiteral}}),Object.defineProperty(s,'parseIntervalLiteral',{enumerable:!0,get:function(){return n.parseIntervalLiteral}}),
Object.defineProperty(s,'parseWithComments',{enumerable:!0,get:function(){return n.parseWithComments}});var o=t(5);Object.defineProperty(s,'astVisitor',{enumerable:!0,get:function(){return o.astVisitor}});var l=t(2);Object.defineProperty(s,'arrayNilMap',{
enumerable:!0,get:function(){return l.arrayNilMap}}),Object.defineProperty(s,'assignChanged',{enumerable:!0,get:function(){return l.assignChanged}}),Object.defineProperty(s,'astMapper',{enumerable:!0,get:function(){return l.astMapper}});var p=t(19)
;Object.defineProperty(s,'toSql',{enumerable:!0,get:function(){return p.toSql}}),a(t(21),s);var c=t(4);Object.defineProperty(s,'intervalToString',{enumerable:!0,get:function(){return c.intervalToString}}),Object.defineProperty(s,'normalizeInterval',{
enumerable:!0,get:function(){return c.normalizeInterval}})},function(e,s,t){'use strict';var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,'__esModule',{value:!0}),
s.parseGeometricLiteral=s.parseIntervalLiteral=s.parseArrayLiteral=s.parse=s.parseWithComments=s.parseFirst=void 0;const a=t(9),n=r(t(10)),o=r(t(11)),l=r(t(13)),p=r(t(15)),c=r(t(17)),m=t(4),i=t(1);let $,_,b,y,u;function x(e,s){
$||($=a.Grammar.fromCompiled(n.default));const t='string'==typeof s?s:null==s?void 0:s.entry,r='string'==typeof s?null:s,o=()=>d(e,$,t);let l=(null==r?void 0:r.locationTracking)?(0,i.tracking)(o):o();return'string'==typeof s||Array.isArray(l)||(l=[l]),l}
function d(e,s,t){try{s.start=null!=t?t:'main';const r=new a.Parser(s);r.feed(e);const n=r.finish();if(!n.length)throw new Error('Unexpected end of input')
;if(1!==n.length)throw new Error(`💀 Ambiguous SQL syntax: Please file an issue stating the request that has failed at https://github.com/oguimbal/pgsql-ast-parser:\n\n ${e}\n\n `);return n[0]}catch(e){
if('string'!=typeof(null==e?void 0:e.message))throw e;let s=e.message,t=null;const r=[],a=/A (.+) token based on:/g;let n;for(;n=a.exec(s);)t=null!=t?t:s.substr(0,n.index),r.push(` - A "${n[1]}" token`);throw t&&(s=t+r.join('\n')+'\n\n'),e.message=s,e}
}s.parseFirst=function(e){return x(e)[0]},s.parseWithComments=function(e,s){return(0,i.trackingComments)((()=>x(e,s)))},s.parse=x,s.parseArrayLiteral=function(e){return _||(_=a.Grammar.fromCompiled(o.default)),d(e,_)},s.parseIntervalLiteral=function(e){
if(e.startsWith('P'))return u||(u=a.Grammar.fromCompiled(c.default)),(0,m.buildInterval)(e,d(e,u));{y||(y=a.Grammar.fromCompiled(p.default));const s=e.toLowerCase();return(0,m.buildInterval)(e,d(s,y))}},s.parseGeometricLiteral=function(e,s){
return b||(b=a.Grammar.fromCompiled(l.default)),d(e,b,s)}},function(e,s){e.exports=t(58515)},function(e,s,t){'use strict';function r(e){return e[0]}Object.defineProperty(s,'__esModule',{value:!0});const a=t(1),n=t(1);function o(e){return l(e,void 0)}
function l(e,s){const t=y(e);return s&&0!==s.length?(0,n.track)(e,{name:t,columns:s.map((e=>({name:y(e)})))}):(0,n.track)(e,{name:t})}function p(e){const s=y(e);return(0,n.track)(e,{value:s})}function c(e){
return Array.isArray(e)&&1===e.length&&(e=c(e[0])),Array.isArray(e)&&!e.length?null:(0,n.unbox)(e)}const m=e=>s=>(0,n.track)(s,s[e]),i=e=>Array.isArray(e)?(0,n.track)(e[e.length-1],e[e.length-1]):e;function $(e){if(Array.isArray(e)){const s=[]
;for(const t of e)s.push(...$(t));return s}return e?[e]:[]}function _(e){var s;return null!==(s=null==(e=(0,n.unbox)(e))?void 0:e.value)&&void 0!==s?s:e}function b(e){return $((0,
n.unbox)(e)).filter((e=>!!e)).map((e=>_(e))).filter((e=>'string'==typeof e)).map((e=>e.trim())).filter((e=>!!e))}function y(e,s){return b(e).join(s||'')}function u(e){const s={};for(const[t,r]of e)s[t]=r;return s}const x={sensitivity:'accent'
},d=e=>(s,t,r)=>{const a=_(s[0]);return o=e,0===a.localeCompare(o,void 0,x)?(0,n.box)(s,e):r;var o},w=d,f=(...e)=>{const s=new Set(e);return(e,t,r)=>{const a='string'==typeof e[0]?e[0]:e[0].value;return s.has(a)?a:r}};function h(e,s){
const t=new Set,r=s.map(n.unbox);for(const[s,a]of r){if(t.has(s))throw new Error('conflicting or redundant options');t.add(s),e[s]=(0,n.unbox)(a)}}const k={Lexer:a.lexerAny,ParserRules:[{name:'lparen',symbols:[a.lexerAny.has('lparen')?{type:'lparen'
}:lparen]},{name:'rparen',symbols:[a.lexerAny.has('rparen')?{type:'rparen'}:rparen]},{name:'number$subexpression$1',symbols:['float']},{name:'number$subexpression$1',symbols:['int']},{name:'number',symbols:['number$subexpression$1'],postprocess:c},{
name:'dot',symbols:[a.lexerAny.has('dot')?{type:'dot'}:dot],postprocess:r},{name:'float',symbols:[a.lexerAny.has('float')?{type:'float'}:float],postprocess:e=>(0,n.box)(e,parseFloat(c(e)))},{name:'int',symbols:[a.lexerAny.has('int')?{type:'int'}:int],
postprocess:e=>(0,n.box)(e,parseInt(c(e),10))},{name:'comma',symbols:[a.lexerAny.has('comma')?{type:'comma'}:comma],postprocess:r},{name:'star',symbols:[a.lexerAny.has('star')?{type:'star'}:star],postprocess:e=>(0,n.box)(e,e[0].value)},{
name:'string$subexpression$1',symbols:[a.lexerAny.has('string')?{type:'string'}:string]},{name:'string$subexpression$1',symbols:[a.lexerAny.has('eString')?{type:'eString'}:eString]},{name:'string',symbols:['string$subexpression$1'],postprocess:e=>(0,
n.box)(e,c(e[0]).value)},{name:'ident',symbols:['word'],postprocess:m(0)},{name:'word',symbols:[a.lexerAny.has('kw_primary')?{type:'kw_primary'}:kw_primary],postprocess:e=>(0,n.box)(e,'primary')},{name:'word',symbols:[a.lexerAny.has('kw_unique')?{
type:'kw_unique'}:kw_unique],postprocess:e=>(0,n.box)(e,'unique')},{name:'word',symbols:[a.lexerAny.has('quoted_word')?{type:'quoted_word'}:quoted_word],postprocess:e=>(0,n.box)(e,e[0].value,!0)},{name:'word',symbols:[a.lexerAny.has('word')?{type:'word'
}:word],postprocess:e=>(0,n.box)(e,e[0].value)},{name:'collist_paren',symbols:['lparen','collist','rparen'],postprocess:m(1)},{name:'collist$ebnf$1',symbols:[]},{name:'collist$ebnf$1$subexpression$1',symbols:['comma','ident'],postprocess:i},{
name:'collist$ebnf$1',symbols:['collist$ebnf$1','collist$ebnf$1$subexpression$1'],postprocess:e=>e[0].concat([e[1]])},{name:'collist',symbols:['ident','collist$ebnf$1'],postprocess:([e,s])=>[e,...s||[]]},{name:'kw_between',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('between')},{name:'kw_conflict',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('conflict')},{name:'kw_nothing',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('nothing')},{name:'kw_begin',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('begin')},{name:'kw_if',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('if')},{name:'kw_exists',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('exists')},{name:'kw_key',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('key')},{name:'kw_index',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('index')},{name:'kw_extension',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('extension')},{name:'kw_schema',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('schema')},{name:'kw_nulls',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('nulls')},{name:'kw_first',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('first')},{name:'kw_last',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('last')},{name:'kw_start',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('start')},{name:'kw_restart',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('restart')},{name:'kw_filter',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('filter')},{name:'kw_commit',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('commit')},{name:'kw_tablespace',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('tablespace')},{name:'kw_transaction',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('transaction')},{name:'kw_work',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('work')},{name:'kw_read',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('read')},{name:'kw_write',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('write')},{name:'kw_isolation',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('isolation')},{name:'kw_level',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('level')},{name:'kw_serializable',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('serializable')},{name:'kw_rollback',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('rollback')},{name:'kw_insert',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('insert')},{name:'kw_value',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('value')},{name:'kw_values',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('values')},{name:'kw_update',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('update')},{name:'kw_column',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('column')},{name:'kw_set',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('set')},{name:'kw_version',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('version')},{name:'kw_alter',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('alter')},{name:'kw_rename',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('rename')},{name:'kw_sequence',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('sequence')},{name:'kw_temp',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('temp')},{name:'kw_temporary',symbols:[a.lexerAny.has('word')?{type:'word'}:word],
postprocess:d('temporary')},{name:'kw_add',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('add')},{name:'kw_owner',symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('owner')},{name:'kw_owned',
symbols:[a.lexerAny.has('word')?{type:'word'}:word],postprocess:d('owned')},{name:'kw_including',symbols:[a.lexerAny.has('word')?{type:'word