1 line
140 KiB
JavaScript
1 line
140 KiB
JavaScript
(()=>{var __webpack_modules__={1528:e=>{e.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]},3222:(e,t,n)=>{"use strict";var r=n(1528),i={nul:0,control:0};function o(e,t){return 0===e?t.nul:e<32||e>=127&&e<160?t.control:function(e){var t,n=0,i=r.length-1;if(e<r[0][0]||e>r[i][1])return!1;for(;i>=n;)if(t=Math.floor((n+i)/2),e>r[t][1])n=t+1;else{if(!(e<r[t][0]))return!0;i=t-1}return!1}(e)?0:1+(e>=4352&&(e<=4447||9001==e||9002==e||e>=11904&&e<=42191&&12351!=e||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))}e.exports=function(e){return function(e,t){if("string"!=typeof e)return o(e,t);for(var n=0,r=0;r<e.length;r++){var i=o(e.charCodeAt(r),t);if(i<0)return-1;n+=i}return n}(e,i)}},3568:(e,t,n)=>{const r=n(4285);class i extends Error{}function o(e,t=null){if(!e)throw t||(t="Assertion error"),new i(t)}class s{constructor(e,t,n,r,i,o,s){this.delim=e,this.policy=t,this.stop_on_warning=n,this.first_defective_line=null,this.records=r?[]:null,this.collect_records=r,this.num_records_parsed=0,this.fields_info=new Map,this.first_trailing_space_line=null,this.detect_trailing_spaces=o,this.preserve_quotes_and_whitespaces=i,this.min_num_fields_for_autodetection=s}consume(e,t){let[n,i]=r.smart_split(e,this.delim,this.policy,this.preserve_quotes_and_whitespaces);if(i&&(null===this.first_defective_line&&(this.first_defective_line=t),this.stop_on_warning))return!1;if(this.detect_trailing_spaces&&null===this.first_trailing_space_line)for(let e of n)!e.length||" "!=e.charAt(0)&&" "!=e.charAt(e.length-1)||(this.first_trailing_space_line=t);if(!this.fields_info.has(n.length)&&(this.fields_info.set(n.length,this.num_records_parsed),-1!=this.min_num_fields_for_autodetection)){if(n.length<this.min_num_fields_for_autodetection)return!1;if(this.fields_info.size>1)return!1}return this.collect_records&&this.records.push(n),this.num_records_parsed+=1,!0}}e.exports.parse_document_records=function(e,t,n,i=null,a=!1,l=-1,u=!0,_=!1,c=!1,f=-1){let p=e.lineCount,h=0,d=new r.MultilineRecordAggregator(i),g=new s(t,n,a,u,_,c,f),m=[];for(let t=0;t<p;++t){let r=e.lineAt(t).text;if(t+1>=p&&""==r){u&&m.push({record_num:g.num_records_parsed,comment_text:r});break}let o=null;if("quoted_rfc"==n){if(d.add_line(r),d.has_comment_line){h=t+1,d.reset(),u&&m.push({record_num:g.num_records_parsed,comment_text:r});continue}if(!d.has_full_record)continue;o=d.get_full_line("\n"),d.reset()}else{if(i&&r.startsWith(i)){h=t+1,u&&m.push({record_num:g.num_records_parsed,comment_text:r});continue}o=r}if(!g.consume(o,h))return[g.records,g.num_records_parsed,g.fields_info,g.first_defective_line,g.first_trailing_space_line,m];if(h=t+1,-1!==l&&g.num_records_parsed>=l)return[g.records,g.num_records_parsed,g.fields_info,g.first_defective_line,g.first_trailing_space_line,m]}return d.is_inside_multiline_record()&&(o("quoted_rfc"==n),g.consume(d.get_full_line("\n"),h)),[g.records,g.num_records_parsed,g.fields_info,g.first_defective_line,g.first_trailing_space_line,m]},e.exports.assert=o},8075:(e,t,n)=>{"use strict";var r=n(453),i=n(487),o=i(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&o(e,".prototype.")>-1?i(n):n}},487:(e,t,n)=>{"use strict";var r=n(6743),i=n(453),o=n(6897),s=n(9675),a=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||r.call(l,a),_=n(655),c=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new s("a function is required");var t=u(r,l,arguments);return o(t,1+c(0,e.length-(arguments.length-1)),!0)};var f=function(){return u(r,a,arguments)};_?_(e.exports,"apply",{value:f}):e.exports.apply=f},41:(e,t,n)=>{"use strict";var r=n(655),i=n(8068),o=n(9675),s=n(5795);e.exports=function(e,t,n){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,_=arguments.length>6&&arguments[6],c=!!s&&s(e,t);if(r)r(e,t,{configurable:null===u&&c?c.configurable:!u,enumerable:null===a&&c?c.enumerable:!a,value:n,writable:null===l&&c?c.writable:!l});else{if(!_&&(a||l||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},655:(e,t,n)=>{"use strict";var r=n(453)("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch(e){r=!1}e.exports=r},1237:e=>{"use strict";e.exports=EvalError},9383:e=>{"use strict";e.exports=Error},9290:e=>{"use strict";e.exports=RangeError},9538:e=>{"use strict";e.exports=ReferenceError},8068:e=>{"use strict";e.exports=SyntaxError},9675:e=>{"use strict";e.exports=TypeError},5345:e=>{"use strict";e.exports=URIError},2682:(e,t,n)=>{"use strict";var r=n(9600),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=n),"[object Array]"===i.call(e)?function(e,t,n){for(var r=0,i=e.length;r<i;r++)o.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,s):"string"==typeof e?function(e,t,n){for(var r=0,i=e.length;r<i;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,s):function(e,t,n){for(var r in e)o.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,s)}},9353:e=>{"use strict";var t=Object.prototype.toString,n=Math.max,r=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n};e.exports=function(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,s=function(e,t){for(var n=[],r=1,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n}(arguments),a=n(0,i.length-s.length),l=[],u=0;u<a;u++)l[u]="$"+u;if(o=Function("binder","return function ("+function(e,t){for(var n="",r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=",");return n}(l)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var t=i.apply(this,r(s,arguments));return Object(t)===t?t:this}return i.apply(e,r(s,arguments))})),i.prototype){var _=function(){};_.prototype=i.prototype,o.prototype=new _,_.prototype=null}return o}},6743:(e,t,n)=>{"use strict";var r=n(9353);e.exports=Function.prototype.bind||r},453:(e,t,n)=>{"use strict";var r,i=n(9383),o=n(1237),s=n(9290),a=n(9538),l=n(8068),u=n(9675),_=n(5345),c=Function,f=function(e){try{return c('"use strict"; return ('+e+").constructor;")()}catch(e){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(e){p=null}var h=function(){throw new u},d=p?function(){try{return h}catch(e){try{return p(arguments,"callee").get}catch(e){return h}}}():h,g=n(4039)(),m=n(24)(),y=Object.getPrototypeOf||(m?function(e){return e.__proto__}:null),b={},w="undefined"!=typeof Uint8Array&&y?y(Uint8Array):r,x={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":g&&y?y([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":b,"%AsyncGenerator%":b,"%AsyncGeneratorFunction%":b,"%AsyncIteratorPrototype%":b,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":c,"%GeneratorFunction%":b,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&y?y(y([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&y?y((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":s,"%ReferenceError%":a,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&y?y((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&y?y(""[Symbol.iterator]()):r,"%Symbol%":g?Symbol:r,"%SyntaxError%":l,"%ThrowTypeError%":d,"%TypedArray%":w,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":_,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(y)try{null.error}catch(e){var v=y(y(e));x["%Error.prototype%"]=v}var E=function e(t){var n;if("%AsyncFunction%"===t)n=f("async function () {}");else if("%GeneratorFunction%"===t)n=f("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=f("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&y&&(n=y(i.prototype))}return x[t]=n,n},R={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=n(6743),O=n(9957),A=S.call(Function.call,Array.prototype.concat),q=S.call(Function.apply,Array.prototype.splice),I=S.call(Function.call,String.prototype.replace),P=S.call(Function.call,String.prototype.slice),T=S.call(Function.call,RegExp.prototype.exec),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,k=/\\(\\)?/g,N=function(e,t){var n,r=e;if(O(R,r)&&(r="%"+(n=R[r])[0]+"%"),O(x,r)){var i=x[r];if(i===b&&(i=E(r)),void 0===i&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new l("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=P(e,0,1),n=P(e,-1);if("%"===t&&"%"!==n)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var r=[];return I(e,j,(function(e,t,n,i){r[r.length]=n?I(i,k,"$1"):t||e})),r}(e),r=n.length>0?n[0]:"",i=N("%"+r+"%",t),o=i.name,s=i.value,a=!1,_=i.alias;_&&(r=_[0],q(n,A([0,1],_)));for(var c=1,f=!0;c<n.length;c+=1){var h=n[c],d=P(h,0,1),g=P(h,-1);if(('"'===d||"'"===d||"`"===d||'"'===g||"'"===g||"`"===g)&&d!==g)throw new l("property names with quotes must have matching quotes");if("constructor"!==h&&f||(a=!0),O(x,o="%"+(r+="."+h)+"%"))s=x[o];else if(null!=s){if(!(h in s)){if(!t)throw new u("base intrinsic for "+e+" exists, but the property is not available.");return}if(p&&c+1>=n.length){var m=p(s,h);s=(f=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:s[h]}else f=O(s,h),s=s[h];f&&!a&&(x[o]=s)}}return s}},5795:(e,t,n)=>{"use strict";var r=n(453)("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(e){r=null}e.exports=r},592:(e,t,n)=>{"use strict";var r=n(655),i=function(){return!!r};i.hasArrayLengthDefineBug=function(){if(!r)return null;try{return 1!==r([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},24:e=>{"use strict";var t={__proto__:null,foo:{}},n=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof n)}},4039:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(1333);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&i()}},1333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},9092:(e,t,n)=>{"use strict";var r=n(1333);e.exports=function(){return r()&&!!Symbol.toStringTag}},9957:(e,t,n)=>{"use strict";var r=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=n(6743);e.exports=o.call(r,i)},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},7244:(e,t,n)=>{"use strict";var r=n(9092)(),i=n(8075)("Object.prototype.toString"),o=function(e){return!(r&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},9600:e=>{"use strict";var t,n,r=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw n}}),n={},i((function(){throw 42}),null,t)}catch(e){e!==n&&(i=null)}else i=null;var o=/^\s*class\b/,s=function(e){try{var t=r.call(e);return o.test(t)}catch(e){return!1}},a=function(e){try{return!s(e)&&(r.call(e),!0)}catch(e){return!1}},l=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,_=!(0 in[,]),c=function(){return!1};if("object"==typeof document){var f=document.all;l.call(f)===l.call(document.all)&&(c=function(e){if((_||!e)&&(void 0===e||"object"==typeof e))try{var t=l.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=i?function(e){if(c(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{i(e,null,t)}catch(e){if(e!==n)return!1}return!s(e)&&a(e)}:function(e){if(c(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return a(e);if(s(e))return!1;var t=l.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&a(e)}},8184:(e,t,n)=>{"use strict";var r,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=n(9092)(),l=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!l)return!1;if(void 0===r){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();r=!!t&&l(t)}return l(e)===r}},5680:(e,t,n)=>{"use strict";var r=n(5767);e.exports=function(e){return!!r(e)}},6578:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},5606:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,l=[],u=!1,_=-1;function c(){u&&a&&(u=!1,a.length?l=a.concat(l):_=-1,l.length&&f())}function f(){if(!u){var e=s(c);u=!0;for(var t=l.length;t;){for(a=l,l=[];++_<t;)a&&a[_].run();_=-1,t=l.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function h(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||u||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},6897:(e,t,n)=>{"use strict";var r=n(453),i=n(41),o=n(592)(),s=n(5795),a=n(9675),l=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new a("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,u=!0;if("length"in e&&s){var _=s(e,"length");_&&!_.configurable&&(r=!1),_&&!_.writable&&(u=!1)}return(r||u||!n)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},1135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},9032:(e,t,n)=>{"use strict";var r=n(7244),i=n(8184),o=n(5767),s=n(5680);function a(e){return e.call.bind(e)}var l="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,_=a(Object.prototype.toString),c=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),p=a(Boolean.prototype.valueOf);if(l)var h=a(BigInt.prototype.valueOf);if(u)var d=a(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function m(e){return"[object Map]"===_(e)}function y(e){return"[object Set]"===_(e)}function b(e){return"[object WeakMap]"===_(e)}function w(e){return"[object WeakSet]"===_(e)}function x(e){return"[object ArrayBuffer]"===_(e)}function v(e){return"undefined"!=typeof ArrayBuffer&&(x.working?x(e):e instanceof ArrayBuffer)}function E(e){return"[object DataView]"===_(e)}function R(e){return"undefined"!=typeof DataView&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=r,t.isGeneratorFunction=i,t.isTypedArray=s,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):s(e)||R(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},m.working="undefined"!=typeof Map&&m(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=R;var S="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function O(e){return"[object SharedArrayBuffer]"===_(e)}function A(e){return void 0!==S&&(void 0===O.working&&(O.working=O(new S)),O.working?O(e):e instanceof S)}function q(e){return g(e,c)}function I(e){return g(e,f)}function P(e){return g(e,p)}function T(e){return l&&g(e,h)}function j(e){return u&&g(e,d)}t.isSharedArrayBuffer=A,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===_(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===_(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===_(e)},t.isGeneratorObject=function(e){return"[object Generator]"===_(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===_(e)},t.isNumberObject=q,t.isStringObject=I,t.isBooleanObject=P,t.isBigIntObject=T,t.isSymbolObject=j,t.isBoxedPrimitive=function(e){return q(e)||I(e)||P(e)||T(e)||j(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(v(e)||A(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},537:(e,t,n)=>{var r=n(5606),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},o=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(u(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(e).replace(o,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])m(a)||!v(a)?s+=" "+a:s+=" "+u(a);return s},t.deprecate=function(e,n){if(void 0!==r&&!0===r.noDeprecation)return e;if(void 0===r)return function(){return t.deprecate(e,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(r.throwDeprecation)throw new Error(n);r.traceDeprecation?console.trace(n):console.error(n),i=!0}return e.apply(this,arguments)}};var s={},a=/^$/;if(r.env.NODE_DEBUG){var l=r.env.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+l+"$","i")}function u(e,n){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=_),f(r,e,r.depth)}function _(e,t){var n=u.styles[t];return n?"["+u.colors[n][0]+"m"+e+"["+u.colors[n][1]+"m":e}function c(e,t){return e}function f(e,n,r){if(e.customInspect&&n&&S(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=f(e,i,r)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}(e,n);if(o)return o;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),R(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(S(n)){var l=n.name?": "+n.name:"";return e.stylize("[Function"+l+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(R(n))return p(n)}var u,_="",c=!1,v=["{","}"];return d(n)&&(c=!0,v=["[","]"]),S(n)&&(_=" [Function"+(n.name?": "+n.name:"")+"]"),x(n)&&(_=" "+RegExp.prototype.toString.call(n)),E(n)&&(_=" "+Date.prototype.toUTCString.call(n)),R(n)&&(_=" "+p(n)),0!==s.length||c&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=c?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)I(t,String(s))?o.push(h(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))})),o}(e,n,r,a,s):s.map((function(t){return h(e,n,r,a,t,c)})),e.seen.pop(),function(e,t,n){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,_,v)):v[0]+_+v[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),I(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=m(n)?f(e,l.value,null):f(e,l.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.slice(1,-1),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function x(e){return v(e)&&"[object RegExp]"===O(e)}function v(e){return"object"==typeof e&&null!==e}function E(e){return v(e)&&"[object Date]"===O(e)}function R(e){return v(e)&&("[object Error]"===O(e)||e instanceof Error)}function S(e){return"function"==typeof e}function O(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!s[e])if(a.test(e)){var n=r.pid;s[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else s[e]=function(){};return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=n(9032),t.isArray=d,t.isBoolean=g,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=E,t.types.isDate=E,t.isError=R,t.types.isNativeError=R,t.isFunction=S,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(1135);var q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(n=[A((e=new Date).getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":"),[e.getDate(),q[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(6698),t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function T(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,r){e?n(e):t(r)}));try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),P&&Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=P,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var i=t.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};e.apply(this,t).then((function(e){r.nextTick(s.bind(null,null,e))}),(function(e){r.nextTick(T.bind(null,e,s))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},5767:(e,t,n)=>{"use strict";var r=n(2682),i=n(9209),o=n(487),s=n(8075),a=n(5795),l=s("Object.prototype.toString"),u=n(9092)(),_="undefined"==typeof globalThis?n.g:globalThis,c=i(),f=s("String.prototype.slice"),p=Object.getPrototypeOf,h=s("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n<e.length;n+=1)if(e[n]===t)return n;return-1},d={__proto__:null};r(c,u&&a&&p?function(e){var t=new _[e];if(Symbol.toStringTag in t){var n=p(t),r=a(n,Symbol.toStringTag);if(!r){var i=p(n);r=a(i,Symbol.toStringTag)}d["$"+e]=o(r.get)}}:function(e){var t=new _[e],n=t.slice||t.set;n&&(d["$"+e]=o(n))}),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!u){var t=f(l(e),8,-1);return h(c,t)>-1?t:"Object"===t&&function(e){var t=!1;return r(d,(function(n,r){if(!t)try{n(e),t=f(r,1)}catch(e){}})),t}(e)}return a?function(e){var t=!1;return r(d,(function(n,r){if(!t)try{"$"+n(e)===r&&(t=f(r,1))}catch(e){}})),t}(e):null}},785:(e,t,n)=>{var r=n(5606);const i=n(2196),o=n(9175),s=n(7507),a=n(9022),l=n(6945),u=n(4285),_=n(3568),c=n(3222),f=-1,p=/^([0-9]+)(\.[0-9]+)?$/,h="quoted_rfc",d="quoted",g=1;class m extends Error{}function y(e,t=null){if(!e)throw t||(t="Assertion error"),new m(t)}function b(e,t,n,r){let i=r?c(e):e.length;if(n.has_wide_chars=n.has_wide_chars||i!=e.length,n.max_total_length=Math.max(n.max_total_length,i),n.max_int_length==f)return;let o=p.exec(e);if(null===o)return void(!t&&e.length&&(n.max_int_length=f,n.max_fractional_length=f));let s=o[1].length;n.max_int_length=Math.max(n.max_int_length,s);let a=void 0===o[2]?0:o[2].length;n.max_fractional_length=Math.max(n.max_fractional_length,a)}function w(e,t,n,r){e=e.trim();let i=n.has_wide_chars?c(e):e.length;if(n.max_int_length==f){let t=Math.max(n.max_total_length-i,0);return r?e:e+" ".repeat(t+g)}if(t&&null===p.exec(e)){let t=Math.max(n.max_total_length-i,0);return r?e:e+" ".repeat(t+g)}let o=e.indexOf("."),s=-1==o?e.length:o,a=-1==o?0:e.length-o,l=Math.max(n.max_int_length-s,0),u=Math.max(n.max_fractional_length-a),_=r?"":" ".repeat(u+g);return" ".repeat(l)+e+_}function x(e,t,n,r,i){let o=w(e,t,n,i);return r&&(o=" ".repeat(n.start_offset)+o),o}class v{constructor(e,t){this.records=e,this.comments=t,this.nr=0,this.next_comment=0}get_next(){if(this.has_comments_left()&&(!this.has_records_left()||this.comments[this.next_comment].record_num<=this.nr)){let e=[null,this.comments[this.next_comment].comment_text];return this.next_comment+=1,e}if(this.has_records_left()){let e=[this.records[this.nr],null];return this.nr+=1,e}return[null,null]}has_comments_left(){return this.next_comment<this.comments.length}has_records_left(){return this.nr<this.records.length}has_entries_left(){return this.has_comments_left()||this.has_records_left()}}function E(e){return"rbql_table_name:"+e}function R(e,t,n){var r,a="~"===(r=n).charAt(0)?s.join(i.homedir(),r.slice(1)):r;if(o.existsSync(a))return a;if(t&&!s.isAbsolute(a)&&(a=s.join(t,a),o.existsSync(a)))return a;let l=e?e.get(E(n)):null;return l&&o.existsSync(l)?l:null}class S extends Error{}class O extends a.RBQLInputIterator{constructor(e,t,n,r=!1,i=null,o="input",s="a"){super(),this.has_header=r,this.table_name=o,this.variable_prefix=s,this.NR=0,this.NL=0;let a="quoted_rfc"==n,[l,u]=[null,null];if([this.records,l,this.fields_info,this.first_defective_line,this._first_trailing_space_line,u]=_.parse_document_records(e,t,n,i,a),a&&null!==this.first_defective_line)throw new S(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.records.length}, line ${this.first_defective_line}`);this.first_record=this.records.length?this.records[0]:[],this.next_record_index=0}stop(){}async get_variables_map(e){let t=new Object;return a.parse_basic_variables(e,this.variable_prefix,t),a.parse_array_variables(e,this.variable_prefix,t),this.has_header&&(a.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),a.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return this.has_header?this.first_record:null}do_get_record(){if(this.next_record_index>=this.records.length)return null;let e=this.records[this.next_record_index];return this.next_record_index+=1,e}async get_record(){return 0==this.NR&&this.has_header&&this.do_get_record(),this.NR+=1,this.do_get_record()}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.fields_info.size>1&&e.push(function(e,t){let[n,r,i,o]=a.sample_first_two_inconsistent_records(t),s=`Number of fields in "${e}" table is not consistent: `;return s+=`e.g. record ${n+1} -> ${r} fields, record ${i+1} -> ${o} fields`,s}(this.table_name,this.fields_info)),e}}class A extends a.RBQLOutputWriter{constructor(e,t){if(super(),this.delim=e,this.policy=t,this.header_len=null,this.null_in_output=!1,this.delim_in_simple_output=!1,this.output_lines=[],"simple"==t)this.polymorphic_join=this.simple_join;else if("quoted"==t)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==t)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==t)this.polymorphic_join=this.mono_join;else{if("whitespace"!=t)throw new S("Unknown output csv policy");this.polymorphic_join=this.simple_join}}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return u.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return u.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new S('Unable to use "Monocolumn" output format: some records have more than one field');return e[0]}simple_join(e){var t=e.join(this.delim);return-1!=e.join("").indexOf(this.delim)&&(this.delim_in_simple_output=!0),t}normalize_fields(e){for(var t=0;t<e.length;t++)null==e[t]?(this.null_in_output=!0,e[t]=""):Array.isArray(e[t])&&(this.normalize_fields(e[t]),e[t]=e[t].join(this.sub_array_delim))}write(e){if(null!==this.header_len&&e.length!=this.header_len)throw new S(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${e.length}`);return this.normalize_fields(e),this.output_lines.push(this.polymorphic_join(e)),!0}async finish(){}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class q{constructor(){}get_iterator_by_table_id(e){throw new S("JOIN queries are currently not supported in vscode.dev web version.")}get_warnings(){return[]}}class I extends a.RBQLTableRegistry{constructor(e,t,n,r,i,o=!1,s=null,a=null){super(),this.vscode_global_state=e,this.input_file_dir=t,this.delim=n,this.policy=r,this.encoding=i,this.has_header=o,this.comment_prefix=s,this.stream=null,this.record_iterator=null,this.options=a,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=R(this.vscode_global_state,this.input_file_dir,e),null===this.table_path)throw new S(`Unable to find join table "${e}"`);return this.options&&this.options.bulk_read?this.bulk_input_path=this.table_path:this.stream=o.createReadStream(this.table_path),this.record_iterator=new l.CSVRecordIterator(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${s.basename(this.table_path)} was also treated as header (and skipped)`)}}function P(e,t,n,r,i,o){let s=[],a=i,l=0,u=0;for(let i=0;i<r.length;i++){let o=0,_=[];for(;;){let t=r[i].indexOf(n,o);if(-1==t)break;_.push(new e.Range(a,l,a,l+t-o)),a+=1,l=0,u=0,o=t+n.length}u+=r[i].length-o,i+1<r.length&&(u+=t),_.push(new e.Range(a,l,a,u)),s.push(_),l=u}return y(a==o),s}function T(e,t){let[n,r]=u.split_quoted_str(e+'x"',t);return!r}function j(e,t,n,r,i,o=null){null===o&&(o=50);let s=Math.max(0,i.start.line-o),a=Math.min(t.lineCount,i.end.line+o),l=[],_=new u.MultilineRecordAggregator(r);for(let r=s;r<a;r++){let i=t.lineAt(r).text;if(r+1==t.lineCount&&!i)break;let o=_.is_inside_multiline_record(),s=r-_.get_num_lines_in_record();_.add_line(i);let a=_.is_inside_multiline_record();if(!o&&a&&(T(i,n)||(l=[],_.reset())),_.has_comment_line)l.push({comment_range:new e.Range(r,0,r,i.length)}),_.reset();else if(_.has_full_record){const t="\r\n";let i=_.get_full_line(t);_.reset();let[o,a]=u.smart_split(i,n,d,!0);a||l.push({record_ranges:P(e,n.length,t,o,s,r)})}}return l}function k(e,t,n){if(!e.length)return null;for(var r=0,i=e[r].length+t;n>i&&r+1<e.length;)i=i+e[r+=1].length+t;return r}e.exports.make_table_name_key=E,e.exports.find_table_path=R,e.exports.read_header=async function(e,t){"latin-1"==t&&(t="binary");let r=n(7560).createInterface({input:o.createReadStream(e,{encoding:t})}),i=!1,s=null,a=null,l=new Promise((function(e,t){s=e,a=t}));return r.on("line",(e=>{i||(i=!0,r.close(),s(e))})),r.on("error",(e=>{a(e)})),l},e.exports.rbql_query_web=async function(e,t,n,r,i,o,s,l,u=null){let _=new q,c=new O(t,n,r,l,u),f=new A(i,o);return await a.query(e,c,f,s,_,""),f.output_lines},e.exports.rbql_query_node=async function(e,t,n,u,_,c,f,p,h,d,g=!1,m=null,y="",b=null){let w=null,x=null;b&&b.bulk_read&&n?x=n:w=null===n?r.stdin:o.createReadStream(n);let[v,E]=null===c?[r.stdout,!1]:[o.createWriteStream(c),!0];if('"'==u&&"quoted"==_)throw new S('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==h&&(h="binary"),!l.is_ascii(t)&&"binary"==h)throw new S("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(l.is_ascii(u)&&l.is_ascii(f)||"binary"!=h))throw new S("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let R=s.join(i.homedir(),".rbql_init_source.js");""==y&&o.existsSync(R)&&(y=l.read_user_init_code(R));let O=n?s.dirname(n):null,A=new I(e,O,u,_,h,g,m,b),q=new l.CSVRecordIterator(w,x,h,u,_,g,m),P=new l.CSVWriter(v,E,h,f,p);await a.query(t,q,P,d,A,y),A.get_warnings(d)},e.exports.get_header_line=function(e,t){const n=e.lineCount;for(let r=0;r<n;++r){const n=e.lineAt(r).text;if(!t||!n.startsWith(t))return[r,n]}return[null,null]},e.exports.get_default_js_udf_content=function(){return"// This file can be used to store RBQL UDFs. Example:\n //\n // function foo(value) {\n // return 'foo ' + String(value.length);\n // }\n // \n // Functions defined in this file can be used in RBQL queries e.g.\n // SELECT foo(a1), a2 WHERE foo(a3) != 'foo 5' LIMIT 10\n //\n // Don't forget to save this file after editing!\n //\n // Write your own functions below this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.get_default_python_udf_content=function(){return"# This file can be used to store RBQL UDFs. Example:\n #\n # def foo(value):\n # return 'foo ' + str(len(value))\n # \n # \n # Functions defined in this file can be used in RBQL queries e.g.\n # SELECT foo(a1), a2 WHERE foo(a3) != 'foo 5' LIMIT 10\n #\n # Don't forget to save this file after editing!\n #\n # Write your own functions below this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.align_columns=function(e,t,n,r){let i=[],o=!0,s=new v(e,t);for(;s.has_entries_left();){let[e,t]=s.get_next();if(y(null===t!=(null===e)),null===e){i.push(t);continue}let a=[];for(let t=0;t<e.length&&!(t>=n.length);t++){let s=!1,l=e[t].split("\n");for(let u=0;u<l.length;u++){u>0&&(i.push(a.join(r)),a=[],s=!0);let _=t+1==e.length||l.length>1&&u+1<l.length,c=x(l[u],o,n[t],s,_);s=!1,a.push(c)}}o=!1,i.push(a.join(r))}return i.join("\n")},e.exports.shrink_columns=function(e,t,n,r){let[i,o,s,a,l,u]=_.parse_document_records(e,t,n,r,!0,-1,!0,!0);if(null!==a)return[null,a+1];let c=[],f=!1,p=new v(i,u);for(;p.has_entries_left();){let[e,n]=p.get_next();if(y(null===n!=(null===e)),null===e){c.push(n);continue}let r=[];for(let n=0;n<e.length;n++){let i=e[n].split("\n");for(let e=0;e<i.length;e++){e>0&&(c.push(r.join(t)),r=[]);let n=i[e].trim();n.length!=i[e].length&&(f=!0),r.push(n)}}c.push(r.join(t))}return f?[c.join("\n"),null]:[null,null]},e.exports.calc_column_stats=function(e,t,n,r,i){let[o,s,a,l,u,c]=_.parse_document_records(e,t,n,r,!0,-1,!0,!0);if(null!==l)return[null,l+1,null,null];let p=[],h=!0,d=!1;for(let e of o){for(let t=0;t<e.length;t++){p.length<=t&&p.push({max_total_length:0,max_int_length:0,max_fractional_length:0,has_wide_chars:!1});let n=e[t];!d&&i&&(d=!/^[\x00-\x7F]*$/.test(n));let r=n.split("\n");r.length>1&&(p[t].max_int_length=f,p[t].max_fractional_length=f);for(let e of r)b(e.trim(),h,p[t],d)}h=!1}return[p,null,o,c]},e.exports.adjust_column_stats=function(e,t){let n=[];for(let r of e){if(r.max_int_length<=0&&(r.max_int_length=-1,r.max_fractional_length=-1),r.max_int_length>0&&(r.max_int_length+r.max_fractional_length>r.max_total_length&&(r.max_total_length=r.max_int_length+r.max_fractional_length),r.max_total_length-r.max_fractional_length>r.max_int_length&&(r.max_int_length=r.max_total_length-r.max_fractional_length),r.max_total_length!=r.max_int_length+r.max_fractional_length))return null;let e=n.length?n[n.length-1]:null;r.start_offset=null===e?0:e.start_offset+e.max_total_length+g+t,n.push(r)}return n},e.exports.update_subcomponent_stats=b,e.exports.align_field=w,e.exports.rfc_align_field=x,e.exports.assert=y,e.exports.get_field_by_line_position=k,e.exports.get_cursor_position_info=function(e,t,n,r,i,o){return null===r?null:r==h?function(e,t,n,r,i){let o=new e.Range(Math.max(i.line-20,0),0,i.line+20,0),s=j(e,t,n,r,o),a=null;for(let e of s)if(e.hasOwnProperty("comment_range"))e.comment_range.contains(i)&&(a={is_comment:!0});else for(let t=0;t<e.record_ranges.length;t++)for(let n of e.record_ranges[t])n.contains(i)&&(a={column_number:t,total_columns:e.record_ranges.length,split_warning:!1});return a}(e,t,n,i,o):function(e,t,n,r,i){var o=i.line,s=i.character,a=e.lineAt(o).text;if(r&&a.startsWith(r))return{is_comment:!0};let[l,_]=u.smart_split(a,t,n,!0);var c=k(l,t.length,s+1);return null==c?null:{column_number:c,total_columns:l.length,split_warning:_}}(t,n,r,i,o)},e.exports.format_cursor_position_info=function(e,t,n,r,i){if(e.is_comment)return r?["Comment","Comment"]:[null,null];let o="Col "+(e.column_number+1),s="[Rainbow CSV] "+o;if(n&&e.column_number<t.length){let n=t[e.column_number].trim(),r=n.substr(0,i);r!=n&&(r+="..."),o+=": "+r,s+=": "+n}return e.split_warning?s+="; ERR: Inconsistent double quotes in line":t.length!=e.total_columns&&(s+=`; WARN: Inconsistent num of fields, header: ${t.length}, this line: ${e.total_columns}`),[s,o]},e.exports.parse_document_range=function(e,t,n,r,i,o){return r==h?j(e,t,n,i,o):function(e,t,n,r,i,o){let s=[],a=Math.max(0,o.start.line-50),l=Math.min(t.lineCount,o.end.line+50);for(let o=a;o<l;o++){let a=[],l=t.lineAt(o).text;if(o+1==t.lineCount&&!l)break;if(i&&l.startsWith(i)){s.push({comment_range:new e.Range(o,0,o,l.length)});continue}let _=u.smart_split(l,n,r,!0)[0],c=0,f=0;for(let t=0;t<_.length;t++)f+=_[t].length,t+1<_.length&&(f+=n.length),a.push([new e.Range(o,c,o,f)]),c=f;s.push({record_ranges:a})}return s}(e,t,n,r,i,o)},e.exports.sample_preview_records_from_context=function(e,t,n,r){let[i,o,s,a]=[e.input_document,e.delim,e.policy,e.comment_prefix];e.requested_start_record=Math.max(e.requested_start_record,0);let l=s==h,[u,c]=function(e,t,n,r,i,o,s,a){let l=[],u=null,c=null,[f,p,h,d]=[null,null,null,null];if(i<5*o)[l,f,p,u,h,d]=_.parse_document_records(e,t,n,r,s,i,!0,!1);else{let i=!0;if(a.has(e.fileName)&&([l,u,c]=a.get(e.fileName),e.version===c&&(i=!1)),i){let[i,o,l,u,c,f]=_.parse_document_records(e,t,n,r,s,-1,!0,!1);a.set(e.fileName,[i,u,e.version])}[l,u,c]=a.get(e.fileName)}return[l,u]}(i,o,s,a,e.requested_start_record+n,n,l,r);if(null!==c&&s==h)return void(t.preview_sampling_error=`Double quotes are not consistent in record ${u.length+1} which starts at line ${c+1}`);e.requested_start_record=Math.max(0,Math.min(e.requested_start_record,u.length-n));let f=u.slice(e.requested_start_record,e.requested_start_record+n);for(let e=0;e<f.length;e++){let t=f[e];for(let e=0;e<t.length;e++)t[e].length>250&&(t[e]=t[e].substr(0,250)+"###UI_STRING_TRIM_MARKER###")}t.preview_records=f,t.actual_start_record=e.requested_start_record},e.exports.parse_document_range_rfc=j,e.exports.sample_first_two_inconsistent_records=a.sample_first_two_inconsistent_records,e.exports.is_opening_rfc_line=T,e.exports.show_lint_status_bar_button=function(e,t,n,r){const i="#f44242";let o=`${n}.${r}`;if(!t.lint_results.has(o))return;var s=t.lint_results.get(o);t.lint_status_bar_button||(t.lint_status_bar_button=e.window.createStatusBarItem(e.StatusBarAlignment.Left)),t.lint_status_bar_button.text="CSVLint";let l="";if(s.is_processing)t.lint_status_bar_button.color="#A0A0A0",t.lint_status_bar_button.text="$(clock) CSVLint",l="Processing";else if(Number.isInteger(s.first_defective_line))l=`Error. Line ${s.first_defective_line} has formatting error: double quote chars are not consistent`,t.lint_status_bar_button.color=i,t.lint_status_bar_button.text="$(error) CSVLint";else if(s.fields_info&&s.fields_info.size>1){let[e,n,r,o]=a.sample_first_two_inconsistent_records(s.fields_info);l=`Error. Number of fields is not consistent: e.g. record ${e+1} has ${n} fields, and record ${r+1} has ${o} fields`,t.lint_status_bar_button.color=i,t.lint_status_bar_button.text="$(error) CSVLint"}else Number.isInteger(s.first_trailing_space_line)?(l=`Leading/Trailing spaces detected: e.g. at line ${s.first_trailing_space_line+1}. Run "Shrink" command to remove them`,t.lint_status_bar_button.color="#ffff28",t.lint_status_bar_button.text="$(alert) CSVLint"):(y(s.is_ok),t.lint_status_bar_button.color="#62f442",t.lint_status_bar_button.text="$(pass) CSVLint",l="OK");t.lint_status_bar_button.tooltip=l+"\nClick to recheck",t.lint_status_bar_button.command="rainbow-csv.CSVLint",t.lint_status_bar_button.show()},e.exports.get_cursor_position_if_unambiguous=function(e){let t=e.selections;if(!t||1!=t.length)return null;let n=t[0],r=n.active;return r.isEqual(n.anchor)?r:null},e.exports.RecordCommentMerger=v,e.exports.generate_column_edit_selections=function(e,t,n,r,i,o,s){let[a,l,u,c,f,p]=_.parse_document_records(t,n,r,i,!0,-1,!0,!0);if(null!==c)return[null,`Unable to enter column edit mode: quoting error at line ${c+1}`,null];if(a.length+p.length!=t.lineCount)return[null,"Column edit mode is not supported for files with multiline fields",null];let g=0,m=[],b=null,w=new v(a,p);for(;w.has_entries_left();){let[t,i]=w.get_next();if(y(null===i!=(null===t)),null!==t){if(s>=t.length)return[null,`Line ${g+1} doesn't have field number ${s+1}`,null];let i=t.slice(0,s).join("").length+s*n.length,a=t.slice(0,s+1).join("").length+s*n.length,l=t.join(n);b||"ce_before"!=o||r!=d&&r!=h||-1==l.substring(i-2,i+2).indexOf('"')||(b=`Be careful, cursor at line ${g+1} has a double quote is in proximity.`),b||"ce_after"!=o||r!=d&&r!=h||-1==l.substring(a-2,a+2).indexOf('"')||(b=`Be careful, cursor at line ${g+1} has a double quote is in proximity.`),b||"ce_select"!=o||i!=a||(b=`Be careful, Field ${s+1} at line ${g+1} is empty.`);let u=new e.Position(g,i),_=new e.Position(g,a);"ce_before"==o&&m.push(new e.Selection(u,u)),"ce_after"==o&&m.push(new e.Selection(_,_)),"ce_select"==o&&m.push(new e.Selection(u,_))}g+=1}return[m,null,b]}},4285:e=>{let t='"((?:[^"]*"")*[^"]*)"',n=new RegExp("^"+t),r=new RegExp("^ *"+t+" *");function i(e,t,i,o,s,a){var l=!1;let u=e.substring(s),_=(o?r:n).exec(u);if(null!==_){let n=_[0].length;if(s+n==e.length||e[s+n]==t)return i?a.push(_[0]):a.push(_[1].replace(/""/g,'"')),[s+n+1,!1];l=!0}var c=e.indexOf(t,s);-1==c&&(c=e.length);var f=e.substring(s,c);return l=l||-1!=f.indexOf('"'),a.push(f),[c+1,l]}function o(e,t,n=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var r=[],o=0,s=!1;let a=" "!=t;for(;o<e.length;){var l=i(e,t,n,a,o,r);o=l[0],s=s||l[1]}return e.charAt(e.length-1)==t&&r.push(""),[r,s]}function s(e){let n=new RegExp("^ *"+t+" *$").exec(e);return null!==n?n[1].replace(/""/g,'"'):e}function a(e,t=!1){var n=t?new RegExp(" *[^ ]+ *","g"):new RegExp("[^ ]+","g");let r=[],i=null;for(;null!==(i=n.exec(e));)r.push(i[0]);if(t)for(let e=0;e<r.length-1;e++)r[e]=r[e].slice(0,-1);return r}e.exports.split_quoted_str=o,e.exports.split_whitespace_separated_str=a,e.exports.smart_split=function(e,t,n,r){return"simple"===n?[e.split(t),!1]:"whitespace"===n?[a(e,r),!1]:"monocolumn"===n?[[e],!1]:o(e,t,r)},e.exports.quote_field=function(e,t){return-1!=e.indexOf(t)||-1!=e.indexOf('"')?`"${e.replace(/"/g,'""')}"`:e},e.exports.rfc_quote_field=function(e,t){return-1!=e.indexOf(t)||-1!=e.indexOf('"')||-1!=e.indexOf("\n")||-1!=e.indexOf("\r")?`"${e.replace(/"/g,'""')}"`:e},e.exports.unquote_field=s,e.exports.unquote_fields=function(e){return e.map(s)},e.exports.split_lines=function(e){return e.split(/\r\n|\r|\n/)},e.exports.MultilineRecordAggregator=class{constructor(e){this.comment_prefix=e,this.reset()}add_line(e){if(this.has_full_record||this.has_comment_line)throw new Error("Invalid usage - record aggregator must be reset before adding new lines");if(this.comment_prefix&&0==this.rfc_line_buffer.length&&e.startsWith(this.comment_prefix))return this.has_comment_line=!0,!1;let t=e.match(/"/g),n=t&&t.length%2==1;return this.rfc_line_buffer.push(e),this.has_full_record=!n&&1==this.rfc_line_buffer.length||n&&this.rfc_line_buffer.length>1,this.has_full_record}is_inside_multiline_record(){return this.rfc_line_buffer.length&&!this.has_full_record}get_full_line(e){return this.rfc_line_buffer.join(e)}get_num_lines_in_record(){return this.rfc_line_buffer.length}reset(){this.rfc_line_buffer=[],this.has_full_record=!1,this.has_comment_line=!1}}},9022:(__unused_webpack_module,exports)=>{(function(exports){class RbqlParsingError extends Error{}class RbqlRuntimeError extends Error{}class AssertionError extends Error{}class RbqlIOHandlingError extends Error{}class InternalBadFieldError extends Error{constructor(e,...t){super(...t),this.bad_idx=e}}function assert(e,t=null){if(!e)throw t||(t="Assertion error"),new AssertionError(t)}function replace_all(e,t,n){return e.split(t).join(n)}class RBQLContext{constructor(e,t,n,r){this.query_text=e,this.input_iterator=t,this.writer=n,this.user_init_code=r,this.unnest_list=null,this.top_count=null,this.like_regex_cache=new Map,this.sort_key_expression=null,this.aggregation_stage=0,this.aggregation_key_expression=null,this.functional_aggregators=[],this.join_map_impl=null,this.join_map=null,this.lhs_join_var_expression=null,this.where_expression=null,this.select_expression=null,this.update_expressions=null,this.variables_init_code=null}}var query_context=null;const wrong_aggregation_usage_error="Usage of RBQL aggregation functions inside JavaScript expressions is not allowed, see the docs",RBQL_VERSION="0.27.0";function check_if_brackets_match(e,t){return"["==e&&"]"==t||"("==e&&")"==t||"{"==e&&"}"==t}function parse_root_bracket_level_text_spans(e){let t=[],n=0,r=[];for(let i=0;i<e.length;i++){let o=e[i];if(","==o&&0==r.length)t.push(e.substring(n,i)),n=i+1;else if(-1!=["[","{","("].indexOf(o))r.push(o);else if(-1!=["]","}",")"].indexOf(o)){if(!r.length||!check_if_brackets_match(r[r.length-1],o))throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing "${o}"`);r.pop()}}if(r.length)throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching closing bracket for opening "${r[0]}"`);return t.push(e.substring(n,e.length)),t=t.map((e=>e.trim())),t}function unquote_string(e){return!e||e.length<2?null:"'"==e[0]&&"'"==e[e.length-1]?e.substring(1,e.length-1).replace(/\\'/g,"'").replace(/\\\\/g,"\\"):'"'==e[0]&&'"'==e[e.length-1]?e.substring(1,e.length-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function column_info_from_text_span(e,t){e=e.trim();let n="__RBQL_INTERNAL_STAR",r=/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(e),i=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),o=/^([ab])\[([0-9]+)\]$/.exec(e),s=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e),a=/^(.*) (as|AS) +([a-zA-Z][a-zA-Z0-9_]*) *$/.exec(e);if(null!==a)return{table_name:null,column_index:null,column_name:null,is_star:!1,alias_name:a[3]};if(null!==r){if(e==n)return{table_name:null,column_index:null,column_name:null,is_star:!0,alias_name:null};if(e.startsWith("___RBQL_STRING_LITERAL"))return null;let t=/^([ab])([0-9]+)$/.exec(e);return null!==t?{table_name:t[1],column_index:parseInt(t[2])-1,column_name:null,is_star:!1,alias_name:null}:{table_name:null,column_index:null,column_name:e,is_star:!1,alias_name:null}}if(null!==i){let e=i[1],t=i[2];return t==n?{table_name:e,column_index:null,column_name:null,is_star:!0,alias_name:null}:{table_name:null,column_index:null,column_name:t,is_star:!1,alias_name:null}}if(null!=o)return{table_name:o[1],column_index:parseInt(o[2])-1,column_name:null,is_star:!1,alias_name:null};if(null!=s){s[1];let e=s[2];if(e<t.length){let n=unquote_string(t[e]);if(null!=n)return{table_name:null,column_index:null,column_name:n,is_star:!1,alias_name:null}}}return null}function adhoc_parse_select_expression_to_column_infos(e,t){return parse_root_bracket_level_text_spans(e).map((e=>column_info_from_text_span(e,t)))}function stable_compare(e,t){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1}function safe_get(e,t){return t<e.length?e[t]:null}function safe_join_get(e,t){if(t<e.length)return e[t];throw new InternalBadFieldError(t)}function safe_set(e,t,n){if(!(t<e.length))throw new InternalBadFieldError(t);e[t]=n}function regexp_escape(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function like_to_regex(e){let t=0,n=0,r="";for(;n<e.length;)"_"!=e.charAt(n)&&"%"!=e.charAt(n)||(r+=regexp_escape(e.substring(t,n)),t=n+1,"_"==e.charAt(n)?r+=".":r+=".*"),n+=1;return r+=regexp_escape(e.substring(t,n)),"^"+r+"$"}function like(e,t){let n=query_context.like_regex_cache.get(t);return void 0===n&&(n=new RegExp(like_to_regex(t)),query_context.like_regex_cache.set(t,n)),n.test(e)}const LIKE=like;class RBQLAggregationToken{constructor(e,t){this.marker_id=e,this.value=t}toString(){throw new RbqlParsingError(wrong_aggregation_usage_error)}}class UnnestMarker{}function UNNEST(e){if(null!==query_context.unnest_list)throw new RbqlParsingError("Only one UNNEST is allowed per query");return query_context.unnest_list=e,new UnnestMarker}const unnest=UNNEST,Unnest=UNNEST,UNFOLD=UNNEST;function parse_number(e){let t=Number(e);if(isNaN(t))throw new RbqlRuntimeError(`Unable to convert value "${e}" to a number. MIN, MAX, SUM, AVG, MEDIAN and VARIANCE aggregate functions convert their string arguments to numeric values`);return t}class AnyValueAggregator{constructor(){this.stats=new Map}increment(e,t){void 0===this.stats.get(e)&&this.stats.set(e,t)}get_final(e){return this.stats.get(e)}}class MinAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);void 0===n?this.stats.set(e,t):this.stats.set(e,Math.min(n,t))}get_final(e){return this.stats.get(e)}}class MaxAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);void 0===n?this.stats.set(e,t):this.stats.set(e,Math.max(n,t))}get_final(e){return this.stats.get(e)}}class SumAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);void 0===n?this.stats.set(e,t):this.stats.set(e,n+t)}get_final(e){return this.stats.get(e)}}class AvgAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);if(void 0===n)this.stats.set(e,[t,1]);else{var r=n[0],i=n[1];this.stats.set(e,[r+t,i+1])}}get_final(e){var t=this.stats.get(e);return t[0]/t[1]}}class VarianceAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);if(void 0===n)this.stats.set(e,[t,t*t,1]);else{var r=n[0],i=n[1],o=n[2];this.stats.set(e,[r+t,i+t*t,o+1])}}get_final(e){var t=this.stats.get(e),n=t[0],r=t[1],i=t[2],o=n/i;return r/i-o*o}}class MedianAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var n=this.stats.get(e);void 0===n?this.stats.set(e,[t]):n.push(t)}get_final(e){var t=this.stats.get(e);t.sort((function(e,t){return e-t}));var n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}}class CountAggregator{constructor(){this.stats=new Map}increment(e,t){var n=this.stats.get(e);void 0===n?this.stats.set(e,1):this.stats.set(e,n+1)}get_final(e){return this.stats.get(e)}}class ArrayAggAggregator{constructor(e=null){this.post_proc=e,this.stats=new Map}increment(e,t){let n=this.stats.get(e);void 0===n?this.stats.set(e,[t]):n.push(t)}get_final(e){let t=this.stats.get(e);return null===this.post_proc?t:this.post_proc(t)}}class ConstGroupVerifier{constructor(e){this.output_index=e,this.const_values=new Map}increment(e,t){var n=this.const_values.get(e);if(void 0===n)this.const_values.set(e,t);else if(n!=t)throw new RbqlRuntimeError(`Invalid aggregate expression: non-constant values in output column ${this.output_index+1}. E.g. "${n}" and "${t}"`)}get_final(e){return this.const_values.get(e)}}function init_aggregator(e,t,n=null){query_context.aggregation_stage=1;var r=new RBQLAggregationToken(query_context.functional_aggregators.length,t);return null===n?query_context.functional_aggregators.push(new e):query_context.functional_aggregators.push(new e(n)),r}function ANY_VALUE(e){return query_context.aggregation_stage<2?init_aggregator(AnyValueAggregator,e):e}const any_value=ANY_VALUE,Any_value=ANY_VALUE;function MIN(e){return query_context.aggregation_stage<2?init_aggregator(MinAggregator,e):e}const min=MIN,Min=MIN;function MAX(e){return query_context.aggregation_stage<2?init_aggregator(MaxAggregator,e):e}const max=MAX,Max=MAX;function COUNT(e){return query_context.aggregation_stage<2?init_aggregator(CountAggregator,1):1}const count=COUNT,Count=COUNT;function SUM(e){return query_context.aggregation_stage<2?init_aggregator(SumAggregator,e):e}const sum=SUM,Sum=SUM;function AVG(e){return query_context.aggregation_stage<2?init_aggregator(AvgAggregator,e):e}const avg=AVG,Avg=AVG;function VARIANCE(e){return query_context.aggregation_stage<2?init_aggregator(VarianceAggregator,e):e}const variance=VARIANCE,Variance=VARIANCE;function MEDIAN(e){return query_context.aggregation_stage<2?init_aggregator(MedianAggregator,e):e}const median=MEDIAN,Median=MEDIAN;function ARRAY_AGG(e,t=null){return query_context.aggregation_stage<2?init_aggregator(ArrayAggAggregator,e,t):e}const array_agg=ARRAY_AGG,FOLD=ARRAY_AGG;function add_to_set(e,t){var n=e.size;return e.add(t),n!=e.size}class TopWriter{constructor(e,t){this.subwriter=e,this.NW=0,this.top_count=t}async write(e){return!(null!==this.top_count&&this.NW>=this.top_count||(await this.subwriter.write(e),this.NW+=1,0))}async finish(){await this.subwriter.finish()}}class UniqWriter{constructor(e){this.subwriter=e,this.seen=new Set}async write(e){return!add_to_set(this.seen,JSON.stringify(e))||!!await this.subwriter.write(e)}async finish(){await this.subwriter.finish()}}class UniqCountWriter{constructor(e){this.subwriter=e,this.records=new Map}async write(e){var t=JSON.stringify(e),n=this.records.get(t);return n?n[0]+=1:this.records.set(t,[1,e]),!0}async finish(){for(var[e,t]of this.records){let[e,n]=t;if(n.unshift(e),!await this.subwriter.write(n))break}await this.subwriter.finish()}}class SortedWriter{constructor(e,t){this.subwriter=e,this.reverse_sort=t,this.unsorted_entries=[]}async write(e){return this.unsorted_entries.push(e),!0}async finish(){var e=this.unsorted_entries;e.sort(stable_compare),this.reverse_sort&&e.reverse();for(var t=0;t<e.length;t++){var n=e[t];if(!await this.subwriter.write(n[n.length-1]))break}await this.subwriter.finish()}}class AggregateWriter{constructor(e){this.subwriter=e,this.aggregators=[],this.aggregation_keys=new Set}async finish(){var e=Array.from(this.aggregation_keys);e.sort();for(var t=0;t<e.length;t++){var n=e[t],r=[];for(var i of this.aggregators)r.push(i.get_final(n));if(!await this.subwriter.write(r))break}await this.subwriter.finish()}}class InnerJoiner{constructor(e){this.join_map=e}get_rhs(e){return this.join_map.get_join_records(e)}}class LeftJoiner{constructor(e){this.join_map=e,this.null_record=[[null,e.max_record_len,Array(e.max_record_len).fill(null)]]}get_rhs(e){let t=this.join_map.get_join_records(e);return 0==t.length?this.null_record:t}}class StrictLeftJoiner{constructor(e){this.join_map=e}get_rhs(e){let t=this.join_map.get_join_records(e);if(1!=t.length)throw new RbqlRuntimeError('In "STRICT LEFT JOIN" each key in A must have exactly one match in B. Bad A key: "'+e+'"');return t}}function select_except(e,t){let n=[];for(let r=0;r<e.length;r++)-1==t.indexOf(r)&&n.push(e[r]);return n}async function select_simple(e,t,n){if(null!==query_context.sort_key_expression){var r=e.concat([t,n]);if(!await query_context.writer.write(r))return!1}else if(!await query_context.writer.write(n))return!1;return!0}function select_aggregated(e,t){if(null!==e&&(e=JSON.stringify(e)),1===query_context.aggregation_stage){if(!(query_context.writer instanceof TopWriter))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');query_context.writer=new AggregateWriter(query_context.writer);let i=0;for(var n=0;n<t.length;n++)(r=t[n])instanceof RBQLAggregationToken?(query_context.writer.aggregators.push(query_context.functional_aggregators[r.marker_id]),query_context.writer.aggregators[query_context.writer.aggregators.length-1].increment(e,r.value),i+=1):(query_context.writer.aggregators.push(new ConstGroupVerifier(query_context.writer.aggregators.length)),query_context.writer.aggregators[query_context.writer.aggregators.length-1].increment(e,r));if(i!=query_context.functional_aggregators.length)throw new RbqlParsingError(wrong_aggregation_usage_error);query_context.aggregation_stage=2}else for(n=0;n<t.length;n++){var r=t[n];query_context.writer.aggregators[n].increment(e,r)}query_context.writer.aggregation_keys.add(e)}async function select_unnested(e,t,n){let r=n.slice(),i=n.findIndex((e=>e instanceof UnnestMarker));for(var o=0;o<query_context.unnest_list.length;o++)if(r[i]=query_context.unnest_list[o],!await select_simple(e,t,r.slice()))return!1;return!0}const PROCESS_SELECT_COMMON="\n__RBQLMP__variables_init_code\nif (__RBQLMP__where_expression) {\n let out_fields = __RBQLMP__select_expression;\n if (query_context.aggregation_stage > 0) {\n let key = __RBQLMP__aggregation_key_expression;\n select_aggregated(key, out_fields);\n } else {\n let sort_key = [__RBQLMP__sort_key_expression];\n if (query_context.unnest_list !== null) {\n if (!await select_unnested(sort_key, NR, out_fields))\n stop_flag = true;\n } else {\n if (!await select_simple(sort_key, NR, out_fields))\n stop_flag = true;\n }\n }\n}\n",PROCESS_SELECT_SIMPLE="\nlet star_fields = record_a;\n__CODE__\n",PROCESS_SELECT_JOIN="\nlet join_matches = query_context.join_map.get_rhs(__RBQLMP__lhs_join_var_expression);\nfor (let join_match of join_matches) {\n let [bNR, bNF, record_b] = join_match;\n let star_fields = record_a.concat(record_b);\n __CODE__\n if (stop_flag)\n break;\n}\n",PROCESS_UPDATE_JOIN="\nlet join_matches = query_context.join_map.get_rhs(__RBQLMP__lhs_join_var_expression);\nif (join_matches.length > 1)\n throw new RbqlRuntimeError('More than one record in UPDATE query matched a key from the input table in the join table');\nlet record_b = null;\nlet bNR = null;\nlet bNF = null;\nif (join_matches.length == 1)\n [bNR, bNF, record_b] = join_matches[0];\nlet up_fields = record_a;\n__RBQLMP__variables_init_code\nif (join_matches.length == 1 && (__RBQLMP__where_expression)) {\n NU += 1;\n __RBQLMP__update_expressions\n}\nif (!await query_context.writer.write(up_fields))\n stop_flag = true;\n",PROCESS_UPDATE_SIMPLE="\nlet up_fields = record_a;\n__RBQLMP__variables_init_code\nif (__RBQLMP__where_expression) {\n NU += 1;\n __RBQLMP__update_expressions\n}\nif (!await query_context.writer.write(up_fields))\n stop_flag = true;\n",MAIN_LOOP_BODY="\n__USER_INIT_CODE__\n\nlet NU = 0;\nlet NR = 0;\n\nlet stop_flag = false;\nwhile (!stop_flag) {\n let record_a = await query_context.input_iterator.get_record();\n if (record_a === null)\n break;\n NR += 1;\n let NF = record_a.length;\n query_context.unnest_list = null; // TODO optimize, don't need to set this every iteration\n try {\n __CODE__\n } catch (e) {\n if (e.constructor.name === 'InternalBadFieldError') {\n throw new RbqlRuntimeError(`No \"a${e.bad_idx + 1}\" field at record ${NR}`);\n } else if (e.constructor.name === 'RbqlParsingError') {\n throw(e);\n } else {\n throw new RbqlRuntimeError(`At record ${NR}, Details: ${e.message}`);\n }\n }\n}\n";function embed_expression(e,t,n){return replace_all(e,t,n)}function embed_code(e,t,n){let r=e.split("\n"),i=n.split("\n");for(let e=0;e<r.length;e++){let n=r[e].indexOf(t);if(-1==n)continue;assert(n%4==0);let o=r[e].substring(0,n);return i=i.map((e=>o+e)),r.slice(0,e).concat(i).concat(r.slice(e+1)).join("\n")+"\n"}assert(!1)}function generate_main_loop_code(e){let t=null!==e.select_expression,n=null!==e.join_map,r=null===e.where_expression?"true":e.where_expression,i=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,o=null===e.sort_key_expression?"null":e.sort_key_expression,s=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(n?(s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_expression(s,"__RBQLMP__select_expression",e.select_expression),s=embed_expression(s,"__RBQLMP__where_expression",r),s=embed_expression(s,"__RBQLMP__aggregation_key_expression",i),s=embed_expression(s,"__RBQLMP__sort_key_expression",o)):(n?(s=embed_code(s,"__CODE__",PROCESS_UPDATE_JOIN),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(s,"__CODE__",PROCESS_UPDATE_SIMPLE),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_code(s,"__RBQLMP__update_expressions",e.update_expressions),s=embed_expression(s,"__RBQLMP__where_expression",r)),"(async () => {"+s+"})()"}async function compile_and_run(query_context){let main_loop_body=generate_main_loop_code(query_context);try{let main_loop_promise=eval(main_loop_body);await main_loop_promise}catch(e){if(e instanceof SyntaxError){let t=query_context.query_text.toLowerCase();if(-1!=t.indexOf(" having "))throw new SyntaxError(e.message+'\nRBQL doesn\'t support "HAVING" keyword');if(-1!=t.indexOf(" like "))throw new SyntaxError(e.message+"\nRBQL doesn't support \"LIKE\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... ");if(-1!=t.indexOf(" from "))throw new SyntaxError(e.message+'\nTip: If input table is defined by the environment, RBQL query should not have "FROM" keyword');if(e&&e.message&&-1!=String(e.message).toLowerCase().indexOf("unexpected identifier")){if(-1!=t.indexOf(" and "))throw new SyntaxError(e.message+"\nDid you use 'and' keyword in your query?\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!");if(-1!=t.indexOf(" or "))throw new SyntaxError(e.message+"\nDid you use 'or' keyword in your query?\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!")}}if(e&&e.message&&-1!=e.message.indexOf("Received an instance of RBQLAggregationToken"))throw new RbqlParsingError(wrong_aggregation_usage_error);throw e}}const GROUP_BY="GROUP BY",UPDATE="UPDATE",SELECT="SELECT",JOIN="JOIN",INNER_JOIN="INNER JOIN",LEFT_JOIN="LEFT JOIN",LEFT_OUTER_JOIN="LEFT OUTER JOIN",STRICT_LEFT_JOIN="STRICT LEFT JOIN",ORDER_BY="ORDER BY",WHERE="WHERE",LIMIT="LIMIT",EXCEPT="EXCEPT",WITH="WITH";function get_ambiguous_error_msg(e){return`Ambiguous variable name: "${e}" is present both in input and in join tables`}function get_all_matches(e,t){var n=[];let r=null;for(;null!==(r=e.exec(t));)n.push(r);return n}function str_strip(e){return e.replace(/^ +| +$/g,"")}function strip_comments(e){return(e=e.trim()).startsWith("//")?"":e}function combine_string_literals(e,t){for(var n=0;n<t.length;n++)e=replace_all(e,`___RBQL_STRING_LITERAL${n}___`,t[n]);return e}function parse_basic_variables(e,t,n){assert("a"==t||"b"==t);let r=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}([1-9][0-9]*)(?:$|(?=[^_a-zA-Z0-9]))`,"g"),e);for(let e=0;e<r.length;e++){let i=parseInt(r[e][1]);n[t+String(i)]={initialize:!0,index:i-1}}}function parse_array_variables(e,t,n){assert("a"==t||"b"==t);let r=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\[([1-9][0-9]*)\\]`,"g"),e);for(let e=0;e<r.length;e++){let i=parseInt(r[e][1]);n[`${t}[${i}]`]={initialize:!0,index:i-1}}}function js_string_escape_column_name(e,t){return e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"),"'"===t?e.replace(/'/g,"\\'"):'"'===t?e.replace(/"/g,'\\"'):(assert("`"===t),e.replace(/`/g,"\\`"))}function query_probably_has_dictionary_variable(e,t){let n=get_all_matches(new RegExp("[-a-zA-Z0-9_:;+=!.,()%^#@&* ]+","g"),t);for(let t of n)if(-1==e.indexOf(t))return!1;return!0}function parse_dictionary_variables(e,t,n,r){assert("a"===t||"b"===t);let i=new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\[`);if(-1!=e.search(i))for(let i=0;i<n.length;i++){let o=n[i];if(query_probably_has_dictionary_variable(e,o)){let e=js_string_escape_column_name(o,'"');r[`${t}["${e}"]`]={initialize:!0,index:i},e=js_string_escape_column_name(o,"'"),r[`${t}['${e}']`]={initialize:!1,index:i},e=js_string_escape_column_name(o,"`"),r[`${t}[\`${e}\`]`]={initialize:!1,index:i}}}}function parse_attribute_variables(e,t,n,r,i){assert("a"===t||"b"===t);let o=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\.([_a-zA-Z][_a-zA-Z0-9]*)`,"g"),e).map((e=>e[1]));for(let e of o){let o=n.indexOf(e);if(-1==o)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${r}`);i[`${t}.${e}`]={initialize:!0,index:o}}}function map_variables_directly(e,t,n){for(let r=0;r<t.length;r++){let i=t[r];if(null===/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(i))throw new RbqlIOHandlingError(`Unable to use column name "${i}" as RBQL/JS variable`);-1!=e.indexOf(i)&&(n[i]={initialize:!0,index:r})}}function ensure_no_ambiguous_variables(e,t,n){let r=new Set(n);for(let n of t)if(r.has(n)&&-1!=e.indexOf(n))throw new RbqlParsingError(get_ambiguous_error_msg(n))}function parse_join_expression(e){e=str_strip(e);const t="Invalid join syntax. Valid syntax: <JOIN> /path/to/B/table on a... == b... [and a... == b... [and ... ]]";let n=/^ *([^ ]+) +on +/i.exec(e);if(null===n)throw new RbqlParsingError(t);let r=n[1];e=e.substr(n[0].length);let i=[];for(var o=/^([^ =]+) *==? *([^ =]+)/,s=/^ +(and|&&) +/i;;){if(n=o.exec(e),null===n)throw new RbqlParsingError(t);if(i.push([n[1],n[2]]),!(e=e.substr(n[0].length)).length)break;if(n=s.exec(e),null===n)throw new RbqlParsingError(t);e=e.substr(n[0].length)}return[r,i]}function resolve_join_variables(e,t,n,r){let i=[],o=[];const s="Valid JOIN syntax: <JOIN> /path/to/B/table on a... == b... [and a... == b... [and ... ]]";for(let a of n){let[n,l]=a;if(n=combine_string_literals(n,r),l=combine_string_literals(l,r),e.hasOwnProperty(n)&&t.hasOwnProperty(n))throw new RbqlParsingError(get_ambiguous_error_msg(n));if(e.hasOwnProperty(l)&&t.hasOwnProperty(l))throw new RbqlParsingError(get_ambiguous_error_msg(l));e.hasOwnProperty(l)&&([n,l]=[l,n]);let[u,_]=[null,null];if(-1!=["NR","a.NR","aNR"].indexOf(n))u=-1;else{if(!e.hasOwnProperty(n))throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field "${n}"\n${s}`);u=e[n].index}if(-1!=["b.NR","bNR"].indexOf(l))_=-1;else{if(!t.hasOwnProperty(l))throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field "${l}"\n${s}`);_=t[l].index}let c=-1==u?"NR":`safe_join_get(record_a, ${u})`;o.push(_),i.push(c)}return[i,o]}function generate_common_init_code(e,t){assert("a"==t||"b"==t);let n=[];n.push(`${t} = new Object();`);let r="a"==t?"NR":"bNR",i=`${t}.NR`;return-1!=e.indexOf(i)&&n.push(`${i} = ${r};`),"a"==t&&-1!=e.indexOf("aNR")&&n.push("aNR = NR;"),n}function generate_init_statements(e,t,n,r){let i=generate_common_init_code(e,"a"),o=/^[_0-9a-zA-Z]+$/;for(const[e,n]of Object.entries(t))if(n.initialize){let t=o.exec(e)?"var ":"";i.push(`${t}${e} = safe_get(record_a, ${n.index});`)}if(n){i=i.concat(generate_common_init_code(e,"b"));for(const[e,t]of Object.entries(n))if(t.initialize){let n=o.exec(e)?"var ":"";i.push(`${n}${e} = record_b === null ? null : safe_get(record_b, ${t.index});`)}}for(let e=1;e<i.length;e++)i[e]=r+i[e];return i.join("\n")}function replace_star_count(e){return str_strip(e.replace(/(?:(?<=^)|(?<=,)) *COUNT\( *\* *\)/gi," COUNT(1)"))}function replace_star_vars(e){let t=get_all_matches(/(?:^|,) *(\*|a\.\*|b\.\*) *(?=$|,)/g,e),n=0,r="";for(let i of t){let t="]).concat("+{"*":"star_fields","a.*":"record_a","b.*":"record_b"}[i[1]]+").concat([";n<i.index&&(r+=e.substring(n,i.index)),r+=t,n=i.index+i[0].length+1}return r+=e.substring(n),r}function replace_star_vars_for_header_parsing(e){let t=get_all_matches(/(?:(?<=^)|(?<=,)) *(\*|a\.\*|b\.\*) *(?=$|,)/g,e),n=0,r="";for(let i of t){let t={"*":"__RBQL_INTERNAL_STAR","a.*":"a.__RBQL_INTERNAL_STAR","b.*":"b.__RBQL_INTERNAL_STAR"}[i[1]];n<i.index&&(r+=e.substring(n,i.index)),r+=t,n=i.index+i[0].length}return r+=e.substring(n),r}function translate_update_expression(e,t,n,r){let i=`Unable to parse "UPDATE" expression: the expression must start with assignment, but "${str_strip(e.split("=")[0])}" does not look like an assignable field name`,o=/(?:^|,) *(a[.#a-zA-Z0-9\[\]_]*) *=(?=[^=])/g,s=[],a=0;for(;;){let l=o.exec(e);if(0==s.length&&(null===l||0!=l.index))throw new RbqlParsingError(i);if(null===l){s[s.length-1]+=str_strip(e.substr(a))+");";break}s.length&&(s[s.length-1]+=str_strip(e.substring(a,l.index))+");");let u=combine_string_literals(str_strip(l[1]),n);if(!t.hasOwnProperty(u))throw new RbqlParsingError(`Unable to parse "UPDATE" expression: Unknown field name: "${u}"`);let _=t[u].index,c=s.length?r:"";s.push(`${c}safe_set(up_fields, ${_}, `),a=l.index+l[0].length}return combine_string_literals(s.join("\n"),n)}function translate_select_expression(e){let t=replace_star_count(e),n=str_strip(replace_star_vars(t.replace(/ +(AS|as) +([a-zA-Z][a-zA-Z0-9_]*) *(?=$|,)/g,""))),r=str_strip(replace_star_vars_for_header_parsing(t));if(!n.length)throw new RbqlParsingError('"SELECT" expression is empty');return[`[].concat([${n}])`,r]}function separate_string_literals(e){for(var t=/('(\\(\\\\)*'|[^'])*')|("(\\(\\\\)*"|[^"])*")|(`(\\(\\\\)*`|[^`])*`)/g,n=null,r=[],i=[],o=0;null!==(n=t.exec(e));){var s=i.length,a=n[0];i.push(a);var l=n.index;r.push(e.substring(o,l)),r.push(`___RBQL_STRING_LITERAL${s}___`),o=t.lastIndex}r.push(e.substring(o));var u=r.join("");return[u=u.replace(/\t/g," "),i]}function locate_statements(e){let t=[];t.push([STRICT_LEFT_JOIN,LEFT_OUTER_JOIN,LEFT_JOIN,INNER_JOIN,JOIN]),t.push([SELECT]),t.push([ORDER_BY]),t.push([WHERE]),t.push([UPDATE]),t.push([GROUP_BY]),t.push([LIMIT]),t.push([EXCEPT]);for(var n=[],r=0;r<t.length;r++)for(var i=0;i<t[r].length;i++){var o=t[r][i],s=get_all_matches(new RegExp("(?:^| )"+replace_all(o," "," *")+"(?= )","ig"),e);if(s.length){if(s.length>1)throw new RbqlParsingError(`More than one "${o}" statements found`);assert(1==s.length);var a=s[0],l=a[0];n.push([a.index,a.index+l.length,o]);break}}return n.sort((function(e,t){return e[0]-t[0]})),n}function separate_actions(e){e=str_strip(e);var t={};let n=/^(.*) *[Ww][Ii][Tt][Hh] *\(([a-z]{4,20})\) *$/.exec(e);null!==n&&(e=n[1],t[WITH]=n[2]);for(var r=locate_statements(e),i=0;i<r.length;i++){var o=r[i][0],s=r[i][1],a=r[i][2],l=i+1<r.length?r[i+1][0]:e.length;assert(o<s),assert(s<=l);var u=e.substring(s,l),_={};if(-1!=[STRICT_LEFT_JOIN,LEFT_OUTER_JOIN,LEFT_JOIN,INNER_JOIN,JOIN].indexOf(a)&&(_.join_subtype=a,a=JOIN),a==UPDATE){if(0!=o)throw new RbqlParsingError("UPDATE keyword must be at the beginning of the query");u=u.replace(/^ *SET/i,"")}if(a==ORDER_BY){var c=(u=u.replace(/ ASC *$/i,"")).replace(/ DESC *$/i,"");c!=u?(u=c,_.reverse=!0):_.reverse=!1}if(a==SELECT){if(0!=o)throw new RbqlParsingError("SELECT keyword must be at the beginning of the query");let e=/^ *TOP *([0-9]+) /i.exec(u);null!==e&&(_.top=parseInt(e[1]),u=u.substr(e.index+e[0].length)),e=/^ *DISTINCT *(COUNT)? /i.exec(u),null!==e&&(_.distinct=!0,e[1]&&(_.distinct_count=!0),u=u.substr(e.index+e[0].length))}_.text=str_strip(u),t[a]=_}if(!t.hasOwnProperty(SELECT)&&!t.hasOwnProperty(UPDATE))throw new RbqlParsingError("Query must contain either SELECT or UPDATE statement");return assert(t.hasOwnProperty(SELECT)!=t.hasOwnProperty(UPDATE)),t}function find_top(e){if(e.hasOwnProperty(LIMIT)){if(null===/^[0-9]+$/.exec(e[LIMIT].text))throw new RbqlParsingError("LIMIT keyword must be followed by an integer");return parseInt(e[LIMIT].text)}var t=e[SELECT];return t&&t.hasOwnProperty("top")?t.top:null}function translate_except_expression(e,t,n,r){let i=e.split(",");i=i.map(str_strip);let o=[];for(let e of i){if(e=combine_string_literals(e,n),!t.hasOwnProperty(e))throw new RbqlParsingError(`Unknown field in EXCEPT expression: "${e}"`);o.push(t[e].index)}return o=o.sort(((e,t)=>e-t)),[null===r?null:select_except(r,o),`select_except(record_a, [${o.join(",")}])`]}class HashJoinMap{constructor(e,t){this.max_record_len=0,this.hash_map=new Map,this.record_iterator=e,this.nr=0,1==t.length?(this.key_index=t[0],this.key_indices=null,this.polymorphic_get_key=this.get_single_key):(this.key_index=null,this.key_indices=t,this.polymorphic_get_key=this.get_multi_key)}get_single_key(e,t){if(this.key_index>=t.length)throw new RbqlRuntimeError(`No field with index ${this.key_index+1} at record ${this.nr} in "B" table`);return-1===this.key_index?this.nr:t[this.key_index]}get_multi_key(e,t){let n=[];for(let e of this.key_indices){if(e>=t.length)throw new RbqlRuntimeError(`No field with index ${e+1} at record ${this.nr} in "B" table`);n.push(-1===e?this.nr:t[e])}return JSON.stringify(n)}async build(){for(;;){let e=await this.record_iterator.get_record();if(null===e)break;this.nr+=1;let t=e.length;this.max_record_len=Math.max(this.max_record_len,t);let n=this.polymorphic_get_key(this.nr,e),r=this.hash_map.get(n);void 0===r?this.hash_map.set(n,[[this.nr,t,e]]):r.push([this.nr,t,e])}}get_join_records(e){let t=this.hash_map.get(e);return void 0===t?[]:t}get_warnings(){return this.record_iterator.get_warnings()}}function cleanup_query(e){return e.split("\n").map(strip_comments).filter((e=>e.length)).join(" ").replace(/;+$/g,"")}function remove_redundant_table_name(e){return e=str_strip(e.replace(/ +from +a(?: +|$)/gi," ")),str_strip(e.replace(/^ *update +a +set /gi,"update "))}function select_output_header(e,t,n){null===e&&assert(null===t);let r=!1,i=!1;for(let e of n)r=r||null!==e&&e.is_star,i=i||null!==e&&null!==e.alias_name;if(null===e){if(r&&i)throw new RbqlParsingError("Using both * (star) and AS alias in the same query is not allowed for input tables without header");if(!i)return null;e=[],t=[]}null===t&&(t=[]);let o=[];for(let r of n)null===r?o.push("col"+(o.length+1)):r.is_star?null===r.table_name?o=o.concat(e).concat(t):"a"===r.table_name?o=o.concat(e):"b"===r.table_name&&(o=o.concat(t)):null!==r.column_name?o.push(r.column_name):null!==r.alias_name?o.push(r.alias_name):null!==r.column_index?"a"==r.table_name&&r.column_index<e.length?o.push(e[r.column_index]):"b"==r.table_name&&r.column_index<t.length?o.push(t[r.column_index]):o.push("col"+(o.length+1)):o.push("col"+(o.length+1));return o}function sample_first_two_inconsistent_records(e){let t=Array.from(e.entries());t.sort((function(e,t){return e[1]-t[1]})),assert(t.length>1);let[n,r]=t[0],[i,o]=t[1];return[r,n,o,i]}function make_inconsistent_num_fields_warning(e,t){let[n,r,i,o]=sample_first_two_inconsistent_records(t),s=`Number of fields in "${e}" table is not consistent: `;return s+=`e.g. record ${n} -> ${r} fields, record ${i} -> ${o} fields`,s}class RBQLInputIterator{constructor(){}stop(){throw new Error("Unable to call the interface method")}async get_variables_map(e){throw new Error("Unable to call the interface method")}async get_record(){throw new Error("Unable to call the interface method")}handle_query_modifier(){}get_warnings(){return[]}async get_header(){return null}}class RBQLOutputWriter{constructor(){}async write(e){throw new Error("Unable to call the interface method")}async finish(){}get_warnings(){return[]}set_header(){}}class RBQLTableRegistry{constructor(){}get_iterator_by_table_id(e){throw new Error("Unable to call the interface method")}get_warnings(){return[]}}class TableIterator extends RBQLInputIterator{constructor(e,t=null,n=!0,r="a"){super(),this.table=e,this.column_names=t,this.normalize_column_names=n,this.variable_prefix=r,this.nr=0,this.fields_info=new Map,this.stopped=!1}stop(){this.stopped=!0}async get_variables_map(e){let t=new Object;if(parse_basic_variables(e,this.variable_prefix,t),parse_array_variables(e,this.variable_prefix,t),null!==this.column_names){if(this.table.length&&this.column_names.length!=this.table[0].length)throw new RbqlIOHandlingError("List of column names and table records have different lengths");this.normalize_column_names?(parse_dictionary_variables(e,this.variable_prefix,this.column_names,t),parse_attribute_variables(e,this.variable_prefix,this.column_names,"column names list",t)):map_variables_directly(e,this.column_names,t)}return t}async get_record(){if(this.stopped)return null;if(this.nr>=this.table.length)return null;let e=this.table[this.nr];this.nr+=1;let t=e.length;return this.fields_info.has(t)||this.fields_info.set(t,this.nr),e}get_warnings(){return this.fields_info.size>1?[make_inconsistent_num_fields_warning("input",this.fields_info)]:[]}async get_header(){return this.column_names}}class TableWriter extends RBQLOutputWriter{constructor(e){super(),this.table=e,this.header=null}async write(e){return this.table.push(e),!0}set_header(e){this.header=e}}class SingleTableRegistry extends RBQLTableRegistry{constructor(e,t=null,n=!0,r="b"){super(),this.table=e,this.table_id=r,this.column_names=t,this.normalize_column_names=n}get_iterator_by_table_id(e){if(e.toLowerCase()!==this.table_id)throw new RbqlIOHandlingError(`Unable to find join table: "${e}"`);return new TableIterator(this.table,this.column_names,this.normalize_column_names,"b")}}async function shallow_parse_input_query(e,t,n,r){e=cleanup_query(e);var[i,o]=separate_string_literals(e),s=separate_actions(i=remove_redundant_table_name(i));s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]);var a=await t.get_variables_map(e);if(s.hasOwnProperty(ORDER_BY)&&s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(s.hasOwnProperty(GROUP_BY)){if(s.hasOwnProperty(ORDER_BY)||s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');r.aggregation_key_expression="["+combine_string_literals(s[GROUP_BY].text,o)+"]",r.aggregation_stage=1}let l=await t.get_header(),u=null,_=null;if(s.hasOwnProperty(JOIN)){var[c,f]=parse_join_expression(s[JOIN].text);if(null===n)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=n.get_iterator_by_table_id(c);if(!t)throw new RbqlParsingError(`Unable to find join table: "${c}"`);if(s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]),u=await t.get_variables_map(e),_=await t.get_header(),null===l&&null!==_)throw new RbqlIOHandlingError("Inconsistent modes: Input table doesn't have a header while the Join table has a header");if(null!==l&&null===_)throw new RbqlIOHandlingError("Inconsistent modes: Input table has a header while the Join table doesn't have a header");let[i,p]=resolve_join_variables(a,u,f,o),h={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[s[JOIN].join_subtype];r.lhs_join_var_expression=1==i.length?i[0]:"JSON.stringify(["+i.join(",")+"])",r.join_map_impl=new HashJoinMap(t,p),await r.join_map_impl.build(),r.join_map=new h(r.join_map_impl)}if(r.variables_init_code=combine_string_literals(generate_init_statements(i,a,u," ".repeat(4)),o),s.hasOwnProperty(WHERE)){var p=s[WHERE].text;if(/[^><!=]=[^=]/.exec(p))throw new RbqlParsingError('Assignments "=" are not allowed in "WHERE" expressions. For equality test use "==" or "==="');r.where_expression=combine_string_literals(p,o)}if(s.hasOwnProperty(UPDATE)){var h=translate_update_expression(s[UPDATE].text,a,o," ".repeat(8));r.update_expressions=combine_string_literals(h,o),r.writer.set_header(l)}if(s.hasOwnProperty(SELECT)){if(r.top_count=find_top(s),s.hasOwnProperty(EXCEPT)){if(s.hasOwnProperty(JOIN))throw new RbqlParsingError("EXCEPT and JOIN are not allowed in the same query");let[e,t]=translate_except_expression(s[EXCEPT].text,a,o,l);r.select_expression=t,r.writer.set_header(e)}else{let[e,t]=translate_select_expression(s[SELECT].text);r.select_expression=combine_string_literals(e,o);let n=select_output_header(l,_,adhoc_parse_select_expression_to_column_infos(t,o));r.writer.set_header(n)}r.writer=new TopWriter(r.writer,r.top_count),s[SELECT].hasOwnProperty("distinct_count")?r.writer=new UniqCountWriter(r.writer):s[SELECT].hasOwnProperty("distinct")&&(r.writer=new UniqWriter(r.writer))}if(s.hasOwnProperty(ORDER_BY)){r.sort_key_expression=combine_string_literals(s[ORDER_BY].text,o);let e=s[ORDER_BY].reverse;r.writer=new SortedWriter(r.writer,e)}}async function query(e,t,n,r,i=null,o=""){query_context=new RBQLContext(e,t,n,o),await shallow_parse_input_query(e,t,i,query_context),await compile_and_run(query_context),await query_context.writer.finish(),r.push(...t.get_warnings()),query_context.join_map_impl&&r.push(...query_context.join_map_impl.get_warnings()),r.push(...n.get_warnings())}async function query_table(e,t,n,r,i=null,o=null,s=null,a=null,l=!0,u=""){l||null===o||null===s||ensure_no_ambiguous_variables(e,o,s);let _=new TableIterator(t,o,l),c=new TableWriter(n),f=null===i?null:new SingleTableRegistry(i,s,l);if(await query(e,_,c,r,f,u),null!==a&&(assert(0==a.length,"`output_column_names` param must be an empty list or null"),null!==c.header))for(let e of c.header)a.push(e)}function exception_to_error_info(e){let t={RbqlRuntimeError:"query execution",RbqlParsingError:"query parsing",SyntaxError:"JS syntax error",RbqlIOHandlingError:"IO handling"},n="unexpected";return e.constructor&&e.constructor.name&&t.hasOwnProperty(e.constructor.name)&&(n=t[e.constructor.name]),[n,e.hasOwnProperty("message")?e.message:String(e)]}exports.query=query,exports.query_table=query_table,exports.RBQLInputIterator=RBQLInputIterator,exports.RBQLOutputWriter=RBQLOutputWriter,exports.RBQLTableRegistry=RBQLTableRegistry,exports.version=RBQL_VERSION,exports.TableIterator=TableIterator,exports.TableWriter=TableWriter,exports.SingleTableRegistry=SingleTableRegistry,exports.exception_to_error_info=exception_to_error_info,exports.parse_basic_variables=parse_basic_variables,exports.parse_array_variables=parse_array_variables,exports.parse_dictionary_variables=parse_dictionary_variables,exports.parse_attribute_variables=parse_attribute_variables,exports.get_all_matches=get_all_matches,exports.strip_comments=strip_comments,exports.separate_actions=separate_actions,exports.separate_string_literals=separate_string_literals,exports.combine_string_literals=combine_string_literals,exports.parse_join_expression=parse_join_expression,exports.resolve_join_variables=resolve_join_variables,exports.translate_update_expression=translate_update_expression,exports.translate_select_expression=translate_select_expression,exports.translate_except_expression=translate_except_expression,exports.like_to_regex=like_to_regex,exports.adhoc_parse_select_expression_to_column_infos=adhoc_parse_select_expression_to_column_infos,exports.replace_star_count=replace_star_count,exports.replace_star_vars_for_header_parsing=replace_star_vars_for_header_parsing,exports.select_output_header=select_output_header,exports.sample_first_two_inconsistent_records=sample_first_two_inconsistent_records})(exports)},6945:(e,t,n)=>{var r=n(5606);const i=n(8364),o=n(9135),s=n(1820),a=n(537),l=n(9022),u=n(4285),_="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class c extends Error{}class f extends Error{}function p(e,t=null){if(!e)throw t||(t="Assertion error"),new f(t)}function h(e){return/^[\x00-\x7F]*$/.test(e)}function d(e){return i.readFileSync(e,"utf-8")}function g(e,t){var n,r="~"===(n=t).charAt(0)?s.join(o.homedir(),n.slice(1)):n;if(i.existsSync(r))return r;if(e&&!s.isAbsolute(r)&&(r=s.join(e,r),i.existsSync(r)))return r;var a=function(e,t){for(var n=function(e){var t=null;try{t=i.readFileSync(e,"utf-8")}catch(e){return[]}for(var n=t.split("\n"),r=[],o=0;o<n.length;o++)if(n[o]){var s=n[o].split("\t");r.push(s)}return r}(e),r=0;r<n.length;r++)if(n[r].length&&n[r][0]==t)return n[r];return null}(s.join(o.homedir(),".rbql_table_names"),t);return a&&a.length>1&&i.existsSync(a[1])?a[1]:null}class m{constructor(){this.push_stack=[],this.pull_stack=[]}enqueue(e){this.push_stack.push(e)}dequeue(){if(!this.pull_stack.length){if(!this.push_stack.length)return null;this.pull_stack=this.push_stack,this.pull_stack.reverse(),this.push_stack=[]}return this.pull_stack.pop()}}class y extends l.RBQLInputIterator{constructor(e,t,n,r,i,o=!1,s=null,l="input",_="a"){super(),this.stream=e,this.csv_path=t,p(null===this.stream!=(null===this.csv_path)),this.encoding=n,this.delim=r,this.policy=i,this.has_header=o,this.first_record=null,this.first_record_should_be_emitted=!o,this.header_preread_complete=!1,this.table_name=l,this.variable_prefix=_,this.comment_prefix=s,this.decoder=null,"utf-8"==n&&null===this.csv_path&&(this.decoder=new a.TextDecoder(n,{fatal:!0,stream:!0})),this.input_exhausted=!1,this.started=!1,this.utf8_bom_removed=!1,this.first_defective_line=null,this.fields_info=new Map,this.NR=0,this.NL=0,this.line_aggregator=new u.MultilineRecordAggregator(s),this.partially_decoded_line="",this.partially_decoded_line_ends_with_cr=!1,this.resolve_current_record=null,this.reject_current_record=null,this.current_exception=null,this.produced_records_queue=new m,this.process_line_polymorphic="quoted_rfc"==i?this.process_partial_rfc_record_line:this.process_record_line_simple}handle_query_modifier(e){-1!=["header","headers"].indexOf(e)&&(this.has_header=!0,this.first_record_should_be_emitted=!1),-1!=["noheader","noheaders"].indexOf(e)&&(this.has_header=!1,this.first_record_should_be_emitted=!0)}reset_external_callbacks(){this.reject_current_record=null,this.resolve_current_record=null}try_propagate_exception(){if(this.current_exception&&this.reject_current_record){let e=this.reject_current_record,t=this.current_exception;this.reset_external_callbacks(),this.current_exception=null,e(t)}}store_or_propagate_exception(e){null===this.current_exception&&(this.current_exception=e),this.try_propagate_exception()}async preread_first_record(){this.header_preread_complete||(this.first_record=await this.get_record(),this.header_preread_complete=!0,null!==this.first_record&&(this.stream&&this.stream.pause(),this.first_record=this.first_record.slice()))}async get_variables_map(e){let t=new Object;return l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(l.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),l.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return await this.preread_first_record(),this.has_header?this.first_record:null}try_resolve_next_record(){if(this.try_propagate_exception(),null===this.resolve_current_record)return;let e=null;if(this.first_record_should_be_emitted&&this.header_preread_complete?(this.first_record_should_be_emitted=!1,e=this.first_record):e=this.produced_records_queue.dequeue(),null===e&&!this.input_exhausted)return;let t=this.resolve_current_record;this.reset_external_callbacks(),t(e)}async get_record(){this.started||await this.start(),this.stream&&this.stream.isPaused()&&this.stream.resume();let e=this,t=new Promise((function(t,n){e.resolve_current_record=t,e.reject_current_record=n}));return this.try_resolve_next_record(),t}async get_all_records(e=null){let t=[];for(;;){let n=await this.get_record();if(null===n)break;if(t.push(n),e&&t.length>=e){this.stop();break}}return t}process_record_line_simple(e){this.comment_prefix&&e.startsWith(this.comment_prefix)||this.process_record_line(e)}process_record_line(e){this.NR+=1;var[t,n]=u.smart_split(e,this.delim,this.policy,!1);n&&null===this.first_defective_line&&(this.first_defective_line=this.NL,"quoted_rfc"==this.policy&&this.store_or_propagate_exception(new c(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`)));let r=t.length;this.fields_info.has(r)||this.fields_info.set(r,this.NR),this.produced_records_queue.enqueue(t),this.try_resolve_next_record()}process_partial_rfc_record_line(e){this.line_aggregator.add_line(e),this.line_aggregator.has_comment_line?this.line_aggregator.reset():this.line_aggregator.has_full_record&&(this.process_record_line(this.line_aggregator.get_full_line("\n")),this.line_aggregator.reset())}process_line(e){if(this.NL+=1,1===this.NL){var t=function(e,t){return"binary"==t&&e.length>=3&&239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)?e.substring(3):"utf-8"==t&&e.length>=1&&65279===e.charCodeAt(0)?e.substring(1):e}(e,this.encoding);t!=e&&(e=t,this.utf8_bom_removed=!0)}this.process_line_polymorphic(e)}process_data_stream_chunk(e){let t=null;if(this.decoder)try{t=this.decoder.decode(e)}catch(e){return void(e instanceof TypeError?this.store_or_propagate_exception(new c(_)):this.store_or_propagate_exception(e))}else t=e.toString(this.encoding);let n=t.length&&"\n"==t[0]&&this.partially_decoded_line_ends_with_cr?1:0;this.partially_decoded_line_ends_with_cr=t.length&&"\r"==t[t.length-1];let r=u.split_lines(t);r[0]=this.partially_decoded_line+r[0],p(0==n||0==r[0].length),this.partially_decoded_line=r.pop();for(let e=n;e<r.length;e++)this.process_line(r[e])}process_data_bulk(e){let t=e.toString(this.encoding);if("utf-8"==this.encoding){let n=Buffer.from(t,"utf-8");if(0!=Buffer.compare(e,n))return void this.store_or_propagate_exception(new c(_))}let n=u.split_lines(t);n.length&&0==n[n.length-1].length&&n.pop();for(let e=0;e<n.length;e++)this.process_line(n[e]);this.line_aggregator.is_inside_multiline_record()&&this.process_record_line(this.line_aggregator.get_full_line("\n")),this.input_exhausted=!0,this.try_resolve_next_record()}process_data_stream_end(){if(this.input_exhausted=!0,this.partially_decoded_line.length){let e=this.partially_decoded_line;this.partially_decoded_line="",this.process_line(e)}this.line_aggregator.is_inside_multiline_record()&&this.process_record_line(this.line_aggregator.get_full_line("\n")),this.try_resolve_next_record()}stop(){this.stream&&this.stream.destroy()}async start(){if(!this.started){if(this.started=!0,!this.stream){let e=this;return new Promise((function(t,n){i.readFile(e.csv_path,((r,i)=>{r?n(r):(e.process_data_bulk(i),t())}))}))}this.stream.on("data",(e=>{this.process_data_stream_chunk(e)})),this.stream.on("end",(()=>{this.process_data_stream_end()}))}}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.utf8_bom_removed&&e.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`),this.fields_info.size>1&&e.push(function(e,t){let[n,r,i,o]=l.sample_first_two_inconsistent_records(t),s=`Number of fields in "${e}" table is not consistent: `;return s+=`e.g. record ${n} -> ${r} fields, record ${i} -> ${o} fields`,s}(this.table_name,this.fields_info)),e}}class b extends l.RBQLOutputWriter{constructor(e,t,n,r,i,o="\n"){if(super(),this.stream=e,this.encoding=n,n&&this.stream.setDefaultEncoding(n),this.stream.on("error",(e=>{this.store_first_error(e)})),this.delim=r,this.policy=i,this.line_separator=o,this.sub_array_delim="|"==r?";":"|",this.close_stream_on_finish=t,this.null_in_output=!1,this.delim_in_simple_output=!1,this.header_len=null,this.first_error=null,"simple"==i)this.polymorphic_join=this.simple_join;else if("quoted"==i)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==i)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==i)this.polymorphic_join=this.mono_join;else{if("whitespace"!=i)throw new c("Unknown output csv policy");this.polymorphic_join=this.simple_join}}store_first_error(e){null===this.first_error&&(this.first_error=e)}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return u.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return u.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new c('Unable to use "Monocolumn" output format: some records have more than one field');return e[0]}simple_join(e){var t=e.join(this.delim);return-1!=e.join("").indexOf(this.delim)&&(this.delim_in_simple_output=!0),t}normalize_fields(e){for(var t=0;t<e.length;t++)null==e[t]?(this.null_in_output=!0,e[t]=""):Array.isArray(e[t])&&(this.normalize_fields(e[t]),e[t]=e[t].join(this.sub_array_delim))}async write(e){if(null!==this.header_len&&e.length!=this.header_len)throw new c(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${e.length}`);this.normalize_fields(e),this.stream.write(this.polymorphic_join(e)),this.stream.write(this.line_separator);let t=this.first_error;return new Promise((function(e,n){null!==t?n(t):e(!0)}))}_write_all(e){for(let t=0;t<e.length;t++)this.write(e[t])}async finish(){let e=this.close_stream_on_finish,t=this.stream,n=this.encoding,r=this.first_error;return new Promise((function(i,o){null!==r&&o(r),e?t.end("",n,(()=>{i()})):setTimeout((()=>{i()}),0)}))}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w extends l.RBQLTableRegistry{constructor(e,t,n,r,i=!1,o=null,s=null){super(),this.input_file_dir=e,this.delim=t,this.policy=n,this.encoding=r,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=s,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=g(this.input_file_dir,e),null===this.table_path)throw new c(`Unable to find join table "${e}"`);return this.options&&this.options.bulk_read?this.bulk_input_path=this.table_path:this.stream=i.createReadStream(this.table_path),this.record_iterator=new y(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${s.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=h,e.exports.CSVRecordIterator=y,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=w,e.exports.interpret_named_csv_format=function(e){if("monocolumn"==(e=e.toLowerCase()))return["","monocolumn"];if("csv"==e)return[",","quoted"];if("tsv"==e)return["\t","simple"];throw new c(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=d,e.exports.query_csv=async function(e,t,n,a,u,_,f,p,g,m=!1,x=null,v="",E=null){let R=null,S=null;E&&E.bulk_read&&t?S=t:R=null===t?r.stdin:i.createReadStream(t);let[O,A]=null===u?[r.stdout,!1]:[i.createWriteStream(u),!0];if('"'==n&&"quoted"==a)throw new c('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==p&&(p="binary"),!h(e)&&"binary"==p)throw new c("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(h(n)&&h(_)||"binary"!=p))throw new c("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let q=s.join(o.homedir(),".rbql_init_source.js");""==v&&i.existsSync(q)&&(v=d(q));let I=t?s.dirname(t):null,P=new w(I,n,a,p,m,x,E),T=new y(R,S,p,n,a,m,x),j=new b(O,A,p,_,f);await l.query(e,T,j,g,P,v),P.get_warnings(g)},e.exports.RecordQueue=m,e.exports.exception_to_error_info=l.exception_to_error_info},1398:e=>{"use strict";e.exports=require("vscode")},8364:()=>{},9135:()=>{},1820:()=>{},6510:()=>{},9175:()=>{},2196:()=>{},7507:()=>{},7560:()=>{},9209:(e,t,n)=>{"use strict";var r=n(6578),i="undefined"==typeof globalThis?n.g:globalThis;e.exports=function(){for(var e=[],t=0;t<r.length;t++)"function"==typeof i[r[t]]&&(e[e.length]=r[t]);return e}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var __webpack_exports__={};(()=>{var e=__webpack_exports__;const t=__webpack_require__(1398),n=__webpack_require__(7507),r=__webpack_require__(9175),i=__webpack_require__(2196),o=__webpack_require__(6510),s=__webpack_require__(3568),a=__webpack_require__(4285);var l=null,u=null;function _(){return null===u&&(u=__webpack_require__(785)),u}const c=void 0===i.homedir;var f=null;const p=100,h="vscode_rbql_scratch";var d=new Set,g=new Map,m=new Map,y=new Set,b=null,w=null,x=null,v=null,E=null,R=null,S=null,O=null,A=null,q=new Map,I=null,P=null,T=null,j=null,k=null,N=null,C=null,L=null,M=null,B=null;let U=null,$=null,D=null,F=null;const W="plaintext",J="dynamic csv",Q="quoted",z="whitespace",V="quoted_rfc",G="simple";let H={lint_results:new Map,lint_status_bar_button:null,dynamic_document_dialects:new Map,custom_comment_prefixes:new Map,original_language_ids:new Map,reenable_rainbow_language_infos:new Map,autodetection_stoplist:new Set,autodetection_temporarily_disabled_for_rbql:!1,dynamic_dialect_for_next_request:null,logging_enabled:!1,logging_next_context_id:1};const Y={csv:[",",Q],tsv:["\t",G],"csv (semicolon)":[";",Q],"csv (pipe)":["|",G],"csv (whitespace)":[" ",z],[J]:[null,null]},Z="comment",X=["rainbow1","rainbow2","rainbow3","rainbow4","rainbow5","rainbow6","rainbow7","rainbow8","rainbow9","rainbow10"],K=X.concat([Z]),ee=new t.SemanticTokensLegend(K);function te(e){return e&&e.uri&&e.fileName&&function(e){return e&&e.uri&&-1!=["file","untitled","vscode-test-web"].indexOf(e.uri.scheme)}(e)}function ne(e){return te(e)&&Y.hasOwnProperty(e.languageId)}function re(e,t){return{delim:e,policy:t}}function ie(e){return"dynamic_dialect:"+e}async function oe(e,t,n){await de(ie(t),n),e.dynamic_document_dialects.set(t,n)}function se(e){if(H.dynamic_document_dialects.has(e))return H.dynamic_document_dialects.get(e);let t=he(ie(e),null);return t&&t.hasOwnProperty("delim")&&t.hasOwnProperty("policy")?(H.dynamic_document_dialects.set(e,t),t):null}function ae(e){return e?e.toLowerCase():e}function le(e){for(let t in Y)if(Y.hasOwnProperty(t)&&Y[t][0]==e)return Y[t][1];return G}function ue(e,t){for(let n in Y)if(Y.hasOwnProperty(n)&&Y[n][0]==e&&Y[n][1]==t)return n;return J}let _e={"rbql_client.js":null,"contrib/textarea-caret-position/index.js":null,"rbql_suggest.js":null,"rbql_logo.svg":null,"rbql_client.html":null,"dialect_select.html":null,"dialect_select.js":null,"rbql mock/rbql_mock.py":null,"rbql_core/vscode_rbql.py":null};function ce(e){var n=t.window;n&&n.showErrorMessage(e)}function fe(e){return new Promise((t=>setTimeout(t,e)))}async function pe(e,t){e.report({message:t}),await fe(0)}function he(e,t){if(T){var n=T.get(e);if(null!=n)return n}return t}async function de(e,t){return!(!T||!e||(await T.update(e,t),0))}async function ge(e,n,r){let i=new t.Range(0,0,n.lineCount,0),o=n.validateRange(i);await e.edit((e=>e.replace(o,r)))}function me(e){return"rbql_header_info:"+e}function ye(e){return"rbql_with_headers:"+e}function be(e,n,r=null){return r||(r=t.workspace.getConfiguration("rainbow_csv")),r?r.get(e):n}class we{constructor(e,t=null){this.context_name=e,this.logging_enabled=H.logging_enabled,this.context_id=null===t?H.logging_next_context_id:t,H.logging_next_context_id+=1}log_doc_event(e,t=null){if(this.logging_enabled)try{let n=`CID:${this.context_id}, ${this.context_name}:${e}`;t?(n=`${n}, doc_lang:${t.languageId}`,t.uri&&(n=`${n}, doc_uri:${t.uri.toString(!0)}`)):n=`${n}, no_doc:1`,A.info(n)}catch(e){return void console.error(`Rainbow CSV: Unexpected log failure. ${this.context_name}:${this.event_name}`)}}log_simple_event(e){if(this.logging_enabled)try{let t=`CID:${this.context_id}, ${this.context_name}:${e}`;A.info(t)}catch(e){return void console.error(`Rainbow CSV: Unexpected log failure. ${this.context_name}:${this.event_name}`)}}}function xe(e,t,n,r){let[i,o]=_().get_header_line(e,r);return o?a.smart_split(o,t,n,!1)[0]:null}function ve(e,t,n,r){var i=e.fileName;if(i){let e=he(me(i),null);if(null!==e&&null!==e.header)return e.header}return xe(e,t,n,r)}function Ee(e){let t=e.languageId,n=null,r=null,i="";if(i=H.custom_comment_prefixes.has(e.fileName)?H.custom_comment_prefixes.get(e.fileName):be("comment_prefix",""),t!=J&&Y.hasOwnProperty(t))return[n,r]=Y[t],[n,r,i];let o=null;return t==J&&(o=se(e.fileName)),o?[o.delim,o.policy,i]:[null,null,null]}class Re{constructor(){}async provideDocumentSymbols(e){let[n,r,i]=Ee(e);if(!r)return null;let o=null;var s=e.fileName;if(s){let e=he(me(s),null);null!==e&&null!==e.header_line_num&&(o=e.header_line_num)}if(null===o&&(o=_().get_header_line(e,i)[0]),null===o||o>=e.lineCount-1)return null;let a=new t.Range(o,0,e.lineCount-1,65535);a=e.validateRange(a);let l=new t.Range(o,0,o,65535);if(!a.contains(l))return;let u=t.SymbolKind.File;return[new t.DocumentSymbol("data","",u,a,l)]}}function Se(e=!1){if(!be("enable_sticky_header",!1))return void(null!==F&&(F.dispose(),F=null));if(null!==F&&e&&(F.dispose(),F=null),null!==F)return;let n=new Re,r=[];for(let e in Y)Y.hasOwnProperty(e)&&r.push({language:e});F=t.languages.registerDocumentSymbolProvider(r,n)}function Oe(){let e=new gt;null!==$&&$.dispose();let n={language:J};$=t.languages.registerDocumentRangeSemanticTokensProvider(n,e,ee)}function Ae(){let e=new mt;null!==D&&D.dispose();let n=[];for(let e in Y)Y.hasOwnProperty(e)&&e!=J&&n.push({language:e});D=t.languages.registerDocumentRangeSemanticTokensProvider(n,e,ee)}async function qe(e=null){let n=new we("choose_dynamic_separator");n.log_doc_event("starting",i);let r=je();if(!r)return;var i=ke(r);if(!te(i))return;let o=function(e,t){if(!e||!t)return"";let n=e.selection;return n?n.start.line!=n.end.line?"":t.lineAt(n.start.line).text.substring(n.start.character,n.end.character):""}(r,i);P||(P=await yt("dialect_select.html")),(k=t.window.createWebviewPanel("rainbow-dialect-select","Choose CSV Dialect",t.ViewColumn.Beside,{enableScripts:!0})).webview.html=it(k,P,["dialect_select.js"]),k.webview.onDidReceiveMessage((function(r){!async function(e,n,r,i,o,s){if(r){if("dialect_handshake"==r.msg_type){let e={msg_type:"dialect_handshake",selected_separator:i};s&&s.integration_test&&(e.integration_test=!0),await n.webview.postMessage(e)}if("apply_dialect"==r.msg_type){let i=r.delim,s=r.policy,a=r.comment_prefix;if("whitespace"==s&&" "!=i)return void ce("Selected policy can only be used with whitespace separator");if("double_escape"==s&&'"'==i)return void ce("Double quote separator in incompatible with double quote escape policy");if(!i)return void ce("Separator is empty");if(-1==[G,V,Q,z].indexOf(s))return void ce("Selected policy is empty or not supported");n.dispose(),await oe(H,e.fileName,re(i,s)),H.custom_comment_prefixes.set(e.fileName,a),e.languageId==J&&Ne(e)?await Ie(e,o):await t.languages.setTextDocumentLanguage(e,J)}}}(i,k,r,o,n,e)}))}async function Ie(e,r){if(r.log_doc_event("start enable-rainbow-features-if-csv",e),!ne(e))return void r.log_simple_event("abort enable-rainbow-features-if-csv: non-rainbow dialect");v&&v.hide();var i=e.languageId;i==J&&null!=H.dynamic_dialect_for_next_request&&(await oe(H,e.fileName,H.dynamic_dialect_for_next_request),H.dynamic_dialect_for_next_request=null);let[o,s,a]=Ee(e);if(!o||!s)return r.log_simple_event("abort enable-rainbow-features-if-csv: missing delim or policy"),Pe(),S||(S=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),S.text="Choose Separator...",S.tooltip="Click to choose Dynamic CSV separator",S.command="rainbow-csv.RainbowSeparator",void S.show();a&&t.languages.setLanguageConfiguration(i,{comments:{lineComment:a}}),i==J&&Oe(),function(e){S&&S.hide(),_().show_lint_status_bar_button(t,H,e.fileName,e.languageId),b||(b=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),b.text="Query",b.tooltip="Click to run SQL-like RBQL query",b.command="rainbow-csv.RBQL",b.show(),Ce(e.fileName),x||(x=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),x.text="Rainbow OFF",x.tooltip="Click to restore original file type and syntax",x.command="rainbow-csv.RainbowSeparatorOff",x.show(),function(e){let r=g.get(ae(e));if(!r||-1!=r.indexOf(h))return;let i=n.basename(r);E||(E=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),E.text="Copy Back",E.tooltip=`Copy to parent table: ${i}`,E.command="rainbow-csv.CopyBack",E.show()}(e.fileName),Le(),be("enable_cursor_position_info",!1)&&(C=t.window.onDidChangeTextEditorSelection(_t))}(e),await Me(e,!1),r.log_simple_event("finish enable-rainbow-features-if-csv")}function Pe(){let e=[H.lint_status_bar_button,b,x,E,w,R,S,v];for(let t=0;t<e.length;t++)e[t]&&e[t].hide();C&&(C.dispose(),C=null)}function Te(e,n){if(n.log_doc_event("start disable-rainbow-features-if-non-csv",e),ne(e))return v&&v.hide(),void n.log_simple_event("abort disable-rainbow-features-if-non-csv: is rainbow dialect");n.log_simple_event("perform disable-rainbow-features-if-non-csv"),Pe(),te(e)&&H.reenable_rainbow_language_infos.has(e.fileName)&&(n.log_simple_event("show rainbow-on status button"),v||(v=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),v.text="Rainbow ON",v.tooltip="Click to reenable Rainbow CSV for this file",v.command="rainbow-csv.RainbowSeparatorOn",v.show())}function je(){var e=t.window;return e&&e.activeTextEditor||null}function ke(e=null){return e||(e=je()),e&&e.document||null}function Ne(e){let t=ke();return t&&t.uri&&e&&e.uri&&t.uri.toString()==e.uri.toString()}function Ce(e){w||(w=t.window.createStatusBarItem(t.StatusBarAlignment.Left)),d.has(e)?(w.text="Shrink",w.tooltip="Click to shrink table (Then you can click again to align)",w.command="rainbow-csv.Shrink"):(w.text="Align",w.tooltip="Click to align table (Then you can click again to shrink)",w.command="rainbow-csv.Align"),w.show()}function Le(){let e=je();if(!e)return!1;let n=_().get_cursor_position_if_unambiguous(e);if(!n)return!1;let r=ke(e),[i,o,s]=Ee(r),a=_().get_cursor_position_info(t,r,i,o,s,n);if(!a)return!1;let l=be("enable_tooltip_column_names",!1),u=ve(r,i,o,s);if(!u)return!1;let[c,f]=_().format_cursor_position_info(a,u,l,!1,25);return function(e,n){R||(R=t.window.createStatusBarItem(t.StatusBarAlignment.Right,1e3)),R.text=n,R.tooltip=e,R.show()}(c,f),!0}async function Me(e,n){if(e||(e=ke()),!ne(e))return null;var r=e.fileName,i=e.languageId;let o=`${r}.${i}`;if(!n){if(H.lint_results.has(o))return null;if(!be("enable_auto_csv_lint",!1))return null}let[a,l,u]=Ee(e);if(null===l)return null;H.lint_results.set(o,{is_processing:!0}),_().show_lint_status_bar_button(t,H,r,i);let c=be("csv_lint_detect_trailing_spaces",!1),[f,p,h,d,g,m]=s.parse_document_records(e,a,l,u,!0,-1,!1,!0,c),y={is_ok:null===d&&h.size<=1,first_defective_line:d,fields_info:h,first_trailing_space_line:g};return H.lint_results.set(o,y),n&&await fe(500),_().show_lint_status_bar_button(t,H,r,i),y}async function Be(){return await Me(null,!0)}async function Ue(e){return e&&e.check_initialization_state?{initialized:null!==T,lazy_loaded:null!==u}:e&&e.check_last_rbql_report?M:e&&e.check_last_rbql_warnings?{warnings:B}:null}async function $e(e){if(B=[],e&&e.length){var n=t.window;if(!n)return null;for(var r=0;r<e.length;r++)n.showWarningMessage("RBQL warning: "+e[r]);B=e}}async function De(e,n,r,i){try{await t.window.showTextDocument(e)}catch(e){return void ce("Unable to open RBQL result document")}let o=ue(n,r);o&&e.languageId!=o&&await t.languages.setTextDocumentLanguage(e,o),await $e(i)}function Fe(e){return e&&-1!=e.indexOf(h)?h:e}async function We(e,t){let n=null;try{n=await function(e,t){return new Promise((function(n,r){let i="",s="",a=o.spawn(e,t,{windowsHide:!0});a.stdout.on("data",(function(e){i+=e.toString()})),a.stderr.on("data",(function(e){s+=e.toString()})),a.on("close",(function(e){n({exit_code:e,stdout:i,stderr:s})})),a.on("error",(function(e){r(e)}))}))}(e,t)}catch(e){return{error_type:"Integration",error_msg:"Something went wrong. Make sure you have python installed and added to PATH variable in your OS. Or you can use it with JavaScript instead - it should work out of the box\nDetails:\n"+(e?e.name+": "+e.message:""),invocation_error:1}}let r=n.stdout;if(!r||n.stderr)return{error_type:"Integration",error_msg:n.stderr||"empty error"};try{return JSON.parse(r)}catch(e){return{error_type:"Integration",error_msg:"Unable to parse JSON report"}}}async function Je(e,t,n){let r=null;for(let i of e){if(n.log_simple_event(`Attempting interpreter '${i}' ...`),r=await We(i,t),!r||!r.hasOwnProperty("invocation_error")||!r.invocation_error)return r;n.log_simple_event(`Interpreter '${i}' invocation failed.`)}return r}async function Qe(e,t,n){let r={msg_type:"rbql_report"};t&&(r.error_type=t),n&&(r.error_msg=n),M=r,await e.postMessage(r)}async function ze(){let e=je();if(!e)return;var t=ke(e);if(!t)return;let[n,r,i]=Ee(t);if(null===r)return void ce("Unable to set header line: no separator specified");let o=t.fileName;if(!o)return void ce("Unable to set header line for non-file documents");let s=e.selection.start.line,l=t.lineAt(s).text,u=a.smart_split(l,n,r,!1)[0];await de(me(o),{header_line_num:s,header:u}),Se(!0)}function Ve(e,t,n){e&&(Y.hasOwnProperty(t)||n.set(e,t))}async function Ge(){let e=je();if(!e)return;var n=ke(e);if(!n)return;let r=e.selection;if(!r)return void ce("Selection is empty");let i=n.lineAt(r.start.line).text.substring(r.start.character,r.end.character);H.custom_comment_prefixes.set(n.fileName,i),i?y.delete(n.fileName):y.add(n.fileName),i&&t.languages.setLanguageConfiguration(n.languageId,{comments:{lineComment:i}}),n.languageId==J?Oe():Ae()}async function He(){let e=new we("restore_original_language"),n=ke();if(e.log_doc_event("starting",n),!n)return;let r=n.fileName,i=W;if(H.original_language_ids.has(r)&&(i=H.original_language_ids.get(r)),!Y.hasOwnProperty(i)&&Y.hasOwnProperty(n.languageId)){if(r){let e={language_id:n.languageId},t=se(r);t&&(e.dynamic_dialect_info=t),H.reenable_rainbow_language_infos.set(r,e),H.autodetection_stoplist.add(r)}n=await t.languages.setTextDocumentLanguage(n,i),Te(n,e),async function(e){await de(ie(e),void 0),H.dynamic_document_dialects.delete(e)}(r)}else ce("Unable to restore original language")}async function Ye(){var e=ke();if(!e)return;let n=e.fileName;if(!H.reenable_rainbow_language_infos.has(n))return void ce("Unable to re-enable rainbow highlighting automatically, select filetype manually or select a new separator with cursor.");let r=H.reenable_rainbow_language_infos.get(n);H.autodetection_stoplist.delete(n),r.hasOwnProperty("dynamic_dialect_info")&&await oe(H,n,r.dynamic_dialect_info),Ve(n,e.languageId,H.original_language_ids),H.reenable_rainbow_language_infos.delete(n),v&&v.hide(),await t.languages.setTextDocumentLanguage(e,r.language_id)}async function Ze(){if(c)return void ce("This command is currently unavailable in web mode.");var e=ke();if(!e)return;let n=e.fileName;if(!n)return void ce("Unable to use this document as join table");let r=await t.window.showInputBox({prompt:"Input table name to use in RBQL JOIN expressions instead of table path",value:"b"});r&&await de(_().make_table_name_key(r),n)}async function Xe(){var e=ke();let[n,r,i]=Ee(e);if(null===r)return void ce("Unable to set virtual header: no separator specified");var o=e.fileName;if(!o)return void ce("Unable to edit column names for non-file documents");var s=ve(e,n,r,i),l=s?function(e,t){var n=e.map((function(e){return function(e,t){return-1!=e.indexOf('"')||-1!=e.indexOf(t)?'"'+e.replace(/"/g,'""')+'"':e}(e,t)}));return n.join(t)}(s,n):"",u={prompt:"Adjust column names displayed in hover tooltips. Actual header line and file content won't be affected.",value:l};let _=await t.window.showInputBox(u);if(!_)return;let c=a.smart_split(_,n,r,!1)[0];await de(me(o),{header_line_num:null,header:c})}async function Ke(e){let n=je();if(!n)return;let r=n.document;if(!r)return;let[i,o,s]=Ee(r);if(null===o)return;let a=_().get_cursor_position_if_unambiguous(n);if(!a)return void ce("Unable to enter column edit mode: make sure that no text is selected and only one cursor is active");if(r.lineCount>=1e4)return void ce("Multicursor column edit works only for files smaller than 10000 lines.");let l=_().get_cursor_position_info(t,r,i,o,s,a).column_number,[u,c,f]=_().generate_column_edit_selections(t,r,i,o,s,e,l);null===c?(f&&t.window.showWarningMessage(f),n.selections=u,await t.window.showTextDocument(r)):ce(c)}async function et(){let e=je(),n=ke(e);if(!ne(n))return;let[r,i,o]=Ee(n);if(null===i)return;let s={location:t.ProgressLocation.Window,title:"Rainbow CSV"};await t.window.withProgress(s,(async s=>{await pe(s,"Preparing");let[a,l]=_().shrink_columns(n,r,i,o);l?ce(`Unable to shrink: Inconsistent double quotes at line ${l}`):(d.delete(n.fileName),Ce(n.fileName),null!==a?(await pe(s,"Shrinking columns"),await ge(e,n,a)):t.window.showWarningMessage("No trailing whitespaces found, skipping"))}))}async function tt(){let e=je(),n=ke(e);if(!ne(n))return;let[r,i,o]=Ee(n);if(null===i)return;let s={location:t.ProgressLocation.Window,title:"Rainbow CSV"};await t.window.withProgress(s,(async s=>{await pe(s,"Calculating column statistics");let a=be("double_width_alignment",!0),[l,u,c,f]=_().calc_column_stats(n,r,i,o,a);if(u)return void ce(`Unable to align: Inconsistent double quotes at line ${u}`);if(l=_().adjust_column_stats(l,r.length),null===l)return void ce("Unable to allign: Internal Rainbow CSV Error");await pe(s,"Preparing final alignment");let p=_().align_columns(c,f,l,r);await pe(s,"Aligning columns");let h=be("align_in_scratch_file",!1),g=n.uri&&"untitled"==n.uri.scheme;if(h&&!g){let e={content:p,language:n.languageId},r=await t.workspace.openTextDocument(e);d.add(r.fileName),await t.window.showTextDocument(r),Ce(r.fileName)}else await ge(e,n,p),d.add(n.fileName),Ce(n.fileName)}))}async function nt(){if(c)return void ce("This command is currently unavailable in web mode.");let e=ke();if(!e)return;let n=e.fileName,r=g.get(ae(n));if(!r)return;let i=await t.workspace.openTextDocument(r),o=await t.window.showTextDocument(i);await async function(e,t){let n=e.getText(),r=ke(t);r&&await ge(t,r,n)}(e,o)}async function rt(e,o,s=null){let u=o.msg_type;if("handshake"==u){var f={msg_type:"handshake",backend_language:he("rbql_backend_language","js"),encoding:he("rbql_encoding","utf-8")};_().sample_preview_records_from_context(O,f,p,m);let t=Fe(O.input_document_path);q.has(t)&&(f.last_query=q.get(t));let n=he("rbql_query_history",[]);f.query_history=n,f.policy=O.policy,f.with_headers=O.with_headers,f.header_for_ui=O.header_for_ui,f.is_web_ext=c,s&&(f.integration_test_language=s.rbql_backend,f.integration_test_query=s.rbql_query,f.integration_test_with_headers=s.with_headers||!1,f.integration_test_delay=s.integration_test_delay||2e3),await e.postMessage(f)}if("fetch_table_header"==u)try{let t=o.table_id,r=o.encoding,i=O.input_document_path?n.dirname(O.input_document_path):null,s=_().find_table_path(T,i,t);if(!s)return;let l=await _().read_header(s,r);if(!l)return;let[u,c]=a.smart_split(l,O.delim,O.policy,!1);c||e.postMessage({msg_type:"fetch_table_header_response",header_for_ui:u})}catch(e){console.error("Unable to get join table header: "+String(e))}if("update_query"==u){let e=o.query;if(!e)return;O.input_document_path&&q.set(Fe(O.input_document_path),e)}if("with_headers_change"==u&&(O.with_headers=o.with_headers,O.input_document_path&&await de(ye(O.input_document_path),O.with_headers)),"navigate"==u){var h=o.direction;"backward"==h?O.requested_start_record-=p:"forward"==h?O.requested_start_record+=p:"begin"==h?O.requested_start_record=0:"end"==h&&(O.requested_start_record=O.input_document.lineCount);let t={msg_type:"navigate"};_().sample_preview_records_from_context(O,t,p,m),await e.postMessage(t)}if("run"==u){let r=o.query,s=o.backend_language,a=o.encoding,u=o.output_dialect,f=o.with_headers;await async function(e){let t=he("rbql_query_history",[]),n=t.indexOf(e);-1!=n?t.splice(n,1):t.length>=20&&t.splice(0,1),t.push(e),await de("rbql_query_history",t)}(r),await async function(e,r,o,s,a,u,f){let p=new we("run-rbql-query");p.log_simple_event("start"),q.set(Fe(r),a);let h=["python3","python"],[d,m,y]=[O.delim,O.policy,O.comment_prefix],[b,w]=[d,m];"csv"==u&&([b,w]=[",",Q]),"tsv"==u&&([b,w]=["\t",G]),O.output_delim=b,O.output_policy=w;let x=c?null:n.join(function(e){let t=be("rbql_output_dir","TMP");return"TMP"==t?i.tmpdir():"INPUT"==t?n.dirname(e):t}(r),function(e,t){var r=n.basename(e),i=n.extname(r),o={"\t":".tsv",",":".csv"},s=".txt";o.hasOwnProperty(t)?s=o[t]:i.length>1&&(s=i);let a=r+s;return a==r&&(a+=".txt"),a}(r,b));if(a.startsWith("test ")){p.log_simple_event("test mode");let t=[_e["rbql mock/rbql_mock.py"],a],n=await Je(h,t,p);return console.log(JSON.stringify(n)),n.hasOwnProperty("error_type")||n.hasOwnProperty("error_msg")?void await Qe(e,n.error_type,n.error_msg):void await Qe(e,null,null)}if("js"==s){p.log_simple_event("using js backend");let n=[],i=null,s=ue(b,w);try{if(c){p.log_simple_event("using web mode");let r={content:(await _().rbql_query_web(a,O.input_document,d,m,b,w,n,f,y)).join("\n"),language:s};s==J&&(H.dynamic_dialect_for_next_request=re(b,w)),H.autodetection_temporarily_disabled_for_rbql=!0,i=await t.workspace.openTextDocument(r),await Qe(e,null,null),await async function(e,n){try{await t.window.showTextDocument(e)}catch(e){return void ce("Unable to open RBQL result document")}await $e(n)}(i,n),H.dynamic_dialect_for_next_request=null,H.autodetection_temporarily_disabled_for_rbql=!1,p.log_simple_event("finished OK")}else{p.log_simple_event("using electron mode");let l={bulk_read:!0};await _().rbql_query_node(T,a,r,d,m,x,b,w,o,n,f,y,"",l),g.set(ae(x),r),s==J&&(H.dynamic_dialect_for_next_request=re(b,w)),H.autodetection_temporarily_disabled_for_rbql=!0,i=await t.workspace.openTextDocument(x),await Qe(e,null,null),await De(i,b,w,n),H.dynamic_dialect_for_next_request=null,H.autodetection_temporarily_disabled_for_rbql=!1,p.log_simple_event("finished OK")}}catch(t){let[n,r]=(null===l&&(l=__webpack_require__(6945)),l).exception_to_error_info(t);return p.log_simple_event("finished with error"),void await Qe(e,n,r)}}else{if(p.log_simple_event("using python backend"),c)return void await Qe(e,"Input error","Python backend for RBQL is not supported in web version, please use JavaScript backend.");let n=Buffer.from(a,"utf-8").toString("base64");y||(y="");let i=[_e["rbql_core/vscode_rbql.py"],n,r,d,m,x,b,w,y,o];f&&i.push("--with_headers");let s=await Je(h,i,p);if(s.hasOwnProperty("error_type")||s.hasOwnProperty("error_msg"))return p.log_simple_event("finished with error"),void await Qe(e,s.error_type,s.error_msg);p.log_simple_event("finished OK"),await Qe(e,null,null),H.autodetection_stoplist.add(x),g.set(ae(x),r),H.autodetection_temporarily_disabled_for_rbql=!0;let l=ue(b,w),u=await t.workspace.openTextDocument(x);H.autodetection_temporarily_disabled_for_rbql=!1,l==J&&(H.dynamic_dialect_for_next_request=re(b,w)),await De(u,b,w,s.warnings),H.dynamic_dialect_for_next_request=null}}(e,O.input_document_path,a,s,r,u,f)}if("edit_udf"==u){if(c)return void await Qe(e,"Input error","UDFs are currently not supported in web version");let s=null,a="";"js"==o.backend_language?(s=n.join(i.homedir(),".rbql_init_source.js"),a=_().get_default_js_udf_content()):(s=n.join(i.homedir(),".rbql_init_source.py"),a=_().get_default_python_udf_content()),r.existsSync(s)||r.writeFileSync(s,a);let l=await t.workspace.openTextDocument(s);await t.window.showTextDocument(l)}"global_param_change"==u&&await de(o.key,o.value)}function it(e,n,r){for(const i of r){let r=null;r=c?_e[i]:e.webview.asWebviewUri(t.Uri.file(_e[i])),n=n.replace(`src="${i}"`,`src="${r}"`)}return n}async function ot(e=null){let o=t.window;if(!o)return;let s=o.activeTextEditor;if(!s)return;let a=s.document;if(!a)return;let l=a.uri;if(!l)return;if("file"!=l.scheme&&"untitled"!=l.scheme&&!c)return;if("file"==l.scheme&&a.isDirty&&!c)return void ce("Unable to run RBQL: file has unsaved changes");let u=null;if("untitled"!=l.scheme||c)u=a.fileName;else{let e=a.getText(),t=String(Math.floor(1e6*Math.random()));u=n.join(i.tmpdir(),`${h}_${t}.txt`),r.writeFileSync(u,e)}if(!u)return void ce("Unable to run RBQL for this file");let[_,f,p]=Ee(a);null===f&&(f="monocolumn",_="monocolumn");let d=be("rbql_with_headers_by_default",!1),g=he(ye(u),d),m=xe(a,_,f,p);O={input_document:a,input_document_path:u,requested_start_record:0,delim:_,policy:f,comment_prefix:p,with_headers:g,header_for_ui:m},j=t.window.createWebviewPanel("rbql-console","RBQL Console",t.ViewColumn.Active,{enableScripts:!0}),I||(I=await yt("rbql_client.html")),j.webview.html=it(j,I,["contrib/textarea-caret-position/index.js","rbql_suggest.js","rbql_client.js","rbql_logo.svg"]),j.webview.onDidReceiveMessage((function(t){rt(j.webview,t,e)}))}function st(e,t,n){let[r,i,o]=["csv",",",Q],s=0,a=e.getText();if(!a)return[r,i,o];for(let e of t){if(" "==e||"."==e)continue;let t=0;for(let r=0;r<n&&r<a.length;r++)a[r]==e&&(t+=1);if(t>s){let n=le(e),a=ue(e,n);[r,i,o]=[a,e,n],s=t}}return[r,i,o]}async function at(e,t,n,r,i=null){let o=new we("autodetection",i);if(o.log_doc_event("starting...",r),n.autodetection_temporarily_disabled_for_rbql)return o.log_simple_event("abort: disabled for rbql"),[r,!1];if(!te(r))return o.log_simple_event("abort: ineligible doc"),[r,!1];if(!be("enable_separator_autodetection",!1,t))return o.log_simple_event("abort: disabled in config"),[r,!1];var a=r.fileName,l=r.languageId;if(n.autodetection_stoplist.has(a))return o.log_simple_event("abort: doc path in stoplist"),[r,!1];let u=(a.endsWith(".csv")||a.endsWith(".CSV"))&&"csv"==l;if(l!=W&&!u)return o.log_simple_event("abort: ineligible original language id"),[r,!1];let _=be("autodetect_separators",[],t).map((e=>"TAB"===e?"\t":e));if(!Y.hasOwnProperty(l)&&L&&L.file_path===a&&Math.abs(Date.now()-L.timestamp)<1e3)return o.log_simple_event("abort: recent doc language switch prevention"),[r,!1];let c=be("comment_prefix","",t)||"#";o.log_simple_event("starting standard dialect autodetection...");let[f,p,h,d]=function(e,t,n,r){let i=[];for(let e of n){let t=le(e),n=ue(e,t);n&&t&&(i.push([n,e,t]),","!=e&&";"!=e||i.push([J,e,V]))}let o=be("csv_lint_detect_trailing_spaces",!1,e),a=be("autodetection_min_line_count",10,e);if(t.lineCount<a)return[null,null,null];let[l,u,_,c]=[null,null,null,null],f=1;for(let e of i){let[n,i,p]=e,[h,d,g,m,y,b]=s.parse_document_records(t,i,p,r,!0,-1,!1,!0,o,f+1);if(null!==m||1!=g.size)continue;if(d<a)continue;let w=Array.from(g.keys())[0];w>=f+1&&(f=w,[l,u,_]=[n,i,p],c=y)}return[l,u,_,c]}(t,r,_,c);if(f?n.lint_results.set(`${a}.${f}`,{is_ok:!0,first_trailing_space_line:d}):!f&&u&&(o.log_simple_event("starting frequency-based dialect autodetection..."),[f,p,h]=st(r,_,1e4)),!f)return o.log_simple_event("abort: content-based autodetection did not detect anything"),[r,!1];if(f==J&&await oe(n,a,re(p,h)),f==l)return o.log_simple_event("abort: autodetected dialect matches the original one"),[r,!1];Ve(a,l,n.original_language_ids),o.log_simple_event(`autodetection successful - switching from ${l} to ${f}`);let g=await e.languages.setTextDocumentLanguage(r,f);return o.log_doc_event("after language switch",g),[g,!0]}async function lt(e){if(!e)return;N&&(N.dispose(),N=null);let n=new we("handle_first_edit_for_an_empty_doc");n.log_doc_event("starting",e.document),await at(t,t.workspace.getConfiguration("rainbow_csv"),H,e.document,n.context_id)}async function ut(e){let t=new we("handle_editor_switch"),n=ke(e);t.log_doc_event("editor switch",n),Te(n,t),await Ie(n,t)}function _t(e){null!==U&&clearTimeout(U),U=setTimeout((()=>{!Le()&&R&&R.hide()}),10)}async function ct(e){let n=new we("handle_doc_open");if(n.log_doc_event("opening doc",e),!te(e))return void n.log_simple_event("abort: ineligible doc");if(be("enable_separator_autodetection",!1)&&null===N&&e.isUntitled&&e.lineCount<=1)return N=t.workspace.onDidChangeTextDocument(lt),void n.log_simple_event("creating empty doc subscription");let r=!1;[e,r]=await at(t,t.workspace.getConfiguration("rainbow_csv"),H,e,n.context_id),n.log_doc_event(`after autodetection. filetype changed: ${r}`,e),Ne(e)&&(n.log_simple_event("active doc - enabling features"),Te(e,n),await Ie(e,n)),n.log_simple_event("finishing")}async function ft(e){let t=new we("handle_doc_close");if(t.log_doc_event("closing doc",e),!ne(e))return t.log_simple_event("abort: non rainbow doc"),void(L=null);L={file_path:e.fileName,timestamp:Date.now()},Ne(e)&&(t.log_simple_event("disabling ui elements"),Pe()),t.log_simple_event("finalizing")}async function pt(e){let t=H.logging_enabled;H.logging_enabled=be("enable_debug_logging",!1),H.logging_enabled&&!t&&new we("config change").log_simple_event("logging enabled"),Se()}async function ht(e,o){if(c)return void ce("This command is currently unavailable in web mode.");var s=e.fsPath;if(!s||!r.existsSync(s))return void t.window.showErrorMessage("Invalid file");var a=1024e3,l=r.statSync(s).size;if(l<=a){t.window.showWarningMessage("Rainbow CSV: The file is not big enough, showing the full file instead. Use this preview for files larger than 1MB");let e=await t.workspace.openTextDocument(s);return void await t.window.showTextDocument(e)}let u=n.basename(s);const _=n.join(i.tmpdir(),`.rb_csv_preview.${o}.${u}`);r.open(s,"r",((e,n)=>{if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");var i=Buffer.alloc(a);let s="head"==o?0:Math.max(l-a,0);r.read(n,i,0,a,s,(function(e,n){if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");const s=i.toString();let a=null;a="head"==o?s.substr(0,s.lastIndexOf(s.includes("\r\n")?"\r\n":"\n")):s.substr(s.indexOf("\n")+1),r.writeFileSync(_,a),t.workspace.openTextDocument(_).then((e=>t.window.showTextDocument(e)))}))}))}function dt(e,n){let r=t.languages.registerHoverProvider(e,{provideHover:(e,n,r)=>function(e,n,r,i){if(!be("enable_tooltip",!1))return;let[o,s,a]=Ee(e),l=_().get_cursor_position_info(t,e,o,s,a,r);if(!l||i.isCancellationRequested)return null;let u=be("enable_tooltip_column_names",!1),c=ve(e,o,s,a);if(!c)return null;let[f,p]=_().format_cursor_position_info(l,c,u,!0,25),h=new t.MarkdownString;return h.appendText(p),new t.Hover(h)}(e,0,n,r)});n.subscriptions.push(r)}class gt{constructor(){}async provideDocumentRangeSemanticTokens(e,n,r){let[i,o,s]=Ee(e);if(!o||e.languageId!=J)return null;let a=_().parse_document_range(t,e,i,o,s,n);const l=new t.SemanticTokensBuilder(ee);for(let e of a)if(e.hasOwnProperty("comment_range"))l.push(e.comment_range,Z);else for(let t=0;t<e.record_ranges.length;t++){let n=t%X.length;if(0!=n)for(let r of e.record_ranges[t])l.push(r,X[n])}return l.build()}}class mt{constructor(){}async provideDocumentRangeSemanticTokens(e,n,r){let[i,o,s]=Ee(e);if(y.has(e.fileName)&&!s&&(s="#####COMMENT_PREFIX_THAT_CAN_NOT_OCCURE_IN_A_NORMAL_FILE_AND_EVEN_IF_IT_OCCURES_NOT_A_BIG_DEAL####"),!s||null===o||o==V)return null;const a=new t.SemanticTokensBuilder(ee);let l=Math.max(0,n.start.line-50),u=Math.min(e.lineCount,n.end.line+50);for(let n=l;n<u;n++){let r=e.lineAt(n).text;r.startsWith(s)&&a.push(new t.Range(n,0,n,r.length),Z)}return a.build()}}async function yt(e){if(c){let n=await async function(e,n){let r=t.Uri.joinPath(e,n),i=await t.workspace.fs.readFile(r);return(new TextDecoder).decode(i)}(f,e);return n}return r.readFileSync(_e[e],"utf8")}e.activate=async function(e){T=e.globalState,c&&(f=e.extensionUri);for(let n in _e)_e.hasOwnProperty(n)&&(_e[n]=c?t.Uri.joinPath(e.extensionUri,n):e.asAbsolutePath(n));if(be("enable_tooltip",!1))for(let t in Y)Y.hasOwnProperty(t)&&dt(t,e);H.logging_enabled=be("enable_debug_logging",!1);var n=t.commands.registerCommand("rainbow-csv.CSVLint",Be),r=t.commands.registerCommand("rainbow-csv.RBQL",ot),i=t.commands.registerCommand("rainbow-csv.SetHeaderLine",ze),o=t.commands.registerCommand("rainbow-csv.SetCommentPrefix",Ge),s=t.commands.registerCommand("rainbow-csv.SetVirtualHeader",Xe),a=t.commands.registerCommand("rainbow-csv.SetJoinTableName",Ze),l=t.commands.registerCommand("rainbow-csv.ColumnEditBefore",(async function(){await Ke("ce_before")})),u=t.commands.registerCommand("rainbow-csv.ColumnEditAfter",(async function(){await Ke("ce_after")})),_=t.commands.registerCommand("rainbow-csv.ColumnEditSelect",(async function(){await Ke("ce_select")})),p=t.commands.registerCommand("rainbow-csv.RainbowSeparator",qe),h=t.commands.registerCommand("rainbow-csv.RainbowSeparatorOff",He),d=t.commands.registerCommand("rainbow-csv.RainbowSeparatorOn",Ye),g=t.commands.registerCommand("rainbow-csv.SampleHead",(async function(e){await ht(e,"head")})),m=t.commands.registerCommand("rainbow-csv.SampleTail",(async function(e){await ht(e,"tail")})),y=t.commands.registerCommand("rainbow-csv.Align",tt),b=t.commands.registerCommand("rainbow-csv.Shrink",et),w=t.commands.registerCommand("rainbow-csv.CopyBack",nt),x=t.commands.registerCommand("rainbow-csv.InternalTest",Ue),v=t.workspace.onDidOpenTextDocument(ct),E=t.workspace.onDidCloseTextDocument(ft),R=t.workspace.onDidChangeConfiguration(pt),S=t.window.onDidChangeActiveTextEditor(ut);try{A=t.window.createOutputChannel("rainbow_csv_debug_channel",{log:!0})}catch(e){console.error("Rainbow CSV: Failed to create output log channel")}Oe(),Se(),be("comment_prefix",null)&&Ae(),e.subscriptions.push(n),e.subscriptions.push(r),e.subscriptions.push(s),e.subscriptions.push(l),e.subscriptions.push(u),e.subscriptions.push(_),e.subscriptions.push(p),e.subscriptions.push(h),e.subscriptions.push(d),e.subscriptions.push(g),e.subscriptions.push(m),e.subscriptions.push(a),e.subscriptions.push(y),e.subscriptions.push(b),e.subscriptions.push(w),e.subscriptions.push(i),e.subscriptions.push(o),e.subscriptions.push(x),e.subscriptions.push(v),e.subscriptions.push(E),e.subscriptions.push(S),e.subscriptions.push(R),await fe(1e3),ct(ke())},e.deactivate=function(){},e.autodetect_dialect_frequency_based=st,e.try_autodetect_and_set_rainbow_filetype=at})();var __webpack_export_target__=exports;for(var i in __webpack_exports__)__webpack_export_target__[i]=__webpack_exports__[i];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})(); |