2 lines
241 KiB
JavaScript
2 lines
241 KiB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
|
||
(()=>{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),a={nul:0,control:0};function i(e,t){return 0===e?t.nul:e<32||e>=127&&e<160?t.control:function(e){var t,n=0,a=r.length-1;if(e<r[0][0]||e>r[a][1])return!1;for(;a>=n;)if(t=Math.floor((n+a)/2),e>r[t][1])n=t+1;else{if(!(e<r[t][0]))return!0;a=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 i(e,t);for(var n=0,r=0;r<e.length;r++){var a=i(e.charCodeAt(r),t);if(a<0)return-1;n+=a}return n}(e,a)}},4012:(e,t,n)=>{const r=n(1398),a=n(7507),i=n(9175),o=n(2196),l=n(6510),s=n(3568),c=n(4285);var u=null,_=null;function d(){return null===_&&(_=n(785)),_}const p=void 0===o.homedir;var f=null;const g=100,h="vscode_rbql_scratch";var m=new Set,w=new Map,b=new Map,y=new Set,x=null,v=null,q=null,E=null,S=null,O=null,A=null,R=null,j=null,k=new Map,T=null,I=null,P=null,C=null,M=null,N=null,D=null,$=null,L=null,B=null;let U=null,F=null,V=null,W=null;const z="plaintext",J="dynamic csv",Q="quoted",G="whitespace",H="quoted_rfc",Y="simple";let Z={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 X={csv:[",",Q],tsv:["\t",Y],"csv (semicolon)":[";",Q],"csv (pipe)":["|",Y],"csv (whitespace)":[" ",G],[J]:[null,null]},K="comment",ee=["rainbow1","rainbow2","rainbow3","rainbow4","rainbow5","rainbow6","rainbow7","rainbow8","rainbow9","rainbow10"],te=ee.concat([K]),ne=new r.SemanticTokensLegend(te);function re(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 ae(e){return re(e)&&X.hasOwnProperty(e.languageId)}function ie(e,t){return{delim:e,policy:t}}function oe(e){return"dynamic_dialect:"+e}async function le(e,t,n){await me(oe(t),n),e.dynamic_document_dialects.set(t,n)}function se(e){if(Z.dynamic_document_dialects.has(e))return Z.dynamic_document_dialects.get(e);let t=he(oe(e),null);return t&&t.hasOwnProperty("delim")&&t.hasOwnProperty("policy")?(Z.dynamic_document_dialects.set(e,t),t):null}function ce(e){return e?e.toLowerCase():e}function ue(e){for(let t in X)if(X.hasOwnProperty(t)&&X[t][0]==e)return X[t][1];return Y}function _e(e,t){for(let n in X)if(X.hasOwnProperty(n)&&X[n][0]==e&&X[n][1]==t)return n;return J}let de={"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 pe(e){var t=r.window;t&&t.showErrorMessage(e)}function fe(e){return new Promise((t=>setTimeout(t,e)))}async function ge(e,t){e.report({message:t}),await fe(0)}function he(e,t){if(P){var n=P.get(e);if(null!=n)return n}return t}async function me(e,t){return!(!P||!e||(await P.update(e,t),0))}async function we(e,t,n){let a=new r.Range(0,0,t.lineCount,0),i=t.validateRange(a);await e.edit((e=>e.replace(i,n)))}function be(e){return"rbql_header_info:"+e}function ye(e){return"rbql_with_headers:"+e}function xe(e,t,n=null){return n||(n=r.workspace.getConfiguration("rainbow_csv")),n?n.get(e):t}class ve{constructor(e,t=null){this.context_name=e,this.logging_enabled=Z.logging_enabled,this.context_id=null===t?Z.logging_next_context_id:t,Z.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`,j.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}`;j.info(t)}catch(e){return void console.error(`Rainbow CSV: Unexpected log failure. ${this.context_name}:${this.event_name}`)}}}function qe(e,t,n,r){let[a,i]=d().get_header_line(e,r);return i?c.smart_split(i,t,n,!1)[0]:null}function Ee(e,t,n,r){var a=e.fileName;if(a){let e=he(be(a),null);if(null!==e&&null!==e.header)return e.header}return qe(e,t,n,r)}function Se(e){let t=e.languageId,n=null,r=null,a="";if(a=Z.custom_comment_prefixes.has(e.fileName)?Z.custom_comment_prefixes.get(e.fileName):xe("comment_prefix",""),t!=J&&X.hasOwnProperty(t))return[n,r]=X[t],[n,r,a];let i=null;return t==J&&(i=se(e.fileName)),i?[i.delim,i.policy,a]:[null,null,null]}class Oe{constructor(){}async provideDocumentSymbols(e){let[t,n,a]=Se(e);if(!n)return null;let i=null;var o=e.fileName;if(o){let e=he(be(o),null);null!==e&&null!==e.header_line_num&&(i=e.header_line_num)}if(null===i&&(i=d().get_header_line(e,a)[0]),null===i||i>=e.lineCount-1)return null;let l=new r.Range(i,0,e.lineCount-1,65535);l=e.validateRange(l);let s=new r.Range(i,0,i,65535);if(!l.contains(s))return;let c=r.SymbolKind.File;return[new r.DocumentSymbol("data","",c,l,s)]}}function Ae(e=!1){if(!xe("enable_sticky_header",!1))return void(null!==W&&(W.dispose(),W=null));if(null!==W&&e&&(W.dispose(),W=null),null!==W)return;let t=new Oe,n=[];for(let e in X)X.hasOwnProperty(e)&&n.push({language:e});W=r.languages.registerDocumentSymbolProvider(n,t)}function Re(){let e=new wt;null!==F&&F.dispose();let t={language:J};F=r.languages.registerDocumentRangeSemanticTokensProvider(t,e,ne)}function je(){let e=new bt;null!==V&&V.dispose();let t=[];for(let e in X)X.hasOwnProperty(e)&&e!=J&&t.push({language:e});V=r.languages.registerDocumentRangeSemanticTokensProvider(t,e,ne)}async function ke(e=null){let t=new ve("choose_dynamic_separator");t.log_doc_event("starting",a);let n=Ce();if(!n)return;var a=Me(n);if(!re(a))return;let i=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):""}(n,a);I||(I=await yt("dialect_select.html")),(M=r.window.createWebviewPanel("rainbow-dialect-select","Choose CSV Dialect",r.ViewColumn.Beside,{enableScripts:!0})).webview.html=ot(M,I,["dialect_select.js"]),M.webview.onDidReceiveMessage((function(n){!async function(e,t,n,a,i,o){if(n){if("dialect_handshake"==n.msg_type){let e={msg_type:"dialect_handshake",selected_separator:a};o&&o.integration_test&&(e.integration_test=!0),await t.webview.postMessage(e)}if("apply_dialect"==n.msg_type){let a=n.delim,o=n.policy,l=n.comment_prefix;if("whitespace"==o&&" "!=a)return void pe("Selected policy can only be used with whitespace separator");if("double_escape"==o&&'"'==a)return void pe("Double quote separator in incompatible with double quote escape policy");if(!a)return void pe("Separator is empty");if(-1==[Y,H,Q,G].indexOf(o))return void pe("Selected policy is empty or not supported");t.dispose(),await le(Z,e.fileName,ie(a,o)),Z.custom_comment_prefixes.set(e.fileName,l),e.languageId==J&&Ne(e)?await Te(e,i):await r.languages.setTextDocumentLanguage(e,J)}}}(a,M,n,i,t,e)}))}async function Te(e,t){if(t.log_doc_event("start enable-rainbow-features-if-csv",e),!ae(e))return void t.log_simple_event("abort enable-rainbow-features-if-csv: non-rainbow dialect");E&&E.hide();var n=e.languageId;n==J&&null!=Z.dynamic_dialect_for_next_request&&(await le(Z,e.fileName,Z.dynamic_dialect_for_next_request),Z.dynamic_dialect_for_next_request=null);let[i,o,l]=Se(e);if(!i||!o)return t.log_simple_event("abort enable-rainbow-features-if-csv: missing delim or policy"),Ie(),A||(A=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),A.text="Choose Separator...",A.tooltip="Click to choose Dynamic CSV separator",A.command="rainbow-csv.RainbowSeparator",void A.show();l&&r.languages.setLanguageConfiguration(n,{comments:{lineComment:l}}),n==J&&Re(),function(e){A&&A.hide(),d().show_lint_status_bar_button(r,Z,e.fileName,e.languageId),x||(x=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),x.text="Query",x.tooltip="Click to run SQL-like RBQL query",x.command="rainbow-csv.RBQL",x.show(),De(e.fileName),q||(q=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),q.text="Rainbow OFF",q.tooltip="Click to restore original file type and syntax",q.command="rainbow-csv.RainbowSeparatorOff",q.show(),function(e){let t=w.get(ce(e));if(!t||-1!=t.indexOf(h))return;let n=a.basename(t);S||(S=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),S.text="Copy Back",S.tooltip=`Copy to parent table: ${n}`,S.command="rainbow-csv.CopyBack",S.show()}(e.fileName),$e(),xe("enable_cursor_position_info",!1)&&(D=r.window.onDidChangeTextEditorSelection(dt))}(e),await Le(e,!1),t.log_simple_event("finish enable-rainbow-features-if-csv")}function Ie(){let e=[Z.lint_status_bar_button,x,q,S,v,O,A,E];for(let t=0;t<e.length;t++)e[t]&&e[t].hide();D&&(D.dispose(),D=null)}function Pe(e,t){if(t.log_doc_event("start disable-rainbow-features-if-non-csv",e),ae(e))return E&&E.hide(),void t.log_simple_event("abort disable-rainbow-features-if-non-csv: is rainbow dialect");t.log_simple_event("perform disable-rainbow-features-if-non-csv"),Ie(),re(e)&&Z.reenable_rainbow_language_infos.has(e.fileName)&&(t.log_simple_event("show rainbow-on status button"),E||(E=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),E.text="Rainbow ON",E.tooltip="Click to reenable Rainbow CSV for this file",E.command="rainbow-csv.RainbowSeparatorOn",E.show())}function Ce(){var e=r.window;return e&&e.activeTextEditor||null}function Me(e=null){return e||(e=Ce()),e&&e.document||null}function Ne(e){let t=Me();return t&&t.uri&&e&&e.uri&&t.uri.toString()==e.uri.toString()}function De(e){v||(v=r.window.createStatusBarItem(r.StatusBarAlignment.Left)),m.has(e)?(v.text="Shrink",v.tooltip="Click to shrink table (Then you can click again to align)",v.command="rainbow-csv.Shrink"):(v.text="Align",v.tooltip="Click to align table (Then you can click again to shrink)",v.command="rainbow-csv.Align"),v.show()}function $e(){let e=Ce();if(!e)return!1;let t=d().get_cursor_position_if_unambiguous(e);if(!t)return!1;let n=Me(e),[a,i,o]=Se(n),l=d().get_cursor_position_info(r,n,a,i,o,t);if(!l)return!1;let s=xe("enable_tooltip_column_names",!1),c=Ee(n,a,i,o);if(!c)return!1;let[u,_]=d().format_cursor_position_info(l,c,s,!1,25);return function(e,t){O||(O=r.window.createStatusBarItem(r.StatusBarAlignment.Right,1e3)),O.text=t,O.tooltip=e,O.show()}(u,_),!0}async function Le(e,t){if(e||(e=Me()),!ae(e))return null;var n=e.fileName,a=e.languageId;let i=`${n}.${a}`;if(!t){if(Z.lint_results.has(i))return null;if(!xe("enable_auto_csv_lint",!1))return null}let[o,l,c]=Se(e);if(null===l)return null;Z.lint_results.set(i,{is_processing:!0}),d().show_lint_status_bar_button(r,Z,n,a);let u=xe("csv_lint_detect_trailing_spaces",!1),[_,p,f,g,h,m]=s.parse_document_records(e,o,l,c,!0,-1,!1,!0,u),w={is_ok:null===g&&f.size<=1,first_defective_line:g,fields_info:f,first_trailing_space_line:h};return Z.lint_results.set(i,w),t&&await fe(500),d().show_lint_status_bar_button(r,Z,n,a),w}async function Be(){return await Le(null,!0)}async function Ue(e){return e&&e.check_initialization_state?{initialized:null!==P,lazy_loaded:null!==_}:e&&e.check_last_rbql_report?L:e&&e.check_last_rbql_warnings?{warnings:B}:null}async function Fe(e){if(B=[],e&&e.length){var t=r.window;if(!t)return null;for(var n=0;n<e.length;n++)t.showWarningMessage("RBQL warning: "+e[n]);B=e}}async function Ve(e,t,n,a){try{await r.window.showTextDocument(e)}catch(e){return void pe("Unable to open RBQL result document")}let i=_e(t,n);i&&e.languageId!=i&&await r.languages.setTextDocumentLanguage(e,i),await Fe(a)}function We(e){return e&&-1!=e.indexOf(h)?h:e}async function ze(e,t){let n=null;try{n=await function(e,t){return new Promise((function(n,r){let a="",i="",o=l.spawn(e,t,{windowsHide:!0});o.stdout.on("data",(function(e){a+=e.toString()})),o.stderr.on("data",(function(e){i+=e.toString()})),o.on("close",(function(e){n({exit_code:e,stdout:a,stderr:i})})),o.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 a of e){if(n.log_simple_event(`Attempting interpreter '${a}' ...`),r=await ze(a,t),!r||!r.hasOwnProperty("invocation_error")||!r.invocation_error)return r;n.log_simple_event(`Interpreter '${a}' 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),L=r,await e.postMessage(r)}async function Ge(){let e=Ce();if(!e)return;var t=Me(e);if(!t)return;let[n,r,a]=Se(t);if(null===r)return void pe("Unable to set header line: no separator specified");let i=t.fileName;if(!i)return void pe("Unable to set header line for non-file documents");let o=e.selection.start.line,l=t.lineAt(o).text,s=c.smart_split(l,n,r,!1)[0];await me(be(i),{header_line_num:o,header:s}),Ae(!0)}function He(e,t,n){e&&(X.hasOwnProperty(t)||n.set(e,t))}async function Ye(){let e=Ce();if(!e)return;var t=Me(e);if(!t)return;let n=e.selection;if(!n)return void pe("Selection is empty");let a=t.lineAt(n.start.line).text.substring(n.start.character,n.end.character);Z.custom_comment_prefixes.set(t.fileName,a),a?y.delete(t.fileName):y.add(t.fileName),a&&r.languages.setLanguageConfiguration(t.languageId,{comments:{lineComment:a}}),t.languageId==J?Re():je()}async function Ze(){let e=new ve("restore_original_language"),t=Me();if(e.log_doc_event("starting",t),!t)return;let n=t.fileName,a=z;if(Z.original_language_ids.has(n)&&(a=Z.original_language_ids.get(n)),!X.hasOwnProperty(a)&&X.hasOwnProperty(t.languageId)){if(n){let e={language_id:t.languageId},r=se(n);r&&(e.dynamic_dialect_info=r),Z.reenable_rainbow_language_infos.set(n,e),Z.autodetection_stoplist.add(n)}t=await r.languages.setTextDocumentLanguage(t,a),Pe(t,e),async function(e){await me(oe(e),void 0),Z.dynamic_document_dialects.delete(e)}(n)}else pe("Unable to restore original language")}async function Xe(){var e=Me();if(!e)return;let t=e.fileName;if(!Z.reenable_rainbow_language_infos.has(t))return void pe("Unable to re-enable rainbow highlighting automatically, select filetype manually or select a new separator with cursor.");let n=Z.reenable_rainbow_language_infos.get(t);Z.autodetection_stoplist.delete(t),n.hasOwnProperty("dynamic_dialect_info")&&await le(Z,t,n.dynamic_dialect_info),He(t,e.languageId,Z.original_language_ids),Z.reenable_rainbow_language_infos.delete(t),E&&E.hide(),await r.languages.setTextDocumentLanguage(e,n.language_id)}async function Ke(){if(p)return void pe("This command is currently unavailable in web mode.");var e=Me();if(!e)return;let t=e.fileName;if(!t)return void pe("Unable to use this document as join table");let n=await r.window.showInputBox({prompt:"Input table name to use in RBQL JOIN expressions instead of table path",value:"b"});n&&await me(d().make_table_name_key(n),t)}async function et(){var e=Me();let[t,n,a]=Se(e);if(null===n)return void pe("Unable to set virtual header: no separator specified");var i=e.fileName;if(!i)return void pe("Unable to edit column names for non-file documents");var o=Ee(e,t,n,a),l=o?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)}(o,t):"",s={prompt:"Adjust column names displayed in hover tooltips. Actual header line and file content won't be affected.",value:l};let u=await r.window.showInputBox(s);if(!u)return;let _=c.smart_split(u,t,n,!1)[0];await me(be(i),{header_line_num:null,header:_})}async function tt(e){let t=Ce();if(!t)return;let n=t.document;if(!n)return;let[a,i,o]=Se(n);if(null===i)return;let l=d().get_cursor_position_if_unambiguous(t);if(!l)return void pe("Unable to enter column edit mode: make sure that no text is selected and only one cursor is active");if(n.lineCount>=1e4)return void pe("Multicursor column edit works only for files smaller than 10000 lines.");let s=d().get_cursor_position_info(r,n,a,i,o,l).column_number,[c,u,_]=d().generate_column_edit_selections(r,n,a,i,o,e,s);null===u?(_&&r.window.showWarningMessage(_),t.selections=c,await r.window.showTextDocument(n)):pe(u)}async function nt(){let e=Ce(),t=Me(e);if(!ae(t))return;let[n,a,i]=Se(t);if(null===a)return;let o={location:r.ProgressLocation.Window,title:"Rainbow CSV"};await r.window.withProgress(o,(async o=>{await ge(o,"Preparing");let[l,s]=d().shrink_columns(t,n,a,i);s?pe(`Unable to shrink: Inconsistent double quotes at line ${s}`):(m.delete(t.fileName),De(t.fileName),null!==l?(await ge(o,"Shrinking columns"),await we(e,t,l)):r.window.showWarningMessage("No trailing whitespaces found, skipping"))}))}async function rt(){let e=Ce(),t=Me(e);if(!ae(t))return;let[n,a,i]=Se(t);if(null===a)return;let o={location:r.ProgressLocation.Window,title:"Rainbow CSV"};await r.window.withProgress(o,(async o=>{await ge(o,"Calculating column statistics");let l=xe("double_width_alignment",!0),[s,c,u,_]=d().calc_column_stats(t,n,a,i,l);if(c)return void pe(`Unable to align: Inconsistent double quotes at line ${c}`);if(s=d().adjust_column_stats(s,n.length),null===s)return void pe("Unable to allign: Internal Rainbow CSV Error");await ge(o,"Preparing final alignment");let p=d().align_columns(u,_,s,n);await ge(o,"Aligning columns");let f=xe("align_in_scratch_file",!1),g=t.uri&&"untitled"==t.uri.scheme;if(f&&!g){let e={content:p,language:t.languageId},n=await r.workspace.openTextDocument(e);m.add(n.fileName),await r.window.showTextDocument(n),De(n.fileName)}else await we(e,t,p),m.add(t.fileName),De(t.fileName)}))}async function at(){if(p)return void pe("This command is currently unavailable in web mode.");let e=Me();if(!e)return;let t=e.fileName,n=w.get(ce(t));if(!n)return;let a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a);await async function(e,t){let n=e.getText(),r=Me(t);r&&await we(t,r,n)}(e,i)}async function it(e,t,l=null){let s=t.msg_type;if("handshake"==s){var _={msg_type:"handshake",backend_language:he("rbql_backend_language","js"),encoding:he("rbql_encoding","utf-8")};d().sample_preview_records_from_context(R,_,g,b);let t=We(R.input_document_path);k.has(t)&&(_.last_query=k.get(t));let n=he("rbql_query_history",[]);_.query_history=n,_.policy=R.policy,_.with_headers=R.with_headers,_.header_for_ui=R.header_for_ui,_.is_web_ext=p,l&&(_.integration_test_language=l.rbql_backend,_.integration_test_query=l.rbql_query,_.integration_test_with_headers=l.with_headers||!1,_.integration_test_delay=l.integration_test_delay||2e3),await e.postMessage(_)}if("fetch_table_header"==s)try{let n=t.table_id,r=t.encoding,i=R.input_document_path?a.dirname(R.input_document_path):null,o=d().find_table_path(P,i,n);if(!o)return;let l=await d().read_header(o,r);if(!l)return;let[s,u]=c.smart_split(l,R.delim,R.policy,!1);u||e.postMessage({msg_type:"fetch_table_header_response",header_for_ui:s})}catch(e){console.error("Unable to get join table header: "+String(e))}if("update_query"==s){let e=t.query;if(!e)return;R.input_document_path&&k.set(We(R.input_document_path),e)}if("with_headers_change"==s&&(R.with_headers=t.with_headers,R.input_document_path&&await me(ye(R.input_document_path),R.with_headers)),"navigate"==s){var f=t.direction;"backward"==f?R.requested_start_record-=g:"forward"==f?R.requested_start_record+=g:"begin"==f?R.requested_start_record=0:"end"==f&&(R.requested_start_record=R.input_document.lineCount);let n={msg_type:"navigate"};d().sample_preview_records_from_context(R,n,g,b),await e.postMessage(n)}if("run"==s){let i=t.query,l=t.backend_language,s=t.encoding,c=t.output_dialect,_=t.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 me("rbql_query_history",t)}(i),await async function(e,t,i,l,s,c,_){let f=new ve("run-rbql-query");f.log_simple_event("start"),k.set(We(t),s);let g=["python3","python"],[h,m,b]=[R.delim,R.policy,R.comment_prefix],[y,x]=[h,m];"csv"==c&&([y,x]=[",",Q]),"tsv"==c&&([y,x]=["\t",Y]),R.output_delim=y,R.output_policy=x;let v=p?null:a.join(function(e){let t=xe("rbql_output_dir","TMP");return"TMP"==t?o.tmpdir():"INPUT"==t?a.dirname(e):t}(t),function(e,t){var n=a.basename(e),r=a.extname(n),i={"\t":".tsv",",":".csv"},o=".txt";i.hasOwnProperty(t)?o=i[t]:r.length>1&&(o=r);let l=n+o;return l==n&&(l+=".txt"),l}(t,y));if(s.startsWith("test ")){f.log_simple_event("test mode");let t=[de["rbql mock/rbql_mock.py"],s],n=await Je(g,t,f);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"==l){f.log_simple_event("using js backend");let a=[],o=null,l=_e(y,x);try{if(p){f.log_simple_event("using web mode");let t={content:(await d().rbql_query_web(s,R.input_document,h,m,y,x,a,_,b)).join("\n"),language:l};l==J&&(Z.dynamic_dialect_for_next_request=ie(y,x)),Z.autodetection_temporarily_disabled_for_rbql=!0,o=await r.workspace.openTextDocument(t),await Qe(e,null,null),await async function(e,t){try{await r.window.showTextDocument(e)}catch(e){return void pe("Unable to open RBQL result document")}await Fe(t)}(o,a),Z.dynamic_dialect_for_next_request=null,Z.autodetection_temporarily_disabled_for_rbql=!1,f.log_simple_event("finished OK")}else{f.log_simple_event("using electron mode");let n={bulk_read:!0};await d().rbql_query_node(P,s,t,h,m,v,y,x,i,a,_,b,"",n),w.set(ce(v),t),l==J&&(Z.dynamic_dialect_for_next_request=ie(y,x)),Z.autodetection_temporarily_disabled_for_rbql=!0,o=await r.workspace.openTextDocument(v),await Qe(e,null,null),await Ve(o,y,x,a),Z.dynamic_dialect_for_next_request=null,Z.autodetection_temporarily_disabled_for_rbql=!1,f.log_simple_event("finished OK")}}catch(t){let[r,a]=(null===u&&(u=n(6945)),u).exception_to_error_info(t);return f.log_simple_event("finished with error"),void await Qe(e,r,a)}}else{if(f.log_simple_event("using python backend"),p)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(s,"utf-8").toString("base64");b||(b="");let a=[de["rbql_core/vscode_rbql.py"],n,t,h,m,v,y,x,b,i];_&&a.push("--with_headers");let o=await Je(g,a,f);if(o.hasOwnProperty("error_type")||o.hasOwnProperty("error_msg"))return f.log_simple_event("finished with error"),void await Qe(e,o.error_type,o.error_msg);f.log_simple_event("finished OK"),await Qe(e,null,null),Z.autodetection_stoplist.add(v),w.set(ce(v),t),Z.autodetection_temporarily_disabled_for_rbql=!0;let l=_e(y,x),c=await r.workspace.openTextDocument(v);Z.autodetection_temporarily_disabled_for_rbql=!1,l==J&&(Z.dynamic_dialect_for_next_request=ie(y,x)),await Ve(c,y,x,o.warnings),Z.dynamic_dialect_for_next_request=null}}(e,R.input_document_path,s,l,i,c,_)}if("edit_udf"==s){if(p)return void await Qe(e,"Input error","UDFs are currently not supported in web version");let n=null,l="";"js"==t.backend_language?(n=a.join(o.homedir(),".rbql_init_source.js"),l=d().get_default_js_udf_content()):(n=a.join(o.homedir(),".rbql_init_source.py"),l=d().get_default_python_udf_content()),i.existsSync(n)||i.writeFileSync(n,l);let s=await r.workspace.openTextDocument(n);await r.window.showTextDocument(s)}"global_param_change"==s&&await me(t.key,t.value)}function ot(e,t,n){for(const a of n){let n=null;n=p?de[a]:e.webview.asWebviewUri(r.Uri.file(de[a])),t=t.replace(`src="${a}"`,`src="${n}"`)}return t}async function lt(e=null){let t=r.window;if(!t)return;let n=t.activeTextEditor;if(!n)return;let l=n.document;if(!l)return;let s=l.uri;if(!s)return;if("file"!=s.scheme&&"untitled"!=s.scheme&&!p)return;if("file"==s.scheme&&l.isDirty&&!p)return void pe("Unable to run RBQL: file has unsaved changes");let c=null;if("untitled"!=s.scheme||p)c=l.fileName;else{let e=l.getText(),t=String(Math.floor(1e6*Math.random()));c=a.join(o.tmpdir(),`${h}_${t}.txt`),i.writeFileSync(c,e)}if(!c)return void pe("Unable to run RBQL for this file");let[u,_,d]=Se(l);null===_&&(_="monocolumn",u="monocolumn");let f=xe("rbql_with_headers_by_default",!1),g=he(ye(c),f),m=qe(l,u,_,d);R={input_document:l,input_document_path:c,requested_start_record:0,delim:u,policy:_,comment_prefix:d,with_headers:g,header_for_ui:m},C=r.window.createWebviewPanel("rbql-console","RBQL Console",r.ViewColumn.Active,{enableScripts:!0}),T||(T=await yt("rbql_client.html")),C.webview.html=ot(C,T,["contrib/textarea-caret-position/index.js","rbql_suggest.js","rbql_client.js","rbql_logo.svg"]),C.webview.onDidReceiveMessage((function(t){it(C.webview,t,e)}))}function st(e,t,n){let[r,a,i]=["csv",",",Q],o=0,l=e.getText();if(!l)return[r,a,i];for(let e of t){if(" "==e||"."==e)continue;let t=0;for(let r=0;r<n&&r<l.length;r++)l[r]==e&&(t+=1);if(t>o){let n=ue(e),l=_e(e,n);[r,a,i]=[l,e,n],o=t}}return[r,a,i]}async function ct(e,t,n,r,a=null){let i=new ve("autodetection",a);if(i.log_doc_event("starting...",r),n.autodetection_temporarily_disabled_for_rbql)return i.log_simple_event("abort: disabled for rbql"),[r,!1];if(!re(r))return i.log_simple_event("abort: ineligible doc"),[r,!1];if(!xe("enable_separator_autodetection",!1,t))return i.log_simple_event("abort: disabled in config"),[r,!1];var o=r.fileName,l=r.languageId;if(n.autodetection_stoplist.has(o))return i.log_simple_event("abort: doc path in stoplist"),[r,!1];let c=(o.endsWith(".csv")||o.endsWith(".CSV"))&&"csv"==l;if(l!=z&&!c)return i.log_simple_event("abort: ineligible original language id"),[r,!1];let u=xe("autodetect_separators",[],t).map((e=>"TAB"===e?"\t":e));if(!X.hasOwnProperty(l)&&$&&$.file_path===o&&Math.abs(Date.now()-$.timestamp)<1e3)return i.log_simple_event("abort: recent doc language switch prevention"),[r,!1];let _=xe("comment_prefix","",t)||"#";i.log_simple_event("starting standard dialect autodetection...");let[d,p,f,g]=function(e,t,n,r){let a=[];for(let e of n){let t=ue(e),n=_e(e,t);n&&t&&(a.push([n,e,t]),","!=e&&";"!=e||a.push([J,e,H]))}let i=xe("csv_lint_detect_trailing_spaces",!1,e),o=xe("autodetection_min_line_count",10,e);if(t.lineCount<o)return[null,null,null];let[l,c,u,_]=[null,null,null,null],d=1;for(let e of a){let[n,a,p]=e,[f,g,h,m,w,b]=s.parse_document_records(t,a,p,r,!0,-1,!1,!0,i,d+1);if(null!==m||1!=h.size)continue;if(g<o)continue;let y=Array.from(h.keys())[0];y>=d+1&&(d=y,[l,c,u]=[n,a,p],_=w)}return[l,c,u,_]}(t,r,u,_);if(d?n.lint_results.set(`${o}.${d}`,{is_ok:!0,first_trailing_space_line:g}):!d&&c&&(i.log_simple_event("starting frequency-based dialect autodetection..."),[d,p,f]=st(r,u,1e4)),!d)return i.log_simple_event("abort: content-based autodetection did not detect anything"),[r,!1];if(d==J&&await le(n,o,ie(p,f)),d==l)return i.log_simple_event("abort: autodetected dialect matches the original one"),[r,!1];He(o,l,n.original_language_ids),i.log_simple_event(`autodetection successful - switching from ${l} to ${d}`);let h=await e.languages.setTextDocumentLanguage(r,d);return i.log_doc_event("after language switch",h),[h,!0]}async function ut(e){if(!e)return;N&&(N.dispose(),N=null);let t=new ve("handle_first_edit_for_an_empty_doc");t.log_doc_event("starting",e.document),await ct(r,r.workspace.getConfiguration("rainbow_csv"),Z,e.document,t.context_id)}async function _t(e){let t=new ve("handle_editor_switch"),n=Me(e);t.log_doc_event("editor switch",n),Pe(n,t),await Te(n,t)}function dt(e){null!==U&&clearTimeout(U),U=setTimeout((()=>{!$e()&&O&&O.hide()}),10)}async function pt(e){let t=new ve("handle_doc_open");if(t.log_doc_event("opening doc",e),!re(e))return void t.log_simple_event("abort: ineligible doc");if(xe("enable_separator_autodetection",!1)&&null===N&&e.isUntitled&&e.lineCount<=1)return N=r.workspace.onDidChangeTextDocument(ut),void t.log_simple_event("creating empty doc subscription");let n=!1;[e,n]=await ct(r,r.workspace.getConfiguration("rainbow_csv"),Z,e,t.context_id),t.log_doc_event(`after autodetection. filetype changed: ${n}`,e),Ne(e)&&(t.log_simple_event("active doc - enabling features"),Pe(e,t),await Te(e,t)),t.log_simple_event("finishing")}async function ft(e){let t=new ve("handle_doc_close");if(t.log_doc_event("closing doc",e),!ae(e))return t.log_simple_event("abort: non rainbow doc"),void($=null);$={file_path:e.fileName,timestamp:Date.now()},Ne(e)&&(t.log_simple_event("disabling ui elements"),Ie()),t.log_simple_event("finalizing")}async function gt(e){let t=Z.logging_enabled;Z.logging_enabled=xe("enable_debug_logging",!1),Z.logging_enabled&&!t&&new ve("config change").log_simple_event("logging enabled"),Ae()}async function ht(e,t){if(p)return void pe("This command is currently unavailable in web mode.");var n=e.fsPath;if(!n||!i.existsSync(n))return void r.window.showErrorMessage("Invalid file");var l=1024e3,s=i.statSync(n).size;if(s<=l){r.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 r.workspace.openTextDocument(n);return void await r.window.showTextDocument(e)}let c=a.basename(n);const u=a.join(o.tmpdir(),`.rb_csv_preview.${t}.${c}`);i.open(n,"r",((e,n)=>{if(e)return console.log(e.message),void r.window.showErrorMessage("Unable to preview file");var a=Buffer.alloc(l);let o="head"==t?0:Math.max(s-l,0);i.read(n,a,0,l,o,(function(e,n){if(e)return console.log(e.message),void r.window.showErrorMessage("Unable to preview file");const o=a.toString();let l=null;l="head"==t?o.substr(0,o.lastIndexOf(o.includes("\r\n")?"\r\n":"\n")):o.substr(o.indexOf("\n")+1),i.writeFileSync(u,l),r.workspace.openTextDocument(u).then((e=>r.window.showTextDocument(e)))}))}))}function mt(e,t){let n=r.languages.registerHoverProvider(e,{provideHover:(e,t,n)=>function(e,t,n,a){if(!xe("enable_tooltip",!1))return;let[i,o,l]=Se(e),s=d().get_cursor_position_info(r,e,i,o,l,n);if(!s||a.isCancellationRequested)return null;let c=xe("enable_tooltip_column_names",!1),u=Ee(e,i,o,l);if(!u)return null;let[_,p]=d().format_cursor_position_info(s,u,c,!0,25),f=new r.MarkdownString;return f.appendText(p),new r.Hover(f)}(e,0,t,n)});t.subscriptions.push(n)}class wt{constructor(){}async provideDocumentRangeSemanticTokens(e,t,n){let[a,i,o]=Se(e);if(!i||e.languageId!=J)return null;let l=d().parse_document_range(r,e,a,i,o,t);const s=new r.SemanticTokensBuilder(ne);for(let e of l)if(e.hasOwnProperty("comment_range"))s.push(e.comment_range,K);else for(let t=0;t<e.record_ranges.length;t++){let n=t%ee.length;if(0!=n)for(let r of e.record_ranges[t])s.push(r,ee[n])}return s.build()}}class bt{constructor(){}async provideDocumentRangeSemanticTokens(e,t,n){let[a,i,o]=Se(e);if(y.has(e.fileName)&&!o&&(o="#####COMMENT_PREFIX_THAT_CAN_NOT_OCCURE_IN_A_NORMAL_FILE_AND_EVEN_IF_IT_OCCURES_NOT_A_BIG_DEAL####"),!o||null===i||i==H)return null;const l=new r.SemanticTokensBuilder(ne);let s=Math.max(0,t.start.line-50),c=Math.min(e.lineCount,t.end.line+50);for(let t=s;t<c;t++){let n=e.lineAt(t).text;n.startsWith(o)&&l.push(new r.Range(t,0,t,n.length),K)}return l.build()}}async function yt(e){if(p){let t=await async function(e,t){let n=r.Uri.joinPath(e,t),a=await r.workspace.fs.readFile(n);return(new TextDecoder).decode(a)}(f,e);return t}return i.readFileSync(de[e],"utf8")}t.activate=async function(e){P=e.globalState,p&&(f=e.extensionUri);for(let t in de)de.hasOwnProperty(t)&&(de[t]=p?r.Uri.joinPath(e.extensionUri,t):e.asAbsolutePath(t));if(xe("enable_tooltip",!1))for(let t in X)X.hasOwnProperty(t)&&mt(t,e);Z.logging_enabled=xe("enable_debug_logging",!1);var t=r.commands.registerCommand("rainbow-csv.CSVLint",Be),n=r.commands.registerCommand("rainbow-csv.RBQL",lt),a=r.commands.registerCommand("rainbow-csv.SetHeaderLine",Ge),i=r.commands.registerCommand("rainbow-csv.SetCommentPrefix",Ye),o=r.commands.registerCommand("rainbow-csv.SetVirtualHeader",et),l=r.commands.registerCommand("rainbow-csv.SetJoinTableName",Ke),s=r.commands.registerCommand("rainbow-csv.ColumnEditBefore",(async function(){await tt("ce_before")})),c=r.commands.registerCommand("rainbow-csv.ColumnEditAfter",(async function(){await tt("ce_after")})),u=r.commands.registerCommand("rainbow-csv.ColumnEditSelect",(async function(){await tt("ce_select")})),_=r.commands.registerCommand("rainbow-csv.RainbowSeparator",ke),d=r.commands.registerCommand("rainbow-csv.RainbowSeparatorOff",Ze),g=r.commands.registerCommand("rainbow-csv.RainbowSeparatorOn",Xe),h=r.commands.registerCommand("rainbow-csv.SampleHead",(async function(e){await ht(e,"head")})),m=r.commands.registerCommand("rainbow-csv.SampleTail",(async function(e){await ht(e,"tail")})),w=r.commands.registerCommand("rainbow-csv.Align",rt),b=r.commands.registerCommand("rainbow-csv.Shrink",nt),y=r.commands.registerCommand("rainbow-csv.CopyBack",at),x=r.commands.registerCommand("rainbow-csv.InternalTest",Ue),v=r.workspace.onDidOpenTextDocument(pt),q=r.workspace.onDidCloseTextDocument(ft),E=r.workspace.onDidChangeConfiguration(gt),S=r.window.onDidChangeActiveTextEditor(_t);try{j=r.window.createOutputChannel("rainbow_csv_debug_channel",{log:!0})}catch(e){console.error("Rainbow CSV: Failed to create output log channel")}Re(),Ae(),xe("comment_prefix",null)&&je(),e.subscriptions.push(t),e.subscriptions.push(n),e.subscriptions.push(o),e.subscriptions.push(s),e.subscriptions.push(c),e.subscriptions.push(u),e.subscriptions.push(_),e.subscriptions.push(d),e.subscriptions.push(g),e.subscriptions.push(h),e.subscriptions.push(m),e.subscriptions.push(l),e.subscriptions.push(w),e.subscriptions.push(b),e.subscriptions.push(y),e.subscriptions.push(a),e.subscriptions.push(i),e.subscriptions.push(x),e.subscriptions.push(v),e.subscriptions.push(q),e.subscriptions.push(S),e.subscriptions.push(E),await fe(1e3),pt(Me())},t.deactivate=function(){},t.autodetect_dialect_frequency_based=st,t.try_autodetect_and_set_rainbow_filetype=ct},3568:(e,t,n)=>{const r=n(4285);class a extends Error{}function i(e,t=null){if(!e)throw t||(t="Assertion error"),new a(t)}class o{constructor(e,t,n,r,a,i,o){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=i,this.preserve_quotes_and_whitespaces=a,this.min_num_fields_for_autodetection=o}consume(e,t){let[n,a]=r.smart_split(e,this.delim,this.policy,this.preserve_quotes_and_whitespaces);if(a&&(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,a=null,l=!1,s=-1,c=!0,u=!1,_=!1,d=-1){let p=e.lineCount,f=0,g=new r.MultilineRecordAggregator(a),h=new o(t,n,l,c,u,_,d),m=[];for(let t=0;t<p;++t){let r=e.lineAt(t).text;if(t+1>=p&&""==r){c&&m.push({record_num:h.num_records_parsed,comment_text:r});break}let i=null;if("quoted_rfc"==n){if(g.add_line(r),g.has_comment_line){f=t+1,g.reset(),c&&m.push({record_num:h.num_records_parsed,comment_text:r});continue}if(!g.has_full_record)continue;i=g.get_full_line("\n"),g.reset()}else{if(a&&r.startsWith(a)){f=t+1,c&&m.push({record_num:h.num_records_parsed,comment_text:r});continue}i=r}if(!h.consume(i,f))return[h.records,h.num_records_parsed,h.fields_info,h.first_defective_line,h.first_trailing_space_line,m];if(f=t+1,-1!==s&&h.num_records_parsed>=s)return[h.records,h.num_records_parsed,h.fields_info,h.first_defective_line,h.first_trailing_space_line,m]}return g.is_inside_multiline_record()&&(i("quoted_rfc"==n),h.consume(g.get_full_line("\n"),f)),[h.records,h.num_records_parsed,h.fields_info,h.first_defective_line,h.first_trailing_space_line,m]},e.exports.assert=i},4148:(e,t,n)=>{"use strict";var r=n(5606);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===a(i)?i:String(i)),r)}var i}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var l,s,c=n(9597).codes,u=c.ERR_AMBIGUOUS_ARGUMENT,_=c.ERR_INVALID_ARG_TYPE,d=c.ERR_INVALID_ARG_VALUE,p=c.ERR_INVALID_RETURN_VALUE,f=c.ERR_MISSING_ARGS,g=n(3918),h=n(537).inspect,m=n(537).types,w=m.isPromise,b=m.isRegExp,y=n(1514)(),x=n(9394)(),v=n(8075)("RegExp.prototype.test");function q(){var e=n(2299);l=e.isDeepEqual,s=e.isDeepStrictEqual}new Map;var E=!1,S=e.exports=j,O={};function A(e){if(e.message instanceof Error)throw e.message;throw new g(e)}function R(e,t,n,r){if(!n){var a=!1;if(0===t)a=!0,r="No value argument passed to `assert.ok()`";else if(r instanceof Error)throw r;var i=new g({actual:n,expected:!0,message:r,operator:"==",stackStartFn:e});throw i.generatedMessage=a,i}}function j(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];R.apply(void 0,[j,t.length].concat(t))}S.fail=function e(t,n,a,i,o){var l,s=arguments.length;if(0===s?l="Failed":1===s?(a=t,t=void 0):(!1===E&&(E=!0,(r.emitWarning?r.emitWarning:console.warn.bind(console))("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")),2===s&&(i="!=")),a instanceof Error)throw a;var c={actual:t,expected:n,operator:void 0===i?"fail":i,stackStartFn:o||e};void 0!==a&&(c.message=a);var u=new g(c);throw l&&(u.message=l,u.generatedMessage=!0),u},S.AssertionError=g,S.ok=j,S.equal=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");t!=n&&A({actual:t,expected:n,message:r,operator:"==",stackStartFn:e})},S.notEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");t==n&&A({actual:t,expected:n,message:r,operator:"!=",stackStartFn:e})},S.deepEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");void 0===l&&q(),l(t,n)||A({actual:t,expected:n,message:r,operator:"deepEqual",stackStartFn:e})},S.notDeepEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");void 0===l&&q(),l(t,n)&&A({actual:t,expected:n,message:r,operator:"notDeepEqual",stackStartFn:e})},S.deepStrictEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");void 0===l&&q(),s(t,n)||A({actual:t,expected:n,message:r,operator:"deepStrictEqual",stackStartFn:e})},S.notDeepStrictEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");void 0===l&&q(),s(t,n)&&A({actual:t,expected:n,message:r,operator:"notDeepStrictEqual",stackStartFn:e})},S.strictEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");x(t,n)||A({actual:t,expected:n,message:r,operator:"strictEqual",stackStartFn:e})},S.notStrictEqual=function e(t,n,r){if(arguments.length<2)throw new f("actual","expected");x(t,n)&&A({actual:t,expected:n,message:r,operator:"notStrictEqual",stackStartFn:e})};var k=o((function e(t,n,r){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n.forEach((function(e){e in t&&(void 0!==r&&"string"==typeof r[e]&&b(t[e])&&v(t[e],r[e])?a[e]=r[e]:a[e]=t[e])}))}));function T(e,t,n,r){if("function"!=typeof t){if(b(t))return v(t,e);if(2===arguments.length)throw new _("expected",["Function","RegExp"],t);if("object"!==a(e)||null===e){var i=new g({actual:e,expected:t,message:n,operator:"deepStrictEqual",stackStartFn:r});throw i.operator=r.name,i}var o=Object.keys(t);if(t instanceof Error)o.push("name","message");else if(0===o.length)throw new d("error",t,"may not be an empty object");return void 0===l&&q(),o.forEach((function(a){"string"==typeof e[a]&&b(t[a])&&v(t[a],e[a])||function(e,t,n,r,a,i){if(!(n in e)||!s(e[n],t[n])){if(!r){var o=new k(e,a),l=new k(t,a,e),c=new g({actual:o,expected:l,operator:"deepStrictEqual",stackStartFn:i});throw c.actual=e,c.expected=t,c.operator=i.name,c}A({actual:e,expected:t,message:r,operator:i.name,stackStartFn:i})}}(e,t,a,n,o,r)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function I(e){if("function"!=typeof e)throw new _("fn","Function",e);try{e()}catch(e){return e}return O}function P(e){return w(e)||null!==e&&"object"===a(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function C(e){return Promise.resolve().then((function(){var t;if("function"==typeof e){if(!P(t=e()))throw new p("instance of Promise","promiseFn",t)}else{if(!P(e))throw new _("promiseFn",["Function","Promise"],e);t=e}return Promise.resolve().then((function(){return t})).then((function(){return O})).catch((function(e){return e}))}))}function M(e,t,n,r){if("string"==typeof n){if(4===arguments.length)throw new _("error",["Object","Error","Function","RegExp"],n);if("object"===a(t)&&null!==t){if(t.message===n)throw new u("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===n)throw new u("error/message",'The error "'.concat(t,'" is identical to the message.'));r=n,n=void 0}else if(null!=n&&"object"!==a(n)&&"function"!=typeof n)throw new _("error",["Object","Error","Function","RegExp"],n);if(t===O){var i="";n&&n.name&&(i+=" (".concat(n.name,")")),i+=r?": ".concat(r):".";var o="rejects"===e.name?"rejection":"exception";A({actual:void 0,expected:n,operator:e.name,message:"Missing expected ".concat(o).concat(i),stackStartFn:e})}if(n&&!T(t,n,r,e))throw t}function N(e,t,n,r){if(t!==O){if("string"==typeof n&&(r=n,n=void 0),!n||T(t,n)){var a=r?": ".concat(r):".",i="doesNotReject"===e.name?"rejection":"exception";A({actual:t,expected:n,operator:e.name,message:"Got unwanted ".concat(i).concat(a,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function D(e,t,n,r,i){if(!b(t))throw new _("regexp","RegExp",t);var o="match"===i;if("string"!=typeof e||v(t,e)!==o){if(n instanceof Error)throw n;var l=!n;n=n||("string"!=typeof e?'The "string" argument must be of type string. Received type '+"".concat(a(e)," (").concat(h(e),")"):(o?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(h(t),". Input:\n\n").concat(h(e),"\n"));var s=new g({actual:e,expected:t,message:n,operator:i,stackStartFn:r});throw s.generatedMessage=l,s}}function $(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];R.apply(void 0,[$,t.length].concat(t))}S.throws=function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];M.apply(void 0,[e,I(t)].concat(r))},S.rejects=function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return C(t).then((function(t){return M.apply(void 0,[e,t].concat(r))}))},S.doesNotThrow=function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];N.apply(void 0,[e,I(t)].concat(r))},S.doesNotReject=function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return C(t).then((function(t){return N.apply(void 0,[e,t].concat(r))}))},S.ifError=function e(t){if(null!=t){var n="ifError got unwanted exception: ";"object"===a(t)&&"string"==typeof t.message?0===t.message.length&&t.constructor?n+=t.constructor.name:n+=t.message:n+=h(t);var r=new g({actual:t,expected:null,operator:"ifError",message:n,stackStartFn:e}),i=t.stack;if("string"==typeof i){var o=i.split("\n");o.shift();for(var l=r.stack.split("\n"),s=0;s<o.length;s++){var c=l.indexOf(o[s]);if(-1!==c){l=l.slice(0,c);break}}r.stack="".concat(l.join("\n"),"\n").concat(o.join("\n"))}throw r}},S.match=function e(t,n,r){D(t,n,r,e,"match")},S.doesNotMatch=function e(t,n,r){D(t,n,r,e,"doesNotMatch")},S.strict=y($,S,{equal:S.strictEqual,deepEqual:S.deepStrictEqual,notEqual:S.notStrictEqual,notDeepEqual:S.notDeepStrictEqual}),S.strict.strict=S.strict},3918:(e,t,n)=>{"use strict";var r=n(5606);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){var r,a,i;r=e,a=t,i=n[t],(a=l(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!==g(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===g(t)?t:String(t)}function s(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){var t="function"==typeof Map?new Map:void 0;return u=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)},u(e)}function _(e,t,n){return _=d()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&p(a,n.prototype),a},_.apply(null,arguments)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}var h=n(537).inspect,m=n(9597).codes.ERR_INVALID_ARG_TYPE;function w(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}var b="",y="",x="",v="",q={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function E(e){var t=Object.keys(e),n=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){n[t]=e[t]})),Object.defineProperty(n,"message",{value:e.message}),n}function S(e){return h(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var O=function(e,t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(O,e);var n,a,l,u,_=(n=O,a=d(),function(){var e,t=f(n);if(a){var r=f(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return s(this,e)});function O(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,O),"object"!==g(e)||null===e)throw new m("options","Object",e);var n=e.message,a=e.operator,i=e.stackStartFn,o=e.actual,l=e.expected,u=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=n)t=_.call(this,String(n));else if(r.stderr&&r.stderr.isTTY&&(r.stderr&&r.stderr.getColorDepth&&1!==r.stderr.getColorDepth()?(b="[34m",y="[32m",v="[39m",x="[31m"):(b="",y="",v="",x="")),"object"===g(o)&&null!==o&&"object"===g(l)&&null!==l&&"stack"in o&&o instanceof Error&&"stack"in l&&l instanceof Error&&(o=E(o),l=E(l)),"deepStrictEqual"===a||"strictEqual"===a)t=_.call(this,function(e,t,n){var a="",i="",o=0,l="",s=!1,c=S(e),u=c.split("\n"),_=S(t).split("\n"),d=0,p="";if("strictEqual"===n&&"object"===g(e)&&"object"===g(t)&&null!==e&&null!==t&&(n="strictEqualObject"),1===u.length&&1===_.length&&u[0]!==_[0]){var f=u[0].length+_[0].length;if(f<=10){if(!("object"===g(e)&&null!==e||"object"===g(t)&&null!==t||0===e&&0===t))return"".concat(q[n],"\n\n")+"".concat(u[0]," !== ").concat(_[0],"\n")}else if("strictEqualObject"!==n&&f<(r.stderr&&r.stderr.isTTY?r.stderr.columns:80)){for(;u[0][d]===_[0][d];)d++;d>2&&(p="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var n=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,n-e.length)}(" ",d),"^"),d=0)}}for(var h=u[u.length-1],m=_[_.length-1];h===m&&(d++<2?l="\n ".concat(h).concat(l):a=h,u.pop(),_.pop(),0!==u.length&&0!==_.length);)h=u[u.length-1],m=_[_.length-1];var E=Math.max(u.length,_.length);if(0===E){var O=c.split("\n");if(O.length>30)for(O[26]="".concat(b,"...").concat(v);O.length>27;)O.pop();return"".concat(q.notIdentical,"\n\n").concat(O.join("\n"),"\n")}d>3&&(l="\n".concat(b,"...").concat(v).concat(l),s=!0),""!==a&&(l="\n ".concat(a).concat(l),a="");var A=0,R=q[n]+"\n".concat(y,"+ actual").concat(v," ").concat(x,"- expected").concat(v),j=" ".concat(b,"...").concat(v," Lines skipped");for(d=0;d<E;d++){var k=d-o;if(u.length<d+1)k>1&&d>2&&(k>4?(i+="\n".concat(b,"...").concat(v),s=!0):k>3&&(i+="\n ".concat(_[d-2]),A++),i+="\n ".concat(_[d-1]),A++),o=d,a+="\n".concat(x,"-").concat(v," ").concat(_[d]),A++;else if(_.length<d+1)k>1&&d>2&&(k>4?(i+="\n".concat(b,"...").concat(v),s=!0):k>3&&(i+="\n ".concat(u[d-2]),A++),i+="\n ".concat(u[d-1]),A++),o=d,i+="\n".concat(y,"+").concat(v," ").concat(u[d]),A++;else{var T=_[d],I=u[d],P=I!==T&&(!w(I,",")||I.slice(0,-1)!==T);P&&w(T,",")&&T.slice(0,-1)===I&&(P=!1,I+=","),P?(k>1&&d>2&&(k>4?(i+="\n".concat(b,"...").concat(v),s=!0):k>3&&(i+="\n ".concat(u[d-2]),A++),i+="\n ".concat(u[d-1]),A++),o=d,i+="\n".concat(y,"+").concat(v," ").concat(I),a+="\n".concat(x,"-").concat(v," ").concat(T),A+=2):(i+=a,a="",1!==k&&0!==d||(i+="\n ".concat(I),A++))}if(A>20&&d<E-2)return"".concat(R).concat(j,"\n").concat(i,"\n").concat(b,"...").concat(v).concat(a,"\n")+"".concat(b,"...").concat(v)}return"".concat(R).concat(s?j:"","\n").concat(i).concat(a).concat(l).concat(p)}(o,l,a));else if("notDeepStrictEqual"===a||"notStrictEqual"===a){var d=q[a],p=S(o).split("\n");if("notStrictEqual"===a&&"object"===g(o)&&null!==o&&(d=q.notStrictEqualObject),p.length>30)for(p[26]="".concat(b,"...").concat(v);p.length>27;)p.pop();t=1===p.length?_.call(this,"".concat(d," ").concat(p[0])):_.call(this,"".concat(d,"\n\n").concat(p.join("\n"),"\n"))}else{var f=S(o),h="",A=q[a];"notDeepEqual"===a||"notEqual"===a?(f="".concat(q[a],"\n\n").concat(f)).length>1024&&(f="".concat(f.slice(0,1021),"...")):(h="".concat(S(l)),f.length>512&&(f="".concat(f.slice(0,509),"...")),h.length>512&&(h="".concat(h.slice(0,509),"...")),"deepEqual"===a||"equal"===a?f="".concat(A,"\n\n").concat(f,"\n\nshould equal\n\n"):h=" ".concat(a," ").concat(h)),t=_.call(this,"".concat(f).concat(h))}return Error.stackTraceLimit=u,t.generatedMessage=!n,Object.defineProperty(c(t),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),t.code="ERR_ASSERTION",t.actual=o,t.expected=l,t.operator=a,Error.captureStackTrace&&Error.captureStackTrace(c(t),i),t.stack,t.name="AssertionError",s(t)}return l=O,(u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(e,t){return h(this,i(i({},t),{},{customInspect:!1,depth:0}))}}])&&o(l.prototype,u),Object.defineProperty(l,"prototype",{writable:!1}),O}(u(Error),h.custom);e.exports=O},9597:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}var o,l,s={};function c(e,t,n){n||(n=Error);var o=function(n){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(u,n);var o,l,s,c=(l=u,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=i(l);if(s){var n=i(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(n,r,a){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),i=c.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,a)),i.code=e,i}return o=u,Object.defineProperty(o,"prototype",{writable:!1}),o}(n);s[e]=o}function u(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}c("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),c("ERR_INVALID_ARG_TYPE",(function(e,t,a){var i,l,s,c,_;if(void 0===o&&(o=n(4148)),o("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(l="not ",t.substr(0,4)===l)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(u(t,"type"));else{var d=("number"!=typeof _&&(_=0),_+1>(c=e).length||-1===c.indexOf(".",_)?"argument":"property");s='The "'.concat(e,'" ').concat(d," ").concat(i," ").concat(u(t,"type"))}return s+". Received type ".concat(r(a))}),TypeError),c("ERR_INVALID_ARG_VALUE",(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===l&&(l=n(537));var a=l.inspect(t);return a.length>128&&(a="".concat(a.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(r,". Received ").concat(a)}),TypeError,RangeError),c("ERR_INVALID_RETURN_VALUE",(function(e,t,n){var a;return a=n&&n.constructor&&n.constructor.name?"instance of ".concat(n.constructor.name):"type ".concat(r(n)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(a,".")}),TypeError),c("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];void 0===o&&(o=n(4148)),o(t.length>0,"At least one arg needs to be specified");var a="The ",i=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),i){case 1:a+="".concat(t[0]," argument");break;case 2:a+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:a+=t.slice(0,i-1).join(", "),a+=", and ".concat(t[i-1]," arguments")}return"".concat(a," must be specified")}),TypeError),e.exports.codes=s},2299:(e,t,n)=>{"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=void 0!==/a/g.flags,l=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},s=function(e){var t=[];return e.forEach((function(e,n){return t.push([n,e])})),t},c=Object.is?Object.is:n(7653),u=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},_=Number.isNaN?Number.isNaN:n(4133);function d(e){return e.call.bind(e)}var p=d(Object.prototype.hasOwnProperty),f=d(Object.prototype.propertyIsEnumerable),g=d(Object.prototype.toString),h=n(537).types,m=h.isAnyArrayBuffer,w=h.isArrayBufferView,b=h.isDate,y=h.isMap,x=h.isRegExp,v=h.isSet,q=h.isNativeError,E=h.isBoxedPrimitive,S=h.isNumberObject,O=h.isStringObject,A=h.isBooleanObject,R=h.isBigIntObject,j=h.isSymbolObject,k=h.isFloat32Array,T=h.isFloat64Array;function I(e){if(0===e.length||e.length>10)return!0;for(var t=0;t<e.length;t++){var n=e.charCodeAt(t);if(n<48||n>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function P(e){return Object.keys(e).filter(I).concat(u(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function C(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,a=0,i=Math.min(n,r);a<i;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:r<n?1:0}var M=0,N=1,D=2,$=3;function L(e,t,n,r){if(e===t)return 0!==e||!n||c(e,t);if(n){if("object"!==i(e))return"number"==typeof e&&_(e)&&_(t);if("object"!==i(t)||null===e||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(null===e||"object"!==i(e))return(null===t||"object"!==i(t))&&e==t;if(null===t||"object"!==i(t))return!1}var a,l,s,u,d=g(e);if(d!==g(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var p=P(e),f=P(t);return p.length===f.length&&U(e,t,n,r,N,p)}if("[object Object]"===d&&(!y(e)&&y(t)||!v(e)&&v(t)))return!1;if(b(e)){if(!b(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(x(e)){if(!x(t)||(s=e,u=t,!(o?s.source===u.source&&s.flags===u.flags:RegExp.prototype.toString.call(s)===RegExp.prototype.toString.call(u))))return!1}else if(q(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else{if(w(e)){if(n||!k(e)&&!T(e)){if(!function(e,t){return e.byteLength===t.byteLength&&0===C(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(e,t))return!1}else if(!function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}(e,t))return!1;var h=P(e),I=P(t);return h.length===I.length&&U(e,t,n,r,M,h)}if(v(e))return!(!v(t)||e.size!==t.size)&&U(e,t,n,r,D);if(y(e))return!(!y(t)||e.size!==t.size)&&U(e,t,n,r,$);if(m(e)){if(l=t,(a=e).byteLength!==l.byteLength||0!==C(new Uint8Array(a),new Uint8Array(l)))return!1}else if(E(e)&&!function(e,t){return S(e)?S(t)&&c(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):O(e)?O(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):A(e)?A(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):R(e)?R(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):j(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}(e,t))return!1}return U(e,t,n,r,M)}function B(e,t){return t.filter((function(t){return f(e,t)}))}function U(e,t,n,a,o,c){if(5===arguments.length){c=Object.keys(e);var _=Object.keys(t);if(c.length!==_.length)return!1}for(var d=0;d<c.length;d++)if(!p(t,c[d]))return!1;if(n&&5===arguments.length){var g=u(e);if(0!==g.length){var h=0;for(d=0;d<g.length;d++){var m=g[d];if(f(e,m)){if(!f(t,m))return!1;c.push(m),h++}else if(f(t,m))return!1}var w=u(t);if(g.length!==w.length&&B(t,w).length!==h)return!1}else{var b=u(t);if(0!==b.length&&0!==B(t,b).length)return!1}}if(0===c.length&&(o===M||o===N&&0===e.length||0===e.size))return!0;if(void 0===a)a={val1:new Map,val2:new Map,position:0};else{var y=a.val1.get(e);if(void 0!==y){var x=a.val2.get(t);if(void 0!==x)return y===x}a.position++}a.val1.set(e,a.position),a.val2.set(t,a.position);var v=function(e,t,n,a,o,c){var u=0;if(c===D){if(!function(e,t,n,r){for(var a=null,o=l(e),s=0;s<o.length;s++){var c=o[s];if("object"===i(c)&&null!==c)null===a&&(a=new Set),a.add(c);else if(!t.has(c)){if(n)return!1;if(!W(e,t,c))return!1;null===a&&(a=new Set),a.add(c)}}if(null!==a){for(var u=l(t),_=0;_<u.length;_++){var d=u[_];if("object"===i(d)&&null!==d){if(!F(a,d,n,r))return!1}else if(!n&&!e.has(d)&&!F(a,d,n,r))return!1}return 0===a.size}return!0}(e,t,n,o))return!1}else if(c===$){if(!function(e,t,n,a){for(var o=null,l=s(e),c=0;c<l.length;c++){var u=r(l[c],2),_=u[0],d=u[1];if("object"===i(_)&&null!==_)null===o&&(o=new Set),o.add(_);else{var p=t.get(_);if(void 0===p&&!t.has(_)||!L(d,p,n,a)){if(n)return!1;if(!z(e,t,_,d,a))return!1;null===o&&(o=new Set),o.add(_)}}}if(null!==o){for(var f=s(t),g=0;g<f.length;g++){var h=r(f[g],2),m=h[0],w=h[1];if("object"===i(m)&&null!==m){if(!J(o,e,m,w,n,a))return!1}else if(!(n||e.has(m)&&L(e.get(m),w,!1,a)||J(o,e,m,w,!1,a)))return!1}return 0===o.size}return!0}(e,t,n,o))return!1}else if(c===N)for(;u<e.length;u++){if(!p(e,u)){if(p(t,u))return!1;for(var _=Object.keys(e);u<_.length;u++){var d=_[u];if(!p(t,d)||!L(e[d],t[d],n,o))return!1}return _.length===Object.keys(t).length}if(!p(t,u)||!L(e[u],t[u],n,o))return!1}for(u=0;u<a.length;u++){var f=a[u];if(!L(e[f],t[f],n,o))return!1}return!0}(e,t,n,c,a,o);return a.val1.delete(e),a.val2.delete(t),v}function F(e,t,n,r){for(var a=l(e),i=0;i<a.length;i++){var o=a[i];if(L(t,o,n,r))return e.delete(o),!0}return!1}function V(e){switch(i(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(_(e))return!1}return!0}function W(e,t,n){var r=V(n);return null!=r?r:t.has(r)&&!e.has(r)}function z(e,t,n,r,a){var i=V(n);if(null!=i)return i;var o=t.get(i);return!(void 0===o&&!t.has(i)||!L(r,o,!1,a))&&!e.has(i)&&L(r,o,!1,a)}function J(e,t,n,r,a,i){for(var o=l(e),s=0;s<o.length;s++){var c=o[s];if(L(n,c,a,i)&&L(r,t.get(c),a,i))return e.delete(c),!0}return!1}e.exports={isDeepEqual:function(e,t){return L(e,t,!1)},isDeepStrictEqual:function(e,t){return L(e,t,!0)}}},8075:(e,t,n)=>{"use strict";var r=n(453),a=n(487),i=a(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&i(e,".prototype.")>-1?a(n):n}},487:(e,t,n)=>{"use strict";var r=n(6743),a=n(453),i=n(6897),o=n(9675),l=a("%Function.prototype.apply%"),s=a("%Function.prototype.call%"),c=a("%Reflect.apply%",!0)||r.call(s,l),u=n(655),_=a("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new o("a function is required");var t=c(r,s,arguments);return i(t,1+_(0,e.length-(arguments.length-1)),!0)};var d=function(){return c(r,l,arguments)};u?u(e.exports,"apply",{value:d}):e.exports.apply=d},41:(e,t,n)=>{"use strict";var r=n(655),a=n(8068),i=n(9675),o=n(5795);e.exports=function(e,t,n){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new i("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],_=!!o&&o(e,t);if(r)r(e,t,{configurable:null===c&&_?_.configurable:!c,enumerable:null===l&&_?_.enumerable:!l,value:n,writable:null===s&&_?_.writable:!s});else{if(!u&&(l||s||c))throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},8452:(e,t,n)=>{"use strict";var r=n(1189),a="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,o=Array.prototype.concat,l=n(41),s=n(592)(),c=function(e,t,n,r){if(t in e)if(!0===r){if(e[t]===n)return}else if("function"!=typeof(a=r)||"[object Function]"!==i.call(a)||!r())return;var a;s?l(e,t,n,!0):l(e,t,n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);a&&(i=o.call(i,Object.getOwnPropertySymbols(t)));for(var l=0;l<i.length;l+=1)c(e,i[l],t[i[l]],n[i[l]])};u.supportsDescriptors=!!s,e.exports=u},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),a=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var o;arguments.length>=3&&(o=n),"[object Array]"===a.call(e)?function(e,t,n){for(var r=0,a=e.length;r<a;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,o):"string"==typeof e?function(e,t,n){for(var r=0,a=e.length;r<a;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,o):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,o)}},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 a=0;a<t.length;a+=1)n[a+e.length]=t[a];return n};e.exports=function(e){var a=this;if("function"!=typeof a||"[object Function]"!==t.apply(a))throw new TypeError("Function.prototype.bind called on incompatible "+a);for(var i,o=function(e,t){for(var n=[],r=1,a=0;r<e.length;r+=1,a+=1)n[a]=e[r];return n}(arguments),l=n(0,a.length-o.length),s=[],c=0;c<l;c++)s[c]="$"+c;if(i=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}(s)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var t=a.apply(this,r(o,arguments));return Object(t)===t?t:this}return a.apply(e,r(o,arguments))})),a.prototype){var u=function(){};u.prototype=a.prototype,i.prototype=new u,u.prototype=null}return i}},6743:(e,t,n)=>{"use strict";var r=n(9353);e.exports=Function.prototype.bind||r},453:(e,t,n)=>{"use strict";var r,a=n(9383),i=n(1237),o=n(9290),l=n(9538),s=n(8068),c=n(9675),u=n(5345),_=Function,d=function(e){try{return _('"use strict"; return ('+e+").constructor;")()}catch(e){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(e){p=null}var f=function(){throw new c},g=p?function(){try{return f}catch(e){try{return p(arguments,"callee").get}catch(e){return f}}}():f,h=n(4039)(),m=n(24)(),w=Object.getPrototypeOf||(m?function(e){return e.__proto__}:null),b={},y="undefined"!=typeof Uint8Array&&w?w(Uint8Array):r,x={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":h&&w?w([][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%":a,"%eval%":eval,"%EvalError%":i,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":_,"%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%":h&&w?w(w([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h&&w?w((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%":o,"%ReferenceError%":l,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h&&w?w((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&w?w(""[Symbol.iterator]()):r,"%Symbol%":h?Symbol:r,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":y,"%TypeError%":c,"%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%":u,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(w)try{null.error}catch(e){var v=w(w(e));x["%Error.prototype%"]=v}var q=function e(t){var n;if("%AsyncFunction%"===t)n=d("async function () {}");else if("%GeneratorFunction%"===t)n=d("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=d("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var a=e("%AsyncGenerator%");a&&w&&(n=w(a.prototype))}return x[t]=n,n},E={__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),R=S.call(Function.apply,Array.prototype.splice),j=S.call(Function.call,String.prototype.replace),k=S.call(Function.call,String.prototype.slice),T=S.call(Function.call,RegExp.prototype.exec),I=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,C=function(e,t){var n,r=e;if(O(E,r)&&(r="%"+(n=E[r])[0]+"%"),O(x,r)){var a=x[r];if(a===b&&(a=q(r)),void 0===a&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:a}}throw new s("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,e))throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=k(e,0,1),n=k(e,-1);if("%"===t&&"%"!==n)throw new s("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new s("invalid intrinsic syntax, expected opening `%`");var r=[];return j(e,I,(function(e,t,n,a){r[r.length]=n?j(a,P,"$1"):t||e})),r}(e),r=n.length>0?n[0]:"",a=C("%"+r+"%",t),i=a.name,o=a.value,l=!1,u=a.alias;u&&(r=u[0],R(n,A([0,1],u)));for(var _=1,d=!0;_<n.length;_+=1){var f=n[_],g=k(f,0,1),h=k(f,-1);if(('"'===g||"'"===g||"`"===g||'"'===h||"'"===h||"`"===h)&&g!==h)throw new s("property names with quotes must have matching quotes");if("constructor"!==f&&d||(l=!0),O(x,i="%"+(r+="."+f)+"%"))o=x[i];else if(null!=o){if(!(f in o)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(p&&_+1>=n.length){var m=p(o,f);o=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:o[f]}else d=O(o,f),o=o[f];d&&!l&&(x[i]=o)}}return o}},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),a=function(){return!!r};a.hasArrayLengthDefineBug=function(){if(!r)return null;try{return 1!==r([],"length",{value:1}).length}catch(e){return!0}},e.exports=a},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,a=n(1333);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&a()}},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 a=Object.getOwnPropertyDescriptor(e,t);if(42!==a.value||!0!==a.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,a=Object.prototype.hasOwnProperty,i=n(6743);e.exports=i.call(r,a)},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)(),a=n(8075)("Object.prototype.toString"),i=function(e){return!(r&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===a(e)},o=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==a(e)&&"[object Function]"===a(e.callee)},l=function(){return i(arguments)}();i.isLegacyArguments=o,e.exports=l?i:o},9600:e=>{"use strict";var t,n,r=Function.prototype.toString,a="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof a&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw n}}),n={},a((function(){throw 42}),null,t)}catch(e){e!==n&&(a=null)}else a=null;var i=/^\s*class\b/,o=function(e){try{var t=r.call(e);return i.test(t)}catch(e){return!1}},l=function(e){try{return!o(e)&&(r.call(e),!0)}catch(e){return!1}},s=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,u=!(0 in[,]),_=function(){return!1};if("object"==typeof document){var d=document.all;s.call(d)===s.call(document.all)&&(_=function(e){if((u||!e)&&(void 0===e||"object"==typeof e))try{var t=s.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=a?function(e){if(_(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{a(e,null,t)}catch(e){if(e!==n)return!1}return!o(e)&&l(e)}:function(e){if(_(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return l(e);if(o(e))return!1;var t=s.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&l(e)}},8184:(e,t,n)=>{"use strict";var r,a=Object.prototype.toString,i=Function.prototype.toString,o=/^\s*(?:function)?\*/,l=n(9092)(),s=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(o.test(i.call(e)))return!0;if(!l)return"[object GeneratorFunction]"===a.call(e);if(!s)return!1;if(void 0===r){var t=function(){if(!l)return!1;try{return Function("return function*() {}")()}catch(e){}}();r=!!t&&s(t)}return s(e)===r}},3003:e=>{"use strict";e.exports=function(e){return e!=e}},4133:(e,t,n)=>{"use strict";var r=n(487),a=n(8452),i=n(3003),o=n(6642),l=n(2464),s=r(o(),Number);a(s,{getPolyfill:o,implementation:i,shim:l}),e.exports=s},6642:(e,t,n)=>{"use strict";var r=n(3003);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:r}},2464:(e,t,n)=>{"use strict";var r=n(8452),a=n(6642);e.exports=function(){var e=a();return r(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5680:(e,t,n)=>{"use strict";var r=n(5767);e.exports=function(e){return!!r(e)}},9211:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,n){return 0===e&&0===n?1/e==1/n:e===n||!(!t(e)||!t(n))}},7653:(e,t,n)=>{"use strict";var r=n(8452),a=n(487),i=n(9211),o=n(9394),l=n(6576),s=a(o(),Object);r(s,{getPolyfill:o,implementation:i,shim:l}),e.exports=s},9394:(e,t,n)=>{"use strict";var r=n(9211);e.exports=function(){return"function"==typeof Object.is?Object.is:r}},6576:(e,t,n)=>{"use strict";var r=n(9394),a=n(8452);e.exports=function(){var e=r();return a(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8875:(e,t,n)=>{"use strict";var r;if(!Object.keys){var a=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=n(1093),l=Object.prototype.propertyIsEnumerable,s=!l.call({toString:null},"toString"),c=l.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!d["$"+e]&&a.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{_(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();r=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===i.call(e),r=o(e),l=t&&"[object String]"===i.call(e),d=[];if(!t&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var f=c&&n;if(l&&e.length>0&&!a.call(e,0))for(var g=0;g<e.length;++g)d.push(String(g));if(r&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var m in e)f&&"prototype"===m||!a.call(e,m)||d.push(String(m));if(s)for(var w=function(e){if("undefined"==typeof window||!p)return _(e);try{return _(e)}catch(e){return!1}}(e),b=0;b<u.length;++b)w&&"constructor"===u[b]||!a.call(e,u[b])||d.push(u[b]);return d}}e.exports=r},1189:(e,t,n)=>{"use strict";var r=Array.prototype.slice,a=n(1093),i=Object.keys,o=i?function(e){return i(e)}:n(8875),l=Object.keys;o.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return a(e)?l(r.call(e)):l(e)})}else Object.keys=o;return Object.keys||o},e.exports=o},1093:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var n=t.call(e),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),r}},8403:(e,t,n)=>{"use strict";var r=n(1189),a=n(1333)(),i=n(8075),o=Object,l=i("Array.prototype.push"),s=i("Object.prototype.propertyIsEnumerable"),c=a?Object.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var n=o(e);if(1===arguments.length)return n;for(var i=1;i<arguments.length;++i){var u=o(arguments[i]),_=r(u),d=a&&(Object.getOwnPropertySymbols||c);if(d)for(var p=d(u),f=0;f<p.length;++f){var g=p[f];s(u,g)&&l(_,g)}for(var h=0;h<_.length;++h){var m=_[h];if(s(u,m)){var w=u[m];n[m]=w}}}return n}},1514:(e,t,n)=>{"use strict";var r=n(8403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),n={},r=0;r<t.length;++r)n[t[r]]=t[r];var a=Object.assign({},n),i="";for(var o in a)i+=o;return e!==i}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return"y"===e[1]}return!1}()?r:Object.assign:r}},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 a(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!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:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l,s=[],c=!1,u=-1;function _(){c&&l&&(c=!1,l.length?s=l.concat(s):u=-1,s.length&&d())}function d(){if(!c){var e=o(_);c=!0;for(var t=s.length;t;){for(l=s,s=[];++u<t;)l&&l[u].run();u=-1,t=s.length}l=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!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 f(){}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];s.push(new p(e,t)),1!==s.length||c||o(d)},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=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,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),a=n(41),i=n(592)(),o=n(5795),l=n(9675),s=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new l("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||s(t)!==t)throw new l("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,c=!0;if("length"in e&&o){var u=o(e,"length");u&&!u.configurable&&(r=!1),u&&!u.writable&&(c=!1)}return(r||c||!n)&&(i?a(e,"length",t,!0,!0):a(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),a=n(8184),i=n(5767),o=n(5680);function l(e){return e.call.bind(e)}var s="undefined"!=typeof BigInt,c="undefined"!=typeof Symbol,u=l(Object.prototype.toString),_=l(Number.prototype.valueOf),d=l(String.prototype.valueOf),p=l(Boolean.prototype.valueOf);if(s)var f=l(BigInt.prototype.valueOf);if(c)var g=l(Symbol.prototype.valueOf);function h(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function m(e){return"[object Map]"===u(e)}function w(e){return"[object Set]"===u(e)}function b(e){return"[object WeakMap]"===u(e)}function y(e){return"[object WeakSet]"===u(e)}function x(e){return"[object ArrayBuffer]"===u(e)}function v(e){return"undefined"!=typeof ArrayBuffer&&(x.working?x(e):e instanceof ArrayBuffer)}function q(e){return"[object DataView]"===u(e)}function E(e){return"undefined"!=typeof DataView&&(q.working?q(e):e instanceof DataView)}t.isArgumentsObject=r,t.isGeneratorFunction=a,t.isTypedArray=o,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):o(e)||E(e)},t.isUint8Array=function(e){return"Uint8Array"===i(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===i(e)},t.isUint16Array=function(e){return"Uint16Array"===i(e)},t.isUint32Array=function(e){return"Uint32Array"===i(e)},t.isInt8Array=function(e){return"Int8Array"===i(e)},t.isInt16Array=function(e){return"Int16Array"===i(e)},t.isInt32Array=function(e){return"Int32Array"===i(e)},t.isFloat32Array=function(e){return"Float32Array"===i(e)},t.isFloat64Array=function(e){return"Float64Array"===i(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===i(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===i(e)},m.working="undefined"!=typeof Map&&m(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},w.working="undefined"!=typeof Set&&w(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(w.working?w(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)},y.working="undefined"!=typeof WeakSet&&y(new WeakSet),t.isWeakSet=function(e){return y(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,q.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&q(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=E;var S="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function O(e){return"[object SharedArrayBuffer]"===u(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 R(e){return h(e,_)}function j(e){return h(e,d)}function k(e){return h(e,p)}function T(e){return s&&h(e,f)}function I(e){return c&&h(e,g)}t.isSharedArrayBuffer=A,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===u(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===u(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===u(e)},t.isGeneratorObject=function(e){return"[object Generator]"===u(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===u(e)},t.isNumberObject=R,t.isStringObject=j,t.isBooleanObject=k,t.isBigIntObject=T,t.isSymbolObject=I,t.isBoxedPrimitive=function(e){return R(e)||j(e)||k(e)||T(e)||I(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),a=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},i=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(c(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,a=r.length,o=String(e).replace(i,(function(e){if("%%"===e)return"%";if(n>=a)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}})),l=r[n];n<a;l=r[++n])m(l)||!v(l)?o+=" "+l:o+=" "+c(l);return o},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 a=!1;return function(){if(!a){if(r.throwDeprecation)throw new Error(n);r.traceDeprecation?console.trace(n):console.error(n),a=!0}return e.apply(this,arguments)}};var o={},l=/^$/;if(r.env.NODE_DEBUG){var s=r.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),l=new RegExp("^"+s+"$","i")}function c(e,n){var r={seen:[],stylize:_};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(n)?r.showHidden=n:n&&t._extend(r,n),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),d(r,e,r.depth)}function u(e,t){var n=c.styles[t];return n?"["+c.colors[n][0]+"m"+e+"["+c.colors[n][1]+"m":e}function _(e,t){return e}function d(e,n,r){if(e.customInspect&&n&&S(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var a=n.inspect(r,e);return b(a)||(a=d(e,a,r)),a}var i=function(e,t){if(y(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 w(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}(e,n);if(i)return i;var o=Object.keys(n),l=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),E(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(n);if(0===o.length){if(S(n)){var s=n.name?": "+n.name:"";return e.stylize("[Function"+s+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(q(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return p(n)}var c,u="",_=!1,v=["{","}"];return g(n)&&(_=!0,v=["[","]"]),S(n)&&(u=" [Function"+(n.name?": "+n.name:"")+"]"),x(n)&&(u=" "+RegExp.prototype.toString.call(n)),q(n)&&(u=" "+Date.prototype.toUTCString.call(n)),E(n)&&(u=" "+p(n)),0!==o.length||_&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=_?function(e,t,n,r,a){for(var i=[],o=0,l=t.length;o<l;++o)j(t,String(o))?i.push(f(e,t,n,r,String(o),!0)):i.push("");return a.forEach((function(a){a.match(/^\d+$/)||i.push(f(e,t,n,r,a,!0))})),i}(e,n,r,l,o):o.map((function(t){return f(e,n,r,l,t,_)})),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]}(c,u,v)):v[0]+u+v[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,a,i){var o,l,s;if((s=Object.getOwnPropertyDescriptor(t,a)||{value:t[a]}).get?l=s.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):s.set&&(l=e.stylize("[Setter]","special")),j(r,a)||(o="["+a+"]"),l||(e.seen.indexOf(s.value)<0?(l=m(n)?d(e,s.value,null):d(e,s.value,n-1)).indexOf("\n")>-1&&(l=i?l.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+l.split("\n").map((function(e){return" "+e})).join("\n")):l=e.stylize("[Circular]","special")),y(o)){if(i&&a.match(/^\d+$/))return l;(o=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+l}function g(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function m(e){return null===e}function w(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(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 q(e){return v(e)&&"[object Date]"===O(e)}function E(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(),!o[e])if(l.test(e)){var n=r.pid;o[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else o[e]=function(){};return o[e]},t.inspect=c,c.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]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=n(9032),t.isArray=g,t.isBoolean=h,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=w,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=q,t.types.isDate=q,t.isError=E,t.types.isNativeError=E,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 R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(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(),R[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 k="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(k&&e[k]){var t;if("function"!=typeof(t=e[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,k,{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})),a=[],i=0;i<arguments.length;i++)a.push(arguments[i]);a.push((function(e,r){e?n(e):t(r)}));try{e.apply(this,a)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),k&&Object.defineProperty(t,k,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,a(e))},t.promisify.custom=k,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 a=t.pop();if("function"!=typeof a)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return a.apply(i,arguments)};e.apply(this,t).then((function(e){r.nextTick(o.bind(null,null,e))}),(function(e){r.nextTick(T.bind(null,e,o))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,a(e)),t}},5767:(e,t,n)=>{"use strict";var r=n(2682),a=n(9209),i=n(487),o=n(8075),l=n(5795),s=o("Object.prototype.toString"),c=n(9092)(),u="undefined"==typeof globalThis?n.g:globalThis,_=a(),d=o("String.prototype.slice"),p=Object.getPrototypeOf,f=o("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n<e.length;n+=1)if(e[n]===t)return n;return-1},g={__proto__:null};r(_,c&&l&&p?function(e){var t=new u[e];if(Symbol.toStringTag in t){var n=p(t),r=l(n,Symbol.toStringTag);if(!r){var a=p(n);r=l(a,Symbol.toStringTag)}g["$"+e]=i(r.get)}}:function(e){var t=new u[e],n=t.slice||t.set;n&&(g["$"+e]=i(n))}),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!c){var t=d(s(e),8,-1);return f(_,t)>-1?t:"Object"===t&&function(e){var t=!1;return r(g,(function(n,r){if(!t)try{n(e),t=d(r,1)}catch(e){}})),t}(e)}return l?function(e){var t=!1;return r(g,(function(n,r){if(!t)try{"$"+n(e)===r&&(t=d(r,1))}catch(e){}})),t}(e):null}},785:(e,t,n)=>{var r=n(5606);const a=n(2196),i=n(9175),o=n(7507),l=n(9022),s=n(6945),c=n(4285),u=n(3568),_=n(3222),d=-1,p=/^([0-9]+)(\.[0-9]+)?$/,f="quoted_rfc",g="quoted",h=1;class m extends Error{}function w(e,t=null){if(!e)throw t||(t="Assertion error"),new m(t)}function b(e,t,n,r){let a=r?_(e):e.length;if(n.has_wide_chars=n.has_wide_chars||a!=e.length,n.max_total_length=Math.max(n.max_total_length,a),n.max_int_length==d)return;let i=p.exec(e);if(null===i)return void(!t&&e.length&&(n.max_int_length=d,n.max_fractional_length=d));let o=i[1].length;n.max_int_length=Math.max(n.max_int_length,o);let l=void 0===i[2]?0:i[2].length;n.max_fractional_length=Math.max(n.max_fractional_length,l)}function y(e,t,n,r){e=e.trim();let a=n.has_wide_chars?_(e):e.length;if(n.max_int_length==d){let t=Math.max(n.max_total_length-a,0);return r?e:e+" ".repeat(t+h)}if(t&&null===p.exec(e)){let t=Math.max(n.max_total_length-a,0);return r?e:e+" ".repeat(t+h)}let i=e.indexOf("."),o=-1==i?e.length:i,l=-1==i?0:e.length-i,s=Math.max(n.max_int_length-o,0),c=Math.max(n.max_fractional_length-l),u=r?"":" ".repeat(c+h);return" ".repeat(s)+e+u}function x(e,t,n,r,a){let i=y(e,t,n,a);return r&&(i=" ".repeat(n.start_offset)+i),i}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 q(e){return"rbql_table_name:"+e}function E(e,t,n){var r,l="~"===(r=n).charAt(0)?o.join(a.homedir(),r.slice(1)):r;if(i.existsSync(l))return l;if(t&&!o.isAbsolute(l)&&(l=o.join(t,l),i.existsSync(l)))return l;let s=e?e.get(q(n)):null;return s&&i.existsSync(s)?s:null}class S extends Error{}class O extends l.RBQLInputIterator{constructor(e,t,n,r=!1,a=null,i="input",o="a"){super(),this.has_header=r,this.table_name=i,this.variable_prefix=o,this.NR=0,this.NL=0;let l="quoted_rfc"==n,[s,c]=[null,null];if([this.records,s,this.fields_info,this.first_defective_line,this._first_trailing_space_line,c]=u.parse_document_records(e,t,n,a,l),l&&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 l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),this.has_header&&(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 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,a,i]=l.sample_first_two_inconsistent_records(t),o=`Number of fields in "${e}" table is not consistent: `;return o+=`e.g. record ${n+1} -> ${r} fields, record ${a+1} -> ${i} fields`,o}(this.table_name,this.fields_info)),e}}class A extends l.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 c.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return c.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 R{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 j extends l.RBQLTableRegistry{constructor(e,t,n,r,a,i=!1,o=null,l=null){super(),this.vscode_global_state=e,this.input_file_dir=t,this.delim=n,this.policy=r,this.encoding=a,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=l,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=E(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=i.createReadStream(this.table_path),this.record_iterator=new s.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 ${o.basename(this.table_path)} was also treated as header (and skipped)`)}}function k(e,t,n,r,a,i){let o=[],l=a,s=0,c=0;for(let a=0;a<r.length;a++){let i=0,u=[];for(;;){let t=r[a].indexOf(n,i);if(-1==t)break;u.push(new e.Range(l,s,l,s+t-i)),l+=1,s=0,c=0,i=t+n.length}c+=r[a].length-i,a+1<r.length&&(c+=t),u.push(new e.Range(l,s,l,c)),o.push(u),s=c}return w(l==i),o}function T(e,t){let[n,r]=c.split_quoted_str(e+'x"',t);return!r}function I(e,t,n,r,a,i=null){null===i&&(i=50);let o=Math.max(0,a.start.line-i),l=Math.min(t.lineCount,a.end.line+i),s=[],u=new c.MultilineRecordAggregator(r);for(let r=o;r<l;r++){let a=t.lineAt(r).text;if(r+1==t.lineCount&&!a)break;let i=u.is_inside_multiline_record(),o=r-u.get_num_lines_in_record();u.add_line(a);let l=u.is_inside_multiline_record();if(!i&&l&&(T(a,n)||(s=[],u.reset())),u.has_comment_line)s.push({comment_range:new e.Range(r,0,r,a.length)}),u.reset();else if(u.has_full_record){const t="\r\n";let a=u.get_full_line(t);u.reset();let[i,l]=c.smart_split(a,n,g,!0);l||s.push({record_ranges:k(e,n.length,t,i,o,r)})}}return s}function P(e,t,n){if(!e.length)return null;for(var r=0,a=e[r].length+t;n>a&&r+1<e.length;)a=a+e[r+=1].length+t;return r}e.exports.make_table_name_key=q,e.exports.find_table_path=E,e.exports.read_header=async function(e,t){"latin-1"==t&&(t="binary");let r=n(7560).createInterface({input:i.createReadStream(e,{encoding:t})}),a=!1,o=null,l=null,s=new Promise((function(e,t){o=e,l=t}));return r.on("line",(e=>{a||(a=!0,r.close(),o(e))})),r.on("error",(e=>{l(e)})),s},e.exports.rbql_query_web=async function(e,t,n,r,a,i,o,s,c=null){let u=new R,_=new O(t,n,r,s,c),d=new A(a,i);return await l.query(e,_,d,o,u,""),d.output_lines},e.exports.rbql_query_node=async function(e,t,n,c,u,_,d,p,f,g,h=!1,m=null,w="",b=null){let y=null,x=null;b&&b.bulk_read&&n?x=n:y=null===n?r.stdin:i.createReadStream(n);let[v,q]=null===_?[r.stdout,!1]:[i.createWriteStream(_),!0];if('"'==c&&"quoted"==u)throw new S('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==f&&(f="binary"),!s.is_ascii(t)&&"binary"==f)throw new S("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(s.is_ascii(c)&&s.is_ascii(d)||"binary"!=f))throw new S("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let E=o.join(a.homedir(),".rbql_init_source.js");""==w&&i.existsSync(E)&&(w=s.read_user_init_code(E));let O=n?o.dirname(n):null,A=new j(e,O,c,u,f,h,m,b),R=new s.CSVRecordIterator(y,x,f,c,u,h,m),k=new s.CSVWriter(v,q,f,d,p);await l.query(t,R,k,g,A,w),A.get_warnings(g)},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 a=[],i=!0,o=new v(e,t);for(;o.has_entries_left();){let[e,t]=o.get_next();if(w(null===t!=(null===e)),null===e){a.push(t);continue}let l=[];for(let t=0;t<e.length&&!(t>=n.length);t++){let o=!1,s=e[t].split("\n");for(let c=0;c<s.length;c++){c>0&&(a.push(l.join(r)),l=[],o=!0);let u=t+1==e.length||s.length>1&&c+1<s.length,_=x(s[c],i,n[t],o,u);o=!1,l.push(_)}}i=!1,a.push(l.join(r))}return a.join("\n")},e.exports.shrink_columns=function(e,t,n,r){let[a,i,o,l,s,c]=u.parse_document_records(e,t,n,r,!0,-1,!0,!0);if(null!==l)return[null,l+1];let _=[],d=!1,p=new v(a,c);for(;p.has_entries_left();){let[e,n]=p.get_next();if(w(null===n!=(null===e)),null===e){_.push(n);continue}let r=[];for(let n=0;n<e.length;n++){let a=e[n].split("\n");for(let e=0;e<a.length;e++){e>0&&(_.push(r.join(t)),r=[]);let n=a[e].trim();n.length!=a[e].length&&(d=!0),r.push(n)}}_.push(r.join(t))}return d?[_.join("\n"),null]:[null,null]},e.exports.calc_column_stats=function(e,t,n,r,a){let[i,o,l,s,c,_]=u.parse_document_records(e,t,n,r,!0,-1,!0,!0);if(null!==s)return[null,s+1,null,null];let p=[],f=!0,g=!1;for(let e of i){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];!g&&a&&(g=!/^[\x00-\x7F]*$/.test(n));let r=n.split("\n");r.length>1&&(p[t].max_int_length=d,p[t].max_fractional_length=d);for(let e of r)b(e.trim(),f,p[t],g)}f=!1}return[p,null,i,_]},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+h+t,n.push(r)}return n},e.exports.update_subcomponent_stats=b,e.exports.align_field=y,e.exports.rfc_align_field=x,e.exports.assert=w,e.exports.get_field_by_line_position=P,e.exports.get_cursor_position_info=function(e,t,n,r,a,i){return null===r?null:r==f?function(e,t,n,r,a){let i=new e.Range(Math.max(a.line-20,0),0,a.line+20,0),o=I(e,t,n,r,i),l=null;for(let e of o)if(e.hasOwnProperty("comment_range"))e.comment_range.contains(a)&&(l={is_comment:!0});else for(let t=0;t<e.record_ranges.length;t++)for(let n of e.record_ranges[t])n.contains(a)&&(l={column_number:t,total_columns:e.record_ranges.length,split_warning:!1});return l}(e,t,n,a,i):function(e,t,n,r,a){var i=a.line,o=a.character,l=e.lineAt(i).text;if(r&&l.startsWith(r))return{is_comment:!0};let[s,u]=c.smart_split(l,t,n,!0);var _=P(s,t.length,o+1);return null==_?null:{column_number:_,total_columns:s.length,split_warning:u}}(t,n,r,a,i)},e.exports.format_cursor_position_info=function(e,t,n,r,a){if(e.is_comment)return r?["Comment","Comment"]:[null,null];let i="Col "+(e.column_number+1),o="[Rainbow CSV] "+i;if(n&&e.column_number<t.length){let n=t[e.column_number].trim(),r=n.substr(0,a);r!=n&&(r+="..."),i+=": "+r,o+=": "+n}return e.split_warning?o+="; ERR: Inconsistent double quotes in line":t.length!=e.total_columns&&(o+=`; WARN: Inconsistent num of fields, header: ${t.length}, this line: ${e.total_columns}`),[o,i]},e.exports.parse_document_range=function(e,t,n,r,a,i){return r==f?I(e,t,n,a,i):function(e,t,n,r,a,i){let o=[],l=Math.max(0,i.start.line-50),s=Math.min(t.lineCount,i.end.line+50);for(let i=l;i<s;i++){let l=[],s=t.lineAt(i).text;if(i+1==t.lineCount&&!s)break;if(a&&s.startsWith(a)){o.push({comment_range:new e.Range(i,0,i,s.length)});continue}let u=c.smart_split(s,n,r,!0)[0],_=0,d=0;for(let t=0;t<u.length;t++)d+=u[t].length,t+1<u.length&&(d+=n.length),l.push([new e.Range(i,_,i,d)]),_=d;o.push({record_ranges:l})}return o}(e,t,n,r,a,i)},e.exports.sample_preview_records_from_context=function(e,t,n,r){let[a,i,o,l]=[e.input_document,e.delim,e.policy,e.comment_prefix];e.requested_start_record=Math.max(e.requested_start_record,0);let s=o==f,[c,_]=function(e,t,n,r,a,i,o,l){let s=[],c=null,_=null,[d,p,f,g]=[null,null,null,null];if(a<5*i)[s,d,p,c,f,g]=u.parse_document_records(e,t,n,r,o,a,!0,!1);else{let a=!0;if(l.has(e.fileName)&&([s,c,_]=l.get(e.fileName),e.version===_&&(a=!1)),a){let[a,i,s,c,_,d]=u.parse_document_records(e,t,n,r,o,-1,!0,!1);l.set(e.fileName,[a,c,e.version])}[s,c,_]=l.get(e.fileName)}return[s,c]}(a,i,o,l,e.requested_start_record+n,n,s,r);if(null!==_&&o==f)return void(t.preview_sampling_error=`Double quotes are not consistent in record ${c.length+1} which starts at line ${_+1}`);e.requested_start_record=Math.max(0,Math.min(e.requested_start_record,c.length-n));let d=c.slice(e.requested_start_record,e.requested_start_record+n);for(let e=0;e<d.length;e++){let t=d[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=d,t.actual_start_record=e.requested_start_record},e.exports.parse_document_range_rfc=I,e.exports.sample_first_two_inconsistent_records=l.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 a="#f44242";let i=`${n}.${r}`;if(!t.lint_results.has(i))return;var o=t.lint_results.get(i);t.lint_status_bar_button||(t.lint_status_bar_button=e.window.createStatusBarItem(e.StatusBarAlignment.Left)),t.lint_status_bar_button.text="CSVLint";let s="";if(o.is_processing)t.lint_status_bar_button.color="#A0A0A0",t.lint_status_bar_button.text="$(clock) CSVLint",s="Processing";else if(Number.isInteger(o.first_defective_line))s=`Error. Line ${o.first_defective_line} has formatting error: double quote chars are not consistent`,t.lint_status_bar_button.color=a,t.lint_status_bar_button.text="$(error) CSVLint";else if(o.fields_info&&o.fields_info.size>1){let[e,n,r,i]=l.sample_first_two_inconsistent_records(o.fields_info);s=`Error. Number of fields is not consistent: e.g. record ${e+1} has ${n} fields, and record ${r+1} has ${i} fields`,t.lint_status_bar_button.color=a,t.lint_status_bar_button.text="$(error) CSVLint"}else Number.isInteger(o.first_trailing_space_line)?(s=`Leading/Trailing spaces detected: e.g. at line ${o.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"):(w(o.is_ok),t.lint_status_bar_button.color="#62f442",t.lint_status_bar_button.text="$(pass) CSVLint",s="OK");t.lint_status_bar_button.tooltip=s+"\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,a,i,o){let[l,s,c,_,d,p]=u.parse_document_records(t,n,r,a,!0,-1,!0,!0);if(null!==_)return[null,`Unable to enter column edit mode: quoting error at line ${_+1}`,null];if(l.length+p.length!=t.lineCount)return[null,"Column edit mode is not supported for files with multiline fields",null];let h=0,m=[],b=null,y=new v(l,p);for(;y.has_entries_left();){let[t,a]=y.get_next();if(w(null===a!=(null===t)),null!==t){if(o>=t.length)return[null,`Line ${h+1} doesn't have field number ${o+1}`,null];let a=t.slice(0,o).join("").length+o*n.length,l=t.slice(0,o+1).join("").length+o*n.length,s=t.join(n);b||"ce_before"!=i||r!=g&&r!=f||-1==s.substring(a-2,a+2).indexOf('"')||(b=`Be careful, cursor at line ${h+1} has a double quote is in proximity.`),b||"ce_after"!=i||r!=g&&r!=f||-1==s.substring(l-2,l+2).indexOf('"')||(b=`Be careful, cursor at line ${h+1} has a double quote is in proximity.`),b||"ce_select"!=i||a!=l||(b=`Be careful, Field ${o+1} at line ${h+1} is empty.`);let c=new e.Position(h,a),u=new e.Position(h,l);"ce_before"==i&&m.push(new e.Selection(c,c)),"ce_after"==i&&m.push(new e.Selection(u,u)),"ce_select"==i&&m.push(new e.Selection(c,u))}h+=1}return[m,null,b]}},4285:e=>{let t='"((?:[^"]*"")*[^"]*)"',n=new RegExp("^"+t),r=new RegExp("^ *"+t+" *");function a(e,t,a,i,o,l){var s=!1;let c=e.substring(o),u=(i?r:n).exec(c);if(null!==u){let n=u[0].length;if(o+n==e.length||e[o+n]==t)return a?l.push(u[0]):l.push(u[1].replace(/""/g,'"')),[o+n+1,!1];s=!0}var _=e.indexOf(t,o);-1==_&&(_=e.length);var d=e.substring(o,_);return s=s||-1!=d.indexOf('"'),l.push(d),[_+1,s]}function i(e,t,n=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var r=[],i=0,o=!1;let l=" "!=t;for(;i<e.length;){var s=a(e,t,n,l,i,r);i=s[0],o=o||s[1]}return e.charAt(e.length-1)==t&&r.push(""),[r,o]}function o(e){let n=new RegExp("^ *"+t+" *$").exec(e);return null!==n?n[1].replace(/""/g,'"'):e}function l(e,t=!1){var n=t?new RegExp(" *[^ ]+ *","g"):new RegExp("[^ ]+","g");let r=[],a=null;for(;null!==(a=n.exec(e));)r.push(a[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=i,e.exports.split_whitespace_separated_str=l,e.exports.smart_split=function(e,t,n,r){return"simple"===n?[e.split(t),!1]:"whitespace"===n?[l(e,r),!1]:"monocolumn"===n?[[e],!1]:i(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=o,e.exports.unquote_fields=function(e){return e.map(o)},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 a=0;a<e.length;a++){let i=e[a];if(","==i&&0==r.length)t.push(e.substring(n,a)),n=a+1;else if(-1!=["[","{","("].indexOf(i))r.push(i);else if(-1!=["]","}",")"].indexOf(i)){if(!r.length||!check_if_brackets_match(r[r.length-1],i))throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing "${i}"`);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),a=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),i=/^([ab])\[([0-9]+)\]$/.exec(e),o=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e),l=/^(.*) (as|AS) +([a-zA-Z][a-zA-Z0-9_]*) *$/.exec(e);if(null!==l)return{table_name:null,column_index:null,column_name:null,is_star:!1,alias_name:l[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!==a){let e=a[1],t=a[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!=i)return{table_name:i[1],column_index:parseInt(i[2])-1,column_name:null,is_star:!1,alias_name:null};if(null!=o){o[1];let e=o[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],a=n[1];this.stats.set(e,[r+t,a+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],a=n[1],i=n[2];this.stats.set(e,[r+t,a+t*t,i+1])}}get_final(e){var t=this.stats.get(e),n=t[0],r=t[1],a=t[2],i=n/a;return r/a-i*i}}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 a of this.aggregators)r.push(a.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 a=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),a+=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(a!=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(),a=n.findIndex((e=>e instanceof UnnestMarker));for(var i=0;i<query_context.unnest_list.length;i++)if(r[a]=query_context.unnest_list[i],!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"),a=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 i=r[e].substring(0,n);return a=a.map((e=>i+e)),r.slice(0,e).concat(a).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,a=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,i=null===e.sort_key_expression?"null":e.sort_key_expression,o=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(n?(o=embed_code(embed_code(o,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),o=embed_expression(o,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):o=embed_code(embed_code(o,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),o=embed_code(o,"__RBQLMP__variables_init_code",e.variables_init_code),o=embed_expression(o,"__RBQLMP__select_expression",e.select_expression),o=embed_expression(o,"__RBQLMP__where_expression",r),o=embed_expression(o,"__RBQLMP__aggregation_key_expression",a),o=embed_expression(o,"__RBQLMP__sort_key_expression",i)):(n?(o=embed_code(o,"__CODE__",PROCESS_UPDATE_JOIN),o=embed_expression(o,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):o=embed_code(o,"__CODE__",PROCESS_UPDATE_SIMPLE),o=embed_code(o,"__RBQLMP__variables_init_code",e.variables_init_code),o=embed_code(o,"__RBQLMP__update_expressions",e.update_expressions),o=embed_expression(o,"__RBQLMP__where_expression",r)),"(async () => {"+o+"})()"}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 a=parseInt(r[e][1]);n[t+String(a)]={initialize:!0,index:a-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 a=parseInt(r[e][1]);n[`${t}[${a}]`]={initialize:!0,index:a-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 a=new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\[`);if(-1!=e.search(a))for(let a=0;a<n.length;a++){let i=n[a];if(query_probably_has_dictionary_variable(e,i)){let e=js_string_escape_column_name(i,'"');r[`${t}["${e}"]`]={initialize:!0,index:a},e=js_string_escape_column_name(i,"'"),r[`${t}['${e}']`]={initialize:!1,index:a},e=js_string_escape_column_name(i,"`"),r[`${t}[\`${e}\`]`]={initialize:!1,index:a}}}}function parse_attribute_variables(e,t,n,r,a){assert("a"===t||"b"===t);let i=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 i){let i=n.indexOf(e);if(-1==i)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${r}`);a[`${t}.${e}`]={initialize:!0,index:i}}}function map_variables_directly(e,t,n){for(let r=0;r<t.length;r++){let a=t[r];if(null===/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(a))throw new RbqlIOHandlingError(`Unable to use column name "${a}" as RBQL/JS variable`);-1!=e.indexOf(a)&&(n[a]={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 a=[];for(var i=/^([^ =]+) *==? *([^ =]+)/,o=/^ +(and|&&) +/i;;){if(n=i.exec(e),null===n)throw new RbqlParsingError(t);if(a.push([n[1],n[2]]),!(e=e.substr(n[0].length)).length)break;if(n=o.exec(e),null===n)throw new RbqlParsingError(t);e=e.substr(n[0].length)}return[r,a]}function resolve_join_variables(e,t,n,r){let a=[],i=[];const o="Valid JOIN syntax: <JOIN> /path/to/B/table on a... == b... [and a... == b... [and ... ]]";for(let l of n){let[n,s]=l;if(n=combine_string_literals(n,r),s=combine_string_literals(s,r),e.hasOwnProperty(n)&&t.hasOwnProperty(n))throw new RbqlParsingError(get_ambiguous_error_msg(n));if(e.hasOwnProperty(s)&&t.hasOwnProperty(s))throw new RbqlParsingError(get_ambiguous_error_msg(s));e.hasOwnProperty(s)&&([n,s]=[s,n]);let[c,u]=[null,null];if(-1!=["NR","a.NR","aNR"].indexOf(n))c=-1;else{if(!e.hasOwnProperty(n))throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field "${n}"\n${o}`);c=e[n].index}if(-1!=["b.NR","bNR"].indexOf(s))u=-1;else{if(!t.hasOwnProperty(s))throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field "${s}"\n${o}`);u=t[s].index}let _=-1==c?"NR":`safe_join_get(record_a, ${c})`;i.push(u),a.push(_)}return[a,i]}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",a=`${t}.NR`;return-1!=e.indexOf(a)&&n.push(`${a} = ${r};`),"a"==t&&-1!=e.indexOf("aNR")&&n.push("aNR = NR;"),n}function generate_init_statements(e,t,n,r){let a=generate_common_init_code(e,"a"),i=/^[_0-9a-zA-Z]+$/;for(const[e,n]of Object.entries(t))if(n.initialize){let t=i.exec(e)?"var ":"";a.push(`${t}${e} = safe_get(record_a, ${n.index});`)}if(n){a=a.concat(generate_common_init_code(e,"b"));for(const[e,t]of Object.entries(n))if(t.initialize){let n=i.exec(e)?"var ":"";a.push(`${n}${e} = record_b === null ? null : safe_get(record_b, ${t.index});`)}}for(let e=1;e<a.length;e++)a[e]=r+a[e];return a.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 a of t){let t="]).concat("+{"*":"star_fields","a.*":"record_a","b.*":"record_b"}[a[1]]+").concat([";n<a.index&&(r+=e.substring(n,a.index)),r+=t,n=a.index+a[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 a of t){let t={"*":"__RBQL_INTERNAL_STAR","a.*":"a.__RBQL_INTERNAL_STAR","b.*":"b.__RBQL_INTERNAL_STAR"}[a[1]];n<a.index&&(r+=e.substring(n,a.index)),r+=t,n=a.index+a[0].length}return r+=e.substring(n),r}function translate_update_expression(e,t,n,r){let a=`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`,i=/(?:^|,) *(a[.#a-zA-Z0-9\[\]_]*) *=(?=[^=])/g,o=[],l=0;for(;;){let s=i.exec(e);if(0==o.length&&(null===s||0!=s.index))throw new RbqlParsingError(a);if(null===s){o[o.length-1]+=str_strip(e.substr(l))+");";break}o.length&&(o[o.length-1]+=str_strip(e.substring(l,s.index))+");");let c=combine_string_literals(str_strip(s[1]),n);if(!t.hasOwnProperty(c))throw new RbqlParsingError(`Unable to parse "UPDATE" expression: Unknown field name: "${c}"`);let u=t[c].index,_=o.length?r:"";o.push(`${_}safe_set(up_fields, ${u}, `),l=s.index+s[0].length}return combine_string_literals(o.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=[],a=[],i=0;null!==(n=t.exec(e));){var o=a.length,l=n[0];a.push(l);var s=n.index;r.push(e.substring(i,s)),r.push(`___RBQL_STRING_LITERAL${o}___`),i=t.lastIndex}r.push(e.substring(i));var c=r.join("");return[c=c.replace(/\t/g," "),a]}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 a=0;a<t[r].length;a++){var i=t[r][a],o=get_all_matches(new RegExp("(?:^| )"+replace_all(i," "," *")+"(?= )","ig"),e);if(o.length){if(o.length>1)throw new RbqlParsingError(`More than one "${i}" statements found`);assert(1==o.length);var l=o[0],s=l[0];n.push([l.index,l.index+s.length,i]);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),a=0;a<r.length;a++){var i=r[a][0],o=r[a][1],l=r[a][2],s=a+1<r.length?r[a+1][0]:e.length;assert(i<o),assert(o<=s);var c=e.substring(o,s),u={};if(-1!=[STRICT_LEFT_JOIN,LEFT_OUTER_JOIN,LEFT_JOIN,INNER_JOIN,JOIN].indexOf(l)&&(u.join_subtype=l,l=JOIN),l==UPDATE){if(0!=i)throw new RbqlParsingError("UPDATE keyword must be at the beginning of the query");c=c.replace(/^ *SET/i,"")}if(l==ORDER_BY){var _=(c=c.replace(/ ASC *$/i,"")).replace(/ DESC *$/i,"");_!=c?(c=_,u.reverse=!0):u.reverse=!1}if(l==SELECT){if(0!=i)throw new RbqlParsingError("SELECT keyword must be at the beginning of the query");let e=/^ *TOP *([0-9]+) /i.exec(c);null!==e&&(u.top=parseInt(e[1]),c=c.substr(e.index+e[0].length)),e=/^ *DISTINCT *(COUNT)? /i.exec(c),null!==e&&(u.distinct=!0,e[1]&&(u.distinct_count=!0),c=c.substr(e.index+e[0].length))}u.text=str_strip(c),t[l]=u}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 a=e.split(",");a=a.map(str_strip);let i=[];for(let e of a){if(e=combine_string_literals(e,n),!t.hasOwnProperty(e))throw new RbqlParsingError(`Unknown field in EXCEPT expression: "${e}"`);i.push(t[e].index)}return i=i.sort(((e,t)=>e-t)),[null===r?null:select_except(r,i),`select_except(record_a, [${i.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,a=!1;for(let e of n)r=r||null!==e&&e.is_star,a=a||null!==e&&null!==e.alias_name;if(null===e){if(r&&a)throw new RbqlParsingError("Using both * (star) and AS alias in the same query is not allowed for input tables without header");if(!a)return null;e=[],t=[]}null===t&&(t=[]);let i=[];for(let r of n)null===r?i.push("col"+(i.length+1)):r.is_star?null===r.table_name?i=i.concat(e).concat(t):"a"===r.table_name?i=i.concat(e):"b"===r.table_name&&(i=i.concat(t)):null!==r.column_name?i.push(r.column_name):null!==r.alias_name?i.push(r.alias_name):null!==r.column_index?"a"==r.table_name&&r.column_index<e.length?i.push(e[r.column_index]):"b"==r.table_name&&r.column_index<t.length?i.push(t[r.column_index]):i.push("col"+(i.length+1)):i.push("col"+(i.length+1));return i}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],[a,i]=t[1];return[r,n,i,a]}function make_inconsistent_num_fields_warning(e,t){let[n,r,a,i]=sample_first_two_inconsistent_records(t),o=`Number of fields in "${e}" table is not consistent: `;return o+=`e.g. record ${n} -> ${r} fields, record ${a} -> ${i} fields`,o}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[a,i]=separate_string_literals(e),o=separate_actions(a=remove_redundant_table_name(a));o.hasOwnProperty(WITH)&&t.handle_query_modifier(o[WITH]);var l=await t.get_variables_map(e);if(o.hasOwnProperty(ORDER_BY)&&o.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(o.hasOwnProperty(GROUP_BY)){if(o.hasOwnProperty(ORDER_BY)||o.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');r.aggregation_key_expression="["+combine_string_literals(o[GROUP_BY].text,i)+"]",r.aggregation_stage=1}let s=await t.get_header(),c=null,u=null;if(o.hasOwnProperty(JOIN)){var[_,d]=parse_join_expression(o[JOIN].text);if(null===n)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=n.get_iterator_by_table_id(_);if(!t)throw new RbqlParsingError(`Unable to find join table: "${_}"`);if(o.hasOwnProperty(WITH)&&t.handle_query_modifier(o[WITH]),c=await t.get_variables_map(e),u=await t.get_header(),null===s&&null!==u)throw new RbqlIOHandlingError("Inconsistent modes: Input table doesn't have a header while the Join table has a header");if(null!==s&&null===u)throw new RbqlIOHandlingError("Inconsistent modes: Input table has a header while the Join table doesn't have a header");let[a,p]=resolve_join_variables(l,c,d,i),f={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[o[JOIN].join_subtype];r.lhs_join_var_expression=1==a.length?a[0]:"JSON.stringify(["+a.join(",")+"])",r.join_map_impl=new HashJoinMap(t,p),await r.join_map_impl.build(),r.join_map=new f(r.join_map_impl)}if(r.variables_init_code=combine_string_literals(generate_init_statements(a,l,c," ".repeat(4)),i),o.hasOwnProperty(WHERE)){var p=o[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,i)}if(o.hasOwnProperty(UPDATE)){var f=translate_update_expression(o[UPDATE].text,l,i," ".repeat(8));r.update_expressions=combine_string_literals(f,i),r.writer.set_header(s)}if(o.hasOwnProperty(SELECT)){if(r.top_count=find_top(o),o.hasOwnProperty(EXCEPT)){if(o.hasOwnProperty(JOIN))throw new RbqlParsingError("EXCEPT and JOIN are not allowed in the same query");let[e,t]=translate_except_expression(o[EXCEPT].text,l,i,s);r.select_expression=t,r.writer.set_header(e)}else{let[e,t]=translate_select_expression(o[SELECT].text);r.select_expression=combine_string_literals(e,i);let n=select_output_header(s,u,adhoc_parse_select_expression_to_column_infos(t,i));r.writer.set_header(n)}r.writer=new TopWriter(r.writer,r.top_count),o[SELECT].hasOwnProperty("distinct_count")?r.writer=new UniqCountWriter(r.writer):o[SELECT].hasOwnProperty("distinct")&&(r.writer=new UniqWriter(r.writer))}if(o.hasOwnProperty(ORDER_BY)){r.sort_key_expression=combine_string_literals(o[ORDER_BY].text,i);let e=o[ORDER_BY].reverse;r.writer=new SortedWriter(r.writer,e)}}async function query(e,t,n,r,a=null,i=""){query_context=new RBQLContext(e,t,n,i),await shallow_parse_input_query(e,t,a,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,a=null,i=null,o=null,l=null,s=!0,c=""){s||null===i||null===o||ensure_no_ambiguous_variables(e,i,o);let u=new TableIterator(t,i,s),_=new TableWriter(n),d=null===a?null:new SingleTableRegistry(a,o,s);if(await query(e,u,_,r,d,c),null!==l&&(assert(0==l.length,"`output_column_names` param must be an empty list or null"),null!==_.header))for(let e of _.header)l.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 a=n(8364),i=n(9135),o=n(1820),l=n(537),s=n(9022),c=n(4285),u="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class _ extends Error{}class d extends Error{}function p(e,t=null){if(!e)throw t||(t="Assertion error"),new d(t)}function f(e){return/^[\x00-\x7F]*$/.test(e)}function g(e){return a.readFileSync(e,"utf-8")}function h(e,t){var n,r="~"===(n=t).charAt(0)?o.join(i.homedir(),n.slice(1)):n;if(a.existsSync(r))return r;if(e&&!o.isAbsolute(r)&&(r=o.join(e,r),a.existsSync(r)))return r;var l=function(e,t){for(var n=function(e){var t=null;try{t=a.readFileSync(e,"utf-8")}catch(e){return[]}for(var n=t.split("\n"),r=[],i=0;i<n.length;i++)if(n[i]){var o=n[i].split("\t");r.push(o)}return r}(e),r=0;r<n.length;r++)if(n[r].length&&n[r][0]==t)return n[r];return null}(o.join(i.homedir(),".rbql_table_names"),t);return l&&l.length>1&&a.existsSync(l[1])?l[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 w extends s.RBQLInputIterator{constructor(e,t,n,r,a,i=!1,o=null,s="input",u="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=a,this.has_header=i,this.first_record=null,this.first_record_should_be_emitted=!i,this.header_preread_complete=!1,this.table_name=s,this.variable_prefix=u,this.comment_prefix=o,this.decoder=null,"utf-8"==n&&null===this.csv_path&&(this.decoder=new l.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 c.MultilineRecordAggregator(o),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"==a?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 s.parse_basic_variables(e,this.variable_prefix,t),s.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(s.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),s.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]=c.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 _(`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 _(u)):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=c.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 _(u))}let n=c.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){a.readFile(e.csv_path,((r,a)=>{r?n(r):(e.process_data_bulk(a),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,a,i]=s.sample_first_two_inconsistent_records(t),o=`Number of fields in "${e}" table is not consistent: `;return o+=`e.g. record ${n} -> ${r} fields, record ${a} -> ${i} fields`,o}(this.table_name,this.fields_info)),e}}class b extends s.RBQLOutputWriter{constructor(e,t,n,r,a,i="\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=a,this.line_separator=i,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"==a)this.polymorphic_join=this.simple_join;else if("quoted"==a)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==a)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==a)this.polymorphic_join=this.mono_join;else{if("whitespace"!=a)throw new _("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 c.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return c.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new _('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 _(`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(a,i){null!==r&&i(r),e?t.end("",n,(()=>{a()})):setTimeout((()=>{a()}),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 y extends s.RBQLTableRegistry{constructor(e,t,n,r,a=!1,i=null,o=null){super(),this.input_file_dir=e,this.delim=t,this.policy=n,this.encoding=r,this.has_header=a,this.comment_prefix=i,this.stream=null,this.record_iterator=null,this.options=o,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=h(this.input_file_dir,e),null===this.table_path)throw new _(`Unable to find join table "${e}"`);return this.options&&this.options.bulk_read?this.bulk_input_path=this.table_path:this.stream=a.createReadStream(this.table_path),this.record_iterator=new w(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 ${o.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=f,e.exports.CSVRecordIterator=w,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=y,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 _(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=g,e.exports.query_csv=async function(e,t,n,l,c,u,d,p,h,m=!1,x=null,v="",q=null){let E=null,S=null;q&&q.bulk_read&&t?S=t:E=null===t?r.stdin:a.createReadStream(t);let[O,A]=null===c?[r.stdout,!1]:[a.createWriteStream(c),!0];if('"'==n&&"quoted"==l)throw new _('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==p&&(p="binary"),!f(e)&&"binary"==p)throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(f(n)&&f(u)||"binary"!=p))throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let R=o.join(i.homedir(),".rbql_init_source.js");""==v&&a.existsSync(R)&&(v=g(R));let j=t?o.dirname(t):null,k=new y(j,n,l,p,m,x,q),T=new w(E,S,p,n,l,m,x),I=new b(O,A,p,u,d);await s.query(e,T,I,h,k,v),k.get_warnings(h)},e.exports.RecordQueue=m,e.exports.exception_to_error_info=s.exception_to_error_info},7181:(e,t,n)=>{const r=n(4148),a=n(785),i=n(3568);class o{constructor(e,t){this.line=e,this.character=t}}class l{constructor(e,t){this.anchor=e,this.active=t}}class s{constructor(e,t,n,r){this.start=new o(e,t),this.end=new o(n,r)}contains(e){let t=e.line>this.start.line||e.line===this.start.line&&e.character>=this.start.character,n=e.line<this.end.line||e.line==this.end.line&&e.character<=this.end.character;return t&&n}}class c{constructor(e){this.scheme=e}}class u{constructor(e,t="TestDouble.txt",n="plaintext",r="file"){this.lines_buffer=e,this.lineCount=e.length,this.fileName=t,this.version=1,this.languageId=n,this.uri=new c(r)}lineAt(e){return{text:this.lines_buffer[e]}}getText(){return this.lines_buffer.join("\n")}}class _{constructor(){this.text=null,this.color=null,this.tooltip=null,this.command=null,this.is_visible=!1}show(){this.is_visible=!0}}let d={Range:s,window:{createStatusBarItem:function(e){return new _}},StatusBarAlignment:{Left:null},languages:{setTextDocumentLanguage:function(e,t){return e.languageId=t,e}},Position:o,Selection:l};function p(e){return r.equal(e.start.line,e.end.line),[e.start.line,e.start.character,e.end.character]}function f(e){let t=[],n=[];for(let a of e)if(a.hasOwnProperty("comment_range"))t.push(p(a.comment_range));else{r(a.hasOwnProperty("record_ranges"));let e=[];for(let t of a.record_ranges){let n=[];for(let e of t)n.push(p(e));e.push(n)}n.push(e)}return[t,n]}function g(e,t,n){return[e,t,n]}function h(e){let t=[];for(;e.has_entries_left();)t.push(e.get_next());return t}t.test_all=function(){!function(){let e=null,t=null,n=null;e="foobar",t=0,n={max_total_length:5,max_int_length:2,max_fractional_length:3,has_wide_chars:!1},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:6,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1}),e="foobar",t=1,n={max_total_length:0,max_int_length:0,max_fractional_length:0},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:6,max_int_length:0,max_fractional_length:0,has_wide_chars:!1}),e="100000",t=0,n={max_total_length:2,max_int_length:-1,max_fractional_length:-1},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:6,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1}),e="",t=0,n={max_total_length:5,max_int_length:2,max_fractional_length:3},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:5,max_int_length:2,max_fractional_length:3,has_wide_chars:!1}),e="100.3",t=0,n={max_total_length:7,max_int_length:4,max_fractional_length:3,has_wide_chars:!1},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:7,max_int_length:4,max_fractional_length:3,has_wide_chars:!1}),e="100000",t=0,n={max_total_length:5,max_int_length:2,max_fractional_length:3},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:6,max_int_length:6,max_fractional_length:3,has_wide_chars:!1}),e="1000.23",t=0,n={max_total_length:3,max_int_length:3,max_fractional_length:0},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:7,max_int_length:4,max_fractional_length:3,has_wide_chars:!1}),e="编号",t=0,n={max_total_length:1,max_int_length:-1,max_fractional_length:-1},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:4,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!0}),e="foobar",t=0,n={max_total_length:1,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!0},a.update_subcomponent_stats(e,t,n,!0),r.deepEqual(n,{max_total_length:6,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!0}),e="编号",t=0,n={max_total_length:1,max_int_length:-1,max_fractional_length:-1},a.update_subcomponent_stats(e,t,n,!1),r.deepEqual(n,{max_total_length:2,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1})}(),function(){let e=null,t=null,n=null,i=null;e="foobar",t=0,n={max_total_length:10,max_int_length:-1,max_fractional_length:-1},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("foobar ",i),e="foobar",t=0,n={max_total_length:10,max_int_length:-1,max_fractional_length:-1},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!0),r.deepEqual("foobar",i),e="foobar",t=1,n={max_total_length:10,max_int_length:4,max_fractional_length:6},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("foobar ",i),e="10.1",t=1,n={max_total_length:10,max_int_length:4,max_fractional_length:6},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual(" 10.1 ",i),e="10.1",t=1,n={max_total_length:10,max_int_length:-1,max_fractional_length:-1},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("10.1 ",i),e="10.1",t=0,n={max_total_length:10,max_int_length:-1,max_fractional_length:-1},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("10.1 ",i),e="10.1",t=0,n={max_total_length:10,max_int_length:4,max_fractional_length:6},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual(" 10.1 ",i),e="1000",t=0,n={max_total_length:10,max_int_length:4,max_fractional_length:6},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("1000 ",i),e="1000",t=0,n={max_total_length:4,max_int_length:4,max_fractional_length:0},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual("1000 ",i),e="1000",t=0,n={max_total_length:6,max_int_length:4,max_fractional_length:0},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual(" 1000 ",i),e="10.1",t=0,n={max_total_length:12,max_int_length:4,max_fractional_length:6},n=a.adjust_column_stats([n],1)[0],i=a.align_field(e,t,n,!1),r.deepEqual(" 10.1 ",i)}(),function(){let[e,t,n,i,o]=[null,null,null,null,null,null];e="foobar",t=0,o=!1,n=[{max_total_length:5,max_int_length:-1,max_fractional_length:-1},{max_total_length:10,max_int_length:-1,max_fractional_length:-1}],n=a.adjust_column_stats(n,1),i=a.rfc_align_field(e,t,n[1],o,!1),r.deepEqual("foobar ",i),e="foobar",t=0,o=!0,n=[{max_total_length:5,max_int_length:-1,max_fractional_length:-1},{max_total_length:10,max_int_length:-1,max_fractional_length:-1}],n=a.adjust_column_stats(n,1),i=a.rfc_align_field(e,t,n[1],o,!1),r.deepEqual(" foobar ",i),e="foobar",t=0,o=!1,n=[{max_total_length:5,max_int_length:-1,max_fractional_length:-1},{max_total_length:10,max_int_length:-1,max_fractional_length:-1}],n=a.adjust_column_stats(n,1),i=a.rfc_align_field(e,t,n[1],o,!0),r.deepEqual("foobar",i),e="foobar",t=0,o=!0,n=[{max_total_length:5,max_int_length:-1,max_fractional_length:-1},{max_total_length:10,max_int_length:-1,max_fractional_length:-1}],n=a.adjust_column_stats(n,1),i=a.rfc_align_field(e,t,n[1],o,!0),r.deepEqual(" foobar",i)}(),function(){let[e,t,n,i,o]=[null,null,null,null,null],[l,s,c,_]=[null,null,null,null],[d,p,f]=[null,null];e=["type,weight","car,100","ship,20000"],t=new u(e),o="#",n=",",i="quoted",[l,s,c,_]=a.calc_column_stats(t,n,i,o),l=a.adjust_column_stats(l,n.length),d=a.align_columns(c,_,l,n),p=d.split("\n"),f=["type ,weight","car , 100","ship , 20000"],r.deepEqual(f,p),e=["type,color","car,red","ship,orange"],t=new u(e),o="#",n=",",i="quoted",[l,s,c,_]=a.calc_column_stats(t,n,i,o),l=a.adjust_column_stats(l,n.length),d=a.align_columns(c,_,l,n),p=d.split("\n"),f=["type ,color","car ,red","ship ,orange"],r.deepEqual(f,p),e=[" type, wght, color "," car , 1.008 , red"," ship , 200.5 , yellow"],t=new u(e),o="#",n=",",i="quoted",[l,s,c,_]=a.calc_column_stats(t,n,i,o),l=a.adjust_column_stats(l,n.length),d=a.align_columns(c,_,l,n),p=d.split("\n"),f=["type ,wght ,color","car , 1.008 ,red","ship ,200.5 ,yellow"],r.deepEqual(f,p),e=["#info","type,weight","#foo,foo","#m","car,100","ship,20000","#bar","#bar",""],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),l=a.adjust_column_stats(l,n.length),d=a.align_columns(c,_,l,n),p=d.split("\n"),f=["#info","type ,weight","#foo,foo","#m","car , 100","ship , 20000","#bar","#bar",""],r.deepEqual(f,p),e=["type,info,max_speed",'car,"A nice red car.','Can get you ""anywhere"" you want.','GPS included",100','ship,"Big heavy superfreighter ""Yamaha-2000"".','Comes with a crew of 10",25'],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),l=a.adjust_column_stats(l,n.length),d=a.align_columns(c,_,l,n),p=d.split("\n"),f=["type ,info ,max_speed",'car ,"A nice red car.',' Can get you ""anywhere"" you want.',' GPS included" , 100','ship ,"Big heavy superfreighter ""Yamaha-2000"".',' Comes with a crew of 10" , 25'],r.deepEqual(f,p),e=["type,color","car,red",'ship",orange'],t=new u(e),o="#",n=",",i="quoted",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.equal(null,l),r.equal(3,s),r.equal(null,c)}(),function(){let[e,t,n,i,o]=[null,null,null,null,null],[l,s,c,_]=[null,null,null,null];e=[" type , weight, color"," car,100 , yellow ","ship,20000,red"],t=new u(e),o="#",n=",",i="quoted",[s,l]=a.shrink_columns(t,n,i,o),c=s.split("\n"),_=["type,weight,color","car,100,yellow","ship,20000,red"],r.deepEqual(_,c),e=["type,weight,color","car,100,yellow","ship,20000,red"],t=new u(e),o="#",n=",",i="quoted",[s,l]=a.shrink_columns(t,n,i,o),r.equal(null,l),r.equal(null,s),e=["#hello"," type , weight, color","#foo","#bar"," car,100 , yellow ","ship,20000,red","# foo , bar",""],t=new u(e),o="#",n=",",i="quoted",[s,l]=a.shrink_columns(t,n,i,o),c=s.split("\n"),_=["#hello","type,weight,color","#foo","#bar","car,100,yellow","ship,20000,red","# foo , bar",""],r.deepEqual(_,c),e=[" type , weight, color"," car,100 , yellow ",'ship,20000",red'],t=new u(e),o="#",n=",",i="quoted",[s,l]=a.shrink_columns(t,n,i,o),r.equal(l,3),r.equal(s,null),e=["type ,info ,max_speed",'car ,"A nice red car.',' Can get you ""anywhere"" you want.',' GPS included" , 100','ship ,"Big heavy superfreighter ""Yamaha-2000"".',' Comes with a crew of 10" , 25'],t=new u(e),o="#",n=",",i="quoted_rfc",[s,l]=a.shrink_columns(t,n,i,o),c=s.split("\n"),_=["type,info,max_speed",'car,"A nice red car.','Can get you ""anywhere"" you want.','GPS included",100','ship,"Big heavy superfreighter ""Yamaha-2000"".','Comes with a crew of 10",25'],r.deepEqual(_,c),e=["type,info,max_speed",'car,"A nice red car.','Can get you ""anywhere"" you want.','GPS included",100','ship,"Big heavy superfreighter ""Yamaha-2000"".','Comes with a crew of 10",25'],t=new u(e),o="#",n=",",i="quoted_rfc",[s,l]=a.shrink_columns(t,n,i,o),r.equal(null,l),r.equal(null,s)}(),function(){let[e,t,n,i,o]=[null,null,null,null,null],[l,s,c,_]=[null,null,null,null];e=["# commment line",'1a,"1b','1b,""1b"",1b','1b",1c',"2a,2bbb,2cc",""],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.deepEqual([{record_num:0,comment_text:"# commment line"},{record_num:2,comment_text:""}],_),r.deepEqual(null,s),r.deepEqual([{max_total_length:2,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:12,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:3,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1}],l),e=["1a,1b","2aa","3a,3b,3c"],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.deepEqual([],_),r.deepEqual(null,s),r.deepEqual([{max_total_length:3,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:2,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:2,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1}],l),e=["1a,1b",'2a"a',"3a,3b,3c"],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.deepEqual(2,s),r.deepEqual(null,l),r.deepEqual(null,c),e=["type,weight","car,100","ship, 20000"],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.deepEqual([],_),r.deepEqual(null,s),r.deepEqual([{max_total_length:4,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:6,max_int_length:5,max_fractional_length:0,has_wide_chars:!1}],l),e=["car,100",'ship,"20000','300"'],t=new u(e),o="#",n=",",i="quoted_rfc",[l,s,c,_]=a.calc_column_stats(t,n,i,o),r.deepEqual([],_),r.deepEqual(null,s),r.deepEqual([{max_total_length:4,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1},{max_total_length:6,max_int_length:-1,max_fractional_length:-1,has_wide_chars:!1}],l)}(),function(){let[e,t,n,i]=[null,null,null];e={max_total_length:10,max_int_length:-1,max_fractional_length:-1},t=a.adjust_column_stats([e],1)[0],r.deepEqual({max_total_length:10,max_int_length:-1,max_fractional_length:-1,start_offset:0},t),e={max_total_length:10,max_int_length:0,max_fractional_length:0},t=a.adjust_column_stats([e],1)[0],r.deepEqual({max_total_length:10,max_int_length:-1,max_fractional_length:-1,start_offset:0},t),e={max_total_length:5,max_int_length:4,max_fractional_length:3},t=a.adjust_column_stats([e],1)[0],r.deepEqual({max_total_length:7,max_int_length:4,max_fractional_length:3,start_offset:0},t),e={max_total_length:10,max_int_length:4,max_fractional_length:3},t=a.adjust_column_stats([e],1)[0],r.deepEqual({max_total_length:10,max_int_length:7,max_fractional_length:3,start_offset:0},t),n=[{max_total_length:10,max_int_length:-1,max_fractional_length:-1},{max_total_length:8,max_int_length:-1,max_fractional_length:-1}],i=a.adjust_column_stats(n,1),r.deepEqual([{max_total_length:10,max_int_length:-1,max_fractional_length:-1,start_offset:0},{max_total_length:8,max_int_length:-1,max_fractional_length:-1,start_offset:12}],i)}(),function(){let[e,t,n,a,o]=[null,null,null,null,null],[l,s,c,_,d,p]=[null,null,null,null,null,null];e=["aaa","bbb","ccc"],t=new u(e),n=null,a=",",o="simple",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,1e3,!0,!1,!1),r.deepEqual([["aaa"],["bbb"],["ccc"]],l),r.deepEqual([[1,0]],Array.from(c.entries())),r.deepEqual([],p),r.equal(_,null),r.equal(d,null),r.equal(s,l.length),e=["a1,a2","b1,b2","#comment","c1 ,c2"],t=new u(e),n="#",a=",",o="simple",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!1,!0),r.deepEqual([["a1","a2"],["b1","b2"],["c1 ","c2"]],l),r.deepEqual([[2,0]],Array.from(c.entries())),r.deepEqual([{record_num:2,comment_text:"#comment"}],p),r.equal(_,null),r.equal(d,3),e=["a1,a2 ","b1,b2","","c1","d3,d4,d5"],t=new u(e),n="#",a=",",o="simple",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!1,!0),r.deepEqual([["a1","a2 "],["b1","b2"],[""],["c1"],["d3","d4","d5"]],l),r.deepEqual([[2,0],[1,2],[3,4]],Array.from(c.entries())),r.equal(_,null),r.equal(d,0),e=["a1,a2",'#"b1,b2','"b1,b2',"c1","d3,d4,d5"],t=new u(e),n="#",a=",",o="quoted",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!1,-1,!0,!1,!0),r.deepEqual([["a1","a2"],['"b1',"b2"],["c1"],["d3","d4","d5"]],l),r.deepEqual([{record_num:1,comment_text:'#"b1,b2'}],p),r.equal(_,2),r.equal(d,null),e=["a1,a2",'#"b1,b2','"b1,b2',"c1","d3,d4,d5"],t=new u(e),n="#",a=",",o="quoted",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!1,!0),r.deepEqual([["a1","a2"]],l),r.deepEqual([{record_num:1,comment_text:'#"b1,b2'}],p),r.equal(_,2),r.equal(d,null),e=['a1,"a2','b1"",b2 ','c1,c2",c3','#d1,"','"e1,""e2,e3"',"f1 ,f2"],t=new u(e),n="#",a=",",o="quoted_rfc",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!1,!0),r.deepEqual([["a1",'a2\nb1",b2 \nc1,c2',"c3"],['e1,"e2,e3'],["f1 ","f2"]],l),r.deepEqual([{record_num:1,comment_text:'#d1,"'}],p),r.equal(_,null),r.equal(d,5),e=['a1,"a2','b1"",b2 ','c1,"c2,c3','#d1,"','"e1,""e2,e3"',"f1 ,f2"],t=new u(e),n="#",a=",",o="quoted_rfc",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!1,!0),r.deepEqual([],l),r.deepEqual([],p),r.equal(_,0),e=["a1","b1","c1"],t=new u(e),n=null,a=",",o="simple",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!1,-1,!1,!0,!1,2),r.equal(null,l),r.deepEqual([],p),r.deepEqual([[1,0]],Array.from(c.entries())),r.equal(_,null),r.equal(d,null),e=["a1,a2","b1,b2","c1,c2"],t=new u(e),n=null,a=",",o="quoted",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!1,-1,!1,!0,!1,2),r.equal(null,l),r.deepEqual([[2,0]],Array.from(c.entries())),r.equal(_,null),r.equal(d,null),e=["a1,a2","b1,b2","c1,c2,c3","d1,d3"],t=new u(e),n=null,a=",",o="quoted",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!1,-1,!0,!1,!1,2),r.deepEqual([["a1","a2"],["b1","b2"]],l),r.deepEqual([[2,0],[3,2]],Array.from(c.entries())),e=["a1,a2","b1,b2",'"c1,c2'],t=new u(e),n=null,a=",",o="quoted_rfc",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,2,!0,!1,!1),r.deepEqual([["a1","a2"],["b1","b2"]],l),r.equal(_,null),e=["a1,a2","b1,b2",'"c1,c2'],t=new u(e),n=null,a=",",o="quoted_rfc",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,5,!0,!1,!1),r.deepEqual([["a1","a2"],["b1","b2"]],l),r.equal(_,2),e=["a1#~#a2#~#a3","b1#~#b2#~#b3","c1#~#c2#~#c3"],t=new u(e),n=null,a="#~#",o="simple",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,3,!0,!1,!1),r.deepEqual([["a1","a2","a3"],["b1","b2","b3"],["c1","c2","c3"]],l),r.equal(_,null),e=[" a1 a2 a3","b1 b2 b3 "," c1 c2 c3 "],t=new u(e),n=null,a=" ",o="whitespace",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,3,!0,!1,!0),r.deepEqual([["a1","a2","a3"],["b1","b2","b3"],["c1","c2","c3"]],l),r.equal(_,null),r.equal(d,null),e=['a1,"a2','b1"",b2 ','c1,c2",c3','#d1,"','"e1,""e2,e3"',"f1 ,f2"],t=new u(e),n="#",a=",",o="quoted_rfc",[l,s,c,_,d,p]=i.parse_document_records(t,a,o,n,!0,-1,!0,!0,!0),r.deepEqual([["a1",'"a2\nb1"",b2 \nc1,c2"',"c3"],['"e1,""e2,e3"'],["f1 ","f2"]],l),r.deepEqual([{record_num:1,comment_text:'#d1,"'}],p),r.equal(_,null),r.equal(d,5)}(),function(){let[e,t,n,i,o]=[null,null,null,null,null],[l,s,c]=[null,null,null],[_,p,h,m]=[null,null,null,null];e=["a1,a2","b1,b2","c1,c2","d1,d2"],t=new u(e),n=null,i=",",o=new d.Range(1,0,3,0),l=a.parse_document_range_rfc(d,t,i,n,o,0),[s,c]=f(l),p=[[g(1,0,3)],[g(1,3,5)]],h=[[g(2,0,3)],[g(2,3,5)]],r.deepEqual([p,h],c),r.deepEqual([],s),e=["a1,a2","b1,b2","c1,c2","d1,d2"],t=new u(e),n=null,i=",",o=new d.Range(1,0,4,0),l=a.parse_document_range_rfc(d,t,i,n,o,0),[s,c]=f(l),p=[[g(1,0,3)],[g(1,3,5)]],h=[[g(2,0,3)],[g(2,3,5)]],m=[[g(3,0,3)],[g(3,3,5)]],r.deepEqual([p,h,m],c),r.deepEqual([],s),e=["a1,a2","b1,b2","c1,c2","#comment","d1,d2"],t=new u(e),n=null,i=",",o=new d.Range(0,0,5,0),l=a.parse_document_range_rfc(d,t,i,"#",o,100),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,5)]],p=[[g(1,0,3)],[g(1,3,5)]],h=[[g(2,0,3)],[g(2,3,5)]],m=[[g(4,0,3)],[g(4,3,5)]],r.deepEqual([_,p,h,m],c),r.deepEqual([g(3,0,8)],s),e=["a1,a2","b1,b2","c1,c2","#comment","d1,d2"],t=new u(e),n=null,i=",",o=new d.Range(2,0,2,0),l=a.parse_document_range_rfc(d,t,i,"#",o),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,5)]],p=[[g(1,0,3)],[g(1,3,5)]],h=[[g(2,0,3)],[g(2,3,5)]],m=[[g(4,0,3)],[g(4,3,5)]],r.deepEqual([_,p,h,m],c),r.deepEqual([g(3,0,8)],s),e=['a1,"a2',"b1,b2","c1,c2",'d1",d2'],t=new u(e),n=null,i=",",o=new d.Range(0,0,4,0),l=a.parse_document_range_rfc(d,t,i,n,o,100),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,6),g(1,0,5),g(2,0,5),g(3,0,4)],[g(3,4,6)]],r.deepEqual([_],c),r.deepEqual([],s),e=['a1,a2,"a3','#b1","b2"",b3",b4,"b5','c1,c2"'],t=new u(e),n=null,i=",",o=new d.Range(0,0,4,0),l=a.parse_document_range_rfc(d,t,i,"#",o,100),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,6)],[g(0,6,9),g(1,0,5)],[g(1,5,15)],[g(1,15,18)],[g(1,18,21),g(2,0,6)]],r.deepEqual([_],c),r.deepEqual([],s),e=['a1,"a2',"b1,b2","c1,c2",'d1,d2"',"e1,e2"],t=new u(e),n=null,i=",",o=new d.Range(1,0,20,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(4,0,3)],[g(4,3,5)]],r.deepEqual([_],c),r.deepEqual([],s),e=['a1,"a2',"b1,b2","c1,c2",'d1,d2"',"e1,e2"],t=new u(e),n=null,i=",",o=new d.Range(0,0,20,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,6),g(1,0,5),g(2,0,5),g(3,0,6)]],p=[[g(4,0,3)],[g(4,3,5)]],r.deepEqual([_,p],c),r.deepEqual([],s),e=["a1,a2","b1,b2",'c1,"c2',"d1,d2","e1,e2",'f1,f2"'],t=new u(e),n=null,i=",",o=new d.Range(0,0,5,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,5)]],p=[[g(1,0,3)],[g(1,3,5)]],r.deepEqual([_,p],c),r.deepEqual([],s),e=["a1,a2","b1,b2",'c1,"c2',"d1,d2","e1,e2",'f1,f2"'],t=new u(e),n=null,i=",",o=new d.Range(0,0,6,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,5)]],p=[[g(1,0,3)],[g(1,3,5)]],h=[[g(2,0,3)],[g(2,3,6),g(3,0,5),g(4,0,5),g(5,0,6)]],r.deepEqual([_,p,h],c),r.deepEqual([],s),e=['a1,"a2',"b1,b2",'c1","c2',"d1,d2","#hello world","e1,e2",'f1",f2'],t=new u(e),n=null,i=",",o=new d.Range(0,0,6,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),r.deepEqual([],c),r.deepEqual([],s),e=['a1,"a2',"b1,b2",'c1","c2',"d1,d2","#hello world","e1,e2",'f1",f2'],t=new u(e),n=null,i=",",o=new d.Range(1,0,6,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(1,0,3)],[g(1,3,5)]],p=[[g(3,0,3)],[g(3,3,5)]],h=[[g(5,0,3)],[g(5,3,5)]],r.deepEqual([_,p,h],c),r.deepEqual([g(4,0,12)],s),e=['a1,"a2',"b1,b2",'c1","c2',"d1,d2","#hello world","e1,e2",'f1",f2'],t=new u(e),n=null,i=",",o=new d.Range(1,0,7,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),r.deepEqual([],c),r.deepEqual([],s),e=['a1,"a2',"b1,b2",'c1","c2',"d1,d2","#hello world","e1,e2",'f1",f2'],t=new u(e),n=null,i=",",o=new d.Range(0,0,7,0),l=a.parse_document_range_rfc(d,t,i,"#",o,0),[s,c]=f(l),_=[[g(0,0,3)],[g(0,3,6),g(1,0,5),g(2,0,4)],[g(2,4,7),g(3,0,5),g(4,0,12),g(5,0,5),g(6,0,4)],[g(6,4,6)]],r.deepEqual([_],c),r.deepEqual([],s),e=['a1;"a2',"b1;b2",'c1";c2',"d1;d2","#hello world","e1;e2",'f1;"f2',"g1;g2",'h1";h2'],t=new u(e),n="#",i=";",o=new d.Range(1,0,8,0),l=a.parse_document_range_rfc(d,t,i,n,o,0),[s,c]=f(l),p=[[g(3,0,3)],[g(3,3,5)]],h=[[g(5,0,3)],[g(5,3,5)]],r.deepEqual([p,h],c),r.deepEqual([g(4,0,12)],s)}(),r(a.is_opening_rfc_line('a1,"a2',",")),r(a.is_opening_rfc_line('a1;"a2',";")),r(a.is_opening_rfc_line('a1, " a2',",")),r(a.is_opening_rfc_line('a1 , " a2',",")),r(a.is_opening_rfc_line('a1,a1,a1 , " a2',",")),r(a.is_opening_rfc_line('a1,"a1,a1 ", " a2',",")),r(a.is_opening_rfc_line('a1,"a1,a1 " , " a2',",")),r(!a.is_opening_rfc_line("a1,a2",",")),r(!a.is_opening_rfc_line('a1",a2',",")),r(!a.is_opening_rfc_line("a1;a2",";")),r(!a.is_opening_rfc_line('a1";a2',";")),r(a.is_opening_rfc_line('",a2,a3',",")),r(!a.is_opening_rfc_line('abcd"',",")),r(!a.is_opening_rfc_line('abcd",ab',",")),r(!a.is_opening_rfc_line('ab,cd",ab',",")),r(!a.is_opening_rfc_line('ab""x""cd",ab',",")),r(!a.is_opening_rfc_line('a1,"a2,a3""a4,a5""",a6,a7',",")),r(a.is_opening_rfc_line('"',",")),r(a.is_opening_rfc_line('",',",")),r(a.is_opening_rfc_line(',"',",")),r(a.is_opening_rfc_line('a,"',",")),r(!a.is_opening_rfc_line('a,a"',",")),function(){let[e,t,n,i,o,l,s,c,_]=[null,null,null,null,null,null,null,null,null],d="fake_doc.txt";e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2"],i=",",n="#",l=10,t=new u(e,d),requested_start_record=-100,s=new Map,c=new Object,_="simple",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,0),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"],["d1","d2"]],c.preview_records),r(!s.has(d)),e=['a1,"a2','b1",b2',"#comment",'c1,"c2',"d1,d2"],i=",",n="#",l=10,t=new u(e,d),requested_start_record=0,s=new Map,c=new Object,_="quoted_rfc",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r(!c.actual_start_record),r(!c.preview_records),r.equal(c.preview_sampling_error,"Double quotes are not consistent in record 2 which starts at line 4"),r(!s.has(d)),e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2","e1,e2"],i=",",n="#",l=10,t=new u(e,d),requested_start_record=3,s=new Map,c=new Object,_="simple",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,0),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"],["d1","d2"],["e1","e2"]],c.preview_records),r(!s.has(d)),e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2","e1,e2"],i=",",n="#",l=4,t=new u(e,d),requested_start_record=3,s=new Map,c=new Object,_="simple",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,1),r.deepEqual([["b1","b2"],["c1","c2"],["d1","d2"],["e1","e2"]],c.preview_records),r(!s.has(d)),e=["1".repeat(251)+","+"2".repeat(251)],i=",",n="#",l=4,t=new u(e,d),requested_start_record=3,s=new Map,c=new Object,_="simple",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,0),r.deepEqual([["1".repeat(250)+"###UI_STRING_TRIM_MARKER###","2".repeat(250)+"###UI_STRING_TRIM_MARKER###"]],c.preview_records),r(!s.has(d)),e=["#info","#info","#info","#info","#info","#info","#info","#info","#info","#info","a1,a2","b1,b2","#comment","c1,c2","d1,d2"],i=",",n="#",l=3,t=new u(e,d),requested_start_record=0,s=new Map,c=new Object,_="simple",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,0),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"]],c.preview_records),r(!s.has(d)),e=["a1,a2","b1,b2","c1,c2","#comment","d1,d2","e1,e2","f1,f2","g1,g2","h1,h2","i1,i2","j1,j2","k1,k2","l1,l2","m1,m2","n1,n2",'o1"",o2'],i=",",n="#",l=2,t=new u(e,d),requested_start_record=11,s=new Map,c=new Object,_="quoted_rfc",o={input_document:t,delim:i,policy:_,comment_prefix:n,requested_start_record},a.sample_preview_records_from_context(o,c,l,s),r.equal(c.preview_sampling_error,"Double quotes are not consistent in record 15 which starts at line 16"),r(s.has(d)),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"],["d1","d2"],["e1","e2"],["f1","f2"],["g1","g2"],["h1","h2"],["i1","i2"],["j1","j2"],["k1","k2"],["l1","l2"],["m1","m2"],["n1","n2"]],s.get(d)[0]),r.equal(15,s.get(d)[1]),r.equal(1,s.get(d)[2]),c=new Object,t.lines_buffer[t.lines_buffer.length-1]="o1,o2",a.sample_preview_records_from_context(o,c,l,s),r.equal(c.preview_sampling_error,"Double quotes are not consistent in record 15 which starts at line 16"),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"],["d1","d2"],["e1","e2"],["f1","f2"],["g1","g2"],["h1","h2"],["i1","i2"],["j1","j2"],["k1","k2"],["l1","l2"],["m1","m2"],["n1","n2"]],s.get(d)[0]),r.equal(15,s.get(d)[1]),r.equal(1,s.get(d)[2]),c=new Object,t.version=2,a.sample_preview_records_from_context(o,c,l,s),r.equal(c.actual_start_record,11),r.deepEqual([["l1","l2"],["m1","m2"]],c.preview_records),r.equal(c.preview_sampling_error,void 0),r.deepEqual([["a1","a2"],["b1","b2"],["c1","c2"],["d1","d2"],["e1","e2"],["f1","f2"],["g1","g2"],["h1","h2"],["i1","i2"],["j1","j2"],["k1","k2"],["l1","l2"],["m1","m2"],["n1","n2"],["o1","o2"]],s.get(d)[0]),r.equal(void 0,s.get(d)[1]),r.equal(2,s.get(d)[2])}(),function(){let[e,t,n,i,o,l]=[null,null,null,null,null,null];e={lint_results:new Map},t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}`,e.lint_results.set(lint_cache_key,{is_processing:!0,is_ok:!0}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button.is_visible,!0),r.equal(e.lint_status_bar_button.tooltip,"Processing\nClick to recheck"),e={lint_results:new Map},t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}.bad`,e.lint_results.set(lint_cache_key,{is_processing:!0}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button,void 0),e={lint_results:new Map},o=10,l=5,i=new Map([[2,0],[3,2]]),t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}`,e.lint_results.set(lint_cache_key,{first_defective_line:o,fields_info:i,first_trailing_space_line:l}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button.is_visible,!0),r.equal(e.lint_status_bar_button.tooltip,"Error. Line 10 has formatting error: double quote chars are not consistent\nClick to recheck"),e={lint_results:new Map},l=5,i=new Map([[2,0],[1,10],[4,15],[3,2]]),t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}`,e.lint_results.set(lint_cache_key,{fields_info:i,first_trailing_space_line:l}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button.is_visible,!0),r.equal(e.lint_status_bar_button.tooltip,"Error. Number of fields is not consistent: e.g. record 1 has 2 fields, and record 3 has 3 fields\nClick to recheck"),e={lint_results:new Map},l=0,t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}`,e.lint_results.set(lint_cache_key,{first_trailing_space_line:l,is_ok:!0}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button.is_visible,!0),r.equal(e.lint_status_bar_button.tooltip,'Leading/Trailing spaces detected: e.g. at line 1. Run "Shrink" command to remove them\nClick to recheck'),e={lint_results:new Map},t="fake_path.txt",n="fake_csv_language_id",lint_cache_key=`${t}.${n}`,e.lint_results.set(lint_cache_key,{is_ok:!0}),a.show_lint_status_bar_button(d,e,t,n),r.equal(e.lint_status_bar_button.is_visible,!0),r.equal(e.lint_status_bar_button.tooltip,"OK\nClick to recheck")}(),function(){let[e,t,n,i,l,s,c]=[null,null,null,null,null,null,null];e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2"],t=new u(e),n=",",i="simple",l="#",s=new o(3,3),c=a.get_cursor_position_info(d,t,n,i,l,s),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},c),e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2"],t=new u(e),n=",",i="simple",l="#",s=new o(3,2),c=a.get_cursor_position_info(d,t,n,i,l,s),r.deepEqual({column_number:0,total_columns:2,split_warning:!1},c),e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2"],t=new u(e),n=",",i="simple",l="#",s=new o(2,5),c=a.get_cursor_position_info(d,t,n,i,l,s),r.deepEqual({is_comment:!0},c),e=["a1,a2","b1,b2","#comment","c1,c2","d1,d2"],t=new u(e),n=",",i="simple",l="#",s=new o(3,4),c=a.get_cursor_position_info(d,t,n,i,l,s),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},c),e=["a1@@@a2@@@a3","b1@@@b2@@@b3","#comment","c1@@@c2@@@c3","d1@@@d2@@@d3"],t=new u(e),n="@@@",i="simple",l="#",r.deepEqual({column_number:0,total_columns:3,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,4))),r.deepEqual({column_number:1,total_columns:3,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,5))),r.deepEqual({column_number:1,total_columns:3,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,9))),r.deepEqual({column_number:2,total_columns:3,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,10))),e=["a1 a2 ","b1 b2","$$comment","$c1 c2 ","d1 d2"],t=new u(e),n=" ",i="whitespace",l="$$",r.deepEqual({column_number:0,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,0))),r.deepEqual({column_number:0,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,4))),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,5))),r.deepEqual({is_comment:!0},a.get_cursor_position_info(d,t,n,i,l,new o(2,6))),e=["a1,a2",'$b1,"b2',"$$comment",'"c1,""c1""",c2',"d1,d2"],t=new u(e),n=",",i="quoted",l="$$",r.deepEqual({column_number:0,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,11))),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,12))),r.deepEqual({column_number:1,total_columns:2,split_warning:!0},a.get_cursor_position_info(d,t,n,i,l,new o(1,4))),r.deepEqual({is_comment:!0},a.get_cursor_position_info(d,t,n,i,l,new o(2,6))),e=["a1,a2","#comment",'b1,"b2','#not a ""comment"", inside multiline field!','d1,d2"','e1,"e2,e2"','f1,"f2'],t=new u(e),n=",",i="quoted_rfc",l="#",r.deepEqual({is_comment:!0},a.get_cursor_position_info(d,t,n,i,l,new o(1,6))),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(3,6))),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(4,5))),r.deepEqual({column_number:1,total_columns:2,split_warning:!1},a.get_cursor_position_info(d,t,n,i,l,new o(5,3))),r.equal(null,a.get_cursor_position_info(d,t,n,i,l,new o(6,1))),r.equal(null,a.get_cursor_position_info(d,t,n,i,l,new o(6,3)))}(),function(){let[e,t]=[null,null],n=null,[i,o]=[null,null];e=["hello","world"],t=[{record_num:0,comment_text:"#foo"},{record_num:2,comment_text:"#bar1"},{record_num:2,comment_text:"#bar2"}],n=new a.RecordCommentMerger(e,t),i=h(n),o=[[null,"#foo"],["hello",null],["world",null],[null,"#bar1"],[null,"#bar2"]],r.deepEqual(o,i),e=[],t=[{record_num:0,comment_text:"#foo"},{record_num:2,comment_text:"#bar1"},{record_num:2,comment_text:"#bar2"}],n=new a.RecordCommentMerger(e,t),i=h(n),o=[[null,"#foo"],[null,"#bar1"],[null,"#bar2"]],r.deepEqual(o,i),e=["hello","world"],t=[],n=new a.RecordCommentMerger(e,t),i=h(n),o=[["hello",null],["world",null]],r.deepEqual(o,i),e=[],t=[],n=new a.RecordCommentMerger(e,t),i=h(n),o=[],r.deepEqual(o,i)}(),function(){let[e,t,n,i,s,c,_]=[null,null,null,null,null,null,null],[p,f,g]=[null,null,null],[h,m,w]=[null,null,null];e=["type,weight,color","car,100,yellow","ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal(null,g),h=[new l(new o(0,5),new o(0,5)),new l(new o(1,4),new o(1,4)),new l(new o(2,5),new o(2,5))],r.deepEqual(h,p),e=["type,weight,color","car,100,yellow","ship,20000,red"],t=new u(e),s="#",n=",",i="quoted_rfc",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal(null,g),h=[new l(new o(0,5),new o(0,5)),new l(new o(1,4),new o(1,4)),new l(new o(2,5),new o(2,5))],r.deepEqual(h,p),e=["type,weight,color",'car,100,"yellow',' and black"',"ship,20000,red"],t=new u(e),s="#",n=",",i="quoted_rfc",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal("Column edit mode is not supported for files with multiline fields",f),e=["type,weight,color","car,100,yellow","#hello world","ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal(null,g),h=[new l(new o(0,5),new o(0,5)),new l(new o(1,4),new o(1,4)),new l(new o(3,5),new o(3,5))],r.deepEqual(h,p),e=["type,weight,color",'car,100,yellow " red',"ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal("Unable to enter column edit mode: quoting error at line 2",f),r.equal(null,g),r.deepEqual(null,p),e=["type,weight,color","car,100,yellow","rocket,1000","ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_before",_=2,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal("Line 3 doesn't have field number 3",f),r.equal(null,g),r.deepEqual(null,p),e=["type,weight,color",'car,"100",yellow',"ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_before",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal("Be careful, cursor at line 2 has a double quote is in proximity.",g),h=[new l(new o(0,5),new o(0,5)),new l(new o(1,4),new o(1,4)),new l(new o(2,5),new o(2,5))],r.deepEqual(h,p),e=["type,weight,color",'car,"100",yellow',"ship,20000,red"],t=new u(e),s="#",n=",",i="quoted",c="ce_after",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal("Be careful, cursor at line 2 has a double quote is in proximity.",g),h=[new l(new o(0,11),new o(0,11)),new l(new o(1,9),new o(1,9)),new l(new o(2,10),new o(2,10))],r.deepEqual(h,p),e=["type\tweight\tcolor","car\t\tyellow","ship\t20000\tred"],t=new u(e),s="#",n="\t",i="simple",c="ce_select",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal("Be careful, Field 2 at line 2 is empty.",g),h=[new l(new o(0,5),new o(0,11)),new l(new o(1,4),new o(1,4)),new l(new o(2,5),new o(2,10))],r.deepEqual(h,p),e=["type|weight|color",'car|"100"|yellow',"ship|20000|red"],t=new u(e),s="#",n="|",i="simple",c="ce_after",_=1,[p,f,g]=a.generate_column_edit_selections(d,t,n,i,s,c,_),r.equal(null,f),r.equal(null,g),h=[new l(new o(0,11),new o(0,11)),new l(new o(1,9),new o(1,9)),new l(new o(2,10),new o(2,10))],r.deepEqual(h,p)}()},t.VscodePositionTestDouble=o,t.VscodeRangeTestDouble=s,t.VscodeDocumentTestDouble=u,t.vscode_test_double=d},1398:e=>{"use strict";e.exports=require("vscode")},8364:()=>{},9135:()=>{},1820:()=>{},7349:()=>{},6510:()=>{},9175:()=>{},2196:()=>{},7507:()=>{},7560:()=>{},9209:(e,t,n)=>{"use strict";var r=n(6578),a="undefined"==typeof globalThis?n.g:globalThis;e.exports=function(){for(var e=[],t=0;t<r.length;t++)"function"==typeof a[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__(4148),n=__webpack_require__(7349),r=__webpack_require__(1398),a=(__webpack_require__(785),__webpack_require__(7181)),i=__webpack_require__(4012),o=void 0===n.homedir,l=6e3;function s(e){return new Promise((t=>setTimeout(t,e)))}async function c(){await s(200),await r.commands.executeCommand("cursorTop")}function u(e){console.log("###RAINBOW_CSV_UNIT_TEST_MESSAGE### "+e)}async function _(e){let[n,a,i,_]=[null,null,null,null];n=r.Uri.joinPath(e,"csv_files","countries_with_comments.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3),_=await r.commands.executeCommand("rainbow-csv.CSVLint"),t(!_.is_ok),await c(),await r.commands.executeCommand("cursorRightSelect"),await r.commands.executeCommand("cursorRightSelect"),await s(1e3),await r.commands.executeCommand("rainbow-csv.SetCommentPrefix"),await s(1500),_=await r.commands.executeCommand("rainbow-csv.CSVLint"),t(_.is_ok),await s(1e3),await r.commands.executeCommand("cursorTop"),await r.commands.executeCommand("cursorRight"),await r.commands.executeCommand("cursorRight"),await s(500),await r.commands.executeCommand("editor.action.commentLine"),_=await r.commands.executeCommand("rainbow-csv.CSVLint"),t(!_.is_ok),await s(1e3),await r.commands.executeCommand("editor.action.commentLine"),_=await r.commands.executeCommand("rainbow-csv.CSVLint"),t(_.is_ok),await s(1e3),await r.commands.executeCommand("undo"),await r.commands.executeCommand("undo"),await s(1e3),await r.commands.executeCommand("rainbow-csv.RBQL",{rbql_backend:"js",rbql_query:"SELECT a.Country, a.Population",with_headers:!0,integration_test_delay:1500}),await s(l),a=r.window.activeTextEditor.document;let d=a.lineCount;u(`Length after js query: ${d}`);let p=11;o||(p+=1),t.equal(p,d)}e.run=async function(){try{u("Starting tests"),t.equal(-1,[1,2,3].indexOf(0));let e=null;t(r.workspace.workspaceFolders),t.equal(1,r.workspace.workspaceFolders.length),e=r.workspace.workspaceFolders[0].uri;let n=e;if(function(){let[e,n,i,o]=[null,null,null,null];e=new r.Range(1,0,1,10),n=new r.Position(1,4),i=new a.VscodeRangeTestDouble(1,0,1,10),o=new a.VscodePositionTestDouble(1,4),t(e.contains(n)),t(i.contains(o)),e=new r.Range(1,0,1,10),n=new r.Position(2,4),i=new a.VscodeRangeTestDouble(1,0,1,10),o=new a.VscodePositionTestDouble(2,4),t(!e.contains(n)),t(!i.contains(o)),e=new r.Range(3,5,3,10),n=new r.Position(3,11),i=new a.VscodeRangeTestDouble(3,5,3,10),o=new a.VscodePositionTestDouble(3,11),t(!e.contains(n)),t(!i.contains(o)),e=new r.Range(3,5,3,10),n=new r.Position(3,10),i=new a.VscodeRangeTestDouble(3,5,3,10),o=new a.VscodePositionTestDouble(3,10),t(e.contains(n)),t(i.contains(o)),e=new r.Range(3,5,3,10),n=new r.Position(3,5),i=new a.VscodeRangeTestDouble(3,5,3,10),o=new a.VscodePositionTestDouble(3,5),t(e.contains(n)),t(i.contains(o)),e=new r.Range(3,5,3,10),n=new r.Position(2,5),i=new a.VscodeRangeTestDouble(3,5,3,10),o=new a.VscodePositionTestDouble(2,5),t(!e.contains(n)),t(!i.contains(o)),e=new r.Range(3,5,10,4),n=new r.Position(3,100),i=new a.VscodeRangeTestDouble(3,5,10,4),o=new a.VscodePositionTestDouble(3,100),t(e.contains(n)),t(i.contains(o))}(),a.test_all(),function(){let[e,n,r,o,l]=[null,null,null,null,null];e=["a1;a2","b1;b2","#comment","c1;c2","d1;d2"],n=new a.VscodeDocumentTestDouble(e),r=[",",";"],o=1e4,l=i.autodetect_dialect_frequency_based(n,r,o),t.deepEqual(["csv (semicolon)",";","quoted"],l),e=[],n=new a.VscodeDocumentTestDouble(e),r=["|"," ","\t",",",";"],o=1e4,l=i.autodetect_dialect_frequency_based(n,r,o),t.deepEqual(["csv",",","quoted"],l),e=["a|b|c|d,f|g|h|d","a,b","c,d","e,f","g,h","k,l","m,n","o,p"],n=new a.VscodeDocumentTestDouble(e),r=["|",",",";"],t.deepEqual(["csv (pipe)","|","simple"],i.autodetect_dialect_frequency_based(n,r,10)),t.deepEqual(["csv",",","quoted"],i.autodetect_dialect_frequency_based(n,r,1e4)),e=["a$b","c$d","e$f","g,h","k,l"],n=new a.VscodeDocumentTestDouble(e),r=["$",",",";"],t.deepEqual(["dynamic csv","$","simple"],i.autodetect_dialect_frequency_based(n,r,1e4)),e=["a; b...","c ;d...","e ;f...","g ; h...","k l..."],n=new a.VscodeDocumentTestDouble(e),r=[" ",".",";"],t.deepEqual(["csv (semicolon)",";","quoted"],i.autodetect_dialect_frequency_based(n,r,1e4)),e=["a|b","c|d","e|f"],n=new a.VscodeDocumentTestDouble(e),r=[";","\t"],t.deepEqual(["csv",",","quoted"],i.autodetect_dialect_frequency_based(n,r,1e4)),e=["a|b","c|d","e|f"],n=new a.VscodeDocumentTestDouble(e),r=[],t.deepEqual(["csv",",","quoted"],i.autodetect_dialect_frequency_based(n,r,1e4))}(),await async function(){let[e,n,r,o]=[null,null,null,null];r=["a|b","c|d ","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set(["other_fake.txt"])},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv (pipe)",o.languageId),t.deepEqual([["fake.txt.csv (pipe)",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f","g,h"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!1],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a\tb","c\td","e\tf"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!1],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set(["fake.txt"])},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.git","plaintext","git"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","foobar"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("foobar",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.csv","csv"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv (pipe)",o.languageId),t.deepEqual([["fake.csv.csv (pipe)",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a,b",'c,"d','a""sd""f','ef"',"g,h","i,j"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("dynamic csv",o.languageId),t.deepEqual([["fake.txt.dynamic csv",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([["fake.txt",{delim:",",policy:"quoted_rfc"}]],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b",'c|"d','a""sd""f','ef"',"g|h","i|j"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","c |d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set(["other_fake.txt"])},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!0],["autodetection_min_line_count",3],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv (pipe)",o.languageId),t.deepEqual([["fake.txt.csv (pipe)",{is_ok:!0,first_trailing_space_line:1}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",4],["comment_prefix","#"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a|b","#comment","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv (pipe)",o.languageId),t.deepEqual([["fake.txt.csv (pipe)",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b","$$comment","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","$$"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv (pipe)",o.languageId),t.deepEqual([["fake.txt.csv (pipe)",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b","$$comment","c|d","e|f"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a,b\tc\td","a,b\tc\td","a,b\tc\td","a,b\tc\td"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",","TAB"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3],["comment_prefix","$$"]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("tsv",o.languageId),t.deepEqual([["fake.txt.tsv",{is_ok:!0,first_trailing_space_line:null}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([["fake.txt","plaintext"]],Array.from(n.original_language_ids.entries())),r=["a|b","c|d","e|f","e|f|g"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a,b","c,d",'e,"fsdf""',"g,h"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",",";","\t","|"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a,b,c","a,b,c","a,b,c","a,b\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc"],o=new a.VscodeDocumentTestDouble(r,"fake.csv","csv"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",","TAB"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("tsv",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["a,b,c","a,b,c","a,b ,c","#comment"],o=new a.VscodeDocumentTestDouble(r,"fake.csv","csv"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",","TAB"]],["csv_lint_detect_trailing_spaces",!0],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("csv",o.languageId),t.deepEqual([["fake.csv.csv",{is_ok:!0,first_trailing_space_line:2}]],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=["Device ids, use with caution!","#a20","#a50","#a30"],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",","TAB"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries())),r=['hello,"world',"asd,fasf","","sadf",'fasdf"'],o=new a.VscodeDocumentTestDouble(r,"fake.txt","plaintext"),n={lint_results:new Map,dynamic_document_dialects:new Map,original_language_ids:new Map,autodetection_stoplist:new Set},e=new Map([["enable_separator_autodetection",!0],["autodetect_separators",[",","TAB"]],["csv_lint_detect_trailing_spaces",!1],["autodetection_min_line_count",3]]),await i.try_autodetect_and_set_rainbow_filetype(a.vscode_test_double,e,n,o),t.equal("plaintext",o.languageId),t.deepEqual([],Array.from(n.lint_results.entries())),t.deepEqual([],Array.from(n.dynamic_document_dialects.entries())),t.deepEqual([],Array.from(n.original_language_ids.entries()))}(),await async function(e){let n=r.Uri.joinPath(e,"csv_files","lorem_ipsum.txt"),a=await r.workspace.openTextDocument(n);u(`languageId for lorem_ipsum.txt: ${a.languageId}`),t.equal(a.languageId,"plaintext");let i=await r.window.showTextDocument(a);await s(1e3),n=r.Uri.joinPath(e,"suite","index.js"),a=await r.workspace.openTextDocument(n),u(`languageId for index.js: ${a.languageId}`),t.equal(a.languageId,"javascript"),i=await r.window.showTextDocument(a),await s(1e3),n=r.Uri.joinPath(e,"csv_files","lorem_ipsum"),a=await r.workspace.openTextDocument(n),u(`languageId for lorem_ipsum: ${a.languageId}`),t.equal(a.languageId,"plaintext"),i=await r.window.showTextDocument(a),await s(1e3)}(n),!o){let e=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(!e.lazy_loaded)}if(await async function(e){let n=r.Uri.joinPath(e,"csv_files","university_ranking_semicolon.txt"),a=await r.workspace.openTextDocument(n);await r.window.showTextDocument(a),u(`languageId for university_ranking_semicolon.txt: ${a.languageId}`),t.equal(a.languageId,"csv (semicolon)"),await s(1e3)}(n),await async function(e){let n=r.Uri.joinPath(e,"csv_files","small_movies.pipe"),a=await r.workspace.openTextDocument(n);u(`languageId for small_movies.pipe: ${a.languageId}`),t.equal(a.languageId,"plaintext"),await r.window.showTextDocument(a),await c(),await s(1e3);for(let e=0;e<6;e++)await r.commands.executeCommand("cursorRight");await r.commands.executeCommand("cursorRightSelect"),await s(1e3),await r.commands.executeCommand("rainbow-csv.RainbowSeparator",{integration_test:!0}),await s(4e3),u(`languageId for small_movies.pipe after RainbowSeparator: ${a.languageId}`),t.equal(a.languageId,"dynamic csv"),await r.commands.executeCommand("rainbow-csv.RainbowSeparatorOff"),await s(2e3),u(`languageId for small_movies.pipe after RainbowSeparatorOff: ${a.languageId}`),t.equal(a.languageId,"plaintext"),await s(1e3)}(n),await async function(e){let n=performance.now(),a=r.Uri.joinPath(e,"csv_files","books_huge.txt"),i=await r.workspace.openTextDocument(a);await r.window.showTextDocument(i),t.equal(i.languageId,"csv"),await r.commands.executeCommand("cursorBottom"),await s(500),await r.commands.executeCommand("cursorTop"),await s(500);for(let e=0;e<100;e++)await r.commands.executeCommand("scrollPageDown"),await s(10);for(let e=0;e<10;e++)await r.commands.executeCommand("editor.action.deleteLines"),await s(10);await s(500),await r.commands.executeCommand("cursorTop"),await s(500);let o=performance.now()-n-900;u(`total adjusted latency: ${o}`),t(o<2e4)}(n),await async function(e){let n=r.Uri.joinPath(e,"csv_files","movies_multichar_separator.txt"),a=await r.workspace.openTextDocument(n);u(`languageId for movies_multichar_separator.txt: ${a.languageId}`),t.equal(a.languageId,"plaintext"),await r.window.showTextDocument(a),await c(),await s(1e3);for(let e=0;e<6;e++)await r.commands.executeCommand("cursorRight");for(let e=0;e<3;e++)await r.commands.executeCommand("cursorRightSelect");await s(1e3);let i={integration_test:!0};await r.commands.executeCommand("rainbow-csv.RainbowSeparator",i),await s(4e3),u(`languageId for small_movies.pipe after RainbowSeparator: ${a.languageId}`),t.equal(a.languageId,"dynamic csv"),await r.commands.executeCommand("rainbow-csv.RainbowSeparatorOff"),await s(2e3),u(`languageId for small_movies.pipe after RainbowSeparatorOff: ${a.languageId}`),t.equal(a.languageId,"plaintext"),await s(1e3),await r.commands.executeCommand("rainbow-csv.RainbowSeparator",i),await s(4e3),await r.commands.executeCommand("scrollPageDown"),await s(500),await r.commands.executeCommand("scrollPageUp"),await s(500);let _=a.getText().length;await r.commands.executeCommand("rainbow-csv.Align");let d=a.getText().length;t.equal(_+8513,d),await s(1e3),await r.commands.executeCommand("rainbow-csv.Shrink"),await s(1e3);let p=a.getText().length;t.equal(_,p),await r.commands.executeCommand("undo"),await s(500),await r.commands.executeCommand("undo"),await s(500),await r.commands.executeCommand("rainbow-csv.RBQL",{rbql_backend:"js",rbql_query:"select a1, a4 % 100, a5 order by a1 limit 20"}),await s(l),a=r.window.activeTextEditor.document;let f=a.getText().length;u(`Length after js query: ${f}`),await s(1e3);let g=742;o||(g+=1),t.equal(g,f)}(n),o?await async function(e){let[n,a,i]=[null,null,null];await _(e),n=r.Uri.joinPath(e,"csv_files","university_ranking.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3);let o={rbql_backend:"js",with_headers:!0,rbql_query:"select top 20 a1, Math.ceil(parseFloat(a.total_score) * 100), a['university_name'], null, 'foo bar' order by a2"};await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l);let c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["null values in output were replaced by empty strings"]',JSON.stringify(c.warnings)),a=r.window.activeTextEditor.document;let d=a.getText().length;u(`Length after first js query: ${d}`),t.equal(846,d),o={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),a=r.window.activeTextEditor.document,d=a.getText().length,u(`Length after second js query: ${d}`),t.equal(267,d),o={rbql_backend:"js",rbql_query:"select nonexistent_function(a1)"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",c.error_type),t.equal("At record 1, Details: nonexistent_function is not defined",c.error_msg),u("Starting multiline records test"),n=r.Uri.joinPath(e,"csv_files","synthetic_rfc_newline_data.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3),o={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),a=r.window.activeTextEditor.document,d=a.getText().length,u(`Length after js multiline-record query: ${d}`),t.equal(644,d)}(n):await async function(e){let[n,a,i]=[null,null,null];await _(e),await async function(e){let[n,a,i,o]=[null,null,null,null];n=r.Uri.joinPath(e,"csv_files","countries_with_comments.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3),await r.commands.executeCommand("rainbow-csv.RBQL",{rbql_backend:"python",rbql_query:"SELECT '[{}]'.format(a.Country), int(a.Population) / 10",with_headers:!0,integration_test_delay:1500}),await s(l),a=r.window.activeTextEditor.document;let c=a.lineCount;u(`Length after python query: ${c}`),t.equal(12,c)}(e),n=r.Uri.joinPath(e,"csv_files","university_ranking.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3);let o={rbql_backend:"python",with_headers:!0,rbql_query:"select top 20 a1, math.ceil(float(a.total_score) * 100), a['university_name'], None, 'foo bar' order by a2"};await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l);let c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["None values in output were replaced by empty strings"]',JSON.stringify(c.warnings)),a=r.window.activeTextEditor.document;let d=a.getText().length;u(`Length after python query: ${d}`),t.equal(868,d),o={rbql_backend:"js",with_headers:!1,rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),a=r.window.activeTextEditor.document,d=a.getText().length,u(`Length after js query: ${d}`),t.equal(268,d),o={rbql_backend:"python",rbql_query:"select nonexistent_function(a1)"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",c.error_type),t.equal("At record 1, Details: name 'nonexistent_function' is not defined",c.error_msg),n=r.Uri.joinPath(e,"csv_files","synthetic_rfc_newline_data.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3),t.equal(a.languageId,"dynamic csv"),o={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),a=r.window.activeTextEditor.document,d=a.getText().length,u(`Length after js multiline-record query: ${d}`),t.equal(645,d),n=r.Uri.joinPath(e,"csv_files","university_ranking.csv"),a=await r.workspace.openTextDocument(n),i=await r.window.showTextDocument(a),await s(1e3),o={rbql_backend:"python",with_headers:!0,rbql_query:"select a.university_name, b.Country, b.Population, b['GDP per capita'] JOIN countries.csv on a.country == b.Country order by int(b.Population) desc"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),t.equal('["The first record in JOIN file countries.csv was also treated as header (and skipped)"]',JSON.stringify(c.warnings)),a=r.window.activeTextEditor.document,d=a.getText().length,u(`Length after join query: ${d}`),t.equal(11592,d),t.equal(202,a.lineCount),n=r.Uri.joinPath(e,"csv_files","countries.csv"),a=await r.workspace.openTextDocument(n);let p=a.fileName,f=a.getText().length;i=await r.window.showTextDocument(a),t(-1==a.getText().indexOf("oceania")),t(a.getText().indexOf("OCEANIA")>0),await s(1e3),o={rbql_backend:"python",with_headers:!0,rbql_query:"UPDATE set a.Region = a.Region.lower()"},await r.commands.executeCommand("rainbow-csv.RBQL",o),await s(l),c=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),t.equal("[]",JSON.stringify(c.warnings)),a=r.window.activeTextEditor.document,a.fileName,d=a.getText().length,u(`Length after update query: ${d}`),t.equal(f,d-a.lineCount+1),t(-1==a.getText().indexOf("OCEANIA")),t(a.getText().indexOf("oceania")>0),await s(1e3),await r.commands.executeCommand("rainbow-csv.CopyBack"),await s(1e3),a=await r.workspace.openTextDocument(n);let g=a.fileName;t.equal(p,g),t(-1==a.getText().indexOf("OCEANIA")),t(a.getText().indexOf("oceania")>0)}(n),!o){let e=await r.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(e.lazy_loaded)}await async function(e){let n=r.Uri.joinPath(e,"csv_files","university_ranking.csv"),a=await r.workspace.openTextDocument(n),i=(await r.window.showTextDocument(a),a.getText().length);u(`Original length: ${i}`),t.equal(12538,i),await s(2e3),await r.commands.executeCommand("rainbow-csv.Align");let o=a.getText().length;u(`Aligned length: ${o}`),t.equal(25896,o),t(o>i);let l=await r.commands.executeCommand("rainbow-csv.CSVLint");t(l.is_ok),await s(2e3),await r.commands.executeCommand("rainbow-csv.Shrink");let c=a.getText().length;u(`Shrinked length: ${c}`),t.equal(i,c),await s(500);await r.commands.executeCommand("default:type",{text:"foobar,"}),l=await r.commands.executeCommand("rainbow-csv.CSVLint"),t(l.fields_info.size>1),await s(500);for(let e=0;e<7;e++)await r.commands.executeCommand("deleteLeft");await s(500)}(n),await async function(e){let n=r.Uri.joinPath(e,"csv_files","double_width_chars.csv"),a=await r.workspace.openTextDocument(n),i=(await r.window.showTextDocument(a),a.getText().length);u(`Original length: ${i}`),t.equal(274,i),await s(2e3),await r.commands.executeCommand("rainbow-csv.Align");let o=a.getText().length;u(`Aligned length: ${o}`),t.equal(461,o),t(o>i);let l=await r.commands.executeCommand("rainbow-csv.CSVLint");t(l.is_ok),await s(2e3),await r.commands.executeCommand("rainbow-csv.Shrink");let c=a.getText().length;u(`Shrinked length: ${c}`),t.equal(i,c),await s(500)}(n),await async function(e){let n=r.Uri.joinPath(e,"csv_files","movies.txt"),a=await r.workspace.openTextDocument(n),i=(await r.window.showTextDocument(a),a.getText().length);t.equal(9986,i),await c();for(let e=0;e<10;e++)await r.commands.executeCommand("cursorRight");await s(1e3),await r.commands.executeCommand("rainbow-csv.ColumnEditAfter"),await s(1e3);await r.commands.executeCommand("default:type",{text:"foobar,"});let o=a.getText().length;t.equal(i+7*a.lineCount,o),await s(1e3);for(let e=0;e<7;e++)await r.commands.executeCommand("deleteLeft");await s(1e3);let l=a.getText().length;t.equal(i,l)}(n),u("Finishing tests")}catch(e){u("Error: tests have failed. Exception:"),u(String(e)),u(String(e.stack))}}})();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})})(); |